| @@ -922,10 +922,9 @@ | ||
| 922 | 922 | } else { |
| 923 | 923 | $default_data = array("firstScene" => $default_scene, "sceneFadeDuration" => $scene_fade_duration); |
| 924 | 924 | } |
| 925 | 925 | |
| 926 | - $scene_data = array(); | |
| 927 | - $mobile_media_resize = get_option('mobile_media_resize'); | |
| 926 | + $scene_data = array(); | |
| 928 | 927 | |
| 929 | 928 | if (!empty($panodata["scene-list"])) { |
| 930 | 929 | foreach ($panodata["scene-list"] as $panoscenes) { |
| 931 | 930 | $scene_ititle = ''; |
| @@ -1139,134 +1138,41 @@ | ||
| 1139 | 1138 | } |
| 1140 | 1139 | } |
| 1141 | 1140 | $hotspot_info['URL'] = ($hotspot_data['hotspot-type'] === 'fluent_form' || $hotspot_data['hotspot-type'] === 'wc_product') ? '' : $hotspot_info['URL']; |
| 1142 | 1141 | |
| 1143 | - $is_sticker = ( ( $hotspot_data['hotspot-type'] ?? '' ) === 'sticker' ); | |
| 1144 | - if ( $is_sticker ) { | |
| 1145 | - $custom_class_pro = ! empty( $hotspot_data['hotspot-customclass'] ) && $hotspot_data['hotspot-customclass'] !== 'none' | |
| 1146 | - ? ' ' . $hotspot_data['hotspot-customclass'] | |
| 1147 | - : ''; | |
| 1148 | - $hotspot_info['cssClass'] = 'wpvr-hs-custom wpvr-hs-sticker' . $custom_class_pro; | |
| 1149 | - $hotspot_info['scale'] = true; | |
| 1150 | - $hotspot_info['stickerTemplate'] = $hotspot_data['hotspot-sticker-template'] ?? 'social_proof'; | |
| 1151 | - $hotspot_info['stickerReviewText'] = $hotspot_data['hotspot-sticker-review-text'] ?? 'The support is super responsive and responds without worries to our requests and needs! Big up to the entire RexTheme team!'; | |
| 1152 | - $hotspot_info['stickerClientName'] = $hotspot_data['hotspot-sticker-client-name'] ?? 'Elena R.'; | |
| 1153 | - $hotspot_info['stickerClientAvatar'] = $hotspot_data['hotspot-sticker-client-avatar'] ?? ''; | |
| 1154 | - $hotspot_info['stickerRating'] = isset( $hotspot_data['hotspot-sticker-rating'] ) ? (int) $hotspot_data['hotspot-sticker-rating'] : 5; | |
| 1155 | - $is_separate_icon = ( $hotspot_data['hotspot-sticker-template'] ?? '' ) === 'button_with_separate_icon'; | |
| 1156 | - $is_add_to_cart = ( $hotspot_data['hotspot-sticker-template'] ?? '' ) === 'add_to_cart'; | |
| 1157 | - $is_social_share = ( $hotspot_data['hotspot-sticker-template'] ?? '' ) === 'social_share'; | |
| 1158 | - $hotspot_info['stickerBgColor'] = $hotspot_data['hotspot-sticker-bg-color'] ?? '#201b2c'; | |
| 1159 | - $hotspot_info['stickerBgOpacity'] = isset( $hotspot_data['hotspot-sticker-bg-opacity'] ) ? (float) $hotspot_data['hotspot-sticker-bg-opacity'] : ( ( $is_separate_icon || $is_add_to_cart || $is_social_share ) ? 75 : 95 ); | |
| 1160 | - $hotspot_info['stickerBlur'] = isset( $hotspot_data['hotspot-sticker-blur'] ) ? (float) $hotspot_data['hotspot-sticker-blur'] : 12; | |
| 1161 | - $hotspot_info['stickerBrightness'] = isset( $hotspot_data['hotspot-sticker-brightness'] ) ? (float) $hotspot_data['hotspot-sticker-brightness'] : 100; | |
| 1162 | - $hotspot_info['stickerTextColor'] = $hotspot_data['hotspot-sticker-text-color'] ?? '#ffffff'; | |
| 1163 | - $hotspot_info['stickerBorderColor'] = $hotspot_data['hotspot-sticker-border-color'] ?? ( ( $is_separate_icon || $is_add_to_cart || $is_social_share ) ? '#40355a' : '#3a3051' ); | |
| 1164 | - $default_radius = $is_separate_icon ? 135 : ( ( $is_add_to_cart || $is_social_share ) ? 15 : 20 ); | |
| 1165 | - $hotspot_info['stickerBorderRadius'] = $hotspot_data['hotspot-sticker-border-radius'] ?? [ | |
| 1166 | - 'topLeft' => $default_radius, | |
| 1167 | - 'topRight' => $default_radius, | |
| 1168 | - 'bottomRight' => $default_radius, | |
| 1169 | - 'bottomLeft' => $default_radius, | |
| 1170 | - ]; | |
| 1171 | - $hotspot_info['stickerPadding'] = $hotspot_data['hotspot-sticker-padding'] ?? [ | |
| 1172 | - 'top' => 21, | |
| 1173 | - 'right' => 21, | |
| 1174 | - 'bottom' => 21, | |
| 1175 | - 'left' => 21, | |
| 1176 | - ]; | |
| 1177 | - $hotspot_info['stickerStarColor'] = $hotspot_data['hotspot-sticker-star-color'] ?? '#EF991F'; | |
| 1178 | - // Text before button (for add_to_cart) | |
| 1179 | - $hotspot_info['stickerPrefixText'] = $hotspot_data['hotspot-sticker-prefix-text'] ?? '$1,090 -'; | |
| 1180 | - $hotspot_info['stickerSubText'] = $hotspot_data['hotspot-sticker-sub-text'] ?? 'Ready to ship'; | |
| 1181 | - // Discount button, add to cart & social share sticker fields | |
| 1182 | - $hotspot_info['stickerBtnText'] = $hotspot_data['hotspot-sticker-btn-text'] ?? ( $is_social_share ? 'SHARE EXPERIENCE' : ( $is_add_to_cart ? 'ADD TO CART' : ( $is_separate_icon ? 'Limited “Midnight Horizon” Edition' : 'GET 20% OFF NOW' ) ) ); | |
| 1183 | - $hotspot_info['stickerBtnColor'] = $hotspot_data['hotspot-sticker-btn-color'] ?? ( $is_social_share ? '#201a2b' : ( $is_add_to_cart ? '#3f04fe' : ( $is_separate_icon ? '#ffffff' : '#EF991F' ) ) ); | |
| 1184 | - $hotspot_info['stickerBtnTextColor'] = $hotspot_data['hotspot-sticker-btn-text-color'] ?? ( ( $is_add_to_cart || $is_social_share ) ? '#ffffff' : '#000000' ); | |
| 1185 | - $hotspot_info['stickerBtnIconColor'] = $hotspot_data['hotspot-sticker-btn-icon-color'] ?? '#000000'; | |
| 1186 | - $hotspot_info['stickerBtnUrl'] = $hotspot_data['hotspot-sticker-btn-url'] ?? ''; | |
| 1187 | - $hotspot_info['stickerBtnNewTab'] = $hotspot_data['hotspot-sticker-btn-new-tab'] ?? 'off'; | |
| 1188 | - $hotspot_info['stickerMainBg'] = $hotspot_data['hotspot-sticker-main-bg'] ?? ( $hotspot_data['hotspot-sticker-card-bg'] ?? 'on' ); | |
| 1189 | - $hotspot_info['stickerCardBg'] = $hotspot_info['stickerMainBg']; | |
| 1190 | - $hotspot_info['stickerBtnBg'] = $hotspot_data['hotspot-sticker-btn-bg'] ?? 'on'; | |
| 1191 | - $hotspot_info['stickerBtnWidth'] = isset( $hotspot_data['hotspot-sticker-btn-width'] ) && $hotspot_data['hotspot-sticker-btn-width'] !== '' ? $hotspot_data['hotspot-sticker-btn-width'] : ( $is_social_share ? 222 : ( $is_add_to_cart ? 163 : ( $is_separate_icon ? 356 : '' ) ) ); | |
| 1192 | - $hotspot_info['stickerBtnHeight'] = isset( $hotspot_data['hotspot-sticker-btn-height'] ) && $hotspot_data['hotspot-sticker-btn-height'] !== '' ? $hotspot_data['hotspot-sticker-btn-height'] : ( ( $is_social_share || $is_add_to_cart || $is_separate_icon ) ? 60 : '' ); | |
| 1193 | - $hotspot_info['stickerBtnRadius'] = isset( $hotspot_data['hotspot-sticker-btn-radius'] ) && $hotspot_data['hotspot-sticker-btn-radius'] !== '' ? (float) $hotspot_data['hotspot-sticker-btn-radius'] : ( $is_separate_icon ? 30 : 10 ); | |
| 1194 | - $hotspot_info['stickerBtnBorder'] = isset( $hotspot_data['hotspot-sticker-btn-border'] ) && $hotspot_data['hotspot-sticker-btn-border'] !== '' ? (float) $hotspot_data['hotspot-sticker-btn-border'] : ( $is_social_share ? 1 : 0 ); | |
| 1195 | - $hotspot_info['stickerBtnBorderColor'] = $hotspot_data['hotspot-sticker-btn-border-color'] ?? ( $is_social_share ? '#3a3051' : ( ( $is_add_to_cart || $is_separate_icon ) ? '#ffffff' : '#EF991F' ) ); | |
| 1196 | - $hotspot_info['stickerBtnTextSize'] = isset( $hotspot_data['hotspot-sticker-btn-text-size'] ) && $hotspot_data['hotspot-sticker-btn-text-size'] !== '' ? (float) $hotspot_data['hotspot-sticker-btn-text-size'] : 18; | |
| 1197 | - $hotspot_info['stickerBtnTextWeight'] = $hotspot_data['hotspot-sticker-btn-text-weight'] ?? ( ( $is_social_share || $is_add_to_cart || $is_separate_icon ) ? '600' : '700' ); | |
| 1198 | - $hotspot_info['stickerBtnIcon'] = ( $is_add_to_cart || $is_social_share ) ? 'none' : ( $hotspot_data['hotspot-sticker-btn-icon'] ?? 'fas fa-tag' ); | |
| 1199 | - // Button with separate icon fields | |
| 1200 | - $hotspot_info['stickerIconBoxBgColor'] = $hotspot_data['hotspot-sticker-icon-box-bg-color'] ?? '#ffffff'; | |
| 1201 | - $hotspot_info['stickerIconBoxRadius'] = isset( $hotspot_data['hotspot-sticker-icon-box-radius'] ) && $hotspot_data['hotspot-sticker-icon-box-radius'] !== '' ? (float) $hotspot_data['hotspot-sticker-icon-box-radius'] : 30; | |
| 1202 | - $hotspot_info['stickerIconBoxBorder'] = isset( $hotspot_data['hotspot-sticker-icon-box-border'] ) && $hotspot_data['hotspot-sticker-icon-box-border'] !== '' ? (float) $hotspot_data['hotspot-sticker-icon-box-border'] : 0; | |
| 1203 | - $hotspot_info['stickerIconBoxBorderColor'] = $hotspot_data['hotspot-sticker-icon-box-border-color'] ?? '#ffffff'; | |
| 1204 | - $hotspot_info['stickerIconBoxSize'] = isset( $hotspot_data['hotspot-sticker-icon-box-size'] ) && $hotspot_data['hotspot-sticker-icon-box-size'] !== '' ? (float) $hotspot_data['hotspot-sticker-icon-box-size'] : 60; | |
| 1205 | - // Social share sticker fields | |
| 1206 | - $hotspot_info['stickerSocialColor'] = $hotspot_data['hotspot-sticker-social-color'] ?? '#ffffff'; | |
| 1207 | - $hotspot_info['stickerSocialSize'] = isset( $hotspot_data['hotspot-sticker-social-size'] ) && $hotspot_data['hotspot-sticker-social-size'] !== '' ? (float) $hotspot_data['hotspot-sticker-social-size'] : 20; | |
| 1208 | - $hotspot_info['stickerSocialGap'] = isset( $hotspot_data['hotspot-sticker-social-gap'] ) && $hotspot_data['hotspot-sticker-social-gap'] !== '' ? (float) $hotspot_data['hotspot-sticker-social-gap'] : 16; | |
| 1209 | - $hotspot_info['stickerSocialLinks'] = isset( $hotspot_data['hotspot-sticker-social-links'] ) ? ( is_array( $hotspot_data['hotspot-sticker-social-links'] ) ? $hotspot_data['hotspot-sticker-social-links'] : json_decode( (string) $hotspot_data['hotspot-sticker-social-links'], true ) ) : [ | |
| 1210 | - [ 'id' => '1', 'icon' => 'fab fa-linkedin-in', 'customSvg' => '', 'url' => 'https://linkedin.com', 'openNewTab' => 'on' ], | |
| 1211 | - [ 'id' => '2', 'icon' => 'fab fa-facebook-f', 'customSvg' => '', 'url' => 'https://facebook.com', 'openNewTab' => 'on' ], | |
| 1212 | - [ 'id' => '3', 'icon' => 'fab fa-instagram', 'customSvg' => '', 'url' => 'https://instagram.com', 'openNewTab' => 'on' ], | |
| 1213 | - [ 'id' => '4', 'icon' => 'fab fa-dribbble', 'customSvg' => '', 'url' => 'https://dribbble.com', 'openNewTab' => 'on' ], | |
| 1214 | - ]; | |
| 1215 | - $hotspot_info['stickerShowPlaceholderText'] = $hotspot_data['hotspot-sticker-show-placeholder-text'] ?? 'on'; | |
| 1216 | - } else { | |
| 1217 | - if ( isset( $hotspot_data['hotspot-scale'] ) && ( $hotspot_data['hotspot-scale'] === 'on' || $hotspot_data['hotspot-scale'] === true ) ) { | |
| 1218 | - $hotspot_info['scale'] = true; | |
| 1219 | - } | |
| 1220 | - if ($hotspot_data["hotspot-customclass"] == 'none' || $hotspot_data["hotspot-customclass"] == '') { | |
| 1221 | - unset($hotspot_info["cssClass"]); | |
| 1222 | - } | |
| 1142 | + if ($hotspot_data["hotspot-customclass"] == 'none' || $hotspot_data["hotspot-customclass"] == '') { | |
| 1143 | + unset($hotspot_info["cssClass"]); | |
| 1223 | 1144 | } |
| 1224 | 1145 | array_push($hotspots, $hotspot_info); |
| 1225 | 1146 | } |
| 1226 | 1147 | |
| 1227 | - $device_scene = $panoscenes['scene-attachment-url']; | |
| 1228 | - $mobile_scene_url = ''; | |
| 1229 | - $desktop_scene_url = $device_scene; | |
| 1230 | - | |
| 1231 | - if ($mobile_media_resize == "true" && !empty($device_scene)) { | |
| 1232 | - $attachment_id = !empty($panoscenes['scene-attachment-id']) | |
| 1233 | - ? (int) $panoscenes['scene-attachment-id'] | |
| 1234 | - : $this->get_attachment_id_by_url($device_scene); | |
| 1235 | - | |
| 1236 | - if ($attachment_id) { | |
| 1237 | - $image_width = 0; | |
| 1238 | - $image_meta = wp_get_attachment_metadata($attachment_id); | |
| 1239 | - | |
| 1240 | - if (isset($image_meta['width'])) { | |
| 1241 | - $image_width = (int) $image_meta['width']; | |
| 1242 | - } elseif (function_exists('get_attached_file')) { | |
| 1243 | - // Local file fallback only if attachment metadata is missing (no network request) | |
| 1244 | - $file_path = get_attached_file($attachment_id); | |
| 1245 | - if ($file_path && file_exists($file_path)) { | |
| 1246 | - $image_info = @getimagesize($file_path); | |
| 1247 | - if (isset($image_info[0])) { | |
| 1248 | - $image_width = (int) $image_info[0]; | |
| 1148 | + $device_scene = $panoscenes['scene-attachment-url']; | |
| 1149 | + $mobile_media_resize = get_option('mobile_media_resize'); | |
| 1150 | + $file_accessible = ini_get('allow_url_fopen'); | |
| 1151 | + if ($mobile_media_resize == "true" && $device_scene ) { | |
| 1152 | + if ($file_accessible == "1") { | |
| 1153 | + $image_info = getimagesize($device_scene); | |
| 1154 | + if ( isset($image_info[0]) && $image_info[0] > 4096) { | |
| 1155 | + $src_to_id_for_mobile = ''; | |
| 1156 | + $src_to_id_for_desktop = ''; | |
| 1157 | + if (wpvr_isMobileDevice()) { | |
| 1158 | + $src_to_id_for_mobile = attachment_url_to_postid($panoscenes['scene-attachment-url']); | |
| 1159 | + if ($src_to_id_for_mobile) { | |
| 1160 | + $mobile_scene = wp_get_attachment_image_src($src_to_id_for_mobile, 'wpvr_mobile'); | |
| 1161 | + if ($mobile_scene[3]) { | |
| 1162 | + $device_scene = $mobile_scene[0]; | |
| 1163 | + } | |
| 1249 | 1164 | } |
| 1165 | + } else { | |
| 1166 | + $src_to_id_for_desktop = attachment_url_to_postid($panoscenes['scene-attachment-url']); | |
| 1167 | + if ($src_to_id_for_desktop) { | |
| 1168 | + $desktop_scene = wp_get_attachment_image_src($src_to_id_for_mobile, 'full'); | |
| 1169 | + if (isset($desktop_scene[0])) { | |
| 1170 | + $device_scene = $desktop_scene[0]; | |
| 1171 | + } | |
| 1172 | + } | |
| 1250 | 1173 | } |
| 1251 | 1174 | } |
| 1252 | - | |
| 1253 | - if ($image_width > 4096) { | |
| 1254 | - $mobile_scene = wp_get_attachment_image_src($attachment_id, 'wpvr_mobile'); | |
| 1255 | - if (!empty($mobile_scene[3])) { // is_intermediate verifies resized image exists | |
| 1256 | - $mobile_scene_url = $mobile_scene[0]; | |
| 1257 | - } | |
| 1258 | - | |
| 1259 | - $desktop_scene = wp_get_attachment_image_src($attachment_id, 'full'); | |
| 1260 | - if (isset($desktop_scene[0])) { | |
| 1261 | - $desktop_scene_url = $desktop_scene[0]; | |
| 1262 | - $device_scene = $desktop_scene[0]; | |
| 1263 | - } | |
| 1264 | - | |
| 1265 | - if (wpvr_isMobileDevice() && !empty($mobile_scene_url)) { | |
| 1266 | - $device_scene = $mobile_scene_url; | |
| 1267 | - } | |
| 1268 | - } | |
| 1269 | 1175 | } |
| 1270 | 1176 | } |
| 1271 | 1177 | |
| 1272 | 1178 | $scene_info = array(); |
| @@ -1283,13 +1189,8 @@ | ||
| 1283 | 1189 | |
| 1284 | 1190 | $scene_info = array("type" => $panoscenes["scene-type"], "cubeMap" => $pano_attachment, "pitch" => $default_scene_pitch, "maxPitch" => $scene_max_pitch, "minPitch" => $scene_min_pitch, "maxYaw" => $scene_max_yaw, "minYaw" => $scene_min_yaw, "yaw" => $default_scene_yaw, "hfov" => $default_zoom, "maxHfov" => $max_zoom, "minHfov" => $min_zoom, "title" => $scene_ititle, "author" => $scene_author, "authorURL" => $scene_author_url, "vaov" => $scene_vaov, "haov" => $scene_haov, "vOffset" => $scene_vertical_offset, "hotSpots" => $hotspots); |
| 1285 | 1191 | } else { |
| 1286 | 1192 | $scene_info = array("type" => $panoscenes["scene-type"], "panorama" => $device_scene, "pitch" => $default_scene_pitch, "maxPitch" => $scene_max_pitch, "minPitch" => $scene_min_pitch, "maxYaw" => $scene_max_yaw, "minYaw" => $scene_min_yaw, "yaw" => $default_scene_yaw, "hfov" => $default_zoom, "maxHfov" => $max_zoom, "minHfov" => $min_zoom, "title" => $scene_ititle, "author" => $scene_author, "authorURL" => $scene_author_url, "vaov" => $scene_vaov, "haov" => $scene_haov, "vOffset" => $scene_vertical_offset, "hotSpots" => $hotspots); |
| 1287 | - if (!empty($mobile_scene_url)) { | |
| 1288 | - $scene_info['mobile_panorama'] = $mobile_scene_url; | |
| 1289 | - $scene_info['desktop_panorama'] = $desktop_scene_url; | |
| 1290 | - $scene_info['desktop_width'] = $image_width; | |
| 1291 | - } | |
| 1292 | 1193 | } |
| 1293 | 1194 | |
| 1294 | 1195 | |
| 1295 | 1196 | if (isset($panoscenes["ptyscene"])) { |
| @@ -1425,11 +1326,8 @@ | ||
| 1425 | 1326 | if ( empty( $panoscenes['hotspot-list'] ) || ! is_array( $panoscenes['hotspot-list'] ) ) { |
| 1426 | 1327 | continue; |
| 1427 | 1328 | } |
| 1428 | 1329 | foreach($panoscenes['hotspot-list'] as $hotspot){ |
| 1429 | - if ( ( $hotspot['hotspot-type'] ?? '' ) === 'sticker' ) { | |
| 1430 | - continue; | |
| 1431 | - } | |
| 1432 | 1330 | if (isset($hotspot['hotspot-customclass-color-icon-value']) && !empty($hotspot['hotspot-customclass-color-icon-value'])) { |
| 1433 | 1331 | $hotspoticoncolor = $hotspot['hotspot-customclass-color-icon-value']; |
| 1434 | 1332 | } else { |
| 1435 | 1333 | $hotspoticoncolor = "#00b4ff"; |
| @@ -2346,40 +2244,8 @@ | ||
| 2346 | 2244 | $html .= '(function ($) {'; |
| 2347 | 2245 | $html .= 'jQuery(document).ready(function() {'; |
| 2348 | 2246 | $html .= 'var response = ' . $response . ';'; |
| 2349 | 2247 | $html .= 'var scenes = response[1];'; |
| 2350 | - $html .= 'function wpvrResolveDevicePanorama(scenesConfig) {'; | |
| 2351 | - $html .= ' if (!scenesConfig || !scenesConfig.scenes) return;'; | |
| 2352 | - $html .= ' var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);'; | |
| 2353 | - $html .= ' var isSmallScreen = (window.innerWidth <= 768);'; | |
| 2354 | - $html .= ' if (typeof window.wpvrMaxTexture === "undefined") {'; | |
| 2355 | - $html .= ' window.wpvrMaxTexture = 16384;'; | |
| 2356 | - $html .= ' try {'; | |
| 2357 | - $html .= ' var testCanvas = document.createElement("canvas");'; | |
| 2358 | - $html .= ' var gl = testCanvas.getContext("webgl") || testCanvas.getContext("experimental-webgl");'; | |
| 2359 | - $html .= ' if (gl) {'; | |
| 2360 | - $html .= ' window.wpvrMaxTexture = gl.getParameter(gl.MAX_TEXTURE_SIZE) || 16384;'; | |
| 2361 | - $html .= ' var ext = gl.getExtension("WEBGL_lose_context");'; | |
| 2362 | - $html .= ' if (ext) { ext.loseContext(); }'; | |
| 2363 | - $html .= ' }'; | |
| 2364 | - $html .= ' } catch (e) {}'; | |
| 2365 | - $html .= ' }'; | |
| 2366 | - $html .= ' var maxTexture = window.wpvrMaxTexture;'; | |
| 2367 | - $html .= ' for (var scId in scenesConfig.scenes) {'; | |
| 2368 | - $html .= ' if (!scenesConfig.scenes.hasOwnProperty(scId)) continue;'; | |
| 2369 | - $html .= ' var sc = scenesConfig.scenes[scId];'; | |
| 2370 | - $html .= ' if (!sc) continue;'; | |
| 2371 | - $html .= ' var exceedsGpu = sc.desktop_width && (sc.desktop_width > maxTexture);'; | |
| 2372 | - $html .= ' if (isMobile || isSmallScreen || exceedsGpu) {'; | |
| 2373 | - $html .= ' if (sc.mobile_panorama) {'; | |
| 2374 | - $html .= ' sc.panorama = sc.mobile_panorama;'; | |
| 2375 | - $html .= ' }'; | |
| 2376 | - $html .= ' } else if (sc.desktop_panorama) {'; | |
| 2377 | - $html .= ' sc.panorama = sc.desktop_panorama;'; | |
| 2378 | - $html .= ' }'; | |
| 2379 | - $html .= ' }'; | |
| 2380 | - $html .= '}'; | |
| 2381 | - $html .= 'wpvrResolveDevicePanorama(scenes);'; | |
| 2382 | 2248 | $html .= 'if(scenes) {'; |
| 2383 | 2249 | $html .= 'var scenedata = scenes.scenes;'; |
| 2384 | 2250 | $html .= 'for(var scId in scenedata) {'; |
| 2385 | 2251 | $html .= 'if(!scenedata.hasOwnProperty(scId)) continue;'; |
| @@ -2399,22 +2265,12 @@ | ||
| 2399 | 2265 | $html .='}'; |
| 2400 | 2266 | } |
| 2401 | 2267 | $html .= '}'; |
| 2402 | 2268 | |
| 2403 | - $html .= 'if(scenehotspot[hIdx].hotspot_type === "sticker" || scenehotspot[hIdx].type === "sticker" || scenehotspot[hIdx].stickerTemplate) {'; | |
| 2404 | - $html .= ' (function(hs) {'; | |
| 2405 | - $html .= ' hs["createTooltipFunc"] = function(div) {'; | |
| 2406 | - $html .= ' if (typeof window.wpvrRenderStickerHotspot === "function") {'; | |
| 2407 | - $html .= ' window.wpvrRenderStickerHotspot(div, hs);'; | |
| 2408 | - $html .= ' }'; | |
| 2409 | - $html .= ' };'; | |
| 2410 | - $html .= ' })(scenehotspot[hIdx]);'; | |
| 2411 | - $html .= '}'; | |
| 2412 | - | |
| 2413 | 2269 | if (wpvr_isMobileDevice() && get_option('dis_on_hover') == "true") { |
| 2414 | 2270 | } else { |
| 2415 | - $html .= 'else if(scenehotspot[hIdx]["createTooltipArgs"] != "") {'; | |
| 2416 | - $html .= ' scenehotspot[hIdx]["createTooltipFunc"] = function(div, args) { if (typeof window.wpvrtooltip === "function") { window.wpvrtooltip(div, args); } };'; | |
| 2271 | + $html .= 'if(scenehotspot[hIdx]["createTooltipArgs"] != "") {'; | |
| 2272 | + $html .= 'scenehotspot[hIdx]["createTooltipFunc"] = function(div, args) { if (typeof window.wpvrtooltip === "function") { window.wpvrtooltip(div, args); } };'; | |
| 2417 | 2273 | $html .= '}'; |
| 2418 | 2274 | } |
| 2419 | 2275 | |
| 2420 | 2276 | $html .= '}'; |
| @@ -2464,9 +2320,8 @@ | ||
| 2464 | 2320 | $response2[1]->autoRotate = false; |
| 2465 | 2321 | $response = json_encode($response2); |
| 2466 | 2322 | $html .= 'var response_duplicate = ' . $response . ';'; |
| 2467 | 2323 | $html .= 'var scenes_duplicate = response_duplicate[1];'; |
| 2468 | - $html .= 'wpvrResolveDevicePanorama(scenes_duplicate);'; | |
| 2469 | 2324 | |
| 2470 | 2325 | $html .= 'if(scenes_duplicate) {'; |
| 2471 | 2326 | $html .= 'var scenedata = scenes_duplicate.scenes;'; |
| 2472 | 2327 | $html .= 'for(var scId in scenedata) {'; |
| @@ -2476,22 +2331,12 @@ | ||
| 2476 | 2331 | $html .= 'for(var hIdx = 0; hIdx < scenehotspot.length; hIdx++) {'; |
| 2477 | 2332 | $html .= 'if(scenehotspot[hIdx]["clickHandlerArgs"] != "") {'; |
| 2478 | 2333 | $html .= 'scenehotspot[hIdx]["clickHandlerFunc"] = function(div, args) { if (typeof window.wpvrhotspot === "function") { window.wpvrhotspot(div, args); } };'; |
| 2479 | 2334 | $html .= '}'; |
| 2480 | - $html .= 'if(scenehotspot[hIdx].hotspot_type === "sticker" || scenehotspot[hIdx].type === "sticker" || scenehotspot[hIdx].stickerTemplate) {'; | |
| 2481 | - $html .= ' (function(hs) {'; | |
| 2482 | - $html .= ' hs["createTooltipFunc"] = function(div) {'; | |
| 2483 | - $html .= ' if (typeof window.wpvrRenderStickerHotspot === "function") {'; | |
| 2484 | - $html .= ' window.wpvrRenderStickerHotspot(div, hs);'; | |
| 2485 | - $html .= ' }'; | |
| 2486 | - $html .= ' };'; | |
| 2487 | - $html .= ' })(scenehotspot[hIdx]);'; | |
| 2488 | - $html .= '}'; | |
| 2489 | - | |
| 2490 | 2335 | if (wpvr_isMobileDevice() && get_option('dis_on_hover') == "true") { |
| 2491 | 2336 | } else { |
| 2492 | - $html .= 'else if(scenehotspot[hIdx]["createTooltipArgs"] != "") {'; | |
| 2493 | - $html .= ' scenehotspot[hIdx]["createTooltipFunc"] = function(div, args) { if (typeof window.wpvrtooltip === "function") { window.wpvrtooltip(div, args); } };'; | |
| 2337 | + $html .= 'if(scenehotspot[hIdx]["createTooltipArgs"] != "") {'; | |
| 2338 | + $html .= 'scenehotspot[hIdx]["createTooltipFunc"] = function(div, args) { if (typeof window.wpvrtooltip === "function") { window.wpvrtooltip(div, args); } };'; | |
| 2494 | 2339 | $html .= '}'; |
| 2495 | 2340 | } |
| 2496 | 2341 | $html .= '}'; |
| 2497 | 2342 | $html .= '}'; |
| @@ -3052,13 +2897,8 @@ | ||
| 3052 | 2897 | if (!hotspot) { |
| 3053 | 2898 | return; |
| 3054 | 2899 | } |
| 3055 | 2900 | |
| 3056 | - // Social share icons navigate independently using their own links and targets. | |
| 3057 | - if (hotspot.querySelector(".wpvr-sticker-card--social-share")) { | |
| 3058 | - return; | |
| 3059 | - } | |
| 3060 | - | |
| 3061 | 2901 | var hotspotLink = hotspot.closest("a[href]"); |
| 3062 | 2902 | if (!hotspotLink) { |
| 3063 | 2903 | hotspotLink = hotspot.querySelector("a[href]"); |
| 3064 | 2904 | } |
| @@ -3966,41 +3806,7 @@ | ||
| 3966 | 3806 | return 'https://' . $url; |
| 3967 | 3807 | } |
| 3968 | 3808 | |
| 3969 | 3809 | return $url; |
| 3970 | -} | |
| 3971 | - | |
| 3972 | -/** | |
| 3973 | - * Get attachment ID from URL with in-memory static cache and WordPress object cache. | |
| 3974 | - * | |
| 3975 | - * @param string $url Image URL. | |
| 3976 | - * @return int Attachment ID or 0. | |
| 3977 | - */ | |
| 3978 | -private function get_attachment_id_by_url($url) | |
| 3979 | -{ | |
| 3980 | - static $memory_cache = array(); | |
| 3981 | - | |
| 3982 | - if (empty($url) || !is_string($url)) { | |
| 3983 | - return 0; | |
| 3984 | - } | |
| 3985 | - | |
| 3986 | - if (isset($memory_cache[$url])) { | |
| 3987 | - return $memory_cache[$url]; | |
| 3988 | - } | |
| 3989 | - | |
| 3990 | - $cache_key = 'wpvr_att_id_' . md5($url); | |
| 3991 | - $cached_id = wp_cache_get($cache_key, 'wpvr'); | |
| 3992 | - if (false !== $cached_id) { | |
| 3993 | - $memory_cache[$url] = (int) $cached_id; | |
| 3994 | - return (int) $cached_id; | |
| 3995 | - } | |
| 3996 | - | |
| 3997 | - $attachment_id = attachment_url_to_postid($url); | |
| 3998 | - $attachment_id = $attachment_id ? (int) $attachment_id : 0; | |
| 3999 | - | |
| 4000 | - wp_cache_set($cache_key, $attachment_id, 'wpvr', HOUR_IN_SECONDS); | |
| 4001 | - $memory_cache[$url] = $attachment_id; | |
| 4002 | - | |
| 4003 | - return $attachment_id; | |
| 4004 | 3810 | } |
| 4005 | 3811 | |
| 4006 | 3812 | } |