| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/test20.chuangfenglink.xyz/wp-content/themes/woodmart/inc/shortcodes/ |
Upload File : |
<?php
/**
* Shortcode for 3D view element.
*
* @package woodmart
*/
if ( ! defined( 'WOODMART_THEME_DIR' ) ) {
exit( 'No direct script access allowed' );
}
if ( ! function_exists( 'woodmart_shortcode_3d_view' ) ) {
/**
* 3D view shortcode.
*
* @param array $atts Shortcode attributes.
*
* @return string
*/
function woodmart_shortcode_3d_view( $atts ) {
$click = '';
$output = '';
$class = '';
extract( // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
shortcode_atts(
array(
'images' => '',
'img_size' => 'full',
'title' => '',
'style' => '',
'el_class' => '',
),
$atts
)
);
$id = wp_rand( 100, 999 );
$images = explode( ',', $images );
$class .= ' ' . $el_class;
$frames_count = count( $images );
if ( $frames_count < 2 ) {
return;
}
ob_start();
woodmart_enqueue_js_library( 'threesixty' );
woodmart_enqueue_js_script( 'view3d-element' );
woodmart_enqueue_inline_style( '360degree' );
$args = array(
'frames_count' => count( $images ),
'images' => array(),
'width' => '',
'height' => '',
);
foreach ( $images as $img_id ) {
$img = wp_get_attachment_image_src( $img_id, $img_size );
$args['width'] = isset( $img[1] ) ? $img[1] : '';
$args['height'] = isset( $img[2] ) ? $img[2] : '';
$args['images'][] = isset( $img[0] ) ? $img[0] : '';
}
?>
<div class="wd-threed-view<?php echo esc_attr( $class ); ?> threed-id-<?php echo esc_attr( $id ); ?>" data-args='<?php echo wp_json_encode( $args ); ?>'>
<?php if ( ! empty( $title ) ) : ?>
<h3 class="threed-title"><span><?php echo wp_kses( $title, woodmart_get_allowed_html() ); ?></span></h3>
<?php endif ?>
<ul class="threed-view-images"></ul>
<div class="spinner">
<span>0%</span>
</div>
</div>
<?php
$output = ob_get_contents();
ob_end_clean();
return $output;
}
}