PluginProbe
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress / 8.5.4
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress v8.5.4
9.1.2 9.1.1 9.1.0 9.0.3 9.0.2 9.0.1 9.0.0 8.5.79 8.5.78 8.5.77 8.5.76 8.5.75 8.5.74 8.5.73 8.5.72 8.5.71 8.5.70 8.5.69 8.5.68 8.5.35 8.5.36 8.5.37 8.5.38 8.5.39 8.5.4 All 221 releases
wpvr / admin / classes / class-wpvr-scene.php

class-wpvr-scene.php in WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress 8.5.4, at admin/classes/class-wpvr-scene.php

2,809 lines 132.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) exit; // Exit if accessed directly
3 /**
4 * Responsible for managing Scene tab on Setup meta box
5 *
6 * @link http://rextheme.com/
7 * @since 8.0.0
8 *
9 * @package Wpvr
10 * @subpackage Wpvr/admin/classes
11 */
12
13 class WPVR_Scene {
14
15 /**
16 * Instance of WPVR_Hotspot class
17 *
18 * @var object
19 * @since 8.0.0
20 */
21 protected $hotspot;
22
23 /**
24 * Instance of WPVR_Format class
25 *
26 * @var object
27 * @since 8.0.0
28 */
29 protected $format;
30
31 /**
32 * Instance of WPVR_Validator class
33 *
34 * @var object
35 * @since 8.0.0
36 */
37 private $validator;
38
39 /**
40 * Number of scene or hotspot item
41 *
42 * @var integer
43 * @since 8.0.0
44 */
45 protected $data_limit;
46
47 /**
48 * Pro version license status
49 *
50 * @var string
51 * @since 8.0.0
52 */
53 protected $status;
54
55
56 function __construct()
57 {
58 $this->hotspot = new WPVR_Hotspot();
59 $this->format = new WPVR_Format();
60 $this->validator = new WPVR_Validator();
61
62 $this->status = apply_filters( 'check_pro_license_status', $this->status );
63
64 if ($this->status !== false && $this->status == 'valid') {
65 $this->data_limit = 999999999;
66 } else {
67 $this->data_limit = 5;
68 }
69 }
70
71
72 /**
73 * Render Scene Settings Content
74 *
75 * @param array $postdata
76 *
77 * @return void
78 * @since 8.0.0
79 */
80 public function render_scene($postdata)
81 {
82 ob_start();
83 ?>
84
85 <!-- Scene and Hotspot repeater -->
86 <div class="scene-setup rex-pano-sub-tabs" data-limit="<?= $this->data_limit + 1;?>">
87 <?php $this->render_scene_repeater_list($postdata); ?>
88 </div>
89
90 <?php
91 // ob_end_flush();
92 }
93
94
95 /**
96 * Render scene setup data repeater list
97 *
98 * @param array $postdata
99 *
100 * @return void
101 * @since 8.0.0
102 */
103 private function render_scene_repeater_list($postdata)
104 {
105 ob_start();
106 ?>
107 <nav class="rex-pano-tab-nav rex-pano-nav-menu scene-nav">
108 <?php $this->render_nav_menu($postdata); // Will render scene navigation bar ?>
109 </nav>
110
111 <div data-repeater-list="scene-list" class="rex-pano-tab-content">
112
113 <!-- Default empty repeater -->
114 <div data-repeater-item class="single-scene rex-pano-tab" data-title="0" id="scene-0">
115 <?php $this->render_default_repeater_item(); ?>
116 </div>
117 <!-- Empty repeater end -->
118
119 <?php $s = 1; $firstvalue = reset($postdata['panodata']["scene-list"]);
120 foreach ($postdata['panodata']["scene-list"] as $pano_scene) { ?>
121
122 <div data-repeater-item class="single-scene rex-pano-tab <?php if($pano_scene['scene-id'] == $firstvalue['scene-id']) { echo 'active'; }; ?>" data-title="1" id="scene-<?php echo $s;?>">
123 <?php $this->render_repeater_item_with_panodata($pano_scene, $s); ?>
124 </div>
125
126 <?php $s++; } ?>
127 </div>
128 <?php
129 // ob_end_flush();
130 }
131
132
133 /**
134 * Render scene nav menu
135 *
136 * @param array $postdata
137 *
138 * @return void
139 * @since 8.0.0
140 */
141 private function render_nav_menu($postdata)
142 {
143 ob_start();
144 ?>
145 <ul>
146 <?php $i = 1; $firstvalue = reset($postdata['panodata']["scene-list"]);
147 foreach ($postdata['panodata']["scene-list"] as $pano_scene) { ?>
148
149 <li class="<?php if ($pano_scene['scene-id'] == $firstvalue['scene-id']) {echo 'active';};?>">
150 <span data-index="<?php echo $i;?>" data-href="#scene-<?php echo $i;?>">
151 <i class="fa fa-image"></i>
152 </span>
153 </li>
154
155 <?php $i++; } ?>
156 <li class="add" data-repeater-create><span><i class="fa fa-plus-circle"></i></span></li>
157 </ul>
158 <?php
159 ob_end_flush();
160 }
161
162
163 /**
164 * Render repeater item for default scene
165 *
166 * @param int $data_limit
167 *
168 * @return void
169 * @since 8.0.0
170 */
171 private function render_default_repeater_item()
172 {
173 ob_start();
174 ?>
175 <div class="active_scene_id"><p></p></div>
176 <div class="scene-content">
177 <?php $this->render_default_repeater_item_scene_content(); ?>
178 </div>
179
180 <!-- hotspot setup -->
181 <div class="hotspot-setup rex-pano-sub-tabs" data-limit="<?= $this->data_limit;?>">
182 <?php $this->hotspot->render_hotspot($s = 0, $h =1)?>
183 </div>
184 <button data-repeater-delete type="button" title="Delete Scene" class="delete-scene"><i class="far fa-trash-alt"></i></button>
185 <?php
186 ob_end_flush();
187 }
188
189
190 /**
191 * Render repeater items while scene has panaromic data
192 *
193 * @param array $pano_scene
194 * @param int $s scene number increment var
195 *
196 * @return void
197 * @since 8.0.0
198 */
199 private function render_repeater_item_with_panodata($pano_scene, $s)
200 {
201 ob_start();
202 ?>
203 <div class="active_scene_id"><p></p></div>
204 <div class="scene-content">
205 <!--
206 - Render repeater item scene content
207 - If scene has panaromic data
208 -->
209 <?php $this->render_repeater_scene_content_with_data($pano_scene); ?>
210 </div>
211 <!--
212 - Render repeater item hotspot content
213 -->
214 <?php $this->render_repeater_item_hotspot_content($pano_scene, $s); ?>
215
216 <button data-repeater-delete type="button" title="Delete Scene" class="delete-scene"><i class="far fa-trash-alt"></i></button>
217 <?php
218 ob_end_flush();
219 }
220
221
222 /**
223 * Render scene content for default repeater item
224 *
225 * @return void
226 * @since 8.0.0
227 */
228 private function render_default_repeater_item_scene_content()
229 {
230 ob_start();
231 ?>
232
233 <h6 class="title"><i class="fa fa-cog"></i> <?php echo __('Scene Settings','wpvr') ?> </h6>
234
235 <div class="scene-left">
236 <?php WPVR_Meta_Field::render_scene_left_fields_empty_panodata(); ?>
237 </div>
238
239 <div class="scene-right">
240 <?php do_action( 'wpvr_pro_scene_empty_right_fields' ) ?>
241 </div>
242
243 <?php
244 ob_end_flush();
245 }
246
247
248 /**
249 * Render repeater item scene content is scene has panaromic data
250 *
251 * @param mixed $dscene
252 * @param mixed $scene_id
253 * @param mixed $scene_photo
254 *
255 * @return void
256 * @since 8.0.0
257 */
258 private function render_repeater_scene_content_with_data($pano_scene)
259 {
260 ob_start();
261 ?>
262 <h6 class="title"><i class="fa fa-cog"></i> <?php echo __('Scene Settings','wpvr') ?> </h6>
263
264 <div class="scene-left">
265 <?php WPVR_Meta_Field::render_scene_left_fields_with_panodata($pano_scene) ;?>
266 </div>
267
268 <div class="scene-right">
269 <?php do_action( 'wpvr_pro_scene_right_fields', $pano_scene ) ?>
270 </div>
271
272
273 <?php
274 ob_end_flush();
275 }
276
277
278 /**
279 * Render repeater item hotspot content
280 *
281 * @param array $pano_hotspots
282 * @param int $data_limit
283 * @param int $s
284 *
285 * @return void
286 * @since 8.0.0
287 */
288 private function render_repeater_item_hotspot_content($pano_scene, $s)
289 {
290 if (!empty($pano_scene['hotspot-list'])) { ?>
291 <div class="hotspot-setup rex-pano-sub-tabs" data-limit="<?= $this->data_limit;?>">
292
293 <?php $this->hotspot->render_hotspot_with_panodata($pano_scene['hotspot-list'], $s); //Render hotspot while scene has hotspot data ?>
294
295 </div>
296 <?php } else { ?>
297 <div class="hotspot-setup rex-pano-sub-tabs" data-limit="<?= $this->data_limit;?>">
298
299 <?php $this->hotspot->render_hotspot($s, $h = 1); //Render hotspot while scene has no hotspot data ?>
300
301 </div>
302 <?php }
303 }
304
305
306 /**
307 * Update post meta data
308 *
309 * @param integer $postid
310 * @param integer $panoid
311 *
312 * @return void
313 * @since 8.0.0
314 */
315 public function wpvr_update_meta_box($postid, $panoid)
316 {
317 $panodata = $this->format->prepare_panodata($_POST['panodata']);
318 $default_scene = $this->format->prepare_default_scene($panodata);
319 $previewtext = $this->validator->preview_text_validation($_POST['previewtext']);
320
321 $gzoom = $this->format->set_pro_checkbox_value(@$_POST['gzoom']);
322 $default_global_zoom = '';
323 $max_global_zoom = '';
324 $min_global_zoom = '';
325 if ($gzoom == 'on') {
326 $default_global_zoom = $_POST['dzoom'];
327 $max_global_zoom = $_POST['maxzoom'];
328 $min_global_zoom = $_POST['minzoom'];
329 }
330
331 $custom_control = isset($_POST['customcontrol']) ? $_POST['customcontrol'] : null;
332
333 $vrgallery = $this->format->set_checkbox_value(@$_POST['vrgallery']);
334 $vrgallery_title = $this->format->set_checkbox_value(@$_POST['vrgallery_title']);
335 $vrgallery_display = $this->format->set_checkbox_value(@$_POST['vrgallery_display']);
336 $vrgallery_icon_size = $this->format->set_checkbox_value(@$_POST['vrgallery_icon_size']);
337
338 $mouseZoom = $this->format->set_pro_checkbox_value(@$_POST['mouseZoom']);
339 $draggable = $this->format->set_pro_checkbox_value(@$_POST['draggable']);
340 $diskeyboard = $this->format->set_pro_checkbox_value(@$_POST['diskeyboard']);
341 $keyboardzoom = $this->format->set_checkbox_value(@$_POST['keyboardzoom']);
342 $compass = $this->format->set_checkbox_on_value(@$_POST['compass']);
343 //===Gyroscopre control===//
344 $gyro = $this->format->set_pro_checkbox_value(@$_POST['gyro']);
345 if ($gyro == 'on') {
346 if (!is_ssl()) {
347 wp_send_json_error('<p><span>Warning:</span> Please add SSL to enable Gyroscope for WP VR. </p>');
348 die();
349 }
350 $gyro = true;
351 $deviceorientationcontrol = $this->format->set_checkbox_value(@$_POST['deviceorientationcontrol']);
352 } else {
353 $gyro = false;
354 $deviceorientationcontrol = false;
355 }
356 //===Gyroscopre control===//
357
358 $autoload = $this->format->set_checkbox_value($_POST['autoload']);
359 $control = $this->format->set_checkbox_value($_POST['control']);
360
361 $scene_fade_duration = $_POST['scenefadeduration'];
362 $preview = esc_url($_POST['preview']);
363 $rotation = sanitize_text_field($_POST['rotation']);
364 $autorotation = sanitize_text_field($_POST['autorotation']);
365
366 $autorotationinactivedelay = sanitize_text_field($_POST['autorotationinactivedelay']);
367 $autorotationstopdelay = sanitize_text_field($_POST['autorotationstopdelay']);
368
369 //===generic form===//
370 $genericform = sanitize_text_field(isset($_POST['genericform']) ? $_POST['genericform'] : 'off');
371 $genericformshortcode = isset($_POST['genericformshortcode']) ? $_POST['genericformshortcode'] : '' ;
372 //===generic form===//
373
374 $this->validator->basic_setting_validation($autorotationinactivedelay, $autorotationstopdelay); // Basic setting error control and validation //
375
376 //===Company Logo===//
377 $cpLogoSwitch = isset($_POST['cpLogoSwitch']) ? $_POST['cpLogoSwitch'] : 'off';
378 $cpLogoImg = isset($_POST['cpLogoImg']) ? $_POST['cpLogoImg'] : '';
379 $cpLogoContent = isset($_POST['cpLogoContent']) ? sanitize_text_field($_POST['cpLogoContent']) : '';
380 //===Company Logo===//
381
382 //===Explainer video===//
383 $explainerSwitch = isset($_POST['explainerSwitch']) ? $_POST['explainerSwitch'] : 'off';
384 $explainerContent = '';
385 $explainerContent = isset($_POST['explainerContent']) ? $_POST['explainerContent'] : '';
386 //===Explainer video===//
387
388
389 $scene_fade_duration = '';
390 $scene_fade_duration = $_POST['scenefadeduration'];
391
392 $this->validator->scene_validation($panodata); // Scene content error control and validation //
393
394 $this->validator->empty_scene_validation($panodata); // Empty scene content error control and validation //
395
396 $this->validator->duplicate_hotspot_validation($panodata); // Duplicate error control and validation //
397
398 $panodata = $this->format->remove_empty_scene_and_hotspot($panodata); // Remove Empty scene and hotspot //
399
400 //===audio===//
401 $bg_music = isset($_POST['bg_music']) ? sanitize_text_field($_POST['bg_music']) : 'off';
402 $bg_music_url = isset($_POST['bg_music_url']) ? esc_url_raw($_POST['bg_music_url']) : '';
403 $autoplay_bg_music = isset($_POST['autoplay_bg_music']) ? sanitize_text_field($_POST['autoplay_bg_music']) : 'off';
404 $loop_bg_music = isset($_POST['loop_bg_music']) ? sanitize_text_field($_POST['loop_bg_music']) : 'off';
405 if ($bg_music == 'on') {
406 if (empty($bg_music_url)) {
407 wp_send_json_error('<p><span>Warning:</span> Please add an audio file as you enabled audio for this tour </p>');
408 die();
409 }
410 }
411 //===audio===//
412 $advanced_control = array(
413 'keyboardzoom' => $keyboardzoom,
414 'diskeyboard' => $diskeyboard,
415 'draggable' => $draggable,
416 'mouseZoom' => $mouseZoom,
417 'gyro' => $gyro,
418 'deviceorientationcontrol' => $deviceorientationcontrol,
419 'compass' => $compass,
420 'vrgallery' => $vrgallery,
421 'vrgallery_title' => $vrgallery_title,
422 'vrgallery_display' => $vrgallery_display,
423 'vrgallery_icon_size' => $vrgallery_icon_size,
424 'bg_music' => $bg_music,
425 'bg_music_url' => $bg_music_url,
426 'autoplay_bg_music' => $autoplay_bg_music,
427 'loop_bg_music' => $loop_bg_music,
428 'cpLogoSwitch' => $cpLogoSwitch,
429 'cpLogoImg' => $cpLogoImg,
430 'cpLogoContent' => $cpLogoContent,
431 'hfov' => $default_global_zoom,
432 'maxHfov' => $max_global_zoom,
433 'minHfov' => $min_global_zoom,
434 'explainerSwitch' => $explainerSwitch,
435 'explainerContent' => $explainerContent,
436 );
437
438 $pano_array = array();
439 $pano_array = array(
440 "panoid" => $panoid,
441 "autoLoad" => $autoload,
442 "showControls" => $control,
443 "customcontrol" => $custom_control,
444 "autoRotate" => $autorotation,
445 "autoRotateInactivityDelay" => $autorotationinactivedelay,
446 "autoRotateStopDelay" => $autorotationstopdelay,
447 "genericform" => $genericform,
448 "genericformshortcode" => $genericformshortcode,
449 "preview" => $preview,
450 "defaultscene" => $default_scene,
451 "scenefadeduration" => $scene_fade_duration,
452 "panodata" => $panodata,
453 "previewtext" => $previewtext);
454 $pano_array = apply_filters( 'prepare_scene_pano_array_with_pro_version', $pano_array, $_POST, $advanced_control );
455 $pano_array = $this->format->prepare_rotation_wrapper_data($pano_array, $rotation);
456 // Prepare tour rotation wrapper data /
457 update_post_meta($postid, 'panodata', $pano_array);
458 $response = array(
459 'success' => true,
460 'data' => array(
461 'post_ID' => $postid,
462 'post_status' => get_post_status($postid)
463 )
464 );
465 wp_send_json($response);
466 die();
467
468 }
469
470
471 /**
472 * Responsible for showing Scene Preview
473 *
474 * @param string $panoid
475 * @param string $panovideo
476 *
477 * @return wp_send_json_success
478 * @since 8.0.0
479 */
480 public function wpvr_scene_preview($panoid, $panovideo)
481 {
482 $panodata = $this->format->prepare_panodata($_POST['panodata']);
483
484 $control = $this->format->set_checkbox_value($_POST['control']);
485 $autoload = $this->format->set_checkbox_value($_POST['autoload']);
486
487 $compass = $this->format->set_checkbox_on_value(@$_POST['compass']);
488 $mouseZoom = $this->format->set_pro_checkbox_value(@$_POST['mouseZoom']);
489 $draggable = $this->format->set_checkbox_value(@$_POST['draggable']);
490 $gzoom = $this->format->set_pro_checkbox_value(@$_POST['gzoom']);
491 $diskeyboard = $this->format->set_checkbox_value(@$_POST['diskeyboard']);
492 $keyboardzoom = $this->format->set_checkbox_value(@$_POST['keyboardzoom']);
493
494 $floor_plan_enabler = $this->format->set_pro_checkbox_value(@$_POST['wpvr_floor_plan_enabler']);
495 $floor_plan_image = isset($_POST['wpvr_floor_plan_image']) ? $_POST['wpvr_floor_plan_image'] : '';
496
497 $scene_fade_duration = sanitize_text_field($_POST['scenefadeduration']);
498 $preview = esc_url($_POST['preview']);
499
500 $default_scene = '';
501
502 $rotation = sanitize_text_field($_POST['rotation']);
503 $autorotation = sanitize_text_field($_POST['autorotation']);
504 $autorotationinactivedelay = sanitize_text_field($_POST['autorotationinactivedelay']);
505 $autorotationstopdelay = sanitize_text_field($_POST['autorotationstopdelay']);
506
507 $default_global_zoom = '';
508 $max_global_zoom = '';
509 $min_global_zoom = '';
510 if ($gzoom == 'on') {
511 $default_global_zoom = $_POST['dzoom'];
512 $max_global_zoom = $_POST['maxzoom'];
513 $min_global_zoom = $_POST['minzoom'];
514 }
515
516 $default_scene = $this->format->prepare_default_scene($panodata);
517
518 $this->validator->basic_setting_validation($autorotationinactivedelay, $autorotationstopdelay); // Basic setting error control and validation //
519
520 $this->validator->scene_validation($panodata); // Scene content error control and validation //
521
522 $this->validator->empty_scene_validation($panodata); // Empty scene content error control and validation //
523
524 $this->validator->duplicate_hotspot_validation($panodata);
525 if($floor_plan_enabler == 'on'){
526 $this->validator->empty_floor_plan_image_validation($floor_plan_image);
527 }
528
529 $default_data = array();
530 if ($gzoom == 'on') {
531 $default_data = array("firstScene" => $default_scene, "sceneFadeDuration" => $scene_fade_duration, "hfov" => $default_global_zoom, "maxHfov" => $max_global_zoom, "minHfov" => $min_global_zoom);
532 } else {
533 $default_data = array("firstScene" => $default_scene, "sceneFadeDuration" => $scene_fade_duration);
534 }
535
536 $scene_data = $this->format->prepare_scene_data_for_preview($panodata);
537
538
539 $pano_id_array = array();
540 $pano_id_array = array("panoid" => $panoid);
541 $pano_response = array();
542 $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);
543
544 $pano_response = $this->format->prepare_rotation_wrapper_data($pano_response, $rotation);
545 $is_pro = apply_filters('is_wpvr_pro_active',false);
546 $status = get_option('wpvr_edd_license_status');
547 $pano_floor_plan = array();
548 $call_to_action = array();
549 if ($status !== false && 'valid' == $status && $is_pro) {
550 $pano_floor_plan = array(
551 "floor_plan_tour_enabler" => $floor_plan_enabler,
552 "floor_plan_attachment_url" => $floor_plan_image
553 );
554 $call_to_action = array(
555 'button_enable' =>sanitize_text_field($_POST['callToAction']),
556 'button_text' =>sanitize_text_field($_POST['buttontext']),
557 'button_url' =>sanitize_text_field($_POST['buttonurl'])
558 );
559 }
560
561 $response = array();
562 $response = array($pano_id_array, $pano_response, $panovideo,$pano_floor_plan,$call_to_action);
563 wp_send_json_success($response);
564 }
565
566
567 /**
568 * Render shortcode for scene and hotspot post data
569 *
570 * @param array $postdata
571 * @param string $panoid
572 * @param integer $id
573 * @param mixed $radius
574 * @param mixed $width
575 * @param mixed $height
576 *
577 * @return string
578 * @since 8.0.0
579 */
580 public function render_scene_shortcode($postdata, $panoid, $id, $radius, $width, $height, $mobile_height)
581 {
582 $control = false;
583 if (isset($postdata['showControls'])) {
584 $control = $postdata['showControls'];
585 }
586
587 if ($control) {
588 if (isset($postdata['customcontrol'])) {
589 $custom_control = $postdata['customcontrol'];
590 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") {
591 $control = false;
592 }
593 }
594 }
595
596 $vrgallery = false;
597 if (isset($postdata['vrgallery'])) {
598 $vrgallery = $postdata['vrgallery'];
599 }
600
601 $vrgallery_title = false;
602 if (isset($postdata['vrgallery_title'])) {
603 $vrgallery_title = $postdata['vrgallery_title'];
604 }
605
606 $vrgallery_display = false;
607 if (isset($postdata['vrgallery_display'])) {
608 $vrgallery_display = $postdata['vrgallery_display'];
609 }
610 $vrgallery_icon_size = false;
611 if (isset($postdata['vrgallery_icon_size'])) {
612 $vrgallery_icon_size = $postdata['vrgallery_icon_size'];
613 }
614 $gyro = false;
615 $gyro_orientation = false;
616 if (isset($postdata['gyro'])) {
617 $gyro = $postdata['gyro'];
618 if (isset($postdata['deviceorientationcontrol'])) {
619 $gyro_orientation = $postdata['deviceorientationcontrol'];
620 }
621 }
622 //== Floor plan handle ==//
623 $floor_plan_enable = 'off';
624 $floor_plan_image = '';
625 if (isset($postdata['floor_plan_tour_enabler']) && $postdata['floor_plan_tour_enabler'] == 'on'){
626 $floor_plan_enable = $postdata['floor_plan_tour_enabler'];
627 if(isset($postdata['floor_plan_attachment_url']) && !empty($postdata['floor_plan_attachment_url'])){
628 $floor_plan_image = $postdata['floor_plan_attachment_url'];
629 }
630 }
631
632 $compass = false;
633 $audio_right = "5px";
634 if (isset($postdata['compass'])) {
635 $compass = $postdata['compass'] == 'on' || $postdata['compass'] != null ? true : false;
636 if ($compass) {
637 $audio_right = "60px";
638 }
639 }
640 $floor_map_right = "10px";
641 if((isset($postdata['compass']) && $postdata['compass'] == 'on') && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on')){
642 $floor_map_right = "85px";
643 }elseif(isset($postdata['compass']) && $postdata['compass'] == 'on'){
644 $floor_map_right = "55px";
645 }elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on") {
646 $floor_map_right = "25px";
647 }
648
649
650 //===explainer handle===//
651
652 $explainer_right = "10px";
653 if ((isset($postdata['compass']) && $postdata['compass'] == 'on') && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on') && ( $floor_plan_enable == 'on' && !empty($floor_plan_image) ) ) {
654 $explainer_right = "130px";
655 } elseif (isset($postdata['compass']) && $postdata['compass'] == 'on' && ($floor_plan_enable == 'on' && !empty($floor_plan_image) )) {
656 $explainer_right = "100px";
657 } elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on" && ($floor_plan_enable == 'on' && !empty($floor_plan_image) )) {
658 $explainer_right = "60px";
659 } elseif((isset($postdata['compass']) && $postdata['compass'] == 'on') && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on') ) {
660 $explainer_right = "80px";
661 }elseif (isset($postdata['compass']) && $postdata['compass'] == 'on') {
662 $explainer_right = "55px";
663 } elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on") {
664 $explainer_right = "30px";
665 } elseif ($floor_plan_enable == 'on' && !empty($floor_plan_image) ) {
666 $explainer_right = "40px";
667 }
668
669
670 $enable_cardboard = '';
671 $is_cardboard = get_option('wpvr_cardboard_disable');
672 if(wpvr_isMobileDevice() && $is_cardboard == 'true' ){
673 $enable_cardboard = 'enable-cardboard';
674 $audio_right = "73px";
675 if (isset($postdata['compass'])) {
676 $compass = $postdata['compass'] == 'on' || $postdata['compass'] != null ? true : false;
677 if ($compass) {
678 $audio_right = "130px";
679 }
680 }
681 //===Floor plan handle===//
682 $floor_map_right = "60px";
683 if((isset($postdata['compass']) && $postdata['compass'] == 'on') && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on')){
684 $floor_map_right = "150px";
685 }elseif(isset($postdata['compass']) && $postdata['compass'] == 'on'){
686 $floor_map_right = "120px";
687 }elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on") {
688 $floor_map_right = "90px";
689 }
690
691 //===explainer handle===//
692 $explainer_right = "65px";
693
694 if ((isset($postdata['compass']) && $postdata['compass'] == true) && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on')) {
695 $explainer_right = "150px";
696 } elseif((isset($postdata['compass']) && $postdata['compass'] == true) && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on') && ($floor_plan_enable == 'on' && !empty($floor_plan_image) )) {
697 $explainer_right = "180px";
698 } elseif (isset($postdata['compass']) && $postdata['compass'] == true && ($floor_plan_enable == 'on' && !empty($floor_plan_image) )) {
699 $explainer_right = "150px";
700 } elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on" && ($floor_plan_enable == 'on' && !empty($floor_plan_image) )) {
701 $explainer_right = "120px";
702 }elseif (isset($postdata['compass']) && $postdata['compass'] == true) {
703 $explainer_right = "130px";
704 } elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on") {
705 $explainer_right = "90px";
706 }elseif ($floor_plan_enable == 'on' && !empty($floor_plan_image) ) {
707 $explainer_right = "90px";
708 }
709 }
710
711 //===explainer handle===//
712
713 $mouseZoom = true;
714 if (isset($postdata['mouseZoom'])) {
715 if($postdata['mouseZoom'] == "off") {
716 $mouseZoom = false;
717 }
718 else {
719 $mouseZoom = true;
720 }
721 }
722
723 $draggable = true;
724 if (isset($postdata['draggable'])) {
725 $draggable = $postdata['draggable'] == 'off' || $postdata['draggable'] == null ? false : true;
726 }
727
728 $diskeyboard = false;
729 if (isset($postdata['diskeyboard'])) {
730 $diskeyboard = $postdata['diskeyboard'] == 'off' || $postdata['diskeyboard'] == null ? false : true;
731 }
732
733 $keyboardzoom = true;
734 if (isset($postdata['keyboardzoom'])) {
735 $keyboardzoom = $postdata['keyboardzoom'];
736 }
737
738 $autoload = false;
739
740 if (isset($postdata['autoLoad'])) {
741 $autoload = $postdata['autoLoad'];
742 }
743
744 $default_scene = '';
745 if (isset($postdata['defaultscene'])) {
746 $default_scene = $postdata['defaultscene'];
747 }
748
749 $default_global_zoom = '';
750 if (isset($postdata['hfov'])) {
751 $default_global_zoom = $postdata['hfov'];
752 }
753
754 $max_global_zoom = '';
755 if (isset($postdata['maxHfov'])) {
756 $max_global_zoom = $postdata['maxHfov'];
757 }
758
759 $min_global_zoom = '';
760 if (isset($postdata['minHfov'])) {
761 $min_global_zoom = $postdata['minHfov'];
762 }
763
764 $preview = '';
765 if (isset($postdata['preview'])) {
766 $preview = $postdata['preview'];
767 }
768
769 $autorotation = '';
770 if (isset($postdata["autoRotate"])) {
771 $autorotation = $postdata["autoRotate"];
772 }
773 $autorotationinactivedelay = '';
774 if (isset($postdata["autoRotateInactivityDelay"])) {
775 $autorotationinactivedelay = $postdata["autoRotateInactivityDelay"];
776 }
777 $autorotationstopdelay = '';
778 if (isset($postdata["autoRotateStopDelay"])) {
779 $autorotationstopdelay = $postdata["autoRotateStopDelay"];
780 }
781
782 $scene_fade_duration = '';
783 if (isset($postdata['scenefadeduration'])) {
784 $scene_fade_duration = $postdata['scenefadeduration'];
785 }
786
787 $panodata = '';
788 if (isset($postdata['panodata'])) {
789 $panodata = $postdata['panodata'];
790 }
791
792 $hotspoticoncolor = '#00b4ff';
793 $hotspotblink = 'on';
794 $default_data = array();
795 if ($default_global_zoom != '' && $max_global_zoom != '' && $min_global_zoom != '') {
796 $default_data = array("firstScene" => $default_scene, "sceneFadeDuration" => $scene_fade_duration, "hfov" => $default_global_zoom, "maxHfov" => $max_global_zoom, "minHfov" => $min_global_zoom);
797 } else {
798 $default_data = array("firstScene" => $default_scene, "sceneFadeDuration" => $scene_fade_duration);
799 }
800
801 $scene_data = array();
802
803 if (!empty($panodata["scene-list"])) {
804 foreach ($panodata["scene-list"] as $panoscenes) {
805 $scene_ititle = '';
806 if (isset($panoscenes["scene-ititle"])) {
807 $scene_ititle = sanitize_text_field($panoscenes["scene-ititle"]);
808 }
809
810 $scene_author = '';
811 if (isset($panoscenes["scene-author"])) {
812 $scene_author = sanitize_text_field($panoscenes["scene-author"]);
813 }
814
815 $scene_author_url = '';
816 if (isset($panoscenes["scene-author-url"])) {
817 $scene_author_url = sanitize_text_field($panoscenes["scene-author-url"]);
818 }
819
820 $scene_vaov = 180;
821 if (isset($panoscenes["scene-vaov"])) {
822 $scene_vaov = (float)$panoscenes["scene-vaov"];
823 }
824
825 $scene_haov = 360;
826 if (isset($panoscenes["scene-haov"])) {
827 $scene_haov = (float)$panoscenes["scene-haov"];
828 }
829
830
831 $scene_vertical_offset = 0;
832 if (isset($panoscenes["scene-vertical-offset"])) {
833 $scene_vertical_offset = (float)$panoscenes["scene-vertical-offset"];
834 }
835
836 $default_scene_pitch = null;
837 if (isset($panoscenes["scene-pitch"])) {
838 $default_scene_pitch = (float)$panoscenes["scene-pitch"];
839 }
840
841 $default_scene_yaw = null;
842 if (isset($panoscenes["scene-yaw"])) {
843 $default_scene_yaw = (float)$panoscenes["scene-yaw"];
844 }
845
846 $scene_max_pitch = '';
847 if (isset($panoscenes["scene-maxpitch"])) {
848 $scene_max_pitch = (float)$panoscenes["scene-maxpitch"];
849 }
850
851
852 $scene_min_pitch = '';
853 if (isset($panoscenes["scene-minpitch"])) {
854 $scene_min_pitch = (float)$panoscenes["scene-minpitch"];
855 }
856
857
858 $scene_max_yaw = '';
859 if (isset($panoscenes["scene-maxyaw"])) {
860 $scene_max_yaw = (float)$panoscenes["scene-maxyaw"];
861 }
862
863
864 $scene_min_yaw = '';
865 if (isset($panoscenes["scene-minyaw"])) {
866 $scene_min_yaw = (float)$panoscenes["scene-minyaw"];
867 }
868
869 $default_zoom = 100;
870 if (isset($panoscenes["scene-zoom"]) && $panoscenes["scene-zoom"] != "") {
871 $default_zoom = $panoscenes["scene-zoom"];
872 } else {
873 if ($default_global_zoom != '') {
874 $default_zoom = (int)$default_global_zoom;
875 }
876 }
877
878
879 $max_zoom = 120;
880 if (isset($panoscenes["scene-maxzoom"]) && $panoscenes["scene-maxzoom"] != '') {
881 $max_zoom = (int)$panoscenes["scene-maxzoom"];
882 } else {
883 if ($max_global_zoom != '') {
884 $max_zoom = (int)$max_global_zoom;
885 }
886 }
887
888
889
890 $min_zoom = 50;
891 if (isset($panoscenes["scene-minzoom"]) && $panoscenes["scene-minzoom"] != '') {
892 $min_zoom = (int)$panoscenes["scene-minzoom"];
893 } else {
894 if ($min_global_zoom != '') {
895 $min_zoom = (int)$min_global_zoom;
896 }
897 }
898
899
900 $hotspot_datas = array();
901 if (isset($panoscenes["hotspot-list"])) {
902 $hotspot_datas = $panoscenes["hotspot-list"];
903 }
904
905 $hotspots = array();
906
907
908 foreach ($hotspot_datas as $hotspot_data) {
909 $status = get_option('wpvr_edd_license_status');
910 if ($status !== false && $status == 'valid') {
911 if (isset($hotspot_data["hotspot-customclass-pro"]) && $hotspot_data["hotspot-customclass-pro"] != 'none') {
912 $hotspot_data['hotspot-customclass'] = $hotspot_data["hotspot-customclass-pro"] . ' custom-' . $id.'-' . $panoscenes['scene-id'] .'-'. $hotspot_data['hotspot-title'];
913 }
914 if (isset($hotspot_data['hotspot-blink'])) {
915 $hotspotblink = $hotspot_data['hotspot-blink'];
916 }
917 }
918 $hotspot_scene_pitch = '';
919 if (isset($hotspot_data["hotspot-scene-pitch"])) {
920 $hotspot_scene_pitch = $hotspot_data["hotspot-scene-pitch"];
921 }
922 $hotspot_scene_yaw = '';
923 if (isset($hotspot_data["hotspot-scene-yaw"])) {
924 $hotspot_scene_yaw = $hotspot_data["hotspot-scene-yaw"];
925 }
926
927 $hotspot_type = $hotspot_data["hotspot-type"] !== 'scene' ? 'info' : $hotspot_data["hotspot-type"];
928 $hotspot_content = '';
929
930 ob_start();
931 do_action('wpvr_hotspot_content', $hotspot_data);
932 $hotspot_content = ob_get_clean();
933
934 if (!$hotspot_content) {
935 $hotspot_content = $hotspot_data["hotspot-content"];
936 }
937
938 if (isset($hotspot_data["wpvr_url_open"][0])) {
939 $wpvr_url_open = $hotspot_data["wpvr_url_open"][0];
940 } else {
941 $wpvr_url_open = "off";
942 }
943 $on_hover_content = preg_replace_callback('/<img[^>]*>/', "replace_callback", $hotspot_data['hotspot-hover']);
944 $on_click_content = preg_replace_callback('/<img[^>]*>/', "replace_callback", $hotspot_content);
945 $hotspot_shape = 'round';
946 if (isset($hotspot_data["hotspot-customclass-pro"]) && $hotspot_data["hotspot-customclass-pro"] != 'none') {
947 $hotspot_shape = isset($hotspot_data["hotspot-shape"]) ? $hotspot_data["hotspot-shape"] : 'round';
948 }
949 $hotspot_info = array(
950 "text" => $hotspot_data["hotspot-title"],
951 "pitch" => $hotspot_data["hotspot-pitch"],
952 "yaw" => $hotspot_data["hotspot-yaw"],
953 "type" => $hotspot_type,
954 "cssClass" => $hotspot_data["hotspot-customclass"],
955 "URL" => $hotspot_data["hotspot-url"],
956 "wpvr_url_open" => $wpvr_url_open,
957 "clickHandlerArgs" => $on_click_content,
958 // "clickHandlerArgs" => $hotspot_content,
959 // 'createTooltipArgs' => $hotspot_data['hotspot-hover'],
960 'createTooltipArgs' => $on_hover_content,
961 "sceneId" => $hotspot_data["hotspot-scene"],
962 "targetPitch" => (float)$hotspot_scene_pitch,
963 "targetYaw" => (float)$hotspot_scene_yaw,
964 'hotspot_type' => $hotspot_data['hotspot-type'],
965 'hotspot_target' => 'notBlank',
966 'hotspot_shape' => $hotspot_shape,
967 );
968
969 $hotspot_info['URL'] = ($hotspot_data['hotspot-type'] === 'fluent_form' || $hotspot_data['hotspot-type'] === 'wc_product') ? '' : $hotspot_info['URL'];
970
971 if ($hotspot_data["hotspot-customclass"] == 'none' || $hotspot_data["hotspot-customclass"] == '') {
972 unset($hotspot_info["cssClass"]);
973 }
974 if (empty($hotspot_data["hotspot-scene"])) {
975 unset($hotspot_info['targetPitch']);
976 unset($hotspot_info['targetYaw']);
977 }
978 array_push($hotspots, $hotspot_info);
979 }
980
981 $device_scene = $panoscenes['scene-attachment-url'];
982 $mobile_media_resize = get_option('mobile_media_resize');
983 $file_accessible = ini_get('allow_url_fopen');
984 if ($mobile_media_resize == "true" && $device_scene ) {
985 if ($file_accessible == "1") {
986 $image_info = getimagesize($device_scene);
987 if ($image_info[0] > 4096) {
988 $src_to_id_for_mobile = '';
989 $src_to_id_for_desktop = '';
990 if (wpvr_isMobileDevice()) {
991 $src_to_id_for_mobile = attachment_url_to_postid($panoscenes['scene-attachment-url']);
992 if ($src_to_id_for_mobile) {
993 $mobile_scene = wp_get_attachment_image_src($src_to_id_for_mobile, 'wpvr_mobile');
994 if ($mobile_scene[3]) {
995 $device_scene = $mobile_scene[0];
996 }
997 }
998 } else {
999 $src_to_id_for_desktop = attachment_url_to_postid($panoscenes['scene-attachment-url']);
1000 if ($src_to_id_for_desktop) {
1001 $desktop_scene = wp_get_attachment_image_src($src_to_id_for_mobile, 'full');
1002 if (isset($desktop_scene[0])) {
1003 $device_scene = $desktop_scene[0];
1004 }
1005 }
1006 }
1007 }
1008 }
1009 }
1010
1011 $scene_info = array();
1012
1013 if ($panoscenes["scene-type"] == 'cubemap') {
1014 $pano_attachment = array(
1015 $panoscenes["scene-attachment-url-face0"],
1016 $panoscenes["scene-attachment-url-face1"],
1017 $panoscenes["scene-attachment-url-face2"],
1018 $panoscenes["scene-attachment-url-face3"],
1019 $panoscenes["scene-attachment-url-face4"],
1020 $panoscenes["scene-attachment-url-face5"]
1021 );
1022
1023 $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);
1024 } else {
1025 $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);
1026 }
1027
1028
1029 if (isset($panoscenes["ptyscene"])) {
1030 if ($panoscenes["ptyscene"] == "off") {
1031 unset($scene_info['pitch']);
1032 unset($scene_info['yaw']);
1033 }
1034 }
1035
1036 if (empty($panoscenes["scene-ititle"])) {
1037 unset($scene_info['title']);
1038 }
1039 if (empty($panoscenes["scene-author"])) {
1040 unset($scene_info['author']);
1041 }
1042 if (empty($panoscenes["scene-author-url"])) {
1043 unset($scene_info['authorURL']);
1044 }
1045
1046 if (empty($scene_vaov)) {
1047 unset($scene_info['vaov']);
1048 }
1049
1050 if (empty($scene_haov)) {
1051 unset($scene_info['haov']);
1052 }
1053
1054 if (empty($scene_vertical_offset)) {
1055 unset($scene_info['vOffset']);
1056 }
1057
1058 if (isset($panoscenes["cvgscene"])) {
1059 if ($panoscenes["cvgscene"] == "off") {
1060 unset($scene_info['maxPitch']);
1061 unset($scene_info['minPitch']);
1062 }
1063 }
1064 if (empty($panoscenes["scene-maxpitch"])) {
1065 unset($scene_info['maxPitch']);
1066 }
1067
1068 if (empty($panoscenes["scene-minpitch"])) {
1069 unset($scene_info['minPitch']);
1070 }
1071
1072 if (isset($panoscenes["chgscene"])) {
1073 if ($panoscenes["chgscene"] == "off") {
1074 unset($scene_info['maxYaw']);
1075 unset($scene_info['minYaw']);
1076 }
1077 }
1078 if (empty($panoscenes["scene-maxyaw"])) {
1079 unset($scene_info['maxYaw']);
1080 }
1081
1082 if (empty($panoscenes["scene-minyaw"])) {
1083 unset($scene_info['minYaw']);
1084 }
1085
1086 // if (isset($panoscenes["czscene"])) {
1087 // if ($panoscenes["czscene"] == "off") {
1088 // unset($scene_info['hfov']);
1089 // unset($scene_info['maxHfov']);
1090 // unset($scene_info['minHfov']);
1091 // }
1092 // }
1093
1094 $scene_array = array();
1095 $scene_array = array(
1096 $panoscenes["scene-id"] => $scene_info
1097 );
1098 $scene_data[$panoscenes["scene-id"]] = $scene_info;
1099 }
1100 }
1101
1102 $pano_id_array = array();
1103 $pano_id_array = array("panoid" => $panoid);
1104 $pano_response = array();
1105 $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);
1106 if (empty($autorotation)) {
1107 unset($pano_response['autoRotate']);
1108 unset($pano_response['autoRotateInactivityDelay']);
1109 unset($pano_response['autoRotateStopDelay']);
1110 }
1111 if (empty($autorotationinactivedelay)) {
1112 unset($pano_response['autoRotateInactivityDelay']);
1113 }
1114 if (empty($autorotationstopdelay)) {
1115 unset($pano_response['autoRotateStopDelay']);
1116 }
1117 $response = array();
1118 $response = array($pano_id_array, $pano_response);
1119 if (!empty($response)) {
1120 $response = json_encode($response);
1121 }
1122
1123
1124 if (empty($width)) {
1125 $width = '600px';
1126 }
1127 if (empty($height)) {
1128 $height = '400px';
1129 }
1130 $foreground_color = '#fff';
1131 $pulse_color = wpvr_hex2rgb($hotspoticoncolor);
1132 $rgb = wpvr_HTMLToRGB($hotspoticoncolor);
1133 $hsl = wpvr_RGBToHSL($rgb);
1134 if ($hsl->lightness > 200) {
1135 $foreground_color = '#000000';
1136 } else {
1137 $foreground_color = '#fff';
1138 }
1139 $html = '';
1140
1141 $html .= '<style>';
1142 if ($width == 'embed') {
1143 $html .= 'body{
1144 overflow: hidden;
1145 }';
1146 }
1147 $status = get_option('wpvr_edd_license_status');
1148 if ($status !== false && $status == 'valid') {
1149 if(isset($postdata['customcss_enable']) && $postdata['customcss_enable'] == 'on'){
1150 $html .= isset($postdata['customcss']) ? $postdata['customcss'] : '';
1151 }
1152 }
1153 $panoid2 = 'pano2'.$id;
1154 $status = get_option('wpvr_edd_license_status');
1155 if ($status !== false && $status == 'valid') {
1156 foreach ($panodata['scene-list'] as $panoscenes){
1157
1158 foreach($panoscenes['hotspot-list'] as $hotspot){
1159 if (isset($hotspot['hotspot-customclass-color-icon-value']) && !empty($hotspot['hotspot-customclass-color-icon-value'])) {
1160 $hotspoticoncolor = $hotspot['hotspot-customclass-color-icon-value'];
1161 } else {
1162 $hotspoticoncolor = "#00b4ff";
1163 }
1164 $hotspot_border = '';
1165 if(isset($hotspot['hotspot-border']) && $hotspot['hotspot-border'] == 'on'){
1166 $border_width = $hotspot['hotspot-border-width'];
1167 $border_color = $hotspot['hotspot-border-color'];
1168 $border_style = $hotspot['hotspot-border-style'];
1169 $hotspot_border = 'border: '.$border_width.'px '.$border_style.' '.$border_color.';';
1170 }
1171 $hotspot_background_color = 'background-color: ' . $hotspoticoncolor . ';';
1172 $hotspot_animation = ' animation: icon-pulse' . $panoid . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . ' 1.5s infinite cubic-bezier(.25, 0, 0, 1);
1173 '. $hotspot_border.'';
1174 $pulse_color = wpvr_hex2rgb($hotspoticoncolor);
1175 if (isset($hotspot["hotspot-customclass-pro"]) && $hotspot["hotspot-customclass-pro"] != 'none') {
1176 $border_radius = ' border-radius: 100%;';
1177 $hotspot_shape = isset($hotspot["hotspot-shape"]) ? $hotspot["hotspot-shape"] : 'round';
1178 if($hotspot_shape === 'square'){
1179 $border_radius = '';
1180 }
1181 if ($hotspot_shape === 'hexagon') {
1182 $border_radius = '';
1183 $hotspot_background_color = 'background-color: transparent;';
1184 $hotspot_animation = '';
1185 }
1186
1187 if(isset($hotspot['hotspot-custom-icon-color-value']) && !empty($hotspot['hotspot-custom-icon-color-value'])){
1188 $foreground_color = $hotspot['hotspot-custom-icon-color-value'];
1189 }
1190
1191 $html .= '#' . $panoid . ' div.pnlm-hotspot-base.fas.custom-' . $id.'-' . $panoscenes['scene-id'] .'-'. $hotspot['hotspot-title'].',
1192 #' . $panoid . ' div.pnlm-hotspot-base.fab.custom-' . $id.'-' . $panoscenes['scene-id'] .'-'. $hotspot['hotspot-title'].',
1193 #' . $panoid . ' div.pnlm-hotspot-base.fa-solid.custom-' . $id.'-' . $panoscenes['scene-id'] .'-'. $hotspot['hotspot-title'].',
1194 #' . $panoid . ' div.pnlm-hotspot-base.fa.custom-' . $id.'-' . $panoscenes['scene-id'] .'-'. $hotspot['hotspot-title'].',
1195 #' . $panoid . ' div.pnlm-hotspot-base.far.custom-' . $id.'-' . $panoscenes['scene-id'] .'-'. $hotspot['hotspot-title'].' {
1196 display: block !important;
1197 '.$hotspot_background_color.'
1198 color: ' . $foreground_color . ';
1199 '.$border_radius.'
1200 width: 30px;
1201 height: 30px;
1202 font-size: 16px;
1203 line-height: 30px;
1204 '.$hotspot_animation.'
1205 }';
1206
1207 if($hotspot_shape === 'hexagon'){
1208
1209 $html .= '#' . $panoid . ' .custom-' . $id . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . ' .hexagon-wrapper svg path {
1210 fill: ' . $hotspoticoncolor . ';
1211 }';
1212
1213 $html .= '#' . $panoid . ' .custom-' . $id . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . '.pnlm-tooltip:after{
1214 content: "";
1215 position: absolute;
1216 left: 50%;
1217 top: 50%;
1218 transform: translate(-50%, -50%);
1219 width: 85%;
1220 height: 85%;
1221 animation: icon-pulse' . $panoid . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . ' 1.5s infinite cubic-bezier(.25, 0, 0, 1);
1222 border-radius: 100%;
1223 z-index: -2;
1224 }';
1225
1226 }
1227
1228 $html .= '#' . $panoid2 . ' div.pnlm-hotspot-base.fas.custom-' . $id.'-' . $panoscenes['scene-id'] .'-'. $hotspot['hotspot-title'].',
1229 #' . $panoid2 . ' div.pnlm-hotspot-base.fab.custom-' . $id.'-' . $panoscenes['scene-id'] .'-'. $hotspot['hotspot-title'].',
1230 #' . $panoid2 . ' div.pnlm-hotspot-base.fa-solid.custom-' . $id.'-' . $panoscenes['scene-id'] .'-'. $hotspot['hotspot-title'].',
1231 #' . $panoid2 . ' div.pnlm-hotspot-base.fa.custom-' . $id.'-' . $panoscenes['scene-id'] .'-'. $hotspot['hotspot-title'].',
1232 #' . $panoid2 . ' div.pnlm-hotspot-base.far.custom-' . $id.'-' . $panoscenes['scene-id'] .'-'. $hotspot['hotspot-title'].' {
1233 display: block !important;
1234 '.$hotspot_background_color.'
1235 color: ' . $foreground_color . ';
1236 '.$border_radius.'
1237 width: 30px;
1238 height: 30px;
1239 font-size: 16px;
1240 line-height: 30px;
1241 '.$hotspot_animation.'
1242 }';
1243 }
1244 if (isset($hotspot['hotspot-blink'])) {
1245 $hotspotblink = $hotspot['hotspot-blink'];
1246 if ($hotspotblink == 'on') {
1247 $html .= '@-webkit-keyframes icon-pulse' .$panoid .'-'. $panoscenes['scene-id'] .'-'. $hotspot['hotspot-title'] .' {
1248 0% {
1249 box-shadow: 0 0 0 0px rgba(' . $pulse_color[0] . ', 1);
1250 }
1251 100% {
1252 box-shadow: 0 0 0 10px rgba(' . $pulse_color[0] . ', 0);
1253 }
1254 }
1255 @keyframes icon-pulse' . $panoid . ' {
1256 0% {
1257 box-shadow: 0 0 0 0px rgba(' . $pulse_color[0] . ', 1);
1258 }
1259 100% {
1260 box-shadow: 0 0 0 10px rgba(' . $pulse_color[0] . ', 0);
1261 }
1262 }';
1263 $html .= '@-webkit-keyframes icon-pulse' .$panoid2 .'-'. $panoscenes['scene-id'] .'-'. $hotspot['hotspot-title'] .' {
1264 0% {
1265 box-shadow: 0 0 0 0px rgba(' . $pulse_color[0] . ', 1);
1266 }
1267 100% {
1268 box-shadow: 0 0 0 10px rgba(' . $pulse_color[0] . ', 0);
1269 }
1270 }
1271 @keyframes icon-pulse' . $panoid . ' {
1272 0% {
1273 box-shadow: 0 0 0 0px rgba(' . $pulse_color[0] . ', 1);
1274 }
1275 100% {
1276 box-shadow: 0 0 0 10px rgba(' . $pulse_color[0] . ', 0);
1277 }
1278 }';
1279 }
1280 }
1281
1282 }
1283
1284 }
1285
1286 }
1287
1288 $status = get_option('wpvr_edd_license_status');
1289 if ($status !== false && $status == 'valid') {
1290 if (!$gyro) {
1291 $html .= '#' . $panoid . ' div.pnlm-orientation-button {
1292 display: none;
1293 }';
1294 }
1295 } else {
1296 $html .= '#' . $panoid . ' div.pnlm-orientation-button {
1297 display: none;
1298 }';
1299 }
1300 $floor_plan_custom_color = isset($postdata['floor_plan_custom_color']) ? $postdata['floor_plan_custom_color'] : '#cca92c';
1301 $foreground_color_pointer = '#fff';
1302 if($floor_plan_custom_color != ''){
1303 $pointer_pulse = wpvr_hex2rgb($floor_plan_custom_color);
1304 $floor_rgb = wpvr_HTMLToRGB($floor_plan_custom_color);
1305 $floor_hsl = wpvr_RGBToHSL($floor_rgb);
1306 if ($floor_hsl->lightness > 200) {
1307 $foreground_color_pointer = '#000000';
1308 }
1309 $html .= '
1310 .wpvr-floor-map .floor-plan-pointer.add-pulse:before {
1311 border: 17px solid '.$floor_plan_custom_color.';
1312 }
1313 @-webkit-keyframes pulse {
1314 0% {
1315 -webkit-box-shadow: 0 0 0 0 rgba('.$pointer_pulse[0].', 0.7);
1316 }
1317 70% {
1318 -webkit-box-shadow: 0 0 0 10px rgba('.$pointer_pulse[0].', 0);
1319 }
1320 100% {
1321 -webkit-box-shadow: 0 0 0 0 rgba('.$pointer_pulse[0].', 0);
1322 }
1323 }
1324 @keyframes pulse {
1325 0% {
1326 -moz-box-shadow: 0 0 0 0 rgba('.$pointer_pulse[0].', 0.7);
1327 box-shadow: 0 0 0 0 rgba('.$pointer_pulse[0].', 0.7);
1328 }
1329 70% {
1330 -moz-box-shadow: 0 0 0 10px rgba('.$pointer_pulse[0].', 0);
1331 box-shadow: 0 0 0 10px rgba('.$pointer_pulse[0].', 0);
1332 }
1333 100% {
1334 -moz-box-shadow: 0 0 0 0 rgba('.$pointer_pulse[0].', 0);
1335 box-shadow: 0 0 0 0 rgba('.$pointer_pulse[0].', 0);
1336 }
1337 }';
1338 }
1339
1340 $html .= '</style>';
1341
1342
1343 $scene_animation = isset($postdata['sceneAnimation']) ? $postdata['sceneAnimation'] : 'off';
1344
1345 if( $scene_animation === 'on'){
1346 $animation_type = isset($postdata['sceneAnimationName']) ? $postdata['sceneAnimationName'] : 'none';
1347 $animation_css = apply_filters('wpvr_tour_scene_animation',$animation_type,$postdata,$id);
1348 $html .= $animation_css;
1349 }
1350
1351 if ($width == 'fullwidth') {
1352 $width = "100%";
1353 }
1354
1355 if (wpvr_isMobileDevice()) {
1356 $html .= '<div id="master-container" class="wpvr-cardboard '.$enable_cardboard.'" style="max-width:' . $width . '; width: 100%; height: ' . $mobile_height . '; border-radius:' . $radius . '; direction:ltr; ">';
1357 } else {
1358 $html .= '<div id="master-container" class="wpvr-cardboard '.$enable_cardboard.'" style="max-width:' . $width . '; width: 100%; height: ' . $height . '; border-radius:' . $radius . '; direction:ltr; ">';
1359 }
1360 $is_pro = apply_filters('is_wpvr_pro_active',false);
1361 $status = get_option('wpvr_edd_license_status');
1362 $is_cardboard = get_option('wpvr_cardboard_disable');
1363 if ($status !== false && 'valid' == $status && $is_pro && wpvr_isMobileDevice() && $is_cardboard == 'true' ) {
1364 $html .= '<button class="fullscreen-button">';
1365 $html .= '<span class="expand">';
1366 $html .= '<i class="fa fa-expand" aria-hidden="true"></i>';
1367 $html .= '</span>';
1368
1369 $html .= '<span class="compress">';
1370 $html .= '<i class="fa fa-compress" aria-hidden="true"></i>';
1371 $html .= '</span>';
1372 $html .= '</button>';
1373 $embed_mode = '';
1374 if($width == "embed"){
1375 $embed_mode = "vr-embade-mode";
1376 }
1377 $html .= '<label class="wpvr-cardboard-switcher '.$embed_mode.'">
1378 <input type="checkbox" class="vr_mode_change' . $id . '" name="vr_mode_change" value="off">
1379 <span class="switcher-box">
1380 <span class="normal-mode-tooltip">Normal VR Mode</span>
1381 <svg width="78" height="60" viewBox="0 0 78 60" fill="none" xmlns="http://www.w3.org/2000/svg">
1382 <path d="M42.25 21.4286C42.25 22.2811 41.9076 23.0986 41.2981 23.7014C40.6886 24.3042 39.862 24.6429 39 24.6429C38.138 24.6429 37.3114 24.3042 36.7019 23.7014C36.0924 23.0986 35.75 22.2811 35.75 21.4286C35.75 20.5761 36.0924 19.7585 36.7019 19.1557C37.3114 18.5529 38.138 18.2143 39 18.2143C39.862 18.2143 40.6886 18.5529 41.2981 19.1557C41.9076 19.7585 42.25 20.5761 42.25 21.4286ZM19.5 30C18.9254 30 18.3743 30.2258 17.9679 30.6276C17.5616 31.0295 17.3333 31.5745 17.3333 32.1429C17.3333 32.7112 17.5616 33.2562 17.9679 33.6581C18.3743 34.06 18.9254 34.2857 19.5 34.2857H28.1667C28.7413 34.2857 29.2924 34.06 29.6987 33.6581C30.1051 33.2562 30.3333 32.7112 30.3333 32.1429C30.3333 31.5745 30.1051 31.0295 29.6987 30.6276C29.2924 30.2258 28.7413 30 28.1667 30H19.5ZM47.6667 32.1429C47.6667 31.5745 47.8949 31.0295 48.3013 30.6276C48.7076 30.2258 49.2587 30 49.8333 30H58.5C59.0746 30 59.6257 30.2258 60.0321 30.6276C60.4384 31.0295 60.6667 31.5745 60.6667 32.1429C60.6667 32.7112 60.4384 33.2562 60.0321 33.6581C59.6257 34.06 59.0746 34.2857 58.5 34.2857H49.8333C49.2587 34.2857 48.7076 34.06 48.3013 33.6581C47.8949 33.2562 47.6667 32.7112 47.6667 32.1429ZM32.5 0C31.9254 0 31.3743 0.225765 30.9679 0.627629C30.5616 1.02949 30.3333 1.57454 30.3333 2.14286V8.57143H18.4167C14.8693 8.57183 11.4528 9.89617 8.84994 12.2798C6.24706 14.6634 4.64954 17.9306 4.37667 21.4286H2.16667C1.59203 21.4286 1.04093 21.6543 0.634602 22.0562C0.228273 22.4581 0 23.0031 0 23.5714V36.4286C0 36.9969 0.228273 37.5419 0.634602 37.9438C1.04093 38.3457 1.59203 38.5714 2.16667 38.5714H4.33333V46.0714C4.33333 49.7655 5.81711 53.3083 8.45825 55.9204C11.0994 58.5325 14.6815 60 18.4167 60H25.3933C29.1269 59.9986 32.7071 58.5311 35.347 55.92L37.921 53.3786C38.0618 53.2393 38.229 53.1288 38.4131 53.0534C38.5971 52.978 38.7943 52.9392 38.9935 52.9392C39.1927 52.9392 39.3899 52.978 39.5739 53.0534C39.758 53.1288 39.9252 53.2393 40.066 53.3786L42.6357 55.92C45.2766 58.5322 48.8586 59.9998 52.5937 60H59.5833C63.3185 60 66.9006 58.5325 69.5418 55.9204C72.1829 53.3083 73.6667 49.7655 73.6667 46.0714V38.5714H75.8333C76.408 38.5714 76.9591 38.3457 77.3654 37.9438C77.7717 37.5419 78 36.9969 78 36.4286V23.5714C78 23.0031 77.7717 22.4581 77.3654 22.0562C76.9591 21.6543 76.408 21.4286 75.8333 21.4286H73.6233C73.3505 17.9306 71.753 14.6634 69.1501 12.2798C66.5472 9.89617 63.1307 8.57183 59.5833 8.57143H47.6667V2.14286C47.6667 1.57454 47.4384 1.02949 47.0321 0.627629C46.6257 0.225765 46.0746 0 45.5 0H32.5ZM69.3333 22.5V46.0714C69.3333 48.6289 68.3061 51.0816 66.4776 52.89C64.6491 54.6983 62.1692 55.7143 59.5833 55.7143H52.5937C50.0093 55.7132 47.5311 54.6973 45.7037 52.89L43.1297 50.3486C42.5864 49.8108 41.9413 49.3842 41.2312 49.0931C40.5211 48.8021 39.76 48.6522 38.9913 48.6522C38.2227 48.6522 37.4616 48.8021 36.7515 49.0931C36.0414 49.3842 35.3963 49.8108 34.853 50.3486L32.2833 52.89C30.4559 54.6973 27.9777 55.7132 25.3933 55.7143H18.4167C15.8308 55.7143 13.3509 54.6983 11.5224 52.89C9.6939 51.0816 8.66667 48.6289 8.66667 46.0714V22.5C8.66667 19.9426 9.6939 17.4899 11.5224 15.6815C13.3509 13.8731 15.8308 12.8571 18.4167 12.8571H59.5833C62.1692 12.8571 64.6491 13.8731 66.4776 15.6815C68.3061 17.4899 69.3333 19.9426 69.3333 22.5Z" fill="#216DF0"/>
1383 </svg>
1384 </span>
1385 </label>';
1386
1387 }
1388
1389 if ($width == 'fullwidth') {
1390 if (wpvr_isMobileDevice()) {
1391 $html .= '<div class="cardboard-vrfullwidth vrfullwidth">';
1392 $html .= '<div id="pano2' . $id . '" class="pano-wrap pano-left cardboard-half" style="width: 49%!important; border-radius:' . $radius . ' text-align:center; direction:ltr;" ><div id="center-pointer2' . $id . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>';
1393 $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style="width: 100%; text-align:center; direction:ltr; border-radius:' . $radius . '" >';
1394 } else {
1395 $html .= '<div id="pano2' . $id . '" class="pano-wrap pano-left" style="width: 49%; border-radius:' . $radius . '"><div id="center-pointer2' . $id . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>';
1396 if ($radius) {
1397 $html .= '<div id="pano' . $id . '" class="pano-wrap vrfullwidth" style=" text-align:center; height: ' . $height . '; border-radius:' . $radius . '; direction:ltr;" >';
1398 } else {
1399 $html .= '<div id="pano' . $id . '" class="pano-wrap vrfullwidth" style=" text-align:center; height: ' . $height . '; direction:ltr;" >';
1400 }
1401 }
1402 } elseif ($width == 'embed') {
1403 $html .= '<div class="cardboard-vrembed vrembed">';
1404 $html .= '<div id="pano2' . $id . '" class="pano-wrap pano-left" style=" width: 49%!important; text-align:center; direction:ltr;" ><div id="center-pointer2' . $id . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>';
1405 $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style=" text-align:center; direction:ltr;" >';
1406 } else {
1407 if (wpvr_isMobileDevice()) {
1408 $html .= '<div id="pano2' . $id . '" class="pano-wrap pano-left cardboard-half" style="width: 49%; border-radius:' . $radius . '"><div id="center-pointer2' . $id . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>';
1409 if ($radius) {
1410 $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style=" width: 100%; border-radius:' . $radius . ';">';
1411 } else {
1412 $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style=" width: 100%; ">';
1413 }
1414 } else {
1415 $html .= '<div id="pano2' . $id . '" class="pano-wrap pano-left" style="width: 49%; border-radius:' . $radius . '"><div id="center-pointer2' . $id . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>';
1416
1417 if ($radius) {
1418 $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style="width: 100%; border-radius:' . $radius . ';">';
1419 } else {
1420 $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style="width: 100%;">';
1421 }
1422 }
1423 }
1424 // Vr mode transction scene to scene
1425 if ($status !== false && 'valid' == $status && $is_pro) {
1426 $html .= '<div id="center-pointer' . $id . '" class="vr-pointer-container" style="display:none"><span class="center-pointer"></span></div>';
1427 }
1428 $social_logo_top = '';
1429 //===company logo===//
1430 if (isset($postdata['cpLogoSwitch'])) {
1431 $cpLogoImg = $postdata['cpLogoImg'];
1432 $cpLogoContent = $postdata['cpLogoContent'];
1433 if ($postdata['cpLogoSwitch'] == 'on') {
1434 $html .= '<div id="cp-logo-controls">';
1435 $html .= '<div class="cp-logo-ctrl" id="cp-logo">';
1436 if ($cpLogoImg) {
1437 $social_logo_top = '50px';
1438 $html .= '<img loading="lazy" src="' . $cpLogoImg . '" alt="Company Logo">';
1439 }
1440
1441 if ($cpLogoContent) {
1442 $html .= '<div class="cp-info">' . $cpLogoContent . '</div>';
1443 }
1444 $html .= '</div>';
1445 $html .= '</div>';
1446 }
1447 }
1448 //===company logo ends===//
1449
1450 //===Background Tour===//
1451 if (isset($postdata['bg_tour_enabler'])) {
1452
1453 $bg_tour_enabler = $postdata['bg_tour_enabler'];
1454 if ($bg_tour_enabler == 'on') {
1455 $bg_tour_navmenu = $postdata['bg_tour_navmenu'];
1456 $bg_tour_title = $postdata['bg_tour_title'];
1457 $bg_tour_subtitle = $postdata['bg_tour_subtitle'];
1458
1459 if ($bg_tour_navmenu == 'on') {
1460 $menuLocations = get_nav_menu_locations();
1461 if (!empty($menuLocations['primary'])) {
1462 $menuID = $menuLocations['primary'];
1463 $primaryNav = wp_get_nav_menu_items($menuID);
1464 $html .= '<ul class="wpvr-navbar-container">';
1465 foreach ($primaryNav as $primaryNav_key => $primaryNav_value) {
1466 if ($primaryNav_value->menu_item_parent == "0") {
1467 $html .= '<li>';
1468 $html .= '<a href="' . $primaryNav_value->url . '">' . $primaryNav_value->title . '</a>';
1469 $html .= '<ul class="wpvr-navbar-dropdown">';
1470 foreach ($primaryNav as $pm_key => $pm_value) {
1471 if ($pm_value->menu_item_parent == $primaryNav_value->ID) {
1472 $html .= '<li>';
1473 $html .= '<a href="' . $pm_value->url . '">' . $pm_value->title . '</a>';
1474 $html .= '</li>';
1475 }
1476 }
1477 $html .= '</ul>';
1478 $html .= '</li>';
1479 }
1480 }
1481 $html .= '</ul>';
1482 }
1483 }
1484
1485 $html .= '<div class="wpvr-home-content">';
1486 $html .= '<div class="wpvr-home-title">' . $bg_tour_title . '</div>';
1487 $html .= '<div class="wpvr-home-subtitle">' . $bg_tour_subtitle . '</div>';
1488 $html .= '</div>';
1489 }
1490 }
1491 //===Background Tour End===//
1492
1493 //===Custom Control===//
1494 if (isset($custom_control)) {
1495 if ($custom_control['panZoomInSwitch'] == "on" || $custom_control['panZoomOutSwitch'] == "on" || $custom_control['gyroscopeSwitch'] == "on" || $custom_control['backToHomeSwitch'] == "on") {
1496 $html .= '<div id="zoom-in-out-controls' . $id . '" class="zoom-in-out-controls">';
1497
1498 if ($custom_control['backToHomeSwitch'] == "on") {
1499 $html .= '<div class="ctrl" id="backToHome' . $id . '"><i class="' . $custom_control['backToHomeIcon'] . '" style="color:' . $custom_control['backToHomeColor'] . ';"></i></div>';
1500 }
1501
1502 if ($custom_control['panZoomInSwitch'] == "on") {
1503 $html .= '<div class="ctrl" id="zoom-in' . $id . '"><i class="' . $custom_control['panZoomInIcon'] . '" style="color:' . $custom_control['panZoomInColor'] . ';"></i></div>';
1504 }
1505
1506 if ($custom_control['panZoomOutSwitch'] == "on") {
1507 $html .= '<div class="ctrl" id="zoom-out' . $id . '"><i class="' . $custom_control['panZoomOutIcon'] . '" style="color:' . $custom_control['panZoomOutColor'] . ';"></i></div>';
1508 }
1509 if ($custom_control['gyroscopeSwitch'] == "on") {
1510 $html .= '<div class="ctrl" id="gyroscope' . $id . '" ><i class="' . $custom_control['gyroscopeIcon'] . '" id="' . $custom_control['gyroscopeIcon'] . '" style="color:' . $custom_control['gyroscopeColor'] . ';"></i></div>';
1511 }
1512 $html .= '</div>';
1513 }
1514 //===zoom in out Control===//
1515
1516 if ($custom_control['panupSwitch'] == "on" || $custom_control['panDownSwitch'] == "on" || $custom_control['panLeftSwitch'] == "on" || $custom_control['panRightSwitch'] == "on" || $custom_control['panFullscreenSwitch'] == "on") {
1517 //===Custom Control===//
1518 $html .= '<div class="controls" id="controls' . $id . '">';
1519
1520 if ($custom_control['panupSwitch'] == "on") {
1521 $html .= '<div class="ctrl pan-up" id="pan-up' . $id . '"><i class="' . $custom_control['panupIcon'] . '" style="color:' . $custom_control['panupColor'] . ';"></i></div>';
1522 }
1523
1524 if ($custom_control['panDownSwitch'] == "on") {
1525 $html .= '<div class="ctrl pan-down" id="pan-down' . $id . '"><i class="' . $custom_control['panDownIcon'] . '" style="color:' . $custom_control['panDownColor'] . ';"></i></div>';
1526 }
1527
1528 if ($custom_control['panLeftSwitch'] == "on") {
1529 $html .= '<div class="ctrl pan-left" id="pan-left' . $id . '"><i class="' . $custom_control['panLeftIcon'] . '" style="color:' . $custom_control['panLeftColor'] . ';"></i></div>';
1530 }
1531
1532 if ($custom_control['panRightSwitch'] == "on") {
1533 $html .= '<div class="ctrl pan-right" id="pan-right' . $id . '"><i class="' . $custom_control['panRightIcon'] . '" style="color:' . $custom_control['panRightColor'] . ';"></i></div>';
1534 }
1535
1536 if ($custom_control['panFullscreenSwitch'] == "on") {
1537 $html .= '<div class="ctrl fullscreen" id="fullscreen' . $id . '"><i class="' . $custom_control['panFullscreenIcon'] . '" style="color:' . $custom_control['panFullscreenColor'] . ';"></i></div>';
1538 }
1539 $html .= '</div>';
1540 }
1541 //===explainer button===//
1542 $explainerControlSwitch = '';
1543 if (isset($custom_control['explainerSwitch'])) {
1544 $explainerControlSwitch = $custom_control['explainerSwitch'];
1545 }
1546 if ($explainerControlSwitch == "on") {
1547 $html .= '<div class="explainer_button" id="explainer_button_' . $id . '" style="right:' . $explainer_right . '">';
1548 $html .= '<div class="ctrl" id="explainer_target_' . $id . '"><i class="' . $custom_control['explainerIcon'] . '" style="color:' . $custom_control['explainerColor'] . ';"></i></div>';
1549 $html .= '</div>';
1550 }
1551
1552 //===explainer button===//
1553 }
1554 //===Custom Control===//
1555
1556 //===Floor map button===//
1557 $status = get_option('wpvr_edd_license_status');
1558 if ($status !== false && 'valid' == $status && $is_pro){
1559 if ($floor_plan_enable == "on" && !empty($floor_plan_image)) {
1560 $html .= '<div class="floor_map_button" id="floor_map_button_' . $id . '" style="right:'.$floor_map_right.'">';
1561 $html .= '<div class="ctrl" id="floor_map_target_' . $id . '"><i class="fas fa-map" style="color:#f7fffb;"></i></div>';
1562 $html .= '</div>';
1563 }
1564 }
1565 //===floor map button===//
1566
1567 if ($vrgallery) {
1568 //===Carousal setup===//
1569 $size = '';
1570 if($vrgallery_icon_size){
1571 $size = 'vrg-icon-size-large';
1572 }
1573 $html .= '<div id="vrgcontrols' . $id . '" class="vrgcontrols">';
1574
1575 $html .= '<div class="vrgctrl' . $id . ' vrbounce '.$size.'">';
1576 $html .= '</div>';
1577 $html .= '</div>';
1578
1579 $html .= '<div id="sccontrols' . $id . '" class="scene-gallery vrowl-carousel owl-theme">';
1580 if (isset($panodata["scene-list"])) {
1581 foreach ($panodata["scene-list"] as $panoscenes) {
1582 $scene_key = $panoscenes['scene-id'];
1583 if ($vrgallery_title == 'on') {
1584 $scene_key_title = $panoscenes['scene-ititle'];
1585 // $scene_key_title = $panoscenes['scene-id'];
1586 } else {
1587 $scene_key_title = "";
1588 }
1589 if ($panoscenes['scene-type'] == 'cubemap') {
1590 $img_src_url = $panoscenes['scene-attachment-url-face0'];
1591 } else {
1592 $img_src_url = $panoscenes['scene-attachment-url'];
1593 }
1594 $src_to_id = attachment_url_to_postid($img_src_url);
1595 $thumbnail_array = wp_get_attachment_image_src($src_to_id, 'thumbnail');
1596 if ($thumbnail_array) {
1597 $thumbnail = $thumbnail_array[0];
1598 } else {
1599 $thumbnail = $img_src_url;
1600 }
1601
1602 $html .= '<ul style="width:150px;"><li title="Double click to view scene">' . $scene_key_title . '<img loading="lazy" class="scctrl" id="' . $scene_key . '_gallery_' . $id . '" src="' . $thumbnail . '"></li></ul>';
1603 }
1604 }
1605
1606 $html .= '</div>';
1607
1608 $html .= '
1609 <div class="owl-nav wpvr_slider_nav">
1610 <button type="button" role="presentation" class="owl-prev wpvr_owl_prev">
1611 <div class="nav-btn prev-slide"><i class="fa fa-angle-left"></i></div>
1612 </button>
1613 <button type="button" role="presentation" class="owl-next wpvr_owl_next">
1614 <div class="nav-btn next-slide"><i class="fa fa-angle-right"></i></div>
1615 </button>
1616 </div>
1617 ';
1618
1619 //===Carousal setup end===//
1620 }
1621 //===Call TO action Button===//
1622 $autoplay_bg_music = isset($postdata['bg_music']) ? $postdata['bg_music'] : "off";
1623 if (isset($postdata['bg_music'])) {
1624 $bg_music = $postdata['bg_music'];
1625 $bg_music_url = $postdata['bg_music_url'];
1626 $autoplay_bg_music = $postdata['autoplay_bg_music'];
1627 $loop_bg_music = $postdata['loop_bg_music'];
1628 $bg_loop = '';
1629 if ($loop_bg_music == 'on') {
1630 $bg_loop = 'loop';
1631 }
1632 if ($bg_music == 'on') {
1633 $html .= '<div id="adcontrol' . $id . '" class="adcontrol" style="right:' . $audio_right . '; $audio_left ">';
1634 $html .= '<audio id="vrAudio' . $id . '" class="vrAudioDefault" data-autoplay="' . $autoplay_bg_music . '" onended="audionEnd' . $id . '()" ' . $bg_loop . '>
1635 <source src="' . $bg_music_url . '" type="audio/mpeg">
1636 Your browser does not support the audio element.
1637 </audio>
1638 <button onclick="playPause' . $id . '()" class="ctrl audio_control" data-play="' . $autoplay_bg_music . '" data-play="' . $autoplay_bg_music . '" id="audio_control' . $id . '"><i id="vr-volume' . $id . '" class="wpvrvolumeicon' . $id . ' fas fa-volume-up" style="color:#fff;"></i></button>
1639 ';
1640 $html .= '</div>';
1641 }
1642 }
1643
1644 //===Explainer video section===//
1645 $explainerContent = "";
1646 if (isset($postdata['explainerContent'])) {
1647 $explainerContent = $postdata['explainerContent'];
1648 }
1649 $html .= '<div class="explainer" id="explainer' . $id . '" style="display: none">';
1650 $html .= '<span class="close-explainer-video"><i class="fa fa-times"></i></span>';
1651 $html .= '' . $explainerContent . '';
1652 $html .= '</div>';
1653 //===Explainer video section End===//
1654
1655 //===Scene navigation Control===//
1656 if (isset($postdata['scene_navigation']) && $postdata['scene_navigation'] === 'on') {
1657 $html .= '<style>
1658 #et-boc .et-l .pnlm-controls-container,
1659 .pnlm-controls-container{
1660 top: 33px;
1661 }
1662
1663 #et-boc .et-l .zoom-in-out-controls,
1664 .zoom-in-out-controls {
1665 top: 37px;
1666 }
1667 </style>';
1668 $html .= '<div id="custom-scene-navigation' . $id . '" class="custom-scene-navigation">
1669 <span class="hamburger-menu"><svg width="16" height="10" fill="none" viewBox="0 0 22 15" xmlns="http://www.w3.org/2000/svg"><rect width="21.177" height="2.647" fill="#f7fffb" rx="1.324"/><rect width="21.177" height="2.647" y="6.177" fill="#f7fffb" rx="1.324"/><rect width="21.177" height="2.647" y="12.352" fill="#f7fffb" rx="1.324"/></svg></span>
1670 </div>
1671
1672 <div id="custom-scene-navigation-nav' . $id . '" class="custom-scene-navigation-nav">
1673 <ul></ul>
1674 </div>
1675 ';
1676 }
1677 //===Scene navigation Control===//
1678
1679
1680 if( 'embed' === $width){
1681 if(WPVR_Helper::is_enable_social_share($postdata) === 'on'){
1682 $html .= '<div id="wpvr-social-share-bg-box'.$id.'" class="wpvr-social-share-bg-box" style="top:'.$social_logo_top.'">
1683 <span class="share-btn-svg"><svg fill="none" viewBox="0 0 24 24" width="24" height="24" ><path fill="#1F1CF4" d="M18.4 2.4a3.2 3.2 0 00-3.2 3.2 3.2 3.2 0 00.075.67L8.01 9.901A3.2 3.2 0 005.6 8.8a3.2 3.2 0 101.325 6.112 3.2 3.2 0 001.086-.812l7.261 3.632a3.2 3.2 0 101.803-2.242c-.415.189-.786.466-1.085.81l-7.261-3.63A3.2 3.2 0 008.8 12a3.2 3.2 0 00-.075-.667L15.991 7.7a3.2 3.2 0 002.41 1.1 3.2 3.2 0 100-6.4z"/></svg></span>
1684 <nav class="wpvr-share-nav">
1685 '.WPVR_Helper::social_media_share_links_display_in_embed(home_url().'/?embed_page='. $id).'
1686 </nav>
1687 </div>';
1688 }
1689 }
1690 //===Floor plan section===//
1691 $floor_map_image = "";
1692 $floor_map_pointer = array();
1693 $floor_map_scene_id = '';
1694 $floor_plan_custom_color = '#cca92c';
1695
1696 if (isset($postdata['floor_plan_attachment_url'])) {
1697 $floor_map_image = $postdata['floor_plan_attachment_url'];
1698 $floor_map_pointer = $postdata['floor_plan_pointer_position'];
1699 $floor_map_scene_id = $postdata['floor_plan_data_list'];
1700 $floor_plan_custom_color = $postdata['floor_plan_custom_color'];
1701 }
1702 $html .= '<div class="wpvr-floor-map" id="wpvr-floor-map' . $id . '" style="display: none">';
1703 $html .= '<span class="close-floor-map-plan"><i class="fa fa-times"></i></span>';
1704 $html .= '<img loading="lazy" src="'.$floor_map_image.'">';
1705 foreach($floor_map_pointer as $key=> $pointer_position){
1706 $html .= '<div class="floor-plan-pointer ui-draggable ui-draggable-handle" scene_id = "'.$floor_map_scene_id[$key]->value.'" id="'.$pointer_position->id.'" data-top="'.$pointer_position->data_top.'" data-left="'.$pointer_position->data_left.'" style="'.$pointer_position->style.'">
1707 <svg class="floor-pointer-circle" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
1708 <circle cx="12" cy="12" r="11.5" stroke="'.$floor_plan_custom_color.'"/>
1709 <circle cx="12" cy="12" r="5" fill="'.$foreground_color_pointer.'"/>
1710 </svg>
1711 <svg class="floor-pointer-flash" width="54" height="35" viewBox="0 0 54 35" fill="none" xmlns="http://www.w3.org/2000/svg">
1712 <path d="M0.454054 1.32433L11.7683 34.3243C11.9069 34.7285 12.287 35 12.7143 35H41.2857C41.713 35 42.0931 34.7285 42.2317 34.3243L53.5459 1.32432C53.7685 0.675257 53.2862 0 52.6 0H1.4C0.713843 0 0.231517 0.675258 0.454054 1.32433Z" fill="url(#paint0_linear_1_10)"/>
1713 <defs>
1714 <linearGradient id="paint0_linear_1_10" x1="27" y1="4.59807e-08" x2="26.5" y2="28" gradientUnits="userSpaceOnUse">
1715 <stop stop-color="'.$floor_plan_custom_color.'" stop-opacity="0"/>
1716 <stop offset="1" stop-color="'.$floor_plan_custom_color.'"/>
1717 </linearGradient>
1718 </defs>
1719 </svg>
1720
1721
1722 </div>';
1723 }
1724 $html .= '</div>';
1725 //===Floor plan section===//
1726
1727 $html .= '<div class="wpvr-hotspot-tweak-contents-wrapper" style="display: none">';
1728 $html .= '<i class="fa fa-times cross" data-id="' . $id . '"></i>';
1729 $html .= '<div class="wpvr-hotspot-tweak-contents-flex">';
1730 $html .= '<div class="wpvr-hotspot-tweak-contents">';
1731 ob_start();
1732 do_action('wpvr_hotspot_tweak_contents', $scene_data);
1733 $hotspot_content = ob_get_clean();
1734 $html .= $hotspot_content;
1735 $html .= '</div>';
1736 $html .= '</div>';
1737 $html .= '</div>';
1738
1739 $html .= '<div class="custom-ifram-wrapper" style="display: none;">';
1740 $html .= '<i class="fa fa-times cross" data-id="' . $id . '"></i>';
1741
1742 $html .= '<div class="custom-ifram-flex">';
1743 $html .= '<div class="custom-ifram">';
1744 $html .= '</div>';
1745 $html .= '</div>';
1746 $html .= '</div>';
1747
1748 $html .= '</div>';
1749 $html .= '</div>';
1750 if( "embed" == $width ){
1751 $html .= '</div>';
1752 }
1753
1754
1755 if ($status !== false && 'valid' == $status && $is_pro) {
1756 $call_to_action = isset($postdata['calltoaction']) ? $postdata['calltoaction'] : 'off';
1757 if( 'on' == $call_to_action){
1758 $buttontext = isset($postdata['buttontext']) ? $postdata['buttontext'] : '';
1759 $buttonurl = isset($postdata['buttonurl']) ? $postdata['buttonurl'] : '';
1760 $cta_btn_style = isset($postdata['button_configuration']) ? $postdata['button_configuration'] : array();
1761
1762 $button_open_new_tab = isset($cta_btn_style['button_open_new_tab']) ? $cta_btn_style['button_open_new_tab'] : "off";
1763 $target = '_self';
1764 $button_position = isset($cta_btn_style['button_position']) ? $cta_btn_style['button_position'] : "";
1765 $background_color = isset($cta_btn_style['button_background_color']) ? $cta_btn_style['button_background_color'] : "";
1766 $color = isset($cta_btn_style['button_font_color']) ? $cta_btn_style['button_font_color'] : "";
1767 $font_size = isset($cta_btn_style['button_font_size']) ? $cta_btn_style['button_font_size'] : "";
1768 $font_weight = isset($cta_btn_style['button_font_weight']) ? $cta_btn_style['button_font_weight'] : "";
1769 $text_align = isset($cta_btn_style['button_alignment']) ? $cta_btn_style['button_alignment'] : "";
1770 $text_transform = isset($cta_btn_style['button_transform']) ? $cta_btn_style['button_transform'] : "";
1771 $font_style = isset($cta_btn_style['button_text_style']) ? $cta_btn_style['button_text_style'] : "";
1772 $text_decoration = isset($cta_btn_style['button_text_decoration']) ? $cta_btn_style['button_text_decoration'] : "";
1773 $line_height = isset($cta_btn_style['button_line_height']) ? $cta_btn_style['button_line_height'] : "";
1774 $letter_spacing = isset($cta_btn_style['button_letter_spacing']) ? $cta_btn_style['button_letter_spacing'] : "";
1775 $word_spacing = isset($cta_btn_style['button_word_spacing']) ? $cta_btn_style['button_word_spacing'] : "";
1776
1777 $border_width = isset($cta_btn_style['button_border_width']) ? $cta_btn_style['button_border_width'] : "";
1778 $border_style = isset($cta_btn_style['button_border_style']) ? $cta_btn_style['button_border_style'] : "";
1779 $border_color = isset($cta_btn_style['button_border_color']) ? $cta_btn_style['button_border_color'] : "";
1780 $border_radius = isset($cta_btn_style['button_border_radius']) ? $cta_btn_style['button_border_radius'] : "";
1781
1782 $button_pt = isset($cta_btn_style['button_pt']) ? $cta_btn_style['button_pt'] : "";
1783 $button_pr = isset($cta_btn_style['button_pr']) ? $cta_btn_style['button_pr'] : "";
1784 $button_pb = isset($cta_btn_style['button_pb']) ? $cta_btn_style['button_pb'] : "";
1785 $button_pl = isset($cta_btn_style['button_pl']) ? $cta_btn_style['button_pl'] : "";
1786
1787 if($button_open_new_tab == 'on'){
1788 $target = '_blank';
1789 }
1790 $style = 'background-color: '.$background_color.';
1791 color: '.$color.';
1792 font-size: '.$font_size.'px;
1793 font-weight: '.$font_weight.';
1794 text-align: center;
1795 display: inline-block;
1796 text-transform: '.$text_transform.';
1797 font-style: '.$font_style.';
1798 text-decoration: '.$text_decoration.';
1799 line-height: '.$line_height.';
1800 letter-spacing: '.$letter_spacing.'px;
1801 word-spacing: '.$word_spacing.'px;
1802 border: '.$border_width.'px '.$border_style.' '.$border_color.';
1803 border-radius: '.$border_radius.'px;
1804 padding: '.$button_pt.'px '.$button_pr.'px '.$button_pb.'px '.$button_pl.'px;
1805 ';
1806 $html .= '<div class="wpvr-call-to-action-button position-'.$text_align.'" style="max-width:' . $width.'">
1807 <a href="'.$buttonurl.'" style="'.$style.'" target="'.$target.'">'.$buttontext.'</a>
1808 </div>';
1809
1810 }
1811 }
1812
1813
1814 //script started
1815 $html .= '<script>';
1816
1817
1818
1819 if (isset($postdata['bg_music'])) {
1820 if ($bg_music == 'on') {
1821 $html .= '
1822 var x' . $id . ' = document.getElementById("vrAudio' . $id . '");
1823
1824 var playing' . $id . ' = false;
1825
1826 function playPause' . $id . '() {
1827
1828 if (playing' . $id . ') {
1829 jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up");
1830 jQuery("#vr-volume' . $id . '").addClass("fas fa-volume-mute");
1831 x' . $id . '.pause();
1832 jQuery("#audio_control' . $id . '").attr("data-play", "off");
1833 playing' . $id . ' = false;
1834
1835 }
1836 else {
1837 jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute");
1838 jQuery("#vr-volume' . $id . '").addClass("fas fa-volume-up");
1839 x' . $id . '.play();
1840 jQuery("#audio_control' . $id . '").attr("data-play", "on");
1841 playing' . $id . ' = true;
1842 }
1843 }
1844
1845 function audionEnd' . $id . '() {
1846 playing' . $id . ' = false;
1847 jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up");
1848 jQuery("#vr-volume' . $id . '").addClass("fas fa-volume-mute");
1849 jQuery("#audio_control' . $id . '").attr("data-play", "off");
1850 }
1851 ';
1852
1853 if ($autoplay_bg_music == 'on') {
1854 $html .= '
1855 document.getElementById("pano' . $id . '").addEventListener("click", musicPlay' . $id . ');
1856 function musicPlay' . $id . '() {
1857 playing' . $id . ' = true;
1858 document.getElementById("vrAudio' . $id . '").play();
1859 document.getElementById("pano' . $id . '").removeEventListener("click", musicPlay' . $id . ');
1860 }
1861 ';
1862 }
1863 }
1864 }
1865 $html .= 'jQuery(document).ready(function() {';
1866 $html .= 'var response = ' . $response . ';';
1867 $html .= 'var scenes = response[1];';
1868 $html .= 'if(scenes) {';
1869 $html .= 'var scenedata = scenes.scenes;';
1870 $html .= 'for(var i in scenedata) {';
1871 $html .= 'var scenehotspot = scenedata[i].hotSpots;';
1872 $html .= 'for(var i = 0; i < scenehotspot.length; i++) {';
1873 $html .= 'if(scenehotspot[i]["clickHandlerArgs"] != "") {';
1874
1875 $html .= 'scenehotspot[i]["clickHandlerFunc"] = wpvrhotspot;';
1876 $html .= '}';
1877
1878 if (wpvr_isMobileDevice() && get_option('dis_on_hover') == "true") {
1879 } else {
1880 $html .= 'if(scenehotspot[i]["createTooltipArgs"] != "") {';
1881 $html .= 'scenehotspot[i]["createTooltipFunc"] = wpvrtooltip;';
1882 $html .= '}';
1883 }
1884
1885 $html .= '}';
1886 $html .= '}';
1887 $html .= '}';
1888 $html .= 'var panoshow' . $id . ' = pannellum.viewer(response[0]["panoid"], scenes);';
1889 //===Dplicate mode only for vr mode===//
1890 $response2 = json_decode($response);
1891 $response2[1]->compass = false;
1892 $response2[1]->autoRotate = false;
1893 $response = json_encode($response2);
1894 $html .= 'var response_duplicate = ' . $response . ';';
1895 $html .= 'var scenes_duplicate = response_duplicate[1];';
1896
1897 $html .= 'if(scenes_duplicate) {';
1898 $html .= 'var scenedata = scenes_duplicate.scenes;';
1899 $html .= 'for(var i in scenedata) {';
1900 $html .= 'var scenehotspot = scenedata[i].hotSpots;';
1901 $html .= 'for(var i = 0; i < scenehotspot.length; i++) {';
1902 $html .= 'if(scenehotspot[i]["clickHandlerArgs"] != "") {';
1903 $html .= 'scenehotspot[i]["clickHandlerFunc"] = wpvrhotspot;';
1904 $html .= '}';
1905 if (wpvr_isMobileDevice() && get_option('dis_on_hover') == "true") {
1906 } else {
1907 $html .= 'if(scenehotspot[i]["createTooltipArgs"] != "") {';
1908 $html .= 'scenehotspot[i]["createTooltipFunc"] = wpvrtooltip;';
1909 $html .= '}';
1910 }
1911 $html .= '}';
1912 $html .= '}';
1913 $html .= '}';
1914
1915 $is_pro = apply_filters('is_wpvr_pro_active',false);
1916 $status = get_option('wpvr_edd_license_status');
1917 $html .= 'var vr_mode = "off";';
1918 if ($status !== false && 'valid' == $status && $is_pro) {
1919 $html .= 'var panoshow2' . $id . ' = pannellum.viewer("pano2' . $id . '", scenes_duplicate);';
1920
1921
1922 // Show Cardboard Mode in Tour
1923 $html .= '
1924 var tim;
1925 var im = 0;
1926 var active_scene = "'.$default_scene.'";
1927 var c_time;
1928 c_time = new Date();
1929 var timer = c_time.getTime() + 2000;
1930 function panoShowCardBoardOnTrigger(data){
1931 if(scenes_duplicate) {
1932 var scenedata = scenes_duplicate.scenes;
1933 for(var i in scenedata) {
1934 if(active_scene === i) {
1935 var scenehotspot = scenedata[i].hotSpots;
1936 for(var j in scenehotspot) {
1937 var plusFiveYaw = Math.round(scenehotspot[j].yaw) + 5;
1938 var minusFiveYaw = Math.round(scenehotspot[j].yaw) - 5;
1939 var plusFivePitch = Math.round(scenehotspot[j].pitch) + 5;
1940 var minusFivePitch = Math.round(scenehotspot[j].pitch) - 5;
1941 var firstCondition = ( Math.round(data.pitch) > minusFivePitch) && (Math.round(data.pitch) < plusFivePitch) ;
1942 var secCondition = (Math.round(data.yaw) > minusFiveYaw) && (Math.round(data.yaw) < plusFiveYaw);
1943 if(( Math.round(data.pitch) > minusFivePitch) && (Math.round(data.pitch) < plusFivePitch) ){
1944 if((Math.round(data.yaw) > minusFiveYaw) && (Math.round(data.yaw) < plusFiveYaw)){
1945 jQuery(".center-pointer").addClass("wpvr-pluse-effect")
1946 var getScene = scenehotspot[j].sceneId;
1947 if(scenehotspot[j].type == "scene"){
1948 panoshow' . $id . '.loadScene(getScene);
1949 panoshow2' . $id . '.loadScene(getScene);
1950 // var inside_current_time_object = new Date();
1951 // var inside_timer = inside_current_time_object.getTime();
1952 // if(inside_timer > timer) {
1953 // panoshow' . $id . '.loadScene(getScene);
1954 // panoshow2' . $id . '.loadScene(getScene);
1955 // jQuery(".center-pointer").removeClass("wpvr-pluse-effect")
1956 // }
1957 }else{
1958 jQuery(".center-pointer").removeClass("wpvr-pluse-effect")
1959 }
1960 }
1961 else {
1962 jQuery(".center-pointer").removeClass("wpvr-pluse-effect")
1963 c_time = new Date();
1964 timer = c_time.getTime() + 2000;
1965 }
1966 }
1967 else {
1968 c_time = new Date();
1969 timer = c_time.getTime() + 2000;
1970 }
1971 }
1972 }
1973 }
1974 }
1975 };
1976
1977 function vrDeviseOrientation(){
1978 var data = {
1979 pitch: panoshow' . $id . '.getPitch(),
1980 yaw: panoshow' . $id . '.getYaw(),
1981 };
1982 panoShowCardBoardOnTrigger(data);
1983 }
1984 ';
1985
1986 $html .= '
1987
1988 function requestFullScreen(){
1989 var elem = document.getElementById("master-container");
1990 if (elem.requestFullscreen) {
1991 elem.requestFullscreen();
1992 } else if (elem.webkitRequestFullscreen) { /* Safari */
1993 elem.webkitRequestFullscreen();
1994 } else if (elem.msRequestFullscreen) { /* IE11 */
1995 elem.msRequestFullscreen();
1996 }
1997 }
1998 function requestExitFullscreen(){
1999 var elem = document.getElementById("master-container");
2000 if (document.exitFullscreen) {
2001 document.exitFullscreen();
2002 } else if (document.webkitExitFullscreen) { /* Safari */
2003 document.webkitExitFullscreen();
2004 } else if (document.msExitFullscreen) { /* IE11 */
2005 document.msExitFullscreen();
2006 }
2007 }
2008 jQuery(document).on("click",".fullscreen-button .expand",function() {
2009 jQuery(this).hide()
2010 jQuery(this).parent().find(".compress").show()
2011 requestFullScreen()
2012 });
2013 jQuery(document).on("click",".fullscreen-button .compress",function() {
2014 jQuery(this).hide()
2015 jQuery(this).parent().find(".expand").show()
2016 requestExitFullscreen()
2017 screen.orientation.unlock();
2018
2019 });
2020 ';
2021 $html .= '
2022 panoshow' . $id . '.on("scenechange", function (scene){
2023 jQuery(".center-pointer").removeClass("wpvr-pluse-effect")
2024 active_scene = scene;
2025 // if(localStorage.getItem("vr_mode") == "on") {
2026 if(vr_mode == "on") {
2027 jQuery("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2028 jQuery("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2029 }
2030 });
2031 var compassBlock = "";
2032 var infoBlock = "";
2033 jQuery(document).on("click",".vr_mode_change' . $id . '",function (){
2034 jQuery("#pano2' . $id . ' .pnlm-load-button").trigger("click");
2035 jQuery("#pano' . $id . ' .pnlm-load-button").trigger("click");
2036 var getValue = jQuery(this).val();
2037 var getParent = jQuery(this).parent().parent();
2038 var compass = getParent.find("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display");
2039 var panoInfo = getParent.find("#pano' . $id . ' .pnlm-panorama-info").css("display");
2040 if(compass == "block"){
2041 compassBlock = "block";
2042 }
2043 if(panoInfo == "block"){
2044 infoBlock = "block";
2045 }
2046
2047 if (getValue == "off") {
2048 requestFullScreen()
2049 screen.orientation.lock("landscape-primary").then(function() {
2050 }).catch(function(error) {
2051 alert("VR Glass Mode not supported in this device");
2052 });
2053 // localStorage.setItem("vr_mode", "on");
2054 vr_mode = "on";
2055 jQuery(".vr-mode-title").show();
2056 jQuery(this).val("on");
2057 getParent.find("#pano2' . $id . '").css({
2058 "opacity": "1",
2059 "visibility": "visible",
2060 "position": "relative",
2061 });
2062 gyroSwitch = true;
2063 panoshow' . $id . '.startOrientation();
2064 panoshow2' . $id . '.startOrientation();
2065
2066 panoshow2' . $id . '.setPitch(panoshow' . $id . '.getPitch(), 0);
2067 panoshow2' . $id . '.setYaw(panoshow' . $id . '.getYaw(), 0);
2068
2069 getParent.find(".pano-wrap").addClass("wpvr-cardboard-disable-event");
2070 getParent.find("#pano' .$id. ' #zoom-in-out-controls'.$id.'").hide();
2071 getParent.find("#pano' .$id. ' #controls'.$id.'").hide();
2072 getParent.find("#pano' .$id. ' #explainer_button_'.$id.'").hide();
2073 getParent.find("#pano' .$id. ' #floor_map_button_'.$id.'").hide();
2074 getParent.find("#pano' .$id. ' #vrgcontrols'.$id.'").hide();
2075 getParent.find("#pano' .$id. ' #sccontrols'.$id.'").hide();
2076 getParent.find("#pano' .$id. ' #adcontrol'.$id.'").hide();
2077 getParent.find("#pano' .$id. ' .owl-nav.wpvr_slider_nav").hide();
2078 getParent.find("#pano' .$id. ' #cp-logo-controls").hide();
2079 getParent.find("#pano' .$id. ' #wpvr-social-share-bg-box'.$id.'").hide();
2080
2081 getParent.find("#pano2' . $id . ' .pnlm-controls-container").hide();
2082 getParent.find("#pano' . $id . ' .pnlm-controls-container").hide();
2083
2084 getParent.find("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").hide();
2085 getParent.find("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").hide();
2086
2087 getParent.find("#pano2' . $id . ' .pnlm-panorama-info").hide();
2088 getParent.find("#pano' . $id . ' .pnlm-panorama-info").hide();
2089 getParent.find("#pano' . $id . '").addClass("cardboard-half");
2090 getParent.find("#center-pointer' . $id . '").show();
2091 getParent.find(".fullscreen-button").hide();
2092
2093 getParent.find("#pano' . $id . ' #custom-scene-navigation' . $id . '").hide();
2094
2095 if (window.DeviceOrientationEvent) {
2096 window.addEventListener("deviceorientation", vrDeviseOrientation);
2097 }
2098
2099 panoshow' . $id . '.on("zoomchange", function (data){
2100 panoshow2' . $id . '.setHfov(data, 0);
2101 });
2102
2103 panoshow2' . $id . '.on("zoomchange", function (data){
2104 panoshow' . $id . '.setHfov(data, 0);
2105 });
2106
2107 jQuery(document).on("click","#pano2' . $id . '",function(event) {
2108 panoshow' . $id . '.startOrientation();
2109 panoshow2' . $id . '.startOrientation();
2110
2111 });
2112
2113 jQuery(document).on("click","#pano' . $id . '",function(event) {
2114 panoshow' . $id . '.startOrientation();
2115 panoshow2' . $id . '.startOrientation();
2116 });
2117
2118 panoshow' . $id . '.on("mousemove", function (data){
2119 panoshow2' . $id . '.setPitch(data.pitch, 0);
2120 panoshow2' . $id . '.setYaw(data.yaw, 0);
2121 panoShowCardBoardOnTrigger(data);
2122
2123 });
2124 panoshow2' . $id . '.on("mousemove", function (data){
2125 panoshow' . $id . '.setPitch(data.pitch, 0);
2126 panoshow' . $id . '.setYaw(data.yaw, 0);
2127 panoShowCardBoardOnTrigger(data);
2128
2129 });
2130
2131
2132 panoshow' . $id . '.on("touchmove", function (data){
2133 panoshow' . $id . '.stopOrientation();
2134 panoshow2' . $id . '.stopOrientation();
2135 panoshow2' . $id . '.setPitch(data.pitch, 0);
2136 panoshow2' . $id . '.setYaw(data.yaw, 0);
2137 panoShowCardBoardOnTrigger(data);
2138
2139 });
2140
2141 panoshow2' . $id . '.on("touchmove", function (data){
2142 panoshow' . $id . '.stopOrientation();
2143 panoshow2' . $id . '.stopOrientation();
2144 panoshow' . $id . '.setPitch(data.pitch, 0);
2145 panoshow' . $id . '.setYaw(data.yaw, 0);
2146 panoShowCardBoardOnTrigger(data);
2147
2148 });
2149
2150 }
2151 else if(getValue == "on") {
2152 screen.orientation.unlock();
2153 requestExitFullscreen();
2154 // localStorage.setItem("vr_mode", "off");
2155 vr_mode = "off";
2156 jQuery(".vr-mode-title").hide();
2157 jQuery(this).val("off");
2158 getParent.find("#pano2' . $id . '").css({
2159 "opacity": "0",
2160 "visibility": "hidden",
2161 "position": "absolute",
2162 });
2163 getParent.find(".pano-wrap").removeClass("wpvr-cardboard-disable-event");
2164
2165 getParent.find("#pano' .$id. ' #zoom-in-out-controls'.$id.'").show();
2166 getParent.find("#pano' .$id. ' #controls'.$id.'").show();
2167 getParent.find("#pano' .$id. ' #explainer_button_'.$id.'").show();
2168 getParent.find("#pano' .$id. ' #floor_map_button_'.$id.'").show();
2169
2170 getParent.find("#pano2' . $id . ' .pnlm-controls-container").show();
2171 getParent.find("#pano' . $id . ' .pnlm-controls-container").show();
2172 getParent.find("#pano' .$id. ' #vrgcontrols'.$id.'").show();
2173 getParent.find("#pano' .$id. ' #sccontrols'.$id.'").hide();
2174 getParent.find("#pano' .$id. ' #adcontrol'.$id.'").show();
2175 getParent.find("#pano' .$id. ' .owl-nav.wpvr_slider_nav").hide();
2176 getParent.find("#pano' .$id. ' #cp-logo-controls").show();
2177 getParent.find("#pano' .$id. ' #wpvr-social-share-bg-box'.$id.'").show();
2178
2179 getParent.find("#pano' . $id . ' #custom-scene-navigation' . $id . '").show();
2180
2181 if(compassBlock == "block"){
2182 getParent.find("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").show();
2183 getParent.find("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").show();
2184 }
2185 if(infoBlock == "block"){
2186 getParent.find("#pano2' . $id . ' .pnlm-panorama-info").show();
2187 getParent.find("#pano' . $id . ' .pnlm-panorama-info").show();
2188 }
2189 getParent.find("#pano' . $id . '").removeClass("cardboard-half");
2190 getParent.find("#center-pointer' . $id . '").hide();
2191 getParent.find(".fullscreen-button").hide();
2192 panoshow' . $id . '.off("mousemove");
2193 panoshow' . $id . '.off("touchmove");
2194 panoshow2' . $id . '.off("mousemove");
2195 panoshow2' . $id . '.off("touchmove");
2196 if (window.DeviceOrientationEvent) {
2197 window.removeEventListener("deviceorientation", vrDeviseOrientation);
2198 }
2199 }
2200 });';
2201
2202 $html .= 'panoshow2' . $id . '.on("load", function (){
2203 // if(localStorage.getItem("vr_mode") == "off") {
2204 if( vr_mode == "off") {
2205 jQuery(".vr-mode-title").hide();
2206 }
2207 else {
2208 jQuery("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2209 jQuery("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2210 jQuery("#pano2' . $id . ' .pnlm-panorama-info").hide();
2211 jQuery("#pano' . $id . ' .pnlm-panorama-info").hide();
2212 jQuery(".vr-mode-title").show();
2213 }
2214 });';
2215 }
2216
2217 //=== end Dplicate mode only for vr mode===//
2218
2219 $html .= 'jQuery("#pano' . $id . ' .wpvr-floor-map .floor-plan-pointer").on("click",function(){
2220 var scene_id = jQuery(this).attr("scene_id");
2221 panoshow' . $id . '.loadScene(scene_id)
2222 jQuery(".floor-plan-pointer").removeClass("add-pulse")
2223 jQuery(this).addClass("add-pulse")
2224
2225 });';
2226
2227 if($scene_animation == 'on'){
2228 $animation_js = apply_filters('wpvr_scene_animation_js', $id, $animation_type);
2229 $html .= $animation_js;
2230 $html .= 'panoshow' . $id . '.on("load", function (scene){
2231 if (typeof changeScene === "function") {
2232 changeScene();
2233 } else {
2234 console.warn("changeScene function is not defined.");
2235 }
2236 });';
2237 }
2238
2239
2240 $html .= '
2241 panoshow' . $id . '.on("mousemove", function (data){
2242 jQuery(".add-pulse").css({"transform":"rotate("+data.yaw+"deg)"});
2243 });
2244 ';
2245
2246
2247 $status = get_option('wpvr_edd_license_status');
2248 if ($status !== false && 'valid' == $status && $is_pro){
2249 $html .= 'panoshow' . $id . '.on("scenechange", function (scene){
2250 jQuery(".center-pointer").removeClass("wpvr-pluse-effect")
2251 jQuery(".floor-plan-pointer").each(function(index ,element){
2252 var scene_id = jQuery(this).attr("scene_id");
2253 if( active_scene == scene_id ){
2254 jQuery(".floor-plan-pointer").removeClass("add-pulse")
2255 jQuery(this).addClass("add-pulse")
2256 }
2257 });
2258
2259 });';
2260 $html .= 'panoshow' . $id . '.on("load", function (){
2261 if(jQuery(".floor-plan-pointer").length > 0){
2262 jQuery(".floor-plan-pointer").each(function(index ,element){
2263 var scene_id = jQuery(this).attr("scene_id");
2264 if( active_scene == scene_id ){
2265 jQuery(".floor-plan-pointer").removeClass("add-pulse")
2266 jQuery(this).addClass("add-pulse")
2267 }
2268 });
2269 }
2270 });';
2271 }
2272
2273 if ($status !== false && 'valid' == $status && $is_pro){
2274 $scene_navigation_content_type = isset($postdata['scene_navigation_content_type']) ? $postdata['scene_navigation_content_type'] : 'scene_id';
2275 $html .= '
2276 jQuery("#pano' . $id . ' .custom-scene-navigation").on("click",function(){
2277 jQuery("#custom-scene-navigation-nav' . $id . ' ul").empty()
2278 if(scenes){
2279 var scene_navigation_content_type = '."'".$scene_navigation_content_type."'" .';
2280 var sceneList = scenes.scenes;
2281 var getScene = panoshow' . $id . '.getScene();
2282 for (const key in sceneList) {
2283 let title;
2284 if (scene_navigation_content_type === "scene_title") {
2285 if (sceneList[key].title) {
2286 title = sceneList[key].title;
2287
2288 }else{
2289 if(title == "" || title == undefined){
2290 if (sceneList[key].panorama) {
2291 title = getImageNameWithoutExtension(sceneList[key].panorama);
2292 }
2293 }
2294 }
2295 } else if (scene_navigation_content_type === "scene_image_name") {
2296 if (sceneList[key].panorama) {
2297 title = getImageNameWithoutExtension(sceneList[key].panorama);
2298 }
2299 } else {
2300 title = key;
2301 }
2302 if (sceneList.hasOwnProperty(key)) {
2303 if( key === getScene){
2304 jQuery("#custom-scene-navigation-nav' . $id . ' ul").append("<li class=\"scene-navigation-list active\" scene_id= " + key + " >" + title + "</li>");
2305 }else{
2306 jQuery("#custom-scene-navigation-nav' . $id . ' ul").append("<li class=\"scene-navigation-list\" scene_id= " + key + " >" + title + "</li>");
2307 }
2308 }
2309 }
2310 }
2311 jQuery("#custom-scene-navigation-nav' . $id . '").toggleClass("visible");
2312 });
2313 ';
2314
2315 $html .='function getImageNameWithoutExtension(imageUrl) {
2316 // Split the URL by "/"
2317 var parts = imageUrl.split("/");
2318
2319 // Get the last part which contains the image name
2320 var imageNameWithExtension = parts[parts.length - 1];
2321
2322 // Split the image name by period (.)
2323 var imageNameParts = imageNameWithExtension.split(".");
2324
2325 // Remove the last part (which is the extension) and join the remaining parts
2326 var imageNameWithoutExtension = imageNameParts.slice(0, -1).join(".");
2327
2328 // Return the image name without extension
2329 return imageNameWithoutExtension;
2330 }';
2331
2332
2333 $html .= '
2334 jQuery("#pano' . $id . ' #custom-scene-navigation-nav' . $id . ' ul").on("click", "li.scene-navigation-list", function() {
2335 if (scenes) {
2336 jQuery(this).siblings("li").removeClass("active");
2337 jQuery(this).addClass("active");
2338
2339 var scene_key = jQuery(this).attr("scene_id");
2340 panoshow' . $id . '.loadScene(scene_key);
2341 }
2342 });
2343 ';
2344 }
2345
2346 $html .= '
2347 const node = document.querySelector(".add-pulse");
2348 panoshow' . $id . '.on("compasschange", function (data){
2349 console.log(data);
2350 // const node = document.querySelector(".add-pulse");
2351 // node.style.transform = data;
2352 // jQuery(".add-pulse").css({"transform":data});
2353
2354 });
2355 ';
2356 $html .= 'panoshow' . $id . '.on("load", function (){
2357 // if(localStorage.getItem("vr_mode") == "off") {
2358 if(vr_mode == "off") {
2359 jQuery(".vr-mode-title").hide();
2360 }
2361 else {
2362 jQuery("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2363 jQuery("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2364 jQuery("#pano2' . $id . ' .pnlm-panorama-info").hide();
2365 jQuery("#pano' . $id . ' .pnlm-panorama-info").hide();
2366 jQuery(".vr-mode-title").show();
2367 }
2368 setTimeout(() => {
2369 window.dispatchEvent(new Event("resize"));
2370 }, 200);
2371 if (jQuery("#pano' . $id . '").children().children(".pnlm-panorama-info:visible").length > 0) {
2372 jQuery("#controls' . $id . '").css("bottom", "55px");
2373 }
2374 else {
2375 jQuery("#controls' . $id . '").css("bottom", "5px");
2376 }
2377 });';
2378
2379 $html .= 'panoshow' . $id . '.on("render", function (){
2380 window.dispatchEvent(new Event("resize"));
2381 });';
2382
2383 $html .= '
2384 if (scenes.autoRotate) {
2385 panoshow' . $id . '.on("load", function (){
2386 setTimeout(function(){ panoshow' . $id . '.startAutoRotate(scenes.autoRotate, 0); }, 3000);
2387 });
2388 panoshow' . $id . '.on("scenechange", function (){
2389 setTimeout(function(){ panoshow' . $id . '.startAutoRotate(scenes.autoRotate, 0); }, 3000);
2390 });
2391 }
2392 ';
2393 $html .= 'var touchtime = 0;';
2394 if ($vrgallery) {
2395 if (isset($panodata["scene-list"])) {
2396 foreach ($panodata["scene-list"] as $panoscenes) {
2397 $scene_key = $panoscenes['scene-id'];
2398 $scene_key_gallery = $panoscenes['scene-id'] . '_gallery_' . $id;
2399 $img_src_url = $panoscenes['scene-attachment-url'];
2400 // $html .= 'document.getElementById("'.$scene_key_gallery.'").addEventListener("click", function(e) { ';
2401 // $html .= 'if (touchtime == 0) {';
2402 // $html .= 'touchtime = new Date().getTime();';
2403 // $html .= '} else {';
2404 // $html .= 'if (((new Date().getTime()) - touchtime) < 800) {';
2405 // $html .= 'panoshow'.$id.'.loadScene("'.$scene_key.'");';
2406 // $html .= 'touchtime = 0;';
2407 // $html .= '} else {';
2408 // $html .= 'touchtime = new Date().getTime();';
2409 // $html .= '}';
2410 // $html .= '}';
2411 // $html .= '});';
2412 $html .= '
2413 jQuery(document).on("click","#' . $scene_key_gallery . '",function() {
2414 panoshow' . $id . '.loadScene("' . $scene_key . '");
2415 });
2416 ';
2417 }
2418 }
2419 }
2420
2421 //===Custom Control===//
2422 if (isset($custom_control)) {
2423 if ($custom_control['panupSwitch'] == "on") {
2424 $html .= 'document.getElementById("pan-up' . $id . '").addEventListener("click", function(e) {';
2425 $html .= 'panoshow' . $id . '.setPitch(panoshow' . $id . '.getPitch() + 10);';
2426 $html .= '});';
2427 }
2428
2429 if ($custom_control['panDownSwitch'] == "on") {
2430 $html .= 'document.getElementById("pan-down' . $id . '").addEventListener("click", function(e) {';
2431 $html .= 'panoshow' . $id . '.setPitch(panoshow' . $id . '.getPitch() - 10);';
2432 $html .= '});';
2433 }
2434
2435 if ($custom_control['panLeftSwitch'] == "on") {
2436 $html .= 'document.getElementById("pan-left' . $id . '").addEventListener("click", function(e) {';
2437 $html .= 'panoshow' . $id . '.setYaw(panoshow' . $id . '.getYaw() - 10);';
2438 $html .= '});';
2439 }
2440
2441 if ($custom_control['panRightSwitch'] == "on") {
2442 $html .= 'document.getElementById("pan-right' . $id . '").addEventListener("click", function(e) {';
2443 $html .= 'panoshow' . $id . '.setYaw(panoshow' . $id . '.getYaw() + 10);';
2444 $html .= '});';
2445 }
2446
2447 if ($custom_control['panZoomInSwitch'] == "on") {
2448 $html .= 'document.getElementById("zoom-in' . $id . '").addEventListener("click", function(e) {';
2449 $html .= 'panoshow' . $id . '.setHfov(panoshow' . $id . '.getHfov() - 10);';
2450 $html .= '});';
2451 }
2452
2453 if ($custom_control['panZoomOutSwitch'] == "on") {
2454 $html .= 'document.getElementById("zoom-out' . $id . '").addEventListener("click", function(e) {';
2455 $html .= 'panoshow' . $id . '.setHfov(panoshow' . $id . '.getHfov() + 10);';
2456 $html .= '});';
2457 }
2458
2459 if ($custom_control['panFullscreenSwitch'] == "on") {
2460 $html .= 'document.getElementById("fullscreen' . $id . '").addEventListener("click", function(e) {';
2461 $html .= 'panoshow' . $id . '.toggleFullscreen();';
2462 $html .= '});';
2463 }
2464
2465 if ($custom_control['backToHomeSwitch'] == "on") {
2466 $html .= 'document.getElementById("backToHome' . $id . '").addEventListener("click", function(e) {';
2467 $html .= 'panoshow' . $id . '.loadScene("' . $default_scene . '");';
2468 $html .= '});';
2469 }
2470
2471 if ($custom_control['gyroscopeSwitch'] == "on") {
2472 $html .= '
2473 var element = document.getElementById("gyroscope' . $id . '");
2474 var gyroSwitch = true;
2475 panoshow' . $id . '.on("load", function (){
2476 if(gyroSwitch == false) {
2477 panoshow' . $id . '.stopOrientation();
2478 element.children[0].style.color = "red";
2479 }
2480 else {
2481 panoshow' . $id . '.startOrientation();
2482 element.children[0].style.color = "'.$custom_control['gyroscopeColor'].'";
2483 }
2484 });
2485 panoshow' . $id . '.on("scenechange", function (){
2486 if (panoshow' . $id . '.isOrientationActive()) {
2487 element.children[0].style.color = "'.$custom_control['gyroscopeColor'].'";
2488 }
2489 else {
2490 element.children[0].style.color = "red";
2491 }
2492 });
2493
2494 panoshow' . $id . '.on("touchstart", function (){
2495 if (panoshow' . $id . '.isOrientationActive()) {
2496 gyroSwitch = true;
2497 element.children[0].style.color = "'.$custom_control['gyroscopeColor'].'";
2498 }
2499 else {
2500 gyroSwitch = false;
2501 element.children[0].style.color = "red";
2502 }
2503 });
2504 ';
2505 $html .= 'document.getElementById("gyroscope' . $id . '").addEventListener("click", function(e) {';
2506 $html .= '
2507 var element = document.getElementById("gyroscope' . $id . '");
2508 if (panoshow' . $id . '.isOrientationActive()) {
2509
2510 panoshow' . $id . '.stopOrientation();
2511 gyroSwitch = false;
2512 element.children[0].style.color = "red";
2513 }
2514 else {
2515 panoshow' . $id . '.startOrientation();
2516 gyroSwitch = true;
2517 element.children[0].style.color = "'.$custom_control['gyroscopeColor'].'";
2518 }
2519
2520 ';
2521 $html .= '});';
2522 }
2523 }
2524
2525 $angle_up = '<i class="fa fa-angle-up"></i>';
2526 $angle_down = '<i class="fa fa-angle-down"></i>';
2527 $sin_qout = "'";
2528
2529 //===Explainer Script===//
2530
2531 if ($autoplay_bg_music == 'on') {
2532
2533 $html .= '
2534 jQuery(document).on("click","#explainer_button_' . $id . '",function() {
2535 jQuery("#explainer' . $id . '").slideToggle();
2536
2537 playing' . $id . ' = false;
2538 var x' . $id . ' = document.getElementById("vrAudio' . $id . '");
2539 jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up");
2540 jQuery("#vr-volume' . $id . '").addClass("fas fa-volume-mute");
2541 x' . $id . '.pause();
2542 });
2543
2544 jQuery(document).on("click",".close-explainer-video",function() {
2545 jQuery(this).parent(".explainer").hide();
2546 var el_src = jQuery(".vr-iframe").attr("src");
2547 jQuery(".vr-iframe").attr("src", el_src);
2548 });
2549
2550 ';
2551 } else {
2552 $html .= '
2553 jQuery(document).on("click","#explainer_button_' . $id . '",function() {
2554 jQuery("#explainer' . $id . '").slideToggle();
2555 });
2556
2557 jQuery(document).on("click",".close-explainer-video",function() {
2558 jQuery(this).parent(".explainer").hide();
2559 var el_src = jQuery(".vr-iframe").attr("src");
2560 jQuery(".vr-iframe").attr("src", el_src);
2561 });
2562
2563 ';
2564 }
2565
2566 //===Explainer Script End===//
2567
2568
2569 //===Floor map Script===//
2570 $html .= '
2571 jQuery(document).on("click","#floor_map_button_' . $id . '",function() {
2572 jQuery("#wpvr-floor-map' . $id . '").toggle().removeClass("fullwindow");
2573 });
2574
2575 jQuery(document).on("dblclick","#wpvr-floor-map' . $id . '",function(){
2576 jQuery(this).addClass("fullwindow");
2577 jQuery(this).parents(".pano-wrap").addClass("show-modal");
2578 });
2579
2580 jQuery(document).on("click",".close-floor-map-plan",function() {
2581 jQuery(this).parent(".wpvr-floor-map").hide();
2582 jQuery(this).parent(".wpvr-floor-map").removeClass("fullwindow");
2583 jQuery(this).parents(".pano-wrap").removeClass("show-modal");
2584 });
2585
2586 ';
2587 //===Floor map Script End===//
2588
2589 if ($vrgallery_display) {
2590
2591 if (!$autoload) {
2592 $html .= '
2593 jQuery(document).ready(function($){
2594 jQuery("#sccontrols' . $id . '").hide();
2595 jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
2596 jQuery("#sccontrols' . $id . '").hide();
2597 jQuery(".wpvr_slider_nav").hide();
2598 });
2599 ';
2600
2601 $html .= '
2602 var slide' . $id . ' = "down";
2603 jQuery(document).on("click","#vrgcontrols' . $id . '",function() {
2604
2605 if (slide' . $id . ' == "up") {
2606 jQuery(".vrgctrl' . $id . '").empty();
2607 jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
2608 slide' . $id . ' = "down";
2609 }
2610 else {
2611 jQuery(".vrgctrl' . $id . '").empty();
2612 jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . ');
2613 slide' . $id . ' = "up";
2614 }
2615 jQuery(".wpvr_slider_nav").slideToggle();
2616 jQuery("#sccontrols' . $id . '").slideToggle();
2617 });
2618 ';
2619 } else {
2620 $html .= '
2621 jQuery(document).ready(function($){
2622 jQuery("#sccontrols' . $id . '").show();
2623 jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . ');
2624 jQuery(".wpvr_slider_nav").show();
2625 });
2626 ';
2627
2628 $html .= '
2629 var slide' . $id . ' = "down";
2630 jQuery(document).on("click","#vrgcontrols' . $id . '",function() {
2631
2632 if (slide' . $id . ' == "up") {
2633 jQuery(".vrgctrl' . $id . '").empty();
2634 jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . ');
2635 slide' . $id . ' = "down";
2636 }
2637 else {
2638 jQuery(".vrgctrl' . $id . '").empty();
2639 jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
2640 slide' . $id . ' = "up";
2641 }
2642 jQuery(".wpvr_slider_nav").slideToggle();
2643 jQuery("#sccontrols' . $id . '").slideToggle();
2644 });
2645 ';
2646 }
2647 } else {
2648 $html .= '
2649 jQuery(document).ready(function($){
2650 jQuery("#sccontrols' . $id . '").hide();
2651 jQuery(".wpvr_slider_nav").hide();
2652 jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
2653 });
2654 ';
2655
2656 $html .= '
2657 var slide' . $id . ' = "down";
2658 jQuery(document).on("click","#vrgcontrols' . $id . '",function() {
2659
2660 if (slide' . $id . ' == "up") {
2661 jQuery(".vrgctrl' . $id . '").empty();
2662 jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
2663 slide' . $id . ' = "down";
2664 }
2665 else {
2666 jQuery(".vrgctrl' . $id . '").empty();
2667 jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . ');
2668 slide' . $id . ' = "up";
2669 }
2670 jQuery(".wpvr_slider_nav").slideToggle();
2671 jQuery("#sccontrols' . $id . '").slideToggle();
2672 });
2673 ';
2674 }
2675
2676
2677
2678
2679 if (!$autoload) {
2680 $html .= '
2681 jQuery(document).ready(function(){
2682 jQuery("#controls' . $id . '").hide();
2683 jQuery("#zoom-in-out-controls' . $id . '").hide();
2684 jQuery("#adcontrol' . $id . '").hide();
2685 jQuery("#explainer_button_' . $id . '").hide();
2686 jQuery("#floor_map_button_' . $id . '").hide();
2687 jQuery("#vrgcontrols' . $id . '").hide();
2688 jQuery("#pano' . $id . '").find(".pnlm-panorama-info").hide();
2689 });
2690
2691 ';
2692
2693 if ($vrgallery_display) {
2694 $html .= 'var load_once = "true";';
2695 $html .= 'panoshow' . $id . '.on("load", function (){
2696 if (load_once == "true") {
2697 load_once = "false";
2698 jQuery("#sccontrols' . $id . '").slideToggle();
2699 }
2700 });';
2701 }
2702
2703 $html .= 'panoshow' . $id . '.on("load", function (){
2704 jQuery("#controls' . $id . '").show();
2705 jQuery("#zoom-in-out-controls' . $id . '").show();
2706 jQuery("#adcontrol' . $id . '").show();
2707 jQuery("#explainer_button_' . $id . '").show();
2708 jQuery("#floor_map_button_' . $id . '").show();
2709 jQuery("#vrgcontrols' . $id . '").show();
2710 jQuery("#pano' . $id . '").find(".pnlm-panorama-info").show();
2711 });';
2712 }
2713
2714 //==Old code working properly==//
2715
2716 $previeword = "Click to Load Panorama";
2717 if (isset($postdata['previewtext']) && $postdata['previewtext'] != '') {
2718 $previeword = $postdata['previewtext'];
2719 }
2720 $html .= '
2721 jQuery(".elementor-tab-title").click(function(){
2722 var element_id;
2723 var pano_id;
2724 var element_id = this.id;
2725 element_id = element_id.split("-");
2726 element_id = element_id[3];
2727 jQuery("#elementor-tab-content-"+element_id).find("#master-container").children("div").eq(1).addClass("awwww");
2728 var pano_id = jQuery(".awwww").attr("id");
2729 jQuery("#elementor-tab-content-"+element_id).find("#master-container").children("div").eq(1).removeClass("awwww");;
2730 if (pano_id != undefined) {
2731 pano_id = pano_id.split("o");
2732 pano_id = pano_id[1];
2733 if (pano_id == "' . $id . '") {
2734 jQuery("#pano' . $id . '").children(".pnlm-render-container").remove();
2735 jQuery("#pano' . $id . '").children(".pnlm-ui").remove();
2736 panoshow' . $id . ' = pannellum.viewer(response[0]["panoid"], scenes);
2737 jQuery("#pano' . $id . '").children(".pnlm-ui").find(".pnlm-load-button p").text("' . $previeword . '")
2738 setTimeout(function() {
2739 // panoshow' . $id . '.loadScene("' . $default_scene . '");
2740 window.dispatchEvent(new Event("resize"));
2741 if (jQuery("#pano' . $id . '").children().children(".pnlm-panorama-info:visible").length > 0) {
2742 jQuery("#controls' . $id . '").css("bottom", "55px");
2743 }
2744 else {
2745 jQuery("#controls' . $id . '").css("bottom", "5px");
2746 }
2747
2748 }, 200);
2749 }
2750 }
2751 });
2752 ';
2753 $html .= '
2754 jQuery(".geodir-tab-head dd, #vr-tour-tab").click(function(){
2755 jQuery("#pano' . $id . '").children(".pnlm-render-container").remove();
2756 jQuery("#pano' . $id . '").children(".pnlm-ui").remove();
2757 panoshow' . $id . ' = pannellum.viewer(response[0]["panoid"], scenes);
2758 setTimeout(function() {
2759 panoshow' . $id . '.loadScene("' . $default_scene . '");
2760 window.dispatchEvent(new Event("resize"));
2761 if (jQuery("#pano' . $id . '").children().children(".pnlm-panorama-info:visible").length > 0) {
2762 jQuery("#controls' . $id . '").css("bottom", "55px");
2763 }
2764 else {
2765 jQuery("#controls' . $id . '").css("bottom", "5px");
2766 }
2767 }, 200);
2768 });
2769 ';
2770 if (isset($postdata['previewtext']) && $postdata['previewtext'] != '') {
2771 $html .= '
2772 jQuery("#pano' . $id . '").children(".pnlm-ui").find(".pnlm-load-button p").text("' . $postdata['previewtext'] . '")
2773 ';
2774 }
2775
2776 if ($default_global_zoom != '' || $max_global_zoom != '' || $min_global_zoom != '') {
2777 $html .= '
2778 jQuery(".globalzoom").val("on").change();
2779 ';
2780 }
2781
2782 $html .= 'jQuery("#pano' . $id . ' .pnlm-title-box").on("mouseenter", function(){
2783 jQuery(this).attr("title", jQuery(this).text());
2784 });
2785 jQuery("#pano' . $id . ' .pnlm-title-box").on("mouseleave", function(){
2786 jQuery(this).removeAttr("title");
2787 });';
2788 $html .= '});';
2789 $html .= '</script>';
2790
2791 $tour_data = [];
2792 if(defined("WPVR_PRO_VERSION")){
2793 $tour_data = array(
2794 'explainerControlSwitch' => $explainerControlSwitch,
2795 'floor_plan_enable' => $floor_plan_enable,
2796 'floor_plan_image' => $floor_plan_image,
2797 'custom_control' => $custom_control,
2798 );
2799 }
2800 return apply_filters('wpvr_generate_tour_layout_html', $html ,$postdata ,$id, $tour_data);
2801 }
2802
2803 function replace_callback($matches){
2804 foreach ($matches as $match){
2805 return str_replace('<img','<img decoding="async"',$match);
2806 }
2807
2808 }
2809 }