| @@ -1,173 +1,3 @@ | ||
| 1 | 1 | <?php |
| 2 | - | |
| 3 | -/** | |
| 4 | - * The public-facing functionality of the plugin. | |
| 5 | - * | |
| 6 | - * @link http://rextheme.com/ | |
| 7 | - * @since 8.0.0 | |
| 8 | - * | |
| 9 | - * @package Wpvr | |
| 10 | - * @subpackage Wpvr/public | |
| 11 | - */ | |
| 12 | - | |
| 13 | -use WPVR\Builder\DIVI\WPVR_Divi_modules; | |
| 14 | - | |
| 15 | -/** | |
| 16 | - * The public-facing functionality of the plugin. | |
| 17 | - * | |
| 18 | - * Defines the plugin name, version, and two examples hooks for how to | |
| 19 | - * enqueue the public-facing stylesheet and JavaScript. | |
| 20 | - * | |
| 21 | - * @package Wpvr | |
| 22 | - * @subpackage Wpvr/public | |
| 23 | - * @author Rextheme <support@rextheme.com> | |
| 24 | - */ | |
| 25 | -class Wpvr_Public { | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * The ID of this plugin. | |
| 29 | - * | |
| 30 | - * @since 8.0.0 | |
| 31 | - * @access private | |
| 32 | - * @var string $plugin_name The ID of this plugin. | |
| 33 | - */ | |
| 34 | - private $plugin_name; | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * The version of this plugin. | |
| 38 | - * | |
| 39 | - * @since 8.0.0 | |
| 40 | - * @access private | |
| 41 | - * @var string $version The current version of this plugin. | |
| 42 | - */ | |
| 43 | - private $version; | |
| 44 | - | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * Instance of WPVR_Shortcode class | |
| 48 | - * | |
| 49 | - * @var object | |
| 50 | - * @since 8.0.0 | |
| 51 | - */ | |
| 52 | - private $shortcode; | |
| 53 | - | |
| 54 | - /** | |
| 55 | - * Initialize the class and set its properties. | |
| 56 | - * | |
| 57 | - * @since 8.0.0 | |
| 58 | - * @param string $plugin_name The name of the plugin. | |
| 59 | - * @param string $version The version of this plugin. | |
| 60 | - */ | |
| 61 | - public function __construct( $plugin_name, $version ) { | |
| 62 | - | |
| 63 | - $this->plugin_name = $plugin_name; | |
| 64 | - $this->version = $version; | |
| 65 | - $this->shortcode = new WPVR_Shortcode($this->plugin_name); | |
| 66 | - | |
| 67 | - } | |
| 68 | - | |
| 69 | - /** | |
| 70 | - * Register the stylesheets for the public-facing side of the site. | |
| 71 | - * | |
| 72 | - * @since 8.0.0 | |
| 73 | - */ | |
| 74 | - public function enqueue_styles() { | |
| 75 | - global $wp; | |
| 76 | - $wpvr_script_control = get_option('wpvr_script_control'); | |
| 77 | - | |
| 78 | - $should_load = false; | |
| 79 | - | |
| 80 | - if ( $wpvr_script_control == 'true' ) { | |
| 81 | - $wpvr_script_list = get_option('wpvr_script_list'); | |
| 82 | - $allowed_pages = isset($wpvr_script_list) && !empty($wpvr_script_list) ? array_map('sanitize_text_field', explode(",", $wpvr_script_list)) : array(); | |
| 83 | - $allowed_pages_modified = array(); | |
| 84 | - foreach ($allowed_pages as $value) { | |
| 85 | - $allowed_pages_modified[] = untrailingslashit($value); | |
| 86 | - } | |
| 87 | - $current_url = home_url(add_query_arg(isset($_GET) ? array_map('sanitize_text_field', wp_unslash($_GET)) : array(), isset($wp->request) ? sanitize_text_field($wp->request) : '')); | |
| 88 | - foreach ($allowed_pages_modified as $value) { | |
| 89 | - if ($value && strpos($current_url, $value) !== false) { | |
| 90 | - $should_load = true; | |
| 91 | - break; | |
| 92 | - } | |
| 93 | - } | |
| 94 | - } else { | |
| 95 | - $should_load = true; | |
| 96 | - } | |
| 97 | - | |
| 98 | - if ( $should_load ) { | |
| 99 | - $fontawesome_disable = get_option('wpvr_fontawesome_disable'); | |
| 100 | - if ($fontawesome_disable != 'true') { | |
| 101 | - wp_enqueue_style($this->plugin_name . 'fontawesome', plugin_dir_url(__FILE__) . 'css/fontawesome/css/all.css', array(), $this->version, 'all'); | |
| 102 | - wp_enqueue_style( | |
| 103 | - $this->plugin_name . '-icons-fix', | |
| 104 | - plugin_dir_url(__FILE__) . 'css/fontawesome/css/icons-fix.css', | |
| 105 | - array($this->plugin_name . 'fontawesome'), | |
| 106 | - $this->version | |
| 107 | - ); | |
| 108 | - } | |
| 109 | - wp_enqueue_style('videojs-css', plugin_dir_url(__FILE__) . 'lib/pannellum/src/css/video-js.css', array(), $this->version); | |
| 110 | - wp_enqueue_style('videojs-vr-css', plugin_dir_url(__FILE__) . 'lib/videojs-vr/videojs-vr.css', array(), $this->version); | |
| 111 | - wp_enqueue_style('panellium-css', plugin_dir_url(__FILE__) . 'lib/pannellum/src/css/pannellum.css', array(), $this->version); | |
| 112 | - wp_enqueue_style('owl-css', plugin_dir_url(__FILE__) . 'css/owl.carousel.css', array(), $this->version, 'all'); | |
| 113 | - wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/wpvr-public.css', array(), $this->version, 'all'); | |
| 114 | - } | |
| 115 | - } | |
| 116 | - | |
| 117 | - /** | |
| 118 | - * Register the JavaScript for the public-facing side of the site. | |
| 119 | - * | |
| 120 | - * @since 8.0.0 | |
| 121 | - */ | |
| 122 | - public function enqueue_scripts() { | |
| 123 | - global $wp; | |
| 124 | - $wpvr_script_control = get_option('wpvr_script_control'); | |
| 125 | - | |
| 126 | - if ( $wpvr_script_control == 'true' ) { | |
| 127 | - $wpvr_frontend_notice = get_option('wpvr_frontend_notice'); | |
| 128 | - $notice = $wpvr_frontend_notice ? sanitize_text_field( get_option('wpvr_frontend_notice_area') ) : ''; | |
| 129 | - $wpvr_script_list = get_option('wpvr_script_list'); | |
| 130 | - $allowed_pages = isset($wpvr_script_list) && !empty($wpvr_script_list) ? array_map('sanitize_text_field', explode(",", $wpvr_script_list)) : array(); | |
| 131 | - $allowed_pages_modified = array(); | |
| 132 | - foreach ($allowed_pages as $value) { | |
| 133 | - $allowed_pages_modified[] = untrailingslashit($value); | |
| 134 | - } | |
| 135 | - $current_url = home_url(add_query_arg(isset($_GET) ? array_map('sanitize_text_field', wp_unslash($_GET)) : array(), isset($wp->request) ? sanitize_text_field($wp->request) : '')); | |
| 136 | - | |
| 137 | - foreach ($allowed_pages_modified as $value) { | |
| 138 | - if ($value && strpos($current_url, $value) !== false) { | |
| 139 | - wp_enqueue_script('videojs-js', plugin_dir_url(__FILE__) . 'js/video.js', array(), $this->version, true); | |
| 140 | - wp_enqueue_script('videojsvr-js', plugin_dir_url(__FILE__) . 'lib/videojs-vr/videojs-vr.js', array('videojs-js'), $this->version, true); | |
| 141 | - wp_enqueue_script('panellium-js', plugin_dir_url(__FILE__) . 'lib/pannellum/src/js/pannellum.js', array(), $this->version, true); | |
| 142 | - wp_enqueue_script('panelliumlib-js', plugin_dir_url(__FILE__) . 'lib/pannellum/src/js/libpannellum.js', array('panellium-js'), $this->version, true); | |
| 143 | - wp_enqueue_script('panelliumvid-js', plugin_dir_url(__FILE__) . 'lib/pannellum/src/js/videojs-pannellum-plugin.js', array('videojs-js', 'videojsvr-js', 'panellium-js', 'panelliumlib-js'), $this->version, true); | |
| 144 | - wp_enqueue_script('owl-js', plugin_dir_url(__FILE__) . 'js/owl.carousel.js', array('jquery'), $this->version, true); | |
| 145 | - wp_enqueue_script('jquery_cookie', plugin_dir_url(__FILE__) . 'js/jquery.cookie.js', array('jquery'), $this->version, true); | |
| 146 | - wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/wpvr-public.js', array('jquery', 'jquery_cookie'), $this->version, true); | |
| 147 | - wp_localize_script('wpvr', 'wpvr_public', array( | |
| 148 | - 'notice_active' => $wpvr_frontend_notice, | |
| 149 | - 'notice' => $notice, | |
| 150 | - 'is_pro_active' => is_plugin_active('wpvr-pro/wpvr-pro.php'), | |
| 151 | - 'is_license_active' => get_option('wpvr_edd_license_status') == 'valid' ? true : false, | |
| 152 | - 'dis_on_hover' => get_option('dis_on_hover') === 'true' ? true : false, | |
| 153 | - 'mobile_hotspot_tip' => get_option('wpvr_mobile_hotspot_tip') === 'true' ? true : false, | |
| 154 | - )); | |
| 155 | - break; | |
| 156 | - } | |
| 157 | - } | |
| 158 | - } | |
| 159 | - // In auto mode, scripts are enqueued from render functions via wpvr_enqueue_frontend_scripts(). | |
| 160 | - } | |
| 161 | - | |
| 162 | - /** | |
| 163 | - * Init the edit screen of the plugin post type item | |
| 164 | - * | |
| 165 | - * @since 8.0.0 | |
| 166 | - */ | |
| 167 | - public function public_init() | |
| 168 | - { | |
| 169 | - add_shortcode($this->plugin_name, array( $this->shortcode , 'wpvr_shortcode')); | |
| 170 | - | |
| 171 | - } | |
| 172 | - | |
| 173 | -} | |
| 2 | +// Backward-compatibility shim. Path moved to legacy/ in new UI architecture. | |
| 3 | +require_once plugin_dir_path( __FILE__ ) . '../legacy/public/class-wpvr-public.php'; | |