PluginProbe
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress / 8.5.68
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress v8.5.68
9.1.3 9.1.2 9.1.1 9.1.0 9.0.3 9.0.2 9.0.1 9.0.0 8.5.79 8.5.78 8.5.77 8.5.76 8.5.75 8.5.74 8.5.73 8.5.72 8.5.71 8.5.70 8.5.69 8.5.68 8.5.35 8.5.36 8.5.37 8.5.38 8.5.39 All 222 releases
wpvr / public / class-wpvr-public.php

class-wpvr-public.php in WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress 8.5.68, at public/class-wpvr-public.php

240 lines 10.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 <[email protected]>
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
76 /**
77 * This function is provided for demonstration purposes only.
78 *
79 * An instance of this class should be passed to the run() function
80 * defined in Wpvr_Loader as all of the hooks are defined
81 * in that particular class.
82 *
83 * The Wpvr_Loader will then create the relationship
84 * between the defined hooks and the functions defined in this
85 * class.
86 */
87
88 global $wp;
89 $wpvr_script_control = get_option('wpvr_script_control');
90 $wpvr_script_list = get_option('wpvr_script_list');
91 $allowed_pages_modified = array();
92 $allowed_pages = explode(",", $wpvr_script_list);
93 foreach ($allowed_pages as $value) {
94 $allowed_pages_modified[] = untrailingslashit($value);
95 }
96 $current_url = home_url(add_query_arg(array($_GET), $wp->request));
97 if ($wpvr_script_control == 'true') {
98 foreach ($allowed_pages_modified as $value) {
99 if ($value) {
100 if (strpos($current_url, $value) !== false) {
101 $fontawesome_disable = get_option('wpvr_fontawesome_disable');
102 if ($fontawesome_disable == 'true') {
103 } else {
104 wp_enqueue_style($this->plugin_name . 'fontawesome', plugin_dir_url(__FILE__) . 'css/fontawesome/css/all.css', array(), $this->version, 'all');
105 wp_enqueue_style(
106 $this->plugin_name . '-icons-fix',
107 plugin_dir_url(__FILE__) . 'css/fontawesome/css/icons-fix.css',
108 array($this->plugin_name . 'fontawesome'),
109 $this->version
110 );
111 }
112 wp_enqueue_style('panellium-css', plugin_dir_url(__FILE__) . 'lib/pannellum/src/css/pannellum.css', array(), true);
113 wp_enqueue_style('videojs-css', plugin_dir_url(__FILE__) . 'lib/pannellum/src/css/video-js.css', array(), true);
114 wp_enqueue_style('owl-css', plugin_dir_url(__FILE__) . 'css/owl.carousel.css', array(), $this->version, 'all');
115 wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/wpvr-public.css', array(), $this->version, 'all');
116 }
117 }
118 }
119 } else {
120 $fontawesome_disable = get_option('wpvr_fontawesome_disable');
121 if ($fontawesome_disable == 'true') {
122 } else {
123 wp_enqueue_style($this->plugin_name . 'fontawesome', plugin_dir_url(__FILE__) . 'css/fontawesome/css/all.css', array(), $this->version, 'all');
124 wp_enqueue_style(
125 $this->plugin_name . '-icons-fix',
126 plugin_dir_url(__FILE__) . 'css/fontawesome/css/icons-fix.css',
127 array($this->plugin_name . 'fontawesome'),
128 $this->version
129 );
130 }
131 wp_enqueue_style('panellium-css', plugin_dir_url(__FILE__) . 'lib/pannellum/src/css/pannellum.css', array(), true);
132 wp_enqueue_style('videojs-css', plugin_dir_url(__FILE__) . 'lib/pannellum/src/css/video-js.css', array(), true); // commented for video js vr
133 // wp_enqueue_style('videojs-css', 'https://vjs.zencdn.net/7.18.1/video-js.css', array(), true); // commented for video js vr
134 wp_enqueue_style('videojs-vr-css', plugin_dir_url(__FILE__) . 'lib/videojs-vr/videojs-vr.css', array(), true); //video js VR
135 wp_enqueue_style('owl-css', plugin_dir_url(__FILE__) . 'css/owl.carousel.css', array(), $this->version, 'all');
136 wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/wpvr-public.css', array(), $this->version, 'all');
137 }
138
139 }
140
141 /**
142 * Register the JavaScript for the public-facing side of the site.
143 *
144 * @since 8.0.0
145 */
146 public function enqueue_scripts() {
147
148 $notice = '';
149 $wpvr_frontend_notice = get_option('wpvr_frontend_notice');
150 if ($wpvr_frontend_notice) {
151 $notice = get_option('wpvr_frontend_notice_area');
152 }
153 global $wp;
154 $wpvr_script_control = get_option('wpvr_script_control');
155 $wpvr_script_list = get_option('wpvr_script_list');
156 $allowed_pages_modified = array();
157 $allowed_pages = explode(",", $wpvr_script_list);
158 foreach ($allowed_pages as $value) {
159 $allowed_pages_modified[] = untrailingslashit($value);
160 }
161
162 $wpvr_video_script_control = get_option('wpvr_video_script_control');
163 $wpvr_video_script_list = get_option('wpvr_video_script_list');
164 $allowed_video_pages_modified = array();
165 $allowed_video_pages = explode(",", $wpvr_video_script_list);
166 foreach ($allowed_video_pages as $value) {
167 $allowed_video_pages_modified[] = untrailingslashit($value);
168 }
169
170 $current_url = home_url(add_query_arg(array($_GET), $wp->request));
171
172 if ($wpvr_script_control == 'true') {
173 foreach ($allowed_pages_modified as $value) {
174 if (strpos($current_url, $value) !== false) {
175 wp_enqueue_script('panellium-js', plugin_dir_url(__FILE__) . 'lib/pannellum/src/js/pannellum.js', array(), true);
176 wp_enqueue_script('panelliumlib-js', plugin_dir_url(__FILE__) . 'lib/pannellum/src/js/libpannellum.js', array(), true);
177 wp_enqueue_script('videojs-js', plugin_dir_url(__FILE__) . 'js/video.js', array(), true); //commented for video js vr
178 // wp_enqueue_script('videojs-js', 'https://vjs.zencdn.net/7.18.1/video.min.js', array(), true);
179 wp_enqueue_script('videojsvr-js', plugin_dir_url(__FILE__) . 'lib/videojs-vr/videojs-vr.js', array(), true); //video js vr
180 wp_enqueue_script('panelliumvid-js', plugin_dir_url(__FILE__) . 'lib/pannellum/src/js/videojs-pannellum-plugin.js', array(), true);
181 wp_enqueue_script('owl-js', plugin_dir_url(__FILE__) . 'js/owl.carousel.js', array('jquery'), false);
182 wp_enqueue_script('jquery_cookie', plugin_dir_url(__FILE__) . 'js/jquery.cookie.js', array('jquery'), true);
183 wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/wpvr-public.js', array('jquery', 'jquery_cookie'), $this->version, false);
184 wp_localize_script('wpvr', 'wpvr_public', array(
185 'notice_active' => $wpvr_frontend_notice,
186 'notice' => $notice,
187 'is_pro_active' => is_plugin_active('wpvr-pro/wpvr-pro.php'),
188 'is_license_active' => get_option('wpvr_edd_license_status') == 'valid' ? true : false,
189 ));
190 }
191 }
192 } else {
193 wp_enqueue_script('panellium-js', plugin_dir_url(__FILE__) . 'lib/pannellum/src/js/pannellum.js', array(), true);
194 wp_enqueue_script('panelliumlib-js', plugin_dir_url(__FILE__) . 'lib/pannellum/src/js/libpannellum.js', array(), true);
195 wp_enqueue_script('videojs-js', plugin_dir_url(__FILE__) . 'js/video.js', array(), true); // commented for video js vr
196 wp_enqueue_script('videojsvr-js', plugin_dir_url(__FILE__) . 'lib/videojs-vr/videojs-vr.js', array(), true); //video js vr
197 wp_enqueue_script('panelliumvid-js', plugin_dir_url(__FILE__) . 'lib/pannellum/src/js/videojs-pannellum-plugin.js', array(), true);
198 wp_enqueue_script('owl-js', plugin_dir_url(__FILE__) . 'js/owl.carousel.js', array('jquery'), false);
199 wp_enqueue_script('jquery_cookie', plugin_dir_url(__FILE__) . 'js/jquery.cookie.js', array('jquery'), true);
200 wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/wpvr-public.js', array('jquery', 'jquery_cookie'), $this->version, true);
201 wp_localize_script('wpvr', 'wpvr_public', array(
202 'notice_active' => $wpvr_frontend_notice,
203 'notice' => $notice,
204 'is_pro_active' => is_plugin_active('wpvr-pro/wpvr-pro.php'),
205 'is_license_active' => get_option('wpvr_edd_license_status') == 'valid' ? true : false,
206 ));
207 }
208
209 $match_found = false;
210 if ($wpvr_video_script_control == 'true') {
211 foreach ($allowed_video_pages_modified as $value) {
212 if (strpos($current_url, $value) !== false) {
213 $match_found = true;
214 wp_enqueue_script('videojs-js', plugin_dir_url(__FILE__) . 'js/video.js', array(), true); // commented for video js vr
215 wp_enqueue_script('videojsvr-js', plugin_dir_url(__FILE__) . 'lib/videojs-vr/videojs-vr.js', array(), true); //video js vr
216 wp_enqueue_script('panelliumvid-js', plugin_dir_url(__FILE__) . 'lib/pannellum/src/js/videojs-pannellum-plugin.js', array(), true);
217 }
218 }
219 if (!$match_found) {
220 wp_dequeue_script('videojs-js');
221 wp_dequeue_script('videojsvr-js');
222 wp_dequeue_script('panelliumvid-js');
223 }
224 }
225
226 }
227
228 /**
229 * Init the edit screen of the plugin post type item
230 *
231 * @since 8.0.0
232 */
233 public function public_init()
234 {
235 add_shortcode($this->plugin_name, array( $this->shortcode , 'wpvr_shortcode'));
236
237 }
238
239 }
240