exists() && 'bricks' === get_template()) { require_once plugin_dir_path(__FILE__) . 'bricks/bricks.php'; } /** * Currently plugin version. * Start at version 1.0.0 and use SemVer - https://semver.org * Rename this for your plugin and update it as you release new versions. */ define('WPVR_VERSION', '8.5.38'); define('WPVR_FILE', __FILE__); define("WPVR_PLUGIN_DIR_URL", plugin_dir_url(__FILE__)); define("WPVR_PLUGIN_DIR_PATH", plugin_dir_path(__FILE__)); define("WPVR_PLUGIN_PUBLIC_DIR_URL", plugin_dir_url(__FILE__) . 'public/'); define('WPVR_BASE', plugin_basename(WPVR_FILE)); define('WPVR_DEV_MODE', false); define('WPVR_JS_PATH', plugin_dir_url(__FILE__) . 'admin/js/'); define('WPVR_ASSET_PATH', plugin_dir_url(__FILE__) . 'admin/'); define( 'WPVR_WEBHOOK_URL', sanitize_url( 'https://rextheme.com/?mailmint=1&route=webhook&topic=contact&hash=bbd19901-6d42-4ae5-a7a8-01eb1013c553' ) ); /** * The code that runs during plugin activation. * This action is documented in includes/class-wpvr-activator.php */ function activate_wpvr() { require_once plugin_dir_path(__FILE__) . 'includes/class-wpvr-activator.php'; Wpvr_Activator::activate(); // Trigger plugin activation tracking do_action( 'wpvr_plugin_activated' ); } /** * The code that runs during plugin deactivation. * This action is documented in includes/class-wpvr-deactivator.php */ function deactivate_wpvr() { require_once plugin_dir_path(__FILE__) . 'includes/class-wpvr-deactivator.php'; Wpvr_Deactivator::deactivate(); } register_activation_hook(__FILE__, 'activate_wpvr'); register_deactivation_hook(__FILE__, 'deactivate_wpvr'); /** * The core plugin class that is used to define internationalization, * admin-specific hooks, and public-facing site hooks. */ require plugin_dir_path(__FILE__) . 'includes/class-wpvr.php'; use Wpvr\Admin\Tracking\Tracker; /** * Begins execution of the plugin. * * Since everything within the plugin is registered via hooks, * then kicking off the plugin from this point in the file does * not affect the page life cycle. * * @since 7.3.6 */ function run_wpvr() { $plugin = new Wpvr(); $plugin->run(); // new Tracker(); // black friday banner class initialization new WPVR_Special_Occasion_Banner( '4th_of_july_deal_2025', '2025-07-02 00:00:01', '2025-07-14 23:59:59' ); // if (!defined('WPVR_PRO_VERSION') && 'no' === get_option('wpvr_sell_notification_bar', 'no')) { // new WPVR_Notification_Bar(); // } } run_wpvr(); /** * Array information checker * * @param mixed $needle * @param mixed $haystack * @param bool $strict * * @return bool * @since 7.3.6 */ function wpvr_in_array_r($needle, $haystack, $strict = false) { foreach ($haystack as $item) { if ((($strict ? $item === $needle : $item == $needle)) || is_array($item) && wpvr_in_array_r($needle, $item, $strict)) { return true; } } return false; } /** * Initialize the plugin tracker * * @return void * @since 7.3.6 */ function appsero_init_tracker_wpvr() { if (!class_exists('Appsero\Client')) { require_once __DIR__ . '/appsero/src/Client.php'; } $client = new Appsero\Client('cab9761e-b067-4824-9c71-042df5d58598', 'WP VR', __FILE__); // Active insights $client->insights()->init(); } appsero_init_tracker_wpvr(); function wpvr_block() { wp_register_script( 'wpvr-block', plugins_url('build/index.build.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor') ); if (is_admin()) { wp_enqueue_style( 'gutyblocks/guty-block', plugins_url('src/view.css', __FILE__), array() ); } if (function_exists('register_block_type')) { register_block_type('wpvr/wpvr-block', array( 'attributes' => array( 'id' => array( 'type' => 'string', 'default' => '0', ), 'width' => array( 'type' => 'string', 'default' => '600', ), 'width_unit' => array( 'type' => 'string', 'default' => 'px', ), 'height' => array( 'type' => 'string', 'default' => '400', ), 'height_unit' => array( 'type' => 'string', 'default' => 'px', ), 'mobile_height' => array( 'type' => 'string', 'default' => '300', ), 'mobile_height_unit' => array( 'type' => 'string', 'default' => 'px', ), 'radius' => array( 'type' => 'string', 'default' => '0', ), 'border_width' => array( 'type' => 'string', 'default' => '0px', ), 'border_style' => array( 'type' => 'string', 'default' => 'none', ), 'border_color' => array( 'type' => 'string', 'default' => 'none', ), 'radius_unit' => array( 'type' => 'string', 'default' => 'px', ), 'content' => array( 'type' => 'string', 'source' => 'html', 'default' => '' ), ), 'editor_script' => 'wpvr-block', 'render_callback' => 'wpvr_block_render', )); } } add_action('init', 'wpvr_block'); function wpvr_block_render($attributes) { if (isset($attributes['id'])) { $id = $attributes['id']; } else { $id = 0; } do_action('rex_wpvr_embadded_tour', $id, 'shortcode'); $memberpress_active = defined('MEPR_VERSION'); $rcp_active = is_plugin_active( 'restrict-content-pro/restrict-content-pro.php' ); if (($memberpress_active || $rcp_active ) && apply_filters('is_wpvr_pro_active', false)) { if (!is_user_logged_in()) { return esc_html__('You need to log in to access this content.', 'wpvr'); } $user_id = get_current_user_id(); $allowed_access = false; // Get saved membership levels from post meta $allowed_membership_levels = get_post_meta($id, '_wpvr_allowed_roles_levels', true); if ( isset($allowed_membership_levels) && 'none' !== $allowed_membership_levels ) { if (!is_array($allowed_membership_levels)) { $allowed_membership_levels = array($allowed_membership_levels); } // Check MemberPress Access if ($memberpress_active) { $user = new MeprUser($user_id); $active_memberships = $user->active_product_subscriptions(); if (array_intersect($allowed_membership_levels, $active_memberships) ) { $allowed_access = true; } } // Check Restrict Content Pro Access if ($rcp_active) { $user_rcp_memberships = rcp_get_customer_memberships($user_id); foreach ($user_rcp_memberships as $membership) { $rcp_access_level = array( $membership->get_object_id() ); if (array_intersect($allowed_membership_levels, $rcp_access_level) ) { $allowed_access = true; break; } } } } else { // If no membership restriction is set, allow access by default $allowed_access = true; } if (!$allowed_access) { return esc_html__('You do not have access to this content.', 'wpvr'); } } if (isset($attributes['width'])) { $width = $attributes['width']; } if (isset($attributes['width_unit'])) { $width_unit = $attributes['width_unit']; } if (isset($attributes['height'])) { $height = $attributes['height']; } if (isset($attributes['height_unit'])) { $height_unit = $attributes['height_unit']; } if (isset($attributes['mobile_height'])) { $mobile_height = $attributes['mobile_height']; } if (isset($attributes['mobile_height_unit'])) { $mobile_height_unit = $attributes['mobile_height_unit']; } if (isset($attributes['radius']) && isset($attributes['radius_unit'])) { $radius = $attributes['radius'] . $attributes['radius_unit']; } $border_style = ''; if (isset($attributes['border_width'], $attributes['border_style'], $attributes['border_color'])) { $border_style = $attributes['border_width'] . 'px ' . $attributes['border_style'] . ' ' . $attributes['border_color']; } if (isset($attributes['className'])) { $className = $attributes['className']; } else { $className = ''; } $get_post = get_post_status($id); if ($get_post !== 'publish') { return esc_html__('Oops! It seems like this post isn\'t published yet. Stay tuned for updates!', 'wpvr'); } if (post_password_required($id)) { return get_the_password_form(); } $postdata = get_post_meta($id, 'panodata', true); $panoid = 'pano' . $id; $panoid2 = 'pano2' . $id; if (!isset($postdata) || empty($postdata)) { return wp_kses( __('Oops! It seems that you have not selected any tour yet. Please select a tour from the dropdown of WPVR block.
', 'wpvr'), ['br' => []] ); } if (isset($postdata['streetviewdata'])) { if (empty($width)) { $width = '600px'; } if (empty($height)) { $height = '400px'; } $streetviewurl = $postdata['streetviewurl']; $html = ''; $html .= '
'; $html .= ''; $html .= '
'; return $html; } $is_pro = apply_filters('is_wpvr_pro_active', false); if (isset($postdata['vidid'])) { if (empty($width)) { $width = '600'; } if (empty($height)) { $height = '400'; } $videourl = $postdata['vidurl']; $videourl = $postdata['vidurl']; $autoplay = 'off'; if (isset($postdata['autoplay'])) { $autoplay = $postdata['autoplay']; } $loop = 'off'; if (isset($postdata['loop'])) { $loop = $postdata['loop']; } if (strpos($videourl, 'youtube') > 0 || strpos($videourl, 'youtu') > 0) { $explodeid = ''; $explodeid = explode("=", $videourl); $foundid = ''; $muted = '&mute=1'; if ($autoplay == 'on') { $autoplay = '&autoplay=1'; } else { $autoplay = ''; } if ($loop == 'on') { $loop = '&loop=1'; } else { $loop = ''; } if (strpos($videourl, 'youtu') > 0) { $explodeid = explode("/", $videourl); $foundid = $explodeid[3] . '?' . $autoplay . $loop; $expdata = $explodeid[3]; } else { $foundid = $explodeid[1] . '?' . $autoplay . $loop; $expdata = $explodeid[1]; } $playlist = '&playlist=' . $expdata; $playlist = str_replace("?feature=shared", "", $playlist); $html = ''; $html .= '
'; // Compatibility check script $html .= ''; $random_id = 'video-container-' . rand(10000, 99999); $html .= '
'; // Compatibility check screen (initially hidden for all, will show only for iPhone) $html .= ''; // Spinner animation $html .= ''; // Iframe (initial display set to block) $html .= '
'; $html .= ''; $html .= '
'; // Permission request (mobile only) $html .= ''; // Browser warning $html .= ''; // Main script $html .= ''; $html .= '
'; // Close container $html .= '
'; // Close outer wrapper } else { $html = ''; $html .= '
'; $html .= '
' . $postdata['panoviddata'] . '
'; $html .= ' '; // $html .= ''; $html .= '
'; //video js vr setup // $html .= ''; //video js vr end // } return $html; } $control = false; if (isset($postdata['showControls'])) { $control = $postdata['showControls']; } if ($control) { if (isset($postdata['customcontrol'])) { $custom_control = $postdata['customcontrol']; if ($custom_control['panupSwitch'] == "on" || $custom_control['panDownSwitch'] == "on" || $custom_control['panLeftSwitch'] == "on" || $custom_control['panRightSwitch'] == "on" || $custom_control['panZoomInSwitch'] == "on" || $custom_control['panZoomOutSwitch'] == "on" || $custom_control['panFullscreenSwitch'] == "on" || $custom_control['gyroscopeSwitch'] == "on" || $custom_control['backToHomeSwitch'] == "on") { $control = false; } } } $floor_plan_enable = 'off'; $floor_plan_image = ''; if (isset($postdata['floor_plan_tour_enabler']) && $postdata['floor_plan_tour_enabler'] == 'on') { $floor_plan_enable = $postdata['floor_plan_tour_enabler']; if (isset($postdata['floor_plan_attachment_url']) && !empty($postdata['floor_plan_attachment_url'])) { $floor_plan_image = $postdata['floor_plan_attachment_url']; } } $vrgallery = false; if (isset($postdata['vrgallery'])) { $vrgallery = $postdata['vrgallery']; } $vrgallery_title = false; if (isset($postdata['vrgallery_title'])) { $vrgallery_title = $postdata['vrgallery_title']; } $vrgallery_display = false; if (isset($postdata['vrgallery_display'])) { $vrgallery_display = $postdata['vrgallery_display']; } $vrgallery_icon_size = false; if (isset($postdata['vrgallery_icon_size'])) { $vrgallery_icon_size = $postdata['vrgallery_icon_size']; } $gyro = false; $gyro_orientation = false; if (isset($postdata['gyro'])) { $gyro = $postdata['gyro']; if (isset($postdata['deviceorientationcontrol'])) { $gyro_orientation = $postdata['deviceorientationcontrol']; } } $compass = false; $audio_right = "5px"; if (isset($postdata['compass'])) { $compass = $postdata['compass'] == 'on' || $postdata['compass'] != null ? true : false; if ($compass) { $audio_right = "60px"; } } $floor_map_right = "10px"; if ((isset($postdata['compass']) && $postdata['compass'] == 'on') && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on')) { $floor_map_right = "85px"; } elseif (isset($postdata['compass']) && $postdata['compass'] == 'on') { $floor_map_right = "55px"; } elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on") { $floor_map_right = "25px"; } //===explainer handle===// //===explainer handle===// $explainer_right = "10px"; if ((isset($postdata['compass']) && $postdata['compass'] == 'on') && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on') && ($floor_plan_enable == 'on' && !empty($floor_plan_image))) { $explainer_right = "130px"; } elseif (isset($postdata['compass']) && $postdata['compass'] == 'on' && ($floor_plan_enable == 'on' && !empty($floor_plan_image))) { $explainer_right = "100px"; } elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on" && ($floor_plan_enable == 'on' && !empty($floor_plan_image))) { $explainer_right = "60px"; } elseif ((isset($postdata['compass']) && $postdata['compass'] == 'on') && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on')) { $explainer_right = "80px"; } elseif (isset($postdata['compass']) && $postdata['compass'] == 'on') { $explainer_right = "55px"; } elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on") { $explainer_right = "30px"; } elseif ($floor_plan_enable == 'on' && !empty($floor_plan_image)) { $explainer_right = "40px"; } $enable_cardboard = ''; $is_cardboard = get_option('wpvr_cardboard_disable'); if (wpvr_isMobileDevice() && $is_cardboard == 'true') { $enable_cardboard = 'enable-cardboard'; $audio_right = "73px"; if (isset($postdata['compass'])) { $compass = $postdata['compass'] == 'on' || $postdata['compass'] != null ? true : false; if ($compass) { $audio_right = "130px"; } } $floor_map_right = "60px"; if ((isset($postdata['compass']) && $postdata['compass'] == 'on') && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on')) { $floor_map_right = "150px"; } elseif (isset($postdata['compass']) && $postdata['compass'] == 'on') { $floor_map_right = "120px"; } elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on") { $floor_map_right = "90px"; } //===explainer handle===// $explainer_right = "65px"; if ((isset($postdata['compass']) && $postdata['compass'] == true) && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on')) { $explainer_right = "150px"; } elseif ((isset($postdata['compass']) && $postdata['compass'] == true) && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on') && ($floor_plan_enable == 'on' && !empty($floor_plan_image))) { $explainer_right = "180px"; } elseif (isset($postdata['compass']) && $postdata['compass'] == true && ($floor_plan_enable == 'on' && !empty($floor_plan_image))) { $explainer_right = "150px"; } elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on" && ($floor_plan_enable == 'on' && !empty($floor_plan_image))) { $explainer_right = "120px"; } elseif (isset($postdata['compass']) && $postdata['compass'] == true) { $explainer_right = "130px"; } elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on") { $explainer_right = "90px"; } elseif ($floor_plan_enable == 'on' && !empty($floor_plan_image)) { $explainer_right = "90px"; } } //===explainer handle===// $mouseZoom = true; if (isset($postdata['mouseZoom'])) { if ($postdata['mouseZoom'] == "off") { $mouseZoom = false; } else { $mouseZoom = true; } } $draggable = true; if (isset($postdata['draggable'])) { $draggable = $postdata['draggable'] == 'on' || $postdata['draggable'] != null ? true : false; if ($postdata['draggable'] === 'off') { $draggable = false; } } $diskeyboard = false; if (isset($postdata['diskeyboard'])) { $diskeyboard = $postdata['diskeyboard'] == 'off' || $postdata['diskeyboard'] == null ? false : true; } $keyboardzoom = true; if (isset($postdata['keyboardzoom'])) { $keyboardzoom = $postdata['keyboardzoom']; } $autoload = false; if (isset($postdata['autoLoad'])) { $autoload = $postdata['autoLoad']; } $default_scene = ''; if (isset($postdata['defaultscene'])) { $default_scene = $postdata['defaultscene']; } $preview = ''; if (isset($postdata['preview'])) { $preview = $postdata['preview']; } $autorotation = ''; if (isset($postdata["autoRotate"])) { $autorotation = $postdata["autoRotate"]; } $autorotationinactivedelay = ''; if (isset($postdata["autoRotateInactivityDelay"])) { $autorotationinactivedelay = $postdata["autoRotateInactivityDelay"]; } $autorotationstopdelay = ''; if (isset($postdata["autoRotateStopDelay"])) { $autorotationstopdelay = $postdata["autoRotateStopDelay"]; } $scene_fade_duration = ''; if (isset($postdata['scenefadeduration'])) { $scene_fade_duration = $postdata['scenefadeduration']; } $panodata = array(); if (isset($postdata['panodata'])) { $panodata = $postdata['panodata']; } $default_zoom_global = 100; if (isset($postdata['hfov']) && $postdata['hfov'] != '') { $default_zoom_global = $postdata['hfov']; } $min_zoom_global = 50; if (isset($postdata['minHfov']) && $postdata['minHfov'] != '') { $min_zoom_global = $postdata['minHfov']; } $max_zoom_global = 120; if (isset($postdata['maxHfov']) && $postdata['maxHfov'] != '') { $max_zoom_global = $postdata['maxHfov']; } $hotspoticoncolor = '#00b4ff'; $hotspotblink = 'on'; $default_data = array(); $default_data = array('firstScene' => $default_scene, 'sceneFadeDuration' => $scene_fade_duration, 'hfov' => $default_zoom_global, 'maxHfov' => $max_zoom_global, 'minHfov' => $min_zoom_global); $scene_data = array(); if (is_array($panodata) && isset($panodata['scene-list'])) { if (!empty($panodata['scene-list'])) { foreach ($panodata['scene-list'] as $panoscenes) { $scene_ititle = ''; if (isset($panoscenes["scene-ititle"])) { $scene_ititle = sanitize_text_field($panoscenes["scene-ititle"]); } $scene_author = ''; if (isset($panoscenes["scene-author"])) { $scene_author = sanitize_text_field($panoscenes["scene-author"]); } $scene_author_url = ''; if (isset($panoscenes["scene-author-url"])) { $scene_author_url = sanitize_text_field($panoscenes["scene-author-url"]); } $scene_vaov = 180; if (isset($panoscenes["scene-vaov"])) { $scene_vaov = (float)$panoscenes["scene-vaov"]; } $scene_haov = 360; if (isset($panoscenes["scene-haov"])) { $scene_haov = (float)$panoscenes["scene-haov"]; } $scene_vertical_offset = 0; if (isset($panoscenes["scene-vertical-offset"])) { $scene_vertical_offset = (float)$panoscenes["scene-vertical-offset"]; } $default_scene_pitch = null; if (isset($panoscenes["scene-pitch"])) { $default_scene_pitch = (float)$panoscenes["scene-pitch"]; } $default_scene_yaw = null; if (isset($panoscenes["scene-yaw"])) { $default_scene_yaw = (float)$panoscenes["scene-yaw"]; } $scene_max_pitch = ''; if (isset($panoscenes["scene-maxpitch"])) { $scene_max_pitch = (float)$panoscenes["scene-maxpitch"]; } $scene_min_pitch = ''; if (isset($panoscenes["scene-minpitch"])) { $scene_min_pitch = (float)$panoscenes["scene-minpitch"]; } $scene_max_yaw = ''; if (isset($panoscenes["scene-maxyaw"])) { $scene_max_yaw = (float)$panoscenes["scene-maxyaw"]; } $scene_min_yaw = ''; if (isset($panoscenes["scene-minyaw"])) { $scene_min_yaw = (float)$panoscenes["scene-minyaw"]; } $default_zoom = 100; if (isset($panoscenes["scene-zoom"]) && $panoscenes["scene-zoom"] != '') { $default_zoom = (int)$panoscenes["scene-zoom"]; } else { if ($default_zoom_global != '') { $default_zoom = (int)$default_zoom_global; } } $max_zoom = 120; if (isset($panoscenes["scene-maxzoom"]) && $panoscenes["scene-maxzoom"] != '') { $max_zoom = (int)$panoscenes["scene-maxzoom"]; } else { if ($max_zoom_global != '') { $max_zoom = (int)$max_zoom_global; } } $min_zoom = 120; if (isset($panoscenes["scene-minzoom"]) && $panoscenes["scene-minzoom"] != '') { $min_zoom = (int)$panoscenes["scene-minzoom"]; } else { if ($min_zoom_global != '') { $min_zoom = (int)$min_zoom_global; } } $hotspot_datas = array(); if (isset($panoscenes['hotspot-list'])) { $hotspot_datas = $panoscenes['hotspot-list']; } $hotspots = array(); foreach ($hotspot_datas as $hotspot_data) { $status = get_option('wpvr_edd_license_status'); if ($status !== false && $status == 'valid') { if (isset($hotspot_data["hotspot-customclass-pro"]) && $hotspot_data["hotspot-customclass-pro"] != 'none') { $hotspot_data['hotspot-customclass'] = $hotspot_data["hotspot-customclass-pro"] . ' custom-' . $id . '-' . $panoscenes['scene-id'] . '-' . $hotspot_data['hotspot-title']; } if (isset($hotspot_data['hotspot-blink'])) { $hotspotblink = $hotspot_data['hotspot-blink']; } } $hotspot_scene_pitch = ''; if (isset($hotspot_data["hotspot-scene-pitch"])) { $hotspot_scene_pitch = $hotspot_data["hotspot-scene-pitch"]; } $hotspot_scene_yaw = ''; if (isset($hotspot_data["hotspot-scene-yaw"])) { $hotspot_scene_yaw = $hotspot_data["hotspot-scene-yaw"]; } $hotspot_type = $hotspot_data["hotspot-type"] !== 'scene' ? 'info' : $hotspot_data["hotspot-type"]; $hotspot_content = ''; ob_start(); do_action('wpvr_hotspot_content', $hotspot_data); $hotspot_content = ob_get_clean(); if (!$hotspot_content) { $hotspot_content = $hotspot_data["hotspot-content"]; } if (isset($hotspot_data["wpvr_url_open"][0])) { $wpvr_url_open = $hotspot_data["wpvr_url_open"][0]; } else { $wpvr_url_open = "off"; } $on_hover_content = preg_replace_callback( '/

