hotspot = new WPVR_Hotspot(); $this->format = new WPVR_Format(); $this->validator = new WPVR_Validator(); $this->status = apply_filters( 'check_pro_license_status', $this->status ); if ($this->status !== false && $this->status == 'valid') { $this->data_limit = 999999999; } else { $this->data_limit = 5; } } /** * Render Scene Settings Content * * @param array $postdata * * @return void * @since 8.0.0 */ public function render_scene($postdata) { ob_start(); ?>
Warning: Please add SSL to enable Gyroscope for WP VR.
'); die(); } $gyro = true; $deviceorientationcontrol = $this->format->set_checkbox_value(@$_POST['deviceorientationcontrol']); } else { $gyro = false; $deviceorientationcontrol = false; } //===Gyroscopre control===// $autoload = $this->format->set_checkbox_value($_POST['autoload']); $control = $this->format->set_checkbox_value($_POST['control']); $scene_fade_duration = $_POST['scenefadeduration']; $preview = esc_url($_POST['preview']); $rotation = sanitize_text_field($_POST['rotation']); $autorotation = sanitize_text_field($_POST['autorotation']); $autorotationinactivedelay = sanitize_text_field($_POST['autorotationinactivedelay']); $autorotationstopdelay = sanitize_text_field($_POST['autorotationstopdelay']); //===generic form===// $genericform = sanitize_text_field(isset($_POST['genericform']) ? $_POST['genericform'] : 'off'); $genericformshortcode = isset($_POST['genericformshortcode']) ? $_POST['genericformshortcode'] : '' ; //===generic form===// if(isset($_POST['rotation']) && sanitize_text_field($_POST['rotation']) === 'on' ) { $this->validator->basic_setting_validation($autorotationinactivedelay, $autorotationstopdelay); // Basic setting error control and validation // } //===Company Logo===// $cpLogoSwitch = isset($_POST['cpLogoSwitch']) ? $_POST['cpLogoSwitch'] : 'off'; $cpLogoImg = isset($_POST['cpLogoImg']) ? $_POST['cpLogoImg'] : ''; $cpLogoContent = isset($_POST['cpLogoContent']) ? sanitize_text_field($_POST['cpLogoContent']) : ''; //===Company Logo===// //===Explainer video===// $explainerSwitch = isset($_POST['explainerSwitch']) ? $_POST['explainerSwitch'] : 'off'; $explainerContent = ''; $explainerContent = isset($_POST['explainerContent']) ? $_POST['explainerContent'] : ''; //===Explainer video===// $scene_fade_duration = ''; $scene_fade_duration = $_POST['scenefadeduration']; $this->validator->scene_validation($panodata); // Scene content error control and validation // $this->validator->empty_scene_validation($panodata); // Empty scene content error control and validation // $this->validator->duplicate_hotspot_validation($panodata); // Duplicate error control and validation // $panodata = $this->format->remove_empty_scene_and_hotspot($panodata); // Remove Empty scene and hotspot // //===audio===// $bg_music = isset($_POST['bg_music']) ? sanitize_text_field($_POST['bg_music']) : 'off'; $bg_music_url = isset($_POST['bg_music_url']) ? esc_url_raw($_POST['bg_music_url']) : ''; $autoplay_bg_music = isset($_POST['autoplay_bg_music']) ? sanitize_text_field($_POST['autoplay_bg_music']) : 'off'; $loop_bg_music = isset($_POST['loop_bg_music']) ? sanitize_text_field($_POST['loop_bg_music']) : 'off'; if ($bg_music == 'on') { if (empty($bg_music_url)) { wp_send_json_error('Warning: Please add an audio file as you enabled audio for this tour
'); die(); } } //===audio===// $advanced_control = array( 'keyboardzoom' => $keyboardzoom, 'diskeyboard' => $diskeyboard, 'draggable' => $draggable, 'mouseZoom' => $mouseZoom, 'gyro' => $gyro, 'deviceorientationcontrol' => $deviceorientationcontrol, 'compass' => $compass, 'vrgallery' => $vrgallery, 'vrgallery_title' => $vrgallery_title, 'vrgallery_display' => $vrgallery_display, 'vrgallery_icon_size' => $vrgallery_icon_size, 'bg_music' => $bg_music, 'bg_music_url' => $bg_music_url, 'autoplay_bg_music' => $autoplay_bg_music, 'loop_bg_music' => $loop_bg_music, 'cpLogoSwitch' => $cpLogoSwitch, 'cpLogoImg' => $cpLogoImg, 'cpLogoContent' => $cpLogoContent, 'hfov' => $default_global_zoom, 'maxHfov' => $max_global_zoom, 'minHfov' => $min_global_zoom, 'explainerSwitch' => $explainerSwitch, 'explainerContent' => $explainerContent, ); $pano_array = array(); $pano_array = array( "panoid" => $panoid, "autoLoad" => $autoload, "showControls" => $control, "customcontrol" => $custom_control, "autoRotate" => $autorotation, "autoRotateInactivityDelay" => $autorotationinactivedelay, "autoRotateStopDelay" => $autorotationstopdelay, "genericform" => $genericform, "genericformshortcode" => $genericformshortcode, "preview" => $preview, "defaultscene" => $default_scene, "scenefadeduration" => $scene_fade_duration, "panodata" => $panodata, "previewtext" => $previewtext); $pano_array = apply_filters( 'prepare_scene_pano_array_with_pro_version', $pano_array, $_POST, $advanced_control ); $pano_array = $this->format->prepare_rotation_wrapper_data($pano_array, $rotation); // Prepare tour rotation wrapper data / update_post_meta($postid, 'panodata', $pano_array); $response = array( 'success' => true, 'data' => array( 'post_ID' => $postid, 'post_status' => get_post_status($postid) ) ); /** * Delete orphaned analytics data * * @param integer $postid POST ID * * @return void * @since 8.5.16 */ do_action('wpvr_pro_delete_orphaned_analytics_data', $postid); wp_send_json($response); die(); } /** * Responsible for showing Scene Preview * * @param string $panoid * @param string $panovideo * * @return wp_send_json_success * @since 8.0.0 */ public function wpvr_scene_preview($panoid, $panovideo) { $panodata = $this->format->prepare_panodata($_POST['panodata']); $control = $this->format->set_checkbox_value($_POST['control']); $autoload = $this->format->set_checkbox_value($_POST['autoload']); $compass = $this->format->set_checkbox_on_value(@$_POST['compass']); $mouseZoom = $this->format->set_pro_checkbox_value(@$_POST['mouseZoom']); $draggable = $this->format->set_checkbox_value($_POST['draggable'] ?? null); $gzoom = $this->format->set_pro_checkbox_value(@$_POST['gzoom']); $diskeyboard = $this->format->set_checkbox_value(@$_POST['diskeyboard']); $keyboardzoom = $this->format->set_checkbox_value(@$_POST['keyboardzoom']); $floor_plan_enabler = $this->format->set_pro_checkbox_value(@$_POST['wpvr_floor_plan_enabler']); $floor_plan_image = isset($_POST['wpvr_floor_plan_image']) ? $_POST['wpvr_floor_plan_image'] : ''; $scene_fade_duration = sanitize_text_field($_POST['scenefadeduration']); $preview = esc_url($_POST['preview']); $default_scene = ''; $rotation = sanitize_text_field($_POST['rotation']); $autorotation = sanitize_text_field($_POST['autorotation']); $autorotationinactivedelay = sanitize_text_field($_POST['autorotationinactivedelay']); $autorotationstopdelay = sanitize_text_field($_POST['autorotationstopdelay']); $default_global_zoom = ''; $max_global_zoom = ''; $min_global_zoom = ''; if ($gzoom == 'on') { $default_global_zoom = $_POST['dzoom']; $max_global_zoom = $_POST['maxzoom']; $min_global_zoom = $_POST['minzoom']; } $default_scene = $this->format->prepare_default_scene($panodata); if(isset($_POST['rotation']) && sanitize_text_field($_POST['rotation']) === 'on' ) { $this->validator->basic_setting_validation($autorotationinactivedelay, $autorotationstopdelay); // Basic setting error control and validation // } $this->validator->scene_validation($panodata); // Scene content error control and validation // $this->validator->empty_scene_validation($panodata); // Empty scene content error control and validation // $this->validator->duplicate_hotspot_validation($panodata); if($floor_plan_enabler == 'on'){ $this->validator->empty_floor_plan_image_validation($floor_plan_image); } $default_data = array(); if ($gzoom == 'on') { $default_data = array("firstScene" => $default_scene, "sceneFadeDuration" => $scene_fade_duration, "hfov" => $default_global_zoom, "maxHfov" => $max_global_zoom, "minHfov" => $min_global_zoom); } else { $default_data = array("firstScene" => $default_scene, "sceneFadeDuration" => $scene_fade_duration); } $scene_data = $this->format->prepare_scene_data_for_preview($panodata); $pano_id_array = array(); $pano_id_array = array("panoid" => $panoid); $pano_response = array(); $pano_response = array("autoLoad" => $autoload, "defaultZoom" => $default_global_zoom, "minZoom" => $min_global_zoom, "maxZoom" => $max_global_zoom, "showControls" => $control, "compass" => $compass, "mouseZoom" => $mouseZoom, "draggable" => $draggable, "disableKeyboardCtrl" => $diskeyboard, 'keyboardZoom' => $keyboardzoom, "preview" => $preview, "autoRotate" => $autorotation, "autoRotateInactivityDelay" => $autorotationinactivedelay, "autoRotateStopDelay" => $autorotationstopdelay, "default" => $default_data, "scenes" => $scene_data); $pano_response = $this->format->prepare_rotation_wrapper_data($pano_response, $rotation); $is_pro = apply_filters('is_wpvr_pro_active',false); $status = get_option('wpvr_edd_license_status'); $pano_floor_plan = array(); $call_to_action = array(); if ($status !== false && 'valid' == $status && $is_pro) { $pano_floor_plan = array( "floor_plan_tour_enabler" => $floor_plan_enabler, "floor_plan_attachment_url" => $floor_plan_image ); $call_to_action = array( 'button_enable' =>sanitize_text_field($_POST['callToAction']), 'button_text' =>sanitize_text_field($_POST['buttontext']), 'button_url' =>sanitize_text_field($_POST['buttonurl']) ); } $response = array(); $response = array($pano_id_array, $pano_response, $panovideo,$pano_floor_plan,$call_to_action); wp_send_json_success($response); } /** * Render shortcode for scene and hotspot post data * * @param array $postdata * @param string $panoid * @param integer $id * @param mixed $radius * @param mixed $width * @param mixed $height * * @return string * @since 8.0.0 */ public function render_scene_shortcode($postdata, $panoid, $id, $radius, $width, $height, $mobile_height) { do_action('rex_wpvr_embadded_tour', $id, 'scene'); $control = false; if (isset($postdata['showControls'])) { $control = $postdata['showControls']; } if ($control) { if (isset($postdata['customcontrol'])) { $custom_control = $postdata['customcontrol']; if ($custom_control['panupSwitch'] == "on" || $custom_control['panDownSwitch'] == "on" || $custom_control['panLeftSwitch'] == "on" || $custom_control['panRightSwitch'] == "on" || $custom_control['panZoomInSwitch'] == "on" || $custom_control['panZoomOutSwitch'] == "on" || $custom_control['panFullscreenSwitch'] == "on" || $custom_control['gyroscopeSwitch'] == "on" || $custom_control['backToHomeSwitch'] == "on") { $control = false; } } } $vrgallery = false; if (isset($postdata['vrgallery'])) { $vrgallery = $postdata['vrgallery']; } $vrgallery_title = false; if (isset($postdata['vrgallery_title'])) { $vrgallery_title = $postdata['vrgallery_title']; } $vrgallery_display = false; if (isset($postdata['vrgallery_display'])) { $vrgallery_display = $postdata['vrgallery_display']; } $vrgallery_icon_size = false; if (isset($postdata['vrgallery_icon_size'])) { $vrgallery_icon_size = $postdata['vrgallery_icon_size']; } $gyro = false; $gyro_orientation = false; if (isset($postdata['gyro'])) { $gyro = $postdata['gyro']; if (isset($postdata['deviceorientationcontrol'])) { $gyro_orientation = $postdata['deviceorientationcontrol']; } } //== Floor plan handle ==// $floor_plan_enable = 'off'; $floor_plan_image = ''; if (isset($postdata['floor_plan_tour_enabler']) && $postdata['floor_plan_tour_enabler'] == 'on'){ $floor_plan_enable = $postdata['floor_plan_tour_enabler']; if(isset($postdata['floor_plan_attachment_url']) && !empty($postdata['floor_plan_attachment_url'])){ $floor_plan_image = $postdata['floor_plan_attachment_url']; } } $compass = false; $audio_right = "5px"; if (isset($postdata['compass'])) { $compass = $postdata['compass'] == 'on' || $postdata['compass'] != null ? true : false; if ($compass) { $audio_right = "60px"; } } $floor_map_right = "10px"; if((isset($postdata['compass']) && $postdata['compass'] == 'on') && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on')){ $floor_map_right = "85px"; }elseif(isset($postdata['compass']) && $postdata['compass'] == 'on'){ $floor_map_right = "55px"; }elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on") { $floor_map_right = "25px"; } //===explainer handle===// $explainer_right = "10px"; if ((isset($postdata['compass']) && $postdata['compass'] == 'on') && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on') && ( $floor_plan_enable == 'on' && !empty($floor_plan_image) ) ) { $explainer_right = "130px"; } elseif (isset($postdata['compass']) && $postdata['compass'] == 'on' && ($floor_plan_enable == 'on' && !empty($floor_plan_image) )) { $explainer_right = "100px"; } elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on" && ($floor_plan_enable == 'on' && !empty($floor_plan_image) )) { $explainer_right = "60px"; } elseif((isset($postdata['compass']) && $postdata['compass'] == 'on') && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on') ) { $explainer_right = "80px"; }elseif (isset($postdata['compass']) && $postdata['compass'] == 'on') { $explainer_right = "55px"; } elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on") { $explainer_right = "30px"; } elseif ($floor_plan_enable == 'on' && !empty($floor_plan_image) ) { $explainer_right = "40px"; } $enable_cardboard = ''; $is_cardboard = get_option('wpvr_cardboard_disable'); if(wpvr_isMobileDevice() && $is_cardboard == 'true' ){ $enable_cardboard = 'enable-cardboard'; $audio_right = "73px"; if (isset($postdata['compass'])) { $compass = $postdata['compass'] == 'on' || $postdata['compass'] != null ? true : false; if ($compass) { $audio_right = "130px"; } } //===Floor plan handle===// $floor_map_right = "60px"; if((isset($postdata['compass']) && $postdata['compass'] == 'on') && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on')){ $floor_map_right = "150px"; }elseif(isset($postdata['compass']) && $postdata['compass'] == 'on'){ $floor_map_right = "120px"; }elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on") { $floor_map_right = "90px"; } //===explainer handle===// $explainer_right = "65px"; if ((isset($postdata['compass']) && $postdata['compass'] == true) && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on')) { $explainer_right = "150px"; } elseif((isset($postdata['compass']) && $postdata['compass'] == true) && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on') && ($floor_plan_enable == 'on' && !empty($floor_plan_image) )) { $explainer_right = "180px"; } elseif (isset($postdata['compass']) && $postdata['compass'] == true && ($floor_plan_enable == 'on' && !empty($floor_plan_image) )) { $explainer_right = "150px"; } elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on" && ($floor_plan_enable == 'on' && !empty($floor_plan_image) )) { $explainer_right = "120px"; }elseif (isset($postdata['compass']) && $postdata['compass'] == true) { $explainer_right = "130px"; } elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on") { $explainer_right = "90px"; }elseif ($floor_plan_enable == 'on' && !empty($floor_plan_image) ) { $explainer_right = "90px"; } } //===explainer handle===// $mouseZoom = true; if (isset($postdata['mouseZoom'])) { if($postdata['mouseZoom'] == "off") { $mouseZoom = false; } else { $mouseZoom = true; } } $draggable = true; if (isset($postdata['draggable'])) { $draggable = $postdata['draggable'] == 'off' || $postdata['draggable'] == null ? false : true; } $diskeyboard = false; if (isset($postdata['diskeyboard'])) { $diskeyboard = $postdata['diskeyboard'] == 'off' || $postdata['diskeyboard'] == null ? false : true; } $keyboardzoom = true; if (isset($postdata['keyboardzoom'])) { $keyboardzoom = $postdata['keyboardzoom']; } $autoload = false; if (isset($postdata['autoLoad'])) { $autoload = $postdata['autoLoad']; } $default_scene = ''; if (isset($postdata['defaultscene'])) { $default_scene = $postdata['defaultscene']; } $default_global_zoom = ''; if (isset($postdata['hfov'])) { $default_global_zoom = $postdata['hfov']; } $max_global_zoom = ''; if (isset($postdata['maxHfov'])) { $max_global_zoom = $postdata['maxHfov']; } $min_global_zoom = ''; if (isset($postdata['minHfov'])) { $min_global_zoom = $postdata['minHfov']; } $preview = ''; if (isset($postdata['preview'])) { $preview = $postdata['preview']; } $autorotation = ''; if (isset($postdata["autoRotate"])) { $autorotation = $postdata["autoRotate"]; } $autorotationinactivedelay = ''; if (isset($postdata["autoRotateInactivityDelay"])) { $autorotationinactivedelay = $postdata["autoRotateInactivityDelay"]; } $autorotationstopdelay = ''; if (isset($postdata["autoRotateStopDelay"])) { $autorotationstopdelay = $postdata["autoRotateStopDelay"]; } $scene_fade_duration = ''; if (isset($postdata['scenefadeduration'])) { $scene_fade_duration = $postdata['scenefadeduration']; } $panodata = ''; if (isset($postdata['panodata'])) { $panodata = $postdata['panodata']; } $hotspoticoncolor = '#00b4ff'; $hotspotblink = 'on'; $default_data = array(); if ($default_global_zoom != '' && $max_global_zoom != '' && $min_global_zoom != '') { $default_data = array("firstScene" => $default_scene, "sceneFadeDuration" => $scene_fade_duration, "hfov" => $default_global_zoom, "maxHfov" => $max_global_zoom, "minHfov" => $min_global_zoom); } else { $default_data = array("firstScene" => $default_scene, "sceneFadeDuration" => $scene_fade_duration); } $scene_data = array(); if (!empty($panodata["scene-list"])) { foreach ($panodata["scene-list"] as $panoscenes) { $scene_ititle = ''; if (isset($panoscenes["scene-ititle"])) { $scene_ititle = sanitize_text_field($panoscenes["scene-ititle"]); } $scene_author = ''; if (isset($panoscenes["scene-author"])) { $scene_author = sanitize_text_field($panoscenes["scene-author"]); } $scene_author_url = ''; if (isset($panoscenes["scene-author-url"])) { $scene_author_url = sanitize_text_field($panoscenes["scene-author-url"]); } $scene_vaov = 180; if (isset($panoscenes["scene-vaov"])) { $scene_vaov = (float)$panoscenes["scene-vaov"]; } $scene_haov = 360; if (isset($panoscenes["scene-haov"])) { $scene_haov = (float)$panoscenes["scene-haov"]; } $scene_vertical_offset = 0; if (isset($panoscenes["scene-vertical-offset"])) { $scene_vertical_offset = (float)$panoscenes["scene-vertical-offset"]; } $default_scene_pitch = null; if (isset($panoscenes["scene-pitch"])) { $default_scene_pitch = (float)$panoscenes["scene-pitch"]; } $default_scene_yaw = null; if (isset($panoscenes["scene-yaw"])) { $default_scene_yaw = (float)$panoscenes["scene-yaw"]; } $scene_max_pitch = ''; if (isset($panoscenes["scene-maxpitch"])) { $scene_max_pitch = (float)$panoscenes["scene-maxpitch"]; } $scene_min_pitch = ''; if (isset($panoscenes["scene-minpitch"])) { $scene_min_pitch = (float)$panoscenes["scene-minpitch"]; } $scene_max_yaw = ''; if (isset($panoscenes["scene-maxyaw"])) { $scene_max_yaw = (float)$panoscenes["scene-maxyaw"]; } $scene_min_yaw = ''; if (isset($panoscenes["scene-minyaw"])) { $scene_min_yaw = (float)$panoscenes["scene-minyaw"]; } $default_zoom = 100; if (isset($panoscenes["scene-zoom"]) && $panoscenes["scene-zoom"] != "") { $default_zoom = $panoscenes["scene-zoom"]; } else { if ($default_global_zoom != '') { $default_zoom = (int)$default_global_zoom; } } $max_zoom = 120; if (isset($panoscenes["scene-maxzoom"]) && $panoscenes["scene-maxzoom"] != '') { $max_zoom = (int)$panoscenes["scene-maxzoom"]; } else { if ($max_global_zoom != '') { $max_zoom = (int)$max_global_zoom; } } $min_zoom = 50; if (isset($panoscenes["scene-minzoom"]) && $panoscenes["scene-minzoom"] != '') { $min_zoom = (int)$panoscenes["scene-minzoom"]; } else { if ($min_global_zoom != '') { $min_zoom = (int)$min_global_zoom; } } $hotspot_datas = array(); if (isset($panoscenes["hotspot-list"])) { $hotspot_datas = $panoscenes["hotspot-list"]; } $hotspots = array(); foreach ($hotspot_datas as $hotspot_data) { $status = get_option('wpvr_edd_license_status'); if ($status !== false && $status == 'valid') { if (isset($hotspot_data["hotspot-customclass-pro"]) && $hotspot_data["hotspot-customclass-pro"] != 'none') { $hotspot_data['hotspot-customclass'] = $hotspot_data["hotspot-customclass-pro"] . ' custom-' . $id.'-' . $panoscenes['scene-id'] .'-'. $hotspot_data['hotspot-title']; } if (isset($hotspot_data['hotspot-blink'])) { $hotspotblink = $hotspot_data['hotspot-blink']; } } $hotspot_scene_pitch = ''; if (isset($hotspot_data["hotspot-scene-pitch"])) { $hotspot_scene_pitch = $hotspot_data["hotspot-scene-pitch"]; } $hotspot_scene_yaw = ''; if (isset($hotspot_data["hotspot-scene-yaw"])) { $hotspot_scene_yaw = $hotspot_data["hotspot-scene-yaw"]; } $hotspot_type = $hotspot_data["hotspot-type"] !== 'scene' ? 'info' : $hotspot_data["hotspot-type"]; $hotspot_content = ''; ob_start(); do_action('wpvr_hotspot_content', $hotspot_data); $hotspot_content = ob_get_clean(); if (!$hotspot_content) { $hotspot_content = $hotspot_data["hotspot-content"]; } if (isset($hotspot_data["wpvr_url_open"][0])) { $wpvr_url_open = $hotspot_data["wpvr_url_open"][0]; } else { $wpvr_url_open = "off"; } $on_hover_content = preg_replace_callback( '/\s*(]*>)\s*
\s*<\/p>/i',
function ($matches) {
return $matches[1];
},
$hotspot_data['hotspot-hover'] ?? ''
);
$on_hover_content = $this->sanitize_content_preserve_styles($on_hover_content ?? '');
$on_click_content = preg_replace_callback('/]*>/', "replace_callback", $hotspot_content ?? '');
$hotspot_shape = 'round';
if (isset($hotspot_data["hotspot-customclass-pro"]) && $hotspot_data["hotspot-customclass-pro"] != 'none') {
$hotspot_shape = isset($hotspot_data["hotspot-shape"]) ? $hotspot_data["hotspot-shape"] : 'round';
}
$hotspot_data_for_on_click=[];
if('info' === $hotspot_type && !empty($on_click_content)){
$hotspot_data_for_on_click = [
'on_click_content' => $on_click_content,
'tour_id' => $id,
'scene_id' => $panoscenes['scene-id'],
'hotspot_id' => $hotspot_data['hotspot-title'],
];
} elseif('info' === $hotspot_type && !empty($hotspot_data["hotspot-url"])){
$hotspot_data_for_on_click = [
'on_click_content' => '',
'tour_id' => $id,
'scene_id' => $panoscenes['scene-id'],
'hotspot_id' => $hotspot_data['hotspot-title'],
];
}
$hotspot_info = array(
"text" => $hotspot_data["hotspot-title"],
"pitch" => $hotspot_data["hotspot-pitch"],
"yaw" => $hotspot_data["hotspot-yaw"],
"type" => $hotspot_type,
"cssClass" => $hotspot_data["hotspot-customclass"],
"URL" => $hotspot_data["hotspot-url"],
"wpvr_url_open" => $wpvr_url_open,
"clickHandlerArgs" => $hotspot_data_for_on_click,
'createTooltipArgs' => !empty(trim($on_hover_content)) ? trim($on_hover_content) : '',
"sceneId" => $hotspot_data["hotspot-scene"],
"targetPitch" => (float)$hotspot_scene_pitch,
"targetYaw" => (float)$hotspot_scene_yaw,
'hotspot_type' => $hotspot_data['hotspot-type'],
'hotspot_target' => 'notBlank',
'hotspot_shape' => $hotspot_shape,
);
$hotspot_info['URL'] = ($hotspot_data['hotspot-type'] === 'fluent_form' || $hotspot_data['hotspot-type'] === 'wc_product') ? '' : $hotspot_info['URL'];
if ($hotspot_data["hotspot-customclass"] == 'none' || $hotspot_data["hotspot-customclass"] == '') {
unset($hotspot_info["cssClass"]);
}
if (empty($hotspot_data["hotspot-scene"])) {
unset($hotspot_info['targetPitch']);
unset($hotspot_info['targetYaw']);
}
array_push($hotspots, $hotspot_info);
}
$device_scene = $panoscenes['scene-attachment-url'];
$mobile_media_resize = get_option('mobile_media_resize');
$file_accessible = ini_get('allow_url_fopen');
if ($mobile_media_resize == "true" && $device_scene ) {
if ($file_accessible == "1") {
$image_info = getimagesize($device_scene);
if ($image_info[0] > 4096) {
$src_to_id_for_mobile = '';
$src_to_id_for_desktop = '';
if (wpvr_isMobileDevice()) {
$src_to_id_for_mobile = attachment_url_to_postid($panoscenes['scene-attachment-url']);
if ($src_to_id_for_mobile) {
$mobile_scene = wp_get_attachment_image_src($src_to_id_for_mobile, 'wpvr_mobile');
if ($mobile_scene[3]) {
$device_scene = $mobile_scene[0];
}
}
} else {
$src_to_id_for_desktop = attachment_url_to_postid($panoscenes['scene-attachment-url']);
if ($src_to_id_for_desktop) {
$desktop_scene = wp_get_attachment_image_src($src_to_id_for_mobile, 'full');
if (isset($desktop_scene[0])) {
$device_scene = $desktop_scene[0];
}
}
}
}
}
}
$scene_info = array();
if ($panoscenes["scene-type"] == 'cubemap') {
$pano_attachment = array(
$panoscenes["scene-attachment-url-face0"],
$panoscenes["scene-attachment-url-face1"],
$panoscenes["scene-attachment-url-face2"],
$panoscenes["scene-attachment-url-face3"],
$panoscenes["scene-attachment-url-face4"],
$panoscenes["scene-attachment-url-face5"]
);
$scene_info = array("type" => $panoscenes["scene-type"], "cubeMap" => $pano_attachment, "pitch" => $default_scene_pitch, "maxPitch" => $scene_max_pitch, "minPitch" => $scene_min_pitch, "maxYaw" => $scene_max_yaw, "minYaw" => $scene_min_yaw, "yaw" => $default_scene_yaw, "hfov" => $default_zoom, "maxHfov" => $max_zoom, "minHfov" => $min_zoom, "title" => $scene_ititle, "author" => $scene_author, "authorURL" => $scene_author_url, "vaov" => $scene_vaov, "haov" => $scene_haov, "vOffset" => $scene_vertical_offset, "hotSpots" => $hotspots);
} else {
$scene_info = array("type" => $panoscenes["scene-type"], "panorama" => $device_scene, "pitch" => $default_scene_pitch, "maxPitch" => $scene_max_pitch, "minPitch" => $scene_min_pitch, "maxYaw" => $scene_max_yaw, "minYaw" => $scene_min_yaw, "yaw" => $default_scene_yaw, "hfov" => $default_zoom, "maxHfov" => $max_zoom, "minHfov" => $min_zoom, "title" => $scene_ititle, "author" => $scene_author, "authorURL" => $scene_author_url, "vaov" => $scene_vaov, "haov" => $scene_haov, "vOffset" => $scene_vertical_offset, "hotSpots" => $hotspots);
}
if (isset($panoscenes["ptyscene"])) {
if ($panoscenes["ptyscene"] == "off") {
unset($scene_info['pitch']);
unset($scene_info['yaw']);
}
}
if (empty($panoscenes["scene-ititle"])) {
unset($scene_info['title']);
}
if (empty($panoscenes["scene-author"])) {
unset($scene_info['author']);
}
if (empty($panoscenes["scene-author-url"])) {
unset($scene_info['authorURL']);
}
if (empty($scene_vaov)) {
unset($scene_info['vaov']);
}
if (empty($scene_haov)) {
unset($scene_info['haov']);
}
if (empty($scene_vertical_offset)) {
unset($scene_info['vOffset']);
}
if (isset($panoscenes["cvgscene"])) {
if ($panoscenes["cvgscene"] == "off") {
unset($scene_info['maxPitch']);
unset($scene_info['minPitch']);
}
}
if (empty($panoscenes["scene-maxpitch"])) {
unset($scene_info['maxPitch']);
}
if (empty($panoscenes["scene-minpitch"])) {
unset($scene_info['minPitch']);
}
if (isset($panoscenes["chgscene"])) {
if ($panoscenes["chgscene"] == "off") {
unset($scene_info['maxYaw']);
unset($scene_info['minYaw']);
}
}
if (empty($panoscenes["scene-maxyaw"])) {
unset($scene_info['maxYaw']);
}
if (empty($panoscenes["scene-minyaw"])) {
unset($scene_info['minYaw']);
}
// if (isset($panoscenes["czscene"])) {
// if ($panoscenes["czscene"] == "off") {
// unset($scene_info['hfov']);
// unset($scene_info['maxHfov']);
// unset($scene_info['minHfov']);
// }
// }
$scene_array = array();
$scene_array = array(
$panoscenes["scene-id"] => $scene_info
);
$scene_data[$panoscenes["scene-id"]] = $scene_info;
}
}
$pano_id_array = array();
$pano_id_array = array("panoid" => $panoid);
$pano_response = array();
$pano_response = array("autoLoad" => $autoload, "showControls" => $control, "orientationSupport" => 'false', "compass" => $compass, 'orientationOnByDefault' => $gyro_orientation, "mouseZoom" => $mouseZoom, "draggable" => $draggable, 'disableKeyboardCtrl' => $diskeyboard, 'keyboardZoom' => $keyboardzoom, "preview" => $preview, "autoRotate" => $autorotation, "autoRotateInactivityDelay" => $autorotationinactivedelay, "autoRotateStopDelay" => $autorotationstopdelay, "default" => $default_data, "scenes" => $scene_data);
if (empty($autorotation)) {
unset($pano_response['autoRotate']);
unset($pano_response['autoRotateInactivityDelay']);
unset($pano_response['autoRotateStopDelay']);
}
if (empty($autorotationinactivedelay)) {
unset($pano_response['autoRotateInactivityDelay']);
}
if (empty($autorotationstopdelay)) {
unset($pano_response['autoRotateStopDelay']);
}
$response = array();
$response = array($pano_id_array, $pano_response);
if (!empty($response)) {
$response = json_encode($response);
}
if (empty($width)) {
$width = '600px';
}
if (empty($height)) {
$height = '400px';
}
$foreground_color = '#fff';
$pulse_color = wpvr_hex2rgb($hotspoticoncolor);
$rgb = wpvr_HTMLToRGB($hotspoticoncolor);
$hsl = wpvr_RGBToHSL($rgb);
if ($hsl->lightness > 200) {
$foreground_color = '#000000';
} else {
$foreground_color = '#fff';
}
$html = '';
$html .= '';
$scene_animation = isset($postdata['sceneAnimation']) ? $postdata['sceneAnimation'] : 'off';
if( $scene_animation === 'on'){
$animation_type = isset($postdata['sceneAnimationName']) ? $postdata['sceneAnimationName'] : 'none';
$animationDuration = isset($postdata['sceneAnimationTransitionDuration']) ? $postdata['sceneAnimationTransitionDuration'] : '500ms';
$animationDelay = isset($postdata['sceneAnimationTransitionDelay']) ? $postdata['sceneAnimationTransitionDelay'] : '0ms';
$animation_css = apply_filters('wpvr_tour_scene_animation',$animation_type,$animationDuration,$animationDelay,$postdata,$id);
$html .= $animation_css;
}
if ($width == 'fullwidth') {
$width = "100%";
}
if (wpvr_isMobileDevice()) {
$html .= '