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