\s*(]*>)\s*
\s*<\/p>/i', function ($matches) { return $matches[1]; }, $hotspot_data['hotspot-hover'] ?? '' ); $on_hover_content = sanitize_content_preserve_styles($on_hover_content ?? ''); $on_click_content = preg_replace_callback('/]*>/', "replace_callback", $hotspot_content ?? ''); $hotspot_shape = 'round'; if (isset($hotspot_data["hotspot-customclass-pro"]) && $hotspot_data["hotspot-customclass-pro"] != 'none') { $hotspot_shape = isset($hotspot_data["hotspot-shape"]) ? $hotspot_data["hotspot-shape"] : 'round'; } $hotspot_data_for_on_click=[]; if('info' === $hotspot_type && !empty($on_click_content)){ $hotspot_data_for_on_click = [ 'on_click_content' => $on_click_content, 'tour_id' => $id, 'scene_id' => $panoscenes['scene-id'], 'hotspot_id' => $hotspot_data['hotspot-title'], ]; } elseif('info' === $hotspot_type && !empty($hotspot_data["hotspot-url"])){ $hotspot_data_for_on_click = [ 'on_click_content' => '', 'tour_id' => $id, 'scene_id' => $panoscenes['scene-id'], 'hotspot_id' => $hotspot_data['hotspot-title'], ]; } $hotspot_info = array( 'text' => $hotspot_data['hotspot-title'], 'pitch' => $hotspot_data['hotspot-pitch'], 'yaw' => $hotspot_data['hotspot-yaw'], 'type' => $hotspot_type, 'cssClass' => $hotspot_data['hotspot-customclass'], 'URL' => $hotspot_data['hotspot-url'], "wpvr_url_open" => $wpvr_url_open, "clickHandlerArgs" => $hotspot_data_for_on_click, 'createTooltipArgs' => !empty(trim($on_hover_content)) ? trim($on_hover_content) : '', "sceneId" => $hotspot_data["hotspot-scene"], "targetPitch" => (float)$hotspot_scene_pitch, "targetYaw" => (float)$hotspot_scene_yaw, 'hotspot_type' => $hotspot_data['hotspot-type'], 'hotspot_shape' => $hotspot_shape, ); $hotspot_info['URL'] = ($hotspot_data['hotspot-type'] === 'fluent_form' || $hotspot_data['hotspot-type'] === 'wc_product') ? '' : $hotspot_info['URL']; if ($hotspot_data["hotspot-customclass"] == 'none' || $hotspot_data["hotspot-customclass"] == '') { unset($hotspot_info["cssClass"]); } if (empty($hotspot_data["hotspot-scene"])) { unset($hotspot_info['targetPitch']); unset($hotspot_info['targetYaw']); } array_push($hotspots, $hotspot_info); } $device_scene = $panoscenes['scene-attachment-url']; $mobile_media_resize = get_option('mobile_media_resize'); $file_accessible = ini_get('allow_url_fopen'); if ($mobile_media_resize == "true" && $device_scene) { if ($file_accessible == "1") { $image_info = getimagesize($device_scene); if ($image_info && $image_info[0] > 4096) { $src_to_id_for_mobile = ''; $src_to_id_for_desktop = ''; if (wpvr_isMobileDevice()) { $src_to_id_for_mobile = attachment_url_to_postid($panoscenes['scene-attachment-url']); if ($src_to_id_for_mobile) { $mobile_scene = wp_get_attachment_image_src($src_to_id_for_mobile, 'wpvr_mobile'); if ($mobile_scene[3]) { $device_scene = $mobile_scene[0]; } } } else { $src_to_id_for_desktop = attachment_url_to_postid($panoscenes['scene-attachment-url']); if ($src_to_id_for_desktop) { $desktop_scene = wp_get_attachment_image_src($src_to_id_for_mobile, 'full'); if ($desktop_scene && $desktop_scene[0]) { $device_scene = $desktop_scene[0]; } } } } } } $scene_info = array(); if ($panoscenes["scene-type"] == 'cubemap') { $pano_type = 'cubemap'; $pano_attachment = array( $panoscenes["scene-attachment-url-face0"], $panoscenes["scene-attachment-url-face1"], $panoscenes["scene-attachment-url-face2"], $panoscenes["scene-attachment-url-face3"], $panoscenes["scene-attachment-url-face4"], $panoscenes["scene-attachment-url-face5"] ); $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); } else { $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); } if (isset($panoscenes["ptyscene"])) { if ($panoscenes["ptyscene"] == "off") { unset($scene_info['pitch']); unset($scene_info['yaw']); } } if (empty($panoscenes["scene-ititle"])) { unset($scene_info['title']); } if (empty($panoscenes["scene-author"])) { unset($scene_info['author']); } if (empty($panoscenes["scene-author-url"])) { unset($scene_info['authorURL']); } if (empty($scene_vaov)) { unset($scene_info['vaov']); } if (empty($scene_haov)) { unset($scene_info['haov']); } if (empty($scene_vertical_offset)) { unset($scene_info['vOffset']); } if (isset($panoscenes["cvgscene"])) { if ($panoscenes["cvgscene"] == "off") { unset($scene_info['maxPitch']); unset($scene_info['minPitch']); } } if (empty($panoscenes["scene-maxpitch"])) { unset($scene_info['maxPitch']); } if (empty($panoscenes["scene-minpitch"])) { unset($scene_info['minPitch']); } if (isset($panoscenes["chgscene"])) { if ($panoscenes["chgscene"] == "off") { unset($scene_info['maxYaw']); unset($scene_info['minYaw']); } } if (empty($panoscenes["scene-maxyaw"])) { unset($scene_info['maxYaw']); } if (empty($panoscenes["scene-minyaw"])) { unset($scene_info['minYaw']); } // if (isset($panoscenes["czscene"])) { // if ($panoscenes["czscene"] == "off") { // unset($scene_info['hfov']); // unset($scene_info['maxHfov']); // unset($scene_info['minHfov']); // } // } $scene_array = array(); $scene_array = array( $panoscenes['scene-id'] => $scene_info ); $scene_data[$panoscenes['scene-id']] = $scene_info; } } } $pano_id_array = array(); $pano_id_array = array('panoid' => $panoid); $pano_response = array(); $pano_response = array('autoLoad' => $autoload, 'showControls' => $control, 'compass' => $compass, 'orientationOnByDefault' => $gyro_orientation, 'mouseZoom' => $mouseZoom, 'draggable' => $draggable, 'disableKeyboardCtrl' => $diskeyboard, 'keyboardZoom' => $keyboardzoom, "preview" => $preview, "autoRotate" => $autorotation, "autoRotateInactivityDelay" => $autorotationinactivedelay, "autoRotateStopDelay" => $autorotationstopdelay, 'default' => $default_data, 'scenes' => $scene_data); if (empty($autorotation)) { unset($pano_response['autoRotate']); unset($pano_response['autoRotateInactivityDelay']); unset($pano_response['autoRotateStopDelay']); } if (empty($autorotationinactivedelay)) { unset($pano_response['autoRotateInactivityDelay']); } if (empty($autorotationstopdelay)) { unset($pano_response['autoRotateStopDelay']); } $response = array(); $response = array($pano_id_array, $pano_response); if (!empty($response)) { $response = json_encode($response); } if (empty($width)) { $width = '600'; } if (empty($height)) { $height = '400'; } if ('fullwidth' == $width) { $width = "100%"; } $foreground_color = '#fff'; $pulse_color = wpvr_hex2rgb($hotspoticoncolor); $rgb = wpvr_HTMLToRGB($hotspoticoncolor); $hsl = wpvr_RGBToHSL($rgb); if ($hsl->lightness > 200) { $foreground_color = '#000000'; } else { $foreground_color = '#fff'; } $class = 'myclass'; $html = 'test'; $html = ''; $html .= ''; $scene_animation = isset($postdata['sceneAnimation']) ? $postdata['sceneAnimation'] : 'off'; if( $scene_animation === 'on'){ $animation_type = isset($postdata['sceneAnimationName']) ? $postdata['sceneAnimationName'] : 'none'; $animationDuration = isset($postdata['sceneAnimationTransitionDuration']) ? $postdata['sceneAnimationTransitionDuration'] : '500ms'; $animationDelay = isset($postdata['sceneAnimationTransitionDelay']) ? $postdata['sceneAnimationTransitionDelay'] : '0ms'; $animation_css = apply_filters('wpvr_tour_scene_animation',$animation_type,$animationDuration, $animationDelay, $postdata,$id); $html .= $animation_css; } if (wpvr_isMobileDevice()) { $html .= '

