PluginProbe
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress / 9.1.3
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress v9.1.3
9.1.3 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 All 222 releases
← All changes | legacy/admin/classes/class-wpvr-scene.php +733 -636 9.0.39.1.3 View file →
@@ -114,16 +114,28 @@
114 114 <?php $this->render_default_repeater_item(); ?>
115 115 </div>
116 116 <!-- Empty repeater end -->
117 117
118 - <?php $s = 1; $firstvalue = reset($postdata['panodata']["scene-list"]);
119 - foreach ($postdata['panodata']["scene-list"] as $pano_scene) { ?>
118 + <?php
119 + if ( ! empty( $postdata['panodata']["scene-list"] ) && is_array( $postdata['panodata']["scene-list"] ) ) {
120 + $s = 1; $firstvalue = reset($postdata['panodata']["scene-list"]);
121 + $default_scene = $postdata['defaultscene'] ?? ($firstvalue['scene-id'] ?? '');
122 + foreach ($postdata['panodata']["scene-list"] as $pano_scene) {
123 + if ( ! is_array( $pano_scene ) ) {
124 + continue;
125 + }
126 + if ( ! isset( $pano_scene['dscene'] ) ) {
127 + $pano_scene['dscene'] = ( ! empty( $default_scene ) && ( $pano_scene['scene-id'] ?? '' ) === $default_scene ) ? 'on' : 'off';
128 + }
129 + $is_active = ( ( $pano_scene['scene-id'] ?? '' ) === ( $firstvalue['scene-id'] ?? '' ) );
130 + ?>
120 131
121 - <div data-repeater-item class="single-scene rex-pano-tab <?php if($pano_scene['scene-id'] == $firstvalue['scene-id']) { echo esc_attr('active'); }; ?>" data-title="1" id="scene-<?php echo esc_attr( $s ); ?>">
132 + <div data-repeater-item class="single-scene rex-pano-tab <?php if($is_active) { echo esc_attr('active'); }; ?>" data-title="1" id="scene-<?php echo esc_attr( $s ); ?>">
122 133 <?php $this->render_repeater_item_with_panodata($pano_scene, $s); ?>
123 134 </div>
124 135
125 - <?php $s++; } ?>
136 + <?php $s++; }
137 + } ?>
126 138 </div>
127 139 <?php
128 140 // ob_end_flush();
129 141 }
@@ -141,18 +153,26 @@
141 153 {
142 154 ob_start();
143 155 ?>
144 156 <ul>
145 - <?php $i = 1; $firstvalue = reset($postdata['panodata']["scene-list"]);
146 - foreach ($postdata['panodata']["scene-list"] as $pano_scene) { ?>
157 + <?php
158 + if ( ! empty( $postdata['panodata']["scene-list"] ) && is_array( $postdata['panodata']["scene-list"] ) ) {
159 + $i = 1; $firstvalue = reset($postdata['panodata']["scene-list"]);
160 + foreach ($postdata['panodata']["scene-list"] as $pano_scene) {
161 + if ( ! is_array( $pano_scene ) ) {
162 + continue;
163 + }
164 + $is_active = ( ( $pano_scene['scene-id'] ?? '' ) === ( $firstvalue['scene-id'] ?? '' ) );
165 + ?>
147 166
148 - <li class="<?php if ($pano_scene['scene-id'] == $firstvalue['scene-id']) {echo 'active';};?>">
167 + <li class="<?php if ($is_active) {echo 'active';};?>">
149 168 <span data-index="<?php echo esc_attr( $i ); ?>" data-href="#scene-<?php echo esc_attr( $i ); ?>">
150 169 <i class="fa fa-image"></i>
151 170 </span>
152 171 </li>
153 172
154 - <?php $i++; } ?>
173 + <?php $i++; }
174 + } ?>
155 175 <li class="add" data-repeater-create><span><i class="fa fa-plus-circle"></i></span></li>
156 176 </ul>
157 177 <?php
158 178 ob_end_flush();
@@ -888,10 +908,10 @@
888 908 if (isset($postdata['scenefadeduration'])) {
889 909 $scene_fade_duration = $postdata['scenefadeduration'];
890 910 }
891 911
892 - $panodata = '';
893 - if (isset($postdata['panodata'])) {
912 + $panodata = array();
913 + if (isset($postdata['panodata']) && is_array($postdata['panodata'])) {
894 914 $panodata = $postdata['panodata'];
895 915 }
896 916
897 917 $hotspoticoncolor = '#00b4ff';
@@ -1031,10 +1051,18 @@
1031 1051 ob_start();
1032 1052 do_action('wpvr_hotspot_content', $hotspot_data);
1033 1053 $hotspot_content = ob_get_clean();
1034 1054
1035 - if (!$hotspot_content) {
1036 - $hotspot_content = $hotspot_data["hotspot-content"];
1055 + $is_fluent_form = isset($hotspot_data["hotspot-type"]) && 'fluent_form' === $hotspot_data["hotspot-type"];
1056 +
1057 + if ($is_fluent_form) {
1058 + if (!empty($hotspot_content)) {
1059 + $hotspot_content = preg_replace('/<script\b[^>]*>[\s\S]*?<\/script>/i', '', $hotspot_content);
1060 + }
1061 + } else {
1062 + if (!$hotspot_content) {
1063 + $hotspot_content = $hotspot_data["hotspot-content"] ?? '';
1064 + }
1037 1065 }
1038 1066
1039 1067 $hotspot_url = $this->normalize_hotspot_external_url($hotspot_data["hotspot-url"] ?? '');
1040 1068
@@ -1054,9 +1082,8 @@
1054 1082 $hotspot_data['hotspot-hover'] ?? ''
1055 1083 );
1056 1084
1057 1085
1058 - $is_fluent_form = isset($hotspot_data["hotspot-type"]) && 'fluent_form' === $hotspot_data["hotspot-type"];
1059 1086 $on_hover_content = $this->sanitize_content_preserve_styles($on_hover_content ?? '', false);
1060 1087 $on_click_content = preg_replace_callback('/<img[^>]*>/', "replace_callback", $hotspot_content ?? '');
1061 1088 $on_click_content = $this->sanitize_content_preserve_styles($on_click_content ?? '', $is_fluent_form);
1062 1089
@@ -1289,13 +1316,17 @@
1289 1316 if(isset($postdata['customcss_enable']) && $postdata['customcss_enable'] == 'on'){
1290 1317 $html .= isset($postdata['customcss']) ? $postdata['customcss'] : '';
1291 1318 }
1292 1319 }
1293 - $panoid2 = 'pano2'.$id;
1320 + $pano_suffix = (strpos($panoid, 'pano') === 0) ? substr($panoid, 4) : (string) $panoid;
1321 + $panoid2 = 'pano2' . $pano_suffix;
1322 + $master_container_id = ($panoid === 'pano' . $id) ? 'master-container' : ('master-container-' . $pano_suffix);
1294 1323 $status = get_option('wpvr_edd_license_status');
1295 - if ($status !== false && $status == 'valid') {
1324 + if ($status !== false && $status == 'valid' && ! empty( $panodata['scene-list'] ) && is_array( $panodata['scene-list'] )) {
1296 1325 foreach ($panodata['scene-list'] as $panoscenes){
1297 -
1326 + if ( empty( $panoscenes['hotspot-list'] ) || ! is_array( $panoscenes['hotspot-list'] ) ) {
1327 + continue;
1328 + }
1298 1329 foreach($panoscenes['hotspot-list'] as $hotspot){
1299 1330 if (isset($hotspot['hotspot-customclass-color-icon-value']) && !empty($hotspot['hotspot-customclass-color-icon-value'])) {
1300 1331 $hotspoticoncolor = $hotspot['hotspot-customclass-color-icon-value'];
1301 1332 } else {
@@ -1491,16 +1522,24 @@
1491 1522 $animation_css = apply_filters('wpvr_tour_scene_animation',$animation_type,$animationDuration,$animationDelay,$postdata,$id);
1492 1523 $html .= $animation_css;
1493 1524 }
1494 1525
1526 + $container_width = $width;
1527 + $container_height = $height;
1528 + $container_mobile_height = $mobile_height;
1529 +
1495 1530 if ($width == 'fullwidth') {
1496 - $width = "100%";
1531 + $container_width = "100%";
1532 + } elseif ($width == 'embed') {
1533 + $container_width = "100%";
1534 + $container_height = "100%";
1535 + $container_mobile_height = "100%";
1497 1536 }
1498 1537
1499 1538 if (wpvr_isMobileDevice()) {
1500 - $html .= '<div id="master-container" class="wpvr-cardboard '.$enable_cardboard.'" style="max-width:' . $width . '; width: 100%; height: ' . $mobile_height . '; border-radius:' . $radius . '; direction:ltr; ">';
1539 + $html .= '<div id="' . $master_container_id . '" class="wpvr-master-container wpvr-cardboard '.$enable_cardboard.'" style="max-width:' . $container_width . '; width: 100%; height: ' . $container_mobile_height . '; border-radius:' . $radius . '; direction:ltr; ">';
1501 1540 } else {
1502 - $html .= '<div id="master-container" class="wpvr-cardboard '.$enable_cardboard.'" style="max-width:' . $width . '; width: 100%; height: ' . $height . '; border-radius:' . $radius . '; direction:ltr; ">';
1541 + $html .= '<div id="' . $master_container_id . '" class="wpvr-master-container wpvr-cardboard '.$enable_cardboard.'" style="max-width:' . $container_width . '; width: 100%; height: ' . $container_height . '; border-radius:' . $radius . '; direction:ltr; ">';
1503 1542 }
1504 1543 $is_pro = apply_filters('is_wpvr_pro_active',false);
1505 1544 $status = get_option('wpvr_edd_license_status');
1506 1545 $is_cardboard = get_option('wpvr_cardboard_disable');
@@ -1518,9 +1557,9 @@
1518 1557 if($width == "embed"){
1519 1558 $embed_mode = "vr-embade-mode";
1520 1559 }
1521 1560 $html .= '<label class="wpvr-cardboard-switcher '.$embed_mode.'">
1522 - <input type="checkbox" class="vr_mode_change' . $id . '" name="vr_mode_change" value="off">
1561 + <input type="checkbox" class="vr_mode_change' . $pano_suffix . '" name="vr_mode_change" value="off">
1523 1562 <span class="switcher-box">
1524 1563 <span class="normal-mode-tooltip">Normal VR Mode</span>
1525 1564 <svg width="78" height="60" viewBox="0 0 78 60" fill="none" xmlns="http://www.w3.org/2000/svg">
1526 1565 <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"/>
@@ -1532,43 +1571,43 @@
1532 1571
1533 1572 if ($width == 'fullwidth') {
1534 1573 if (wpvr_isMobileDevice()) {
1535 1574 $html .= '<div class="cardboard-vrfullwidth vrfullwidth">';
1536 - $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>';
1537 - $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style="width: 100%; text-align:center; direction:ltr; border-radius:' . $radius . '" >';
1575 + $html .= '<div id="' . $panoid2 . '" class="pano-wrap pano-left cardboard-half pano2' . $id . '" style="width: 49%!important; border-radius:' . $radius . ' text-align:center; direction:ltr;" ><div id="center-pointer2' . $pano_suffix . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>';
1576 + $html .= '<div id="' . $panoid . '" class="pano-wrap pano-right pano' . $id . '" style="width: 100%; text-align:center; direction:ltr; border-radius:' . $radius . '" >';
1538 1577 } else {
1539 - $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>';
1578 + $html .= '<div id="' . $panoid2 . '" class="pano-wrap pano-left pano2' . $id . '" style="width: 49%; border-radius:' . $radius . '"><div id="center-pointer2' . $pano_suffix . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>';
1540 1579 if ($radius) {
1541 - $html .= '<div id="pano' . $id . '" class="pano-wrap vrfullwidth" style=" text-align:center; height: ' . $height . '; border-radius:' . $radius . '; direction:ltr;" >';
1580 + $html .= '<div id="' . $panoid . '" class="pano-wrap vrfullwidth pano' . $id . '" style=" text-align:center; height: ' . $height . '; border-radius:' . $radius . '; direction:ltr;" >';
1542 1581 } else {
1543 - $html .= '<div id="pano' . $id . '" class="pano-wrap vrfullwidth" style=" text-align:center; height: ' . $height . '; direction:ltr;" >';
1582 + $html .= '<div id="' . $panoid . '" class="pano-wrap vrfullwidth pano' . $id . '" style=" text-align:center; height: ' . $height . '; direction:ltr;" >';
1544 1583 }
1545 1584 }
1546 1585 } elseif ($width == 'embed') {
1547 1586 $html .= '<div class="cardboard-vrembed vrembed">';
1548 - $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>';
1549 - $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style=" text-align:center; direction:ltr;" >';
1587 + $html .= '<div id="' . $panoid2 . '" class="pano-wrap pano-left pano2' . $id . '" style=" width: 49%!important; text-align:center; direction:ltr;" ><div id="center-pointer2' . $pano_suffix . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>';
1588 + $html .= '<div id="' . $panoid . '" class="pano-wrap pano-right pano' . $id . '" style="width: 100%; height: 100%; text-align:center; direction:ltr;" >';
1550 1589 } else {
1551 1590 if (wpvr_isMobileDevice()) {
1552 - $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>';
1591 + $html .= '<div id="' . $panoid2 . '" class="pano-wrap pano-left cardboard-half pano2' . $id . '" style="width: 49%; border-radius:' . $radius . '"><div id="center-pointer2' . $pano_suffix . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>';
1553 1592 if ($radius) {
1554 - $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style=" width: 100%; border-radius:' . $radius . ';">';
1593 + $html .= '<div id="' . $panoid . '" class="pano-wrap pano-right pano' . $id . '" style=" width: 100%; border-radius:' . $radius . ';">';
1555 1594 } else {
1556 - $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style=" width: 100%; ">';
1595 + $html .= '<div id="' . $panoid . '" class="pano-wrap pano-right pano' . $id . '" style=" width: 100%; ">';
1557 1596 }
1558 1597 } else {
1559 - $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>';
1598 + $html .= '<div id="' . $panoid2 . '" class="pano-wrap pano-left pano2' . $id . '" style="width: 49%; border-radius:' . $radius . '"><div id="center-pointer2' . $pano_suffix . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>';
1560 1599
1561 1600 if ($radius) {
1562 - $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style="width: 100%; border-radius:' . $radius . ';">';
1601 + $html .= '<div id="' . $panoid . '" class="pano-wrap pano-right pano' . $id . '" style="width: 100%; border-radius:' . $radius . ';">';
1563 1602 } else {
1564 - $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style="width: 100%;">';
1603 + $html .= '<div id="' . $panoid . '" class="pano-wrap pano-right pano' . $id . '" style="width: 100%;">';
1565 1604 }
1566 1605 }
1567 1606 }
1568 1607 // Vr mode transction scene to scene
1569 1608 if ($status !== false && 'valid' == $status && $is_pro) {
1570 - $html .= '<div id="center-pointer' . $id . '" class="vr-pointer-container" style="display:none"><span class="center-pointer"></span></div>';
1609 + $html .= '<div id="center-pointer' . $pano_suffix . '" class="vr-pointer-container" style="display:none"><span class="center-pointer"></span></div>';
1571 1610 }
1572 1611 $social_logo_top = '';
1573 1612 //===company logo===//
1574 1613 if (isset($postdata['cpLogoSwitch'])) {
@@ -1605,14 +1644,14 @@
1605 1644 $generic_form_icon = isset($postdata['genericformicon']) ? (string) $postdata['genericformicon'] : 'fab fa-wpforms';
1606 1645 $generic_form_icon = implode(' ', array_filter(array_map('sanitize_html_class', preg_split('/\s+/', $generic_form_icon))));
1607 1646 $generic_form_icon = $generic_form_icon ?: 'fab fa-wpforms';
1608 1647 $generic_form_icon_color = sanitize_hex_color($postdata['genericformiconcolor'] ?? '') ?: '#f7fffb';
1609 - $html .= '<div class="generic_form_button" id="generic_form_button_' . esc_attr($id) . '">';
1610 - $html .= '<div class="generic-form-icon" title ="Generic Form" id="generic_form_target_' . esc_attr($id) . '"><i class="' . esc_attr($generic_form_icon) . '" style="color:' . esc_attr($generic_form_icon_color) . ';"></i></div>';
1648 + $html .= '<div class="generic_form_button" id="generic_form_button_' . esc_attr($pano_suffix) . '">';
1649 + $html .= '<div class="generic-form-icon" title ="Generic Form" id="generic_form_target_' . esc_attr($pano_suffix) . '"><i class="' . esc_attr($generic_form_icon) . '" style="color:' . esc_attr($generic_form_icon_color) . ';"></i></div>';
1611 1650 $html .= '</div>';
1612 1651
1613 1652 // Generate the modal form container
1614 - $html .= '<div class="wpvr-generic-form" id="wpvr-generic-form' . esc_attr($id) . '" style="display: none">';
1653 + $html .= '<div class="wpvr-generic-form" id="wpvr-generic-form' . esc_attr($pano_suffix) . '" style="display: none">';
1615 1654 $html .= '<span class="close-generic-form"><i class="fa fa-times"></i></span>';
1616 1655 $html .= '<div class="generic-form-container">' . $shortcode_content . '</div>';
1617 1656 $html .= '</div>';
1618 1657 }
@@ -1665,23 +1704,23 @@
1665 1704 //===Custom Control===//
1666 1705 if (isset($custom_control)) {
1667 1706 $gyro_button_enabled = wpvr_isMobileDevice() && $custom_control['gyroSwitch'] == "on" && $custom_control['gyroscopeSwitch'] == "on";
1668 1707 if ($custom_control['panZoomInSwitch'] == "on" || $custom_control['panZoomOutSwitch'] == "on" || $gyro_button_enabled || $custom_control['backToHomeSwitch'] == "on") {
1669 - $html .= '<div id="zoom-in-out-controls' . $id . '" class="zoom-in-out-controls">';
1708 + $html .= '<div id="zoom-in-out-controls' . $pano_suffix . '" class="zoom-in-out-controls">';
1670 1709
1671 1710 if ($custom_control['backToHomeSwitch'] == "on" && 'valid' == $status && $is_pro) {
1672 - $html .= '<div class="ctrl" id="backToHome' . $id . '"><i class="' . $custom_control['backToHomeIcon'] . '" style="color:' . $custom_control['backToHomeColor'] . ';"></i></div>';
1711 + $html .= '<div class="ctrl" id="backToHome' . $pano_suffix . '"><i class="' . $custom_control['backToHomeIcon'] . '" style="color:' . $custom_control['backToHomeColor'] . ';"></i></div>';
1673 1712 }
1674 1713
1675 1714 if ($custom_control['panZoomInSwitch'] == "on" && 'valid' == $status && $is_pro) {
1676 - $html .= '<div class="ctrl" id="zoom-in' . $id . '"><i class="' . $custom_control['panZoomInIcon'] . '" style="color:' . $custom_control['panZoomInColor'] . ';"></i></div>';
1715 + $html .= '<div class="ctrl" id="zoom-in' . $pano_suffix . '"><i class="' . $custom_control['panZoomInIcon'] . '" style="color:' . $custom_control['panZoomInColor'] . ';"></i></div>';
1677 1716 }
1678 1717
1679 1718 if ($custom_control['panZoomOutSwitch'] == "on" && 'valid' == $status && $is_pro) {
1680 - $html .= '<div class="ctrl" id="zoom-out' . $id . '"><i class="' . $custom_control['panZoomOutIcon'] . '" style="color:' . $custom_control['panZoomOutColor'] . ';"></i></div>';
1719 + $html .= '<div class="ctrl" id="zoom-out' . $pano_suffix . '"><i class="' . $custom_control['panZoomOutIcon'] . '" style="color:' . $custom_control['panZoomOutColor'] . ';"></i></div>';
1681 1720 }
1682 1721 if ($gyro_button_enabled && 'valid' == $status && $is_pro) {
1683 - $html .= '<div class="ctrl" id="gyroscope' . $id . '" ><i class="' . $custom_control['gyroscopeIcon'] . '" style="color:' . $custom_control['gyroscopeColor'] . ';"></i></div>';
1722 + $html .= '<div class="ctrl" id="gyroscope' . $pano_suffix . '" ><i class="' . $custom_control['gyroscopeIcon'] . '" style="color:' . $custom_control['gyroscopeColor'] . ';"></i></div>';
1684 1723 }
1685 1724 $html .= '</div>';
1686 1725 }
1687 1726 //===zoom in out Control===//
@@ -1687,28 +1726,28 @@
1687 1726 //===zoom in out Control===//
1688 1727
1689 1728 if (($custom_control['panupSwitch'] == "on" || $custom_control['panDownSwitch'] == "on" || $custom_control['panLeftSwitch'] == "on" || $custom_control['panRightSwitch'] == "on" || $custom_control['panFullscreenSwitch'] == "on" ) && 'valid' == $status && $is_pro) {
1690 1729 //===Custom Control===//
1691 - $html .= '<div class="controls" id="controls' . $id . '">';
1730 + $html .= '<div class="controls" id="controls' . $pano_suffix . '">';
1692 1731
1693 1732 if ($custom_control['panupSwitch'] == "on") {
1694 - $html .= '<div class="ctrl pan-up" id="pan-up' . $id . '"><i class="' . $custom_control['panupIcon'] . '" style="color:' . $custom_control['panupColor'] . ';"></i></div>';
1733 + $html .= '<div class="ctrl pan-up" id="pan-up' . $pano_suffix . '"><i class="' . $custom_control['panupIcon'] . '" style="color:' . $custom_control['panupColor'] . ';"></i></div>';
1695 1734 }
1696 1735
1697 1736 if ($custom_control['panDownSwitch'] == "on") {
1698 - $html .= '<div class="ctrl pan-down" id="pan-down' . $id . '"><i class="' . $custom_control['panDownIcon'] . '" style="color:' . $custom_control['panDownColor'] . ';"></i></div>';
1737 + $html .= '<div class="ctrl pan-down" id="pan-down' . $pano_suffix . '"><i class="' . $custom_control['panDownIcon'] . '" style="color:' . $custom_control['panDownColor'] . ';"></i></div>';
1699 1738 }
1700 1739
1701 1740 if ($custom_control['panLeftSwitch'] == "on") {
1702 - $html .= '<div class="ctrl pan-left" id="pan-left' . $id . '"><i class="' . $custom_control['panLeftIcon'] . '" style="color:' . $custom_control['panLeftColor'] . ';"></i></div>';
1741 + $html .= '<div class="ctrl pan-left" id="pan-left' . $pano_suffix . '"><i class="' . $custom_control['panLeftIcon'] . '" style="color:' . $custom_control['panLeftColor'] . ';"></i></div>';
1703 1742 }
1704 1743
1705 1744 if ($custom_control['panRightSwitch'] == "on") {
1706 - $html .= '<div class="ctrl pan-right" id="pan-right' . $id . '"><i class="' . $custom_control['panRightIcon'] . '" style="color:' . $custom_control['panRightColor'] . ';"></i></div>';
1745 + $html .= '<div class="ctrl pan-right" id="pan-right' . $pano_suffix . '"><i class="' . $custom_control['panRightIcon'] . '" style="color:' . $custom_control['panRightColor'] . ';"></i></div>';
1707 1746 }
1708 1747
1709 1748 if ($custom_control['panFullscreenSwitch'] == "on") {
1710 - $html .= '<div class="ctrl fullscreen" id="fullscreen' . $id . '"><i class="' . $custom_control['panFullscreenIcon'] . '" style="color:' . $custom_control['panFullscreenColor'] . ';"></i></div>';
1749 + $html .= '<div class="ctrl fullscreen" id="fullscreen' . $pano_suffix . '"><i class="' . $custom_control['panFullscreenIcon'] . '" style="color:' . $custom_control['panFullscreenColor'] . ';"></i></div>';
1711 1750 }
1712 1751 $html .= '</div>';
1713 1752 }
1714 1753 }
@@ -1720,9 +1759,9 @@
1720 1759 $postdata,
1721 1760 $is_pro,
1722 1761 $autoload,
1723 1762 $explainer_right,
1724 - $id
1763 + $pano_suffix
1725 1764 );
1726 1765 //===explainer button end===//
1727 1766
1728 1767 //===Floor map button===//
@@ -1728,10 +1767,10 @@
1728 1767 //===Floor map button===//
1729 1768 $status = get_option('wpvr_edd_license_status');
1730 1769 if ($status !== false && 'valid' == $status && $is_pro){
1731 1770 if ($floor_plan_enable == "on" && !empty($floor_plan_image)) {
1732 - $html .= '<div class="floor_map_button" id="floor_map_button_' . $id . '" style="right:'.$floor_map_right.'">';
1733 - $html .= '<div class="ctrl" id="floor_map_target_' . $id . '"><i class="fas fa-map" style="color:#f7fffb;"></i></div>';
1771 + $html .= '<div class="floor_map_button" id="floor_map_button_' . $pano_suffix . '" style="right:'.$floor_map_right.'">';
1772 + $html .= '<div class="ctrl" id="floor_map_target_' . $pano_suffix . '"><i class="fas fa-map" style="color:#f7fffb;"></i></div>';
1734 1773 $html .= '</div>';
1735 1774 }
1736 1775 }
1737 1776 //===floor map button===//
@@ -1741,11 +1780,11 @@
1741 1780 $size = '';
1742 1781 if($vrgallery_icon_size){
1743 1782 $size = 'vrg-icon-size-large';
1744 1783 }
1745 - $html .= '<div id="vrgcontrols' . $id . '" class="vrgcontrols">';
1784 + $html .= '<div id="vrgcontrols' . $pano_suffix . '" class="vrgcontrols">';
1746 1785
1747 - $html .= '<div class="vrgctrl' . $id . ' vrbounce '.$size.'">';
1786 + $html .= '<div class="vrgctrl' . $pano_suffix . ' vrbounce '.$size.'">';
1748 1787 $html .= '</div>';
1749 1788 $html .= '</div>';
1750 1789
1751 1790 $gallery_layout_class = isset($postdata['tourLayout']['layout']) && 'layout1' === $postdata['tourLayout']['layout']
@@ -1750,9 +1789,9 @@
1750 1789
1751 1790 $gallery_layout_class = isset($postdata['tourLayout']['layout']) && 'layout1' === $postdata['tourLayout']['layout']
1752 1791 ? 'wpvr-gallery--modern'
1753 1792 : 'wpvr-gallery--classic';
1754 - $html .= '<div id="sccontrols' . $id . '" class="scene-gallery vrowl-carousel ' . esc_attr($gallery_layout_class) . '">';
1793 + $html .= '<div id="sccontrols' . $pano_suffix . '" class="scene-gallery vrowl-carousel ' . esc_attr($gallery_layout_class) . '">';
1755 1794 if (isset($panodata["scene-list"])) {
1756 1795 foreach ($panodata["scene-list"] as $panoscenes) {
1757 1796 $scene_key = $panoscenes['scene-id'];
1758 1797
@@ -1776,11 +1815,11 @@
1776 1815 $thumbnail = $img_src_url;
1777 1816 }
1778 1817
1779 1818 if( isset($postdata['tourLayout']['layout']) && 'layout1' !== $postdata['tourLayout']['layout']) {
1780 - $html .= '<ul><li title="Click to view scene"><span class="scene-title" title="' . esc_attr($scene_key_title) . '">' . $scene_key_title . '</span><img loading="lazy" class="scctrl" id="' . $scene_key . '_gallery_' . $id . '" src="' . $thumbnail . '"></li></ul>';
1819 + $html .= '<ul><li title="Click to view scene"><span class="scene-title" title="' . esc_attr($scene_key_title) . '">' . $scene_key_title . '</span><img loading="lazy" class="scctrl" id="' . $scene_key . '_gallery_' . $pano_suffix . '" src="' . $thumbnail . '"></li></ul>';
1781 1820 }else {
1782 - $html .= '<ul><li title="Click to view scene"><img loading="lazy" class="scctrl" id="' . $scene_key . '_gallery_' . $id . '" src="' . $thumbnail . '"><span class="scene-title" title="' . esc_attr($scene_key_title) . '">' . $scene_key_title . '</span></li></ul>';
1821 + $html .= '<ul><li title="Click to view scene"><img loading="lazy" class="scctrl" id="' . $scene_key . '_gallery_' . $pano_suffix . '" src="' . $thumbnail . '"><span class="scene-title" title="' . esc_attr($scene_key_title) . '">' . $scene_key_title . '</span></li></ul>';
1783 1822 }
1784 1823 }
1785 1824 }
1786 1825
@@ -1811,15 +1850,15 @@
1811 1850 $audio_muted_attr = ($autoplay_bg_music === 'on') ? 'muted' : '';
1812 1851 $audio_icon_class = 'fa-volume-mute'; // Always start with mute icon
1813 1852
1814 1853 if ($bg_music === 'on' && 'valid' == $status && $is_pro) {
1815 - $html .= '<div id="adcontrol' . esc_attr( $id ) . '" class="adcontrol" style="right:' . esc_attr( $audio_right ) . '">';
1816 - $html .= '<audio id="vrAudio' . esc_attr($id) . '" class="vrAudioDefault" data-autoplay="' . esc_attr($autoplay_bg_music) . '" onended="audionEnd' . esc_attr($id) . '()" ' . $autoplay_attr . ' ' . $audio_muted_attr . ' ' . $bg_loop . '>
1854 + $html .= '<div id="adcontrol' . esc_attr( $pano_suffix ) . '" class="adcontrol" style="right:' . esc_attr( $audio_right ) . '">';
1855 + $html .= '<audio id="vrAudio' . esc_attr($pano_suffix) . '" class="vrAudioDefault" data-autoplay="' . esc_attr($autoplay_bg_music) . '" onended="audionEnd' . esc_attr($pano_suffix) . '()" ' . $autoplay_attr . ' ' . $audio_muted_attr . ' ' . $bg_loop . '>
1817 1856 <source src="' . esc_url($bg_music_url) . '" type="audio/mpeg">
1818 1857 Your browser does not support the audio element.
1819 1858 </audio>';
1820 - $html .= '<button onclick="playPause' . esc_attr($id) . '()" class="ctrl audio_control" id="audio_control' . esc_attr($id) . '">
1821 - <i id="vr-volume' . esc_attr($id) . '" class="wpvrvolumeicon' . esc_attr($id) . ' fas ' . esc_attr($audio_icon_class) . '" style="color:#fff;"></i>
1859 + $html .= '<button onclick="playPause' . esc_attr($pano_suffix) . '()" class="ctrl audio_control" id="audio_control' . esc_attr($pano_suffix) . '">
1860 + <i id="vr-volume' . esc_attr($pano_suffix) . '" class="wpvrvolumeicon' . esc_attr($pano_suffix) . ' fas ' . esc_attr($audio_icon_class) . '" style="color:#fff;"></i>
1822 1861 </button>';
1823 1862 $html .= '</div>';
1824 1863 }
1825 1864 //===Explainer video section===//
@@ -1826,9 +1865,9 @@
1826 1865 $explainerContent = "";
1827 1866 if (isset($postdata['explainerContent'])) {
1828 1867 $explainerContent = $this->wpvr_sanitize_iframe_only($postdata['explainerContent']);
1829 1868 }
1830 - $html .= '<div class="explainer" id="explainer' . $id . '" style="display: none">';
1869 + $html .= '<div class="explainer" id="explainer' . $pano_suffix . '" style="display: none">';
1831 1870 $html .= '<span class="close-explainer-video"><i class="fa fa-times"></i></span>';
1832 1871 $html .= '' . $explainerContent . '';
1833 1872 $html .= '</div>';
1834 1873 //===Explainer video section End===//
@@ -1846,13 +1885,13 @@
1846 1885 .zoom-in-out-controls {
1847 1886 top: 37px;
1848 1887 }
1849 1888 </style>';
1850 - $html .= '<div id="custom-scene-navigation' . $id . '" class="custom-scene-navigation">
1889 + $html .= '<div id="custom-scene-navigation' . $pano_suffix . '" class="custom-scene-navigation">
1851 1890 <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>
1852 1891 </div>
1853 1892
1854 - <div id="custom-scene-navigation-nav' . $id . '" class="' . esc_attr( $scene_navigation_nav_class ) . '">
1893 + <div id="custom-scene-navigation-nav' . $pano_suffix . '" class="' . esc_attr( $scene_navigation_nav_class ) . '">
1855 1894 <ul></ul>
1856 1895 </div>
1857 1896 ';
1858 1897 }
@@ -1860,9 +1899,9 @@
1860 1899
1861 1900
1862 1901 if( 'embed' === $width){
1863 1902 if(WPVR_Helper::is_enable_social_share($postdata) === 'on'){
1864 - $html .= '<div id="wpvr-social-share-bg-box'.$id.'" class="wpvr-social-share-bg-box" style="top:'.$social_logo_top.'">
1903 + $html .= '<div id="wpvr-social-share-bg-box'.$pano_suffix.'" class="wpvr-social-share-bg-box" style="top:'.$social_logo_top.'">
1865 1904 <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>
1866 1905 <nav class="wpvr-share-nav">
1867 1906 '.WPVR_Helper::social_media_share_links_display_in_embed(home_url().'/?embed_page='. $id).'
1868 1907 </nav>
@@ -1881,9 +1920,9 @@
1881 1920 $floor_map_pointer = $postdata['floor_plan_pointer_position'];
1882 1921 $floor_map_scene_id = $postdata['floor_plan_data_list'];
1883 1922 $floor_plan_custom_color = $postdata['floor_plan_custom_color'];
1884 1923 }
1885 - $html .= '<div class="wpvr-floor-map" id="wpvr-floor-map' . $id . '" style="display: none">';
1924 + $html .= '<div class="wpvr-floor-map" id="wpvr-floor-map' . $pano_suffix . '" style="display: none">';
1886 1925 $html .= '<span class="close-floor-map-plan"><i class="fa fa-times"></i></span>';
1887 1926 $html .= '<img loading="lazy" src="'.$floor_map_image.'">';
1888 1927 foreach($floor_map_pointer as $key=> $pointer_position){
1889 1928 $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.'">
@@ -1987,9 +2026,10 @@
1987 2026 border: '.$border_width.'px '.$border_style.' '.$border_color.';
1988 2027 border-radius: '.$border_radius.'px;
1989 2028 padding: '.$button_pt.'px '.$button_pr.'px '.$button_pb.'px '.$button_pl.'px;
1990 2029 ';
1991 - $html .= '<div class="wpvr-call-to-action-button position-'.$text_align.'" style="max-width:' . $width.'">
2030 + $cta_width = ( $width === 'fullwidth' || $width === 'embed' ) ? '100%' : $width;
2031 + $html .= '<div class="wpvr-call-to-action-button position-'.$text_align.'" style="max-width:' . $cta_width . '">
1992 2032 <a href="'.$buttonurl.'" style="'.$style.'" target="'.$target.'">'.$buttontext.'</a>
1993 2033 </div>';
1994 2034
1995 2035 }
@@ -1999,26 +2039,26 @@
1999 2039 //script started
2000 2040 $html .= '<script>';
2001 2041 if (isset($postdata['bg_music']) && $bg_music == 'on' && 'valid' == $status && $is_pro) {
2002 2042 $html .= '
2003 - var x' . $id . ' = document.getElementById("vrAudio' . $id . '");
2004 - var playing' . $id . ' = false;
2005 - var autoplaySupported' . $id . ' = false;
2006 - var alertShown' . $id . ' = false;
2007 - var autoplayChecked' . $id . ' = false;
2043 + var x' . $pano_suffix . ' = document.getElementById("vrAudio' . $pano_suffix . '");
2044 + var playing' . $pano_suffix . ' = false;
2045 + var autoplaySupported' . $pano_suffix . ' = false;
2046 + var alertShown' . $pano_suffix . ' = false;
2047 + var autoplayChecked' . $pano_suffix . ' = false;
2008 2048
2009 - function playPause' . $id . '() {
2010 - if (playing' . $id . ') {
2011 - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute");
2012 - x' . $id . '.pause();
2013 - jQuery("#audio_control' . $id . '").attr("data-play", "off");
2014 - playing' . $id . ' = false;
2049 + function playPause' . $pano_suffix . '() {
2050 + if (playing' . $pano_suffix . ') {
2051 + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute");
2052 + x' . $pano_suffix . '.pause();
2053 + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "off");
2054 + playing' . $pano_suffix . ' = false;
2015 2055 } else {
2016 - x' . $id . '.muted = false;
2017 - x' . $id . '.play().then(function() {
2018 - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up");
2019 - jQuery("#audio_control' . $id . '").attr("data-play", "on");
2020 - playing' . $id . ' = true;
2056 + x' . $pano_suffix . '.muted = false;
2057 + x' . $pano_suffix . '.play().then(function() {
2058 + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up");
2059 + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on");
2060 + playing' . $pano_suffix . ' = true;
2021 2061 }).catch(function(e) {
2022 2062 console.log("Play failed:", e);
2023 2063 });
2024 2064 }
@@ -2023,133 +2063,139 @@
2023 2063 });
2024 2064 }
2025 2065 }
2026 2066
2027 - function audionEnd' . $id . '() {
2028 - playing' . $id . ' = false;
2029 - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute");
2030 - jQuery("#audio_control' . $id . '").attr("data-play", "off");
2067 + function audionEnd' . $pano_suffix . '() {
2068 + playing' . $pano_suffix . ' = false;
2069 + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute");
2070 + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "off");
2031 2071 }
2032 2072
2033 - x' . $id . '.addEventListener("ended", audionEnd' . $id . ');';
2073 + x' . $pano_suffix . '.addEventListener("ended", audionEnd' . $pano_suffix . ');';
2034 2074
2035 2075 if ($autoplay_bg_music == 'on') {
2036 2076 $html .= '
2037 2077
2038 - x' . $id . '.addEventListener("loadeddata", function() {
2039 - if (!autoplayChecked' . $id . ') {
2040 - checkAutoplayStatus' . $id . '();
2078 + x' . $pano_suffix . '.addEventListener("loadeddata", function() {
2079 + if (!autoplayChecked' . $pano_suffix . ') {
2080 + checkAutoplayStatus' . $pano_suffix . '();
2041 2081 }
2042 2082 });
2043 2083
2044 - x' . $id . '.addEventListener("canplay", function() {
2045 - if (!autoplayChecked' . $id . ') {
2046 - checkAutoplayStatus' . $id . '();
2084 + x' . $pano_suffix . '.addEventListener("canplay", function() {
2085 + if (!autoplayChecked' . $pano_suffix . ') {
2086 + checkAutoplayStatus' . $pano_suffix . '();
2047 2087 }
2048 2088 });
2049 2089
2050 - x' . $id . '.addEventListener("canplaythrough", function() {
2051 - if (!autoplayChecked' . $id . ') {
2052 - checkAutoplayStatus' . $id . '();
2090 + x' . $pano_suffix . '.addEventListener("canplaythrough", function() {
2091 + if (!autoplayChecked' . $pano_suffix . ') {
2092 + checkAutoplayStatus' . $pano_suffix . '();
2053 2093 }
2054 2094 });
2055 2095
2056 2096 setTimeout(function() {
2057 - if (!autoplayChecked' . $id . ') {
2058 - checkAutoplayStatus' . $id . '();
2097 + if (!autoplayChecked' . $pano_suffix . ') {
2098 + checkAutoplayStatus' . $pano_suffix . '();
2059 2099 }
2060 2100 }, 1000);
2061 2101
2062 - x' . $id . '.addEventListener("play", function() {
2063 - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up");
2064 - jQuery("#audio_control' . $id . '").attr("data-play", "on");
2065 - playing' . $id . ' = true;
2102 + x' . $pano_suffix . '.addEventListener("play", function() {
2103 + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up");
2104 + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on");
2105 + playing' . $pano_suffix . ' = true;
2066 2106 });
2067 2107
2068 - x' . $id . '.addEventListener("pause", function() {
2069 - if (!playing' . $id . ') {
2070 - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute");
2071 - jQuery("#audio_control' . $id . '").attr("data-play", "off");
2108 + x' . $pano_suffix . '.addEventListener("pause", function() {
2109 + if (!playing' . $pano_suffix . ') {
2110 + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute");
2111 + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "off");
2072 2112 }
2073 2113 });
2074 2114
2075 - function checkAutoplayStatus' . $id . '() {
2076 - autoplayChecked' . $id . ' = true;
2115 + function checkAutoplayStatus' . $pano_suffix . '() {
2116 + autoplayChecked' . $pano_suffix . ' = true;
2077 2117
2078 - x' . $id . '.muted = true;
2079 - var playPromise = x' . $id . '.play();
2118 + x' . $pano_suffix . '.muted = true;
2119 + var playPromise = x' . $pano_suffix . '.play();
2080 2120
2081 2121 if (playPromise !== undefined) {
2082 2122 playPromise.then(function () {
2083 - if (x' . $id . '.muted || x' . $id . '.volume === 0) {
2084 - handleAutoplayBlocked' . $id . '();
2123 + if (x' . $pano_suffix . '.muted || x' . $pano_suffix . '.volume === 0) {
2124 + handleAutoplayBlocked' . $pano_suffix . '();
2085 2125 } else {
2086 - autoplaySupported' . $id . ' = true;
2087 - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up");
2088 - jQuery("#audio_control' . $id . '").attr("data-play", "on");
2089 - playing' . $id . ' = true;
2126 + autoplaySupported' . $pano_suffix . ' = true;
2127 + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up");
2128 + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on");
2129 + playing' . $pano_suffix . ' = true;
2090 2130 }
2091 2131 }).catch(function () {
2092 - handleAutoplayBlocked' . $id . '();
2132 + handleAutoplayBlocked' . $pano_suffix . '();
2093 2133 });
2094 2134 } else {
2095 2135 setTimeout(function () {
2096 - if (x' . $id . '.paused || x' . $id . '.currentTime === 0) {
2097 - handleAutoplayBlocked' . $id . '();
2136 + if (x' . $pano_suffix . '.paused || x' . $pano_suffix . '.currentTime === 0) {
2137 + handleAutoplayBlocked' . $pano_suffix . '();
2098 2138 } else {
2099 - autoplaySupported' . $id . ' = true;
2100 - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up");
2101 - jQuery("#audio_control' . $id . '").attr("data-play", "on");
2102 - playing' . $id . ' = true;
2139 + autoplaySupported' . $pano_suffix . ' = true;
2140 + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up");
2141 + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on");
2142 + playing' . $pano_suffix . ' = true;
2103 2143 }
2104 2144 }, 300);
2105 2145 }
2106 2146 }
2107 2147
2108 - function handleAutoplayBlocked' . $id . '() {
2109 - autoplaySupported' . $id . ' = false;
2110 - if (!alertShown' . $id . ') {
2148 + function handleAutoplayBlocked' . $pano_suffix . '() {
2149 + autoplaySupported' . $pano_suffix . ' = false;
2150 + if (!alertShown' . $pano_suffix . ') {
2111 2151 alert("Autoplay is not supported in your browser. Please click the audio button to play music.");
2112 - alertShown' . $id . ' = true;
2152 + alertShown' . $pano_suffix . ' = true;
2113 2153 }
2114 2154
2115 - x' . $id . '.pause();
2116 - x' . $id . '.currentTime = 0;
2117 - x' . $id . '.muted = true;
2155 + x' . $pano_suffix . '.pause();
2156 + x' . $pano_suffix . '.currentTime = 0;
2157 + x' . $pano_suffix . '.muted = true;
2118 2158
2119 - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute");
2120 - jQuery("#audio_control' . $id . '").attr("data-play", "off");
2159 + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute");
2160 + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "off");
2121 2161
2122 - document.getElementById("pano' . $id . '").addEventListener("click", musicPlay' . $id . ');
2123 - document.addEventListener("touchstart", musicPlay' . $id . ', { once: true });
2124 - document.addEventListener("click", musicPlay' . $id . ', { once: true });
2162 + var musicTriggerElem = document.getElementById("' . $panoid . '");
2163 + if (musicTriggerElem) {
2164 + musicTriggerElem.addEventListener("click", musicPlay' . $pano_suffix . ');
2165 + }
2166 + document.addEventListener("touchstart", musicPlay' . $pano_suffix . ', { once: true });
2167 + document.addEventListener("click", musicPlay' . $pano_suffix . ', { once: true });
2125 2168 }
2126 2169
2127 - function musicPlay' . $id . '() {
2128 - x' . $id . '.muted = false;
2129 - var playPromise = x' . $id . '.play();
2170 + function musicPlay' . $pano_suffix . '() {
2171 + x' . $pano_suffix . '.muted = false;
2172 + var playPromise = x' . $pano_suffix . '.play();
2130 2173
2131 2174 if (playPromise !== undefined) {
2132 2175 playPromise.then(function () {
2133 - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up");
2134 - jQuery("#audio_control' . $id . '").attr("data-play", "on");
2135 - playing' . $id . ' = true;
2176 + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up");
2177 + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on");
2178 + playing' . $pano_suffix . ' = true;
2136 2179 }).catch(function(e) {
2137 2180 console.log("Play failed:", e);
2138 2181 });
2139 2182 } else {
2140 2183 setTimeout(function () {
2141 - if (!x' . $id . '.paused) {
2142 - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up");
2143 - jQuery("#audio_control' . $id . '").attr("data-play", "on");
2144 - playing' . $id . ' = true;
2184 + if (!x' . $pano_suffix . '.paused) {
2185 + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up");
2186 + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on");
2187 + playing' . $pano_suffix . ' = true;
2145 2188 }
2146 2189 }, 100);
2147 2190 }
2148 2191
2149 - document.getElementById("pano' . $id . '").removeEventListener("click", musicPlay' . $id . ');
2150 - document.removeEventListener("touchstart", musicPlay' . $id . ');
2151 - document.removeEventListener("click", musicPlay' . $id . ');
2192 + var musicTriggerElem = document.getElementById("' . $panoid . '");
2193 + if (musicTriggerElem) {
2194 + musicTriggerElem.removeEventListener("click", musicPlay' . $pano_suffix . ');
2195 + }
2196 + document.removeEventListener("touchstart", musicPlay' . $pano_suffix . ');
2197 + document.removeEventListener("click", musicPlay' . $pano_suffix . ');
2152 2198 }
2153 2199 ';
2154 2200 }
2155 2201 }
@@ -2158,27 +2204,31 @@
2158 2204 $html .= 'var response = ' . $response . ';';
2159 2205 $html .= 'var scenes = response[1];';
2160 2206 $html .= 'if(scenes) {';
2161 2207 $html .= 'var scenedata = scenes.scenes;';
2162 - $html .= 'for(var i in scenedata) {';
2163 - $html .= 'var scenehotspot = scenedata[i].hotSpots;';
2164 - $html .= 'for(var i = 0; i < scenehotspot.length; i++) {';
2165 - $html .= 'if(scenehotspot[i].type === "info") {';
2166 - $html .= ' scenehotspot[i]["clickHandlerFunc"] = function(div, args) { if (typeof window.wpvrhotspot === "function") { window.wpvrhotspot(div, args); } };';
2167 - $html .= '} else if(scenehotspot[i].type === "scene") {';
2168 - $html .= ' scenehotspot[i]["clickHandlerArgs"] = scenehotspot[i]["text"];';
2208 + $html .= 'for(var scId in scenedata) {';
2209 + $html .= 'if(!scenedata.hasOwnProperty(scId)) continue;';
2210 + $html .= 'var scenehotspot = scenedata[scId].hotSpots;';
2211 + $html .= 'if(scenehotspot && scenehotspot.length) {';
2212 + $html .= 'for(var hIdx = 0; hIdx < scenehotspot.length; hIdx++) {';
2213 + $html .= 'if(scenehotspot[hIdx].type === "info") {';
2214 + $html .= ' scenehotspot[hIdx]["clickHandlerFunc"] = function(div, args) { if (typeof window.wpvrhotspot === "function") { window.wpvrhotspot(div, args); } };';
2215 + $html .= '} else if(scenehotspot[hIdx].type === "scene") {';
2216 + $html .= ' scenehotspot[hIdx]["clickHandlerArgs"] = scenehotspot[hIdx]["text"] || "";';
2169 2217 $status = get_option('wpvr_edd_license_status');
2170 2218 if ($status !== false && $status == 'valid') {
2171 - $html .='if(typeof wpvr_public !== "undefined" && wpvr_public.is_pro_active) {';
2172 - $html .= ' scenehotspot[i]["clickHandlerFunc"] = function(div, args) { if (typeof wpvrhotspotscene === "function") { wpvrhotspotscene(div, args); } else if (typeof window.wpvrhotspotscene === "function") { window.wpvrhotspotscene(div, args); } };';
2219 + $html .='if(typeof wpvr_public !== "undefined") {';
2220 + $html .='if(wpvr_public.is_pro_active) {';
2221 + $html .= ' scenehotspot[hIdx]["clickHandlerFunc"] = function(div, args) { if (typeof wpvrhotspotscene' . $pano_suffix . ' === "function") { wpvrhotspotscene' . $pano_suffix . '(div, args); } else if (typeof wpvrhotspotscene === "function") { wpvrhotspotscene(div, args); } else if (typeof window.wpvrhotspotscene === "function") { window.wpvrhotspotscene(div, args); } };';
2173 2222 $html .='}';
2223 + $html .='}';
2174 2224 }
2175 2225 $html .= '}';
2176 2226
2177 2227 if (wpvr_isMobileDevice() && get_option('dis_on_hover') == "true") {
2178 2228 } else {
2179 - $html .= 'if(scenehotspot[i]["createTooltipArgs"] != "") {';
2180 - $html .= 'scenehotspot[i]["createTooltipFunc"] = function(div, args) { if (typeof window.wpvrtooltip === "function") { window.wpvrtooltip(div, args); } };';
2229 + $html .= 'if(scenehotspot[hIdx]["createTooltipArgs"] != "") {';
2230 + $html .= 'scenehotspot[hIdx]["createTooltipFunc"] = function(div, args) { if (typeof window.wpvrtooltip === "function") { window.wpvrtooltip(div, args); } };';
2181 2231 $html .= '}';
2182 2232 }
2183 2233
2184 2234 $html .= '}';
@@ -2183,24 +2233,25 @@
2183 2233
2184 2234 $html .= '}';
2185 2235 $html .= '}';
2186 2236 $html .= '}';
2187 - $html .= 'var panoshow' . $id . ';';
2188 - $html .= 'var panoshow2' . $id . ';';
2189 - $html .= 'function initWPVRViewer' . $id . '() {';
2190 - $html .= 'if (typeof pannellum === "undefined" || typeof jQuery === "undefined") { setTimeout(initWPVRViewer' . $id . ', 50); return; }';
2191 - $html .= 'panoshow' . $id . ' = pannellum.viewer(response[0]["panoid"], scenes);';
2237 + $html .= '}';
2238 + $html .= 'var panoshow' . $pano_suffix . ';';
2239 + $html .= 'var panoshow2' . $pano_suffix . ';';
2240 + $html .= 'function initWPVRViewer' . $pano_suffix . '() {';
2241 + $html .= 'if (typeof pannellum === "undefined" || typeof jQuery === "undefined") { setTimeout(initWPVRViewer' . $pano_suffix . ', 50); return; }';
2242 + $html .= 'panoshow' . $pano_suffix . ' = pannellum.viewer(response[0]["panoid"], scenes);';
2192 2243 $html .= '
2193 2244 window.wpvrViewers = window.wpvrViewers || {};
2194 - window.wpvrViewers[response[0]["panoid"]] = panoshow' . $id . ';
2245 + window.wpvrViewers[response[0]["panoid"]] = panoshow' . $pano_suffix . ';
2195 2246 document.dispatchEvent(new CustomEvent("wpvr:viewer-ready", {
2196 - detail: { containerId: response[0]["panoid"], viewer: panoshow' . $id . ' }
2247 + detail: { containerId: response[0]["panoid"], viewer: panoshow' . $pano_suffix . ' }
2197 2248 }));
2198 2249 ';
2199 2250 if ( (float) $scene_fade_duration > 0 ) {
2200 2251 $html .= '
2201 - panoshow' . $id . '.on("scenechange", function() {
2202 - var fadeImage = document.querySelector("#pano' . $id . ' .pnlm-render-container > .pnlm-fade-img");
2252 + panoshow' . $pano_suffix . '.on("scenechange", function() {
2253 + var fadeImage = document.querySelector("#' . $panoid . ' .pnlm-render-container > .pnlm-fade-img");
2203 2254 if (fadeImage) {
2204 2255 fadeImage.style.opacity = "1";
2205 2256 void fadeImage.offsetWidth;
2206 2257 }
@@ -2208,20 +2259,20 @@
2208 2259 }
2209 2260 $html .= '
2210 2261
2211 2262 if(typeof wpvr_public === "undefined" || !wpvr_public.is_pro_active || !wpvr_public.is_license_active) {
2212 - panoshow' . $id . '.on("load", function() {
2263 + panoshow' . $pano_suffix . '.on("load", function() {
2213 2264 jQuery(".pnlm-panorama-info").hide();
2214 2265 jQuery(".pnlm-compass").hide();
2215 2266 });
2216 2267
2217 - panoshow' . $id . '.on("scenechange", function() {
2268 + panoshow' . $pano_suffix . '.on("scenechange", function() {
2218 2269 jQuery(".pnlm-panorama-info").hide();
2219 2270 jQuery(".pnlm-compass").hide();
2220 2271 });
2221 2272 }';
2222 2273 $html .= '}';
2223 - $html .= 'initWPVRViewer' . $id . '();';
2274 + $html .= 'initWPVRViewer' . $pano_suffix . '();';
2224 2275 //===Dplicate mode only for vr mode===//
2225 2276 $response2 = json_decode($response);
2226 2277 $response2[1]->compass = false;
2227 2278 $response2[1]->autoRotate = false;
@@ -2230,40 +2281,43 @@
2230 2281 $html .= 'var scenes_duplicate = response_duplicate[1];';
2231 2282
2232 2283 $html .= 'if(scenes_duplicate) {';
2233 2284 $html .= 'var scenedata = scenes_duplicate.scenes;';
2234 - $html .= 'for(var i in scenedata) {';
2235 - $html .= 'var scenehotspot = scenedata[i].hotSpots;';
2236 - $html .= 'for(var i = 0; i < scenehotspot.length; i++) {';
2237 - $html .= 'if(scenehotspot[i]["clickHandlerArgs"] != "") {';
2238 - $html .= 'scenehotspot[i]["clickHandlerFunc"] = function(div, args) { if (typeof window.wpvrhotspot === "function") { window.wpvrhotspot(div, args); } };';
2285 + $html .= 'for(var scId in scenedata) {';
2286 + $html .= 'if(!scenedata.hasOwnProperty(scId)) continue;';
2287 + $html .= 'var scenehotspot = scenedata[scId].hotSpots;';
2288 + $html .= 'if(scenehotspot && scenehotspot.length) {';
2289 + $html .= 'for(var hIdx = 0; hIdx < scenehotspot.length; hIdx++) {';
2290 + $html .= 'if(scenehotspot[hIdx]["clickHandlerArgs"] != "") {';
2291 + $html .= 'scenehotspot[hIdx]["clickHandlerFunc"] = function(div, args) { if (typeof window.wpvrhotspot === "function") { window.wpvrhotspot(div, args); } };';
2239 2292 $html .= '}';
2240 2293 if (wpvr_isMobileDevice() && get_option('dis_on_hover') == "true") {
2241 2294 } else {
2242 - $html .= 'if(scenehotspot[i]["createTooltipArgs"] != "") {';
2243 - $html .= 'scenehotspot[i]["createTooltipFunc"] = function(div, args) { if (typeof window.wpvrtooltip === "function") { window.wpvrtooltip(div, args); } };';
2295 + $html .= 'if(scenehotspot[hIdx]["createTooltipArgs"] != "") {';
2296 + $html .= 'scenehotspot[hIdx]["createTooltipFunc"] = function(div, args) { if (typeof window.wpvrtooltip === "function") { window.wpvrtooltip(div, args); } };';
2244 2297 $html .= '}';
2245 2298 }
2246 2299 $html .= '}';
2247 2300 $html .= '}';
2248 2301 $html .= '}';
2302 + $html .= '}';
2249 2303
2250 2304 $is_pro = apply_filters('is_wpvr_pro_active',false);
2251 2305 $status = get_option('wpvr_edd_license_status');
2252 2306 $html .= 'var vr_mode = "off";';
2253 2307 if ($status !== false && 'valid' == $status && $is_pro) {
2254 - $html .= 'function initWPVRViewer2' . $id . '() {';
2255 - $html .= 'if (typeof pannellum === "undefined" || typeof jQuery === "undefined") { setTimeout(initWPVRViewer2' . $id . ', 50); return; }';
2256 - $html .= 'panoshow2' . $id . ' = pannellum.viewer("pano2' . $id . '", scenes_duplicate);';
2308 + $html .= 'function initWPVRViewer2' . $pano_suffix . '() {';
2309 + $html .= 'if (typeof pannellum === "undefined" || typeof jQuery === "undefined") { setTimeout(initWPVRViewer2' . $pano_suffix . ', 50); return; }';
2310 + $html .= 'panoshow2' . $pano_suffix . ' = pannellum.viewer("' . $panoid2 . '", scenes_duplicate);';
2257 2311 $html .= '
2258 2312 window.wpvrViewers = window.wpvrViewers || {};
2259 - window.wpvrViewers["pano2' . $id . '"] = panoshow2' . $id . ';
2313 + window.wpvrViewers["' . $panoid2 . '"] = panoshow2' . $pano_suffix . ';
2260 2314 document.dispatchEvent(new CustomEvent("wpvr:viewer-ready", {
2261 - detail: { containerId: "pano2' . $id . '", viewer: panoshow2' . $id . ' }
2315 + detail: { containerId: "' . $panoid2 . '", viewer: panoshow2' . $pano_suffix . ' }
2262 2316 }));
2263 2317 ';
2264 2318 $html .= '}';
2265 - $html .= 'initWPVRViewer2' . $id . '();';
2319 + $html .= 'initWPVRViewer2' . $pano_suffix . '();';
2266 2320 // Show Cardboard Mode in Tour
2267 2321 $html .= '
2268 2322 var tim;
2269 2323 var im = 0;
@@ -2276,43 +2330,45 @@
2276 2330 var scenedata = scenes_duplicate.scenes;
2277 2331 for(var i in scenedata) {
2278 2332 if(active_scene === i) {
2279 2333 var scenehotspot = scenedata[i].hotSpots;
2280 - for(var j in scenehotspot) {
2281 - var plusFiveYaw = Math.round(scenehotspot[j].yaw) + 5;
2282 - var minusFiveYaw = Math.round(scenehotspot[j].yaw) - 5;
2283 - var plusFivePitch = Math.round(scenehotspot[j].pitch) + 5;
2284 - var minusFivePitch = Math.round(scenehotspot[j].pitch) - 5;
2285 - var firstCondition = ( Math.round(data.pitch) > minusFivePitch) && (Math.round(data.pitch) < plusFivePitch) ;
2286 - var secCondition = (Math.round(data.yaw) > minusFiveYaw) && (Math.round(data.yaw) < plusFiveYaw);
2287 - if(( Math.round(data.pitch) > minusFivePitch) && (Math.round(data.pitch) < plusFivePitch) ){
2288 - if((Math.round(data.yaw) > minusFiveYaw) && (Math.round(data.yaw) < plusFiveYaw)){
2289 - jQuery(".center-pointer").addClass("wpvr-pluse-effect")
2290 - var getScene = scenehotspot[j].sceneId;
2291 - if(scenehotspot[j].type == "scene"){
2292 - panoshow' . $id . '.loadScene(getScene);
2293 - panoshow2' . $id . '.loadScene(getScene);
2294 -// var inside_current_time_object = new Date();
2295 -// var inside_timer = inside_current_time_object.getTime();
2296 -// if(inside_timer > timer) {
2297 -// panoshow' . $id . '.loadScene(getScene);
2298 -// panoshow2' . $id . '.loadScene(getScene);
2299 -// jQuery(".center-pointer").removeClass("wpvr-pluse-effect")
2300 -// }
2301 - }else{
2302 - jQuery(".center-pointer").removeClass("wpvr-pluse-effect")
2334 + if(scenehotspot && scenehotspot.length) {
2335 + for(var j = 0; j < scenehotspot.length; j++) {
2336 + var plusFiveYaw = Math.round(scenehotspot[j].yaw) + 5;
2337 + var minusFiveYaw = Math.round(scenehotspot[j].yaw) - 5;
2338 + var plusFivePitch = Math.round(scenehotspot[j].pitch) + 5;
2339 + var minusFivePitch = Math.round(scenehotspot[j].pitch) - 5;
2340 + if(Math.round(data.pitch) > minusFivePitch) {
2341 + if(Math.round(data.pitch) < plusFivePitch) {
2342 + if(Math.round(data.yaw) > minusFiveYaw) {
2343 + if(Math.round(data.yaw) < plusFiveYaw) {
2344 + jQuery(".center-pointer").addClass("wpvr-pluse-effect");
2345 + var getScene = scenehotspot[j].sceneId;
2346 + if(scenehotspot[j].type == "scene"){
2347 + panoshow' . $pano_suffix . '.loadScene(getScene);
2348 + panoshow2' . $pano_suffix . '.loadScene(getScene);
2349 + }else{
2350 + jQuery(".center-pointer").removeClass("wpvr-pluse-effect");
2351 + }
2352 + } else {
2353 + jQuery(".center-pointer").removeClass("wpvr-pluse-effect");
2354 + c_time = new Date();
2355 + timer = c_time.getTime() + 2000;
2356 + }
2357 + } else {
2358 + jQuery(".center-pointer").removeClass("wpvr-pluse-effect");
2359 + c_time = new Date();
2360 + timer = c_time.getTime() + 2000;
2361 + }
2362 + } else {
2363 + c_time = new Date();
2364 + timer = c_time.getTime() + 2000;
2303 2365 }
2304 - }
2305 - else {
2306 - jQuery(".center-pointer").removeClass("wpvr-pluse-effect")
2366 + } else {
2307 2367 c_time = new Date();
2308 2368 timer = c_time.getTime() + 2000;
2309 2369 }
2310 2370 }
2311 - else {
2312 - c_time = new Date();
2313 - timer = c_time.getTime() + 2000;
2314 - }
2315 2371 }
2316 2372 }
2317 2373 }
2318 2374 }
@@ -2318,26 +2374,28 @@
2318 2374 }
2319 2375 };
2320 2376 function vrDeviseOrientation(){
2321 2377 var data = {
2322 - pitch: panoshow' . $id . '.getPitch(),
2323 - yaw: panoshow' . $id . '.getYaw(),
2378 + pitch: panoshow' . $pano_suffix . '.getPitch(),
2379 + yaw: panoshow' . $pano_suffix . '.getYaw(),
2324 2380 };
2325 2381 panoShowCardBoardOnTrigger(data);
2326 2382 }';
2327 2383 $html .= '
2328 2384 function requestFullScreen(){
2329 - var elem = document.getElementById("master-container");
2330 - if (elem.requestFullscreen) {
2331 - elem.requestFullscreen();
2332 - } else if (elem.webkitRequestFullscreen) { /* Safari */
2333 - elem.webkitRequestFullscreen();
2334 - } else if (elem.msRequestFullscreen) { /* IE11 */
2335 - elem.msRequestFullscreen();
2336 - }
2385 + var elem = document.getElementById("' . $master_container_id . '") || document.getElementById("master-container");
2386 + if (elem) {
2387 + if (elem.requestFullscreen) {
2388 + elem.requestFullscreen();
2389 + } else if (elem.webkitRequestFullscreen) { /* Safari */
2390 + elem.webkitRequestFullscreen();
2391 + } else if (elem.msRequestFullscreen) { /* IE11 */
2392 + elem.msRequestFullscreen();
2393 + }
2394 + }
2337 2395 }
2338 2396 function requestExitFullscreen(){
2339 - var elem = document.getElementById("master-container");
2397 + var elem = document.getElementById("' . $master_container_id . '") || document.getElementById("master-container");
2340 2398 if (document.exitFullscreen) {
2341 2399 document.exitFullscreen();
2342 2400 } else if (document.webkitExitFullscreen) { /* Safari */
2343 2401 document.webkitExitFullscreen();
@@ -2359,29 +2417,33 @@
2359 2417 let onLoadAnalytics = false;
2360 2418 let sceneLoadAnalytics = false;
2361 2419
2362 2420 function storeAnalyticsData(data) {
2363 - if (typeof wpvrAnalyticsObj !== "undefined" && typeof wpvr_public !== "undefined" && wpvr_public.is_pro_active) {
2364 - jQuery.ajax({
2365 - url: wpvrAnalyticsObj.ajaxUrl,
2366 - type: "POST",
2367 - data: {
2368 - action: "store_scene_hotspot_data",
2369 - scene_id: data.scene_id,
2370 - tour_id: data.tour_id,
2371 - type: data.type,
2372 - hotspot_id: data.hotspot_id || "",
2373 - user_agent: navigator.userAgent,
2374 - device_type: getDeviceType() || "desktop",
2375 - nonce: wpvrAnalyticsObj.nonce,
2376 - },
2377 - success: function (response) {
2378 - console.log("Data stored successfully");
2379 - },
2380 - error: function (error) {
2381 - console.log("Error in storing data");
2421 + if (typeof wpvrAnalyticsObj !== "undefined") {
2422 + if (typeof wpvr_public !== "undefined") {
2423 + if (wpvr_public.is_pro_active) {
2424 + jQuery.ajax({
2425 + url: wpvrAnalyticsObj.ajaxUrl,
2426 + type: "POST",
2427 + data: {
2428 + action: "store_scene_hotspot_data",
2429 + scene_id: data.scene_id,
2430 + tour_id: data.tour_id,
2431 + type: data.type,
2432 + hotspot_id: data.hotspot_id || "",
2433 + user_agent: navigator.userAgent,
2434 + device_type: getDeviceType() || "desktop",
2435 + nonce: wpvrAnalyticsObj.nonce,
2436 + },
2437 + success: function (response) {
2438 + console.log("Data stored successfully");
2439 + },
2440 + error: function (error) {
2441 + console.log("Error in storing data");
2442 + }
2443 + });
2382 2444 }
2383 - });
2445 + }
2384 2446 } else {
2385 2447 console.warn("Analytics object not available or pro not active");
2386 2448 }
2387 2449 }
@@ -2394,9 +2456,9 @@
2394 2456 } else {
2395 2457 return "desktop";
2396 2458 }
2397 2459 }
2398 - panoshow' . $id . '.on("scenechange", function(scene) {
2460 + panoshow' . $pano_suffix . '.on("scenechange", function(scene) {
2399 2461 onLoadAnalytics = true;
2400 2462 sceneLoadAnalytics = true;
2401 2463 let scene_id = scene;
2402 2464 let tour_id = ' . $id . ';
@@ -2412,29 +2474,31 @@
2412 2474 user_agent: user_agent,
2413 2475 device_type: device_type,
2414 2476 });
2415 2477 });
2416 - panoshow' . $id . '.on("load", function() {
2417 - let scene_id = panoshow' . $id . '.getScene();
2478 + panoshow' . $pano_suffix . '.on("load", function() {
2479 + let scene_id = panoshow' . $pano_suffix . '.getScene();
2418 2480 let tour_id = ' . $id . ';
2419 2481 let type = "scene";
2420 2482 let hotspot_id = "";
2421 2483 let user_agent = navigator.userAgent;
2422 2484 let device_type = getDeviceType() ? getDeviceType() : "desktop";
2423 - if(!onLoadAnalytics && !sceneLoadAnalytics) {
2424 - storeAnalyticsData({
2425 - scene_id: scene_id,
2426 - tour_id: tour_id,
2427 - type: type,
2428 - hotspot_id: hotspot_id,
2429 - user_agent: user_agent,
2430 - device_type: device_type,
2431 - });
2485 + if(!onLoadAnalytics) {
2486 + if(!sceneLoadAnalytics) {
2487 + storeAnalyticsData({
2488 + scene_id: scene_id,
2489 + tour_id: tour_id,
2490 + type: type,
2491 + hotspot_id: hotspot_id,
2492 + user_agent: user_agent,
2493 + device_type: device_type,
2494 + });
2495 + }
2432 2496 }
2433 2497 });
2434 - function wpvrhotspotscene(hotSpotDiv, args) {
2498 + function wpvrhotspotscene' . $pano_suffix . '(hotSpotDiv, args) {
2435 2499 onLoadAnalytics = true;
2436 - let scene_id = panoshow' . $id . '.getScene();
2500 + let scene_id = panoshow' . $pano_suffix . '.getScene();
2437 2501 let tour_id = ' . $id . ';
2438 2502 let type = "hotspot";
2439 2503 let hotspot_id = args;
2440 2504 let user_agent = navigator.userAgent;
@@ -2447,27 +2511,28 @@
2447 2511 user_agent: user_agent,
2448 2512 device_type: device_type
2449 2513 });
2450 2514 }
2515 + var wpvrhotspotscene = wpvrhotspotscene' . $pano_suffix . ';
2451 2516 ';
2452 - $html .= 'panoshow' . $id . '.on("scenechange", function (scene){
2517 + $html .= 'panoshow' . $pano_suffix . '.on("scenechange", function (scene){
2453 2518 jQuery(".center-pointer").removeClass("wpvr-pluse-effect")
2454 2519 active_scene = scene;
2455 2520 // if(localStorage.getItem("vr_mode") == "on") {
2456 2521 if(vr_mode == "on") {
2457 - jQuery("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2458 - jQuery("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2522 + jQuery("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2523 + jQuery("#' . $panoid . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2459 2524 }
2460 2525 });
2461 2526 var compassBlock = "";
2462 2527 var infoBlock = "";
2463 - jQuery(document).on("click",".vr_mode_change' . $id . '",function (){
2464 - jQuery("#pano2' . $id . ' .pnlm-load-button").trigger("click");
2465 - jQuery("#pano' . $id . ' .pnlm-load-button").trigger("click");
2528 + jQuery(document).on("click",".vr_mode_change' . $pano_suffix . '",function (){
2529 + jQuery("#' . $panoid2 . ' .pnlm-load-button").trigger("click");
2530 + jQuery("#' . $panoid . ' .pnlm-load-button").trigger("click");
2466 2531 var getValue = jQuery(this).val();
2467 2532 var getParent = jQuery(this).parent().parent();
2468 - var compass = getParent.find("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display");
2469 - var panoInfo = getParent.find("#pano' . $id . ' .pnlm-panorama-info").css("display");
2533 + var compass = getParent.find("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display");
2534 + var panoInfo = getParent.find("#' . $panoid . ' .pnlm-panorama-info").css("display");
2470 2535 if(compass == "block"){
2471 2536 compassBlock = "block";
2472 2537 }
2473 2538 if(panoInfo == "block"){
@@ -2482,79 +2547,79 @@
2482 2547 // localStorage.setItem("vr_mode", "on");
2483 2548 vr_mode = "on";
2484 2549 jQuery(".vr-mode-title").show();
2485 2550 jQuery(this).val("on");
2486 - getParent.find("#pano2' . $id . '").css({
2551 + getParent.find("#' . $panoid2 . '").css({
2487 2552 "opacity": "1",
2488 2553 "visibility": "visible",
2489 2554 "position": "relative",
2490 2555 });
2491 2556 gyroSwitch = true;
2492 - panoshow' . $id . '.startOrientation();
2493 - panoshow2' . $id . '.startOrientation();
2494 - panoshow2' . $id . '.setPitch(panoshow' . $id . '.getPitch(), 0);
2495 - panoshow2' . $id . '.setYaw(panoshow' . $id . '.getYaw(), 0);
2557 + panoshow' . $pano_suffix . '.startOrientation();
2558 + panoshow2' . $pano_suffix . '.startOrientation();
2559 + panoshow2' . $pano_suffix . '.setPitch(panoshow' . $pano_suffix . '.getPitch(), 0);
2560 + panoshow2' . $pano_suffix . '.setYaw(panoshow' . $pano_suffix . '.getYaw(), 0);
2496 2561 getParent.find(".pano-wrap").addClass("wpvr-cardboard-disable-event");
2497 - getParent.find("#pano' .$id. ' #zoom-in-out-controls'.$id.'").hide();
2498 - getParent.find("#pano' .$id. ' #controls'.$id.'").hide();
2499 - getParent.find("#pano' .$id. ' #explainer_button_'.$id. '").hide();
2500 - getParent.find("#pano' . $id . ' #generic_form_button_' . $id . '").hide();
2501 - getParent.find("#pano' .$id. ' #floor_map_button_'.$id.'").hide();
2502 - getParent.find("#pano' .$id. ' #vrgcontrols'.$id.'").hide();
2503 - getParent.find("#pano' .$id. ' #sccontrols'.$id.'").hide();
2504 - getParent.find("#pano' .$id. ' #adcontrol'.$id.'").hide();
2505 - getParent.find("#pano' .$id. ' .wpvr_slider_nav").hide();
2506 - getParent.find("#pano' .$id. ' #cp-logo-controls").hide();
2507 - getParent.find("#pano' .$id. ' #wpvr-social-share-bg-box'.$id.'").hide();
2508 - getParent.find("#pano2' . $id . ' .pnlm-controls-container").hide();
2509 - getParent.find("#pano' . $id . ' .pnlm-controls-container").hide();
2510 - getParent.find("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").hide();
2511 - getParent.find("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").hide();
2512 - getParent.find("#pano2' . $id . ' .pnlm-panorama-info").hide();
2513 - getParent.find("#pano' . $id . ' .pnlm-panorama-info").hide();
2514 - getParent.find("#pano' . $id . '").addClass("cardboard-half");
2515 - getParent.find("#center-pointer' . $id . '").show();
2562 + getParent.find("#' . $panoid . ' #zoom-in-out-controls' . $pano_suffix . '").hide();
2563 + getParent.find("#' . $panoid . ' #controls' . $pano_suffix . '").hide();
2564 + getParent.find("#' . $panoid . ' #explainer_button_' . $pano_suffix . '").hide();
2565 + getParent.find("#' . $panoid . ' #generic_form_button_' . $pano_suffix . '").hide();
2566 + getParent.find("#' . $panoid . ' #floor_map_button_' . $pano_suffix . '").hide();
2567 + getParent.find("#' . $panoid . ' #vrgcontrols' . $pano_suffix . '").hide();
2568 + getParent.find("#' . $panoid . ' #sccontrols' . $pano_suffix . '").hide();
2569 + getParent.find("#' . $panoid . ' #adcontrol' . $pano_suffix . '").hide();
2570 + getParent.find("#' . $panoid . ' .wpvr_slider_nav").hide();
2571 + getParent.find("#' . $panoid . ' #cp-logo-controls").hide();
2572 + getParent.find("#' . $panoid . ' #wpvr-social-share-bg-box' . $pano_suffix . '").hide();
2573 + getParent.find("#' . $panoid2 . ' .pnlm-controls-container").hide();
2574 + getParent.find("#' . $panoid . ' .pnlm-controls-container").hide();
2575 + getParent.find("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").hide();
2576 + getParent.find("#' . $panoid . ' .pnlm-compass.pnlm-controls.pnlm-control").hide();
2577 + getParent.find("#' . $panoid2 . ' .pnlm-panorama-info").hide();
2578 + getParent.find("#' . $panoid . ' .pnlm-panorama-info").hide();
2579 + getParent.find("#' . $panoid . '").addClass("cardboard-half");
2580 + getParent.find("#center-pointer' . $pano_suffix . '").show();
2516 2581 getParent.find(".fullscreen-button").hide();
2517 - getParent.find("#pano' . $id . ' #custom-scene-navigation' . $id . '").hide();
2582 + getParent.find("#' . $panoid . ' #custom-scene-navigation' . $pano_suffix . '").hide();
2518 2583 if (window.DeviceOrientationEvent) {
2519 2584 window.addEventListener("deviceorientation", vrDeviseOrientation);
2520 2585 }
2521 - panoshow' . $id . '.on("zoomchange", function (data){
2522 - panoshow2' . $id . '.setHfov(data, 0);
2586 + panoshow' . $pano_suffix . '.on("zoomchange", function (data){
2587 + panoshow2' . $pano_suffix . '.setHfov(data, 0);
2523 2588 });
2524 - panoshow2' . $id . '.on("zoomchange", function (data){
2525 - panoshow' . $id . '.setHfov(data, 0);
2589 + panoshow2' . $pano_suffix . '.on("zoomchange", function (data){
2590 + panoshow' . $pano_suffix . '.setHfov(data, 0);
2526 2591 });
2527 - jQuery(document).on("click","#pano2' . $id . '",function(event) {
2528 - panoshow' . $id . '.startOrientation();
2529 - panoshow2' . $id . '.startOrientation();
2592 + jQuery(document).on("click","#' . $panoid2 . '",function(event) {
2593 + panoshow' . $pano_suffix . '.startOrientation();
2594 + panoshow2' . $pano_suffix . '.startOrientation();
2530 2595 });
2531 - jQuery(document).on("click","#pano' . $id . '",function(event) {
2532 - panoshow' . $id . '.startOrientation();
2533 - panoshow2' . $id . '.startOrientation();
2596 + jQuery(document).on("click","#' . $panoid . '",function(event) {
2597 + panoshow' . $pano_suffix . '.startOrientation();
2598 + panoshow2' . $pano_suffix . '.startOrientation();
2534 2599 });
2535 - panoshow' . $id . '.on("mousemove", function (data){
2536 - panoshow2' . $id . '.setPitch(data.pitch, 0);
2537 - panoshow2' . $id . '.setYaw(data.yaw, 0);
2600 + panoshow' . $pano_suffix . '.on("mousemove", function (data){
2601 + panoshow2' . $pano_suffix . '.setPitch(data.pitch, 0);
2602 + panoshow2' . $pano_suffix . '.setYaw(data.yaw, 0);
2538 2603 panoShowCardBoardOnTrigger(data);
2539 2604 });
2540 - panoshow2' . $id . '.on("mousemove", function (data){
2541 - panoshow' . $id . '.setPitch(data.pitch, 0);
2542 - panoshow' . $id . '.setYaw(data.yaw, 0);
2605 + panoshow2' . $pano_suffix . '.on("mousemove", function (data){
2606 + panoshow' . $pano_suffix . '.setPitch(data.pitch, 0);
2607 + panoshow' . $pano_suffix . '.setYaw(data.yaw, 0);
2543 2608 panoShowCardBoardOnTrigger(data);
2544 2609 });
2545 - panoshow' . $id . '.on("touchmove", function (data){
2546 - panoshow' . $id . '.stopOrientation();
2547 - panoshow2' . $id . '.stopOrientation();
2548 - panoshow2' . $id . '.setPitch(data.pitch, 0);
2549 - panoshow2' . $id . '.setYaw(data.yaw, 0);
2610 + panoshow' . $pano_suffix . '.on("touchmove", function (data){
2611 + panoshow' . $pano_suffix . '.stopOrientation();
2612 + panoshow2' . $pano_suffix . '.stopOrientation();
2613 + panoshow2' . $pano_suffix . '.setPitch(data.pitch, 0);
2614 + panoshow2' . $pano_suffix . '.setYaw(data.yaw, 0);
2550 2615 panoShowCardBoardOnTrigger(data);
2551 2616 });
2552 - panoshow2' . $id . '.on("touchmove", function (data){
2553 - panoshow' . $id . '.stopOrientation();
2554 - panoshow2' . $id . '.stopOrientation();
2555 - panoshow' . $id . '.setPitch(data.pitch, 0);
2556 - panoshow' . $id . '.setYaw(data.yaw, 0);
2617 + panoshow2' . $pano_suffix . '.on("touchmove", function (data){
2618 + panoshow' . $pano_suffix . '.stopOrientation();
2619 + panoshow2' . $pano_suffix . '.stopOrientation();
2620 + panoshow' . $pano_suffix . '.setPitch(data.pitch, 0);
2621 + panoshow' . $pano_suffix . '.setYaw(data.yaw, 0);
2557 2622 panoShowCardBoardOnTrigger(data);
2558 2623 });
2559 2624 } else if(getValue == "on") {
2560 2625 screen.orientation.unlock();
@@ -2562,66 +2627,66 @@
2562 2627 // localStorage.setItem("vr_mode", "off");
2563 2628 vr_mode = "off";
2564 2629 jQuery(".vr-mode-title").hide();
2565 2630 jQuery(this).val("off");
2566 - getParent.find("#pano2' . $id . '").css({
2631 + getParent.find("#' . $panoid2 . '").css({
2567 2632 "opacity": "0",
2568 2633 "visibility": "hidden",
2569 2634 "position": "absolute",
2570 2635 });
2571 2636 getParent.find(".pano-wrap").removeClass("wpvr-cardboard-disable-event");
2572 - getParent.find("#pano' .$id. ' #zoom-in-out-controls'.$id.'").show();
2573 - getParent.find("#pano' .$id. ' #controls'.$id.'").show();
2574 - getParent.find("#pano' .$id. ' #explainer_button_'.$id. '").show();
2575 - getParent.find("#pano' . $id . ' #generic_form_button_' . $id . '").show();
2576 - getParent.find("#pano' .$id. ' #floor_map_button_'.$id.'").show();
2577 - getParent.find("#pano2' . $id . ' .pnlm-controls-container").show();
2578 - getParent.find("#pano' . $id . ' .pnlm-controls-container").show();
2579 - getParent.find("#pano' .$id. ' #vrgcontrols'.$id.'").show();
2580 - getParent.find("#pano' .$id. ' #sccontrols'.$id.'").hide();
2581 - getParent.find("#pano' .$id. ' #adcontrol'.$id.'").show();
2582 - getParent.find("#pano' .$id. ' .wpvr_slider_nav").hide();
2583 - getParent.find("#pano' .$id. ' #cp-logo-controls").show();
2584 - getParent.find("#pano' .$id. ' #wpvr-social-share-bg-box'.$id.'").show();
2585 - getParent.find("#pano' . $id . ' #custom-scene-navigation' . $id . '").show();
2637 + getParent.find("#' . $panoid . ' #zoom-in-out-controls' . $pano_suffix . '").show();
2638 + getParent.find("#' . $panoid . ' #controls' . $pano_suffix . '").show();
2639 + getParent.find("#' . $panoid . ' #explainer_button_' . $pano_suffix . '").show();
2640 + getParent.find("#' . $panoid . ' #generic_form_button_' . $pano_suffix . '").show();
2641 + getParent.find("#' . $panoid . ' #floor_map_button_' . $pano_suffix . '").show();
2642 + getParent.find("#' . $panoid2 . ' .pnlm-controls-container").show();
2643 + getParent.find("#' . $panoid . ' .pnlm-controls-container").show();
2644 + getParent.find("#' . $panoid . ' #vrgcontrols' . $pano_suffix . '").show();
2645 + getParent.find("#' . $panoid . ' #sccontrols' . $pano_suffix . '").hide();
2646 + getParent.find("#' . $panoid . ' #adcontrol' . $pano_suffix . '").show();
2647 + getParent.find("#' . $panoid . ' .wpvr_slider_nav").hide();
2648 + getParent.find("#' . $panoid . ' #cp-logo-controls").show();
2649 + getParent.find("#' . $panoid . ' #wpvr-social-share-bg-box' . $pano_suffix . '").show();
2650 + getParent.find("#' . $panoid . ' #custom-scene-navigation' . $pano_suffix . '").show();
2586 2651 if(compassBlock == "block"){
2587 - getParent.find("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").show();
2588 - getParent.find("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").show();
2652 + getParent.find("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").show();
2653 + getParent.find("#' . $panoid . ' .pnlm-compass.pnlm-controls.pnlm-control").show();
2589 2654 }
2590 2655 if(infoBlock == "block"){
2591 - getParent.find("#pano2' . $id . ' .pnlm-panorama-info").show();
2592 - getParent.find("#pano' . $id . ' .pnlm-panorama-info").show();
2656 + getParent.find("#' . $panoid2 . ' .pnlm-panorama-info").show();
2657 + getParent.find("#' . $panoid . ' .pnlm-panorama-info").show();
2593 2658 }
2594 - getParent.find("#pano' . $id . '").removeClass("cardboard-half");
2595 - getParent.find("#center-pointer' . $id . '").hide();
2659 + getParent.find("#' . $panoid . '").removeClass("cardboard-half");
2660 + getParent.find("#center-pointer' . $pano_suffix . '").hide();
2596 2661 getParent.find(".fullscreen-button").hide();
2597 - panoshow' . $id . '.off("mousemove");
2598 - panoshow' . $id . '.off("touchmove");
2599 - panoshow2' . $id . '.off("mousemove");
2600 - panoshow2' . $id . '.off("touchmove");
2662 + panoshow' . $pano_suffix . '.off("mousemove");
2663 + panoshow' . $pano_suffix . '.off("touchmove");
2664 + panoshow2' . $pano_suffix . '.off("mousemove");
2665 + panoshow2' . $pano_suffix . '.off("touchmove");
2601 2666 if (window.DeviceOrientationEvent) {
2602 2667 window.removeEventListener("deviceorientation", vrDeviseOrientation);
2603 2668 }
2604 2669 }
2605 2670 });';
2606 - $html .= 'panoshow2' . $id . '.on("load", function (){
2671 + $html .= 'panoshow2' . $pano_suffix . '.on("load", function (){
2607 2672 // if(localStorage.getItem("vr_mode") == "off") {
2608 2673 if( vr_mode == "off") {
2609 2674 jQuery(".vr-mode-title").hide();
2610 2675 }
2611 2676 else {
2612 - jQuery("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2613 - jQuery("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2614 - jQuery("#pano2' . $id . ' .pnlm-panorama-info").hide();
2615 - jQuery("#pano' . $id . ' .pnlm-panorama-info").hide();
2677 + jQuery("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2678 + jQuery("#' . $panoid . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2679 + jQuery("#' . $panoid2 . ' .pnlm-panorama-info").hide();
2680 + jQuery("#' . $panoid . ' .pnlm-panorama-info").hide();
2616 2681 jQuery(".vr-mode-title").show();
2617 2682 }
2618 2683 });';
2619 2684 }
2620 2685 //=== end Dplicate mode only for vr mode===//
2621 - $html .= 'jQuery("#pano' . $id . ' .wpvr-floor-map .floor-plan-pointer").on("click",function(){
2686 + $html .= 'jQuery("#' . $panoid . ' .wpvr-floor-map .floor-plan-pointer").on("click",function(){
2622 2687 var scene_id = jQuery(this).attr("scene_id");
2623 - panoshow' . $id . '.loadScene(scene_id)
2688 + panoshow' . $pano_suffix . '.loadScene(scene_id)
2624 2689 jQuery(".floor-plan-pointer").removeClass("add-pulse")
2625 2690 jQuery(this).addClass("add-pulse")
2626 2691 });';
2627 2692 if ($scene_animation_enabled && is_plugin_active('wpvr-pro/wpvr-pro.php')) {
@@ -2631,9 +2696,9 @@
2631 2696 $animationDelay = $postdata['sceneAnimationTransitionDelay'] ?? '0ms';
2632 2697 $animation_js = apply_filters('wpvr_scene_animation_js', $id, $animation_type, $animationDuration, $animationDelay);
2633 2698 if (!empty($animation_js)) {
2634 2699 $html .= $animation_js;
2635 - $html .= 'panoshow' . $id . '.on("load", function (scene){
2700 + $html .= 'panoshow' . $pano_suffix . '.on("load", function (scene){
2636 2701 if (typeof changeScene === "function") {
2637 2702 changeScene();
2638 2703 } else {
2639 2704 console.warn("changeScene function is not defined.");
@@ -2641,15 +2706,15 @@
2641 2706 });';
2642 2707 }
2643 2708 }
2644 2709
2645 - $html .= 'panoshow' . $id . '.on("mousemove", function (data){
2710 + $html .= 'panoshow' . $pano_suffix . '.on("mousemove", function (data){
2646 2711 jQuery(".add-pulse").css({"transform":"rotate("+data.yaw+"deg)"});
2647 2712 });
2648 2713 ';
2649 2714 $status = get_option('wpvr_edd_license_status');
2650 2715 if ($status !== false && 'valid' == $status && $is_pro){
2651 - $html .= 'panoshow' . $id . '.on("scenechange", function (scene){
2716 + $html .= 'panoshow' . $pano_suffix . '.on("scenechange", function (scene){
2652 2717 jQuery(".center-pointer").removeClass("wpvr-pluse-effect")
2653 2718 jQuery(".floor-plan-pointer").each(function(index ,element){
2654 2719 var scene_id = jQuery(this).attr("scene_id");
2655 2720 if( active_scene == scene_id ){
@@ -2657,9 +2722,9 @@
2657 2722 jQuery(this).addClass("add-pulse")
2658 2723 }
2659 2724 });
2660 2725 });';
2661 - $html .= 'panoshow' . $id . '.on("load", function (){
2726 + $html .= 'panoshow' . $pano_suffix . '.on("load", function (){
2662 2727 if(jQuery(".floor-plan-pointer").length > 0){
2663 2728 jQuery(".floor-plan-pointer").each(function(index ,element){
2664 2729 var scene_id = jQuery(this).attr("scene_id");
2665 2730 if( active_scene == scene_id ){
@@ -2671,14 +2736,14 @@
2671 2736 });';
2672 2737 }
2673 2738 if ($status !== false && 'valid' == $status && $is_pro){
2674 2739 $scene_navigation_content_type = isset($postdata['scene_navigation_content_type']) ? $postdata['scene_navigation_content_type'] : 'scene_id';
2675 - $html .= 'jQuery("#pano' . $id . ' .custom-scene-navigation").on("click", function() {
2676 - jQuery("#custom-scene-navigation-nav' . $id . ' ul").empty();
2740 + $html .= 'jQuery("#' . $panoid . ' .custom-scene-navigation").on("click", function() {
2741 + jQuery("#custom-scene-navigation-nav' . $pano_suffix . ' ul").empty();
2677 2742 if (scenes) {
2678 2743 var scene_navigation_content_type = "' . $scene_navigation_content_type . '";
2679 2744 var sceneList = scenes.scenes;
2680 - var getScene = panoshow' . $id . '.getScene();
2745 + var getScene = panoshow' . $pano_suffix . '.getScene();
2681 2746 for (const key in sceneList) {
2682 2747 let title;
2683 2748 if (scene_navigation_content_type === "scene_title") {
2684 2749 if (sceneList[key].title) {
@@ -2697,9 +2762,9 @@
2697 2762 } else {
2698 2763 title = key;
2699 2764 }
2700 2765 if (sceneList.hasOwnProperty(key)) {
2701 - let ulElement = document.querySelector("#custom-scene-navigation-nav' . $id . ' ul");
2766 + let ulElement = document.querySelector("#custom-scene-navigation-nav' . $pano_suffix . ' ul");
2702 2767 if (ulElement) {
2703 2768 let liElement = document.createElement("li");
2704 2769 liElement.className = "scene-navigation-list" + (key === getScene ? " active" : "");
2705 2770 liElement.setAttribute("scene_id", key);
@@ -2707,9 +2772,9 @@
2707 2772 ulElement.appendChild(liElement);
2708 2773 }
2709 2774 }
2710 2775 }
2711 - jQuery("#custom-scene-navigation-nav' . $id . '").toggleClass("visible");
2776 + jQuery("#custom-scene-navigation-nav' . $pano_suffix . '").toggleClass("visible");
2712 2777 }
2713 2778 });';
2714 2779 $html .='function getImageNameWithoutExtension(imageUrl) {
2715 2780 // Split the URL by "/"
@@ -2722,70 +2787,70 @@
2722 2787 var imageNameWithoutExtension = imageNameParts.slice(0, -1).join(".");
2723 2788 // Return the image name without extension
2724 2789 return imageNameWithoutExtension;
2725 2790 }';
2726 - $html .= 'jQuery("#pano' . $id . ' #custom-scene-navigation-nav' . $id . ' ul").on("click", "li.scene-navigation-list", function() {
2791 + $html .= 'jQuery("#' . $panoid . ' #custom-scene-navigation-nav' . $pano_suffix . ' ul").on("click", "li.scene-navigation-list", function() {
2727 2792 if (scenes) {
2728 2793 jQuery(this).siblings("li").removeClass("active");
2729 2794 jQuery(this).addClass("active");
2730 2795 var scene_key = jQuery(this).attr("scene_id");
2731 - panoshow' . $id . '.loadScene(scene_key);
2796 + panoshow' . $pano_suffix . '.loadScene(scene_key);
2732 2797 }
2733 2798 });';
2734 2799 }
2735 2800 $html .= 'const node = document.querySelector(".add-pulse");
2736 - panoshow' . $id . '.on("compasschange", function (data){
2801 + panoshow' . $pano_suffix . '.on("compasschange", function (data){
2737 2802 // const node = document.querySelector(".add-pulse");
2738 2803 // node.style.transform = data;
2739 2804 // jQuery(".add-pulse").css({"transform":data});
2740 2805 });';
2741 - $html .= 'panoshow' . $id . '.on("load", function (){
2806 + $html .= 'panoshow' . $pano_suffix . '.on("load", function (){
2742 2807 // if(localStorage.getItem("vr_mode") == "off") {
2743 2808 if(vr_mode == "off") {
2744 2809 jQuery(".vr-mode-title").hide();
2745 2810 } else {
2746 - jQuery("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2747 - jQuery("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2748 - jQuery("#pano2' . $id . ' .pnlm-panorama-info").hide();
2749 - jQuery("#pano' . $id . ' .pnlm-panorama-info").hide();
2811 + jQuery("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2812 + jQuery("#' . $panoid . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none");
2813 + jQuery("#' . $panoid2 . ' .pnlm-panorama-info").hide();
2814 + jQuery("#' . $panoid . ' .pnlm-panorama-info").hide();
2750 2815 jQuery(".vr-mode-title").show();
2751 2816 }
2752 2817 setTimeout(() => {
2753 2818 window.dispatchEvent(new Event("resize"));
2754 2819 }, 200);
2755 - if (jQuery("#pano' . $id . '").children().children(".pnlm-panorama-info:visible").length > 0) {
2756 - jQuery("#controls' . $id . '").css("bottom", "80px");
2820 + if (jQuery("#' . $panoid . '").children().children(".pnlm-panorama-info:visible").length > 0) {
2821 + jQuery("#controls' . $pano_suffix . '").css("bottom", "80px");
2757 2822 }
2758 2823 else {
2759 - jQuery("#controls' . $id . '").css("bottom", "5px");
2824 + jQuery("#controls' . $pano_suffix . '").css("bottom", "5px");
2760 2825 }
2761 2826 });';
2762 - $html .= 'panoshow' . $id . '.on("render", function (){
2827 + $html .= 'panoshow' . $pano_suffix . '.on("render", function (){
2763 2828 window.dispatchEvent(new Event("resize"));
2764 2829 });';
2765 2830 $html .= 'if (scenes.autoRotate) {
2766 - var wpvrAutoRotateTimer' . $id . ' = null;
2767 - var wpvrAutoRotateStopDelay' . $id . ' = parseInt(scenes.autoRotateStopDelay, 10) || 0;
2768 - var wpvrScheduleAutoRotate' . $id . ' = function () {
2769 - clearTimeout(wpvrAutoRotateTimer' . $id . ');
2770 - if (wpvrAutoRotateStopDelay' . $id . ' > 0) {
2771 - wpvrAutoRotateTimer' . $id . ' = setTimeout(function () {
2772 - panoshow' . $id . '.stopAutoRotate();
2773 - }, wpvrAutoRotateStopDelay' . $id . ');
2831 + var wpvrAutoRotateTimer' . $pano_suffix . ' = null;
2832 + var wpvrAutoRotateStopDelay' . $pano_suffix . ' = parseInt(scenes.autoRotateStopDelay, 10) || 0;
2833 + var wpvrScheduleAutoRotate' . $pano_suffix . ' = function () {
2834 + clearTimeout(wpvrAutoRotateTimer' . $pano_suffix . ');
2835 + if (wpvrAutoRotateStopDelay' . $pano_suffix . ' > 0) {
2836 + wpvrAutoRotateTimer' . $pano_suffix . ' = setTimeout(function () {
2837 + panoshow' . $pano_suffix . '.stopAutoRotate();
2838 + }, wpvrAutoRotateStopDelay' . $pano_suffix . ');
2774 2839 } else {
2775 - wpvrAutoRotateTimer' . $id . ' = setTimeout(function () {
2776 - panoshow' . $id . '.startAutoRotate(scenes.autoRotate, 0);
2840 + wpvrAutoRotateTimer' . $pano_suffix . ' = setTimeout(function () {
2841 + panoshow' . $pano_suffix . '.startAutoRotate(scenes.autoRotate, 0);
2777 2842 }, 3000);
2778 2843 }
2779 2844 };
2780 - panoshow' . $id . '.on("load", wpvrScheduleAutoRotate' . $id . ');
2781 - panoshow' . $id . '.on("scenechange", wpvrScheduleAutoRotate' . $id . ');
2845 + panoshow' . $pano_suffix . '.on("load", wpvrScheduleAutoRotate' . $pano_suffix . ');
2846 + panoshow' . $pano_suffix . '.on("scenechange", wpvrScheduleAutoRotate' . $pano_suffix . ');
2782 2847 }';
2783 2848 $html .= 'var touchtime = 0;';
2784 2849 $html .= '
2785 - var wpvrHotspotRoot' . $id . ' = document.getElementById("pano' . $id . '");
2786 - if (wpvrHotspotRoot' . $id . ') {
2787 - wpvrHotspotRoot' . $id . '.addEventListener("click", function (event) {
2850 + var wpvrHotspotRoot' . $pano_suffix . ' = document.getElementById("' . $panoid . '");
2851 + if (wpvrHotspotRoot' . $pano_suffix . ') {
2852 + wpvrHotspotRoot' . $pano_suffix . '.addEventListener("click", function (event) {
2788 2853 var hotspot = event.target.closest(".pnlm-hotspot-base");
2789 2854
2790 2855 if (!hotspot) {
2791 2856 return;
@@ -2816,11 +2881,11 @@
2816 2881 if (isset($panodata["scene-list"])) {
2817 2882 foreach ($panodata["scene-list"] as $panoscenes) {
2818 2883 $scene_key = $panoscenes['scene-id'];
2819 2884 $gallery_scene_ids[] = (string) $scene_key;
2820 - $scene_key_gallery = $panoscenes['scene-id'] . '_gallery_' . $id;
2885 + $scene_key_gallery = $panoscenes['scene-id'] . '_gallery_' . $pano_suffix;
2821 2886 $html .= 'jQuery(document).on("click","#' . $scene_key_gallery . '",function() {
2822 - panoshow' . $id . '.loadScene("' . $scene_key . '");
2887 + panoshow' . $pano_suffix . '.loadScene(' . wp_json_encode( (string) $scene_key ) . ');
2823 2888 });';
2824 2889 }
2825 2890 }
2826 2891
@@ -2848,22 +2913,22 @@
2848 2913 stagePadding: 0
2849 2914 }';
2850 2915
2851 2916 $html .= '
2852 - var wpvrGallery' . $id . ' = jQuery("#sccontrols' . $id . '");
2853 - var wpvrGalleryRoot' . $id . ' = jQuery("#pano' . $id . '");
2854 - var wpvrGalleryScenes' . $id . ' = ' . wp_json_encode(array_values($gallery_scene_ids)) . ';
2855 - var wpvrGalleryResizeTimer' . $id . ';
2856 - var wpvrGalleryVisibilityTimer' . $id . ';
2857 - var wpvrGalleryObserver' . $id . ';
2917 + var wpvrGallery' . $pano_suffix . ' = jQuery("#sccontrols' . $pano_suffix . '");
2918 + var wpvrGalleryRoot' . $pano_suffix . ' = jQuery("#' . $panoid . '");
2919 + var wpvrGalleryScenes' . $pano_suffix . ' = ' . wp_json_encode(array_values($gallery_scene_ids)) . ';
2920 + var wpvrGalleryResizeTimer' . $pano_suffix . ';
2921 + var wpvrGalleryVisibilityTimer' . $pano_suffix . ';
2922 + var wpvrGalleryObserver' . $pano_suffix . ';
2858 2923
2859 - function wpvrPrepareSceneNavigation' . $id . '() {
2860 - var navigationDisabled = wpvrGalleryScenes' . $id . '.length < 2;
2861 - var previousButtons = wpvrGalleryRoot' . $id . '.find(".wpvr_owl_prev");
2862 - var nextButtons = wpvrGalleryRoot' . $id . '.find(".wpvr_owl_next");
2924 + function wpvrPrepareSceneNavigation' . $pano_suffix . '() {
2925 + var navigationDisabled = wpvrGalleryScenes' . $pano_suffix . '.length < 2;
2926 + var previousButtons = wpvrGalleryRoot' . $pano_suffix . '.find(".wpvr_owl_prev");
2927 + var nextButtons = wpvrGalleryRoot' . $pano_suffix . '.find(".wpvr_owl_next");
2863 2928
2864 - wpvrGallery' . $id . '.removeClass("owl-theme");
2865 - wpvrGalleryRoot' . $id . '.find(".wpvr_slider_nav").removeClass("owl-nav");
2929 + wpvrGallery' . $pano_suffix . '.removeClass("owl-theme");
2930 + wpvrGalleryRoot' . $pano_suffix . '.find(".wpvr_slider_nav").removeClass("owl-nav");
2866 2931 previousButtons
2867 2932 .removeClass("owl-prev")
2868 2933 .prop("disabled", navigationDisabled)
2869 2934 .toggleClass("disabled", navigationDisabled);
@@ -2872,76 +2937,76 @@
2872 2937 .prop("disabled", navigationDisabled)
2873 2938 .toggleClass("disabled", navigationDisabled);
2874 2939 }
2875 2940
2876 - function wpvrRefreshGallery' . $id . '() {
2877 - wpvrPrepareSceneNavigation' . $id . '();
2941 + function wpvrRefreshGallery' . $pano_suffix . '() {
2942 + wpvrPrepareSceneNavigation' . $pano_suffix . '();
2878 2943
2879 - if (!wpvrGallery' . $id . '.length || !wpvrGallery' . $id . '.hasClass("owl-loaded") || !wpvrGallery' . $id . '.is(":visible")) {
2944 + if (!wpvrGallery' . $pano_suffix . '.length || !wpvrGallery' . $pano_suffix . '.hasClass("owl-loaded") || !wpvrGallery' . $pano_suffix . '.is(":visible")) {
2880 2945 return;
2881 2946 }
2882 2947
2883 - if (wpvrGallery' . $id . '.css("display") === "flex") {
2884 - wpvrGallery' . $id . '.css("display", "block");
2948 + if (wpvrGallery' . $pano_suffix . '.css("display") === "flex") {
2949 + wpvrGallery' . $pano_suffix . '.css("display", "block");
2885 2950 }
2886 - wpvrGallery' . $id . '.trigger("refresh.owl.carousel");
2887 - wpvrUpdateGalleryNavigation' . $id . '(panoshow' . $id . '.getScene());
2951 + wpvrGallery' . $pano_suffix . '.trigger("refresh.owl.carousel");
2952 + wpvrUpdateGalleryNavigation' . $pano_suffix . '(panoshow' . $pano_suffix . '.getScene());
2888 2953 }
2889 2954
2890 - function wpvrGallerySceneIndex' . $id . '(sceneId) {
2891 - return wpvrGalleryScenes' . $id . '.indexOf(String(sceneId));
2955 + function wpvrGallerySceneIndex' . $pano_suffix . '(sceneId) {
2956 + return wpvrGalleryScenes' . $pano_suffix . '.indexOf(String(sceneId));
2892 2957 }
2893 2958
2894 - function wpvrUpdateGalleryNavigation' . $id . '(sceneId) {
2895 - var currentIndex = wpvrGallerySceneIndex' . $id . '(sceneId);
2896 - var activeThumbnailId = String(sceneId) + "_gallery_' . $id . '";
2897 - var thumbnails = wpvrGallery' . $id . '.find("img.scctrl");
2959 + function wpvrUpdateGalleryNavigation' . $pano_suffix . '(sceneId) {
2960 + var currentIndex = wpvrGallerySceneIndex' . $pano_suffix . '(sceneId);
2961 + var activeThumbnailId = String(sceneId) + "_gallery_' . $pano_suffix . '";
2962 + var thumbnails = wpvrGallery' . $pano_suffix . '.find("img.scctrl");
2898 2963 var activeThumbnail = thumbnails.filter(function () {
2899 2964 return this.id === activeThumbnailId;
2900 2965 });
2901 2966
2902 - wpvrPrepareSceneNavigation' . $id . '();
2967 + wpvrPrepareSceneNavigation' . $pano_suffix . '();
2903 2968 thumbnails.removeClass("wpvr-active-thumbnail");
2904 - wpvrGallery' . $id . '.find(".owl-item").removeClass("clicked");
2969 + wpvrGallery' . $pano_suffix . '.find(".owl-item").removeClass("clicked");
2905 2970 activeThumbnail.addClass("wpvr-active-thumbnail");
2906 2971 activeThumbnail.closest(".owl-item").addClass("clicked");
2907 2972
2908 2973 if (currentIndex >= 0) {
2909 - if (wpvrGallery' . $id . '.hasClass("owl-loaded")) {
2910 - wpvrGallery' . $id . '.trigger("to.owl.carousel", [currentIndex, 300, true]);
2911 - window.setTimeout(wpvrPrepareSceneNavigation' . $id . ', 0);
2974 + if (wpvrGallery' . $pano_suffix . '.hasClass("owl-loaded")) {
2975 + wpvrGallery' . $pano_suffix . '.trigger("to.owl.carousel", [currentIndex, 300, true]);
2976 + window.setTimeout(wpvrPrepareSceneNavigation' . $pano_suffix . ', 0);
2912 2977 }
2913 2978 }
2914 2979 }
2915 2980
2916 - function wpvrLoadAdjacentGalleryScene' . $id . '(direction) {
2917 - var currentIndex = wpvrGallerySceneIndex' . $id . '(panoshow' . $id . '.getScene());
2981 + function wpvrLoadAdjacentGalleryScene' . $pano_suffix . '(direction) {
2982 + var currentIndex = wpvrGallerySceneIndex' . $pano_suffix . '(panoshow' . $pano_suffix . '.getScene());
2918 2983
2919 - if (currentIndex < 0 || wpvrGalleryScenes' . $id . '.length < 2) {
2984 + if (currentIndex < 0 || wpvrGalleryScenes' . $pano_suffix . '.length < 2) {
2920 2985 return;
2921 2986 }
2922 2987
2923 - var targetIndex = (currentIndex + direction + wpvrGalleryScenes' . $id . '.length) % wpvrGalleryScenes' . $id . '.length;
2924 - panoshow' . $id . '.loadScene(wpvrGalleryScenes' . $id . '[targetIndex]);
2988 + var targetIndex = (currentIndex + direction + wpvrGalleryScenes' . $pano_suffix . '.length) % wpvrGalleryScenes' . $pano_suffix . '.length;
2989 + panoshow' . $pano_suffix . '.loadScene(wpvrGalleryScenes' . $pano_suffix . '[targetIndex]);
2925 2990 }
2926 2991
2927 2992 if (jQuery.fn.owlCarousel) {
2928 - if (wpvrGallery' . $id . '.length) {
2929 - if (!wpvrGallery' . $id . '.hasClass("owl-loaded")) {
2930 - wpvrGallery' . $id . '.owlCarousel(' . $gallery_options . ');
2993 + if (wpvrGallery' . $pano_suffix . '.length) {
2994 + if (!wpvrGallery' . $pano_suffix . '.hasClass("owl-loaded")) {
2995 + wpvrGallery' . $pano_suffix . '.owlCarousel(' . $gallery_options . ');
2931 2996 }
2932 2997 }
2933 2998 }
2934 2999
2935 - wpvrGalleryRoot' . $id . '
2936 - .off("click.wpvrGalleryRefresh' . $id . '", "#vrgcontrols' . $id . '")
2937 - .on("click.wpvrGalleryRefresh' . $id . '", "#vrgcontrols' . $id . '", function () {
2938 - wpvrPrepareSceneNavigation' . $id . '();
2939 - window.setTimeout(wpvrRefreshGallery' . $id . ', 450);
3000 + wpvrGalleryRoot' . $pano_suffix . '
3001 + .off("click.wpvrGalleryRefresh' . $pano_suffix . '", "#vrgcontrols' . $pano_suffix . '")
3002 + .on("click.wpvrGalleryRefresh' . $pano_suffix . '", "#vrgcontrols' . $pano_suffix . '", function () {
3003 + wpvrPrepareSceneNavigation' . $pano_suffix . '();
3004 + window.setTimeout(wpvrRefreshGallery' . $pano_suffix . ', 450);
2940 3005 });
2941 3006
2942 - if (wpvrGalleryRoot' . $id . '.length) {
2943 - wpvrGalleryRoot' . $id . '[0].addEventListener("click", function (event) {
3007 + if (wpvrGalleryRoot' . $pano_suffix . '.length) {
3008 + wpvrGalleryRoot' . $pano_suffix . '[0].addEventListener("click", function (event) {
2944 3009 var navigationButton = event.target.closest(".wpvr_owl_prev, .wpvr_owl_next");
2945 3010
2946 3011 if (!navigationButton) {
2947 3012 return;
@@ -2946,9 +3011,9 @@
2946 3011 if (!navigationButton) {
2947 3012 return;
2948 3013 }
2949 3014
2950 - if (!wpvrGalleryRoot' . $id . '[0].contains(navigationButton)) {
3015 + if (!wpvrGalleryRoot' . $pano_suffix . '[0].contains(navigationButton)) {
2951 3016 return;
2952 3017 }
2953 3018
2954 3019 event.preventDefault();
@@ -2954,29 +3019,29 @@
2954 3019 event.preventDefault();
2955 3020 event.stopImmediatePropagation();
2956 3021
2957 3022 if (navigationButton.classList.contains("wpvr_owl_prev")) {
2958 - wpvrLoadAdjacentGalleryScene' . $id . '(-1);
3023 + wpvrLoadAdjacentGalleryScene' . $pano_suffix . '(-1);
2959 3024 } else {
2960 - wpvrLoadAdjacentGalleryScene' . $id . '(1);
3025 + wpvrLoadAdjacentGalleryScene' . $pano_suffix . '(1);
2961 3026 }
2962 3027 }, true);
2963 3028 }
2964 3029
2965 3030 jQuery(window)
2966 - .off("resize.wpvrGallery' . $id . '")
2967 - .on("resize.wpvrGallery' . $id . '", function () {
2968 - window.clearTimeout(wpvrGalleryResizeTimer' . $id . ');
2969 - wpvrGalleryResizeTimer' . $id . ' = window.setTimeout(wpvrRefreshGallery' . $id . ', 100);
3031 + .off("resize.wpvrGallery' . $pano_suffix . '")
3032 + .on("resize.wpvrGallery' . $pano_suffix . '", function () {
3033 + window.clearTimeout(wpvrGalleryResizeTimer' . $pano_suffix . ');
3034 + wpvrGalleryResizeTimer' . $pano_suffix . ' = window.setTimeout(wpvrRefreshGallery' . $pano_suffix . ', 100);
2970 3035 });
2971 3036
2972 3037 if (window.MutationObserver) {
2973 - if (wpvrGallery' . $id . '.length) {
2974 - wpvrGalleryObserver' . $id . ' = new MutationObserver(function () {
2975 - window.clearTimeout(wpvrGalleryVisibilityTimer' . $id . ');
2976 - wpvrGalleryVisibilityTimer' . $id . ' = window.setTimeout(wpvrRefreshGallery' . $id . ', 50);
3038 + if (wpvrGallery' . $pano_suffix . '.length) {
3039 + wpvrGalleryObserver' . $pano_suffix . ' = new MutationObserver(function () {
3040 + window.clearTimeout(wpvrGalleryVisibilityTimer' . $pano_suffix . ');
3041 + wpvrGalleryVisibilityTimer' . $pano_suffix . ' = window.setTimeout(wpvrRefreshGallery' . $pano_suffix . ', 50);
2977 3042 });
2978 - wpvrGalleryObserver' . $id . '.observe(wpvrGallery' . $id . '[0], {
3043 + wpvrGalleryObserver' . $pano_suffix . '.observe(wpvrGallery' . $pano_suffix . '[0], {
2979 3044 attributes: true,
2980 3045 attributeFilter: ["style"]
2981 3046 });
2982 3047 }
@@ -2981,15 +3046,15 @@
2981 3046 });
2982 3047 }
2983 3048 }
2984 3049
2985 - panoshow' . $id . '.on("scenechange", function (sceneId) {
2986 - wpvrUpdateGalleryNavigation' . $id . '(sceneId);
3050 + panoshow' . $pano_suffix . '.on("scenechange", function (sceneId) {
3051 + wpvrUpdateGalleryNavigation' . $pano_suffix . '(sceneId);
2987 3052 });
2988 3053
2989 - window.setTimeout(wpvrRefreshGallery' . $id . ', 0);
3054 + window.setTimeout(wpvrRefreshGallery' . $pano_suffix . ', 0);
2990 3055 window.setTimeout(function () {
2991 - wpvrUpdateGalleryNavigation' . $id . '(panoshow' . $id . '.getScene());
3056 + wpvrUpdateGalleryNavigation' . $pano_suffix . '(panoshow' . $pano_suffix . '.getScene());
2992 3057 }, 0);
2993 3058 ';
2994 3059 }
2995 3060 //===Custom Control===//
@@ -2994,44 +3059,44 @@
2994 3059 }
2995 3060 //===Custom Control===//
2996 3061 if (isset($custom_control)) {
2997 3062 if ($custom_control['panupSwitch'] == "on" && 'valid' == $status && $is_pro) {
2998 - $html .= 'document.getElementById("pan-up' . $id . '").addEventListener("click", function(e) {';
2999 - $html .= 'panoshow' . $id . '.setPitch(panoshow' . $id . '.getPitch() + 10);';
3063 + $html .= 'document.getElementById("pan-up' . $pano_suffix . '").addEventListener("click", function(e) {';
3064 + $html .= 'panoshow' . $pano_suffix . '.setPitch(panoshow' . $pano_suffix . '.getPitch() + 10);';
3000 3065 $html .= '});';
3001 3066 }
3002 3067 if ($custom_control['panDownSwitch'] == "on" && 'valid' == $status && $is_pro) {
3003 - $html .= 'document.getElementById("pan-down' . $id . '").addEventListener("click", function(e) {';
3004 - $html .= 'panoshow' . $id . '.setPitch(panoshow' . $id . '.getPitch() - 10);';
3068 + $html .= 'document.getElementById("pan-down' . $pano_suffix . '").addEventListener("click", function(e) {';
3069 + $html .= 'panoshow' . $pano_suffix . '.setPitch(panoshow' . $pano_suffix . '.getPitch() - 10);';
3005 3070 $html .= '});';
3006 3071 }
3007 3072 if ($custom_control['panLeftSwitch'] == "on" && 'valid' == $status && $is_pro) {
3008 - $html .= 'document.getElementById("pan-left' . $id . '").addEventListener("click", function(e) {';
3009 - $html .= 'panoshow' . $id . '.setYaw(panoshow' . $id . '.getYaw() - 10);';
3073 + $html .= 'document.getElementById("pan-left' . $pano_suffix . '").addEventListener("click", function(e) {';
3074 + $html .= 'panoshow' . $pano_suffix . '.setYaw(panoshow' . $pano_suffix . '.getYaw() - 10);';
3010 3075 $html .= '});';
3011 3076 }
3012 3077 if ($custom_control['panRightSwitch'] == "on" && 'valid' == $status && $is_pro) {
3013 - $html .= 'document.getElementById("pan-right' . $id . '").addEventListener("click", function(e) {';
3014 - $html .= 'panoshow' . $id . '.setYaw(panoshow' . $id . '.getYaw() + 10);';
3078 + $html .= 'document.getElementById("pan-right' . $pano_suffix . '").addEventListener("click", function(e) {';
3079 + $html .= 'panoshow' . $pano_suffix . '.setYaw(panoshow' . $pano_suffix . '.getYaw() + 10);';
3015 3080 $html .= '});';
3016 3081 }
3017 3082 if ($custom_control['panZoomInSwitch'] == "on") {
3018 - $html .= 'document.getElementById("zoom-in' . $id . '").addEventListener("click", function(e) {';
3019 - $html .= 'panoshow' . $id . '.setHfov(panoshow' . $id . '.getHfov() - 10);';
3083 + $html .= 'document.getElementById("zoom-in' . $pano_suffix . '").addEventListener("click", function(e) {';
3084 + $html .= 'panoshow' . $pano_suffix . '.setHfov(panoshow' . $pano_suffix . '.getHfov() - 10);';
3020 3085 $html .= '});';
3021 3086 }
3022 3087 if ($custom_control['panZoomOutSwitch'] == "on") {
3023 - $html .= 'document.getElementById("zoom-out' . $id . '").addEventListener("click", function(e) {';
3024 - $html .= 'panoshow' . $id . '.setHfov(panoshow' . $id . '.getHfov() + 10);';
3088 + $html .= 'document.getElementById("zoom-out' . $pano_suffix . '").addEventListener("click", function(e) {';
3089 + $html .= 'panoshow' . $pano_suffix . '.setHfov(panoshow' . $pano_suffix . '.getHfov() + 10);';
3025 3090 $html .= '});';
3026 3091 }
3027 3092 if ($custom_control['panFullscreenSwitch'] == "on" && 'valid' == $status && $is_pro) {
3028 - $html .= 'document.getElementById("fullscreen' . $id . '").addEventListener("click", function(e) {';
3029 - $html .= 'panoshow' . $id . '.toggleFullscreen();';
3093 + $html .= 'document.getElementById("fullscreen' . $pano_suffix . '").addEventListener("click", function(e) {';
3094 + $html .= 'panoshow' . $pano_suffix . '.toggleFullscreen();';
3030 3095 $html .= '});';
3031 3096 $html .= '(function() {';
3032 - $html .= 'function wpvrFsChange' . $id . '() {';
3033 - $html .= 'var fsIcon = document.querySelector("#fullscreen' . $id . ' i");';
3097 + $html .= 'function wpvrFsChange' . $pano_suffix . '() {';
3098 + $html .= 'var fsIcon = document.querySelector("#fullscreen' . $pano_suffix . ' i");';
3034 3099 $html .= 'if (!fsIcon) return;';
3035 3100 $html .= 'if (document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement) {';
3036 3101 $html .= 'fsIcon.classList.remove("fa-expand"); fsIcon.classList.add("fa-minimize");';
3037 3102 $html .= '} else {';
@@ -3037,23 +3102,23 @@
3037 3102 $html .= '} else {';
3038 3103 $html .= 'fsIcon.classList.remove("fa-minimize"); fsIcon.classList.add("fa-expand");';
3039 3104 $html .= '}';
3040 3105 $html .= '}';
3041 - $html .= 'document.addEventListener("fullscreenchange", wpvrFsChange' . $id . ');';
3042 - $html .= 'document.addEventListener("webkitfullscreenchange", wpvrFsChange' . $id . ');';
3043 - $html .= 'document.addEventListener("mozfullscreenchange", wpvrFsChange' . $id . ');';
3044 - $html .= 'document.addEventListener("MSFullscreenChange", wpvrFsChange' . $id . ');';
3106 + $html .= 'document.addEventListener("fullscreenchange", wpvrFsChange' . $pano_suffix . ');';
3107 + $html .= 'document.addEventListener("webkitfullscreenchange", wpvrFsChange' . $pano_suffix . ');';
3108 + $html .= 'document.addEventListener("mozfullscreenchange", wpvrFsChange' . $pano_suffix . ');';
3109 + $html .= 'document.addEventListener("MSFullscreenChange", wpvrFsChange' . $pano_suffix . ');';
3045 3110 $html .= '})();';
3046 3111 }
3047 3112 if ($custom_control['backToHomeSwitch'] == "on" && 'valid' == $status && $is_pro) {
3048 - $html .= 'document.getElementById("backToHome' . $id . '").addEventListener("click", function(e) {';
3049 - $html .= 'panoshow' . $id . '.loadScene("' . $default_scene . '");';
3113 + $html .= 'document.getElementById("backToHome' . $pano_suffix . '").addEventListener("click", function(e) {';
3114 + $html .= 'panoshow' . $pano_suffix . '.loadScene(' . wp_json_encode( (string) $default_scene ) . ');';
3050 3115 $html .= '});';
3051 3116 }
3052 3117 if ($gyro_button_enabled && 'valid' == $status && $is_pro) {
3053 3118 $html .= '
3054 3119 (function() {
3055 - var gyroButton = document.getElementById("gyroscope' . $id . '");
3120 + var gyroButton = document.getElementById("gyroscope' . $pano_suffix . '");
3056 3121 var gyroIcon = gyroButton ? gyroButton.querySelector("i") : null;
3057 3122 var activeColor = ' . wp_json_encode($custom_control['gyroscopeColor']) . ';
3058 3123 var permissionGranted = false;
3059 3124
@@ -3061,20 +3126,20 @@
3061 3126 return;
3062 3127 }
3063 3128
3064 3129 function updateGyroscopeState() {
3065 - gyroIcon.style.color = panoshow' . $id . '.isOrientationActive()
3130 + gyroIcon.style.color = panoshow' . $pano_suffix . '.isOrientationActive()
3066 3131 ? activeColor
3067 3132 : "red";
3068 3133 }
3069 3134
3070 3135 function startGyroscope() {
3071 - if (!panoshow' . $id . '.isOrientationSupported()) {
3136 + if (!panoshow' . $pano_suffix . '.isOrientationSupported()) {
3072 3137 updateGyroscopeState();
3073 3138 return;
3074 3139 }
3075 3140
3076 - panoshow' . $id . '.startOrientation();
3141 + panoshow' . $pano_suffix . '.startOrientation();
3077 3142 window.setTimeout(updateGyroscopeState, 0);
3078 3143 }
3079 3144
3080 3145 function requestGyroscopePermission() {
@@ -3099,14 +3164,14 @@
3099 3164
3100 3165 startGyroscope();
3101 3166 }
3102 3167
3103 - panoshow' . $id . '.on("load", updateGyroscopeState);
3104 - panoshow' . $id . '.on("scenechange", updateGyroscopeState);
3168 + panoshow' . $pano_suffix . '.on("load", updateGyroscopeState);
3169 + panoshow' . $pano_suffix . '.on("scenechange", updateGyroscopeState);
3105 3170
3106 3171 gyroButton.addEventListener("click", function() {
3107 - if (panoshow' . $id . '.isOrientationActive()) {
3108 - panoshow' . $id . '.stopOrientation();
3172 + if (panoshow' . $pano_suffix . '.isOrientationActive()) {
3173 + panoshow' . $pano_suffix . '.stopOrientation();
3109 3174 updateGyroscopeState();
3110 3175 return;
3111 3176 }
3112 3177
@@ -3121,15 +3186,15 @@
3121 3186
3122 3187 //===Explainer Script===//
3123 3188
3124 3189 if ($autoplay_bg_music == 'on') {
3125 - $html .= 'jQuery(document).on("click","#explainer_button_' . $id . '",function() {
3126 - jQuery("#explainer' . $id . '").slideToggle();
3127 - playing' . $id . ' = false;
3128 - var x' . $id . ' = document.getElementById("vrAudio' . $id . '");
3129 - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up");
3130 - jQuery("#vr-volume' . $id . '").addClass("fas fa-volume-mute");
3131 - x' . $id . '.pause();
3190 + $html .= 'jQuery(document).on("click","#explainer_button_' . $pano_suffix . '",function() {
3191 + jQuery("#explainer' . $pano_suffix . '").slideToggle();
3192 + playing' . $pano_suffix . ' = false;
3193 + var x' . $pano_suffix . ' = document.getElementById("vrAudio' . $pano_suffix . '");
3194 + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-up");
3195 + jQuery("#vr-volume' . $pano_suffix . '").addClass("fas fa-volume-mute");
3196 + x' . $pano_suffix . '.pause();
3132 3197 });
3133 3198 jQuery(document).on("click",".close-explainer-video",function() {
3134 3199 jQuery(this).parent(".explainer").hide();
3135 3200 var el_src = jQuery(".vr-iframe").attr("src");
@@ -3135,11 +3200,11 @@
3135 3200 var el_src = jQuery(".vr-iframe").attr("src");
3136 3201 jQuery(".vr-iframe").attr("src", el_src);
3137 3202 });';
3138 3203 } else {
3139 - $html .= 'jQuery(document).on("click","#explainer_button_' . $id . '",function() {
3140 - jQuery("#explainer' . $id . '").slideToggle(function(){
3141 - var $explainerVideoId = jQuery("#explainer' . $id . '");
3204 + $html .= 'jQuery(document).on("click","#explainer_button_' . $pano_suffix . '",function() {
3205 + jQuery("#explainer' . $pano_suffix . '").slideToggle(function(){
3206 + var $explainerVideoId = jQuery("#explainer' . $pano_suffix . '");
3142 3207 var $explainerVideoIframe = $explainerVideoId.find("iframe");
3143 3208 var explainerVideoIframSrc = $explainerVideoIframe.attr("src");
3144 3209 $explainerVideoIframe.attr("src", "");
3145 3210 $explainerVideoIframe.attr("src", explainerVideoIframSrc);
@@ -3155,12 +3220,16 @@
3155 3220 });';
3156 3221 }
3157 3222
3158 3223 $html .= '
3159 - jQuery(document).on("click","#pano' . $id . '",function(event) {
3224 + jQuery(document).on("click","#' . $panoid . '",function(event) {
3225 + var isCross = event.target.closest(".cross");
3160 3226 var isActiveModal = event.target.closest(".custom-ifram-wrapper");
3161 - var isForm = event.target.closest(".wpvr-hotspot-tweak-contents");
3227 + var isForm = event.target.closest(".wpvr-hotspot-tweak-contents-wrapper");
3162 3228 var isHotspot = event.target.closest(".pnlm-hotspot-base");
3229 + if(isCross != null){
3230 + return;
3231 + }
3163 3232 if(isForm != null){
3164 3233 jQuery(this).addClass("show-modal");
3165 3234 }else if(isActiveModal == null){
3166 3235 if(isHotspot == null){
@@ -3166,9 +3235,9 @@
3166 3235 if(isHotspot == null){
3167 3236 jQuery(".custom-ifram-wrapper .custom-ifram").empty();
3168 3237 jQuery(".custom-ifram-wrapper").hide();
3169 3238 jQuery(this).removeClass("show-modal");
3170 - jQuery(".wpvr-hotspot-tweak-contents-wrapper").hide("show-modal");
3239 + jQuery(".wpvr-hotspot-tweak-contents-wrapper").hide();
3171 3240 }
3172 3241 }
3173 3242 });';
3174 3243
@@ -3176,10 +3245,10 @@
3176 3245
3177 3246 //===generic form script===//
3178 3247 if (isset($postdata["genericform"]) && $postdata["genericform"] === 'on') {
3179 3248 $html .= '
3180 - jQuery(document).on("click","#generic_form_button_' . $id . '",function() {
3181 - jQuery("#wpvr-generic-form' . $id . '").fadeToggle();
3249 + jQuery(document).on("click","#generic_form_button_' . $pano_suffix . '",function() {
3250 + jQuery("#wpvr-generic-form' . $pano_suffix . '").fadeToggle();
3182 3251 });
3183 3252
3184 3253 jQuery(document).on("click",".close-generic-form",function() {
3185 3254 jQuery(this).parent(".wpvr-generic-form").fadeOut()
@@ -3188,12 +3257,12 @@
3188 3257 }
3189 3258 //===generic from script===//
3190 3259
3191 3260 //===Floor map Script===//
3192 - $html .= 'jQuery(document).on("click","#floor_map_button_' . $id . '",function() {
3193 - jQuery("#wpvr-floor-map' . $id . '").toggle().removeClass("fullwindow");
3261 + $html .= 'jQuery(document).on("click","#floor_map_button_' . $pano_suffix . '",function() {
3262 + jQuery("#wpvr-floor-map' . $pano_suffix . '").toggle().removeClass("fullwindow");
3194 3263 });
3195 - jQuery(document).on("dblclick","#wpvr-floor-map' . $id . '",function(){
3264 + jQuery(document).on("dblclick","#wpvr-floor-map' . $pano_suffix . '",function(){
3196 3265 jQuery(this).addClass("fullwindow");
3197 3266 jQuery(this).parents(".pano-wrap").addClass("show-modal");
3198 3267 });
3199 3268 jQuery(document).on("click",".close-floor-map-plan",function() {
@@ -3206,24 +3275,24 @@
3206 3275 if ($vrgallery_display) {
3207 3276
3208 3277 if (!$autoload) {
3209 3278 $html .= 'jQuery(document).ready(function($){
3210 - jQuery("#sccontrols' . $id . '").hide();
3211 - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
3212 - jQuery("#sccontrols' . $id . '").hide();
3213 - jQuery("#pano' . $id . ' .wpvr_slider_nav").hide();
3279 + jQuery("#sccontrols' . $pano_suffix . '").hide();
3280 + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
3281 + jQuery("#sccontrols' . $pano_suffix . '").hide();
3282 + jQuery("#' . $panoid . ' .wpvr_slider_nav").hide();
3214 3283 });';
3215 - $html .= 'var slide' . $id . ' = "down";
3216 - jQuery(document).on("click","#vrgcontrols' . $id . '",function() {
3217 - if (slide' . $id . ' == "up") {
3218 - jQuery(".vrgctrl' . $id . '").empty();
3219 - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
3220 - slide' . $id . ' = "down";
3221 - jQuery("#pano' . $id . ' .wpvr_slider_nav").slideToggle();
3222 - jQuery("#sccontrols' . $id . '").slideToggle(function(){
3284 + $html .= 'var slide' . $pano_suffix . ' = "down";
3285 + jQuery(document).on("click","#vrgcontrols' . $pano_suffix . '",function() {
3286 + if (slide' . $pano_suffix . ' == "up") {
3287 + jQuery(".vrgctrl' . $pano_suffix . '").empty();
3288 + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
3289 + slide' . $pano_suffix . ' = "down";
3290 + jQuery("#' . $panoid . ' .wpvr_slider_nav").slideToggle();
3291 + jQuery("#sccontrols' . $pano_suffix . '").slideToggle(function(){
3223 3292 if (jQuery(".elementor-edit-mode .elementor-widget-container").length) {
3224 3293 if (jQuery(this).is(":visible")) {
3225 - jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({
3294 + jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({
3226 3295 "display": "flex",
3227 3296 "justify-content": "center",
3228 3297 "align-items": "center",
3229 3298 "gap": "15px"
@@ -3231,9 +3300,9 @@
3231 3300 }
3232 3301 }
3233 3302 if (jQuery(".bricks-is-frontend").length) {
3234 3303 if (jQuery(this).is(":visible")) {
3235 - jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({
3304 + jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({
3236 3305 "display": "flex",
3237 3306 "justify-content": "center",
3238 3307 "align-items": "center"
3239 3308 });
@@ -3241,16 +3310,16 @@
3241 3310 }
3242 3311 });
3243 3312 }
3244 3313 else {
3245 - jQuery(".vrgctrl' . $id . '").empty();
3246 - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . ');
3247 - slide' . $id . ' = "up";
3248 - jQuery("#pano' . $id . ' .wpvr_slider_nav").slideToggle();
3249 - jQuery("#sccontrols' . $id . '").slideToggle(function(){
3314 + jQuery(".vrgctrl' . $pano_suffix . '").empty();
3315 + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_down . $sin_qout . ');
3316 + slide' . $pano_suffix . ' = "up";
3317 + jQuery("#' . $panoid . ' .wpvr_slider_nav").slideToggle();
3318 + jQuery("#sccontrols' . $pano_suffix . '").slideToggle(function(){
3250 3319 if (jQuery(".elementor-edit-mode .elementor-widget-container").length) {
3251 3320 if (jQuery(this).is(":visible")) {
3252 - jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({
3321 + jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({
3253 3322 "display": "flex",
3254 3323 "justify-content": "center",
3255 3324 "align-items": "center",
3256 3325 "gap": "15px"
@@ -3258,9 +3327,9 @@
3258 3327 }
3259 3328 }
3260 3329 if (jQuery(".bricks-is-frontend").length) {
3261 3330 if (jQuery(this).is(":visible")) {
3262 - jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({
3331 + jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({
3263 3332 "display": "flex",
3264 3333 "justify-content": "center",
3265 3334 "align-items": "center"
3266 3335 });
@@ -3270,28 +3339,28 @@
3270 3339 }
3271 3340 });';
3272 3341 } else {
3273 3342 $html .= 'jQuery(document).ready(function($){
3274 - jQuery("#sccontrols' . $id . '").show();
3275 - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . ');
3276 - jQuery("#pano' . $id . ' .wpvr_slider_nav").show();
3343 + jQuery("#sccontrols' . $pano_suffix . '").show();
3344 + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_down . $sin_qout . ');
3345 + jQuery("#' . $panoid . ' .wpvr_slider_nav").show();
3277 3346 });';
3278 - $html .= 'var slide' . $id . ' = "down";
3279 - jQuery(document).on("click","#vrgcontrols' . $id . '",function() {
3280 - if (slide' . $id . ' == "up") {
3281 - jQuery(".vrgctrl' . $id . '").empty();
3282 - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . ');
3283 - slide' . $id . ' = "down";
3347 + $html .= 'var slide' . $pano_suffix . ' = "down";
3348 + jQuery(document).on("click","#vrgcontrols' . $pano_suffix . '",function() {
3349 + if (slide' . $pano_suffix . ' == "up") {
3350 + jQuery(".vrgctrl' . $pano_suffix . '").empty();
3351 + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_down . $sin_qout . ');
3352 + slide' . $pano_suffix . ' = "down";
3284 3353 } else {
3285 - jQuery(".vrgctrl' . $id . '").empty();
3286 - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
3287 - slide' . $id . ' = "up";
3354 + jQuery(".vrgctrl' . $pano_suffix . '").empty();
3355 + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
3356 + slide' . $pano_suffix . ' = "up";
3288 3357 }
3289 - jQuery("#pano' . $id . ' .wpvr_slider_nav").slideToggle();
3290 - jQuery("#sccontrols' . $id . '").slideToggle(function(){
3358 + jQuery("#' . $panoid . ' .wpvr_slider_nav").slideToggle();
3359 + jQuery("#sccontrols' . $pano_suffix . '").slideToggle(function(){
3291 3360 if (jQuery(".elementor-edit-mode .elementor-widget-container").length) {
3292 3361 if (jQuery(this).is(":visible")) {
3293 - jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({
3362 + jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({
3294 3363 "display": "flex",
3295 3364 "justify-content": "center",
3296 3365 "align-items": "center",
3297 3366 "gap": "15px"
@@ -3299,9 +3368,9 @@
3299 3368 }
3300 3369 }
3301 3370 if (jQuery(".bricks-is-frontend").length) {
3302 3371 if (jQuery(this).is(":visible")) {
3303 - jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({
3372 + jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({
3304 3373 "display": "flex",
3305 3374 "justify-content": "center",
3306 3375 "align-items": "center"
3307 3376 });
@@ -3311,29 +3380,29 @@
3311 3380 });';
3312 3381 }
3313 3382 } else {
3314 3383 $html .= 'jQuery(document).ready(function($){
3315 - jQuery("#sccontrols' . $id . '").hide();
3316 - jQuery("#pano' . $id . ' .wpvr_slider_nav").hide();
3317 - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
3384 + jQuery("#sccontrols' . $pano_suffix . '").hide();
3385 + jQuery("#' . $panoid . ' .wpvr_slider_nav").hide();
3386 + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
3318 3387 });';
3319 - $html .= 'var slide' . $id . ' = "down";
3320 - jQuery(document).on("click","#vrgcontrols' . $id . '",function() {
3321 - if (slide' . $id . ' == "up") {
3322 - jQuery(".vrgctrl' . $id . '").empty();
3323 - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
3324 - slide' . $id . ' = "down";
3388 + $html .= 'var slide' . $pano_suffix . ' = "down";
3389 + jQuery(document).on("click","#vrgcontrols' . $pano_suffix . '",function() {
3390 + if (slide' . $pano_suffix . ' == "up") {
3391 + jQuery(".vrgctrl' . $pano_suffix . '").empty();
3392 + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
3393 + slide' . $pano_suffix . ' = "down";
3325 3394 }
3326 3395 else {
3327 - jQuery(".vrgctrl' . $id . '").empty();
3328 - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . ');
3329 - slide' . $id . ' = "up";
3396 + jQuery(".vrgctrl' . $pano_suffix . '").empty();
3397 + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_down . $sin_qout . ');
3398 + slide' . $pano_suffix . ' = "up";
3330 3399 }
3331 - jQuery("#pano' . $id . ' .wpvr_slider_nav").slideToggle();
3332 - jQuery("#sccontrols' . $id . '").slideToggle(function(){
3400 + jQuery("#' . $panoid . ' .wpvr_slider_nav").slideToggle();
3401 + jQuery("#sccontrols' . $pano_suffix . '").slideToggle(function(){
3333 3402 if (jQuery(".elementor-edit-mode .elementor-widget-container").length) {
3334 3403 if (jQuery(this).is(":visible")) {
3335 - jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({
3404 + jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({
3336 3405 "display": "flex",
3337 3406 "justify-content": "center",
3338 3407 "align-items": "center",
3339 3408 "gap": "15px"
@@ -3341,9 +3410,9 @@
3341 3410 }
3342 3411 }
3343 3412 if (jQuery(".bricks-is-frontend").length) {
3344 3413 if (jQuery(this).is(":visible")) {
3345 - jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({
3414 + jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({
3346 3415 "display": "flex",
3347 3416 "justify-content": "center",
3348 3417 "align-items": "center"
3349 3418 });
@@ -3353,33 +3422,33 @@
3353 3422 });';
3354 3423 }
3355 3424 if (!$autoload) {
3356 3425 $html .= 'jQuery(document).ready(function(){
3357 - jQuery("#controls' . $id . '").hide();
3358 - jQuery("#zoom-in-out-controls' . $id . '").hide();
3359 - jQuery("#adcontrol' . $id . '").hide();
3360 - jQuery("#explainer_button_' . $id . '").hide();
3361 - jQuery("#generic_form_button_' . $id . '").hide();
3362 - jQuery("#floor_map_button_' . $id . '").hide();
3363 - jQuery("#vrgcontrols' . $id . '").hide();
3426 + jQuery("#controls' . $pano_suffix . '").hide();
3427 + jQuery("#zoom-in-out-controls' . $pano_suffix . '").hide();
3428 + jQuery("#adcontrol' . $pano_suffix . '").hide();
3429 + jQuery("#explainer_button_' . $pano_suffix . '").hide();
3430 + jQuery("#generic_form_button_' . $pano_suffix . '").hide();
3431 + jQuery("#floor_map_button_' . $pano_suffix . '").hide();
3432 + jQuery("#vrgcontrols' . $pano_suffix . '").hide();
3364 3433 jQuery("#cp-logo-controls").hide();
3365 3434 jQuery(".custom-scene-navigation").hide();
3366 - jQuery("#pano' . $id . '").find(".pnlm-panorama-info").hide();
3435 + jQuery("#' . $panoid . '").find(".pnlm-panorama-info").hide();
3367 3436 });';
3368 3437 if ($vrgallery_display) {
3369 - $html .= 'var load_once = "true";';
3370 - $html .= 'panoshow' . $id . '.on("load", function (){
3371 - if (load_once == "true") {
3372 - load_once = "false";
3373 - jQuery("#sccontrols' . $id . '").slideToggle(function(){
3438 + $html .= 'var load_once' . $pano_suffix . ' = "true";';
3439 + $html .= 'panoshow' . $pano_suffix . '.on("load", function (){
3440 + if (load_once' . $pano_suffix . ' == "true") {
3441 + load_once' . $pano_suffix . ' = "false";
3442 + jQuery("#sccontrols' . $pano_suffix . '").slideToggle(function(){
3374 3443 if (jQuery(".elementor-edit-mode .elementor-widget-container").length) {
3375 3444 if (jQuery(this).is(":visible")) {
3376 - jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css("display", "flex");
3445 + jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css("display", "flex");
3377 3446 }
3378 3447 }
3379 3448 if (jQuery(".bricks-is-frontend").length) {
3380 3449 if (jQuery(this).is(":visible")) {
3381 - jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({
3450 + jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({
3382 3451 "display": "flex",
3383 3452 "justify-content": "center",
3384 3453 "align-items": "center"
3385 3454 });
@@ -3385,23 +3454,23 @@
3385 3454 });
3386 3455 }
3387 3456 }
3388 3457 });
3389 - jQuery("#pano' . $id . ' .wpvr_slider_nav").slideToggle();
3458 + jQuery("#' . $panoid . ' .wpvr_slider_nav").slideToggle();
3390 3459 }
3391 3460 });';
3392 3461 }
3393 - $html .= 'panoshow' . $id . '.on("load", function (){
3394 - jQuery("#controls' . $id . '").show();
3395 - jQuery("#zoom-in-out-controls' . $id . '").show();
3396 - jQuery("#adcontrol' . $id . '").show();
3397 - jQuery("#explainer_button_' . $id . '").show();
3398 - jQuery("#generic_form_button_' . $id . '").show();
3399 - jQuery("#floor_map_button_' . $id . '").show();
3400 - jQuery("#vrgcontrols' . $id . '").show();
3462 + $html .= 'panoshow' . $pano_suffix . '.on("load", function (){
3463 + jQuery("#controls' . $pano_suffix . '").show();
3464 + jQuery("#zoom-in-out-controls' . $pano_suffix . '").show();
3465 + jQuery("#adcontrol' . $pano_suffix . '").show();
3466 + jQuery("#explainer_button_' . $pano_suffix . '").show();
3467 + jQuery("#generic_form_button_' . $pano_suffix . '").show();
3468 + jQuery("#floor_map_button_' . $pano_suffix . '").show();
3469 + jQuery("#vrgcontrols' . $pano_suffix . '").show();
3401 3470 jQuery("#cp-logo-controls").show();
3402 3471 jQuery(".custom-scene-navigation").show();
3403 - jQuery("#pano' . $id . '").find(".pnlm-panorama-info").show();
3472 + jQuery("#' . $panoid . '").find(".pnlm-panorama-info").show();
3404 3473 });';
3405 3474 }
3406 3475
3407 3476 //==Old code working properly==//
@@ -3415,31 +3484,29 @@
3415 3484 var pano_id;
3416 3485 var element_id = this.id;
3417 3486 element_id = element_id.split("-");
3418 3487 element_id = element_id[3];
3419 - jQuery("#elementor-tab-content-"+element_id).find("#master-container").children("div").eq(1).addClass("awwww");
3488 + jQuery("#elementor-tab-content-"+element_id).find("#' . $master_container_id . '").children("div").eq(1).addClass("awwww");
3420 3489 var pano_id = jQuery(".awwww").attr("id");
3421 - jQuery("#elementor-tab-content-"+element_id).find("#master-container").children("div").eq(1).removeClass("awwww");;
3490 + jQuery("#elementor-tab-content-"+element_id).find("#' . $master_container_id . '").children("div").eq(1).removeClass("awwww");;
3422 3491 if (pano_id != undefined) {
3423 - pano_id = pano_id.split("o");
3424 - pano_id = pano_id[1];
3425 - if (pano_id == "' . $id . '") {
3426 - jQuery("#pano' . $id . '").children(".pnlm-render-container").remove();
3427 - jQuery("#pano' . $id . '").children(".pnlm-ui").remove();
3428 - panoshow' . $id . ' = pannellum.viewer(response[0]["panoid"], scenes);
3492 + if (pano_id == "' . $panoid . '") {
3493 + jQuery("#' . $panoid . '").children(".pnlm-render-container").remove();
3494 + jQuery("#' . $panoid . '").children(".pnlm-ui").remove();
3495 + panoshow' . $pano_suffix . ' = pannellum.viewer(response[0]["panoid"], scenes);
3429 3496 window.wpvrViewers = window.wpvrViewers || {};
3430 - window.wpvrViewers[response[0]["panoid"]] = panoshow' . $id . ';
3497 + window.wpvrViewers[response[0]["panoid"]] = panoshow' . $pano_suffix . ';
3431 3498 document.dispatchEvent(new CustomEvent("wpvr:viewer-ready", {
3432 - detail: { containerId: response[0]["panoid"], viewer: panoshow' . $id . ' }
3499 + detail: { containerId: response[0]["panoid"], viewer: panoshow' . $pano_suffix . ' }
3433 3500 }));
3434 - jQuery("#pano' . $id . '").children(".pnlm-ui").find(".pnlm-load-button p").text("' . $previeword . '")
3501 + jQuery("#' . $panoid . '").children(".pnlm-ui").find(".pnlm-load-button p").text(' . wp_json_encode( (string) $previeword ) . ')
3435 3502 setTimeout(function() {
3436 - // panoshow' . $id . '.loadScene("' . $default_scene . '");
3503 + // panoshow' . $pano_suffix . '.loadScene("' . $default_scene . '");
3437 3504 window.dispatchEvent(new Event("resize"));
3438 - if (jQuery("#pano' . $id . '").children().children(".pnlm-panorama-info:visible").length > 0) {
3439 - jQuery("#controls' . $id . '").css("bottom", "55px");
3505 + if (jQuery("#' . $panoid . '").children().children(".pnlm-panorama-info:visible").length > 0) {
3506 + jQuery("#controls' . $pano_suffix . '").css("bottom", "55px");
3440 3507 } else {
3441 - jQuery("#controls' . $id . '").css("bottom", "5px");
3508 + jQuery("#controls' . $pano_suffix . '").css("bottom", "5px");
3442 3509 }
3443 3510 }, 200);
3444 3511 }
3445 3512 }
@@ -3444,30 +3511,30 @@
3444 3511 }
3445 3512 }
3446 3513 });';
3447 3514 $html .= 'jQuery(".geodir-tab-head dd, #vr-tour-tab").click(function(){
3448 - jQuery("#pano' . $id . '").children(".pnlm-render-container").remove();
3449 - jQuery("#pano' . $id . '").children(".pnlm-ui").remove();
3450 - panoshow' . $id . ' = pannellum.viewer(response[0]["panoid"], scenes);
3515 + jQuery("#' . $panoid . '").children(".pnlm-render-container").remove();
3516 + jQuery("#' . $panoid . '").children(".pnlm-ui").remove();
3517 + panoshow' . $pano_suffix . ' = pannellum.viewer(response[0]["panoid"], scenes);
3451 3518 window.wpvrViewers = window.wpvrViewers || {};
3452 - window.wpvrViewers[response[0]["panoid"]] = panoshow' . $id . ';
3519 + window.wpvrViewers[response[0]["panoid"]] = panoshow' . $pano_suffix . ';
3453 3520 document.dispatchEvent(new CustomEvent("wpvr:viewer-ready", {
3454 - detail: { containerId: response[0]["panoid"], viewer: panoshow' . $id . ' }
3521 + detail: { containerId: response[0]["panoid"], viewer: panoshow' . $pano_suffix . ' }
3455 3522 }));
3456 3523 setTimeout(function() {
3457 - panoshow' . $id . '.loadScene("' . $default_scene . '");
3524 + panoshow' . $pano_suffix . '.loadScene(' . wp_json_encode( (string) $default_scene ) . ');
3458 3525 window.dispatchEvent(new Event("resize"));
3459 - if (jQuery("#pano' . $id . '").children().children(".pnlm-panorama-info:visible").length > 0) {
3460 - jQuery("#controls' . $id . '").css("bottom", "55px");
3526 + if (jQuery("#' . $panoid . '").children().children(".pnlm-panorama-info:visible").length > 0) {
3527 + jQuery("#controls' . $pano_suffix . '").css("bottom", "55px");
3461 3528 }
3462 3529 else {
3463 - jQuery("#controls' . $id . '").css("bottom", "5px");
3530 + jQuery("#controls' . $pano_suffix . '").css("bottom", "5px");
3464 3531 }
3465 3532 }, 200);
3466 3533 });';
3467 3534 if (isset($previeword) && $previeword != '') {
3468 3535 $html .= '
3469 - jQuery("#pano' . $id . '").children(".pnlm-ui").find(".pnlm-load-button p").text("' . $previeword . '")
3536 + jQuery("#' . $panoid . '").children(".pnlm-ui").find(".pnlm-load-button p").text(' . wp_json_encode( (string) $previeword ) . ')
3470 3537 ';
3471 3538 }
3472 3539 if ($default_global_zoom != '' || $max_global_zoom != '' || $min_global_zoom != '') {
3473 3540 $html .= 'jQuery(".globalzoom").val("on").change();';
@@ -3472,12 +3539,12 @@
3472 3539 if ($default_global_zoom != '' || $max_global_zoom != '' || $min_global_zoom != '') {
3473 3540 $html .= 'jQuery(".globalzoom").val("on").change();';
3474 3541 }
3475 3542
3476 - $html .= 'jQuery("#pano' . $id . ' .pnlm-title-box").on("mouseenter", function(){
3543 + $html .= 'jQuery("#' . $panoid . ' .pnlm-title-box").on("mouseenter", function(){
3477 3544 jQuery(this).attr("title", jQuery(this).text());
3478 3545 });
3479 - jQuery("#pano' . $id . ' .pnlm-title-box").on("mouseleave", function(){
3546 + jQuery("#' . $panoid . ' .pnlm-title-box").on("mouseleave", function(){
3480 3547 jQuery(this).removeAttr("title");
3481 3548 });';
3482 3549 $html .= '});';
3483 3550 $html .= '})(jQuery);';
@@ -3511,12 +3578,16 @@
3511 3578 private function sanitize_content_preserve_styles($content, $allow_forms = false) {
3512 3579 // Decode HTML entities first (in case content was encoded in database)
3513 3580 $content = html_entity_decode($content, ENT_QUOTES | ENT_HTML5, 'UTF-8');
3514 3581
3515 - // Escape <script> blocks to display as text instead of removing them
3516 - $content = preg_replace_callback('/<script\b[^>]*>(.*?)<\/script>/si', function($matches) {
3517 - return esc_html($matches[0]); // Convert to plain text
3518 - }, $content);
3582 + // Escape or strip <script> blocks
3583 + if ($allow_forms) {
3584 + $content = preg_replace('/<script\b[^>]*>[\s\S]*?<\/script>/i', '', $content);
3585 + } else {
3586 + $content = preg_replace_callback('/<script\b[^>]*>(.*?)<\/script>/si', function($matches) {
3587 + return esc_html($matches[0]); // Convert to plain text
3588 + }, $content);
3589 + }
3519 3590
3520 3591 // Strip dangerous URL-based attributes
3521 3592 $content = preg_replace('/(href|action|formaction)\s*=\s*["\']?\s*(javascript|vbscript|data|about):/i', '$1=""', $content);
3522 3593
@@ -3559,10 +3630,16 @@
3559 3630 $css = preg_replace('/-moz-binding\s*:/i', '', $css);
3560 3631 return '<style>' . esc_html($css) . '</style>';
3561 3632 }, $content);
3562 3633
3563 - // Allow iframes from safe sources only (e.g., YouTube, Vimeo)
3634 + // Allow iframes and styles from safe sources only
3564 3635 $allowed_tags = wp_kses_allowed_html('post');
3636 + $allowed_tags['style'] = [
3637 + 'type' => true,
3638 + 'id' => true,
3639 + 'class' => true,
3640 + 'media' => true,
3641 + ];
3565 3642 $allowed_tags['iframe'] = [
3566 3643 'src' => true,
3567 3644 'width' => true,
3568 3645 'height' => true,
@@ -3592,37 +3669,47 @@
3592 3669 ];
3593 3670
3594 3671 if ($allow_forms) {
3595 3672 $form_attributes = [
3596 - 'id' => true,
3597 - 'class' => true,
3598 - 'style' => true,
3599 - 'name' => true,
3600 - 'value' => true,
3601 - 'type' => true,
3602 - 'placeholder' => true,
3603 - 'action' => true,
3604 - 'method' => true,
3605 - 'target' => true,
3606 - 'enctype' => true,
3607 - 'disabled' => true,
3608 - 'readonly' => true,
3609 - 'required' => true,
3610 - 'checked' => true,
3611 - 'selected' => true,
3612 - 'multiple' => true,
3613 - 'size' => true,
3614 - 'rows' => true,
3615 - 'cols' => true,
3616 - 'maxlength' => true,
3617 - 'minlength' => true,
3618 - 'min' => true,
3619 - 'max' => true,
3620 - 'step' => true,
3621 - 'pattern' => true,
3622 - 'autocomplete'=> true,
3623 - 'autofocus' => true,
3624 - 'for' => true,
3673 + 'id' => true,
3674 + 'class' => true,
3675 + 'style' => true,
3676 + 'name' => true,
3677 + 'value' => true,
3678 + 'type' => true,
3679 + 'placeholder' => true,
3680 + 'action' => true,
3681 + 'method' => true,
3682 + 'target' => true,
3683 + 'enctype' => true,
3684 + 'disabled' => true,
3685 + 'readonly' => true,
3686 + 'required' => true,
3687 + 'checked' => true,
3688 + 'selected' => true,
3689 + 'multiple' => true,
3690 + 'size' => true,
3691 + 'rows' => true,
3692 + 'cols' => true,
3693 + 'maxlength' => true,
3694 + 'minlength' => true,
3695 + 'min' => true,
3696 + 'max' => true,
3697 + 'step' => true,
3698 + 'pattern' => true,
3699 + 'autocomplete' => true,
3700 + 'autofocus' => true,
3701 + 'for' => true,
3702 + 'data-*' => true,
3703 + 'data-form_id' => true,
3704 + 'data-form_instance' => true,
3705 + 'data-name' => true,
3706 + 'data-type' => true,
3707 + 'aria-invalid' => true,
3708 + 'aria-required' => true,
3709 + 'aria-label' => true,
3710 + 'aria-describedby' => true,
3711 + 'aria-labelledby' => true,
3625 3712 ];
3626 3713 $allowed_tags['form'] = $form_attributes;
3627 3714 $allowed_tags['input'] = $form_attributes;
3628 3715 $allowed_tags['button'] = $form_attributes;
@@ -3632,8 +3719,18 @@
3632 3719 $allowed_tags['optgroup'] = $form_attributes;
3633 3720 $allowed_tags['label'] = $form_attributes;
3634 3721 $allowed_tags['fieldset'] = $form_attributes;
3635 3722 $allowed_tags['legend'] = $form_attributes;
3723 + if (!isset($allowed_tags['div'])) {
3724 + $allowed_tags['div'] = [];
3725 + }
3726 + $allowed_tags['div']['data-*'] = true;
3727 + $allowed_tags['div']['data-form_id'] = true;
3728 + $allowed_tags['div']['data-form_instance'] = true;
3729 + if (!isset($allowed_tags['span'])) {
3730 + $allowed_tags['span'] = [];
3731 + }
3732 + $allowed_tags['span']['data-*'] = true;
3636 3733 }
3637 3734
3638 3735 // Apply wp_kses() to keep only allowed tags/attributes
3639 3736 $content = wp_kses($content, $allowed_tags);