| @@ -212,8 +212,11 @@ | ||
| 212 | 212 | wp_enqueue_style('owl-css', plugin_dir_url(__FILE__) . 'css/owl.carousel.css', array(), $this->version, 'all'); |
| 213 | 213 | wp_enqueue_style('panellium-css', plugin_dir_url(__FILE__) . 'lib/pannellum/src/css/pannellum.css', array(), true); |
| 214 | 214 | wp_enqueue_style('videojs-css', plugin_dir_url(__FILE__) . 'lib/pannellum/src/css/video-js.css', array(), true); |
| 215 | 215 | wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/wpvr-admin.css', array(), $this->version, 'all'); |
| 216 | + wp_enqueue_style('wpvr-inter-font', plugin_dir_url(__FILE__) . '../public/css/inter.css', array(), filemtime(plugin_dir_path(__FILE__) . '../public/css/inter.css')); | |
| 217 | + wp_enqueue_style('wpvr-stickers', plugin_dir_url(__FILE__) . '../public/css/wpvr-stickers.css', array('panellium-css', 'wpvr-inter-font'), filemtime(plugin_dir_path(__FILE__) . '../public/css/wpvr-stickers.css')); | |
| 218 | + wp_enqueue_style('wpvr-sticker-fields', plugin_dir_url(__FILE__) . 'css/wpvr-sticker-fields.css', array($this->plugin_name), filemtime(plugin_dir_path(__FILE__) . 'css/wpvr-sticker-fields.css')); | |
| 216 | 219 | wp_enqueue_style('wpvr-image-resize-warning', plugin_dir_url(__FILE__) . 'css/wpvr-image-resize-warning.css', array(), filemtime(plugin_dir_path(__FILE__) . 'css/wpvr-image-resize-warning.css'), 'all'); |
| 217 | 220 | wp_enqueue_style('wpvr-rtl', plugin_dir_url(__FILE__) . 'css/wpvr-admin-rtl.css', array(), $this->version, 'all'); |
| 218 | 221 | wp_enqueue_style('summernote', plugin_dir_url(__FILE__) . 'lib/summernote/summernote-lite.min.css', array(), $this->version, 'all'); |
| 219 | 222 | |
| @@ -289,9 +292,11 @@ | ||
| 289 | 292 | wp_enqueue_script('jquery-repeater', $asset_url . 'js/jquery.repeater.min.js', array('jquery'), true); |
| 290 | 293 | wp_enqueue_script('icon-picker', $asset_url . 'lib/jquery.fonticonpicker.min.js', array(), true); |
| 291 | 294 | wp_enqueue_script('owl', $asset_url . 'js/owl.carousel.js', array('jquery'), false); |
| 292 | 295 | wp_enqueue_script('wpvr-image-resize-warning', plugin_dir_url(__FILE__) . 'js/wpvr-image-resize-warning.js', array('jquery'), filemtime(plugin_dir_path(__FILE__) . 'js/wpvr-image-resize-warning.js'), true); |
| 293 | - wp_enqueue_script($this->plugin_name, $asset_url . 'js/wpvr-admin.js', array('jquery', 'wpvr-image-resize-warning'), filemtime($admin_script_path), true); | |
| 296 | + wp_enqueue_script('wpvr-stickers', plugin_dir_url(__FILE__) . '../public/js/wpvr-stickers.js', array(), filemtime(plugin_dir_path(__FILE__) . '../public/js/wpvr-stickers.js'), true); | |
| 297 | + wp_enqueue_script($this->plugin_name, $asset_url . 'js/wpvr-admin.js', array('jquery', 'wpvr-image-resize-warning', 'wpvr-stickers'), filemtime($admin_script_path), true); | |
| 298 | + wp_enqueue_script('wpvr-sticker-fields', plugin_dir_url(__FILE__) . 'js/wpvr-sticker-fields.js', array('jquery', $this->plugin_name), filemtime(plugin_dir_path(__FILE__) . 'js/wpvr-sticker-fields.js'), true); | |
| 294 | 299 | wp_localize_script($this->plugin_name, 'wpvr_localize', array( |
| 295 | 300 | 'WriteYourCssHere' => __('Write your css here', 'wpvr'), |
| 296 | 301 | 'VideoTourNotice' => __('Turning On The Video Option Will Erase Your Virtual Tour Data. Are You Sure?', 'wpvr'), |
| 297 | 302 | 'StreetViewNotice' => __('Turning On The StreetView Option Will Erase Your Virtual Tour Data. Are You Sure?', 'wpvr'), |
| @@ -344,33 +349,48 @@ | ||
| 344 | 349 | if ($adscreen->id == "wpvr_item") { |
| 345 | 350 | wp_enqueue_script($this->plugin_name . '-shortcode', plugin_dir_url(__FILE__) . 'js/wpvr-shortcode.js', array('jquery'), $this->version, true); |
| 346 | 351 | } |
| 347 | 352 | |
| 348 | - wp_enqueue_script('owl-js', plugin_dir_url(__FILE__) . 'js/owl.carousel.js', array('jquery'), false); | |
| 349 | - wp_enqueue_script('wpvr-global', $asset_url . 'js/wpvr-global.js', array('jquery'), $this->version, false); | |
| 353 | + $is_wpvr_screen = false; | |
| 354 | + if ( isset( $adscreen->id ) ) { | |
| 355 | + $is_wpvr_screen = ( | |
| 356 | + $adscreen->id === 'wpvr_item' || | |
| 357 | + $adscreen->id === 'edit-wpvr_item' || | |
| 358 | + $adscreen->id === 'toplevel_page_wpvr' || | |
| 359 | + $adscreen->id === 'wp-vr_page_wpvr-setting' || | |
| 360 | + false !== strpos( $adscreen->id, 'wpvr' ) || | |
| 361 | + false !== strpos( $adscreen->id, 'wp-vr' ) || | |
| 362 | + ( isset( $adscreen->post_type ) && 'wpvr_item' === $adscreen->post_type ) | |
| 363 | + ); | |
| 364 | + } | |
| 350 | 365 | |
| 351 | - $admin_user = wp_get_current_user(); | |
| 352 | - $admin_name = $admin_user->display_name ?? ''; | |
| 366 | + if ( $is_wpvr_screen ) { | |
| 367 | + wp_enqueue_script('owl-js', plugin_dir_url(__FILE__) . 'js/owl.carousel.js', array('jquery'), false); | |
| 368 | + wp_enqueue_script('wpvr-global', $asset_url . 'js/wpvr-global.js', array('jquery'), $this->version, false); | |
| 353 | 369 | |
| 354 | - wp_localize_script('wpvr-global', 'wpvr_global_obj', array( | |
| 355 | - 'ajaxurl' => admin_url('admin-ajax.php'), | |
| 356 | - 'site_url' => site_url() . '/wp-json/', | |
| 357 | - 'ajax_nonce' => wp_create_nonce('wpvr'), | |
| 358 | - 'user_information' => $this->get_logged_in_user_information(), | |
| 359 | - 'is_wpvr_active' => is_plugin_active('wpvr-pro/wpvr-pro.php'), | |
| 360 | - 'admin_name' => $admin_name, | |
| 361 | - 'url_info' => array( | |
| 362 | - 'admin_url' => admin_url(), | |
| 363 | - 'screen' => $adscreen->action, | |
| 364 | - 'url' => isset( $_SERVER['PHP_SELF'] ) ? sanitize_text_field( wp_unslash( $_SERVER['PHP_SELF'] ) ) : '', | |
| 365 | - 'param' => $_GET, | |
| 366 | - ), | |
| 367 | - 'active_tab_url' => admin_url('post-new.php?post_type=wpvr_item&active_tab=scene'), | |
| 368 | - 'hotspot_warning_text' => __('Please upload a scene before proceeding to set hotspot!', 'wpvr'), | |
| 369 | - 'negative_number_warning_text' =>__('Negative numbers are not allowed!', 'wpvr'), | |
| 370 | - )); | |
| 370 | + $admin_user = wp_get_current_user(); | |
| 371 | + $admin_name = $admin_user->display_name ?? ''; | |
| 371 | 372 | |
| 372 | - wp_localize_script('wpvr-global', 'wpvr_id_options', $wpvr_list); | |
| 373 | + wp_localize_script('wpvr-global', 'wpvr_global_obj', array( | |
| 374 | + 'ajaxurl' => admin_url('admin-ajax.php'), | |
| 375 | + 'site_url' => site_url() . '/wp-json/', | |
| 376 | + 'ajax_nonce' => wp_create_nonce('wpvr'), | |
| 377 | + 'user_information' => $this->get_logged_in_user_information(), | |
| 378 | + 'is_wpvr_active' => is_plugin_active('wpvr-pro/wpvr-pro.php'), | |
| 379 | + 'admin_name' => $admin_name, | |
| 380 | + 'url_info' => array( | |
| 381 | + 'admin_url' => admin_url(), | |
| 382 | + 'screen' => $adscreen->action, | |
| 383 | + 'url' => isset( $_SERVER['PHP_SELF'] ) ? sanitize_text_field( wp_unslash( $_SERVER['PHP_SELF'] ) ) : '', | |
| 384 | + 'param' => $_GET, | |
| 385 | + ), | |
| 386 | + 'active_tab_url' => admin_url('post-new.php?post_type=wpvr_item&active_tab=scene'), | |
| 387 | + 'hotspot_warning_text' => __('Please upload a scene before proceeding to set hotspot!', 'wpvr'), | |
| 388 | + 'negative_number_warning_text' =>__('Negative numbers are not allowed!', 'wpvr'), | |
| 389 | + )); | |
| 390 | + | |
| 391 | + wp_localize_script('wpvr-global', 'wpvr_id_options', $wpvr_list); | |
| 392 | + } | |
| 373 | 393 | } |
| 374 | 394 | |
| 375 | 395 | /** |
| 376 | 396 | * Retrieve the currently logged-in user's email and name. |