'; } else { $html .= '
'; } $status = get_option('wpvr_edd_license_status'); $is_cardboard = get_option('wpvr_cardboard_disable'); if ($status !== false && 'valid' == $status && $is_pro && wpvr_isMobileDevice() && $is_cardboard == 'true') { $html .= ''; $html .= ''; } if ($width == 'fullwidth') { if (wpvr_isMobileDevice()) { $html .= '
'; $html .= '
'; $html .= '
'; } else { $html .= '
'; $html .= '
'; } } else { if (wpvr_isMobileDevice()) { $html .= '
'; $html .= '
'; } else { $html .= '
'; $html .= '
'; } } // Vr mode transction scene to scene if ($status !== false && 'valid' == $status && $is_pro && wpvr_isMobileDevice() && $is_cardboard == 'true') { $html .= ''; } //===company logo===// if (isset($postdata['cpLogoSwitch'])) { $cpLogoImg = $postdata['cpLogoImg']; $cpLogoContent = $postdata['cpLogoContent']; if ($postdata['cpLogoSwitch'] == 'on') { $html .= '
'; $html .= ''; $html .= '
'; } } //===company logo ends===// //===Background Tour===// if (isset($postdata['bg_tour_enabler'])) { $bg_tour_enabler = $postdata['bg_tour_enabler']; if ($bg_tour_enabler == 'on') { $bg_tour_navmenu = $postdata['bg_tour_navmenu'] ?? 'off'; $bg_tour_title = $postdata['bg_tour_title'] ?? ''; $bg_tour_subtitle = $postdata['bg_tour_subtitle'] ?? ''; if ($bg_tour_navmenu == 'on') { $menuLocations = get_nav_menu_locations(); $menuID = $menuLocations['primary']; $primaryNav = wp_get_nav_menu_items($menuID); if ($primaryNav) { $html .= '
'; foreach ($primaryNav as $primaryNav_key => $primaryNav_value) { if ($primaryNav_value->menu_item_parent == "0") { $html .= '
  • '; $html .= '' . esc_attr( $primaryNav_value->title ) . ''; $html .= '
      '; foreach ($primaryNav as $pm_key => $pm_value) { if ($pm_value->menu_item_parent == $primaryNav_value->ID) { $html .= '
    • '; $html .= '' . esc_attr( $pm_value->title ) . ''; $html .= '
    • '; } } $html .= '
    '; $html .= '
  • '; } } $html .= '
    '; } } $html .= '
    '; $html .= '
    ' . esc_attr( $bg_tour_title ) . '
    '; $html .= '
    ' . esc_attr( $bg_tour_subtitle ) . '
    '; $html .= '
    '; } } //===Background Tour End===// //===Custom Control===// if (isset($custom_control)) { if ($custom_control['panZoomInSwitch'] == "on" || $custom_control['panZoomOutSwitch'] == "on" || $custom_control['gyroscopeSwitch'] == "on" || $custom_control['backToHomeSwitch'] == "on") { $html .= '
    '; if ($custom_control['backToHomeSwitch'] == "on") { $html .= '
    '; } if ($custom_control['panZoomInSwitch'] == "on") { $html .= '
    '; } if ($custom_control['panZoomOutSwitch'] == "on") { $html .= '
    '; } if ($custom_control['gyroscopeSwitch'] == "on") { $html .= '
    '; } $html .= '
    '; } //===zoom in out Control===// if ($custom_control['panupSwitch'] == "on" || $custom_control['panDownSwitch'] == "on" || $custom_control['panLeftSwitch'] == "on" || $custom_control['panRightSwitch'] == "on" || $custom_control['panFullscreenSwitch'] == "on") { //===Custom Control===// $html .= '
    '; if ($custom_control['panupSwitch'] == "on") { $html .= '
    '; } if ($custom_control['panDownSwitch'] == "on") { $html .= '
    '; } if ($custom_control['panLeftSwitch'] == "on") { $html .= '
    '; } if ($custom_control['panRightSwitch'] == "on") { $html .= '
    '; } if ($custom_control['panFullscreenSwitch'] == "on") { $html .= '
    '; } $html .= '
    '; } //===explainer button===// $explainerControlSwitch = ''; if (isset($custom_control['explainerSwitch'])) { $explainerControlSwitch = $custom_control['explainerSwitch']; } if ($custom_control['explainerSwitch'] == "on") { $explainer_style = empty($postdata['explainerContent']) || ( isset( $postdata['explainerSwitch'] ) && 'off' === $postdata['explainerSwitch'] )? 'pointer-events: none; opacity: 0.5;' : ''; $html .= '
    '; $html .= '
    '; $html .= '
    '; } //===explainer button===// } //===Custom Control===// //===Scene navigation Control===// if (isset($postdata['scene_navigation']) && $postdata['scene_navigation'] === 'on') { $html .= ''; $html .= '
      '; } //===Scene navigation Control===// /** * Generic Form Handler * Renders a generic form with modal functionality if enabled in post data * * @param array $postdata Array containing form configuration data * @param string $id Unique identifier for the form instance * @return string $html Generated HTML content */ // Check if generic form is enabled and validate the setting if (isset($postdata["genericform"]) && $postdata["genericform"] === 'on') { // $shortcode_val = isset($postdata["genericformshortcode"]) && $postdata["genericformshortcode"] !== "" ? do_shortcode($postdata["genericformshortcode"]) : "No shortcode found or shortcode is empty"; // Process shortcode with fallback handling $shortcode_content = ''; if (isset($postdata["genericformshortcode"]) && !empty(trim($postdata["genericformshortcode"]))) { $shortcode_content = do_shortcode($postdata["genericformshortcode"]); } else { $shortcode_content = '

      No shortcode found.

      '; } // Generate the form trigger button $html .= '
      '; $html .= '
      '; $html .= '
      '; // Generate the modal form container $html .= ''; } //=====custom generic form=====// //===Floor map button===// $status = get_option('wpvr_edd_license_status'); if ($status !== false && 'valid' == $status && $is_pro) { if ($floor_plan_enable == "on" && !empty($floor_plan_image)) { $html .= '
      '; $html .= '
      '; $html .= '
      '; } } //===floor map button===// if ($vrgallery) { //===Carousal setup===// $size = ''; if ($vrgallery_icon_size) { $size = 'vrg-icon-size-large'; } $html .= '
      '; $html .= '
      '; $html .= '
      '; $html .= '
      '; $html .= ''; $html .= '
      '; //===Carousal setup end===// } $bg_music = isset($postdata['bg_music']) ? $postdata['bg_music'] : 'off'; $bg_music_url = isset($postdata['bg_music_url']) ? $postdata['bg_music_url'] : ''; $autoplay_bg_music = isset($postdata['autoplay_bg_music']) ? $postdata['autoplay_bg_music'] : 'off'; $loop_bg_music = isset($postdata['loop_bg_music']) ? $postdata['loop_bg_music'] : 'off'; $bg_loop = ($loop_bg_music === 'on') ? 'loop' : ''; $autoplay_attr = ($autoplay_bg_music === 'on') ? 'autoplay' : ''; $audio_muted_attr = ($autoplay_bg_music === 'on') ? 'muted' : ''; $audio_icon_class = 'fa-volume-mute'; // Always start with mute icon if ($bg_music === 'on') { $html .= '
      '; $html .= ''; $html .= ''; $html .= '
      '; } //===Explainer video section===// $explainerContent = ""; if (isset($postdata['explainerContent'])) { $explainerContent = $postdata['explainerContent']; } $html .= ''; //===Explainer video section End===// //===Floor plan section===// $floor_map_image = ""; $floor_map_pointer = array(); $floor_map_scene_id = ''; $floor_plan_custom_color = '#cca92c'; if (isset($postdata['floor_plan_attachment_url'])) { $floor_map_image = $postdata['floor_plan_attachment_url']; $floor_map_pointer = $postdata['floor_plan_pointer_position']; $floor_map_scene_id = $postdata['floor_plan_data_list']; $floor_plan_custom_color = $postdata['floor_plan_custom_color']; } $html .= ''; //===Floor plan section===// $html .= ''; $html .= ''; $html .= '
      '; $html .= '
      '; if ("fullwidth" == $width) { $html .= '
      '; } if ($status !== false && 'valid' == $status && $is_pro) { $call_to_action = isset($postdata['calltoaction']) ? $postdata['calltoaction'] : 'off'; if ('on' == $call_to_action) { $buttontext = isset($postdata['buttontext']) ? $postdata['buttontext'] : ''; $buttonurl = isset($postdata['buttonurl']) ? $postdata['buttonurl'] : ''; $cta_btn_style = isset($postdata['button_configuration']) ? $postdata['button_configuration'] : array(); $button_open_new_tab = isset($cta_btn_style['button_open_new_tab']) ? $cta_btn_style['button_open_new_tab'] : "off"; $target = '_self'; $button_position = isset($cta_btn_style['button_position']) ? $cta_btn_style['button_position'] : ""; $background_color = isset($cta_btn_style['button_background_color']) ? $cta_btn_style['button_background_color'] : ""; $color = isset($cta_btn_style['button_font_color']) ? $cta_btn_style['button_font_color'] : ""; $font_size = isset($cta_btn_style['button_font_size']) ? $cta_btn_style['button_font_size'] : ""; $font_weight = isset($cta_btn_style['button_font_weight']) ? $cta_btn_style['button_font_weight'] : ""; $text_align = isset($cta_btn_style['button_alignment']) ? $cta_btn_style['button_alignment'] : ""; $text_transform = isset($cta_btn_style['button_transform']) ? $cta_btn_style['button_transform'] : ""; $font_style = isset($cta_btn_style['button_text_style']) ? $cta_btn_style['button_text_style'] : ""; $text_decoration = isset($cta_btn_style['button_text_decoration']) ? $cta_btn_style['button_text_decoration'] : ""; $line_height = isset($cta_btn_style['button_line_height']) ? $cta_btn_style['button_line_height'] : ""; $letter_spacing = isset($cta_btn_style['button_letter_spacing']) ? $cta_btn_style['button_letter_spacing'] : ""; $word_spacing = isset($cta_btn_style['button_word_spacing']) ? $cta_btn_style['button_word_spacing'] : ""; $border_width = isset($cta_btn_style['button_border_width']) ? $cta_btn_style['button_border_width'] : ""; $border_style = isset($cta_btn_style['button_border_style']) ? $cta_btn_style['button_border_style'] : ""; $border_color = isset($cta_btn_style['button_border_color']) ? $cta_btn_style['button_border_color'] : ""; $border_radius = isset($cta_btn_style['button_border_radius']) ? $cta_btn_style['button_border_radius'] : ""; $button_pt = isset($cta_btn_style['button_pt']) ? $cta_btn_style['button_pt'] : ""; $button_pr = isset($cta_btn_style['button_pr']) ? $cta_btn_style['button_pr'] : ""; $button_pb = isset($cta_btn_style['button_pb']) ? $cta_btn_style['button_pb'] : ""; $button_pl = isset($cta_btn_style['button_pl']) ? $cta_btn_style['button_pl'] : ""; if ($button_open_new_tab == 'on') { $target = '_blank'; } $style = 'background-color: ' . esc_attr( $background_color ) . '; color: ' . esc_attr( $color ) . '; font-size: ' . esc_attr( $font_size ) . 'px; font-weight: ' . esc_attr( $font_weight ) . '; text-align: center; display: inline-block; text-transform: ' . esc_attr( $text_transform ) . '; font-style: ' . esc_attr( $font_style ) . '; text-decoration: ' . esc_attr( $text_decoration ) . '; line-height: ' . esc_attr( $line_height ) . '; letter-spacing: ' . esc_attr( $letter_spacing ) . 'px; word-spacing: ' . esc_attr( $word_spacing ) . 'px; border: ' . esc_attr( $border_width ) . 'px ' . esc_attr( $border_style ) . ' ' . esc_attr( $border_color ) . '; border-radius: ' . esc_attr( $border_radius ). 'px; padding: ' . esc_attr( $button_pt ) . 'px ' . esc_attr( $button_pr ) . 'px ' . esc_attr( $button_pb ) . 'px ' . esc_attr( $button_pl ) . 'px; '; $html .= ''; } } //script started $html .= ''; $tour_data = []; if(defined("WPVR_PRO_VERSION")){ $tour_data = array( 'explainerControlSwitch' => $explainerControlSwitch ?? false, 'floor_plan_enable' => $floor_plan_enable ?? false, 'floor_plan_image' => $floor_plan_image ?? '', 'custom_control' => $custom_control ?? [], ); } return apply_filters('wpvr_generate_tour_layout_html', $html ,$postdata ,$id, $tour_data); } function sanitize_content_preserve_styles($content) { // Remove script tags completely $content = preg_replace('/]*>.*?<\/script>/si', '', $content); // Remove dangerous protocols $content = preg_replace('/javascript:/i', '', $content); $content = preg_replace('/vbscript:/i', '', $content); $content = preg_replace('/data:/i', '', $content); $content = preg_replace('/about:/i', '', $content); // Remove all event handlers (onclick, onload, etc.) $content = preg_replace('/\s*on\w+\s*=\s*["\'][^"\']*["\']/i', '', $content); $content = preg_replace('/\s*on\w+\s*=\s*[^>\s]+/i', '', $content); // Remove dangerous tags that can execute code $content = preg_replace('/<(object|embed|applet|iframe|frame|frameset|meta|link|base|form|input|button|textarea|select|option)\b[^>]*>/i', '', $content); $content = preg_replace('/<\/(object|embed|applet|iframe|frame|frameset|meta|link|base|form|input|button|textarea|select|option)>/i', '', $content); // Sanitize CSS in style attributes - remove dangerous CSS functions $content = preg_replace_callback('/style\s*=\s*["\']([^"\']*)["\']/', function($matches) { $style = $matches[1]; // Remove dangerous CSS functions $style = preg_replace('/expression\s*\(/i', '', $style); $style = preg_replace('/javascript:/i', '', $style); $style = preg_replace('/vbscript:/i', '', $style); $style = preg_replace('/data:/i', '', $style); $style = preg_replace('/about:/i', '', $style); $style = preg_replace('/url\s*\(\s*["\']?\s*javascript:/i', '', $style); $style = preg_replace('/url\s*\(\s*["\']?\s*vbscript:/i', '', $style); $style = preg_replace('/url\s*\(\s*["\']?\s*data:/i', '', $style); $style = preg_replace('/import\s*["\']?\s*javascript:/i', '', $style); $style = preg_replace('/behavior\s*:/i', '', $style); $style = preg_replace('/-moz-binding\s*:/i', '', $style); return 'style="' . $style . '"'; }, $content); // Sanitize CSS in style tags $content = preg_replace_callback('/]*>(.*?)<\/style>/si', function($matches) { $css = $matches[1]; // Remove dangerous CSS functions $css = preg_replace('/expression\s*\(/i', '', $css); $css = preg_replace('/javascript:/i', '', $css); $css = preg_replace('/vbscript:/i', '', $css); $css = preg_replace('/data:/i', '', $css); $css = preg_replace('/about:/i', '', $css); $css = preg_replace('/url\s*\(\s*["\']?\s*javascript:/i', '', $css); $css = preg_replace('/url\s*\(\s*["\']?\s*vbscript:/i', '', $css); $css = preg_replace('/url\s*\(\s*["\']?\s*data:/i', '', $css); $css = preg_replace('/import\s*["\']?\s*javascript:/i', '', $css); $css = preg_replace('/behavior\s*:/i', '', $css); $css = preg_replace('/-moz-binding\s*:/i', '', $css); return ''; }, $content); // Remove dangerous attributes from any tag $content = preg_replace('/\s*srcdoc\s*=\s*["\'][^"\']*["\']/i', '', $content); $content = preg_replace('/\s*formaction\s*=\s*["\'][^"\']*["\']/i', '', $content); $content = preg_replace('/\s*action\s*=\s*["\'][^"\']*["\']/i', '', $content); // Clean up malformed HTML that might bypass filters $content = preg_replace('/<[^>]*script[^>]*>/i', '', $content); $content = preg_replace('/<[^>]*on\w+[^>]*>/i', '', $content); // Remove comments that might contain dangerous code $content = preg_replace('//s', '', $content); // Remove any remaining dangerous patterns $content = preg_replace('/\beval\s*\(/i', '', $content); $content = preg_replace('/\bsetTimeout\s*\(/i', '', $content); $content = preg_replace('/\bsetInterval\s*\(/i', '', $content); // Final cleanup - remove any orphaned closing tags from removed elements $content = preg_replace('/<\/(script|object|embed|applet|iframe|frame|frameset|meta|link|base|form|input|button|textarea|select|option)>/i', '', $content); // Final pass with wp_kses_post for additional security return wp_kses_post($content); } function wpvr_hex2rgb($colour) { if (isset($colour[0]) && $colour[0] == '#') { $colour = substr($colour, 1); } if (strlen($colour) == 6) { list($r, $g, $b) = array($colour[0] . $colour[1], $colour[2] . $colour[3], $colour[4] . $colour[5]); } elseif (strlen($colour) == 3) { list($r, $g, $b) = array($colour[0] . $colour[0], $colour[1] . $colour[1], $colour[2] . $colour[2]); } else { return false; } $r = hexdec($r); $g = hexdec($g); $b = hexdec($b); return array($r . ', ' . $g . ', ' . $b); } function wpvr_HTMLToRGB($htmlCode) { $r = 0; $g = 0; $b = 0; if (isset($htmlCode[0]) && $htmlCode[0] == '#') { $htmlCode = substr($htmlCode, 1); } if (strlen($htmlCode) == 3) { $htmlCode = $htmlCode[0] . $htmlCode[0] . $htmlCode[1] . $htmlCode[1] . $htmlCode[2] . $htmlCode[2]; } if (isset($htmlCode[0]) && isset($htmlCode[1])) { $r = hexdec($htmlCode[0] . $htmlCode[1]); } if (isset($htmlCode[2]) && isset($htmlCode[3])) { $g = hexdec($htmlCode[2] . $htmlCode[3]); } if (isset($htmlCode[4]) && isset($htmlCode[5])) { $b = hexdec($htmlCode[4] . $htmlCode[5]); } return $b + ($g << 0x8) + ($r << 0x10); } function wpvr_RGBToHSL($RGB) { $r = 0xFF & ($RGB >> 0x10); $g = 0xFF & ($RGB >> 0x8); $b = 0xFF & $RGB; $r = ((float)$r) / 255.0; $g = ((float)$g) / 255.0; $b = ((float)$b) / 255.0; $maxC = max($r, $g, $b); $minC = min($r, $g, $b); $l = ($maxC + $minC) / 2.0; if ($maxC == $minC) { $s = 0; $h = 0; } else { if ($l < .5) { $s = ($maxC - $minC) / ($maxC + $minC); } else { $s = ($maxC - $minC) / (2.0 - $maxC - $minC); } if ($r == $maxC) { $h = ($g - $b) / ($maxC - $minC); } if ($g == $maxC) { $h = 2.0 + ($b - $r) / ($maxC - $minC); } if ($b == $maxC) { $h = 4.0 + ($r - $g) / ($maxC - $minC); } $h = $h / 6.0; } $h = (int)round(255.0 * $h); $s = (int)round(255.0 * $s); $l = (int)round(255.0 * $l); return (object) array('hue' => $h, 'saturation' => $s, 'lightness' => $l); } add_action('rest_api_init', 'wpvr_rest_data_route'); function wpvr_rest_data_route() { register_rest_route('wpvr/v1', '/panodata/', array( 'methods' => 'GET', 'callback' => 'wpvr_rest_data_set', 'permission_callback' => 'wpvr_rest_route_permission' )); } function wpvr_rest_route_permission() { return true; } function wpvr_rest_data_set() { $query = new WP_Query(array( 'post_type' => 'wpvr_item', 'posts_per_page' => -1, )); $wpvr_list = array(); $list_none = array('value' => 0, 'label' => 'None'); array_push($wpvr_list, $list_none); while ($query->have_posts()) { $query->the_post(); $title = mb_convert_encoding(get_the_title(), 'UTF-8', 'HTML-ENTITIES'); $post_id = get_the_ID(); $title = $post_id . ' : ' . $title; $list_ob = array('value' => $post_id, 'label' => $title); array_push($wpvr_list, $list_ob); } return $wpvr_list; } function wpvr_isMobileDevice() { return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]); } function wpvr_directory() { $upload = wp_upload_dir(); $upload_dir = $upload['basedir']; $upload_dir_temp = $upload_dir . '/wpvr/temp/'; if (!is_dir($upload_dir_temp)) { wp_mkdir_p($upload_dir_temp, 0700); } } add_action('admin_init', 'wpvr_directory'); function wpvr_add_role_cap() { $editor_active = get_option('wpvr_editor_active'); $author_active = get_option('wpvr_author_active'); $admin = get_role('administrator'); $admin->add_cap('publish_wpvr_tour'); $admin->add_cap('edit_wpvr_tours'); $admin->add_cap('read_wpvr_tour'); $admin->add_cap('edit_wpvr_tour'); $admin->add_cap('edit_wpvr_tours'); $admin->add_cap('publish_wpvr_tours'); $admin->add_cap('publish_wpvr_tour'); $admin->add_cap('delete_wpvr_tour'); $admin->add_cap('edit_other_wpvr_tours'); $admin->add_cap('delete_other_wpvr_tours'); if ($editor_active == "true") { $editor = get_role('editor'); if ($editor) { $editor->add_cap('publish_wpvr_tour'); $editor->add_cap('edit_wpvr_tours'); $editor->add_cap('read_wpvr_tour'); $editor->add_cap('edit_wpvr_tour'); $editor->add_cap('edit_wpvr_tours'); $editor->add_cap('publish_wpvr_tours'); $editor->add_cap('publish_wpvr_tour'); $editor->add_cap('delete_wpvr_tour'); $editor->add_cap('edit_other_wpvr_tours'); $editor->add_cap('delete_other_wpvr_tours'); } } else { $editor = get_role('editor'); if ($editor) { $editor->remove_cap('publish_wpvr_tour'); $editor->remove_cap('edit_wpvr_tours'); $editor->remove_cap('read_wpvr_tour'); $editor->remove_cap('edit_wpvr_tour'); $editor->remove_cap('edit_wpvr_tours'); $editor->remove_cap('publish_wpvr_tours'); $editor->remove_cap('publish_wpvr_tour'); $editor->remove_cap('delete_wpvr_tour'); $editor->remove_cap('edit_other_wpvr_tours'); $editor->remove_cap('delete_other_wpvr_tours'); } } if ($author_active == "true") { $author = get_role('author'); if ($author) { $author->add_cap('read_wpvr_tour'); $author->add_cap('edit_wpvr_tour'); $author->add_cap('edit_wpvr_tours'); $author->add_cap('publish_wpvr_tours'); $author->add_cap('publish_wpvr_tour'); $author->add_cap('delete_wpvr_tour'); } } else { $author = get_role('author'); if ($author) { $author->remove_cap('read_wpvr_tour'); $author->remove_cap('edit_wpvr_tour'); $author->remove_cap('edit_wpvr_tours'); $author->remove_cap('publish_wpvr_tours'); $author->remove_cap('publish_wpvr_tour'); $author->remove_cap('delete_wpvr_tour'); } } if(is_plugin_active( 'dokan-lite/dokan.php' ) || is_plugin_active( 'dokan-pro/dokan.php' )){ $dokan_vendor_active = get_option('dokan_vendor_active'); if( 'true' === $dokan_vendor_active){ $seller = get_role('seller'); if ($seller) { $seller->add_cap('read_wpvr_tour'); $seller->add_cap('edit_wpvr_tour'); $seller->add_cap('edit_wpvr_tours'); $seller->add_cap('publish_wpvr_tours'); $seller->add_cap('publish_wpvr_tour'); $seller->add_cap('delete_wpvr_tour'); } } else{ $seller = get_role('seller'); if ($seller) { $seller->remove_cap('read_wpvr_tour'); $seller->remove_cap('edit_wpvr_tour'); $seller->remove_cap('edit_wpvr_tours'); $seller->remove_cap('publish_wpvr_tours'); $seller->remove_cap('publish_wpvr_tour'); $seller->remove_cap('delete_wpvr_tour'); } } } } add_action('admin_init', 'wpvr_add_role_cap', 999); function wpvr_role_management_from_post_type($args, $post_type) { if ('wpvr_item' !== $post_type) { return $args; } $editor_active = get_option('wpvr_editor_active'); $author_active = get_option('wpvr_author_active'); $user = wp_get_current_user(); if ($editor_active == "true") { if (in_array('editor', (array) $user->roles)) { $args['show_in_menu'] = true; } } if ($author_active == "true") { if (in_array('author', (array) $user->roles)) { $args['show_in_menu'] = true; } } if(is_plugin_active( 'dokan-lite/dokan.php' ) || is_plugin_active( 'dokan-pro/dokan.php' )){ $dokan_vendor_active = get_option('dokan_vendor_active'); if( 'true' === $dokan_vendor_active){ if (in_array('seller', (array) $user->roles)) { $args['show_in_menu'] = true; } } } return $args; } add_filter('register_post_type_args', 'wpvr_role_management_from_post_type', 10, 2); function wpvr_cache_admin_notice() { $option = get_option('wpvr_warning'); if (!$option) { ?>

      Google Chrome, Mozilla Firefox, Safai or Microsoft Edge', 'wpvr'); ?>

      elements; foreach ($elementsToRegister as $tag) { $manifestPath = __DIR__ . '/vc/' . $tag . '/manifest.json'; $elementBaseUrl = $pluginBaseUrl . '/vc/' . $tag; $elementsApi->add($manifestPath, $elementBaseUrl); } } ); function wpvr_redirect_after_activation($plugin) { if ($plugin == plugin_basename(__FILE__)) { $url = admin_url('admin.php?page=wpvr-setup-wizard'); $url = esc_url($url, FILTER_SANITIZE_URL); exit(wp_safe_redirect($url)); } } //add_action('activated_plugin', 'wpvr_redirect_after_activation'); function replace_callback($matches) { foreach ($matches as $match) { return str_replace('