PluginProbe
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress / 9.1.4
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress v9.1.4
9.2.0 9.1.4 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 All 224 releases
← All changes | legacy/admin/classes/class-wpvr-scene.php +81 -39 9.1.3 → 9.1.4 View file →
@@ -1765,14 +1765,13 @@
1765 1765 //===explainer button end===//
1766 1766
1767 1767 //===Floor map button===//
1768 1768 $status = get_option('wpvr_edd_license_status');
1769 - if ($status !== false && 'valid' == $status && $is_pro){
1770 - if ($floor_plan_enable == "on" && !empty($floor_plan_image)) {
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>';
1773 - $html .= '</div>';
1774 - }
1769 + $has_floor_plan = ( $status !== false && 'valid' == $status && $is_pro && 'on' == $floor_plan_enable && ! empty( $floor_plan_image ) );
1770 + if ( $has_floor_plan ) {
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>';
1773 + $html .= '</div>';
1775 1774 }
1776 1775 //===floor map button===//
1777 1776
1778 1777 if ($vrgallery && 'valid' == $status && $is_pro ) {
@@ -1908,45 +1907,88 @@
1908 1907 </div>';
1909 1908 }
1910 1909 }
1911 1910 //===Floor plan section===//
1912 - $floor_map_image = "";
1913 - $floor_map_pointer = array();
1914 - $floor_map_scene_id = '';
1915 - $floor_plan_custom_color = '#cca92c';
1916 - $floor_plan_direction_indicator = isset($postdata['floor_plan_direction_indicator']) ? $postdata['floor_plan_direction_indicator'] : 'on';
1911 + if ( $has_floor_plan ) {
1912 + $floor_map_image = $floor_plan_image;
1913 + $floor_map_pointer = isset($postdata['floor_plan_pointer_position']) && is_array($postdata['floor_plan_pointer_position']) ? $postdata['floor_plan_pointer_position'] : array();
1914 + $floor_map_scene_id = isset($postdata['floor_plan_data_list']) && is_array($postdata['floor_plan_data_list']) ? $postdata['floor_plan_data_list'] : array();
1915 + $floor_plan_custom_color = isset($postdata['floor_plan_custom_color']) && ! empty($postdata['floor_plan_custom_color']) ? $postdata['floor_plan_custom_color'] : '#cca92c';
1916 + $floor_plan_direction_indicator = isset($postdata['floor_plan_direction_indicator']) ? $postdata['floor_plan_direction_indicator'] : 'on';
1917 1917
1918 - if (isset($postdata['floor_plan_attachment_url'])) {
1919 - $floor_map_image = $postdata['floor_plan_attachment_url'];
1920 - $floor_map_pointer = $postdata['floor_plan_pointer_position'];
1921 - $floor_map_scene_id = $postdata['floor_plan_data_list'];
1922 - $floor_plan_custom_color = $postdata['floor_plan_custom_color'];
1923 - }
1924 - $html .= '<div class="wpvr-floor-map" id="wpvr-floor-map' . $pano_suffix . '" style="display: none">';
1925 - $html .= '<span class="close-floor-map-plan"><i class="fa fa-times"></i></span>';
1926 - $html .= '<img loading="lazy" src="'.$floor_map_image.'">';
1927 - foreach($floor_map_pointer as $key=> $pointer_position){
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.'">
1929 - <svg class="floor-pointer-circle" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
1930 - <circle cx="12" cy="12" r="11.5" stroke="'.$floor_plan_custom_color.'"/>
1931 - <circle cx="12" cy="12" r="5" fill="'.$foreground_color_pointer.'"/>
1932 - </svg>';
1933 -
1934 - // Only add the floor pointer flash SVG if floor_plan_direction_indicator is "on"
1935 - if ($floor_plan_direction_indicator === "on") {
1936 - $html .= '<svg class="floor-pointer-flash" width="54" height="35" viewBox="0 0 54 35" fill="none" xmlns="http://www.w3.org/2000/svg">
1937 - <path d="M0.454054 1.32433L11.7683 34.3243C11.9069 34.7285 12.287 35 12.7143 35H41.2857C41.713 35 42.0931 34.7285 42.2317 34.3243L53.5459 1.32432C53.7685 0.675257 53.2862 0 52.6 0H1.4C0.713843 0 0.231517 0.675258 0.454054 1.32433Z" fill="url(#paint0_linear_1_10)"/>
1938 - <defs>
1939 - <linearGradient id="paint0_linear_1_10" x1="27" y1="4.59807e-08" x2="26.5" y2="28" gradientUnits="userSpaceOnUse">
1940 - <stop stop-color="' . esc_attr( $floor_plan_custom_color ) . '" stop-opacity="0"/>
1941 - <stop offset="1" stop-color="' . esc_attr( $floor_plan_custom_color ) . '"/>
1942 - </linearGradient>
1943 - </defs>
1944 - </svg>';
1918 + $media_alt = '';
1919 + $attachment_id = attachment_url_to_postid( $floor_map_image );
1920 +
1921 + if ( $attachment_id ) {
1922 + $media_alt = sanitize_text_field( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) );
1923 + }
1924 +
1925 + if ( ! empty( $media_alt ) ) {
1926 + $floor_map_alt = $media_alt;
1927 + } else {
1928 + $tour_title = sanitize_text_field( get_the_title( $id ) );
1929 +
1930 + $floor_map_alt = ! empty( $tour_title )
1931 + /* translators: %s: tour title */
1932 + ? sprintf( __( '%s - Floor Plan', 'wpvr' ), $tour_title )
1933 + : __( 'Floor Plan', 'wpvr' );
1934 + }
1935 +
1936 + $html .= '<div class="wpvr-floor-map" id="wpvr-floor-map' . $pano_suffix . '" style="display: none">';
1937 + $html .= '<span class="close-floor-map-plan"><i class="fa fa-times"></i></span>';
1938 + $html .= '<img loading="lazy" src="' . esc_url( $floor_map_image ) . '" alt="' . esc_attr( $floor_map_alt ) . '">';
1939 + foreach ( $floor_map_pointer as $key => $pointer_position ) {
1940 + $pointer_id = '';
1941 + $data_top = '';
1942 + $data_left = '';
1943 + $style = '';
1944 +
1945 + if ( is_object( $pointer_position ) ) {
1946 + $pointer_id = isset( $pointer_position->id ) ? (string) $pointer_position->id : '';
1947 + $data_top = isset( $pointer_position->data_top ) ? (string) $pointer_position->data_top : '';
1948 + $data_left = isset( $pointer_position->data_left ) ? (string) $pointer_position->data_left : '';
1949 + $style = isset( $pointer_position->style ) ? (string) $pointer_position->style : '';
1950 + } elseif ( is_array( $pointer_position ) ) {
1951 + $pointer_id = isset( $pointer_position['id'] ) ? (string) $pointer_position['id'] : '';
1952 + $data_top = isset( $pointer_position['data_top'] ) ? (string) $pointer_position['data_top'] : '';
1953 + $data_left = isset( $pointer_position['data_left'] ) ? (string) $pointer_position['data_left'] : '';
1954 + $style = isset( $pointer_position['style'] ) ? (string) $pointer_position['style'] : '';
1955 + }
1956 +
1957 + $scene_id_val = '';
1958 + if ( isset( $floor_map_scene_id[ $key ] ) ) {
1959 + $scene_item = $floor_map_scene_id[ $key ];
1960 + if ( is_object( $scene_item ) && isset( $scene_item->value ) ) {
1961 + $scene_id_val = (string) $scene_item->value;
1962 + } elseif ( is_array( $scene_item ) && isset( $scene_item['value'] ) ) {
1963 + $scene_id_val = (string) $scene_item['value'];
1964 + } elseif ( is_scalar( $scene_item ) ) {
1965 + $scene_id_val = (string) $scene_item;
1945 1966 }
1967 + }
1968 +
1969 + $html .= '<div class="floor-plan-pointer ui-draggable ui-draggable-handle" scene_id="' . esc_attr( $scene_id_val ) . '" id="' . esc_attr( $pointer_id ) . '" data-top="' . esc_attr( $data_top ) . '" data-left="' . esc_attr( $data_left ) . '" style="' . esc_attr( $style ) . '">
1970 + <svg class="floor-pointer-circle" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
1971 + <circle cx="12" cy="12" r="11.5" stroke="' . esc_attr( $floor_plan_custom_color ) . '"/>
1972 + <circle cx="12" cy="12" r="5" fill="' . esc_attr( $foreground_color_pointer ) . '"/>
1973 + </svg>';
1974 +
1975 + // Only add the floor pointer flash SVG if floor_plan_direction_indicator is "on"
1976 + if ( $floor_plan_direction_indicator === 'on' ) {
1977 + $html .= '<svg class="floor-pointer-flash" width="54" height="35" viewBox="0 0 54 35" fill="none" xmlns="http://www.w3.org/2000/svg">
1978 + <path d="M0.454054 1.32433L11.7683 34.3243C11.9069 34.7285 12.287 35 12.7143 35H41.2857C41.713 35 42.0931 34.7285 42.2317 34.3243L53.5459 1.32432C53.7685 0.675257 53.2862 0 52.6 0H1.4C0.713843 0 0.231517 0.675258 0.454054 1.32433Z" fill="url(#paint0_linear_1_10)"/>
1979 + <defs>
1980 + <linearGradient id="paint0_linear_1_10" x1="27" y1="4.59807e-08" x2="26.5" y2="28" gradientUnits="userSpaceOnUse">
1981 + <stop stop-color="' . esc_attr( $floor_plan_custom_color ) . '" stop-opacity="0"/>
1982 + <stop offset="1" stop-color="' . esc_attr( $floor_plan_custom_color ) . '"/>
1983 + </linearGradient>
1984 + </defs>
1985 + </svg>';
1986 + }
1987 + $html .= '</div>';
1988 + }
1946 1989 $html .= '</div>';
1947 1990 }
1948 - $html .= '</div>';
1949 1991 //===Floor plan section===//
1950 1992
1951 1993 $html .= '<div class="wpvr-hotspot-tweak-contents-wrapper" style="display: none">';
1952 1994 $html .= '<i class="fa fa-times cross" data-id="' . $id . '"></i>';