| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* The plugin bootstrap file |
| 5 |
* |
| 6 |
* This file is read by WordPress to generate the plugin information in the plugin |
| 7 |
* admin area. This file also includes all of the dependencies used by the plugin, |
| 8 |
* registers the activation and deactivation functions, and defines a function |
| 9 |
* that starts the plugin. |
| 10 |
* |
| 11 |
* @link http://rextheme.com/ |
| 12 |
* @since 7.3.6 |
| 13 |
* @package Wpvr |
| 14 |
* |
| 15 |
* @wordpress-plugin |
| 16 |
* Plugin Name: WP VR |
| 17 |
* Plugin URI: https://rextheme.com/wpvr/ |
| 18 |
* Description: WP VR - 360 Panorama and virtual tour creator for WordPress is a customized panaroma & virtual builder tool for WordPress Website. |
| 19 |
* Version: 8.5.4 |
| 20 |
* Tested up to: 6.6 |
| 21 |
* Author: Rextheme |
| 22 |
* Author URI: http://rextheme.com/ |
| 23 |
* License: GPL-2.0+ |
| 24 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 25 |
* Text Domain: wpvr |
| 26 |
* Domain Path: /languages |
| 27 |
*/ |
| 28 |
|
| 29 |
// If this file is called directly, abort. |
| 30 |
if (!defined('WPINC')) { |
| 31 |
die; |
| 32 |
} |
| 33 |
|
| 34 |
require plugin_dir_path(__FILE__) . 'elementor/elementor.php'; |
| 35 |
|
| 36 |
/** |
| 37 |
* Currently plugin version. |
| 38 |
* Start at version 1.0.0 and use SemVer - https://semver.org |
| 39 |
* Rename this for your plugin and update it as you release new versions. |
| 40 |
*/ |
| 41 |
define('WPVR_VERSION', '8.5.4'); |
| 42 |
define('WPVR_FILE', __FILE__); |
| 43 |
define("WPVR_PLUGIN_DIR_URL", plugin_dir_url(__FILE__)); |
| 44 |
define("WPVR_PLUGIN_DIR_PATH", plugin_dir_path(__FILE__)); |
| 45 |
define("WPVR_PLUGIN_PUBLIC_DIR_URL", plugin_dir_url(__FILE__) . 'public/'); |
| 46 |
define('WPVR_BASE', plugin_basename(WPVR_FILE)); |
| 47 |
define('WPVR_DEV_MODE', false); |
| 48 |
define('WPVR_JS_PATH', plugin_dir_url(__FILE__) . 'admin/js/'); |
| 49 |
define('WPVR_ASSET_PATH', plugin_dir_url(__FILE__) . 'admin/'); |
| 50 |
define( 'WPVR_WEBHOOK_URL', sanitize_url( 'https://rextheme.com/?mailmint=1&route=webhook&topic=contact&hash=bbd19901-6d42-4ae5-a7a8-01eb1013c553' ) ); |
| 51 |
|
| 52 |
/** |
| 53 |
* The code that runs during plugin activation. |
| 54 |
* This action is documented in includes/class-wpvr-activator.php |
| 55 |
*/ |
| 56 |
function activate_wpvr() |
| 57 |
{ |
| 58 |
require_once plugin_dir_path(__FILE__) . 'includes/class-wpvr-activator.php'; |
| 59 |
Wpvr_Activator::activate(); |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* The code that runs during plugin deactivation. |
| 64 |
* This action is documented in includes/class-wpvr-deactivator.php |
| 65 |
*/ |
| 66 |
function deactivate_wpvr() |
| 67 |
{ |
| 68 |
require_once plugin_dir_path(__FILE__) . 'includes/class-wpvr-deactivator.php'; |
| 69 |
Wpvr_Deactivator::deactivate(); |
| 70 |
} |
| 71 |
|
| 72 |
register_activation_hook(__FILE__, 'activate_wpvr'); |
| 73 |
register_deactivation_hook(__FILE__, 'deactivate_wpvr'); |
| 74 |
|
| 75 |
/** |
| 76 |
* The core plugin class that is used to define internationalization, |
| 77 |
* admin-specific hooks, and public-facing site hooks. |
| 78 |
*/ |
| 79 |
require plugin_dir_path(__FILE__) . 'includes/class-wpvr.php'; |
| 80 |
|
| 81 |
/** |
| 82 |
* Begins execution of the plugin. |
| 83 |
* |
| 84 |
* Since everything within the plugin is registered via hooks, |
| 85 |
* then kicking off the plugin from this point in the file does |
| 86 |
* not affect the page life cycle. |
| 87 |
* |
| 88 |
* @since 7.3.6 |
| 89 |
*/ |
| 90 |
function run_wpvr() |
| 91 |
{ |
| 92 |
|
| 93 |
$plugin = new Wpvr(); |
| 94 |
$plugin->run(); |
| 95 |
|
| 96 |
// black friday banner class initialization |
| 97 |
// new WPVR_Special_Occasion_Banner('eid-al-adha-2024', '2024-06-14 00:00:00', '2024-06-25 23:59:00'); |
| 98 |
|
| 99 |
if (!defined('WPVR_PRO_VERSION') && 'no' === get_option('wpvr_sell_notification_bar', 'no')) { |
| 100 |
new WPVR_Notification_Bar(); |
| 101 |
} |
| 102 |
|
| 103 |
} |
| 104 |
run_wpvr(); |
| 105 |
|
| 106 |
|
| 107 |
/** |
| 108 |
* Array information checker |
| 109 |
* |
| 110 |
* @param mixed $needle |
| 111 |
* @param mixed $haystack |
| 112 |
* @param bool $strict |
| 113 |
* |
| 114 |
* @return bool |
| 115 |
* @since 7.3.6 |
| 116 |
*/ |
| 117 |
function wpvr_in_array_r($needle, $haystack, $strict = false) |
| 118 |
{ |
| 119 |
foreach ($haystack as $item) { |
| 120 |
if ((($strict ? $item === $needle : $item == $needle)) || is_array($item) && wpvr_in_array_r($needle, $item, $strict)) { |
| 121 |
return true; |
| 122 |
} |
| 123 |
} |
| 124 |
return false; |
| 125 |
} |
| 126 |
|
| 127 |
|
| 128 |
/** |
| 129 |
* Initialize the plugin tracker |
| 130 |
* |
| 131 |
* @return void |
| 132 |
* @since 7.3.6 |
| 133 |
*/ |
| 134 |
function appsero_init_tracker_wpvr() |
| 135 |
{ |
| 136 |
if (!class_exists('Appsero\Client')) { |
| 137 |
require_once __DIR__ . '/appsero/src/Client.php'; |
| 138 |
} |
| 139 |
$client = new Appsero\Client('cab9761e-b067-4824-9c71-042df5d58598', 'WP VR', __FILE__); |
| 140 |
|
| 141 |
// Active insights |
| 142 |
$client->insights()->init(); |
| 143 |
} |
| 144 |
|
| 145 |
appsero_init_tracker_wpvr(); |
| 146 |
|
| 147 |
|
| 148 |
function wpvr_block() |
| 149 |
{ |
| 150 |
wp_register_script( |
| 151 |
'wpvr-block', |
| 152 |
plugins_url('build/index.build.js', __FILE__), |
| 153 |
array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor') |
| 154 |
); |
| 155 |
|
| 156 |
if (is_admin()) { |
| 157 |
wp_enqueue_style( |
| 158 |
'gutyblocks/guty-block', |
| 159 |
plugins_url('src/view.css', __FILE__), |
| 160 |
array() |
| 161 |
); |
| 162 |
} |
| 163 |
|
| 164 |
|
| 165 |
if (function_exists('register_block_type')) { |
| 166 |
register_block_type('wpvr/wpvr-block', array( |
| 167 |
'attributes' => array( |
| 168 |
'id' => array( |
| 169 |
'type' => 'string', |
| 170 |
'default' => '0', |
| 171 |
), |
| 172 |
'width' => array( |
| 173 |
'type' => 'string', |
| 174 |
'default' => '600', |
| 175 |
), |
| 176 |
'width_unit' => array( |
| 177 |
'type' => 'string', |
| 178 |
'default' => 'px', |
| 179 |
), |
| 180 |
'height' => array( |
| 181 |
'type' => 'string', |
| 182 |
'default' => '400', |
| 183 |
), |
| 184 |
'height_unit' => array( |
| 185 |
'type' => 'string', |
| 186 |
'default' => 'px', |
| 187 |
), |
| 188 |
'mobile_height' => array( |
| 189 |
'type' => 'string', |
| 190 |
'default' => '300', |
| 191 |
), |
| 192 |
'mobile_height_unit' => array( |
| 193 |
'type' => 'string', |
| 194 |
'default' => 'px', |
| 195 |
), |
| 196 |
'radius' => array( |
| 197 |
'type' => 'string', |
| 198 |
'default' => '0', |
| 199 |
), |
| 200 |
'border_width' => array( |
| 201 |
'type' => 'string', |
| 202 |
'default' => '0px', |
| 203 |
), |
| 204 |
'border_style' => array( |
| 205 |
'type' => 'string', |
| 206 |
'default' => 'none', |
| 207 |
), |
| 208 |
'border_color' => array( |
| 209 |
'type' => 'string', |
| 210 |
'default' => 'none', |
| 211 |
), |
| 212 |
'radius_unit' => array( |
| 213 |
'type' => 'string', |
| 214 |
'default' => 'px', |
| 215 |
), |
| 216 |
'content' => array( |
| 217 |
'type' => 'string', |
| 218 |
'source' => 'html', |
| 219 |
'default' => '<script> </script>' |
| 220 |
), |
| 221 |
), |
| 222 |
'editor_script' => 'wpvr-block', |
| 223 |
'render_callback' => 'wpvr_block_render', |
| 224 |
)); |
| 225 |
} |
| 226 |
} |
| 227 |
|
| 228 |
add_action('init', 'wpvr_block'); |
| 229 |
|
| 230 |
function wpvr_block_render($attributes) |
| 231 |
{ |
| 232 |
|
| 233 |
if (isset($attributes['id'])) { |
| 234 |
$id = $attributes['id']; |
| 235 |
} else { |
| 236 |
$id = 0; |
| 237 |
} |
| 238 |
if (isset($attributes['width'])) { |
| 239 |
$width = $attributes['width']; |
| 240 |
} |
| 241 |
if (isset($attributes['width_unit'])) { |
| 242 |
$width_unit = $attributes['width_unit']; |
| 243 |
} |
| 244 |
if (isset($attributes['height'])) { |
| 245 |
$height = $attributes['height']; |
| 246 |
} |
| 247 |
if (isset($attributes['height_unit'])) { |
| 248 |
$height_unit = $attributes['height_unit']; |
| 249 |
} |
| 250 |
if (isset($attributes['mobile_height'])) { |
| 251 |
$mobile_height = $attributes['mobile_height']; |
| 252 |
} |
| 253 |
if (isset($attributes['mobile_height_unit'])) { |
| 254 |
$mobile_height_unit = $attributes['mobile_height_unit']; |
| 255 |
} |
| 256 |
if (isset($attributes['radius']) && isset($attributes['radius_unit'])) { |
| 257 |
$radius = $attributes['radius'] . $attributes['radius_unit']; |
| 258 |
} |
| 259 |
$border_style = ''; |
| 260 |
if (isset($attributes['border_width'], $attributes['border_style'], $attributes['border_color'])) { |
| 261 |
$border_style = $attributes['border_width'] . ' ' . $attributes['border_style'] . ' ' . $attributes['border_color']; |
| 262 |
} |
| 263 |
|
| 264 |
if (isset($attributes['className'])) { |
| 265 |
$className = $attributes['className']; |
| 266 |
} else { |
| 267 |
$className = ''; |
| 268 |
} |
| 269 |
$get_post = get_post_status($id); |
| 270 |
if ($get_post !== 'publish') { |
| 271 |
return esc_html__('Oops! It seems like this post isn\'t published yet. Stay tuned for updates!', 'wpvr'); |
| 272 |
} |
| 273 |
if (post_password_required($id)) { |
| 274 |
return get_the_password_form(); |
| 275 |
} |
| 276 |
$postdata = get_post_meta($id, 'panodata', true); |
| 277 |
$panoid = 'pano' . $id; |
| 278 |
$panoid2 = 'pano2' . $id; |
| 279 |
|
| 280 |
if (isset($postdata['streetviewdata'])) { |
| 281 |
if (empty($width)) { |
| 282 |
$width = '600px'; |
| 283 |
} |
| 284 |
if (empty($height)) { |
| 285 |
$height = '400px'; |
| 286 |
} |
| 287 |
$streetviewurl = $postdata['streetviewurl']; |
| 288 |
$html = ''; |
| 289 |
$html .= '<div class="vr-streetview ' . $className . '" style="text-align: center; max-width:100%; width:' . $width . $width_unit . '; height:' . $height . $height_unit . '; margin: 0 auto;">'; |
| 290 |
$html .= '<iframe src="' . $streetviewurl . '" frameborder="0" style="border:0; width:100px; height:100%;" allowfullscreen=""></iframe>'; |
| 291 |
$html .= '</div>'; |
| 292 |
|
| 293 |
return $html; |
| 294 |
} |
| 295 |
$is_pro = apply_filters('is_wpvr_pro_active', false); |
| 296 |
|
| 297 |
if (isset($postdata['vidid'])) { |
| 298 |
if (empty($width)) { |
| 299 |
$width = '600'; |
| 300 |
} |
| 301 |
if (empty($height)) { |
| 302 |
$height = '400'; |
| 303 |
} |
| 304 |
$videourl = $postdata['vidurl']; |
| 305 |
|
| 306 |
$videourl = $postdata['vidurl']; |
| 307 |
$autoplay = 'off'; |
| 308 |
if (isset($postdata['autoplay'])) { |
| 309 |
$autoplay = $postdata['autoplay']; |
| 310 |
} |
| 311 |
$loop = 'off'; |
| 312 |
if (isset($postdata['loop'])) { |
| 313 |
$loop = $postdata['loop']; |
| 314 |
} |
| 315 |
|
| 316 |
if (strpos($videourl, 'youtube') > 0 || strpos($videourl, 'youtu') > 0) { |
| 317 |
$explodeid = ''; |
| 318 |
$explodeid = explode("=", $videourl); |
| 319 |
$foundid = ''; |
| 320 |
$muted = '&mute=1'; |
| 321 |
|
| 322 |
if ($autoplay == 'on') { |
| 323 |
$autoplay = '&autoplay=1'; |
| 324 |
} else { |
| 325 |
$autoplay = ''; |
| 326 |
} |
| 327 |
|
| 328 |
if ($loop == 'on') { |
| 329 |
$loop = '&loop=1'; |
| 330 |
} else { |
| 331 |
$loop = ''; |
| 332 |
} |
| 333 |
|
| 334 |
if (strpos($videourl, 'youtu') > 0) { |
| 335 |
$explodeid = explode("/", $videourl); |
| 336 |
$foundid = $explodeid[3] . '?' . $autoplay . $loop; |
| 337 |
$expdata = $explodeid[3]; |
| 338 |
} else { |
| 339 |
$foundid = $explodeid[1] . '?' . $autoplay . $loop; |
| 340 |
$expdata = $explodeid[1]; |
| 341 |
} |
| 342 |
|
| 343 |
$playlist = '&playlist=' . $expdata; |
| 344 |
$playlist = str_replace("?feature=shared", "", $playlist); |
| 345 |
|
| 346 |
$html = ''; |
| 347 |
$html .= '<div class="' . $className . '" style="text-align:center; max-width:100%; width:' . $width . $width_unit . '; height:' . $height . $height_unit . '; border-radius: ' . $radius . '; margin: 0 auto;">'; |
| 348 |
|
| 349 |
$html .= ' |
| 350 |
<iframe src="https://www.youtube.com/embed/' . $expdata . '?rel=0&modestbranding=1' . $loop . '&autohide=1' . $muted . '&showinfo=0&controls=1' . $autoplay . '' . $playlist . '" width="100%" height="100%" style="border-radius: ' . $radius . ';" frameborder="0" allowfullscreen></iframe> |
| 351 |
'; |
| 352 |
$html .= '</div>'; |
| 353 |
} elseif (strpos($videourl, 'vimeo') > 0) { |
| 354 |
$explodeid = ''; |
| 355 |
$explodeid = explode("/", $videourl); |
| 356 |
$foundid = ''; |
| 357 |
|
| 358 |
if ($autoplay == 'on') { |
| 359 |
$autoplay = '&autoplay=1&muted=1'; |
| 360 |
} else { |
| 361 |
$autoplay = ''; |
| 362 |
} |
| 363 |
|
| 364 |
if ($loop == 'on') { |
| 365 |
$loop = '&loop=1'; |
| 366 |
} else { |
| 367 |
$loop = ''; |
| 368 |
} |
| 369 |
|
| 370 |
$foundid = $explodeid[3] . '?' . $autoplay . $loop; |
| 371 |
$html = ''; |
| 372 |
$html .= '<div class="' . $className . '" style="text-align:center; max-width:100%; width:' . $width . $width_unit . '; height:' . $height . $height_unit . '; margin: 0 auto;">'; |
| 373 |
$html .= '<iframe src="https://player.vimeo.com/video/' . $foundid . '" width="' . $width . '" height="' . $height . '" style="border-radius: ' . $radius . ';" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'; |
| 374 |
$html .= '</div>'; |
| 375 |
} else { |
| 376 |
$html = ''; |
| 377 |
$html .= '<div id="pano' . $id . '" class="pano-wrap ' . $className . '" style="max-width:100%; width:' . $width . $width_unit . '; height: ' . $height . $height_unit . '; border-radius:' . $radius . '; margin: 0 auto;">'; |
| 378 |
$html .= '<div style="width:100%; height:100%; border-radius: ' . $radius . ';">' . $postdata['panoviddata'] . '</div>'; |
| 379 |
|
| 380 |
$html .= ' |
| 381 |
<style> |
| 382 |
.video-js { |
| 383 |
border-radius:' . $radius . '; |
| 384 |
} |
| 385 |
.video-js canvas{ |
| 386 |
border-radius:' . $radius . '; |
| 387 |
} |
| 388 |
#pano' . $id . ' .vjs-poster { |
| 389 |
border-radius: ' . $radius . '; |
| 390 |
} |
| 391 |
</style> |
| 392 |
|
| 393 |
'; |
| 394 |
|
| 395 |
// $html .= '<script>'; |
| 396 |
// $html .= 'videojs(' . $postdata['vidid'] . ', {'; |
| 397 |
// $html .= 'plugins: {'; |
| 398 |
// $html .= 'pannellum: {}'; |
| 399 |
// $html .= '}'; |
| 400 |
// $html .= '});'; |
| 401 |
// $html .= '</script>'; |
| 402 |
$html .= '</div>'; |
| 403 |
|
| 404 |
//video js vr setup // |
| 405 |
$html .= '<script>'; |
| 406 |
$html .= ' |
| 407 |
(function (window, videojs) { |
| 408 |
var player = window.player = videojs("' . $postdata['vidid'] . '"); |
| 409 |
player.mediainfo = player.mediainfo || {}; |
| 410 |
player.mediainfo.projection = "equirectangular"; |
| 411 |
|
| 412 |
// AUTO is the default and looks at mediainfo |
| 413 |
var vr = window.vr = player.vr({ projection: "AUTO", debug: true, forceCardboard: false, antialias: false }); |
| 414 |
}(window, window.videojs)); |
| 415 |
|
| 416 |
'; |
| 417 |
$html .= '</script>'; |
| 418 |
//video js vr end // |
| 419 |
} |
| 420 |
return $html; |
| 421 |
} |
| 422 |
|
| 423 |
$control = false; |
| 424 |
if (isset($postdata['showControls'])) { |
| 425 |
$control = $postdata['showControls']; |
| 426 |
} |
| 427 |
|
| 428 |
if ($control) { |
| 429 |
if (isset($postdata['customcontrol'])) { |
| 430 |
$custom_control = $postdata['customcontrol']; |
| 431 |
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") { |
| 432 |
$control = false; |
| 433 |
} |
| 434 |
} |
| 435 |
} |
| 436 |
|
| 437 |
$floor_plan_enable = 'off'; |
| 438 |
$floor_plan_image = ''; |
| 439 |
if (isset($postdata['floor_plan_tour_enabler']) && $postdata['floor_plan_tour_enabler'] == 'on') { |
| 440 |
$floor_plan_enable = $postdata['floor_plan_tour_enabler']; |
| 441 |
if (isset($postdata['floor_plan_attachment_url']) && !empty($postdata['floor_plan_attachment_url'])) { |
| 442 |
$floor_plan_image = $postdata['floor_plan_attachment_url']; |
| 443 |
} |
| 444 |
} |
| 445 |
|
| 446 |
$vrgallery = false; |
| 447 |
if (isset($postdata['vrgallery'])) { |
| 448 |
$vrgallery = $postdata['vrgallery']; |
| 449 |
} |
| 450 |
|
| 451 |
$vrgallery_title = false; |
| 452 |
if (isset($postdata['vrgallery_title'])) { |
| 453 |
$vrgallery_title = $postdata['vrgallery_title']; |
| 454 |
} |
| 455 |
|
| 456 |
$vrgallery_display = false; |
| 457 |
if (isset($postdata['vrgallery_display'])) { |
| 458 |
$vrgallery_display = $postdata['vrgallery_display']; |
| 459 |
} |
| 460 |
$vrgallery_icon_size = false; |
| 461 |
if (isset($postdata['vrgallery_icon_size'])) { |
| 462 |
$vrgallery_icon_size = $postdata['vrgallery_icon_size']; |
| 463 |
} |
| 464 |
|
| 465 |
$gyro = false; |
| 466 |
$gyro_orientation = false; |
| 467 |
if (isset($postdata['gyro'])) { |
| 468 |
$gyro = $postdata['gyro']; |
| 469 |
if (isset($postdata['deviceorientationcontrol'])) { |
| 470 |
$gyro_orientation = $postdata['deviceorientationcontrol']; |
| 471 |
} |
| 472 |
} |
| 473 |
|
| 474 |
$compass = false; |
| 475 |
$audio_right = "5px"; |
| 476 |
if (isset($postdata['compass'])) { |
| 477 |
$compass = $postdata['compass'] == 'on' || $postdata['compass'] != null ? true : false; |
| 478 |
if ($compass) { |
| 479 |
$audio_right = "60px"; |
| 480 |
} |
| 481 |
} |
| 482 |
$floor_map_right = "10px"; |
| 483 |
if ((isset($postdata['compass']) && $postdata['compass'] == 'on') && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on')) { |
| 484 |
$floor_map_right = "85px"; |
| 485 |
} elseif (isset($postdata['compass']) && $postdata['compass'] == 'on') { |
| 486 |
$floor_map_right = "55px"; |
| 487 |
} elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on") { |
| 488 |
$floor_map_right = "25px"; |
| 489 |
} |
| 490 |
|
| 491 |
//===explainer handle===// |
| 492 |
|
| 493 |
//===explainer handle===// |
| 494 |
$explainer_right = "10px"; |
| 495 |
if ((isset($postdata['compass']) && $postdata['compass'] == 'on') && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on') && ($floor_plan_enable == 'on' && !empty($floor_plan_image))) { |
| 496 |
$explainer_right = "130px"; |
| 497 |
} elseif (isset($postdata['compass']) && $postdata['compass'] == 'on' && ($floor_plan_enable == 'on' && !empty($floor_plan_image))) { |
| 498 |
$explainer_right = "100px"; |
| 499 |
} elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on" && ($floor_plan_enable == 'on' && !empty($floor_plan_image))) { |
| 500 |
$explainer_right = "60px"; |
| 501 |
} elseif ((isset($postdata['compass']) && $postdata['compass'] == 'on') && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on')) { |
| 502 |
$explainer_right = "80px"; |
| 503 |
} elseif (isset($postdata['compass']) && $postdata['compass'] == 'on') { |
| 504 |
$explainer_right = "55px"; |
| 505 |
} elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on") { |
| 506 |
$explainer_right = "30px"; |
| 507 |
} elseif ($floor_plan_enable == 'on' && !empty($floor_plan_image)) { |
| 508 |
$explainer_right = "40px"; |
| 509 |
} |
| 510 |
$enable_cardboard = ''; |
| 511 |
$is_cardboard = get_option('wpvr_cardboard_disable'); |
| 512 |
if (wpvr_isMobileDevice() && $is_cardboard == 'true') { |
| 513 |
$enable_cardboard = 'enable-cardboard'; |
| 514 |
$audio_right = "73px"; |
| 515 |
if (isset($postdata['compass'])) { |
| 516 |
$compass = $postdata['compass'] == 'on' || $postdata['compass'] != null ? true : false; |
| 517 |
if ($compass) { |
| 518 |
$audio_right = "130px"; |
| 519 |
} |
| 520 |
} |
| 521 |
|
| 522 |
$floor_map_right = "60px"; |
| 523 |
if ((isset($postdata['compass']) && $postdata['compass'] == 'on') && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on')) { |
| 524 |
$floor_map_right = "150px"; |
| 525 |
} elseif (isset($postdata['compass']) && $postdata['compass'] == 'on') { |
| 526 |
$floor_map_right = "120px"; |
| 527 |
} elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on") { |
| 528 |
$floor_map_right = "90px"; |
| 529 |
} |
| 530 |
|
| 531 |
//===explainer handle===// |
| 532 |
|
| 533 |
$explainer_right = "65px"; |
| 534 |
|
| 535 |
if ((isset($postdata['compass']) && $postdata['compass'] == true) && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on')) { |
| 536 |
$explainer_right = "150px"; |
| 537 |
} elseif ((isset($postdata['compass']) && $postdata['compass'] == true) && (isset($postdata['bg_music']) && $postdata['bg_music'] == 'on') && ($floor_plan_enable == 'on' && !empty($floor_plan_image))) { |
| 538 |
$explainer_right = "180px"; |
| 539 |
} elseif (isset($postdata['compass']) && $postdata['compass'] == true && ($floor_plan_enable == 'on' && !empty($floor_plan_image))) { |
| 540 |
$explainer_right = "150px"; |
| 541 |
} elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on" && ($floor_plan_enable == 'on' && !empty($floor_plan_image))) { |
| 542 |
$explainer_right = "120px"; |
| 543 |
} elseif (isset($postdata['compass']) && $postdata['compass'] == true) { |
| 544 |
$explainer_right = "130px"; |
| 545 |
} elseif (isset($postdata['bg_music']) && $postdata['bg_music'] == "on") { |
| 546 |
$explainer_right = "90px"; |
| 547 |
} elseif ($floor_plan_enable == 'on' && !empty($floor_plan_image)) { |
| 548 |
$explainer_right = "90px"; |
| 549 |
} |
| 550 |
} |
| 551 |
|
| 552 |
//===explainer handle===// |
| 553 |
|
| 554 |
$mouseZoom = true; |
| 555 |
if (isset($postdata['mouseZoom'])) { |
| 556 |
if ($postdata['mouseZoom'] == "off") { |
| 557 |
$mouseZoom = false; |
| 558 |
} else { |
| 559 |
$mouseZoom = true; |
| 560 |
} |
| 561 |
} |
| 562 |
|
| 563 |
$draggable = true; |
| 564 |
if (isset($postdata['draggable'])) { |
| 565 |
$draggable = $postdata['draggable'] == 'on' || $postdata['draggable'] != null ? true : false; |
| 566 |
if ($postdata['draggable'] === 'off') { |
| 567 |
$draggable = false; |
| 568 |
} |
| 569 |
} |
| 570 |
$diskeyboard = false; |
| 571 |
if (isset($postdata['diskeyboard'])) { |
| 572 |
$diskeyboard = $postdata['diskeyboard'] == 'off' || $postdata['diskeyboard'] == null ? false : true; |
| 573 |
} |
| 574 |
|
| 575 |
$keyboardzoom = true; |
| 576 |
if (isset($postdata['keyboardzoom'])) { |
| 577 |
$keyboardzoom = $postdata['keyboardzoom']; |
| 578 |
} |
| 579 |
|
| 580 |
$autoload = false; |
| 581 |
|
| 582 |
if (isset($postdata['autoLoad'])) { |
| 583 |
$autoload = $postdata['autoLoad']; |
| 584 |
} |
| 585 |
|
| 586 |
$default_scene = ''; |
| 587 |
if (isset($postdata['defaultscene'])) { |
| 588 |
$default_scene = $postdata['defaultscene']; |
| 589 |
} |
| 590 |
|
| 591 |
$preview = ''; |
| 592 |
if (isset($postdata['preview'])) { |
| 593 |
$preview = $postdata['preview']; |
| 594 |
} |
| 595 |
|
| 596 |
$autorotation = ''; |
| 597 |
if (isset($postdata["autoRotate"])) { |
| 598 |
$autorotation = $postdata["autoRotate"]; |
| 599 |
} |
| 600 |
$autorotationinactivedelay = ''; |
| 601 |
if (isset($postdata["autoRotateInactivityDelay"])) { |
| 602 |
$autorotationinactivedelay = $postdata["autoRotateInactivityDelay"]; |
| 603 |
} |
| 604 |
$autorotationstopdelay = ''; |
| 605 |
if (isset($postdata["autoRotateStopDelay"])) { |
| 606 |
$autorotationstopdelay = $postdata["autoRotateStopDelay"]; |
| 607 |
} |
| 608 |
|
| 609 |
$scene_fade_duration = ''; |
| 610 |
if (isset($postdata['scenefadeduration'])) { |
| 611 |
$scene_fade_duration = $postdata['scenefadeduration']; |
| 612 |
} |
| 613 |
|
| 614 |
$panodata = array(); |
| 615 |
if (isset($postdata['panodata'])) { |
| 616 |
$panodata = $postdata['panodata']; |
| 617 |
} |
| 618 |
|
| 619 |
$default_zoom_global = 100; |
| 620 |
if (isset($postdata['hfov']) && $postdata['hfov'] != '') { |
| 621 |
$default_zoom_global = $postdata['hfov']; |
| 622 |
} |
| 623 |
|
| 624 |
$min_zoom_global = 50; |
| 625 |
if (isset($postdata['minHfov']) && $postdata['minHfov'] != '') { |
| 626 |
$min_zoom_global = $postdata['minHfov']; |
| 627 |
} |
| 628 |
|
| 629 |
$max_zoom_global = 120; |
| 630 |
if (isset($postdata['maxHfov']) && $postdata['maxHfov'] != '') { |
| 631 |
$max_zoom_global = $postdata['maxHfov']; |
| 632 |
} |
| 633 |
|
| 634 |
$hotspoticoncolor = '#00b4ff'; |
| 635 |
$hotspotblink = 'on'; |
| 636 |
$default_data = array(); |
| 637 |
$default_data = array('firstScene' => $default_scene, 'sceneFadeDuration' => $scene_fade_duration, 'hfov' => $default_zoom_global, 'maxHfov' => $max_zoom_global, 'minHfov' => $min_zoom_global); |
| 638 |
$scene_data = array(); |
| 639 |
if (is_array($panodata) && isset($panodata['scene-list'])) { |
| 640 |
if (!empty($panodata['scene-list'])) { |
| 641 |
foreach ($panodata['scene-list'] as $panoscenes) { |
| 642 |
$scene_ititle = ''; |
| 643 |
if (isset($panoscenes["scene-ititle"])) { |
| 644 |
$scene_ititle = sanitize_text_field($panoscenes["scene-ititle"]); |
| 645 |
} |
| 646 |
|
| 647 |
$scene_author = ''; |
| 648 |
if (isset($panoscenes["scene-author"])) { |
| 649 |
$scene_author = sanitize_text_field($panoscenes["scene-author"]); |
| 650 |
} |
| 651 |
|
| 652 |
$scene_author_url = ''; |
| 653 |
if (isset($panoscenes["scene-author-url"])) { |
| 654 |
$scene_author_url = sanitize_text_field($panoscenes["scene-author-url"]); |
| 655 |
} |
| 656 |
|
| 657 |
$scene_vaov = 180; |
| 658 |
if (isset($panoscenes["scene-vaov"])) { |
| 659 |
$scene_vaov = (float)$panoscenes["scene-vaov"]; |
| 660 |
} |
| 661 |
|
| 662 |
$scene_haov = 360; |
| 663 |
if (isset($panoscenes["scene-haov"])) { |
| 664 |
$scene_haov = (float)$panoscenes["scene-haov"]; |
| 665 |
} |
| 666 |
|
| 667 |
$scene_vertical_offset = 0; |
| 668 |
if (isset($panoscenes["scene-vertical-offset"])) { |
| 669 |
$scene_vertical_offset = (float)$panoscenes["scene-vertical-offset"]; |
| 670 |
} |
| 671 |
|
| 672 |
$default_scene_pitch = null; |
| 673 |
if (isset($panoscenes["scene-pitch"])) { |
| 674 |
$default_scene_pitch = (float)$panoscenes["scene-pitch"]; |
| 675 |
} |
| 676 |
|
| 677 |
$default_scene_yaw = null; |
| 678 |
if (isset($panoscenes["scene-yaw"])) { |
| 679 |
$default_scene_yaw = (float)$panoscenes["scene-yaw"]; |
| 680 |
} |
| 681 |
|
| 682 |
$scene_max_pitch = ''; |
| 683 |
if (isset($panoscenes["scene-maxpitch"])) { |
| 684 |
$scene_max_pitch = (float)$panoscenes["scene-maxpitch"]; |
| 685 |
} |
| 686 |
|
| 687 |
|
| 688 |
$scene_min_pitch = ''; |
| 689 |
if (isset($panoscenes["scene-minpitch"])) { |
| 690 |
$scene_min_pitch = (float)$panoscenes["scene-minpitch"]; |
| 691 |
} |
| 692 |
|
| 693 |
|
| 694 |
$scene_max_yaw = ''; |
| 695 |
if (isset($panoscenes["scene-maxyaw"])) { |
| 696 |
$scene_max_yaw = (float)$panoscenes["scene-maxyaw"]; |
| 697 |
} |
| 698 |
|
| 699 |
|
| 700 |
$scene_min_yaw = ''; |
| 701 |
if (isset($panoscenes["scene-minyaw"])) { |
| 702 |
$scene_min_yaw = (float)$panoscenes["scene-minyaw"]; |
| 703 |
} |
| 704 |
|
| 705 |
$default_zoom = 100; |
| 706 |
if (isset($panoscenes["scene-zoom"]) && $panoscenes["scene-zoom"] != '') { |
| 707 |
$default_zoom = (int)$panoscenes["scene-zoom"]; |
| 708 |
} else { |
| 709 |
if ($default_zoom_global != '') { |
| 710 |
$default_zoom = (int)$default_zoom_global; |
| 711 |
} |
| 712 |
} |
| 713 |
|
| 714 |
|
| 715 |
$max_zoom = 120; |
| 716 |
if (isset($panoscenes["scene-maxzoom"]) && $panoscenes["scene-maxzoom"] != '') { |
| 717 |
$max_zoom = (int)$panoscenes["scene-maxzoom"]; |
| 718 |
} else { |
| 719 |
if ($max_zoom_global != '') { |
| 720 |
$max_zoom = (int)$max_zoom_global; |
| 721 |
} |
| 722 |
} |
| 723 |
|
| 724 |
$min_zoom = 120; |
| 725 |
if (isset($panoscenes["scene-minzoom"]) && $panoscenes["scene-minzoom"] != '') { |
| 726 |
$min_zoom = (int)$panoscenes["scene-minzoom"]; |
| 727 |
} else { |
| 728 |
if ($min_zoom_global != '') { |
| 729 |
$min_zoom = (int)$min_zoom_global; |
| 730 |
} |
| 731 |
} |
| 732 |
|
| 733 |
$hotspot_datas = array(); |
| 734 |
if (isset($panoscenes['hotspot-list'])) { |
| 735 |
$hotspot_datas = $panoscenes['hotspot-list']; |
| 736 |
} |
| 737 |
|
| 738 |
$hotspots = array(); |
| 739 |
|
| 740 |
foreach ($hotspot_datas as $hotspot_data) { |
| 741 |
$status = get_option('wpvr_edd_license_status'); |
| 742 |
if ($status !== false && $status == 'valid') { |
| 743 |
|
| 744 |
if (isset($hotspot_data["hotspot-customclass-pro"]) && $hotspot_data["hotspot-customclass-pro"] != 'none') { |
| 745 |
$hotspot_data['hotspot-customclass'] = $hotspot_data["hotspot-customclass-pro"] . ' custom-' . $id . '-' . $panoscenes['scene-id'] . '-' . $hotspot_data['hotspot-title']; |
| 746 |
} |
| 747 |
if (isset($hotspot_data['hotspot-blink'])) { |
| 748 |
$hotspotblink = $hotspot_data['hotspot-blink']; |
| 749 |
} |
| 750 |
} |
| 751 |
$hotspot_scene_pitch = ''; |
| 752 |
if (isset($hotspot_data["hotspot-scene-pitch"])) { |
| 753 |
$hotspot_scene_pitch = $hotspot_data["hotspot-scene-pitch"]; |
| 754 |
} |
| 755 |
$hotspot_scene_yaw = ''; |
| 756 |
if (isset($hotspot_data["hotspot-scene-yaw"])) { |
| 757 |
$hotspot_scene_yaw = $hotspot_data["hotspot-scene-yaw"]; |
| 758 |
} |
| 759 |
|
| 760 |
$hotspot_type = $hotspot_data["hotspot-type"] !== 'scene' ? 'info' : $hotspot_data["hotspot-type"]; |
| 761 |
$hotspot_content = ''; |
| 762 |
|
| 763 |
ob_start(); |
| 764 |
do_action('wpvr_hotspot_content', $hotspot_data); |
| 765 |
$hotspot_content = ob_get_clean(); |
| 766 |
|
| 767 |
if (!$hotspot_content) { |
| 768 |
$hotspot_content = $hotspot_data["hotspot-content"]; |
| 769 |
} |
| 770 |
|
| 771 |
if (isset($hotspot_data["wpvr_url_open"][0])) { |
| 772 |
$wpvr_url_open = $hotspot_data["wpvr_url_open"][0]; |
| 773 |
} else { |
| 774 |
$wpvr_url_open = "off"; |
| 775 |
} |
| 776 |
$on_hover_content = preg_replace_callback('/<img[^>]*>/', "replace_callback", $hotspot_data['hotspot-hover']); |
| 777 |
$on_click_content = preg_replace_callback('/<img[^>]*>/', "replace_callback", $hotspot_content); |
| 778 |
$hotspot_shape = 'round'; |
| 779 |
if (isset($hotspot_data["hotspot-customclass-pro"]) && $hotspot_data["hotspot-customclass-pro"] != 'none') { |
| 780 |
$hotspot_shape = isset($hotspot_data["hotspot-shape"]) ? $hotspot_data["hotspot-shape"] : 'round'; |
| 781 |
} |
| 782 |
$hotspot_info = array( |
| 783 |
'text' => $hotspot_data['hotspot-title'], |
| 784 |
'pitch' => $hotspot_data['hotspot-pitch'], |
| 785 |
'yaw' => $hotspot_data['hotspot-yaw'], |
| 786 |
'type' => $hotspot_type, |
| 787 |
'cssClass' => $hotspot_data['hotspot-customclass'], |
| 788 |
'URL' => $hotspot_data['hotspot-url'], |
| 789 |
"wpvr_url_open" => $wpvr_url_open, |
| 790 |
"clickHandlerArgs" => $on_click_content, |
| 791 |
// "clickHandlerArgs" => $hotspot_content, |
| 792 |
// 'createTooltipArgs' => $hotspot_data['hotspot-hover'], |
| 793 |
'createTooltipArgs' => $on_hover_content, |
| 794 |
"sceneId" => $hotspot_data["hotspot-scene"], |
| 795 |
"targetPitch" => (float)$hotspot_scene_pitch, |
| 796 |
"targetYaw" => (float)$hotspot_scene_yaw, |
| 797 |
'hotspot_type' => $hotspot_data['hotspot-type'], |
| 798 |
'hotspot_shape' => $hotspot_shape, |
| 799 |
); |
| 800 |
|
| 801 |
$hotspot_info['URL'] = ($hotspot_data['hotspot-type'] === 'fluent_form' || $hotspot_data['hotspot-type'] === 'wc_product') ? '' : $hotspot_info['URL']; |
| 802 |
|
| 803 |
if ($hotspot_data["hotspot-customclass"] == 'none' || $hotspot_data["hotspot-customclass"] == '') { |
| 804 |
unset($hotspot_info["cssClass"]); |
| 805 |
} |
| 806 |
if (empty($hotspot_data["hotspot-scene"])) { |
| 807 |
unset($hotspot_info['targetPitch']); |
| 808 |
unset($hotspot_info['targetYaw']); |
| 809 |
} |
| 810 |
array_push($hotspots, $hotspot_info); |
| 811 |
} |
| 812 |
|
| 813 |
$device_scene = $panoscenes['scene-attachment-url']; |
| 814 |
$mobile_media_resize = get_option('mobile_media_resize'); |
| 815 |
$file_accessible = ini_get('allow_url_fopen'); |
| 816 |
if ($mobile_media_resize == "true" && $device_scene) { |
| 817 |
if ($file_accessible == "1") { |
| 818 |
$image_info = getimagesize($device_scene); |
| 819 |
if ($image_info && $image_info[0] > 4096) { |
| 820 |
$src_to_id_for_mobile = ''; |
| 821 |
$src_to_id_for_desktop = ''; |
| 822 |
if (wpvr_isMobileDevice()) { |
| 823 |
$src_to_id_for_mobile = attachment_url_to_postid($panoscenes['scene-attachment-url']); |
| 824 |
if ($src_to_id_for_mobile) { |
| 825 |
$mobile_scene = wp_get_attachment_image_src($src_to_id_for_mobile, 'wpvr_mobile'); |
| 826 |
if ($mobile_scene[3]) { |
| 827 |
$device_scene = $mobile_scene[0]; |
| 828 |
} |
| 829 |
} |
| 830 |
} else { |
| 831 |
$src_to_id_for_desktop = attachment_url_to_postid($panoscenes['scene-attachment-url']); |
| 832 |
if ($src_to_id_for_desktop) { |
| 833 |
$desktop_scene = wp_get_attachment_image_src($src_to_id_for_mobile, 'full'); |
| 834 |
if ($desktop_scene && $desktop_scene[0]) { |
| 835 |
$device_scene = $desktop_scene[0]; |
| 836 |
} |
| 837 |
} |
| 838 |
} |
| 839 |
} |
| 840 |
} |
| 841 |
} |
| 842 |
|
| 843 |
$scene_info = array(); |
| 844 |
|
| 845 |
if ($panoscenes["scene-type"] == 'cubemap') { |
| 846 |
$pano_type = 'cubemap'; |
| 847 |
$pano_attachment = array( |
| 848 |
$panoscenes["scene-attachment-url-face0"], |
| 849 |
$panoscenes["scene-attachment-url-face1"], |
| 850 |
$panoscenes["scene-attachment-url-face2"], |
| 851 |
$panoscenes["scene-attachment-url-face3"], |
| 852 |
$panoscenes["scene-attachment-url-face4"], |
| 853 |
$panoscenes["scene-attachment-url-face5"] |
| 854 |
); |
| 855 |
|
| 856 |
$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); |
| 857 |
} else { |
| 858 |
$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); |
| 859 |
} |
| 860 |
|
| 861 |
|
| 862 |
|
| 863 |
if (isset($panoscenes["ptyscene"])) { |
| 864 |
if ($panoscenes["ptyscene"] == "off") { |
| 865 |
unset($scene_info['pitch']); |
| 866 |
unset($scene_info['yaw']); |
| 867 |
} |
| 868 |
} |
| 869 |
|
| 870 |
if (empty($panoscenes["scene-ititle"])) { |
| 871 |
unset($scene_info['title']); |
| 872 |
} |
| 873 |
if (empty($panoscenes["scene-author"])) { |
| 874 |
unset($scene_info['author']); |
| 875 |
} |
| 876 |
if (empty($panoscenes["scene-author-url"])) { |
| 877 |
unset($scene_info['authorURL']); |
| 878 |
} |
| 879 |
|
| 880 |
if (empty($scene_vaov)) { |
| 881 |
unset($scene_info['vaov']); |
| 882 |
} |
| 883 |
|
| 884 |
if (empty($scene_haov)) { |
| 885 |
unset($scene_info['haov']); |
| 886 |
} |
| 887 |
|
| 888 |
if (empty($scene_vertical_offset)) { |
| 889 |
unset($scene_info['vOffset']); |
| 890 |
} |
| 891 |
|
| 892 |
if (isset($panoscenes["cvgscene"])) { |
| 893 |
if ($panoscenes["cvgscene"] == "off") { |
| 894 |
unset($scene_info['maxPitch']); |
| 895 |
unset($scene_info['minPitch']); |
| 896 |
} |
| 897 |
} |
| 898 |
if (empty($panoscenes["scene-maxpitch"])) { |
| 899 |
unset($scene_info['maxPitch']); |
| 900 |
} |
| 901 |
|
| 902 |
if (empty($panoscenes["scene-minpitch"])) { |
| 903 |
unset($scene_info['minPitch']); |
| 904 |
} |
| 905 |
|
| 906 |
if (isset($panoscenes["chgscene"])) { |
| 907 |
if ($panoscenes["chgscene"] == "off") { |
| 908 |
unset($scene_info['maxYaw']); |
| 909 |
unset($scene_info['minYaw']); |
| 910 |
} |
| 911 |
} |
| 912 |
if (empty($panoscenes["scene-maxyaw"])) { |
| 913 |
unset($scene_info['maxYaw']); |
| 914 |
} |
| 915 |
|
| 916 |
if (empty($panoscenes["scene-minyaw"])) { |
| 917 |
unset($scene_info['minYaw']); |
| 918 |
} |
| 919 |
|
| 920 |
// if (isset($panoscenes["czscene"])) { |
| 921 |
// if ($panoscenes["czscene"] == "off") { |
| 922 |
// unset($scene_info['hfov']); |
| 923 |
// unset($scene_info['maxHfov']); |
| 924 |
// unset($scene_info['minHfov']); |
| 925 |
// } |
| 926 |
// } |
| 927 |
|
| 928 |
$scene_array = array(); |
| 929 |
$scene_array = array( |
| 930 |
$panoscenes['scene-id'] => $scene_info |
| 931 |
); |
| 932 |
|
| 933 |
$scene_data[$panoscenes['scene-id']] = $scene_info; |
| 934 |
} |
| 935 |
} |
| 936 |
} |
| 937 |
$pano_id_array = array(); |
| 938 |
$pano_id_array = array('panoid' => $panoid); |
| 939 |
$pano_response = array(); |
| 940 |
$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); |
| 941 |
if (empty($autorotation)) { |
| 942 |
unset($pano_response['autoRotate']); |
| 943 |
unset($pano_response['autoRotateInactivityDelay']); |
| 944 |
unset($pano_response['autoRotateStopDelay']); |
| 945 |
} |
| 946 |
if (empty($autorotationinactivedelay)) { |
| 947 |
unset($pano_response['autoRotateInactivityDelay']); |
| 948 |
} |
| 949 |
if (empty($autorotationstopdelay)) { |
| 950 |
unset($pano_response['autoRotateStopDelay']); |
| 951 |
} |
| 952 |
|
| 953 |
$response = array(); |
| 954 |
$response = array($pano_id_array, $pano_response); |
| 955 |
if (!empty($response)) { |
| 956 |
$response = json_encode($response); |
| 957 |
} |
| 958 |
if (empty($width)) { |
| 959 |
$width = '600'; |
| 960 |
} |
| 961 |
if (empty($height)) { |
| 962 |
$height = '400'; |
| 963 |
} |
| 964 |
if ('fullwidth' == $width) { |
| 965 |
$width = "100%"; |
| 966 |
} |
| 967 |
|
| 968 |
$foreground_color = '#fff'; |
| 969 |
$pulse_color = wpvr_hex2rgb($hotspoticoncolor); |
| 970 |
$rgb = wpvr_HTMLToRGB($hotspoticoncolor); |
| 971 |
$hsl = wpvr_RGBToHSL($rgb); |
| 972 |
if ($hsl->lightness > 200) { |
| 973 |
$foreground_color = '#000000'; |
| 974 |
} else { |
| 975 |
$foreground_color = '#fff'; |
| 976 |
} |
| 977 |
|
| 978 |
$class = 'myclass'; |
| 979 |
$html = 'test'; |
| 980 |
$html = ''; |
| 981 |
$html .= '<style>'; |
| 982 |
if ($width == 'embed') { |
| 983 |
$html .= 'body{ |
| 984 |
overflow: hidden; |
| 985 |
}'; |
| 986 |
} |
| 987 |
$status = get_option('wpvr_edd_license_status'); |
| 988 |
$status = get_option('wpvr_edd_license_status'); |
| 989 |
if ($status !== false && $status == 'valid') { |
| 990 |
if (isset($postdata['customcss_enable']) && $postdata['customcss_enable'] == 'on') { |
| 991 |
$html .= isset($postdata['customcss']) ? $postdata['customcss'] : ''; |
| 992 |
} |
| 993 |
} |
| 994 |
if ($status !== false && $status == 'valid') { |
| 995 |
if (is_array($panodata) && isset($panodata['scene-list'])) { |
| 996 |
foreach ($panodata['scene-list'] as $panoscenes) { |
| 997 |
|
| 998 |
foreach ($panoscenes['hotspot-list'] as $hotspot) { |
| 999 |
if (isset($hotspot['hotspot-customclass-color-icon-value']) && !empty($hotspot['hotspot-customclass-color-icon-value'])) { |
| 1000 |
$hotspoticoncolor = $hotspot['hotspot-customclass-color-icon-value']; |
| 1001 |
} else { |
| 1002 |
$hotspoticoncolor = "#00b4ff"; |
| 1003 |
} |
| 1004 |
$hotspot_border = ''; |
| 1005 |
if(isset($hotspot['hotspot-border']) && $hotspot['hotspot-border'] == 'on'){ |
| 1006 |
$border_width = $hotspot['hotspot-border-width']; |
| 1007 |
$border_color = $hotspot['hotspot-border-color']; |
| 1008 |
$border_style = $hotspot['hotspot-border-style']; |
| 1009 |
$hotspot_border = 'border: '.$border_width.'px '.$border_style.' '.$border_color.';'; |
| 1010 |
} |
| 1011 |
$hotspot_background_color = 'background-color: ' . $hotspoticoncolor . ';'; |
| 1012 |
$hotspot_animation = ' animation: icon-pulse' . $panoid . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . ' 1.5s infinite cubic-bezier(.25, 0, 0, 1); |
| 1013 |
'. $hotspot_border.''; |
| 1014 |
|
| 1015 |
|
| 1016 |
$pulse_color = wpvr_hex2rgb($hotspoticoncolor); |
| 1017 |
if (isset($hotspot["hotspot-customclass-pro"]) && $hotspot["hotspot-customclass-pro"] != 'none') { |
| 1018 |
$border_radius = ' border-radius: 100%;'; |
| 1019 |
$hotspot_shape = isset($hotspot["hotspot-shape"]) ? $hotspot["hotspot-shape"] : 'round'; |
| 1020 |
if($hotspot_shape === 'square'){ |
| 1021 |
$border_radius = ''; |
| 1022 |
} |
| 1023 |
if ($hotspot_shape === 'hexagon') { |
| 1024 |
$border_radius = ''; |
| 1025 |
$hotspot_background_color = 'background-color: transparent;'; |
| 1026 |
$hotspot_animation = ''; |
| 1027 |
} |
| 1028 |
|
| 1029 |
if(isset($hotspot['hotspot-custom-icon-color-value']) && !empty($hotspot['hotspot-custom-icon-color-value'])){ |
| 1030 |
$foreground_color = $hotspot['hotspot-custom-icon-color-value']; |
| 1031 |
} |
| 1032 |
$html .= '#' . $panoid . ' div.pnlm-hotspot-base.fas.custom-' . $id . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . ', |
| 1033 |
#' . $panoid . ' div.pnlm-hotspot-base.fab.custom-' . $id . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . ', |
| 1034 |
#' . $panoid . ' div.pnlm-hotspot-base.fa.custom-' . $id . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . ', |
| 1035 |
#' . $panoid . ' div.pnlm-hotspot-base.fa-solid.custom-' . $id . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . ', |
| 1036 |
#' . $panoid . ' div.pnlm-hotspot-base.far.custom-' . $id . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . ' { |
| 1037 |
display: block !important; |
| 1038 |
'.$hotspot_background_color.' |
| 1039 |
color: ' . $foreground_color . '; |
| 1040 |
'.$border_radius.' |
| 1041 |
width: 30px; |
| 1042 |
height: 30px; |
| 1043 |
font-size: 16px; |
| 1044 |
line-height: 30px; |
| 1045 |
'.$hotspot_animation.' |
| 1046 |
}'; |
| 1047 |
if($hotspot_shape === 'hexagon'){ |
| 1048 |
|
| 1049 |
$html .= '#' . $panoid . ' .custom-' . $id . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . ' .hexagon-wrapper svg path { |
| 1050 |
fill: ' . $hotspoticoncolor . '; |
| 1051 |
}'; |
| 1052 |
|
| 1053 |
$html .= '#' . $panoid . ' .custom-' . $id . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . '.pnlm-tooltip:after{ |
| 1054 |
content: ""; |
| 1055 |
position: absolute; |
| 1056 |
left: 50%; |
| 1057 |
top: 50%; |
| 1058 |
transform: translate(-50%, -50%); |
| 1059 |
width: 85%; |
| 1060 |
height: 85%; |
| 1061 |
animation: icon-pulse' . $panoid . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . ' 1.5s infinite cubic-bezier(.25, 0, 0, 1); |
| 1062 |
border-radius: 100%; |
| 1063 |
z-index: -2; |
| 1064 |
}'; |
| 1065 |
|
| 1066 |
} |
| 1067 |
$html .= '#' . $panoid2 . ' div.pnlm-hotspot-base.fas.custom-' . $id . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . ', |
| 1068 |
#' . $panoid2 . ' div.pnlm-hotspot-base.fab.custom-' . $id . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . ', |
| 1069 |
#' . $panoid2 . ' div.pnlm-hotspot-base.fa-solid.custom-' . $id . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . ', |
| 1070 |
#' . $panoid2 . ' div.pnlm-hotspot-base.fa.custom-' . $id . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . ', |
| 1071 |
#' . $panoid2 . ' div.pnlm-hotspot-base.far.custom-' . $id . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . ' { |
| 1072 |
display: block !important; |
| 1073 |
'.$hotspot_background_color.' |
| 1074 |
color: ' . $foreground_color . '; |
| 1075 |
'.$border_radius.' |
| 1076 |
width: 30px; |
| 1077 |
height: 30px; |
| 1078 |
font-size: 16px; |
| 1079 |
line-height: 30px; |
| 1080 |
'.$hotspot_animation.' |
| 1081 |
}'; |
| 1082 |
} |
| 1083 |
if (isset($hotspot['hotspot-blink'])) { |
| 1084 |
$hotspotblink = $hotspot['hotspot-blink']; |
| 1085 |
if ($hotspotblink == 'on') { |
| 1086 |
$html .= '@-webkit-keyframes icon-pulse' . $panoid . '-' . $panoscenes['scene-id'] . '-' . $hotspot['hotspot-title'] . ' { |
| 1087 |
0% { |
| 1088 |
box-shadow: 0 0 0 0px rgba(' . $pulse_color[0] . ', 1); |
| 1089 |
} |
| 1090 |
100% { |
| 1091 |
box-shadow: 0 0 0 10px rgba(' . $pulse_color[0] . ', 0); |
| 1092 |
} |
| 1093 |
} |
| 1094 |
@keyframes icon-pulse' . $panoid . ' { |
| 1095 |
0% { |
| 1096 |
box-shadow: 0 0 0 0px rgba(' . $pulse_color[0] . ', 1); |
| 1097 |
} |
| 1098 |
100% { |
| 1099 |
box-shadow: 0 0 0 10px rgba(' . $pulse_color[0] . ', 0); |
| 1100 |
} |
| 1101 |
}'; |
| 1102 |
} |
| 1103 |
} |
| 1104 |
} |
| 1105 |
} |
| 1106 |
} |
| 1107 |
} |
| 1108 |
|
| 1109 |
$status = get_option('wpvr_edd_license_status'); |
| 1110 |
if ($status !== false && $status == 'valid') { |
| 1111 |
if (!$gyro) { |
| 1112 |
$html .= '#' . $panoid . ' div.pnlm-orientation-button { |
| 1113 |
display: none; |
| 1114 |
}'; |
| 1115 |
} |
| 1116 |
} else { |
| 1117 |
$html .= '#' . $panoid . ' div.pnlm-orientation-button { |
| 1118 |
display: none; |
| 1119 |
}'; |
| 1120 |
} |
| 1121 |
$floor_plan_custom_color = isset($postdata['floor_plan_custom_color']) ? $postdata['floor_plan_custom_color'] : '#cca92c'; |
| 1122 |
$foreground_color_pointer = '#fff'; |
| 1123 |
if ($floor_plan_custom_color != '') { |
| 1124 |
$pointer_pulse = wpvr_hex2rgb($floor_plan_custom_color); |
| 1125 |
$floor_rgb = wpvr_HTMLToRGB($floor_plan_custom_color); |
| 1126 |
$floor_hsl = wpvr_RGBToHSL($floor_rgb); |
| 1127 |
if ($floor_hsl->lightness > 200) { |
| 1128 |
$foreground_color_pointer = '#000000'; |
| 1129 |
} |
| 1130 |
$html .= ' |
| 1131 |
.wpvr-floor-map .floor-plan-pointer.add-pulse:before { |
| 1132 |
border: 17px solid ' . $floor_plan_custom_color . '; |
| 1133 |
} |
| 1134 |
@-webkit-keyframes pulse { |
| 1135 |
0% { |
| 1136 |
-webkit-box-shadow: 0 0 0 0 rgba(' . $pointer_pulse[0] . ', 0.7); |
| 1137 |
} |
| 1138 |
70% { |
| 1139 |
-webkit-box-shadow: 0 0 0 10px rgba(' . $pointer_pulse[0] . ', 0); |
| 1140 |
} |
| 1141 |
100% { |
| 1142 |
-webkit-box-shadow: 0 0 0 0 rgba(' . $pointer_pulse[0] . ', 0); |
| 1143 |
} |
| 1144 |
} |
| 1145 |
@keyframes pulse { |
| 1146 |
0% { |
| 1147 |
-moz-box-shadow: 0 0 0 0 rgba(' . $pointer_pulse[0] . ', 0.7); |
| 1148 |
box-shadow: 0 0 0 0 rgba(' . $pointer_pulse[0] . ', 0.7); |
| 1149 |
} |
| 1150 |
70% { |
| 1151 |
-moz-box-shadow: 0 0 0 10px rgba(' . $pointer_pulse[0] . ', 0); |
| 1152 |
box-shadow: 0 0 0 10px rgba(' . $pointer_pulse[0] . ', 0); |
| 1153 |
} |
| 1154 |
100% { |
| 1155 |
-moz-box-shadow: 0 0 0 0 rgba(' . $pointer_pulse[0] . ', 0); |
| 1156 |
box-shadow: 0 0 0 0 rgba(' . $pointer_pulse[0] . ', 0); |
| 1157 |
} |
| 1158 |
}'; |
| 1159 |
} |
| 1160 |
$html .= '</style>'; |
| 1161 |
|
| 1162 |
|
| 1163 |
$scene_animation = isset($postdata['sceneAnimation']) ? $postdata['sceneAnimation'] : 'off'; |
| 1164 |
|
| 1165 |
if( $scene_animation === 'on'){ |
| 1166 |
$animation_type = isset($postdata['sceneAnimationName']) ? $postdata['sceneAnimationName'] : 'none'; |
| 1167 |
$animation_css = apply_filters('wpvr_tour_scene_animation',$animation_type,$postdata,$id); |
| 1168 |
$html .= $animation_css; |
| 1169 |
} |
| 1170 |
|
| 1171 |
if (wpvr_isMobileDevice()) { |
| 1172 |
$html .= '<div id="master-container" class="wpvr-cardboard ' . $className . ' ' . $enable_cardboard . ' " style="max-width:' . $width . $width_unit . '; width: 100%; height: ' . $mobile_height . $mobile_height_unit . '; border-radius:' . $radius . '; direction:ltr; border : ' . $border_style . ' ">'; |
| 1173 |
} else { |
| 1174 |
$html .= '<div id="master-container" class="wpvr-cardboard ' . $className . ' ' . $enable_cardboard . '" style="max-width:' . $width . $width_unit . '; width: 100%; height: ' . $height . $height_unit . '; border-radius:' . $radius . '; direction:ltr; border : ' . $border_style . '">'; |
| 1175 |
} |
| 1176 |
$status = get_option('wpvr_edd_license_status'); |
| 1177 |
$is_cardboard = get_option('wpvr_cardboard_disable'); |
| 1178 |
if ($status !== false && 'valid' == $status && $is_pro && wpvr_isMobileDevice() && $is_cardboard == 'true') { |
| 1179 |
$html .= '<button class="fullscreen-button">'; |
| 1180 |
$html .= '<span class="expand">'; |
| 1181 |
$html .= '<i class="fa fa-expand" aria-hidden="true"></i>'; |
| 1182 |
$html .= '</span>'; |
| 1183 |
|
| 1184 |
$html .= '<span class="compress">'; |
| 1185 |
$html .= '<i class="fa fa-compress" aria-hidden="true"></i>'; |
| 1186 |
$html .= '</span>'; |
| 1187 |
$html .= '</button>'; |
| 1188 |
$html .= '<label class="wpvr-cardboard-switcher"> |
| 1189 |
<input type="checkbox" class="vr_mode_change' . $id . '" name="vr_mode_change" value="off"> |
| 1190 |
<span class="switcher-box"> |
| 1191 |
<span class="normal-mode-tooltip">Normal VR Mode</span> |
| 1192 |
<svg width="78" height="60" viewBox="0 0 78 60" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 1193 |
<path d="M42.25 21.4286C42.25 22.2811 41.9076 23.0986 41.2981 23.7014C40.6886 24.3042 39.862 24.6429 39 24.6429C38.138 24.6429 37.3114 24.3042 36.7019 23.7014C36.0924 23.0986 35.75 22.2811 35.75 21.4286C35.75 20.5761 36.0924 19.7585 36.7019 19.1557C37.3114 18.5529 38.138 18.2143 39 18.2143C39.862 18.2143 40.6886 18.5529 41.2981 19.1557C41.9076 19.7585 42.25 20.5761 42.25 21.4286ZM19.5 30C18.9254 30 18.3743 30.2258 17.9679 30.6276C17.5616 31.0295 17.3333 31.5745 17.3333 32.1429C17.3333 32.7112 17.5616 33.2562 17.9679 33.6581C18.3743 34.06 18.9254 34.2857 19.5 34.2857H28.1667C28.7413 34.2857 29.2924 34.06 29.6987 33.6581C30.1051 33.2562 30.3333 32.7112 30.3333 32.1429C30.3333 31.5745 30.1051 31.0295 29.6987 30.6276C29.2924 30.2258 28.7413 30 28.1667 30H19.5ZM47.6667 32.1429C47.6667 31.5745 47.8949 31.0295 48.3013 30.6276C48.7076 30.2258 49.2587 30 49.8333 30H58.5C59.0746 30 59.6257 30.2258 60.0321 30.6276C60.4384 31.0295 60.6667 31.5745 60.6667 32.1429C60.6667 32.7112 60.4384 33.2562 60.0321 33.6581C59.6257 34.06 59.0746 34.2857 58.5 34.2857H49.8333C49.2587 34.2857 48.7076 34.06 48.3013 33.6581C47.8949 33.2562 47.6667 32.7112 47.6667 32.1429ZM32.5 0C31.9254 0 31.3743 0.225765 30.9679 0.627629C30.5616 1.02949 30.3333 1.57454 30.3333 2.14286V8.57143H18.4167C14.8693 8.57183 11.4528 9.89617 8.84994 12.2798C6.24706 14.6634 4.64954 17.9306 4.37667 21.4286H2.16667C1.59203 21.4286 1.04093 21.6543 0.634602 22.0562C0.228273 22.4581 0 23.0031 0 23.5714V36.4286C0 36.9969 0.228273 37.5419 0.634602 37.9438C1.04093 38.3457 1.59203 38.5714 2.16667 38.5714H4.33333V46.0714C4.33333 49.7655 5.81711 53.3083 8.45825 55.9204C11.0994 58.5325 14.6815 60 18.4167 60H25.3933C29.1269 59.9986 32.7071 58.5311 35.347 55.92L37.921 53.3786C38.0618 53.2393 38.229 53.1288 38.4131 53.0534C38.5971 52.978 38.7943 52.9392 38.9935 52.9392C39.1927 52.9392 39.3899 52.978 39.5739 53.0534C39.758 53.1288 39.9252 53.2393 40.066 53.3786L42.6357 55.92C45.2766 58.5322 48.8586 59.9998 52.5937 60H59.5833C63.3185 60 66.9006 58.5325 69.5418 55.9204C72.1829 53.3083 73.6667 49.7655 73.6667 46.0714V38.5714H75.8333C76.408 38.5714 76.9591 38.3457 77.3654 37.9438C77.7717 37.5419 78 36.9969 78 36.4286V23.5714C78 23.0031 77.7717 22.4581 77.3654 22.0562C76.9591 21.6543 76.408 21.4286 75.8333 21.4286H73.6233C73.3505 17.9306 71.753 14.6634 69.1501 12.2798C66.5472 9.89617 63.1307 8.57183 59.5833 8.57143H47.6667V2.14286C47.6667 1.57454 47.4384 1.02949 47.0321 0.627629C46.6257 0.225765 46.0746 0 45.5 0H32.5ZM69.3333 22.5V46.0714C69.3333 48.6289 68.3061 51.0816 66.4776 52.89C64.6491 54.6983 62.1692 55.7143 59.5833 55.7143H52.5937C50.0093 55.7132 47.5311 54.6973 45.7037 52.89L43.1297 50.3486C42.5864 49.8108 41.9413 49.3842 41.2312 49.0931C40.5211 48.8021 39.76 48.6522 38.9913 48.6522C38.2227 48.6522 37.4616 48.8021 36.7515 49.0931C36.0414 49.3842 35.3963 49.8108 34.853 50.3486L32.2833 52.89C30.4559 54.6973 27.9777 55.7132 25.3933 55.7143H18.4167C15.8308 55.7143 13.3509 54.6983 11.5224 52.89C9.6939 51.0816 8.66667 48.6289 8.66667 46.0714V22.5C8.66667 19.9426 9.6939 17.4899 11.5224 15.6815C13.3509 13.8731 15.8308 12.8571 18.4167 12.8571H59.5833C62.1692 12.8571 64.6491 13.8731 66.4776 15.6815C68.3061 17.4899 69.3333 19.9426 69.3333 22.5Z" fill="#216DF0"/> |
| 1194 |
</svg> |
| 1195 |
</span> |
| 1196 |
</label>'; |
| 1197 |
} |
| 1198 |
|
| 1199 |
if ($width == 'fullwidth') { |
| 1200 |
if (wpvr_isMobileDevice()) { |
| 1201 |
$html .= '<div class="cardboard-vrfullwidth vrfullwidth">'; |
| 1202 |
$html .= '<div id="pano2' . $id . '" class="pano-wrap pano-left cardboard-half" style="width: 49%!important; border-radius:' . $radius . ' ;text-align:center; direction:ltr;" ><div id="center-pointer2' . $id . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>'; |
| 1203 |
$html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style="width: 100%; text-align:center; direction:ltr; border-radius:' . $radius . '" >'; |
| 1204 |
} else { |
| 1205 |
$html .= '<div id="pano2' . $id . '" class="pano-wrap pano-left" style="width: 49%; border-radius:' . $radius . ';"><div id="center-pointer2' . $id . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>'; |
| 1206 |
$html .= '<div id="pano' . $id . '" class="pano-wrap vrfullwidth" style=" text-align:center; height: ' . $height . $height_unit . '; border-radius:' . $radius . '; direction:ltr;" >'; |
| 1207 |
} |
| 1208 |
} else { |
| 1209 |
if (wpvr_isMobileDevice()) { |
| 1210 |
$html .= '<div id="pano2' . $id . '" class="pano-wrap pano-left cardboard-half" style="width: 49%; border-radius:' . $radius . ';"> |
| 1211 |
<div id="center-pointer2' . $id . '" class="vr-pointer-container"> |
| 1212 |
<span class="center-pointer"></span> |
| 1213 |
</div> |
| 1214 |
</div>'; |
| 1215 |
|
| 1216 |
$html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style=" width: 100%; border-radius:' . $radius . ';">'; |
| 1217 |
} else { |
| 1218 |
|
| 1219 |
$html .= '<div id="pano2' . $id . '" class="pano-wrap pano-left" style="width: 49%; border-radius:' . $radius . ';"><div id="center-pointer2' . $id . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>'; |
| 1220 |
|
| 1221 |
$html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style="width: 100%; border-radius:' . $radius . ';">'; |
| 1222 |
} |
| 1223 |
} |
| 1224 |
// Vr mode transction scene to scene |
| 1225 |
if ($status !== false && 'valid' == $status && $is_pro && wpvr_isMobileDevice() && $is_cardboard == 'true') { |
| 1226 |
$html .= '<div id="center-pointer' . $id . '" class="vr-pointer-container" style="display:none"><span class="center-pointer"></span></div>'; |
| 1227 |
} |
| 1228 |
|
| 1229 |
|
| 1230 |
//===company logo===// |
| 1231 |
if (isset($postdata['cpLogoSwitch'])) { |
| 1232 |
$cpLogoImg = $postdata['cpLogoImg']; |
| 1233 |
$cpLogoContent = $postdata['cpLogoContent']; |
| 1234 |
if ($postdata['cpLogoSwitch'] == 'on') { |
| 1235 |
$html .= '<div id="cp-logo-controls">'; |
| 1236 |
$html .= '<div class="cp-logo-ctrl" id="cp-logo">'; |
| 1237 |
if ($cpLogoImg) { |
| 1238 |
$html .= '<img loading="lazy" src="' . $cpLogoImg . '" alt="Company Logo">'; |
| 1239 |
} |
| 1240 |
|
| 1241 |
if ($cpLogoContent) { |
| 1242 |
$html .= '<div class="cp-info">' . $cpLogoContent . '</div>'; |
| 1243 |
} |
| 1244 |
$html .= '</div>'; |
| 1245 |
$html .= '</div>'; |
| 1246 |
} |
| 1247 |
} |
| 1248 |
//===company logo ends===// |
| 1249 |
|
| 1250 |
//===Background Tour===// |
| 1251 |
if (isset($postdata['bg_tour_enabler'])) { |
| 1252 |
|
| 1253 |
$bg_tour_enabler = $postdata['bg_tour_enabler']; |
| 1254 |
if ($bg_tour_enabler == 'on') { |
| 1255 |
$bg_tour_navmenu = $postdata['bg_tour_navmenu']; |
| 1256 |
$bg_tour_title = $postdata['bg_tour_title']; |
| 1257 |
$bg_tour_subtitle = $postdata['bg_tour_subtitle']; |
| 1258 |
|
| 1259 |
if ($bg_tour_navmenu == 'on') { |
| 1260 |
$menuLocations = get_nav_menu_locations(); |
| 1261 |
$menuID = $menuLocations['primary']; |
| 1262 |
$primaryNav = wp_get_nav_menu_items($menuID); |
| 1263 |
|
| 1264 |
if ($primaryNav) { |
| 1265 |
$html .= '<div class="wpvr-navbar-container">'; |
| 1266 |
foreach ($primaryNav as $primaryNav_key => $primaryNav_value) { |
| 1267 |
if ($primaryNav_value->menu_item_parent == "0") { |
| 1268 |
$html .= '<li>'; |
| 1269 |
$html .= '<a href="' . $primaryNav_value->url . '">' . $primaryNav_value->title . '</a>'; |
| 1270 |
$html .= '<ul class="wpvr-navbar-dropdown">'; |
| 1271 |
foreach ($primaryNav as $pm_key => $pm_value) { |
| 1272 |
if ($pm_value->menu_item_parent == $primaryNav_value->ID) { |
| 1273 |
$html .= '<li>'; |
| 1274 |
$html .= '<a href="' . $pm_value->url . '">' . $pm_value->title . '</a>'; |
| 1275 |
$html .= '</li>'; |
| 1276 |
} |
| 1277 |
} |
| 1278 |
$html .= '</ul>'; |
| 1279 |
$html .= '</li>'; |
| 1280 |
} |
| 1281 |
} |
| 1282 |
$html .= '</div>'; |
| 1283 |
} |
| 1284 |
} |
| 1285 |
|
| 1286 |
$html .= '<div class="wpvr-home-content">'; |
| 1287 |
$html .= '<div class="wpvr-home-title">' . $bg_tour_title . '</div>'; |
| 1288 |
$html .= '<div class="wpvr-home-subtitle">' . $bg_tour_subtitle . '</div>'; |
| 1289 |
$html .= '</div>'; |
| 1290 |
} |
| 1291 |
} |
| 1292 |
//===Background Tour End===// |
| 1293 |
|
| 1294 |
//===Custom Control===// |
| 1295 |
if (isset($custom_control)) { |
| 1296 |
if ($custom_control['panZoomInSwitch'] == "on" || $custom_control['panZoomOutSwitch'] == "on" || $custom_control['gyroscopeSwitch'] == "on" || $custom_control['backToHomeSwitch'] == "on") { |
| 1297 |
$html .= '<div id="zoom-in-out-controls' . $id . '" class="zoom-in-out-controls">'; |
| 1298 |
|
| 1299 |
if ($custom_control['backToHomeSwitch'] == "on") { |
| 1300 |
$html .= '<div class="ctrl" id="backToHome' . $id . '"><i class="' . $custom_control['backToHomeIcon'] . '" style="color:' . $custom_control['backToHomeColor'] . ';"></i></div>'; |
| 1301 |
} |
| 1302 |
|
| 1303 |
if ($custom_control['panZoomInSwitch'] == "on") { |
| 1304 |
$html .= '<div class="ctrl" id="zoom-in' . $id . '"><i class="' . $custom_control['panZoomInIcon'] . '" style="color:' . $custom_control['panZoomInColor'] . ';"></i></div>'; |
| 1305 |
} |
| 1306 |
|
| 1307 |
if ($custom_control['panZoomOutSwitch'] == "on") { |
| 1308 |
$html .= '<div class="ctrl" id="zoom-out' . $id . '"><i class="' . $custom_control['panZoomOutIcon'] . '" style="color:' . $custom_control['panZoomOutColor'] . ';"></i></div>'; |
| 1309 |
} |
| 1310 |
|
| 1311 |
if ($custom_control['gyroscopeSwitch'] == "on") { |
| 1312 |
$html .= '<div class="ctrl" id="gyroscope' . $id . '"><i class="' . $custom_control['gyroscopeIcon'] . '" style="color:' . $custom_control['gyroscopeColor'] . ';"></i></div>'; |
| 1313 |
} |
| 1314 |
|
| 1315 |
$html .= '</div>'; |
| 1316 |
} |
| 1317 |
//===zoom in out Control===// |
| 1318 |
|
| 1319 |
if ($custom_control['panupSwitch'] == "on" || $custom_control['panDownSwitch'] == "on" || $custom_control['panLeftSwitch'] == "on" || $custom_control['panRightSwitch'] == "on" || $custom_control['panFullscreenSwitch'] == "on") { |
| 1320 |
|
| 1321 |
//===Custom Control===// |
| 1322 |
$html .= '<div class="controls" id="controls' . $id . '">'; |
| 1323 |
|
| 1324 |
if ($custom_control['panupSwitch'] == "on") { |
| 1325 |
$html .= '<div class="ctrl pan-up" id="pan-up' . $id . '"><i class="' . $custom_control['panupIcon'] . '" style="color:' . $custom_control['panupColor'] . ';"></i></div>'; |
| 1326 |
} |
| 1327 |
|
| 1328 |
if ($custom_control['panDownSwitch'] == "on") { |
| 1329 |
$html .= '<div class="ctrl pan-down" id="pan-down' . $id . '"><i class="' . $custom_control['panDownIcon'] . '" style="color:' . $custom_control['panDownColor'] . ';"></i></div>'; |
| 1330 |
} |
| 1331 |
|
| 1332 |
if ($custom_control['panLeftSwitch'] == "on") { |
| 1333 |
$html .= '<div class="ctrl pan-left" id="pan-left' . $id . '"><i class="' . $custom_control['panLeftIcon'] . '" style="color:' . $custom_control['panLeftColor'] . ';"></i></div>'; |
| 1334 |
} |
| 1335 |
|
| 1336 |
if ($custom_control['panRightSwitch'] == "on") { |
| 1337 |
$html .= '<div class="ctrl pan-right" id="pan-right' . $id . '"><i class="' . $custom_control['panRightIcon'] . '" style="color:' . $custom_control['panRightColor'] . ';"></i></div>'; |
| 1338 |
} |
| 1339 |
|
| 1340 |
if ($custom_control['panFullscreenSwitch'] == "on") { |
| 1341 |
$html .= '<div class="ctrl fullscreen" id="fullscreen' . $id . '"><i class="' . $custom_control['panFullscreenIcon'] . '" style="color:' . $custom_control['panFullscreenColor'] . ';"></i></div>'; |
| 1342 |
} |
| 1343 |
$html .= '</div>'; |
| 1344 |
} |
| 1345 |
|
| 1346 |
//===explainer button===// |
| 1347 |
$explainerControlSwitch = ''; |
| 1348 |
if (isset($custom_control['explainerSwitch'])) { |
| 1349 |
$explainerControlSwitch = $custom_control['explainerSwitch']; |
| 1350 |
} |
| 1351 |
if ($custom_control['explainerSwitch'] == "on") { |
| 1352 |
$html .= '<div class="explainer_button" id="explainer_button_' . $id . '" style="right:' . $explainer_right . '">'; |
| 1353 |
$html .= '<div class="ctrl" id="explainer_target_' . $id . '"><i class="' . $custom_control['explainerIcon'] . '" style="color:' . $custom_control['explainerColor'] . ';"></i></div>'; |
| 1354 |
$html .= '</div>'; |
| 1355 |
} |
| 1356 |
|
| 1357 |
//===explainer button===// |
| 1358 |
|
| 1359 |
} |
| 1360 |
//===Custom Control===// |
| 1361 |
|
| 1362 |
//===Scene navigation Control===// |
| 1363 |
if (isset($postdata['scene_navigation']) && $postdata['scene_navigation'] === 'on') { |
| 1364 |
$html .= '<style> |
| 1365 |
#et-boc .et-l .pnlm-controls-container, |
| 1366 |
.pnlm-controls-container{ |
| 1367 |
top: 33px; |
| 1368 |
} |
| 1369 |
|
| 1370 |
#et-boc .et-l .zoom-in-out-controls, |
| 1371 |
.zoom-in-out-controls { |
| 1372 |
top: 37px; |
| 1373 |
} |
| 1374 |
</style>'; |
| 1375 |
$html .= '<div id="custom-scene-navigation' . $id . '" class="custom-scene-navigation"> |
| 1376 |
<span class="hamburger-menu"><svg width="16" height="10" fill="none" viewBox="0 0 22 15" xmlns="http://www.w3.org/2000/svg"><rect width="21.177" height="2.647" fill="#f7fffb" rx="1.324"/><rect width="21.177" height="2.647" y="6.177" fill="#f7fffb" rx="1.324"/><rect width="21.177" height="2.647" y="12.352" fill="#f7fffb" rx="1.324"/></svg></span> |
| 1377 |
</div> |
| 1378 |
|
| 1379 |
<div id="custom-scene-navigation-nav' . $id . '" class="custom-scene-navigation-nav"> |
| 1380 |
<ul></ul> |
| 1381 |
</div> |
| 1382 |
'; |
| 1383 |
} |
| 1384 |
|
| 1385 |
//===Scene navigation Control===// |
| 1386 |
|
| 1387 |
//=====custom generic form=====// |
| 1388 |
if (isset($postdata["genericform"]) && $postdata["genericform"] == 'on') { |
| 1389 |
$shortcode_val = isset($postdata["genericformshortcode"]) && $postdata["genericformshortcode"] !== "" ? do_shortcode($postdata["genericformshortcode"]) : "No shortcode found"; |
| 1390 |
$html .= '<div class="generic_form_button" id="generic_form_button_' . $id . '">'; |
| 1391 |
$html .= '<div class="ctrl" id="generic_form_target_' . $id . '"><i class="fab fa-wpforms" style="color:#f7fffb;"></i></div>'; |
| 1392 |
$html .= '</div>'; |
| 1393 |
|
| 1394 |
$html .= '<div class="wpvr-generic-form" id="wpvr-generic-form' . $id . '" style="display: none">'; |
| 1395 |
$html .= '<span class="close-generic-form"><i class="fa fa-times"></i></span>'; |
| 1396 |
$html .= '<div class="generic-form-container">' . $shortcode_val . '</div>'; |
| 1397 |
$html .= '</div>'; |
| 1398 |
} |
| 1399 |
//=====custom generic form=====// |
| 1400 |
|
| 1401 |
//===Floor map button===// |
| 1402 |
$status = get_option('wpvr_edd_license_status'); |
| 1403 |
if ($status !== false && 'valid' == $status && $is_pro) { |
| 1404 |
if ($floor_plan_enable == "on" && !empty($floor_plan_image)) { |
| 1405 |
$html .= '<div class="floor_map_button" id="floor_map_button_' . $id . '" style="right:' . $floor_map_right . '">'; |
| 1406 |
$html .= '<div class="ctrl" id="floor_map_target_' . $id . '"><i class="fas fa-map" style="color:#f7fffb;"></i></div>'; |
| 1407 |
$html .= '</div>'; |
| 1408 |
} |
| 1409 |
} |
| 1410 |
|
| 1411 |
//===floor map button===// |
| 1412 |
if ($vrgallery) { |
| 1413 |
//===Carousal setup===// |
| 1414 |
$size = ''; |
| 1415 |
if ($vrgallery_icon_size) { |
| 1416 |
$size = 'vrg-icon-size-large'; |
| 1417 |
} |
| 1418 |
$html .= '<div id="vrgcontrols' . $id . '" class="vrgcontrols">'; |
| 1419 |
|
| 1420 |
$html .= '<div class="vrgctrl' . $id . ' vrbounce ' . $size . '">'; |
| 1421 |
$html .= '</div>'; |
| 1422 |
$html .= '</div>'; |
| 1423 |
|
| 1424 |
$html .= '<div id="sccontrols' . $id . '" class="scene-gallery vrowl-carousel owl-theme">'; |
| 1425 |
if (isset($panodata["scene-list"])) { |
| 1426 |
foreach ($panodata["scene-list"] as $panoscenes) { |
| 1427 |
$scene_key = $panoscenes['scene-id']; |
| 1428 |
if ($vrgallery_title == 'on') { |
| 1429 |
$scene_key_title = $panoscenes['scene-ititle']; |
| 1430 |
// $scene_key_title = $panoscenes['scene-id']; |
| 1431 |
} else { |
| 1432 |
$scene_key_title = ""; |
| 1433 |
} |
| 1434 |
|
| 1435 |
if ($panoscenes['scene-type'] == 'cubemap') { |
| 1436 |
$img_src_url = $panoscenes['scene-attachment-url-face0']; |
| 1437 |
} else { |
| 1438 |
$img_src_url = $panoscenes['scene-attachment-url']; |
| 1439 |
} |
| 1440 |
|
| 1441 |
|
| 1442 |
$src_to_id = attachment_url_to_postid($img_src_url); |
| 1443 |
$thumbnail_array = wp_get_attachment_image_src($src_to_id, 'thumbnail'); |
| 1444 |
if ($thumbnail_array) { |
| 1445 |
$thumbnail = $thumbnail_array[0]; |
| 1446 |
} else { |
| 1447 |
$thumbnail = $img_src_url; |
| 1448 |
} |
| 1449 |
|
| 1450 |
$html .= '<ul style="width:150px;"><li title="Double click to view scene">' . $scene_key_title . '<img loading="lazy" class="scctrl" id="' . $scene_key . '_gallery_' . $id . '" src="' . $thumbnail . '"></li></ul>'; |
| 1451 |
} |
| 1452 |
} |
| 1453 |
$html .= '</div>'; |
| 1454 |
$html .= ' |
| 1455 |
<div class="owl-nav wpvr_slider_nav"> |
| 1456 |
<button type="button" role="presentation" class="owl-prev wpvr_owl_prev"> |
| 1457 |
<div class="nav-btn prev-slide"><i class="fa fa-angle-left"></i></div> |
| 1458 |
</button> |
| 1459 |
<button type="button" role="presentation" class="owl-next wpvr_owl_next"> |
| 1460 |
<div class="nav-btn next-slide"><i class="fa fa-angle-right"></i></div> |
| 1461 |
</button> |
| 1462 |
</div> |
| 1463 |
'; |
| 1464 |
//===Carousal setup end===// |
| 1465 |
} |
| 1466 |
|
| 1467 |
if (isset($postdata['bg_music'])) { |
| 1468 |
$bg_music = $postdata['bg_music']; |
| 1469 |
$bg_music_url = $postdata['bg_music_url']; |
| 1470 |
$autoplay_bg_music = $postdata['autoplay_bg_music']; |
| 1471 |
$loop_bg_music = $postdata['loop_bg_music']; |
| 1472 |
$bg_loop = ''; |
| 1473 |
if ($loop_bg_music == 'on') { |
| 1474 |
$bg_loop = 'loop'; |
| 1475 |
} |
| 1476 |
|
| 1477 |
if ($bg_music == 'on') { |
| 1478 |
$html .= '<div id="adcontrol' . $id . '" class="adcontrol" style="right:' . $audio_right . '">'; |
| 1479 |
$html .= '<audio class="vrAudioDefault" id="vrAudio' . $id . '" data-autoplay="' . $autoplay_bg_music . '" onended="audionEnd' . $id . '()" ' . $bg_loop . '> |
| 1480 |
<source src="' . $bg_music_url . '" type="audio/mpeg"> |
| 1481 |
Your browser does not support the audio element. |
| 1482 |
</audio> |
| 1483 |
<button onclick="playPause' . $id . '()" class="ctrl audio_control" data-play="' . $autoplay_bg_music . '" id="audio_control' . $id . '"><i id="vr-volume' . $id . '" class="wpvrvolumeicon' . $id . ' fas fa-volume-up" style="color:#fff;"></i></button> |
| 1484 |
'; |
| 1485 |
$html .= '</div>'; |
| 1486 |
} |
| 1487 |
} |
| 1488 |
|
| 1489 |
//===Explainer video section===// |
| 1490 |
$explainerContent = ""; |
| 1491 |
if (isset($postdata['explainerContent'])) { |
| 1492 |
$explainerContent = $postdata['explainerContent']; |
| 1493 |
} |
| 1494 |
$html .= '<div class="explainer" id="explainer' . $id . '" style="display: none">'; |
| 1495 |
$html .= '<span class="close-explainer-video"><i class="fa fa-times"></i></span>'; |
| 1496 |
$html .= '' . $explainerContent . ''; |
| 1497 |
$html .= '</div>'; |
| 1498 |
//===Explainer video section End===// |
| 1499 |
|
| 1500 |
//===Floor plan section===// |
| 1501 |
$floor_map_image = ""; |
| 1502 |
$floor_map_pointer = array(); |
| 1503 |
$floor_map_scene_id = ''; |
| 1504 |
$floor_plan_custom_color = '#cca92c'; |
| 1505 |
|
| 1506 |
if (isset($postdata['floor_plan_attachment_url'])) { |
| 1507 |
$floor_map_image = $postdata['floor_plan_attachment_url']; |
| 1508 |
$floor_map_pointer = $postdata['floor_plan_pointer_position']; |
| 1509 |
$floor_map_scene_id = $postdata['floor_plan_data_list']; |
| 1510 |
$floor_plan_custom_color = $postdata['floor_plan_custom_color']; |
| 1511 |
} |
| 1512 |
$html .= '<div class="wpvr-floor-map" id="wpvr-floor-map' . $id . '" style="display: none">'; |
| 1513 |
$html .= '<span class="close-floor-map-plan"><i class="fa fa-times"></i></span>'; |
| 1514 |
$html .= '<img loading="lazy" src="' . $floor_map_image . '">'; |
| 1515 |
|
| 1516 |
foreach ($floor_map_pointer as $key => $pointer_position) { |
| 1517 |
$html .= '<div class="floor-plan-pointer ui-draggable ui-draggable-handle" scene_id = "' . $floor_map_scene_id[$key]->value . '" id="' . $pointer_position->id . '" data-top="' . $pointer_position->data_top . '" data-left="' . $pointer_position->data_left . '" style="' . $pointer_position->style . '"> |
| 1518 |
|
| 1519 |
<svg class="floor-pointer-circle" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 1520 |
<circle cx="12" cy="12" r="11.5" stroke="' . $floor_plan_custom_color . '"/> |
| 1521 |
<circle cx="12" cy="12" r="5" fill="' . $foreground_color_pointer . '"/> |
| 1522 |
</svg> |
| 1523 |
<svg class="floor-pointer-flash" width="54" height="35" viewBox="0 0 54 35" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 1524 |
<path d="M0.454054 1.32433L11.7683 34.3243C11.9069 34.7285 12.287 35 12.7143 35H41.2857C41.713 35 42.0931 34.7285 42.2317 34.3243L53.5459 1.32432C53.7685 0.675257 53.2862 0 52.6 0H1.4C0.713843 0 0.231517 0.675258 0.454054 1.32433Z" fill="url(#paint0_linear_1_10)"/> |
| 1525 |
<defs> |
| 1526 |
<linearGradient id="paint0_linear_1_10" x1="27" y1="4.59807e-08" x2="26.5" y2="28" gradientUnits="userSpaceOnUse"> |
| 1527 |
<stop stop-color="' . $floor_plan_custom_color . '" stop-opacity="0"/> |
| 1528 |
<stop offset="1" stop-color="' . $floor_plan_custom_color . '"/> |
| 1529 |
</linearGradient> |
| 1530 |
</defs> |
| 1531 |
</svg> |
| 1532 |
|
| 1533 |
</div>'; |
| 1534 |
} |
| 1535 |
$html .= '</div>'; |
| 1536 |
//===Floor plan section===// |
| 1537 |
|
| 1538 |
$html .= '<div class="wpvr-hotspot-tweak-contents-wrapper" style="display: none">'; |
| 1539 |
$html .= '<i class="fa fa-times cross" data-id="' . $id . '"></i>'; |
| 1540 |
$html .= '<div class="wpvr-hotspot-tweak-contents-flex">'; |
| 1541 |
$html .= '<div class="wpvr-hotspot-tweak-contents">'; |
| 1542 |
ob_start(); |
| 1543 |
do_action('wpvr_hotspot_tweak_contents', $scene_data); |
| 1544 |
$hotspot_content = ob_get_clean(); |
| 1545 |
$html .= $hotspot_content; |
| 1546 |
$html .= '</div>'; |
| 1547 |
$html .= '</div>'; |
| 1548 |
$html .= '</div>'; |
| 1549 |
|
| 1550 |
$html .= '<div class="custom-ifram-wrapper" style="display: none;">'; |
| 1551 |
$html .= '<i class="fa fa-times cross" data-id="' . $id . '"></i>'; |
| 1552 |
$html .= '<div class="custom-ifram-flex">'; |
| 1553 |
$html .= '<div class="custom-ifram">'; |
| 1554 |
$html .= '</div>'; |
| 1555 |
$html .= '</div>'; |
| 1556 |
$html .= '</div>'; |
| 1557 |
$html .= '</div>'; |
| 1558 |
$html .= '</div>'; |
| 1559 |
|
| 1560 |
|
| 1561 |
if ("fullwidth" == $width) { |
| 1562 |
$html .= '</div>'; |
| 1563 |
} |
| 1564 |
if ($status !== false && 'valid' == $status && $is_pro) { |
| 1565 |
$call_to_action = isset($postdata['calltoaction']) ? $postdata['calltoaction'] : 'off'; |
| 1566 |
if ('on' == $call_to_action) { |
| 1567 |
$buttontext = isset($postdata['buttontext']) ? $postdata['buttontext'] : ''; |
| 1568 |
$buttonurl = isset($postdata['buttonurl']) ? $postdata['buttonurl'] : ''; |
| 1569 |
$cta_btn_style = isset($postdata['button_configuration']) ? $postdata['button_configuration'] : array(); |
| 1570 |
|
| 1571 |
$button_open_new_tab = isset($cta_btn_style['button_open_new_tab']) ? $cta_btn_style['button_open_new_tab'] : "off"; |
| 1572 |
$target = '_self'; |
| 1573 |
$button_position = isset($cta_btn_style['button_position']) ? $cta_btn_style['button_position'] : ""; |
| 1574 |
$background_color = isset($cta_btn_style['button_background_color']) ? $cta_btn_style['button_background_color'] : ""; |
| 1575 |
$color = isset($cta_btn_style['button_font_color']) ? $cta_btn_style['button_font_color'] : ""; |
| 1576 |
$font_size = isset($cta_btn_style['button_font_size']) ? $cta_btn_style['button_font_size'] : ""; |
| 1577 |
$font_weight = isset($cta_btn_style['button_font_weight']) ? $cta_btn_style['button_font_weight'] : ""; |
| 1578 |
$text_align = isset($cta_btn_style['button_alignment']) ? $cta_btn_style['button_alignment'] : ""; |
| 1579 |
$text_transform = isset($cta_btn_style['button_transform']) ? $cta_btn_style['button_transform'] : ""; |
| 1580 |
$font_style = isset($cta_btn_style['button_text_style']) ? $cta_btn_style['button_text_style'] : ""; |
| 1581 |
$text_decoration = isset($cta_btn_style['button_text_decoration']) ? $cta_btn_style['button_text_decoration'] : ""; |
| 1582 |
$line_height = isset($cta_btn_style['button_line_height']) ? $cta_btn_style['button_line_height'] : ""; |
| 1583 |
$letter_spacing = isset($cta_btn_style['button_letter_spacing']) ? $cta_btn_style['button_letter_spacing'] : ""; |
| 1584 |
$word_spacing = isset($cta_btn_style['button_word_spacing']) ? $cta_btn_style['button_word_spacing'] : ""; |
| 1585 |
|
| 1586 |
$border_width = isset($cta_btn_style['button_border_width']) ? $cta_btn_style['button_border_width'] : ""; |
| 1587 |
$border_style = isset($cta_btn_style['button_border_style']) ? $cta_btn_style['button_border_style'] : ""; |
| 1588 |
$border_color = isset($cta_btn_style['button_border_color']) ? $cta_btn_style['button_border_color'] : ""; |
| 1589 |
$border_radius = isset($cta_btn_style['button_border_radius']) ? $cta_btn_style['button_border_radius'] : ""; |
| 1590 |
|
| 1591 |
$button_pt = isset($cta_btn_style['button_pt']) ? $cta_btn_style['button_pt'] : ""; |
| 1592 |
$button_pr = isset($cta_btn_style['button_pr']) ? $cta_btn_style['button_pr'] : ""; |
| 1593 |
$button_pb = isset($cta_btn_style['button_pb']) ? $cta_btn_style['button_pb'] : ""; |
| 1594 |
$button_pl = isset($cta_btn_style['button_pl']) ? $cta_btn_style['button_pl'] : ""; |
| 1595 |
|
| 1596 |
if ($button_open_new_tab == 'on') { |
| 1597 |
$target = '_blank'; |
| 1598 |
} |
| 1599 |
$style = 'background-color: ' . $background_color . '; |
| 1600 |
color: ' . $color . '; |
| 1601 |
font-size: ' . $font_size . 'px; |
| 1602 |
font-weight: ' . $font_weight . '; |
| 1603 |
text-align: center; |
| 1604 |
display: inline-block; |
| 1605 |
text-transform: ' . $text_transform . '; |
| 1606 |
font-style: ' . $font_style . '; |
| 1607 |
text-decoration: ' . $text_decoration . '; |
| 1608 |
line-height: ' . $line_height . '; |
| 1609 |
letter-spacing: ' . $letter_spacing . 'px; |
| 1610 |
word-spacing: ' . $word_spacing . 'px; |
| 1611 |
border: ' . $border_width . 'px ' . $border_style . ' ' . $border_color . '; |
| 1612 |
border-radius: ' . $border_radius . 'px; |
| 1613 |
padding: ' . $button_pt . 'px ' . $button_pr . 'px ' . $button_pb . 'px ' . $button_pl . 'px; |
| 1614 |
'; |
| 1615 |
$html .= '<div class="wpvr-call-to-action-button position-' . $text_align . '" style="max-width:' . $width . $width_unit . '"> |
| 1616 |
<a href="' . $buttonurl . '" style="' . $style . '" target="' . $target . '">' . $buttontext . '</a> |
| 1617 |
</div>'; |
| 1618 |
} |
| 1619 |
} |
| 1620 |
|
| 1621 |
//script started |
| 1622 |
|
| 1623 |
$html .= '<script>'; |
| 1624 |
|
| 1625 |
|
| 1626 |
|
| 1627 |
if (isset($postdata['bg_music'])) { |
| 1628 |
if ($bg_music == 'on') { |
| 1629 |
$html .= ' |
| 1630 |
var x' . $id . ' = document.getElementById("vrAudio' . $id . '"); |
| 1631 |
|
| 1632 |
var playing' . $id . ' = false; |
| 1633 |
|
| 1634 |
function playPause' . $id . '() { |
| 1635 |
|
| 1636 |
if (playing' . $id . ') { |
| 1637 |
jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up"); |
| 1638 |
jQuery("#vr-volume' . $id . '").addClass("fas fa-volume-mute"); |
| 1639 |
x' . $id . '.pause(); |
| 1640 |
jQuery("#audio_control' . $id . '").attr("data-play", "off"); |
| 1641 |
playing' . $id . ' = false; |
| 1642 |
|
| 1643 |
} |
| 1644 |
else { |
| 1645 |
jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute"); |
| 1646 |
jQuery("#vr-volume' . $id . '").addClass("fas fa-volume-up"); |
| 1647 |
jQuery("#audio_control' . $id . '").attr("data-play", "on"); |
| 1648 |
x' . $id . '.play(); |
| 1649 |
playing' . $id . ' = true; |
| 1650 |
} |
| 1651 |
} |
| 1652 |
|
| 1653 |
function audionEnd' . $id . '() { |
| 1654 |
playing' . $id . ' = false; |
| 1655 |
jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up"); |
| 1656 |
jQuery("#vr-volume' . $id . '").addClass("fas fa-volume-mute"); |
| 1657 |
jQuery("#audio_control' . $id . '").attr("data-play", "off"); |
| 1658 |
} |
| 1659 |
'; |
| 1660 |
|
| 1661 |
if ($autoplay_bg_music == 'on') { |
| 1662 |
$html .= ' |
| 1663 |
document.getElementById("pano' . $id . '").addEventListener("click", musicPlay' . $id . '); |
| 1664 |
function musicPlay' . $id . '() { |
| 1665 |
playing' . $id . ' = true; |
| 1666 |
document.getElementById("vrAudio' . $id . '").play(); |
| 1667 |
document.getElementById("pano' . $id . '").removeEventListener("click", musicPlay' . $id . '); |
| 1668 |
} |
| 1669 |
'; |
| 1670 |
} |
| 1671 |
} |
| 1672 |
} |
| 1673 |
$html .= 'jQuery(document).ready(function() {'; |
| 1674 |
$html .= 'var response = ' . $response . ';'; |
| 1675 |
$html .= 'var scenes = response[1];'; |
| 1676 |
$html .= 'if(scenes) {'; |
| 1677 |
$html .= 'var scenedata = scenes.scenes;'; |
| 1678 |
$html .= 'for(var i in scenedata) {'; |
| 1679 |
$html .= 'var scenehotspot = scenedata[i].hotSpots;'; |
| 1680 |
$html .= 'for(var i = 0; i < scenehotspot.length; i++) {'; |
| 1681 |
$html .= 'if(scenehotspot[i]["clickHandlerArgs"] != "") {'; |
| 1682 |
$html .= 'scenehotspot[i]["clickHandlerFunc"] = wpvrhotspot;'; |
| 1683 |
$html .= '}'; |
| 1684 |
if (wpvr_isMobileDevice() && get_option('dis_on_hover') == "true") { |
| 1685 |
} else { |
| 1686 |
$html .= 'if(scenehotspot[i]["createTooltipArgs"] != "") {'; |
| 1687 |
$html .= 'scenehotspot[i]["createTooltipFunc"] = wpvrtooltip;'; |
| 1688 |
$html .= '}'; |
| 1689 |
} |
| 1690 |
$html .= '}'; |
| 1691 |
$html .= '}'; |
| 1692 |
$html .= '}'; |
| 1693 |
$html .= 'var panoshow' . $id . ' = pannellum.viewer(response[0]["panoid"], scenes);'; |
| 1694 |
|
| 1695 |
|
| 1696 |
//===Dplicate mode only for vr mode===// |
| 1697 |
$response2 = json_decode($response); |
| 1698 |
$response2[1]->compass = false; |
| 1699 |
$response2[1]->autoRotate = false; |
| 1700 |
$response = json_encode($response2); |
| 1701 |
$html .= 'var response_duplicate = ' . $response . ';'; |
| 1702 |
$html .= 'var scenes_duplicate = response_duplicate[1];'; |
| 1703 |
|
| 1704 |
$html .= 'if(scenes_duplicate) {'; |
| 1705 |
$html .= 'var scenedata = scenes_duplicate.scenes;'; |
| 1706 |
$html .= 'for(var i in scenedata) {'; |
| 1707 |
$html .= 'var scenehotspot = scenedata[i].hotSpots;'; |
| 1708 |
$html .= 'for(var i = 0; i < scenehotspot.length; i++) {'; |
| 1709 |
$html .= 'if(scenehotspot[i]["clickHandlerArgs"] != "") {'; |
| 1710 |
$html .= 'scenehotspot[i]["clickHandlerFunc"] = wpvrhotspot;'; |
| 1711 |
$html .= '}'; |
| 1712 |
if (wpvr_isMobileDevice() && get_option('dis_on_hover') == "true") { |
| 1713 |
} else { |
| 1714 |
$html .= 'if(scenehotspot[i]["createTooltipArgs"] != "") {'; |
| 1715 |
$html .= 'scenehotspot[i]["createTooltipFunc"] = wpvrtooltip;'; |
| 1716 |
$html .= '}'; |
| 1717 |
} |
| 1718 |
$html .= '}'; |
| 1719 |
$html .= '}'; |
| 1720 |
$html .= '}'; |
| 1721 |
$html .= 'var vr_mode = "off";'; |
| 1722 |
$status = get_option('wpvr_edd_license_status'); |
| 1723 |
if ($status !== false && 'valid' == $status && $is_pro) { |
| 1724 |
$html .= 'var panoshow2' . $id . ' = pannellum.viewer("pano2' . $id . '", scenes_duplicate);'; |
| 1725 |
|
| 1726 |
// Show Cardboard Mode in Tour |
| 1727 |
$html .= ' |
| 1728 |
var tim; |
| 1729 |
var im = 0; |
| 1730 |
var active_scene = "' . $default_scene . '"; |
| 1731 |
var c_time; |
| 1732 |
c_time = new Date(); |
| 1733 |
var timer = c_time.getTime() + 2000; |
| 1734 |
function panoShowCardBoardOnTrigger(data){ |
| 1735 |
if(scenes_duplicate) { |
| 1736 |
var scenedata = scenes_duplicate.scenes; |
| 1737 |
for(var i in scenedata) { |
| 1738 |
if(active_scene === i) { |
| 1739 |
var scenehotspot = scenedata[i].hotSpots; |
| 1740 |
for(var j in scenehotspot) { |
| 1741 |
var plusFiveYaw = Math.round(scenehotspot[j].yaw) + 5; |
| 1742 |
var minusFiveYaw = Math.round(scenehotspot[j].yaw) - 5; |
| 1743 |
var plusFivePitch = Math.round(scenehotspot[j].pitch) + 5; |
| 1744 |
var minusFivePitch = Math.round(scenehotspot[j].pitch) - 5; |
| 1745 |
var firstCondition = ( Math.round(data.pitch) > minusFivePitch) && (Math.round(data.pitch) < plusFivePitch) ; |
| 1746 |
var secCondition = (Math.round(data.yaw) > minusFiveYaw) && (Math.round(data.yaw) < plusFiveYaw); |
| 1747 |
if(( Math.round(data.pitch) > minusFivePitch) && (Math.round(data.pitch) < plusFivePitch) ){ |
| 1748 |
if((Math.round(data.yaw) > minusFiveYaw) && (Math.round(data.yaw) < plusFiveYaw)){ |
| 1749 |
jQuery(".center-pointer").addClass("wpvr-pluse-effect") |
| 1750 |
var getScene = scenehotspot[j].sceneId; |
| 1751 |
if(scenehotspot[j].type == "scene"){ |
| 1752 |
panoshow' . $id . '.loadScene(getScene); |
| 1753 |
panoshow2' . $id . '.loadScene(getScene); |
| 1754 |
// var inside_current_time_object = new Date(); |
| 1755 |
// var inside_timer = inside_current_time_object.getTime(); |
| 1756 |
// if(inside_timer > timer) { |
| 1757 |
// panoshow' . $id . '.loadScene(getScene); |
| 1758 |
// panoshow2' . $id . '.loadScene(getScene); |
| 1759 |
// jQuery(".center-pointer").removeClass("wpvr-pluse-effect") |
| 1760 |
// } |
| 1761 |
}else{ |
| 1762 |
jQuery(".center-pointer").removeClass("wpvr-pluse-effect") |
| 1763 |
} |
| 1764 |
} |
| 1765 |
else { |
| 1766 |
jQuery(".center-pointer").removeClass("wpvr-pluse-effect") |
| 1767 |
c_time = new Date(); |
| 1768 |
timer = c_time.getTime() + 2000; |
| 1769 |
} |
| 1770 |
} |
| 1771 |
else { |
| 1772 |
c_time = new Date(); |
| 1773 |
timer = c_time.getTime() + 2000; |
| 1774 |
} |
| 1775 |
} |
| 1776 |
} |
| 1777 |
} |
| 1778 |
} |
| 1779 |
}; |
| 1780 |
|
| 1781 |
function vrDeviseOrientation(){ |
| 1782 |
var data = { |
| 1783 |
pitch: panoshow' . $id . '.getPitch(), |
| 1784 |
yaw: panoshow' . $id . '.getYaw(), |
| 1785 |
}; |
| 1786 |
panoShowCardBoardOnTrigger(data); |
| 1787 |
} |
| 1788 |
'; |
| 1789 |
$html .= ' |
| 1790 |
|
| 1791 |
function requestFullScreen(){ |
| 1792 |
var elem = document.getElementById("master-container"); |
| 1793 |
if (elem.requestFullscreen) { |
| 1794 |
elem.requestFullscreen(); |
| 1795 |
} else if (elem.webkitRequestFullscreen) { /* Safari */ |
| 1796 |
elem.webkitRequestFullscreen(); |
| 1797 |
} else if (elem.msRequestFullscreen) { /* IE11 */ |
| 1798 |
elem.msRequestFullscreen(); |
| 1799 |
} |
| 1800 |
} |
| 1801 |
function requestExitFullscreen(){ |
| 1802 |
var elem = document.getElementById("master-container"); |
| 1803 |
if (document.exitFullscreen) { |
| 1804 |
document.exitFullscreen(); |
| 1805 |
} else if (document.webkitExitFullscreen) { /* Safari */ |
| 1806 |
document.webkitExitFullscreen(); |
| 1807 |
} else if (document.msExitFullscreen) { /* IE11 */ |
| 1808 |
document.msExitFullscreen(); |
| 1809 |
} |
| 1810 |
} |
| 1811 |
jQuery(document).on("click",".fullscreen-button .expand",function() { |
| 1812 |
jQuery(this).hide() |
| 1813 |
jQuery(this).parent().find(".compress").show() |
| 1814 |
requestFullScreen() |
| 1815 |
screen.orientation.lock("landscape-primary") |
| 1816 |
.then(function() { |
| 1817 |
}) |
| 1818 |
.catch(function(error) { |
| 1819 |
alert("Not Supported for this devise"); |
| 1820 |
}); |
| 1821 |
|
| 1822 |
}); |
| 1823 |
jQuery(document).on("click",".fullscreen-button .compress",function() { |
| 1824 |
jQuery(this).hide() |
| 1825 |
jQuery(this).parent().find(".expand").show() |
| 1826 |
requestExitFullscreen() |
| 1827 |
screen.orientation.unlock(); |
| 1828 |
|
| 1829 |
}); |
| 1830 |
'; |
| 1831 |
|
| 1832 |
$html .= ' |
| 1833 |
panoshow' . $id . '.on("scenechange", function (scene){ |
| 1834 |
jQuery(".center-pointer").removeClass("wpvr-pluse-effect") |
| 1835 |
active_scene = scene; |
| 1836 |
}); |
| 1837 |
var compassBlock = ""; |
| 1838 |
var infoBlock = ""; |
| 1839 |
var getValue = ""; |
| 1840 |
jQuery(document).on("click",".vr_mode_change' . $id . '",function (){ |
| 1841 |
|
| 1842 |
jQuery("#pano2' . $id . ' .pnlm-load-button").trigger("click"); |
| 1843 |
jQuery("#pano' . $id . ' .pnlm-load-button").trigger("click"); |
| 1844 |
|
| 1845 |
getValue = jQuery(this).val(); |
| 1846 |
var getParent = jQuery(this).parent().parent(); |
| 1847 |
var fullWidthParent = getParent.parent(); |
| 1848 |
var compass = getParent.find("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display"); |
| 1849 |
var panoInfo = getParent.find("#pano' . $id . ' .pnlm-panorama-info").css("display"); |
| 1850 |
if(compass == "block"){ |
| 1851 |
compassBlock = "block"; |
| 1852 |
} |
| 1853 |
if(panoInfo == "block"){ |
| 1854 |
infoBlock = "block"; |
| 1855 |
} |
| 1856 |
if (getValue == "off") { |
| 1857 |
requestFullScreen() |
| 1858 |
screen.orientation.lock("landscape-primary") |
| 1859 |
.then(function() { |
| 1860 |
}) |
| 1861 |
.catch(function(error) { |
| 1862 |
alert("VR Glass Mode not supported in this device"); |
| 1863 |
}); |
| 1864 |
getParent.find(".pano-wrap").addClass("wpvr-cardboard-disable-event"); |
| 1865 |
// localStorage.setItem("vr_mode", "on"); |
| 1866 |
vr_mode = "on"; |
| 1867 |
jQuery(".vr-mode-title").show(); |
| 1868 |
jQuery(this).val("on"); |
| 1869 |
getParent.find("#pano2' . $id . '").css({ |
| 1870 |
"opacity": "1", |
| 1871 |
"visibility": "visible", |
| 1872 |
"position": "relative", |
| 1873 |
}); |
| 1874 |
gyroSwitch = true; |
| 1875 |
panoshow' . $id . '.startOrientation(); |
| 1876 |
panoshow2' . $id . '.startOrientation(); |
| 1877 |
panoshow2' . $id . '.setPitch(panoshow' . $id . '.getPitch(), 0); |
| 1878 |
panoshow2' . $id . '.setYaw(panoshow' . $id . '.getYaw(), 0); |
| 1879 |
getParent.find("#pano' . $id . ' #zoom-in-out-controls' . $id . '").hide(); |
| 1880 |
getParent.find("#pano' . $id . ' #controls' . $id . '").hide(); |
| 1881 |
getParent.find("#pano' . $id . ' #explainer_button_' . $id . '").hide(); |
| 1882 |
getParent.find("#pano' . $id . ' #generic_form_button_' . $id . '").hide(); |
| 1883 |
getParent.find("#pano' . $id . ' #floor_map_button_' . $id . '").hide(); |
| 1884 |
getParent.find("#pano' . $id . ' #vrgcontrols' . $id . '").hide(); |
| 1885 |
getParent.find("#pano' . $id . ' #sccontrols' . $id . '").hide(); |
| 1886 |
getParent.find("#pano' . $id . ' #adcontrol' . $id . '").hide(); |
| 1887 |
getParent.find("#pano' . $id . ' .owl-nav.wpvr_slider_nav").hide(); |
| 1888 |
getParent.find("#pano' . $id . ' #cp-logo-controls").hide(); |
| 1889 |
|
| 1890 |
getParent.find("#pano' . $id . ' #custom-scene-navigation' . $id . '").hide(); |
| 1891 |
|
| 1892 |
getParent.find("#pano2' . $id . ' .pnlm-controls-container").hide(); |
| 1893 |
getParent.find("#pano' . $id . ' .pnlm-controls-container").hide(); |
| 1894 |
|
| 1895 |
getParent.find("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").hide(); |
| 1896 |
getParent.find("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").hide(); |
| 1897 |
|
| 1898 |
getParent.find("#pano2' . $id . ' .pnlm-panorama-info").hide(); |
| 1899 |
getParent.find("#pano' . $id . ' .pnlm-panorama-info").hide(); |
| 1900 |
getParent.find("#pano' . $id . '").addClass("cardboard-half"); |
| 1901 |
|
| 1902 |
getParent.find("#center-pointer' . $id . '").show(); |
| 1903 |
getParent.find(".fullscreen-button").hide(); |
| 1904 |
|
| 1905 |
|
| 1906 |
if (window.DeviceOrientationEvent) { |
| 1907 |
window.addEventListener("deviceorientation", vrDeviseOrientation); |
| 1908 |
} |
| 1909 |
|
| 1910 |
panoshow' . $id . '.on("mousemove", function (data){ |
| 1911 |
panoshow2' . $id . '.setPitch(data.pitch, 0); |
| 1912 |
panoshow2' . $id . '.setYaw(data.yaw, 0); |
| 1913 |
panoShowCardBoardOnTrigger(data); |
| 1914 |
|
| 1915 |
}); |
| 1916 |
panoshow2' . $id . '.on("mousemove", function (data){ |
| 1917 |
panoshow2' . $id . '.setPitch(data.pitch, 0); |
| 1918 |
panoshow' . $id . '.setYaw(data.yaw, 0); |
| 1919 |
panoShowCardBoardOnTrigger(data); |
| 1920 |
|
| 1921 |
}); |
| 1922 |
|
| 1923 |
panoshow' . $id . '.on("zoomchange", function (data){ |
| 1924 |
panoshow2' . $id . '.setHfov(data, 0); |
| 1925 |
}); |
| 1926 |
|
| 1927 |
panoshow2' . $id . '.on("zoomchange", function (data){ |
| 1928 |
panoshow' . $id . '.setHfov(data, 0); |
| 1929 |
}); |
| 1930 |
|
| 1931 |
panoshow' . $id . '.on("touchmove", function (data){ |
| 1932 |
panoshow' . $id . '.stopOrientation(); |
| 1933 |
panoshow2' . $id . '.stopOrientation(); |
| 1934 |
panoshow2' . $id . '.setPitch(data.pitch, 0); |
| 1935 |
panoshow2' . $id . '.setYaw(data.yaw, 0); |
| 1936 |
panoShowCardBoardOnTrigger(data); |
| 1937 |
|
| 1938 |
}); |
| 1939 |
|
| 1940 |
panoshow2' . $id . '.on("touchmove", function (data){ |
| 1941 |
panoshow' . $id . '.stopOrientation(); |
| 1942 |
panoshow2' . $id . '.stopOrientation(); |
| 1943 |
panoshow' . $id . '.setPitch(data.pitch, 0); |
| 1944 |
panoshow' . $id . '.setYaw(data.yaw, 0); |
| 1945 |
panoShowCardBoardOnTrigger(data); |
| 1946 |
|
| 1947 |
}); |
| 1948 |
|
| 1949 |
} |
| 1950 |
else if(getValue == "on") { |
| 1951 |
screen.orientation.unlock(); |
| 1952 |
requestExitFullscreen(); |
| 1953 |
// localStorage.setItem("vr_mode", "off"); |
| 1954 |
vr_mode = "off"; |
| 1955 |
jQuery(".vr-mode-title").hide(); |
| 1956 |
jQuery(this).val("off"); |
| 1957 |
getParent.find("#pano2' . $id . '").css({ |
| 1958 |
"opacity": "0", |
| 1959 |
"visibility": "hidden", |
| 1960 |
"position": "absolute", |
| 1961 |
}); |
| 1962 |
panoshow' . $id . '.stopOrientation(); |
| 1963 |
panoshow2' . $id . '.stopOrientation(); |
| 1964 |
getParent.find(".pano-wrap").removeClass("wpvr-cardboard-disable-event"); |
| 1965 |
getParent.find("#pano' . $id . ' #zoom-in-out-controls' . $id . '").show(); |
| 1966 |
getParent.find("#pano' . $id . ' #controls' . $id . '").show(); |
| 1967 |
getParent.find("#pano' . $id . ' #explainer_button_' . $id . '").show(); |
| 1968 |
getParent.find("#pano' . $id . ' #generic_form_button_' . $id . '").show(); |
| 1969 |
getParent.find("#pano' . $id . ' #floor_map_button_' . $id . '").show(); |
| 1970 |
|
| 1971 |
getParent.find("#pano2' . $id . ' .pnlm-controls-container").show(); |
| 1972 |
getParent.find("#pano' . $id . ' .pnlm-controls-container").show(); |
| 1973 |
getParent.find("#pano' . $id . ' #vrgcontrols' . $id . '").show(); |
| 1974 |
getParent.find("#pano' . $id . ' #sccontrols' . $id . '").hide(); |
| 1975 |
getParent.find("#pano' . $id . ' #adcontrol' . $id . '").show(); |
| 1976 |
getParent.find("#pano' . $id . ' .owl-nav.wpvr_slider_nav").hide(); |
| 1977 |
getParent.find("#pano' . $id . ' #cp-logo-controls").show(); |
| 1978 |
getParent.find("#pano' . $id . ' #custom-scene-navigation' . $id . '").show(); |
| 1979 |
|
| 1980 |
if(compassBlock == "block"){ |
| 1981 |
getParent.find("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").show(); |
| 1982 |
getParent.find("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").show(); |
| 1983 |
} |
| 1984 |
if(infoBlock == "block"){ |
| 1985 |
getParent.find("#pano2' . $id . ' .pnlm-panorama-info").show(); |
| 1986 |
getParent.find("#pano' . $id . ' .pnlm-panorama-info").show(); |
| 1987 |
} |
| 1988 |
|
| 1989 |
getParent.find("#pano' . $id . '").removeClass("cardboard-half"); |
| 1990 |
getParent.find("#center-pointer' . $id . '").hide(); |
| 1991 |
getParent.find(".fullscreen-button").hide(); |
| 1992 |
panoshow' . $id . '.off("mousemove"); |
| 1993 |
panoshow' . $id . '.off("touchmove"); |
| 1994 |
panoshow2' . $id . '.off("mousemove"); |
| 1995 |
panoshow2' . $id . '.off("touchmove"); |
| 1996 |
if (window.DeviceOrientationEvent) { |
| 1997 |
window.removeEventListener("deviceorientation", vrDeviseOrientation); |
| 1998 |
} |
| 1999 |
} |
| 2000 |
});'; |
| 2001 |
|
| 2002 |
$html .= 'panoshow2' . $id . '.on("load", function (){ |
| 2003 |
// if(localStorage.getItem("vr_mode") == "off") { |
| 2004 |
if( vr_mode == "off") { |
| 2005 |
jQuery(".vr-mode-title").hide(); |
| 2006 |
} |
| 2007 |
else { |
| 2008 |
jQuery("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); |
| 2009 |
jQuery("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); |
| 2010 |
jQuery("#pano2' . $id . ' .pnlm-panorama-info").hide(); |
| 2011 |
jQuery("#pano' . $id . ' .pnlm-panorama-info").hide(); |
| 2012 |
jQuery(".vr-mode-title").show(); |
| 2013 |
} |
| 2014 |
});'; |
| 2015 |
} |
| 2016 |
|
| 2017 |
$html .= 'jQuery("#pano' . $id . ' .wpvr-floor-map .floor-plan-pointer").on("click",function(){ |
| 2018 |
var scene_id = jQuery(this).attr("scene_id"); |
| 2019 |
panoshow' . $id . '.loadScene(scene_id) |
| 2020 |
jQuery(".floor-plan-pointer").removeClass("add-pulse") |
| 2021 |
jQuery(this).addClass("add-pulse") |
| 2022 |
});'; |
| 2023 |
|
| 2024 |
if($scene_animation == 'on'){ |
| 2025 |
$animation_js = apply_filters('wpvr_scene_animation_js', $id, $animation_type); |
| 2026 |
$html .= $animation_js; |
| 2027 |
$html .= 'panoshow' . $id . '.on("load", function (scene){ |
| 2028 |
if (typeof changeScene === "function") { |
| 2029 |
changeScene(); |
| 2030 |
} else { |
| 2031 |
console.warn("changeScene function is not defined."); |
| 2032 |
} |
| 2033 |
});'; |
| 2034 |
} |
| 2035 |
|
| 2036 |
$html .= ' |
| 2037 |
panoshow' . $id . '.on("mousemove", function (data){ |
| 2038 |
jQuery(".add-pulse").css({"transform":"rotate("+data.yaw+"deg)"}); |
| 2039 |
}); |
| 2040 |
'; |
| 2041 |
|
| 2042 |
|
| 2043 |
|
| 2044 |
$status = get_option('wpvr_edd_license_status'); |
| 2045 |
if ($status !== false && 'valid' == $status && $is_pro) { |
| 2046 |
$html .= 'panoshow' . $id . '.on("scenechange", function (scene){ |
| 2047 |
jQuery(".center-pointer").removeClass("wpvr-pluse-effect") |
| 2048 |
jQuery(".floor-plan-pointer").each(function(index ,element){ |
| 2049 |
var scene_id = jQuery(this).attr("scene_id"); |
| 2050 |
if( active_scene == scene_id ){ |
| 2051 |
jQuery(".floor-plan-pointer").removeClass("add-pulse") |
| 2052 |
jQuery(this).addClass("add-pulse") |
| 2053 |
} |
| 2054 |
}); |
| 2055 |
|
| 2056 |
});'; |
| 2057 |
$html .= 'panoshow' . $id . '.on("load", function (){ |
| 2058 |
if(jQuery(".floor-plan-pointer").length > 0){ |
| 2059 |
jQuery(".floor-plan-pointer").each(function(index ,element){ |
| 2060 |
var scene_id = jQuery(this).attr("scene_id"); |
| 2061 |
if( active_scene == scene_id ){ |
| 2062 |
jQuery(".floor-plan-pointer").removeClass("add-pulse") |
| 2063 |
jQuery(this).addClass("add-pulse") |
| 2064 |
} |
| 2065 |
}); |
| 2066 |
} |
| 2067 |
});'; |
| 2068 |
} |
| 2069 |
|
| 2070 |
if ($status !== false && 'valid' == $status && $is_pro) { |
| 2071 |
$scene_navigation_content_type = isset($postdata['scene_navigation_content_type']) ? $postdata['scene_navigation_content_type'] : 'scene_id'; |
| 2072 |
$html .= ' |
| 2073 |
jQuery("#pano' . $id . ' .custom-scene-navigation").on("click",function(){ |
| 2074 |
jQuery("#custom-scene-navigation-nav' . $id . ' ul").empty() |
| 2075 |
if(scenes){ |
| 2076 |
var scene_navigation_content_type = ' . "'" . $scene_navigation_content_type . "'" . '; |
| 2077 |
var sceneList = scenes.scenes; |
| 2078 |
var getScene = panoshow' . $id . '.getScene(); |
| 2079 |
for (const key in sceneList) { |
| 2080 |
let title; |
| 2081 |
if (scene_navigation_content_type === "scene_title") { |
| 2082 |
if (sceneList[key].title) { |
| 2083 |
title = sceneList[key].title; |
| 2084 |
|
| 2085 |
}else{ |
| 2086 |
if(title == "" || title == undefined){ |
| 2087 |
if (sceneList[key].panorama) { |
| 2088 |
title = getImageNameWithoutExtension(sceneList[key].panorama); |
| 2089 |
} |
| 2090 |
} |
| 2091 |
} |
| 2092 |
} else if (scene_navigation_content_type === "scene_image_name") { |
| 2093 |
if (sceneList[key].panorama) { |
| 2094 |
title = getImageNameWithoutExtension(sceneList[key].panorama); |
| 2095 |
} |
| 2096 |
} else { |
| 2097 |
title = key; |
| 2098 |
} |
| 2099 |
if (sceneList.hasOwnProperty(key)) { |
| 2100 |
if( key === getScene){ |
| 2101 |
jQuery("#custom-scene-navigation-nav' . $id . ' ul").append("<li class=\"scene-navigation-list active\" scene_id= " + key + " >" + title + "</li>"); |
| 2102 |
}else{ |
| 2103 |
jQuery("#custom-scene-navigation-nav' . $id . ' ul").append("<li class=\"scene-navigation-list\" scene_id= " + key + " >" + title + "</li>"); |
| 2104 |
} |
| 2105 |
} |
| 2106 |
} |
| 2107 |
} |
| 2108 |
jQuery("#custom-scene-navigation-nav' . $id . '").toggleClass("visible"); |
| 2109 |
}); |
| 2110 |
'; |
| 2111 |
|
| 2112 |
$html .= 'function getImageNameWithoutExtension(imageUrl) { |
| 2113 |
// Split the URL by "/" |
| 2114 |
var parts = imageUrl.split("/"); |
| 2115 |
|
| 2116 |
// Get the last part which contains the image name |
| 2117 |
var imageNameWithExtension = parts[parts.length - 1]; |
| 2118 |
|
| 2119 |
// Split the image name by period (.) |
| 2120 |
var imageNameParts = imageNameWithExtension.split("."); |
| 2121 |
|
| 2122 |
// Remove the last part (which is the extension) and join the remaining parts |
| 2123 |
var imageNameWithoutExtension = imageNameParts.slice(0, -1).join("."); |
| 2124 |
|
| 2125 |
// Return the image name without extension |
| 2126 |
return imageNameWithoutExtension; |
| 2127 |
}'; |
| 2128 |
|
| 2129 |
|
| 2130 |
$html .= ' |
| 2131 |
jQuery("#pano' . $id . ' #custom-scene-navigation-nav' . $id . ' ul").on("click", "li.scene-navigation-list", function() { |
| 2132 |
if (scenes) { |
| 2133 |
jQuery(this).siblings("li").removeClass("active"); |
| 2134 |
jQuery(this).addClass("active"); |
| 2135 |
|
| 2136 |
var scene_key = jQuery(this).attr("scene_id"); |
| 2137 |
panoshow' . $id . '.loadScene(scene_key); |
| 2138 |
} |
| 2139 |
}); |
| 2140 |
'; |
| 2141 |
} |
| 2142 |
|
| 2143 |
//Duplicate mode only for vr mode end===// |
| 2144 |
$html .= 'panoshow' . $id . '.on("load", function (){ |
| 2145 |
|
| 2146 |
// if(localStorage.getItem("vr_mode") == "off") { |
| 2147 |
if( vr_mode == "off") { |
| 2148 |
jQuery(".vr-mode-title").hide(); |
| 2149 |
} |
| 2150 |
else { |
| 2151 |
jQuery("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); |
| 2152 |
jQuery("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); |
| 2153 |
jQuery("#pano2' . $id . ' .pnlm-panorama-info").hide(); |
| 2154 |
jQuery("#pano' . $id . ' .pnlm-panorama-info").hide(); |
| 2155 |
jQuery(".vr-mode-title").show(); |
| 2156 |
} |
| 2157 |
|
| 2158 |
|
| 2159 |
if (jQuery("#pano' . $id . '").children().children(".pnlm-panorama-info:visible").length > 0) { |
| 2160 |
jQuery("#controls' . $id . '").css("bottom", "55px"); |
| 2161 |
} |
| 2162 |
else { |
| 2163 |
jQuery("#controls' . $id . '").css("bottom", "5px"); |
| 2164 |
} |
| 2165 |
});'; |
| 2166 |
|
| 2167 |
|
| 2168 |
$html .= ' |
| 2169 |
if (scenes.autoRotate) { |
| 2170 |
panoshow' . $id . '.on("load", function (){ |
| 2171 |
setTimeout(function(){ panoshow' . $id . '.startAutoRotate(scenes.autoRotate, 0); }, 3000); |
| 2172 |
}); |
| 2173 |
panoshow' . $id . '.on("scenechange", function (){ |
| 2174 |
setTimeout(function(){ panoshow' . $id . '.startAutoRotate(scenes.autoRotate, 0); }, 3000); |
| 2175 |
}); |
| 2176 |
} |
| 2177 |
'; |
| 2178 |
$html .= 'var touchtime = 0;'; |
| 2179 |
if ($vrgallery) { |
| 2180 |
if (isset($panodata["scene-list"])) { |
| 2181 |
foreach ($panodata["scene-list"] as $panoscenes) { |
| 2182 |
$scene_key = $panoscenes['scene-id']; |
| 2183 |
$scene_key_gallery = $panoscenes['scene-id'] . '_gallery_' . $id; |
| 2184 |
$img_src_url = $panoscenes['scene-attachment-url']; |
| 2185 |
// $html .= 'document.getElementById("' . $scene_key_gallery . '").addEventListener("click", function(e) { '; |
| 2186 |
// $html .= 'if (touchtime == 0) {'; |
| 2187 |
// $html .= 'touchtime = new Date().getTime();'; |
| 2188 |
// $html .= '} else {'; |
| 2189 |
// $html .= 'if (((new Date().getTime()) - touchtime) < 800) {'; |
| 2190 |
// $html .= 'panoshow' . $id . '.loadScene("' . $scene_key . '");'; |
| 2191 |
// $html .= 'touchtime = 0;'; |
| 2192 |
// $html .= '} else {'; |
| 2193 |
// $html .= 'touchtime = new Date().getTime();'; |
| 2194 |
// $html .= '}'; |
| 2195 |
// $html .= '}'; |
| 2196 |
// $html .= '});'; |
| 2197 |
$html .= ' |
| 2198 |
jQuery(document).on("click","#' . $scene_key_gallery . '",function() { |
| 2199 |
panoshow' . $id . '.loadScene("' . $scene_key . '"); |
| 2200 |
}); |
| 2201 |
'; |
| 2202 |
} |
| 2203 |
} |
| 2204 |
} |
| 2205 |
|
| 2206 |
|
| 2207 |
|
| 2208 |
//===Custom Control===// |
| 2209 |
if (isset($custom_control)) { |
| 2210 |
if ($custom_control['panupSwitch'] == "on") { |
| 2211 |
$html .= 'document.getElementById("pan-up' . $id . '").addEventListener("click", function(e) {'; |
| 2212 |
$html .= 'panoshow' . $id . '.setPitch(panoshow' . $id . '.getPitch() + 10);'; |
| 2213 |
$html .= '});'; |
| 2214 |
} |
| 2215 |
|
| 2216 |
if ($custom_control['panDownSwitch'] == "on") { |
| 2217 |
$html .= 'document.getElementById("pan-down' . $id . '").addEventListener("click", function(e) {'; |
| 2218 |
$html .= 'panoshow' . $id . '.setPitch(panoshow' . $id . '.getPitch() - 10);'; |
| 2219 |
$html .= '});'; |
| 2220 |
} |
| 2221 |
|
| 2222 |
if ($custom_control['panLeftSwitch'] == "on") { |
| 2223 |
$html .= 'document.getElementById("pan-left' . $id . '").addEventListener("click", function(e) {'; |
| 2224 |
$html .= 'panoshow' . $id . '.setYaw(panoshow' . $id . '.getYaw() - 10);'; |
| 2225 |
$html .= '});'; |
| 2226 |
} |
| 2227 |
|
| 2228 |
if ($custom_control['panRightSwitch'] == "on") { |
| 2229 |
$html .= 'document.getElementById("pan-right' . $id . '").addEventListener("click", function(e) {'; |
| 2230 |
$html .= 'panoshow' . $id . '.setYaw(panoshow' . $id . '.getYaw() + 10);'; |
| 2231 |
$html .= '});'; |
| 2232 |
} |
| 2233 |
|
| 2234 |
if ($custom_control['panZoomInSwitch'] == "on") { |
| 2235 |
$html .= 'document.getElementById("zoom-in' . $id . '").addEventListener("click", function(e) {'; |
| 2236 |
$html .= 'panoshow' . $id . '.setHfov(panoshow' . $id . '.getHfov() - 10);'; |
| 2237 |
$html .= '});'; |
| 2238 |
} |
| 2239 |
|
| 2240 |
if ($custom_control['panZoomOutSwitch'] == "on") { |
| 2241 |
$html .= 'document.getElementById("zoom-out' . $id . '").addEventListener("click", function(e) {'; |
| 2242 |
$html .= 'panoshow' . $id . '.setHfov(panoshow' . $id . '.getHfov() + 10);'; |
| 2243 |
$html .= '});'; |
| 2244 |
} |
| 2245 |
|
| 2246 |
if ($custom_control['panFullscreenSwitch'] == "on") { |
| 2247 |
$html .= 'document.getElementById("fullscreen' . $id . '").addEventListener("click", function(e) {'; |
| 2248 |
$html .= 'panoshow' . $id . '.toggleFullscreen();'; |
| 2249 |
$html .= '});'; |
| 2250 |
} |
| 2251 |
|
| 2252 |
if ($custom_control['backToHomeSwitch'] == "on") { |
| 2253 |
$html .= 'document.getElementById("backToHome' . $id . '").addEventListener("click", function(e) {'; |
| 2254 |
$html .= 'panoshow' . $id . '.loadScene("' . $default_scene . '");'; |
| 2255 |
$html .= '});'; |
| 2256 |
} |
| 2257 |
|
| 2258 |
if ($custom_control['gyroscopeSwitch'] == "on") { |
| 2259 |
$html .= ' |
| 2260 |
var element = document.getElementById("gyroscope' . $id . '"); |
| 2261 |
var gyroSwitch = true; |
| 2262 |
panoshow' . $id . '.on("load", function (){ |
| 2263 |
if(gyroSwitch == false) { |
| 2264 |
panoshow' . $id . '.stopOrientation(); |
| 2265 |
element.children[0].style.color = "red"; |
| 2266 |
} |
| 2267 |
else { |
| 2268 |
panoshow' . $id . '.startOrientation(); |
| 2269 |
element.children[0].style.color = "' . $custom_control['gyroscopeColor'] . '"; |
| 2270 |
} |
| 2271 |
}); |
| 2272 |
panoshow' . $id . '.on("scenechange", function (){ |
| 2273 |
if (panoshow' . $id . '.isOrientationActive()) { |
| 2274 |
element.children[0].style.color = "' . $custom_control['gyroscopeColor'] . '"; |
| 2275 |
} |
| 2276 |
else { |
| 2277 |
element.children[0].style.color = "red"; |
| 2278 |
} |
| 2279 |
}); |
| 2280 |
|
| 2281 |
panoshow' . $id . '.on("touchstart", function (){ |
| 2282 |
if (panoshow' . $id . '.isOrientationActive()) { |
| 2283 |
gyroSwitch = true; |
| 2284 |
element.children[0].style.color = "' . $custom_control['gyroscopeColor'] . '"; |
| 2285 |
} |
| 2286 |
else { |
| 2287 |
gyroSwitch = false; |
| 2288 |
element.children[0].style.color = "red"; |
| 2289 |
} |
| 2290 |
}); |
| 2291 |
'; |
| 2292 |
$html .= 'document.getElementById("gyroscope' . $id . '").addEventListener("click", function(e) {'; |
| 2293 |
$html .= ' |
| 2294 |
var element = document.getElementById("gyroscope' . $id . '"); |
| 2295 |
if (panoshow' . $id . '.isOrientationActive()) { |
| 2296 |
|
| 2297 |
panoshow' . $id . '.stopOrientation(); |
| 2298 |
gyroSwitch = false; |
| 2299 |
element.children[0].style.color = "red"; |
| 2300 |
} |
| 2301 |
else { |
| 2302 |
panoshow' . $id . '.startOrientation(); |
| 2303 |
gyroSwitch = true; |
| 2304 |
element.children[0].style.color = "' . $custom_control['gyroscopeColor'] . '"; |
| 2305 |
} |
| 2306 |
|
| 2307 |
'; |
| 2308 |
$html .= '});'; |
| 2309 |
} |
| 2310 |
} |
| 2311 |
|
| 2312 |
$angle_up = '<i class="fa fa-angle-up"></i>'; |
| 2313 |
$angle_down = '<i class="fa fa-angle-down"></i>'; |
| 2314 |
$sin_qout = "'"; |
| 2315 |
|
| 2316 |
//===Explainer Script===// |
| 2317 |
$html .= ' |
| 2318 |
jQuery(document).on("click","#explainer_button_' . $id . '",function() { |
| 2319 |
jQuery("#explainer' . $id . '").slideToggle(); |
| 2320 |
// jQuery(".explainer").slideToggle(); |
| 2321 |
}); |
| 2322 |
|
| 2323 |
jQuery(document).on("click",".close-explainer-video",function() { |
| 2324 |
jQuery(this).parent(".explainer").hide(); |
| 2325 |
}); |
| 2326 |
jQuery(document).on("click","#pano' . $id . '",function(event) { |
| 2327 |
var isActiveModal = event.target.closest(".custom-ifram-wrapper"); |
| 2328 |
var isForm = event.target.closest(".wpvr-hotspot-tweak-contents"); |
| 2329 |
if( isActiveModal == null && isForm == null){ |
| 2330 |
jQuery(".custom-ifram-wrapper").hide(); |
| 2331 |
jQuery(this).removeClass("show-modal"); |
| 2332 |
jQuery(".wpvr-hotspot-tweak-contents-wrapper").hide("show-modal"); |
| 2333 |
}else if(isForm != null){ |
| 2334 |
jQuery(this).addClass("show-modal"); |
| 2335 |
} |
| 2336 |
}); |
| 2337 |
|
| 2338 |
'; |
| 2339 |
//===Explainer Script End===// |
| 2340 |
|
| 2341 |
//===generic form script===// |
| 2342 |
if (isset($postdata["genericform"]) && $postdata["genericform"] == 'on') { |
| 2343 |
$html .= ' |
| 2344 |
jQuery(document).on("click","#generic_form_button_' . $id . '",function() { |
| 2345 |
jQuery("#wpvr-generic-form' . $id . '").fadeToggle(); |
| 2346 |
}); |
| 2347 |
|
| 2348 |
jQuery(document).on("click",".close-generic-form",function() { |
| 2349 |
jQuery(this).parent(".wpvr-generic-form").fadeOut() |
| 2350 |
}); |
| 2351 |
'; |
| 2352 |
} |
| 2353 |
//===generic from script===// |
| 2354 |
|
| 2355 |
//===Floor map Script===// |
| 2356 |
$html .= ' |
| 2357 |
jQuery(document).on("click","#floor_map_button_' . $id . '",function() { |
| 2358 |
jQuery("#wpvr-floor-map' . $id . '").toggle().removeClass("fullwindow"); |
| 2359 |
}); |
| 2360 |
|
| 2361 |
jQuery(document).on("dblclick","#wpvr-floor-map' . $id . '",function(){ |
| 2362 |
jQuery(this).addClass("fullwindow"); |
| 2363 |
jQuery(this).parents(".pano-wrap").addClass("show-modal"); |
| 2364 |
}); |
| 2365 |
|
| 2366 |
jQuery(document).on("click",".close-floor-map-plan",function() { |
| 2367 |
jQuery(this).parent(".wpvr-floor-map").hide(); |
| 2368 |
jQuery(this).parent(".wpvr-floor-map").removeClass("fullwindow"); |
| 2369 |
jQuery(this).parents(".pano-wrap").removeClass("show-modal"); |
| 2370 |
}); |
| 2371 |
|
| 2372 |
'; |
| 2373 |
//===Floor map Script End===// |
| 2374 |
|
| 2375 |
if ($vrgallery_display) { |
| 2376 |
if (!$autoload) { |
| 2377 |
$html .= ' |
| 2378 |
jQuery(document).ready(function($){ |
| 2379 |
jQuery("#sccontrols' . $id . '").hide(); |
| 2380 |
jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . '); |
| 2381 |
jQuery("#sccontrols' . $id . '").hide(); |
| 2382 |
jQuery(".wpvr_slider_nav").hide(); |
| 2383 |
}); |
| 2384 |
'; |
| 2385 |
|
| 2386 |
$html .= ' |
| 2387 |
var slide' . $id . ' = "down"; |
| 2388 |
jQuery(document).on("click","#vrgcontrols' . $id . '",function() { |
| 2389 |
|
| 2390 |
if (slide' . $id . ' == "up") { |
| 2391 |
jQuery(".vrgctrl' . $id . '").empty(); |
| 2392 |
jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . '); |
| 2393 |
slide' . $id . ' = "down"; |
| 2394 |
} |
| 2395 |
else { |
| 2396 |
jQuery(".vrgctrl' . $id . '").empty(); |
| 2397 |
jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . '); |
| 2398 |
slide' . $id . ' = "up"; |
| 2399 |
} |
| 2400 |
jQuery(".wpvr_slider_nav").slideToggle(); |
| 2401 |
jQuery("#sccontrols' . $id . '").slideToggle(); |
| 2402 |
}); |
| 2403 |
'; |
| 2404 |
} else { |
| 2405 |
$html .= ' |
| 2406 |
jQuery(document).ready(function($){ |
| 2407 |
jQuery("#sccontrols' . $id . '").show(); |
| 2408 |
jQuery(".wpvr_slider_nav").show(); |
| 2409 |
jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . '); |
| 2410 |
}); |
| 2411 |
'; |
| 2412 |
|
| 2413 |
$html .= ' |
| 2414 |
var slide' . $id . ' = "down"; |
| 2415 |
jQuery(document).on("click","#vrgcontrols' . $id . '",function() { |
| 2416 |
|
| 2417 |
if (slide' . $id . ' == "up") { |
| 2418 |
jQuery(".vrgctrl' . $id . '").empty(); |
| 2419 |
jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . '); |
| 2420 |
slide' . $id . ' = "down"; |
| 2421 |
} |
| 2422 |
else { |
| 2423 |
jQuery(".vrgctrl' . $id . '").empty(); |
| 2424 |
jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . '); |
| 2425 |
slide' . $id . ' = "up"; |
| 2426 |
} |
| 2427 |
jQuery(".wpvr_slider_nav").slideToggle(); |
| 2428 |
jQuery("#sccontrols' . $id . '").slideToggle(); |
| 2429 |
}); |
| 2430 |
'; |
| 2431 |
} |
| 2432 |
} else { |
| 2433 |
$html .= ' |
| 2434 |
jQuery(document).ready(function($){ |
| 2435 |
jQuery("#sccontrols' . $id . '").hide(); |
| 2436 |
jQuery(".wpvr_slider_nav").hide(); |
| 2437 |
jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . '); |
| 2438 |
}); |
| 2439 |
'; |
| 2440 |
|
| 2441 |
$html .= ' |
| 2442 |
var slide' . $id . ' = "down"; |
| 2443 |
jQuery(document).on("click","#vrgcontrols' . $id . '",function() { |
| 2444 |
|
| 2445 |
if (slide' . $id . ' == "up") { |
| 2446 |
jQuery(".vrgctrl' . $id . '").empty(); |
| 2447 |
jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . '); |
| 2448 |
slide' . $id . ' = "down"; |
| 2449 |
} |
| 2450 |
else { |
| 2451 |
jQuery(".vrgctrl' . $id . '").empty(); |
| 2452 |
jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . '); |
| 2453 |
slide' . $id . ' = "up"; |
| 2454 |
} |
| 2455 |
jQuery(".wpvr_slider_nav").slideToggle(); |
| 2456 |
jQuery("#sccontrols' . $id . '").slideToggle(); |
| 2457 |
}); |
| 2458 |
'; |
| 2459 |
} |
| 2460 |
|
| 2461 |
if (!$autoload) { |
| 2462 |
$html .= ' |
| 2463 |
|
| 2464 |
jQuery(document).ready(function(){ |
| 2465 |
jQuery("#controls' . $id . '").hide(); |
| 2466 |
jQuery("#zoom-in-out-controls' . $id . '").hide(); |
| 2467 |
jQuery("#adcontrol' . $id . '").hide(); |
| 2468 |
jQuery("#explainer_button_' . $id . '").hide(); |
| 2469 |
jQuery("#generic_form_button_' . $id . '").hide(); |
| 2470 |
jQuery("#floor_map_button_' . $id . '").hide(); |
| 2471 |
jQuery("#vrgcontrols' . $id . '").hide(); |
| 2472 |
jQuery("#pano' . $id . '").find(".pnlm-panorama-info").hide(); |
| 2473 |
}); |
| 2474 |
|
| 2475 |
'; |
| 2476 |
|
| 2477 |
if ($vrgallery_display) { |
| 2478 |
$html .= 'var load_once = "true";'; |
| 2479 |
$html .= 'panoshow' . $id . '.on("load", function (){ |
| 2480 |
if (load_once == "true") { |
| 2481 |
load_once = "false"; |
| 2482 |
jQuery("#sccontrols' . $id . '").slideToggle(); |
| 2483 |
} |
| 2484 |
});'; |
| 2485 |
} |
| 2486 |
|
| 2487 |
$html .= 'panoshow' . $id . '.on("load", function (){ |
| 2488 |
jQuery("#controls' . $id . '").show(); |
| 2489 |
jQuery("#zoom-in-out-controls' . $id . '").show(); |
| 2490 |
jQuery("#adcontrol' . $id . '").show(); |
| 2491 |
jQuery("#explainer_button_' . $id . '").show(); |
| 2492 |
jQuery("#generic_form_button_' . $id . '").show(); |
| 2493 |
jQuery("#floor_map_button_' . $id . '").show(); |
| 2494 |
jQuery("#vrgcontrols' . $id . '").show(); |
| 2495 |
jQuery("#pano' . $id . '").find(".pnlm-panorama-info").show(); |
| 2496 |
});'; |
| 2497 |
} |
| 2498 |
|
| 2499 |
|
| 2500 |
if (isset($postdata['previewtext'])) { |
| 2501 |
$html .= ' |
| 2502 |
jQuery("#pano' . $id . '").children(".pnlm-ui").find(".pnlm-load-button p").text("' . $postdata['previewtext'] . '") |
| 2503 |
'; |
| 2504 |
} else { |
| 2505 |
$html .= ' |
| 2506 |
jQuery("#pano' . $id . '").children(".pnlm-ui").find(".pnlm-load-button p").text("Click To Load Panorama") |
| 2507 |
'; |
| 2508 |
} |
| 2509 |
|
| 2510 |
$html .= 'jQuery("#pano' . $id . ' .pnlm-title-box").on("mouseenter", function(){ |
| 2511 |
jQuery(this).attr("title", jQuery(this).text()); |
| 2512 |
}); |
| 2513 |
jQuery("#pano' . $id . ' .pnlm-title-box").on("mouseleave", function(){ |
| 2514 |
jQuery(this).removeAttr("title"); |
| 2515 |
});'; |
| 2516 |
$html .= '});'; |
| 2517 |
|
| 2518 |
|
| 2519 |
|
| 2520 |
$html .= '</script>'; |
| 2521 |
|
| 2522 |
$tour_data = []; |
| 2523 |
if(defined("WPVR_PRO_VERSION")){ |
| 2524 |
$tour_data = array( |
| 2525 |
'explainerControlSwitch' => $explainerControlSwitch, |
| 2526 |
'floor_plan_enable' => $floor_plan_enable, |
| 2527 |
'floor_plan_image' => $floor_plan_image, |
| 2528 |
'custom_control' => $custom_control, |
| 2529 |
); |
| 2530 |
} |
| 2531 |
|
| 2532 |
return apply_filters('wpvr_generate_tour_layout_html', $html ,$postdata ,$id, $tour_data); |
| 2533 |
} |
| 2534 |
|
| 2535 |
|
| 2536 |
function wpvr_hex2rgb($colour) |
| 2537 |
{ |
| 2538 |
if (isset($colour[0]) && $colour[0] == '#') { |
| 2539 |
$colour = substr($colour, 1); |
| 2540 |
} |
| 2541 |
if (strlen($colour) == 6) { |
| 2542 |
list($r, $g, $b) = array($colour[0] . $colour[1], $colour[2] . $colour[3], $colour[4] . $colour[5]); |
| 2543 |
} elseif (strlen($colour) == 3) { |
| 2544 |
list($r, $g, $b) = array($colour[0] . $colour[0], $colour[1] . $colour[1], $colour[2] . $colour[2]); |
| 2545 |
} else { |
| 2546 |
return false; |
| 2547 |
} |
| 2548 |
$r = hexdec($r); |
| 2549 |
$g = hexdec($g); |
| 2550 |
$b = hexdec($b); |
| 2551 |
return array($r . ', ' . $g . ', ' . $b); |
| 2552 |
} |
| 2553 |
|
| 2554 |
function wpvr_HTMLToRGB($htmlCode) |
| 2555 |
{ |
| 2556 |
$r = 0; |
| 2557 |
$g = 0; |
| 2558 |
$b = 0; |
| 2559 |
if (isset($htmlCode[0]) && $htmlCode[0] == '#') { |
| 2560 |
$htmlCode = substr($htmlCode, 1); |
| 2561 |
} |
| 2562 |
|
| 2563 |
if (strlen($htmlCode) == 3) { |
| 2564 |
$htmlCode = $htmlCode[0] . $htmlCode[0] . $htmlCode[1] . $htmlCode[1] . $htmlCode[2] . $htmlCode[2]; |
| 2565 |
} |
| 2566 |
|
| 2567 |
if (isset($htmlCode[0]) && isset($htmlCode[1])) { |
| 2568 |
$r = hexdec($htmlCode[0] . $htmlCode[1]); |
| 2569 |
} |
| 2570 |
if (isset($htmlCode[2]) && isset($htmlCode[3])) { |
| 2571 |
$g = hexdec($htmlCode[2] . $htmlCode[3]); |
| 2572 |
} |
| 2573 |
if (isset($htmlCode[4]) && isset($htmlCode[5])) { |
| 2574 |
$b = hexdec($htmlCode[4] . $htmlCode[5]); |
| 2575 |
} |
| 2576 |
|
| 2577 |
return $b + ($g << 0x8) + ($r << 0x10); |
| 2578 |
} |
| 2579 |
|
| 2580 |
function wpvr_RGBToHSL($RGB) |
| 2581 |
{ |
| 2582 |
$r = 0xFF & ($RGB >> 0x10); |
| 2583 |
$g = 0xFF & ($RGB >> 0x8); |
| 2584 |
$b = 0xFF & $RGB; |
| 2585 |
|
| 2586 |
$r = ((float)$r) / 255.0; |
| 2587 |
$g = ((float)$g) / 255.0; |
| 2588 |
$b = ((float)$b) / 255.0; |
| 2589 |
|
| 2590 |
$maxC = max($r, $g, $b); |
| 2591 |
$minC = min($r, $g, $b); |
| 2592 |
|
| 2593 |
$l = ($maxC + $minC) / 2.0; |
| 2594 |
|
| 2595 |
if ($maxC == $minC) { |
| 2596 |
$s = 0; |
| 2597 |
$h = 0; |
| 2598 |
} else { |
| 2599 |
if ($l < .5) { |
| 2600 |
$s = ($maxC - $minC) / ($maxC + $minC); |
| 2601 |
} else { |
| 2602 |
$s = ($maxC - $minC) / (2.0 - $maxC - $minC); |
| 2603 |
} |
| 2604 |
if ($r == $maxC) { |
| 2605 |
$h = ($g - $b) / ($maxC - $minC); |
| 2606 |
} |
| 2607 |
if ($g == $maxC) { |
| 2608 |
$h = 2.0 + ($b - $r) / ($maxC - $minC); |
| 2609 |
} |
| 2610 |
if ($b == $maxC) { |
| 2611 |
$h = 4.0 + ($r - $g) / ($maxC - $minC); |
| 2612 |
} |
| 2613 |
|
| 2614 |
$h = $h / 6.0; |
| 2615 |
} |
| 2616 |
|
| 2617 |
$h = (int)round(255.0 * $h); |
| 2618 |
$s = (int)round(255.0 * $s); |
| 2619 |
$l = (int)round(255.0 * $l); |
| 2620 |
|
| 2621 |
return (object) array('hue' => $h, 'saturation' => $s, 'lightness' => $l); |
| 2622 |
} |
| 2623 |
|
| 2624 |
add_action('rest_api_init', 'wpvr_rest_data_route'); |
| 2625 |
function wpvr_rest_data_route() |
| 2626 |
{ |
| 2627 |
register_rest_route('wpvr/v1', '/panodata/', array( |
| 2628 |
'methods' => 'GET', |
| 2629 |
'callback' => 'wpvr_rest_data_set', |
| 2630 |
'permission_callback' => 'wpvr_rest_route_permission' |
| 2631 |
)); |
| 2632 |
} |
| 2633 |
|
| 2634 |
function wpvr_rest_route_permission() |
| 2635 |
{ |
| 2636 |
return true; |
| 2637 |
} |
| 2638 |
|
| 2639 |
function wpvr_rest_data_set() |
| 2640 |
{ |
| 2641 |
$query = new WP_Query(array( |
| 2642 |
'post_type' => 'wpvr_item', |
| 2643 |
'posts_per_page' => -1, |
| 2644 |
)); |
| 2645 |
|
| 2646 |
$wpvr_list = array(); |
| 2647 |
$list_none = array('value' => 0, 'label' => 'None'); |
| 2648 |
array_push($wpvr_list, $list_none); |
| 2649 |
while ($query->have_posts()) { |
| 2650 |
$query->the_post(); |
| 2651 |
$title = mb_convert_encoding(get_the_title(), 'UTF-8', 'HTML-ENTITIES'); |
| 2652 |
$post_id = get_the_ID(); |
| 2653 |
$title = $post_id . ' : ' . $title; |
| 2654 |
$list_ob = array('value' => $post_id, 'label' => $title); |
| 2655 |
array_push($wpvr_list, $list_ob); |
| 2656 |
} |
| 2657 |
|
| 2658 |
return $wpvr_list; |
| 2659 |
} |
| 2660 |
|
| 2661 |
function wpvr_isMobileDevice() |
| 2662 |
{ |
| 2663 |
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"]); |
| 2664 |
} |
| 2665 |
|
| 2666 |
function wpvr_directory() |
| 2667 |
{ |
| 2668 |
$upload = wp_upload_dir(); |
| 2669 |
$upload_dir = $upload['basedir']; |
| 2670 |
$upload_dir_temp = $upload_dir . '/wpvr/temp/'; |
| 2671 |
if (!is_dir($upload_dir_temp)) { |
| 2672 |
wp_mkdir_p($upload_dir_temp, 0700); |
| 2673 |
} |
| 2674 |
} |
| 2675 |
|
| 2676 |
add_action('admin_init', 'wpvr_directory'); |
| 2677 |
|
| 2678 |
|
| 2679 |
function wpvr_add_role_cap() |
| 2680 |
{ |
| 2681 |
$editor_active = get_option('wpvr_editor_active'); |
| 2682 |
|
| 2683 |
$author_active = get_option('wpvr_author_active'); |
| 2684 |
|
| 2685 |
$admin = get_role('administrator'); |
| 2686 |
$admin->add_cap('publish_wpvr_tour'); |
| 2687 |
$admin->add_cap('edit_wpvr_tours'); |
| 2688 |
$admin->add_cap('read_wpvr_tour'); |
| 2689 |
$admin->add_cap('edit_wpvr_tour'); |
| 2690 |
$admin->add_cap('edit_wpvr_tours'); |
| 2691 |
$admin->add_cap('publish_wpvr_tours'); |
| 2692 |
$admin->add_cap('publish_wpvr_tour'); |
| 2693 |
$admin->add_cap('delete_wpvr_tour'); |
| 2694 |
$admin->add_cap('edit_other_wpvr_tours'); |
| 2695 |
$admin->add_cap('delete_other_wpvr_tours'); |
| 2696 |
|
| 2697 |
if ($editor_active == "true") { |
| 2698 |
$editor = get_role('editor'); |
| 2699 |
if ($editor) { |
| 2700 |
$editor->add_cap('publish_wpvr_tour'); |
| 2701 |
$editor->add_cap('edit_wpvr_tours'); |
| 2702 |
$editor->add_cap('read_wpvr_tour'); |
| 2703 |
$editor->add_cap('edit_wpvr_tour'); |
| 2704 |
$editor->add_cap('edit_wpvr_tours'); |
| 2705 |
$editor->add_cap('publish_wpvr_tours'); |
| 2706 |
$editor->add_cap('publish_wpvr_tour'); |
| 2707 |
$editor->add_cap('delete_wpvr_tour'); |
| 2708 |
$editor->add_cap('edit_other_wpvr_tours'); |
| 2709 |
$editor->add_cap('delete_other_wpvr_tours'); |
| 2710 |
} |
| 2711 |
} else { |
| 2712 |
$editor = get_role('editor'); |
| 2713 |
if ($editor) { |
| 2714 |
$editor->remove_cap('publish_wpvr_tour'); |
| 2715 |
$editor->remove_cap('edit_wpvr_tours'); |
| 2716 |
$editor->remove_cap('read_wpvr_tour'); |
| 2717 |
$editor->remove_cap('edit_wpvr_tour'); |
| 2718 |
$editor->remove_cap('edit_wpvr_tours'); |
| 2719 |
$editor->remove_cap('publish_wpvr_tours'); |
| 2720 |
$editor->remove_cap('publish_wpvr_tour'); |
| 2721 |
$editor->remove_cap('delete_wpvr_tour'); |
| 2722 |
$editor->remove_cap('edit_other_wpvr_tours'); |
| 2723 |
$editor->remove_cap('delete_other_wpvr_tours'); |
| 2724 |
} |
| 2725 |
} |
| 2726 |
|
| 2727 |
if ($author_active == "true") { |
| 2728 |
$author = get_role('author'); |
| 2729 |
if ($author) { |
| 2730 |
$author->add_cap('read_wpvr_tour'); |
| 2731 |
$author->add_cap('edit_wpvr_tour'); |
| 2732 |
$author->add_cap('edit_wpvr_tours'); |
| 2733 |
$author->add_cap('publish_wpvr_tours'); |
| 2734 |
$author->add_cap('publish_wpvr_tour'); |
| 2735 |
$author->add_cap('delete_wpvr_tour'); |
| 2736 |
} |
| 2737 |
} else { |
| 2738 |
$author = get_role('author'); |
| 2739 |
if ($author) { |
| 2740 |
$author->remove_cap('read_wpvr_tour'); |
| 2741 |
$author->remove_cap('edit_wpvr_tour'); |
| 2742 |
$author->remove_cap('edit_wpvr_tours'); |
| 2743 |
$author->remove_cap('publish_wpvr_tours'); |
| 2744 |
$author->remove_cap('publish_wpvr_tour'); |
| 2745 |
$author->remove_cap('delete_wpvr_tour'); |
| 2746 |
} |
| 2747 |
} |
| 2748 |
} |
| 2749 |
|
| 2750 |
add_action('admin_init', 'wpvr_add_role_cap', 999); |
| 2751 |
|
| 2752 |
function wpvr_role_management_from_post_type($args, $post_type) |
| 2753 |
{ |
| 2754 |
if ('wpvr_item' !== $post_type) { |
| 2755 |
return $args; |
| 2756 |
} |
| 2757 |
|
| 2758 |
$editor_active = get_option('wpvr_editor_active'); |
| 2759 |
$author_active = get_option('wpvr_author_active'); |
| 2760 |
$user = wp_get_current_user(); |
| 2761 |
|
| 2762 |
if ($editor_active == "true") { |
| 2763 |
if (in_array('editor', (array) $user->roles)) { |
| 2764 |
$args['show_in_menu'] = true; |
| 2765 |
} |
| 2766 |
} |
| 2767 |
|
| 2768 |
if ($author_active == "true") { |
| 2769 |
if (in_array('author', (array) $user->roles)) { |
| 2770 |
$args['show_in_menu'] = true; |
| 2771 |
} |
| 2772 |
} |
| 2773 |
|
| 2774 |
return $args; |
| 2775 |
} |
| 2776 |
add_filter('register_post_type_args', 'wpvr_role_management_from_post_type', 10, 2); |
| 2777 |
|
| 2778 |
function wpvr_cache_admin_notice() |
| 2779 |
{ |
| 2780 |
$option = get_option('wpvr_warning'); |
| 2781 |
if (!$option) { |
| 2782 |
?> |
| 2783 |
<div class="notice notice-warning" id="wpvr-warning" style="position: relative;"> |
| 2784 |
<p><?php _e('Since you have updated the plugin, please clear the browser cache for smooth functioning. Follow these steps if you are using <a href="https://support.google.com/accounts/answer/32050?co=GENIE.Platform%3DDesktop&hl=en" target="_blank">Google Chrome</a>, <a href="https://support.mozilla.org/en-US/kb/how-clear-firefox-cache" target="_blank">Mozilla Firefox</a>, <a href="https://clear-my-cache.com/en/apple-mac-os/safari.html" target="_blank">Safai</a> or <a href="https://support.microsoft.com/en-us/help/10607/microsoft-edge-view-delete-browser-history" target="_blank">Microsoft Edge</a>', 'wpvr'); ?></p> |
| 2785 |
<button type="button" id="wpvr-dismissible" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button> |
| 2786 |
</div> |
| 2787 |
<?php |
| 2788 |
} |
| 2789 |
} |
| 2790 |
// add_action('admin_notices', 'wpvr_cache_admin_notice'); |
| 2791 |
|
| 2792 |
//===Oxygen widget===// |
| 2793 |
add_action('plugins_loaded', function () { |
| 2794 |
if (!class_exists('OxyEl')) { |
| 2795 |
return; |
| 2796 |
} |
| 2797 |
require_once __DIR__ . '/oxygen/oxy-manager.php'; |
| 2798 |
}); |
| 2799 |
|
| 2800 |
add_action('init', 'wpvr_mobile_media_handle'); |
| 2801 |
function wpvr_mobile_media_handle() |
| 2802 |
{ |
| 2803 |
add_image_size('wpvr_mobile', 4096, 2048); //mobile |
| 2804 |
} |
| 2805 |
|
| 2806 |
|
| 2807 |
add_action( |
| 2808 |
/** |
| 2809 |
* @param $api \VisualComposer\Modules\Api\Factory |
| 2810 |
*/ |
| 2811 |
'vcv:api', |
| 2812 |
function ($api) { |
| 2813 |
$elementsToRegister = [ |
| 2814 |
'wpvrelement', |
| 2815 |
]; |
| 2816 |
$pluginBaseUrl = rtrim(plugins_url(basename(__DIR__)), '\\/'); |
| 2817 |
/** @var \VisualComposer\Modules\Elements\ApiController $elementsApi */ |
| 2818 |
$elementsApi = $api->elements; |
| 2819 |
foreach ($elementsToRegister as $tag) { |
| 2820 |
$manifestPath = __DIR__ . '/vc/' . $tag . '/manifest.json'; |
| 2821 |
$elementBaseUrl = $pluginBaseUrl . '/vc/' . $tag; |
| 2822 |
$elementsApi->add($manifestPath, $elementBaseUrl); |
| 2823 |
} |
| 2824 |
} |
| 2825 |
); |
| 2826 |
|
| 2827 |
function wpvr_redirect_after_activation($plugin) |
| 2828 |
{ |
| 2829 |
if ($plugin == plugin_basename(__FILE__)) { |
| 2830 |
$url = admin_url('admin.php?page=wpvr-setup-wizard'); |
| 2831 |
$url = esc_url($url, FILTER_SANITIZE_URL); |
| 2832 |
exit(wp_safe_redirect($url)); |
| 2833 |
} |
| 2834 |
} |
| 2835 |
//add_action('activated_plugin', 'wpvr_redirect_after_activation'); |
| 2836 |
|
| 2837 |
function replace_callback($matches) |
| 2838 |
{ |
| 2839 |
foreach ($matches as $match) { |
| 2840 |
return str_replace('<img', '<img decoding="async" ', $match); |
| 2841 |
} |
| 2842 |
} |
| 2843 |
|
| 2844 |
|
| 2845 |
/** |
| 2846 |
* Add promoition notice flag in option table |
| 2847 |
* |
| 2848 |
* @return void |
| 2849 |
*/ |
| 2850 |
function wpvr_add_promotional_banner_flag() |
| 2851 |
{ |
| 2852 |
if (!get_option('_is_wpvr_promotion')) { |
| 2853 |
update_option('_is_wpvr_promotion', 'yes'); |
| 2854 |
} |
| 2855 |
} |
| 2856 |
add_action('admin_init', 'wpvr_add_promotional_banner_flag'); |
| 2857 |
|