| @@ -128,8 +128,20 @@ | ||
| 128 | 128 | if (isset($temp_hotspot['fluent-form-id'])) { |
| 129 | 129 | $temp_hotspot['fluent-form-id'] = (string) absint($temp_hotspot['fluent-form-id']); |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | + // Legacy repeater controls serialize compound sticker fields as JSON. | |
| 133 | + foreach (array('border-radius', 'padding', 'social-links') as $sticker_field) { | |
| 134 | + $key = 'hotspot-sticker-' . $sticker_field; | |
| 135 | + if (isset($temp_hotspot[$key])) { | |
| 136 | + $value = $temp_hotspot[$key]; | |
| 137 | + if (is_string($value)) $value = json_decode($value, true); | |
| 138 | + if (is_object($value)) $value = (array) $value; | |
| 139 | + if (is_array($value)) { | |
| 140 | + $temp_hotspot[$key] = json_decode(wp_json_encode($value), true); | |
| 141 | + } | |
| 142 | + } | |
| 143 | + } | |
| 132 | 144 | $_hotspot_array[] = $temp_hotspot; |
| 133 | 145 | } |
| 134 | 146 | } |
| 135 | 147 | |
| @@ -551,8 +563,9 @@ | ||
| 551 | 563 | } else { |
| 552 | 564 | if (!$hotspot_content) $hotspot_content = $hotspot_data["hotspot-content"] ?? ''; |
| 553 | 565 | } |
| 554 | 566 | |
| 567 | + $is_sticker = ( ( $hotspot_data['hotspot-type'] ?? '' ) === 'sticker' ); | |
| 555 | 568 | $hotspot_info = array( |
| 556 | 569 | "text" => $hotspot_data["hotspot-title"], |
| 557 | 570 | "pitch" => $hotspot_data["hotspot-pitch"], |
| 558 | 571 | "yaw" => $hotspot_data["hotspot-yaw"], |
| @@ -560,11 +573,85 @@ | ||
| 560 | 573 | "URL" => $hotspot_data["hotspot-url"], |
| 561 | 574 | "clickHandlerArgs" => sanitize_content_preserve_styles($hotspot_content, $is_fluent_form), |
| 562 | 575 | "createTooltipArgs" => sanitize_content_preserve_styles($hotspot_data["hotspot-hover"] ?? '', false), |
| 563 | 576 | "sceneId" => $hotspot_data["hotspot-scene"], |
| 564 | - 'hotspot_type' => $hotspot_data['hotspot-type'] | |
| 577 | + 'hotspot_type' => $hotspot_data['hotspot-type'], | |
| 578 | + 'scale' => isset($hotspot_data['hotspot-scale']) ? ($hotspot_data['hotspot-scale'] === 'on' || $hotspot_data['hotspot-scale'] === true) : $is_sticker | |
| 565 | 579 | ); |
| 566 | 580 | |
| 581 | + if ( $is_sticker ) { | |
| 582 | + $custom_class_pro = ! empty( $hotspot_data['hotspot-customclass'] ) && $hotspot_data['hotspot-customclass'] !== 'none' | |
| 583 | + ? ' ' . $hotspot_data['hotspot-customclass'] | |
| 584 | + : ''; | |
| 585 | + $hotspot_info['cssClass'] = 'wpvr-hs-custom wpvr-hs-sticker' . $custom_class_pro; | |
| 586 | + $hotspot_info['stickerTemplate'] = $hotspot_data['hotspot-sticker-template'] ?? 'social_proof'; | |
| 587 | + $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!'; | |
| 588 | + $hotspot_info['stickerClientName'] = $hotspot_data['hotspot-sticker-client-name'] ?? 'Elena R.'; | |
| 589 | + $hotspot_info['stickerClientAvatar'] = $hotspot_data['hotspot-sticker-client-avatar'] ?? ''; | |
| 590 | + $hotspot_info['stickerRating'] = isset( $hotspot_data['hotspot-sticker-rating'] ) ? (int) $hotspot_data['hotspot-sticker-rating'] : 5; | |
| 591 | + $is_separate_icon = ( $hotspot_data['hotspot-sticker-template'] ?? '' ) === 'button_with_separate_icon'; | |
| 592 | + $is_add_to_cart = ( $hotspot_data['hotspot-sticker-template'] ?? '' ) === 'add_to_cart'; | |
| 593 | + $is_social_share = ( $hotspot_data['hotspot-sticker-template'] ?? '' ) === 'social_share'; | |
| 594 | + $hotspot_info['stickerBgColor'] = $hotspot_data['hotspot-sticker-bg-color'] ?? '#201b2c'; | |
| 595 | + $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 ); | |
| 596 | + $hotspot_info['stickerBlur'] = isset( $hotspot_data['hotspot-sticker-blur'] ) ? (float) $hotspot_data['hotspot-sticker-blur'] : 12; | |
| 597 | + $hotspot_info['stickerBrightness'] = isset( $hotspot_data['hotspot-sticker-brightness'] ) ? (float) $hotspot_data['hotspot-sticker-brightness'] : 100; | |
| 598 | + $hotspot_info['stickerTextColor'] = $hotspot_data['hotspot-sticker-text-color'] ?? '#ffffff'; | |
| 599 | + $hotspot_info['stickerBorderColor'] = $hotspot_data['hotspot-sticker-border-color'] ?? ( ( $is_separate_icon || $is_add_to_cart || $is_social_share ) ? '#40355a' : '#3a3051' ); | |
| 600 | + $default_radius = $is_separate_icon ? 135 : ( ( $is_add_to_cart || $is_social_share ) ? 15 : 20 ); | |
| 601 | + $hotspot_info['stickerBorderRadius'] = $hotspot_data['hotspot-sticker-border-radius'] ?? [ | |
| 602 | + 'topLeft' => $default_radius, | |
| 603 | + 'topRight' => $default_radius, | |
| 604 | + 'bottomRight' => $default_radius, | |
| 605 | + 'bottomLeft' => $default_radius, | |
| 606 | + ]; | |
| 607 | + $hotspot_info['stickerPadding'] = $hotspot_data['hotspot-sticker-padding'] ?? [ | |
| 608 | + 'top' => 21, | |
| 609 | + 'right' => 21, | |
| 610 | + 'bottom' => 21, | |
| 611 | + 'left' => 21, | |
| 612 | + ]; | |
| 613 | + $hotspot_info['stickerStarColor'] = $hotspot_data['hotspot-sticker-star-color'] ?? '#EF991F'; | |
| 614 | + // Text before button (for add_to_cart) | |
| 615 | + $hotspot_info['stickerPrefixText'] = $hotspot_data['hotspot-sticker-prefix-text'] ?? '$1,090 -'; | |
| 616 | + $hotspot_info['stickerSubText'] = $hotspot_data['hotspot-sticker-sub-text'] ?? 'Ready to ship'; | |
| 617 | + // Discount button, add to cart & social share sticker fields | |
| 618 | + $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' ) ) ); | |
| 619 | + $hotspot_info['stickerBtnColor'] = $hotspot_data['hotspot-sticker-btn-color'] ?? ( $is_social_share ? '#201a2b' : ( $is_add_to_cart ? '#3f04fe' : ( $is_separate_icon ? '#ffffff' : '#EF991F' ) ) ); | |
| 620 | + $hotspot_info['stickerBtnTextColor'] = $hotspot_data['hotspot-sticker-btn-text-color'] ?? ( ( $is_add_to_cart || $is_social_share ) ? '#ffffff' : '#000000' ); | |
| 621 | + $hotspot_info['stickerBtnIconColor'] = $hotspot_data['hotspot-sticker-btn-icon-color'] ?? '#000000'; | |
| 622 | + $hotspot_info['stickerBtnUrl'] = $hotspot_data['hotspot-sticker-btn-url'] ?? ''; | |
| 623 | + $hotspot_info['stickerBtnNewTab'] = $hotspot_data['hotspot-sticker-btn-new-tab'] ?? 'off'; | |
| 624 | + $hotspot_info['stickerMainBg'] = $hotspot_data['hotspot-sticker-main-bg'] ?? ( $hotspot_data['hotspot-sticker-card-bg'] ?? 'on' ); | |
| 625 | + $hotspot_info['stickerCardBg'] = $hotspot_info['stickerMainBg']; | |
| 626 | + $hotspot_info['stickerBtnBg'] = $hotspot_data['hotspot-sticker-btn-bg'] ?? 'on'; | |
| 627 | + $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 : '' ) ) ); | |
| 628 | + $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 : '' ); | |
| 629 | + $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 ); | |
| 630 | + $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 ); | |
| 631 | + $hotspot_info['stickerBtnBorderColor'] = $hotspot_data['hotspot-sticker-btn-border-color'] ?? ( $is_social_share ? '#3a3051' : ( ( $is_add_to_cart || $is_separate_icon ) ? '#ffffff' : '#EF991F' ) ); | |
| 632 | + $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; | |
| 633 | + $hotspot_info['stickerBtnTextWeight'] = $hotspot_data['hotspot-sticker-btn-text-weight'] ?? ( ( $is_social_share || $is_add_to_cart || $is_separate_icon ) ? '600' : '700' ); | |
| 634 | + $hotspot_info['stickerBtnIcon'] = ( $is_add_to_cart || $is_social_share ) ? 'none' : ( $hotspot_data['hotspot-sticker-btn-icon'] ?? 'fas fa-tag' ); | |
| 635 | + // Button with separate icon fields | |
| 636 | + $hotspot_info['stickerIconBoxBgColor'] = $hotspot_data['hotspot-sticker-icon-box-bg-color'] ?? '#ffffff'; | |
| 637 | + $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; | |
| 638 | + $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; | |
| 639 | + $hotspot_info['stickerIconBoxBorderColor'] = $hotspot_data['hotspot-sticker-icon-box-border-color'] ?? '#ffffff'; | |
| 640 | + $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; | |
| 641 | + // Social share sticker fields | |
| 642 | + $hotspot_info['stickerSocialColor'] = $hotspot_data['hotspot-sticker-social-color'] ?? '#ffffff'; | |
| 643 | + $hotspot_info['stickerSocialSize'] = isset( $hotspot_data['hotspot-sticker-social-size'] ) && $hotspot_data['hotspot-sticker-social-size'] !== '' ? (float) $hotspot_data['hotspot-sticker-social-size'] : 20; | |
| 644 | + $hotspot_info['stickerSocialGap'] = isset( $hotspot_data['hotspot-sticker-social-gap'] ) && $hotspot_data['hotspot-sticker-social-gap'] !== '' ? (float) $hotspot_data['hotspot-sticker-social-gap'] : 16; | |
| 645 | + $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 ) ) : [ | |
| 646 | + [ 'id' => '1', 'icon' => 'fab fa-linkedin-in', 'customSvg' => '', 'url' => 'https://linkedin.com', 'openNewTab' => 'on' ], | |
| 647 | + [ 'id' => '2', 'icon' => 'fab fa-facebook-f', 'customSvg' => '', 'url' => 'https://facebook.com', 'openNewTab' => 'on' ], | |
| 648 | + [ 'id' => '3', 'icon' => 'fab fa-instagram', 'customSvg' => '', 'url' => 'https://instagram.com', 'openNewTab' => 'on' ], | |
| 649 | + [ 'id' => '4', 'icon' => 'fab fa-dribbble', 'customSvg' => '', 'url' => 'https://dribbble.com', 'openNewTab' => 'on' ], | |
| 650 | + ]; | |
| 651 | + $hotspot_info['stickerShowPlaceholderText'] = $hotspot_data['hotspot-sticker-show-placeholder-text'] ?? 'on'; | |
| 652 | + } | |
| 653 | + | |
| 567 | 654 | array_push($hotspots, $hotspot_info); |
| 568 | 655 | if (empty($hotspot_data["hotspot-scene"])) { |
| 569 | 656 | unset($hotspot_info['targetPitch']); |
| 570 | 657 | unset($hotspot_info['targetYaw']); |
| @@ -2151,8 +2238,9 @@ | ||
| 2151 | 2238 | * @since 8.0.0 |
| 2152 | 2239 | */ |
| 2153 | 2240 | private function get_shortcode_hotspot_info($hotspot_data, $hotspot_type, $hotspot_content) |
| 2154 | 2241 | { |
| 2242 | + $is_sticker = ( ( $hotspot_data['hotspot-type'] ?? '' ) === 'sticker' ); | |
| 2155 | 2243 | $hotspot_info = array( |
| 2156 | 2244 | "text" => $hotspot_data["hotspot-title"], |
| 2157 | 2245 | "pitch" => $hotspot_data["hotspot-pitch"], |
| 2158 | 2246 | "yaw" => $hotspot_data["hotspot-yaw"], |
| @@ -2162,15 +2250,89 @@ | ||
| 2162 | 2250 | "wpvr_url_open" => isset($hotspot_data["wpvr_url_open"][0]) ? $hotspot_data["wpvr_url_open"][0] : 'off', |
| 2163 | 2251 | "clickHandlerArgs" => sanitize_content_preserve_styles($hotspot_content, ($hotspot_data['hotspot-type'] ?? '') === 'fluent_form'), |
| 2164 | 2252 | "createTooltipArgs" => sanitize_content_preserve_styles($hotspot_data["hotspot-hover"] ?? '', false), |
| 2165 | 2253 | "sceneId" => $hotspot_data["hotspot-scene"], |
| 2166 | - 'hotspot_type' => $hotspot_data['hotspot-type'] | |
| 2254 | + 'hotspot_type' => $hotspot_data['hotspot-type'], | |
| 2255 | + 'scale' => isset($hotspot_data['hotspot-scale']) ? ($hotspot_data['hotspot-scale'] === 'on' || $hotspot_data['hotspot-scale'] === true) : $is_sticker | |
| 2167 | 2256 | ); |
| 2168 | 2257 | |
| 2169 | 2258 | $hotspot_info['URL'] = ($hotspot_data['hotspot-type'] === 'fluent_form' || $hotspot_data['hotspot-type'] === 'wc_product') ? '' : $hotspot_info['URL']; |
| 2170 | 2259 | |
| 2171 | - if ($hotspot_data["hotspot-customclass"] == 'none' || $hotspot_data["hotspot-customclass"] == '') { | |
| 2172 | - unset($hotspot_info["cssClass"]); | |
| 2260 | + if ( $is_sticker ) { | |
| 2261 | + $custom_class_pro = ! empty( $hotspot_data['hotspot-customclass'] ) && $hotspot_data['hotspot-customclass'] !== 'none' | |
| 2262 | + ? ' ' . $hotspot_data['hotspot-customclass'] | |
| 2263 | + : ''; | |
| 2264 | + $hotspot_info['cssClass'] = 'wpvr-hs-custom wpvr-hs-sticker' . $custom_class_pro; | |
| 2265 | + $hotspot_info['stickerTemplate'] = $hotspot_data['hotspot-sticker-template'] ?? 'social_proof'; | |
| 2266 | + $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!'; | |
| 2267 | + $hotspot_info['stickerClientName'] = $hotspot_data['hotspot-sticker-client-name'] ?? 'Elena R.'; | |
| 2268 | + $hotspot_info['stickerClientAvatar'] = $hotspot_data['hotspot-sticker-client-avatar'] ?? ''; | |
| 2269 | + $hotspot_info['stickerRating'] = isset( $hotspot_data['hotspot-sticker-rating'] ) ? (int) $hotspot_data['hotspot-sticker-rating'] : 5; | |
| 2270 | + $is_separate_icon = ( $hotspot_data['hotspot-sticker-template'] ?? '' ) === 'button_with_separate_icon'; | |
| 2271 | + $is_add_to_cart = ( $hotspot_data['hotspot-sticker-template'] ?? '' ) === 'add_to_cart'; | |
| 2272 | + $is_social_share = ( $hotspot_data['hotspot-sticker-template'] ?? '' ) === 'social_share'; | |
| 2273 | + $hotspot_info['stickerBgColor'] = $hotspot_data['hotspot-sticker-bg-color'] ?? '#201b2c'; | |
| 2274 | + $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 ); | |
| 2275 | + $hotspot_info['stickerBlur'] = isset( $hotspot_data['hotspot-sticker-blur'] ) ? (float) $hotspot_data['hotspot-sticker-blur'] : 12; | |
| 2276 | + $hotspot_info['stickerBrightness'] = isset( $hotspot_data['hotspot-sticker-brightness'] ) ? (float) $hotspot_data['hotspot-sticker-brightness'] : 100; | |
| 2277 | + $hotspot_info['stickerTextColor'] = $hotspot_data['hotspot-sticker-text-color'] ?? '#ffffff'; | |
| 2278 | + $hotspot_info['stickerBorderColor'] = $hotspot_data['hotspot-sticker-border-color'] ?? ( ( $is_separate_icon || $is_add_to_cart || $is_social_share ) ? '#40355a' : '#3a3051' ); | |
| 2279 | + $default_radius = $is_separate_icon ? 135 : ( ( $is_add_to_cart || $is_social_share ) ? 15 : 20 ); | |
| 2280 | + $hotspot_info['stickerBorderRadius'] = $hotspot_data['hotspot-sticker-border-radius'] ?? [ | |
| 2281 | + 'topLeft' => $default_radius, | |
| 2282 | + 'topRight' => $default_radius, | |
| 2283 | + 'bottomRight' => $default_radius, | |
| 2284 | + 'bottomLeft' => $default_radius, | |
| 2285 | + ]; | |
| 2286 | + $hotspot_info['stickerPadding'] = $hotspot_data['hotspot-sticker-padding'] ?? [ | |
| 2287 | + 'top' => 21, | |
| 2288 | + 'right' => 21, | |
| 2289 | + 'bottom' => 21, | |
| 2290 | + 'left' => 21, | |
| 2291 | + ]; | |
| 2292 | + $hotspot_info['stickerStarColor'] = $hotspot_data['hotspot-sticker-star-color'] ?? '#EF991F'; | |
| 2293 | + // Text before button (for add_to_cart) | |
| 2294 | + $hotspot_info['stickerPrefixText'] = $hotspot_data['hotspot-sticker-prefix-text'] ?? '$1,090 -'; | |
| 2295 | + $hotspot_info['stickerSubText'] = $hotspot_data['hotspot-sticker-sub-text'] ?? 'Ready to ship'; | |
| 2296 | + // Discount button, add to cart & social share sticker fields | |
| 2297 | + $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' ) ) ); | |
| 2298 | + $hotspot_info['stickerBtnColor'] = $hotspot_data['hotspot-sticker-btn-color'] ?? ( $is_social_share ? '#201a2b' : ( $is_add_to_cart ? '#3f04fe' : ( $is_separate_icon ? '#ffffff' : '#EF991F' ) ) ); | |
| 2299 | + $hotspot_info['stickerBtnTextColor'] = $hotspot_data['hotspot-sticker-btn-text-color'] ?? ( ( $is_add_to_cart || $is_social_share ) ? '#ffffff' : '#000000' ); | |
| 2300 | + $hotspot_info['stickerBtnIconColor'] = $hotspot_data['hotspot-sticker-btn-icon-color'] ?? '#000000'; | |
| 2301 | + $hotspot_info['stickerBtnUrl'] = $hotspot_data['hotspot-sticker-btn-url'] ?? ''; | |
| 2302 | + $hotspot_info['stickerBtnNewTab'] = $hotspot_data['hotspot-sticker-btn-new-tab'] ?? 'off'; | |
| 2303 | + $hotspot_info['stickerMainBg'] = $hotspot_data['hotspot-sticker-main-bg'] ?? ( $hotspot_data['hotspot-sticker-card-bg'] ?? 'on' ); | |
| 2304 | + $hotspot_info['stickerCardBg'] = $hotspot_info['stickerMainBg']; | |
| 2305 | + $hotspot_info['stickerBtnBg'] = $hotspot_data['hotspot-sticker-btn-bg'] ?? 'on'; | |
| 2306 | + $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 : '' ) ) ); | |
| 2307 | + $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 : '' ); | |
| 2308 | + $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 ); | |
| 2309 | + $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 ); | |
| 2310 | + $hotspot_info['stickerBtnBorderColor'] = $hotspot_data['hotspot-sticker-btn-border-color'] ?? ( $is_social_share ? '#3a3051' : ( ( $is_add_to_cart || $is_separate_icon ) ? '#ffffff' : '#EF991F' ) ); | |
| 2311 | + $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; | |
| 2312 | + $hotspot_info['stickerBtnTextWeight'] = $hotspot_data['hotspot-sticker-btn-text-weight'] ?? ( ( $is_social_share || $is_add_to_cart || $is_separate_icon ) ? '600' : '700' ); | |
| 2313 | + $hotspot_info['stickerBtnIcon'] = ( $is_add_to_cart || $is_social_share ) ? 'none' : ( $hotspot_data['hotspot-sticker-btn-icon'] ?? 'fas fa-tag' ); | |
| 2314 | + // Button with separate icon fields | |
| 2315 | + $hotspot_info['stickerIconBoxBgColor'] = $hotspot_data['hotspot-sticker-icon-box-bg-color'] ?? '#ffffff'; | |
| 2316 | + $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; | |
| 2317 | + $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; | |
| 2318 | + $hotspot_info['stickerIconBoxBorderColor'] = $hotspot_data['hotspot-sticker-icon-box-border-color'] ?? '#ffffff'; | |
| 2319 | + $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; | |
| 2320 | + // Social share sticker fields | |
| 2321 | + $hotspot_info['stickerSocialColor'] = $hotspot_data['hotspot-sticker-social-color'] ?? '#ffffff'; | |
| 2322 | + $hotspot_info['stickerSocialSize'] = isset( $hotspot_data['hotspot-sticker-social-size'] ) && $hotspot_data['hotspot-sticker-social-size'] !== '' ? (float) $hotspot_data['hotspot-sticker-social-size'] : 20; | |
| 2323 | + $hotspot_info['stickerSocialGap'] = isset( $hotspot_data['hotspot-sticker-social-gap'] ) && $hotspot_data['hotspot-sticker-social-gap'] !== '' ? (float) $hotspot_data['hotspot-sticker-social-gap'] : 16; | |
| 2324 | + $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 ) ) : [ | |
| 2325 | + [ 'id' => '1', 'icon' => 'fab fa-linkedin-in', 'customSvg' => '', 'url' => 'https://linkedin.com', 'openNewTab' => 'on' ], | |
| 2326 | + [ 'id' => '2', 'icon' => 'fab fa-facebook-f', 'customSvg' => '', 'url' => 'https://facebook.com', 'openNewTab' => 'on' ], | |
| 2327 | + [ 'id' => '3', 'icon' => 'fab fa-instagram', 'customSvg' => '', 'url' => 'https://instagram.com', 'openNewTab' => 'on' ], | |
| 2328 | + [ 'id' => '4', 'icon' => 'fab fa-dribbble', 'customSvg' => '', 'url' => 'https://dribbble.com', 'openNewTab' => 'on' ], | |
| 2329 | + ]; | |
| 2330 | + $hotspot_info['stickerShowPlaceholderText'] = $hotspot_data['hotspot-sticker-show-placeholder-text'] ?? 'on'; | |
| 2331 | + } else { | |
| 2332 | + if ($hotspot_data["hotspot-customclass"] == 'none' || $hotspot_data["hotspot-customclass"] == '') { | |
| 2333 | + unset($hotspot_info["cssClass"]); | |
| 2334 | + } | |
| 2173 | 2335 | } |
| 2174 | 2336 | if (empty($hotspot_data["hotspot-scene"])) { |
| 2175 | 2337 | unset($hotspot_info['targetPitch']); |
| 2176 | 2338 | unset($hotspot_info['targetYaw']); |
| @@ -2219,31 +2381,39 @@ | ||
| 2219 | 2381 | */ |
| 2220 | 2382 | private function get_shortcode_device_scene($device_scene) |
| 2221 | 2383 | { |
| 2222 | 2384 | $mobile_media_resize = get_option('mobile_media_resize'); |
| 2223 | - $file_accessible = ini_get('allow_url_fopen'); | |
| 2224 | 2385 | |
| 2225 | - if ($mobile_media_resize == "true" && $device_scene) { | |
| 2226 | - if ($file_accessible == "1") { | |
| 2227 | - $image_info = getimagesize($device_scene); | |
| 2228 | - if ($image_info[0] > 4096) { | |
| 2229 | - $src_to_id_for_mobile = ''; | |
| 2230 | - $src_to_id_for_desktop = ''; | |
| 2386 | + if ($mobile_media_resize == "true" && !empty($device_scene)) { | |
| 2387 | + $attachment_id = attachment_url_to_postid($device_scene); | |
| 2388 | + | |
| 2389 | + if ($attachment_id) { | |
| 2390 | + $image_width = 0; | |
| 2391 | + $image_meta = wp_get_attachment_metadata($attachment_id); | |
| 2392 | + | |
| 2393 | + if (isset($image_meta['width'])) { | |
| 2394 | + $image_width = (int) $image_meta['width']; | |
| 2395 | + } elseif (function_exists('get_attached_file')) { | |
| 2396 | + // Local file fallback only if attachment metadata is missing (no network request) | |
| 2397 | + $file_path = get_attached_file($attachment_id); | |
| 2398 | + if ($file_path && file_exists($file_path)) { | |
| 2399 | + $image_info = @getimagesize($file_path); | |
| 2400 | + if (isset($image_info[0])) { | |
| 2401 | + $image_width = (int) $image_info[0]; | |
| 2402 | + } | |
| 2403 | + } | |
| 2404 | + } | |
| 2405 | + | |
| 2406 | + if ($image_width > 4096) { | |
| 2231 | 2407 | if (wpvr_isMobileDevice()) { |
| 2232 | - $src_to_id_for_mobile = attachment_url_to_postid($device_scene); | |
| 2233 | - if ($src_to_id_for_mobile) { | |
| 2234 | - $mobile_scene = wp_get_attachment_image_src($src_to_id_for_mobile, 'wpvr_mobile'); | |
| 2235 | - if ($mobile_scene[3]) { | |
| 2236 | - $device_scene = $mobile_scene[0]; | |
| 2237 | - } | |
| 2408 | + $mobile_scene = wp_get_attachment_image_src($attachment_id, 'wpvr_mobile'); | |
| 2409 | + if (!empty($mobile_scene[3])) { | |
| 2410 | + $device_scene = $mobile_scene[0]; | |
| 2238 | 2411 | } |
| 2239 | 2412 | } else { |
| 2240 | - $src_to_id_for_desktop = attachment_url_to_postid($device_scene); | |
| 2241 | - if ($src_to_id_for_desktop) { | |
| 2242 | - $desktop_scene = wp_get_attachment_image_src($src_to_id_for_mobile, 'full'); | |
| 2243 | - if ($desktop_scene[0]) { | |
| 2244 | - $device_scene = $desktop_scene[0]; | |
| 2245 | - } | |
| 2413 | + $desktop_scene = wp_get_attachment_image_src($attachment_id, 'full'); | |
| 2414 | + if (isset($desktop_scene[0])) { | |
| 2415 | + $device_scene = $desktop_scene[0]; | |
| 2246 | 2416 | } |
| 2247 | 2417 | } |
| 2248 | 2418 | } |
| 2249 | 2419 | } |
| @@ -2588,12 +2758,22 @@ | ||
| 2588 | 2758 | $html .= 'for(var hIdx = 0; hIdx < scenehotspot.length; hIdx++) {'; |
| 2589 | 2759 | $html .= 'if(scenehotspot[hIdx]["clickHandlerArgs"] != "") {'; |
| 2590 | 2760 | $html .= 'scenehotspot[hIdx]["clickHandlerFunc"] = function(div, args) { if (typeof window.wpvrhotspot === "function") { window.wpvrhotspot(div, args); } };'; |
| 2591 | 2761 | $html .= '}'; |
| 2762 | + $html .= 'if(scenehotspot[hIdx].hotspot_type === "sticker" || scenehotspot[hIdx].type === "sticker" || scenehotspot[hIdx].stickerTemplate) {'; | |
| 2763 | + $html .= ' (function(hs) {'; | |
| 2764 | + $html .= ' hs["createTooltipFunc"] = function(div) {'; | |
| 2765 | + $html .= ' if (typeof window.wpvrRenderStickerHotspot === "function") {'; | |
| 2766 | + $html .= ' window.wpvrRenderStickerHotspot(div, hs);'; | |
| 2767 | + $html .= ' }'; | |
| 2768 | + $html .= ' };'; | |
| 2769 | + $html .= ' })(scenehotspot[hIdx]);'; | |
| 2770 | + $html .= '}'; | |
| 2771 | + | |
| 2592 | 2772 | if (wpvr_isMobileDevice() && get_option('dis_on_hover') == "true") { |
| 2593 | 2773 | } else { |
| 2594 | - $html .= 'if(scenehotspot[hIdx]["createTooltipArgs"] != "") {'; | |
| 2595 | - $html .= 'scenehotspot[hIdx]["createTooltipFunc"] = function(div, args) { if (typeof window.wpvrtooltip === "function") { window.wpvrtooltip(div, args); } };'; | |
| 2774 | + $html .= 'else if(scenehotspot[hIdx]["createTooltipArgs"] != "") {'; | |
| 2775 | + $html .= ' scenehotspot[hIdx]["createTooltipFunc"] = function(div, args) { if (typeof window.wpvrtooltip === "function") { window.wpvrtooltip(div, args); } };'; | |
| 2596 | 2776 | $html .= '}'; |
| 2597 | 2777 | } |
| 2598 | 2778 | $html .= '}'; |
| 2599 | 2779 | $html .= '}'; |