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.71');
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_CSS_PATH', plugin_dir_url(__FILE__) . 'admin/css/');
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' ) );
define('WPVR_TELEMETRY_API_KEY', 'phc_amk3VQz1P5ZqZOMRRoWM1B41QMFpf3hu8pg7yRfzSXW');
define('WPVR_TELEMETRY_API_SECRET', 'sec_dfb2ab8e84391ae7a0f9');
define('WPVR_TELEMETRY_HOST', 'https://eu.i.posthog.com');
/**
* 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();
// Trigger plugin deactivation tracking
do_action( 'wpvr_plugin_deactivated' );
}
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';
// Include banner classes
require_once plugin_dir_path(__FILE__) . 'admin/classes/class-wpvr-occasion-banner.php';
require_once plugin_dir_path(__FILE__) . 'admin/classes/class-wpvr-sells-notification-bar.php';
require_once plugin_dir_path(__FILE__) . 'admin/classes/class-wpvr-first-tour-banner.php';
require_once plugin_dir_path(__FILE__) . 'admin/classes/class-wpvr-onboarding-notice.php';
require_once plugin_dir_path(__FILE__) . 'admin/classes/class-wpvr-new-user-tour.php';
// Include telemetry class
require_once plugin_dir_path(__FILE__) . 'includes/class-wpvr-linno-telemetry.php';
if ( defined( 'WPB_VC_VERSION' ) ) {
require_once plugin_dir_path( __FILE__ ) . 'builders/wpbakery/wpvr-loader.php';
if ( class_exists( 'Vc_Manager' ) ) {
require_once plugin_dir_path( __FILE__ ) . 'builders/wpbakery/wpvr-element.php';
}
}
/**
* 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(
// 'halloween_deal_2025',
// '2025-10-01 00:00:01',
// '2025-11-05 23:59:59'
// );
if (!defined('WPVR_PRO_VERSION') && 'no' === get_option('wpvr_sell_eid_ul_fitr_2026_notification_bar', 'no')) {
new WPVR_Notification_Bar(
'Eid_Ul_Fitr_2026',
'2026-03-16 00:00:00',
'2026-03-24 23:59:59'
);
}
// Initialize first tour banner
new WPVR_First_Tour_Banner();
// Initialize listing-page onboarding notice ("Remind me later" flow)
new WPVR_Onboarding_Notice();
// Auto-launch guided tour for truly-new users on the Add New Tour page.
new WPVR_New_User_Tour();
// Pro preview banner (shown via JS when free user toggles Advanced Controls)
if (!defined('WPVR_PRO_VERSION')) {
add_action('admin_notices', 'wpvr_render_pro_preview_banner', 11);
}
}
run_wpvr();
/**
* Render Pro preview banner as admin notice.
* Hidden by default; shown via JS when free user toggles Advanced Controls.
*
* @since 8.5.44
*/
function wpvr_render_pro_preview_banner() {
$screen = get_current_screen();
if (!$screen || $screen->id !== 'wpvr_item') {
return;
}
?>
';
$html .= '
';
$html .= '';
}
return $html;
}
}
// Linno telemetry integration
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);
$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);
$origin = '&origin=' . rawurlencode( home_url() );
$html = '';
$html .= '';
// Compatibility check script
$html .= '';
$random_id = 'video_container_' . rand(10000, 99999);
$html .= '
';
// Compatibility check screen (hidden by default and non-interactive unless actively shown)
$html .= '
Checking browser compatibility...
';
// Spinner animation
$html .= '';
// Iframe (initial display set to block)
$html .= '
';
$html .= 'VIDEO ';
$html .= '
';
$html .= '
';
// Custom control bar
$html .= '
';
// Play/Pause button
$html .= '
';
$html .= ' ';
$html .= ' ';
// Time current
$html .= '
0:00 ';
// Progress bar
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
// Time duration
$html .= '
0:00 ';
// Mute button
$html .= '
';
$html .= ' ';
$html .= ' ';
// Volume slider (popup on mute hover)
$html .= '';
$html .= '
';
$html .= ' ';
$html .= '
';
// Fullscreen button
$html .= '
';
$html .= ' ';
$html .= ' ';
$html .= '
'; // Close controls
// Permission request (mobile only)
$html .= '
';
$html .= '
For the best 360° video experience on mobile
';
$html .= '
Allow motion and orientation access ';
$html .= '
';
// Browser warning
$html .= '
';
$html .= '
';
$html .= '
For the best experience, use Chrome or Firefox.
';
$html .= '
Continue Anyway ';
$html .= '
';
// Main script — output via wp_footer to avoid wptexturize mangling && etc.
$wpvr_yt_script = '';
add_action( 'wp_footer', static function () use ( $wpvr_yt_script ) {
echo $wpvr_yt_script; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}, 99 );
$html .= '
'; // Close container
$html .= '
'; // Close outer wrapper
} elseif (strpos($videourl, 'vimeo') !== false) {
$format = new WPVR_Format();
$full_width = $width . ( isset( $width_unit ) ? $width_unit : 'px' );
$full_height = $height . ( isset( $height_unit ) ? $height_unit : 'px' );
$html = $format->prepare_vimeo_video_shortcode_data( $postdata, $full_width, $full_height, $autoplay, $loop, isset( $radius ) ? $radius : '' );
} else {
$html = '';
$html .= '';
$html .= '
' . wp_kses(
$postdata['panoviddata'],
array(
'video' => array(
'id' => array(),
'class' => array(),
'src' => array(),
'controls' => array(),
'autoplay' => array(),
'loop' => array(),
'muted' => array(),
'poster' => array(),
'preload' => array(),
'width' => array(),
'height' => array(),
'style' => array(),
'playsinline' => array(),
'crossorigin' => array(),
'data-*' => true,
),
'source' => array(
'src' => array(),
'type' => array(),
),
'track' => array(
'kind' => array(),
'src' => array(),
'srclang' => array(),
'label' => array(),
'default' => array(),
),
'div' => array(
'id' => array(),
'class' => array(),
'style' => array(),
'data-*' => true,
),
'span' => array(
'id' => array(),
'class' => array(),
'style' => array(),
),
'button' => array(
'id' => array(),
'class' => array(),
'style' => array(),
'type' => array(),
'title' => array(),
),
)
) . '
';
$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'];
$custom_control['gyroSwitch'] = isset($postdata['gyro']) && $postdata['gyro'] ? 'on' : 'off';
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 = "25px";
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 = "55px";
} 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 = "70px";
}
$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 = esc_html($panoscenes["scene-ititle"]);
}
$scene_author = '';
if (isset($panoscenes["scene-author"])) {
$scene_author = esc_html($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'] ?? ''
);
if('fluent_form' !== $hotspot_data["hotspot-type"]){
$on_hover_content = sanitize_content_preserve_styles($on_hover_content ?? '');
$on_click_content = preg_replace_callback('/ ]*>/', "replace_callback", $hotspot_content ?? '');
$on_click_content = sanitize_content_preserve_styles($on_click_content ?? '');
}else{
$on_hover_content = $on_hover_content ?? '';
$on_click_content = $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 || 'fluent_form' === $hotspot_data["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' => sanitize_html_class($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' => sanitize_html_class($hotspot_data['hotspot-title']),
];
}
$hotspot_info = array(
'text' => esc_html(sanitize_text_field($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' && is_plugin_active( 'wpvr-pro/wpvr-pro.php' ) ) {
$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 .= '';
$html .= ' ';
$html .= ' ';
$html .= '';
$html .= ' ';
$html .= ' ';
$html .= ' ';
$html .= '
Normal VR Mode
';
}
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' && 'valid' == $status && $is_pro) {
$html .= '
';
$html .= '
';
if ($cpLogoImg) {
$html .= '
';
}
if ($cpLogoContent) {
$html .= '
' . esc_html( $cpLogoContent ) . '
';
}
$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 .= '
';
}
}
if($is_pro && 'valid' == $status ){
$html .= '
';
$html .= '
' . $bg_tour_title . '
';
$html .= '
' . $bg_tour_subtitle . '
';
$html .= '
';
}
}
}
//===Background Tour End===//
//===Custom Control===//
if (isset($custom_control)) {
if ($custom_control['panZoomInSwitch'] == "on" || $custom_control['panZoomOutSwitch'] == "on" || ( $custom_control['gyroSwitch'] == "on" && $custom_control['gyroscopeSwitch'] == "on") || $custom_control['backToHomeSwitch'] == "on") {
$html .= '
';
if ($custom_control['backToHomeSwitch'] == "on" && 'valid' == $status && $is_pro) {
$html .= '
';
}
if ($custom_control['panZoomInSwitch'] == "on" && 'valid' == $status && $is_pro) {
$html .= '
';
}
if ($custom_control['panZoomOutSwitch'] == "on" && 'valid' == $status && $is_pro) {
$html .= '
';
}
if ($custom_control['gyroSwitch'] == "on" && $custom_control['gyroscopeSwitch'] == "on" && 'valid' == $status && $is_pro) {
$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" ) && 'valid' == $status && $is_pro) {
//===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===//
$html .= wpvr_render_explainer_button(
isset( $custom_control ) ? $custom_control : null,
$postdata,
$is_pro,
$autoload,
$explainer_right,
$id
);
//===explainer button end===//
//===Scene navigation Control===//
if (isset($postdata['scene_navigation']) && $postdata['scene_navigation'] === 'on' && 'valid' == $status && $is_pro) {
$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' && 'valid' == $status && $is_pro) {
// 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 .= '
';
// 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 .= '
';
}
}
//===floor map button===//
if ($vrgallery && 'valid' == $status && $is_pro ) {
//===Carousal setup===//
$size = '';
if ($vrgallery_icon_size) {
$size = 'vrg-icon-size-large';
}
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
if (isset($panodata["scene-list"])) {
foreach ($panodata["scene-list"] as $panoscenes) {
$scene_key = $panoscenes['scene-id'];
if ($vrgallery_title == 'on') {
$scene_key_title = isset($panoscenes['scene-ititle']) ? esc_html($panoscenes['scene-ititle']) : '';
} else {
$scene_key_title = "";
}
if ($panoscenes['scene-type'] == 'cubemap') {
$img_src_url = $panoscenes['scene-attachment-url-face0'];
} else {
$img_src_url = $panoscenes['scene-attachment-url'];
}
$src_to_id = attachment_url_to_postid($img_src_url);
$thumbnail_array = wp_get_attachment_image_src($src_to_id, 'thumbnail');
if ($thumbnail_array) {
$thumbnail = $thumbnail_array[0];
} else {
$thumbnail = $img_src_url;
}
if( isset($postdata['tourLayout']['layout']) && 'layout1' !== $postdata['tourLayout']['layout']) {
$html .= '
' . $scene_key_title . ' ';
}else {
$html .= '
' . $scene_key_title . ' ';
}
}
}
$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' && 'valid' == $status && $is_pro) {
$html .= '
';
$html .= '
Your browser does not support the audio element.
';
$html .= '
';
$html .= '
';
}
//===Explainer video section===//
$explainerContent = "";
if (isset($postdata['explainerContent'])) {
$explainerContent = wpvr_sanitize_iframe_only($postdata['explainerContent']);
}
$html .= '
';
$html .= ' ';
$html .= '' . $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';
$floor_plan_direction_indicator = isset($postdata['floor_plan_direction_indicator']) ? $postdata['floor_plan_direction_indicator'] : 'on';
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 .= '
';
$html .= '
';
$html .= '
';
foreach ($floor_map_pointer as $key => $pointer_position) {
$html .= '
';
// Only add the floor pointer flash SVG if floor_plan_direction_indicator is "on"
if ($floor_plan_direction_indicator === "on") {
$html .= '
';
}
$html .= '
';
}
$html .= '
';
//===Floor plan section===//
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
ob_start();
do_action('wpvr_hotspot_tweak_contents', $scene_data);
$hotspot_content = ob_get_clean();
$html .= $hotspot_content;
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
$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' => ( isset( $custom_control['explainerSwitch'] ) && $custom_control['explainerSwitch'] === 'on' ) ? 'on' : 'off',
'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) {
// Decode HTML entities first (in case content was encoded in database)
$content = html_entity_decode($content, ENT_QUOTES | ENT_HTML5, 'UTF-8');
// Escape