WP VR – 360 Panorama and virtual tour creator for WordPress - Version 7.3.3

Version Description

(16-09-2021) = * Update: Checked Compatibility with WordPress 5.8.1. * Update: Checked Compatibility with PHP 8.0. * Update: Rollback Versions Updated to 7.3.2. * Fix: PHP Error Notices. * New: Full-window Virtual Tour Support. * New: Control video.js loading on specific pages.

Download this release

Release Info

Developer rextheme
Plugin Icon 128x128 WP VR – 360 Panorama and virtual tour creator for WordPress
Version 7.3.3
Comparing to
See all releases

Code changes from version 7.3.2 to 7.3.3

README.txt CHANGED
@@ -1,11 +1,11 @@
1
  === WP VR - 360 Panorama and Virtual Tour Builder For WordPress ===
2
  Contributors: rextheme, coderexco
3
- Tags: virtual tour, real estate tour, panorama, panorama viewer, virtual tour, 360 panorama, interactive tour, 360, streetview, virtual reality, 360 video, virtual, vr, interactive, 360-degree, equirectangular, google streetview, panoramas
4
  Donate link: https://rextheme.com/wp-vr-360-panorama-and-virtual-tour-creator-for-wordpress/
5
  Requires at least: 5.0
6
- Tested up to: 5.8
7
  Requires PHP: 7.0.0
8
- Stable tag: 7.3.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -127,6 +127,7 @@ To have more control over creating a virtual tour, learn about the [Premium vers
127
 
128
  * An unlimited number of virtual tours.
129
  * 360 Degree Video Support (Self-hosted, Youtube and Vimeo Videos).
 
130
  * Shortcode Support.
131
  * Gutenberg Block Support.
132
  * Elementor Widget Support.
@@ -148,7 +149,7 @@ To have more control over creating a virtual tour, learn about the [Premium vers
148
  * Embed Texts, Videos, Images, GIFs, and Website Links on Hotspots.
149
  * Hotspot Customization with Custom CSS.
150
  * Full-width Tour Tag.
151
- * Radius Tag for tour border-radius.
152
  * Multi-Site Support.
153
  * WP User Role Support (Editors and Authors).
154
  * Disable FontAwesome Option.
@@ -303,7 +304,7 @@ Admins & editors will have access to all virtual tours on the site to modify, up
303
 
304
  Authors can access their own tours only and modify, update, or delete them.
305
 
306
- Admins can remove the access from Authors and Editors any time.
307
 
308
  == Screenshots ==
309
  1. Upload 360 Degree Image
@@ -322,11 +323,20 @@ Admins can remove the access from Authors and Editors any time.
322
 
323
  == Changelog ==
324
 
 
 
 
 
 
 
 
 
 
325
  = 7.3.2 (04-08-2021) =
326
- *Fix: PHP Error Notices.
327
 
328
  = 7.3.1 (27-07-2021) =
329
- * Update: Checked compatibility with WordPress 5.8.
330
  * Fix: PHP Error Notice.
331
  * Tweak: Dual Action Warning for Auto-Rotation redesigned & updated.
332
  * Tweak: Invalid Pitch Value Warning redesigned & updated.
@@ -668,4 +678,4 @@ Admins can remove the access from Authors and Editors any time.
668
  * On screen control available.
669
 
670
  == Upgrade Notice ==
671
- Please do update the WP VR to the latest version. Each update makes sure your plugin is supporting all tour features.
1
  === WP VR - 360 Panorama and Virtual Tour Builder For WordPress ===
2
  Contributors: rextheme, coderexco
3
+ Tags: virtual tour, real estate tour, panorama, panorama viewer, virtual tour, 360 panorama, interactive tour, 360, Streetview, virtual reality, 360 video, virtual, vr, interactive, 360-degree, equirectangular, google streetview, panoramas
4
  Donate link: https://rextheme.com/wp-vr-360-panorama-and-virtual-tour-creator-for-wordpress/
5
  Requires at least: 5.0
6
+ Tested up to: 5.8.1
7
  Requires PHP: 7.0.0
8
+ Stable tag: 7.3.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
127
 
128
  * An unlimited number of virtual tours.
129
  * 360 Degree Video Support (Self-hosted, Youtube and Vimeo Videos).
130
+ * Full-window Virtual Tours.
131
  * Shortcode Support.
132
  * Gutenberg Block Support.
133
  * Elementor Widget Support.
149
  * Embed Texts, Videos, Images, GIFs, and Website Links on Hotspots.
150
  * Hotspot Customization with Custom CSS.
151
  * Full-width Tour Tag.
152
+ * Radius Tag for tour border radius.
153
  * Multi-Site Support.
154
  * WP User Role Support (Editors and Authors).
155
  * Disable FontAwesome Option.
304
 
305
  Authors can access their own tours only and modify, update, or delete them.
306
 
307
+ Admins can remove the access from Authors and Editors at any time.
308
 
309
  == Screenshots ==
310
  1. Upload 360 Degree Image
323
 
324
  == Changelog ==
325
 
326
+ = 7.3.3 (16-09-2021) =
327
+ * Update: Checked Compatibility with WordPress 5.8.1.
328
+ * Update: Checked Compatibility with PHP 8.0.
329
+ * Update: Rollback Versions Updated to 7.3.2.
330
+ * Fix: PHP Error Notices.
331
+ * New: Full-window Virtual Tour Support.
332
+ * New: Control video.js loading on specific pages.
333
+
334
+
335
  = 7.3.2 (04-08-2021) =
336
+ * Fix: PHP Error Notices.
337
 
338
  = 7.3.1 (27-07-2021) =
339
+ * Update: Checked Compatibility with WordPress 5.8.
340
  * Fix: PHP Error Notice.
341
  * Tweak: Dual Action Warning for Auto-Rotation redesigned & updated.
342
  * Tweak: Invalid Pitch Value Warning redesigned & updated.
678
  * On screen control available.
679
 
680
  == Upgrade Notice ==
681
+ Please do update the WP VR to the latest version. Each update makes sure your plugin is supporting all tour features.
admin/class-wpvr-ajax.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
  /**
4
  * The admin-specific Ajax files.
5
  *
@@ -10,283 +10,310 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
10
  * @subpackage Wpvr/admin
11
  */
12
 
13
- class Wpvr_Ajax {
 
14
 
15
  /**
16
  * Preview show ajax function
17
  */
18
- function wpvr_show_preview() {
19
- $panoid ='';
20
- $postid = sanitize_text_field($_POST['postid']);
21
- $post_type = get_post_type( $postid );
 
 
 
 
 
 
 
 
 
 
22
 
23
- $panoid = 'pano'.$postid;
 
 
 
 
 
24
 
25
- $control = sanitize_text_field($_POST['control']);
26
- if ($control == 'on') {
27
- $control = true;
28
- }
29
- else {
30
- $control = false;
31
- }
32
 
33
- $compass = sanitize_text_field($_POST['compass']);
34
- if ($compass == 'on') {
35
- $compass = true;
36
- }
37
- else {
38
- $compass = false;
39
- }
40
 
41
- $mouseZoom = sanitize_text_field($_POST['mouseZoom']);
42
- if ($mouseZoom == 'off') {
43
- $mouseZoom = false;
44
- }
45
- else {
46
- $mouseZoom = true;
47
- }
48
 
49
- $draggable = sanitize_text_field($_POST['draggable']);
50
- if ($draggable == 'off') {
51
- $draggable = false;
52
- }
53
- else {
54
- $draggable = true;
55
- }
56
 
57
- $diskeyboard = sanitize_text_field($_POST['diskeyboard']);
58
- if ($diskeyboard == 'on') {
59
- $diskeyboard = true;
60
- }
61
- else {
62
- $diskeyboard = false;
63
- }
64
 
65
- $keyboardzoom = sanitize_text_field($_POST['keyboardzoom']);
66
- if ($keyboardzoom == 'off') {
67
- $keyboardzoom = false;
68
- }
69
- else {
70
- $keyboardzoom = true;
71
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
 
73
- $autoload = sanitize_text_field($_POST['autoload']);
74
- if ($autoload == 'on') {
75
- $autoload = true;
76
- }
77
- else {
78
- $autoload = false;
79
- }
80
 
81
- $default_scene = '';
82
- $default_scene = sanitize_text_field($_POST['defaultscene']);
83
- $preview = '';
84
- $preview = esc_url($_POST['preview']);
85
-
86
- $rotation = '';
87
- $rotation = sanitize_text_field($_POST['rotation']);
88
-
89
- $autorotation = '';
90
- $autorotation = sanitize_text_field($_POST['autorotation']);
91
- $autorotationinactivedelay = '';
92
- $autorotationinactivedelay = sanitize_text_field($_POST['autorotationinactivedelay']);
93
- $autorotationstopdelay = '';
94
- $autorotationstopdelay = sanitize_text_field($_POST['autorotationstopdelay']);
95
-
96
- $default_global_zoom = '';
97
- $max_global_zoom = '';
98
- $min_global_zoom = '';
99
- if(isset($_POST['gzoom']) == 'on'){
100
- $default_global_zoom = $_POST['dzoom'];
101
- $max_global_zoom = $_POST['maxzoom'];
102
- $min_global_zoom = $_POST['minzoom'];
103
  }
104
- if (!empty($autorotationinactivedelay) && !empty($autorotationstopdelay)) {
105
- wp_send_json_error('<span class="pano-error-title">Dual Action Error for Auto-Rotation</span><p> You can not use both Resume Auto-rotation & Stop Auto-rotation on the same tour. You can use only one of them.</p>');
106
 
107
- die();
108
- }
109
 
110
- $scene_fade_duration = '';
111
- $scene_fade_duration = sanitize_text_field($_POST['scenefadeduration']);
112
-
113
- $panodata = $_POST['panodata'];
114
- $panolist = stripslashes($panodata);
115
- $panodata = (array)json_decode($panolist);
116
- $panolist = array();
117
- if(is_array($panodata["scene-list"])) {
118
- foreach ($panodata["scene-list"] as $scenes_data) {
119
- $temp_array = array();
120
- $temp_array = (array)$scenes_data;
121
- if ($temp_array['hotspot-list']) {
122
- $_hotspot_array = array();
123
- foreach ($temp_array['hotspot-list'] as $temp_hotspot) {
124
- $temp_hotspot = (array)$temp_hotspot;
125
- $_hotspot_array[] = $temp_hotspot;
126
- }
127
  }
128
- $temp_array['hotspot-list'] = $_hotspot_array;
129
- $panolist['scene-list'][] = $temp_array;
130
- }
131
- }
132
- $panodata = $panolist;
133
-
134
- //===Error Control and Validation===//
135
 
136
- if ($panodata["scene-list"] != "") {
137
- foreach ($panodata["scene-list"] as $scenes_val) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
 
139
- $scene_id_validate = $scenes_val["scene-id"];
 
 
 
140
 
141
-
142
- if (!empty($scene_id_validate)) {
143
- $scene_id_validated = preg_replace('/[^0-9a-zA-Z_]/',"",$scene_id_validate);
144
- if ($scene_id_validated != $scene_id_validate) {
145
- wp_send_json_error('<span class="pano-error-title">Invalid Scene ID</span> <p>Scene ID can\'t contain spaces and special characters. <br/>Please assign a unique Scene ID with letters and numbers where Scene ID is : '.$scene_id_validate.'</p>');
146
  die();
147
  }
 
148
  if (empty($scenes_val["scene-attachment-url"])) {
149
- wp_send_json_error('<span class="pano-error-title">Missing Scene Image</span><p> Please upload a 360 Degree image where Scene ID is: '.$scene_id_validate.'</p>');
150
  die();
151
  }
 
152
 
153
- if (!empty($scenes_val["scene-pitch"])) {
154
- $validate_scene_pitch = $scenes_val["scene-pitch"];
155
- $validated_scene_pitch = preg_replace('/[^0-9.-]/','',$validate_scene_pitch);
156
- if ($validated_scene_pitch != $validate_scene_pitch) {
157
- wp_send_json_error('<span class="pano-error-title">Invalid Pitch Value</span><p> The Pitch Value can only contain float numbers where Scene ID: '.$scene_id_validate.'</p>');
158
- die();
159
- }
160
  }
 
161
 
162
- if (!empty($scenes_val["scene-yaw"])) {
163
- $validate_scene_yaw = $scenes_val["scene-yaw"];
164
- $validated_scene_yaw = preg_replace('/[^0-9.-]/','',$validate_scene_yaw);
165
- if ($validated_scene_yaw != $validate_scene_yaw) {
166
- wp_send_json_error('<span class="pano-error-title">Invalid Yaw Value</span><p> The Yaw Value can only contain float numbers where Scene ID: '.$scene_id_validate.'</p>');
167
- die();
168
- }
169
  }
 
170
 
171
- if (!empty($scenes_val["scene-zoom"])) {
172
- $validate_default_zoom = $scenes_val["scene-zoom"];
173
- $validated_default_zoom = preg_replace('/[^0-9-]/','',$validate_default_zoom);
174
- if ($validated_default_zoom != $validate_default_zoom) {
175
- wp_send_json_error('<span class="pano-error-title">Invalid Default Zoom Value</span><p> You can only set Default Zoom in Degree values from 50 to 120 where Scene ID: '.$scene_id_validate.'</p>');
176
- die();
177
- }
178
- $default_zoom_value = (int)$scenes_val["scene-zoom"];
179
- if ($default_zoom_value > 120 || $default_zoom_value < 50) {
180
- wp_send_json_error('<span class="pano-error-title">Invalid Default Zoom Value</span><p> You can only set Default Zoom in Degree values from 50 to 120 where Scene ID: '.$scene_id_validate.'</p>');
181
 
182
- die();
183
- }
184
  }
 
185
 
186
- if (!empty($scenes_val["scene-maxzoom"])) {
187
- $validate_max_zoom = $scenes_val["scene-maxzoom"];
188
- $validated_max_zoom = preg_replace('/[^0-9-]/','',$validate_max_zoom);
189
- if ($validated_max_zoom != $validate_max_zoom) {
190
- wp_send_json_error('<span class="pano-error-title">Invalid Max-zoom Value:</span><p> You can only set Max-zoom in degree values (50-120) where Scene ID: '.$scene_id_validate.'</p>');
191
 
192
- die();
193
- }
194
- $max_zoom_value = (int)$scenes_val["scene-maxzoom"];
195
- if ($max_zoom_value > 120 ) {
196
- wp_send_json_error('<span class="pano-error-title">Max-zoom Value Limit Exceeded</span><p> You can set the Max-zoom Value up to 120 degrees.</p>');
197
- die();
198
- }
199
  }
 
 
 
 
 
 
200
 
201
- if (!empty($scenes_val["scene-minzoom"])) {
202
- $validate_min_zoom = $scenes_val["scene-minzoom"];
203
- $validated_min_zoom = preg_replace('/[^0-9-]/','',$validate_min_zoom);
204
- if ($validated_min_zoom != $validate_min_zoom) {
205
- wp_send_json_error('<span class="pano-error-title">Invalid Min-zoom Value</span><p> You can only set Min-zoom in degree values (50-120) where Scene ID: '.$scene_id_validate.'</p>');
206
- die();
207
- }
208
- $min_zoom_value = (int)$scenes_val["scene-minzoom"];
209
- if ($min_zoom_value < 50 ) {
210
- wp_send_json_error('<span class="pano-error-title">Low Min-Zoom Value</span><p> The Min-zoom value must be more than 50 in degree values where Scene ID: '.$scene_id_validate.'</p>');
211
- die();
212
- }
213
  }
214
-
215
- if ($scenes_val["hotspot-list"] != "") {
216
- foreach ($scenes_val["hotspot-list"] as $hotspot_val) {
217
 
218
- $hotspot_title_validate = $hotspot_val["hotspot-title"];
 
219
 
220
-
221
- if (!empty($hotspot_title_validate)) {
222
- $hotspot_title_validated = preg_replace('/[^0-9a-zA-Z_]/',"",$hotspot_title_validate);
223
- if ($hotspot_title_validated != $hotspot_title_validate) {
224
- wp_send_json_error('<span class="pano-error-title">Invalid Hotspot ID</span> <p>Hotspot ID can\'t contain spaces and special characters. <br/>Please assign a unique Hotspot ID with letters and numbers where Scene id: '.$scene_id_validate.' Hotspot ID is: '.$hotspot_title_validate.'</p>');
225
- die();
226
- }
227
 
228
- $hotspot_pitch_validate = $hotspot_val["hotspot-pitch"];
229
- if (!empty($hotspot_pitch_validate)) {
230
- $hotspot_pitch_validated = preg_replace('/[^0-9.-]/','',$hotspot_pitch_validate);
231
- if ($hotspot_pitch_validated != $hotspot_pitch_validate) {
232
- wp_send_json_error('<span class="pano-error-title">Invalid Pitch Value</span> <p>The Pitch Value can only contain float numbers where Scene ID: '.$scene_id_validate.' Hotspot ID is: '.$hotspot_title_validate.'</p>');
233
-
234
- die();
235
- }
236
- }
237
 
238
- $hotspot_yaw_validate = $hotspot_val["hotspot-yaw"];
239
- if (!empty($hotspot_yaw_validate)) {
240
- $hotspot_yaw_validated = preg_replace('/[^0-9.-]/','',$hotspot_yaw_validate);
241
- if ($hotspot_yaw_validated != $hotspot_yaw_validate) {
242
- wp_send_json_error('<span class="pano-error-title">Invalid Yaw Value</span> <p>The Yaw Value can only contain float numbers where Scene ID: '.$scene_id_validate.' Hotspot ID is: '.$hotspot_title_validate.'</p>');
 
243
 
244
- die();
245
- }
 
 
 
 
 
246
  }
 
247
 
248
- if(is_plugin_active( 'wpvr-pro/wpvr-pro.php' )){
249
- $status = get_option( 'wpvr_edd_license_status' );
250
- if( $status !== false && $status == 'valid' ) {
251
- if ($hotspot_val["hotspot-customclass-pro"] != 'none' && !empty($hotspot_val["hotspot-customclass"])) {
252
- wp_send_json_error('<span class="pano-error-title">Warning!</span> <p>You can not use both Custom Icon and Custom Icon Class for a hotspot where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
253
- die();
254
- }
255
- }
256
  }
257
- $hotspot_type_validate = $hotspot_val["hotspot-type"];
258
- $hotspot_url_validate = $hotspot_val["hotspot-url"];
259
- if (!empty($hotspot_url_validate)) {
260
- $hotspot_url_validated = esc_url($hotspot_url_validate);
261
- if ($hotspot_url_validated != $hotspot_url_validate) {
262
- wp_send_json_error('<p><span>Warning:</span> Hotspot Url is invalid where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
 
263
  die();
264
  }
265
  }
266
- $hotspot_content_validate = $hotspot_val["hotspot-content"];
 
 
 
 
 
 
 
 
 
 
267
 
268
- $hotspot_scene_validate = $hotspot_val["hotspot-scene"];
269
 
270
- if ($hotspot_type_validate == "info") {
271
- if (!empty($hotspot_scene_validate)) {
272
- wp_send_json_error('<p><span>Warning:</span> Don\'t add Target Scene ID on info type hotspot where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
273
- die();
274
- }
275
- if (!empty($hotspot_url_validate) && !empty($hotspot_content_validate)) {
276
- wp_send_json_error('<span class="pano-error-title">Warning!</span> <p>You can not set both On Click Content and URL on a hotspot where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
277
- die();
278
- }
279
  }
 
280
 
281
- if ($hotspot_type_validate == "scene") {
282
- if (empty($hotspot_scene_validate)) {
283
- wp_send_json_error('<span class="pano-error-title">Target Scene Missing</span> <p>Assign a Target Scene to the Scene-type Hotspot where Scene ID: '.$scene_id_validate.' and Hotspot ID : '.$hotspot_title_validate.'</p>');
284
- die();
285
- }
286
- if (!empty($hotspot_url_validate) || !empty($hotspot_content_validate)) {
287
- wp_send_json_error('<p><span>Warning:</span> Don\'t add Url or On click content on scene type hotspot where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
288
- die();
289
- }
290
  }
291
  }
292
  }
@@ -294,911 +321,921 @@ class Wpvr_Ajax {
294
  }
295
  }
296
  }
297
- //===Error Control and Validation===//
298
- foreach ($panodata["scene-list"] as $panoscenes) {
299
- if (empty($panoscenes['scene-id']) && !empty($panoscenes['scene-attachment-url'])) {
300
- wp_send_json_error('<span class="pano-error-title">Missing Scene ID</span> <p>Please assign a unique Scene ID to your uploaded scene.</p>');
301
- die();
302
- }
303
  }
 
304
 
305
- $allsceneids = array();
306
 
307
- foreach ($panodata["scene-list"] as $panoscenes) {
308
- if (!empty($panoscenes['scene-id'])) {
309
- array_push($allsceneids, $panoscenes['scene-id']);
310
- }
311
  }
 
312
 
313
- foreach ($panodata["scene-list"] as $panoscenes) {
314
 
315
- if ($panoscenes['dscene'] == 'on') {
316
- $default_scene = $panoscenes['scene-id'];
317
- }
318
  }
319
- if (empty($default_scene)) {
320
- if ($allsceneids) {
321
- $default_scene = $allsceneids[0];
322
- }
323
- else {
324
- wp_send_json_error('<p><span>Warning:</span> No default scene selected and no scene id found to set as default. You need at least one scene to publish a tour </p>');
325
- die();
326
- }
327
  }
 
328
 
329
- $allsceneids_count = array_count_values($allsceneids);
330
- foreach ($allsceneids_count as $key => $value) {
331
- if ($value > 1) {
332
- wp_send_json_error('<span class="pano-error-title">Duplicate Scene ID</span> <p>You\'ve assigned a duplicate Scene ID. <br/>Please assign unique Scene IDs to each scene. </p>');
333
- die();
334
- }
335
  }
 
336
 
337
- foreach ($panodata["scene-list"] as $panoscenes) {
338
- if (!empty($panoscenes['scene-id'])) {
339
- $allhotspot = array();
340
- foreach ($panoscenes["hotspot-list"] as $hotspot_val) {
341
-
342
- if (!empty($hotspot_val["hotspot-title"])) {
343
- array_push($allhotspot, $hotspot_val["hotspot-title"]);
344
- }
345
- }
346
- $allhotspotcount = array_count_values($allhotspot);
347
- foreach ($allhotspotcount as $key => $value) {
348
- if ($value > 1) {
349
- wp_send_json_error('<span class="pano-error-title">Duplicate Hotspot ID</span> <p>You\'ve assigned a duplicate Hotspot ID. <br/>Please assign unique Hotspot IDs to each Hotspot.</p>');
350
- die();
351
- }
352
- }
353
  }
354
  }
 
355
 
356
- $default_data = array();
357
- if($_POST['gzoom'] == 'on'){
358
- $default_data = array("firstScene"=>$default_scene,"sceneFadeDuration"=>$scene_fade_duration,"hfov"=>$default_global_zoom,"maxHfov"=>$max_global_zoom,"minHfov"=>$min_global_zoom);
359
- }else{
360
- $default_data = array("firstScene"=>$default_scene,"sceneFadeDuration"=>$scene_fade_duration);
361
- }
362
- $scene_data = array();
363
- foreach ($panodata["scene-list"] as $panoscenes) {
364
- if (!empty($panoscenes['scene-id'])) {
365
- $scene_ititle = '';
366
- $scene_ititle = sanitize_text_field($panoscenes["scene-ititle"]);
367
- $scene_author = '';
368
- $scene_author = sanitize_text_field($panoscenes["scene-author"]);
369
 
370
- $scene_vaov = 180;
371
- $scene_vaov = (float)$panoscenes["scene-vaov"];
372
 
373
- $scene_haov = 360;
374
- $scene_haov = (float)$panoscenes["scene-haov"];
375
 
376
- $scene_vertical_offset = 0;
377
- $scene_vertical_offset = (float)$panoscenes["scene-vertical-offset"];
378
 
379
- $default_scene_pitch = null;
380
- $default_scene_pitch = (float)$panoscenes["scene-pitch"];
381
 
382
- $default_scene_yaw = null;
383
- $default_scene_yaw = (float)$panoscenes["scene-yaw"];
384
 
385
- $scene_max_pitch = '';
386
- $scene_max_pitch = (float)$panoscenes["scene-maxpitch"];
387
 
388
- $scene_min_pitch = '';
389
- $scene_min_pitch = (float)$panoscenes["scene-minpitch"];
390
 
391
- $scene_max_yaw = '';
392
- $scene_max_yaw = (float)$panoscenes["scene-maxyaw"];
393
 
394
- $scene_min_yaw = '';
395
- $scene_min_yaw = (float)$panoscenes["scene-minyaw"];
396
 
 
 
 
 
 
397
  $default_zoom = 100;
398
- $default_zoom = $panoscenes["scene-zoom"];
399
- if (!empty($default_zoom)) {
400
- $default_zoom = (int)$panoscenes["scene-zoom"];
401
- }
402
- else {
403
- $default_zoom = 100;
404
- }
405
 
 
 
 
 
 
406
  $max_zoom = 120;
407
- $max_zoom = $panoscenes["scene-maxzoom"];
408
- if (!empty($max_zoom)) {
409
- $max_zoom = (int)$panoscenes["scene-maxzoom"];
410
- }
411
- else {
412
- $max_zoom = 120;
413
- }
414
 
 
 
 
 
 
415
  $min_zoom = 50;
416
- $min_zoom = $panoscenes["scene-minzoom"];
417
- if (!empty($min_zoom)) {
418
- $min_zoom = (int)$panoscenes["scene-minzoom"];
419
- }
420
- else {
421
- $min_zoom = 50;
422
- }
423
 
424
- $hotspot_datas = $panoscenes["hotspot-list"];
425
 
426
- $hotspots = array();
427
- foreach ($hotspot_datas as $hotspot_data) {
428
 
429
- if (!empty($hotspot_data["hotspot-title"])) {
430
 
431
- $hotspot_type = $hotspot_data["hotspot-type"] !== 'scene' ? 'info' : $hotspot_data["hotspot-type"];
432
- $hotspot_content = '';
433
 
434
- ob_start();
435
- do_action('wpvr_hotspot_content_admin', $hotspot_data);
436
- $hotspot_content = ob_get_clean();
437
 
438
 
439
- if(!$hotspot_content) $hotspot_content = $hotspot_data["hotspot-content"];
440
 
441
-
442
- $hotspot_info = array(
443
- "text"=>$hotspot_data["hotspot-title"],
444
- "pitch"=>$hotspot_data["hotspot-pitch"],
445
- "yaw"=>$hotspot_data["hotspot-yaw"],
446
- "type"=>$hotspot_type,
447
- "URL"=>$hotspot_data["hotspot-url"],
448
- "clickHandlerArgs"=>$hotspot_content,
449
- "createTooltipArgs"=>$hotspot_data["hotspot-hover"],
450
- "sceneId"=>$hotspot_data["hotspot-scene"],
451
- "targetPitch"=>(float)$hotspot_data["hotspot-scene-pitch"],
452
- "targetYaw"=>(float)$hotspot_data["hotspot-scene-yaw"],
453
- 'hotspot_type' => $hotspot_data['hotspot-type']
454
- );
455
 
456
- array_push($hotspots, $hotspot_info);
457
- if (empty($hotspot_data["hotspot-scene"])) {
458
- unset($hotspot_info['targetPitch']);
459
- unset($hotspot_info['targetYaw']);
460
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  }
462
  }
 
463
 
464
- $scene_info = array();
465
- $scene_info = array("type"=>$panoscenes["scene-type"],"panorama"=>$panoscenes["scene-attachment-url"],"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 ,"vaov"=>$scene_vaov, "haov"=>$scene_haov, "vOffset"=>$scene_vertical_offset, "hotSpots"=>$hotspots);
 
 
 
 
 
 
 
 
 
466
 
467
- if ($panoscenes["ptyscene"] == "off") {
468
- unset($scene_info['pitch']);
469
- unset($scene_info['yaw']);
470
- }
471
 
472
- if (empty($panoscenes["scene-ititle"])) {
473
- unset($scene_info['title']);
474
- }
475
- if (empty($panoscenes["scene-author"])) {
476
- unset($scene_info['author']);
477
- }
478
 
479
- if (empty($scene_vaov)) {
480
- unset($scene_info['vaov']);
481
- }
 
482
 
483
- if (empty($scene_haov)) {
484
- unset($scene_info['haov']);
485
- }
 
 
 
486
 
487
- if (empty($scene_vertical_offset)) {
488
- unset($scene_info['vOffset']);
489
- }
490
 
491
- if ($panoscenes["cvgscene"] == "off") {
492
- unset($scene_info['maxPitch']);
493
- unset($scene_info['minPitch']);
494
- }
495
- if (empty($panoscenes["scene-maxpitch"])) {
496
- unset($scene_info['maxPitch']);
497
- }
498
 
499
- if (empty($panoscenes["scene-minpitch"])) {
500
- unset($scene_info['minPitch']);
501
- }
502
 
503
- if ($panoscenes["chgscene"] == "off") {
504
- unset($scene_info['maxYaw']);
505
- unset($scene_info['minYaw']);
 
 
 
 
506
 
507
- }
508
- if (empty($panoscenes["scene-maxyaw"])) {
509
- unset($scene_info['maxYaw']);
510
- }
511
 
512
- if (empty($panoscenes["scene-minyaw"])) {
513
- unset($scene_info['minYaw']);
514
- }
 
 
 
 
515
 
516
- // if ($panoscenes["czscene"] == "off") {
517
- // unset($scene_info['hfov']);
518
- // unset($scene_info['maxHfov']);
519
- // unset($scene_info['minHfov']);
520
- // }
521
 
522
- $scene_array = array();
523
- $scene_array = array(
524
- $panoscenes["scene-id"]=>$scene_info
525
- );
526
- $scene_data[$panoscenes["scene-id"]] = $scene_info;
527
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
528
 
 
 
 
 
529
  }
530
-
531
- $pano_id_array = array();
532
- $pano_id_array = array("panoid"=>$panoid);
533
- $pano_response = array();
534
- $pano_response = array("autoLoad"=>$autoload,"defaultZoom"=>$default_global_zoom,"minZoom"=>$min_global_zoom,"maxZoom"=>$max_global_zoom,"showControls"=>$control,"compass"=>$compass,"mouseZoom"=>$mouseZoom,"draggable"=>$draggable,"disableKeyboardCtrl"=>$diskeyboard,'keyboardZoom'=>$keyboardzoom,"preview"=>$preview,"autoRotate"=>$autorotation,"autoRotateInactivityDelay"=>$autorotationinactivedelay,"autoRotateStopDelay"=>$autorotationstopdelay,"default"=>$default_data,"scenes"=>$scene_data);
535
-
536
- if ($rotation == 'off') {
537
- unset($pano_response['autoRotate']);
538
- unset($pano_response['autoRotateInactivityDelay']);
539
- unset($pano_response['autoRotateStopDelay']);
 
 
 
 
 
540
  }
541
- if (empty($autorotation)) {
542
- unset($pano_response['autoRotate']);
543
- unset($pano_response['autoRotateInactivityDelay']);
544
- unset($pano_response['autoRotateStopDelay']);
 
545
  }
546
- if (empty($autorotationinactivedelay)) {
547
- unset($pano_response['autoRotateInactivityDelay']);
 
 
 
 
 
 
 
 
 
548
  }
549
- if (empty($autorotationstopdelay)) {
550
- unset($pano_response['autoRotateStopDelay']);
 
 
 
 
551
  }
552
 
553
- // if($_POST['gzoom'] == 'off' ){
554
- // unset($pano_response['defaultZoom']);
555
- // unset($pano_response['minZoom']);
556
- // unset($pano_response['maxZoom']);
557
- // }
558
- $response = array();
559
- $response = array($pano_id_array,$pano_response);
560
- wp_send_json_success( $response );
 
 
 
 
561
  }
562
 
563
- /**
564
- * Video Preview show ajax function
565
- */
566
- function wpvrvideo_preview() {
567
- $panoid ='';
568
- $postid = sanitize_text_field($_POST['postid']);
569
- $panoid = 'pano'.$postid;
570
- $randid = rand(1000, 1000000);
571
- $vidid = 'vid'.$randid;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
572
  $videourl = esc_url_raw($_POST['videourl']);
573
  $autoplay = sanitize_text_field($_POST['autoplay']);
 
574
  $loop = sanitize_text_field($_POST['loop']);
575
-
576
  $vidtype = '';
 
577
  if (strpos($videourl, 'youtube') > 0) {
578
  $vidtype = 'youtube';
579
  $explodeid = '';
580
- $explodeid = explode("=",$videourl);
 
581
 
582
  if ($autoplay == 'on') {
583
  $autoplay = '&autoplay=1';
584
- $muted = '&mute=1';
585
- }
586
- else {
587
  $autoplay = '';
588
- $muted = '';
589
  }
590
 
591
  if ($loop == 'on') {
592
  $loop = '&loop=1';
593
- }
594
- else {
595
  $loop = '';
596
  }
597
 
598
- $foundid = '';
599
- $foundid = $explodeid[1].'?'.$autoplay.$loop;
600
  $html = '';
601
- $html .= '
602
- <iframe src="https://www.youtube.com/embed/'.$explodeid[1].'?rel=0&modestbranding=1'.$loop.'&autohide=1'.$muted.'&showinfo=0&controls=1'.$autoplay.'" width="600" height="400" frameborder="0" allowfullscreen></iframe>
603
- ';
604
-
605
  } elseif (strpos($videourl, 'youtu.be') > 0) {
606
  $vidtype = 'youtube';
607
  $explodeid = '';
608
- $explodeid = explode("/",$videourl);
 
609
 
610
  if ($autoplay == 'on') {
611
  $autoplay = '&autoplay=1';
612
- }
613
- else {
614
  $autoplay = '';
615
  }
616
 
617
  if ($loop == 'on') {
618
  $loop = '&loop=1';
619
- }
620
- else {
621
  $loop = '';
622
  }
623
 
624
- $foundid = '';
625
- $foundid = $explodeid[3].'?'.$autoplay.$loop;
626
  $html = '';
627
- $html .= '<iframe width="600" height="400" src="https://www.youtube.com/embed/'.$foundid.'" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
628
-
629
- }
630
- elseif (strpos($videourl, 'vimeo') > 0) {
631
  $vidtype = 'vimeo';
632
  $explodeid = '';
633
- $explodeid = explode("/",$videourl);
634
  $foundid = '';
635
 
636
  if ($autoplay == 'on') {
637
  $autoplay = '&autoplay=1&muted=1';
638
- }
639
- else {
640
  $autoplay = '';
641
  }
642
 
643
  if ($loop == 'on') {
644
  $loop = '&loop=1';
645
- }
646
- else {
647
  $loop = '';
648
  }
649
 
650
- $foundid = $explodeid[3].'?'.$autoplay.$loop;
651
  $html = '';
652
- $html .= '<iframe src="https://player.vimeo.com/video/'.$foundid.'" width="600" height="400" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
653
-
654
  } else {
655
  $vidtype = 'selfhost';
 
 
 
656
 
657
  if ($autoplay == 'on') {
658
- $autoplay = 'autoplay';
659
- }
660
- else {
661
  $autoplay = '';
662
  }
663
 
664
-
665
  if ($loop == 'on') {
666
  $loop = 'loop';
667
- }
668
- else {
669
  $loop = '';
670
  }
671
 
672
  $html = '';
673
- $html .= '<video id="'.$vidid.'" class="video-js vjs-default-skin vjs-big-play-centered" '.$autoplay.' '.$loop.' controls preload="none" style="width:100%;height:400px;" poster="" >';
674
- $html .= '<source src="'.$videourl.'" type="video/mp4"/>';
675
- $html .= '<p class="vjs-no-js">';
676
- $html .= 'To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com html5-video-support/" target="_blank">supports HTML5 video</a>';
677
- $html .= '</p>';
678
  $html .= '</video>';
679
  }
680
 
681
- $response = array();
682
- $response = array(__( "panoid" )=>$panoid,__( "panodata" )=>$html,__( "vidid" )=>$vidid,__( "vidtype" )=>$vidtype);
683
- wp_send_json_success( $response );
684
- }
685
 
686
- function wpvr_save_data() {
687
 
688
- $panoid ='';
689
- $postid = sanitize_text_field($_POST['postid']);
690
- $prevtext = sanitize_text_field($_POST['previewtext']);
691
- // error_log(print_r($_POST['customColor'],1));
692
- $previewtext = '';
693
- if(strlen($prevtext) <= 50 ){
694
- $previewtext = $prevtext;
695
- }
696
- $post_type = get_post_type( $postid );
697
- if ($post_type != 'wpvr_item') {
698
- die();
699
- }
700
- $panoid = 'pano'.$postid;
701
-
702
- $default_global_zoom = '';
703
- $max_global_zoom = '';
704
- $min_global_zoom = '';
705
- if(isset($_POST['gzoom']) == 'on'){
706
- $default_global_zoom = $_POST['dzoom'];
707
- $max_global_zoom = $_POST['maxzoom'];
708
- $min_global_zoom = $_POST['minzoom'];
709
- }
710
-
711
- if(isset($_POST['streetview'])){
712
- $streetview = $_POST['streetview'];
713
- if ($streetview == 'on') {
714
- $streetviewurl = esc_url_raw($_POST['streetviewurl']);
715
- if ($streetviewurl) {
716
- $html .= '<iframe src="'.$streetviewurl.'" width="600" height="400" frameborder="0" style="border:0;" allowfullscreen=""></iframe>';
717
- }
718
- $streetviewarray = array();
719
- $streetviewarray = array(__( "panoid" )=>$panoid,__( "streetviewdata" )=>$html,__( "streetviewurl" )=>$streetviewurl,__( "streetview" )=>$streetview);
720
- update_post_meta( $postid, 'panodata', $streetviewarray );
721
- die();
722
- }
723
-
724
- }
725
-
726
-
727
- $pnovideo = $_POST['panovideo'];
728
- if ($pnovideo == "on") {
729
-
730
- $vidid = 'vid'.$postid;
731
- $videourl = esc_url_raw($_POST['videourl']);
732
- $autoplay = sanitize_text_field($_POST['autoplay']);
733
- $vidautoplay = sanitize_text_field($_POST['autoplay']);
734
- $loop = sanitize_text_field($_POST['loop']);
735
- $vidloop = sanitize_text_field($_POST['loop']);
736
- $vidtype = '';
737
-
738
- if (strpos($videourl, 'youtube') > 0) {
739
- $vidtype = 'youtube';
740
- $explodeid = '';
741
- $explodeid = explode("=",$videourl);
742
- $foundid = '';
743
-
744
- if ($autoplay == 'on') {
745
- $autoplay = '&autoplay=1';
746
- }
747
- else {
748
- $autoplay = '';
749
- }
750
-
751
- if ($loop == 'on') {
752
- $loop = '&loop=1';
753
- }
754
- else {
755
- $loop = '';
756
- }
757
-
758
- $foundid = $explodeid[1].'?'.$autoplay.$loop;
759
- $html = '';
760
- $html .= '<iframe width="600" height="400" src="https://www.youtube.com/embed/'.$foundid.'" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
761
-
762
- }
763
- elseif (strpos($videourl, 'youtu.be') > 0) {
764
- $vidtype = 'youtube';
765
- $explodeid = '';
766
- $explodeid = explode("/",$videourl);
767
- $foundid = '';
768
-
769
- if ($autoplay == 'on') {
770
- $autoplay = '&autoplay=1';
771
- }
772
- else {
773
- $autoplay = '';
774
- }
775
-
776
- if ($loop == 'on') {
777
- $loop = '&loop=1';
778
- }
779
- else {
780
- $loop = '';
781
- }
782
-
783
- $foundid = $explodeid[3].'?'.$autoplay.$loop;
784
- $html = '';
785
- $html .= '<iframe width="600" height="400" src="https://www.youtube.com/embed/'.$foundid.'" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
786
 
787
- }
788
 
789
- elseif (strpos($videourl, 'vimeo') > 0) {
790
- $vidtype = 'vimeo';
791
- $explodeid = '';
792
- $explodeid = explode("/",$videourl);
793
- $foundid = '';
 
794
 
795
- if ($autoplay == 'on') {
796
- $autoplay = '&autoplay=1&muted=1';
797
- }
798
- else {
799
- $autoplay = '';
800
- }
801
 
802
- if ($loop == 'on') {
803
- $loop = '&loop=1';
804
- }
805
- else {
806
- $loop = '';
807
- }
808
 
809
- $foundid = $explodeid[3].'?'.$autoplay.$loop;
810
- $html = '';
811
- $html .= '<iframe src="https://player.vimeo.com/video/'.$foundid.'" width="600" height="400" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
 
 
 
812
 
813
- }
814
- else {
815
- $vidtype = 'selfhost';
816
- $vidautoplay = '';
817
- // $vidautoplay = sanitize_text_field($_POST['vidautoplay']);
818
- $vidautoplay = sanitize_text_field($_POST['autoplay']);
819
-
820
- if ($autoplay == 'on') {
821
- $autoplay = 'autoplay muted';
822
- }
823
- else {
824
- $autoplay = '';
825
- }
826
-
827
- if ($loop == 'on') {
828
- $loop = 'loop';
829
- }
830
- else {
831
- $loop = '';
832
- }
833
 
834
- $html = '';
835
- $html .= '<video id="'.$vidid.'" class="video-js vjs-default-skin vjs-big-play-centered" '.$autoplay.' '.$loop.' controls preload="auto" style="width:100%;height:100%;" poster="" >';
836
- $html .= '<source src="'.$videourl.'" type="video/mp4"/>';
837
- $html .= '<p class="vjs-no-js">';
838
- $html .= 'To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com html5-video-support/" target="_blank">supports HTML5 video</a>';
839
- $html .= '</p>';
840
- $html .= '</video>';
841
- }
842
 
 
 
 
 
843
 
 
844
 
845
- $videoarray = array();
846
- $videoarray = array(__( "panoid" )=>$panoid,__( "panoviddata" )=>$html,__( "vidid" )=>$vidid,__( "vidurl" )=>$videourl,__( "autoplay" )=>$autoplay,__( "loop" )=>$vidloop,__( "vidtype" )=>$vidtype);
847
- update_post_meta( $postid, 'panodata', $videoarray );
848
  die();
849
  }
 
 
 
 
 
 
 
 
 
 
850
 
 
 
 
 
 
 
851
 
852
- $control = sanitize_text_field($_POST['control']);
853
- if ($control == 'on') {
854
- $control = true;
855
- }
856
- else {
857
- $control = false;
858
- }
859
 
860
- //===Custom Control===//
861
- $custom_control = $_POST['customcontrol'];
 
 
 
 
862
 
863
- //===Custom Control End===//
 
 
 
 
 
864
 
865
- $vrgallery = sanitize_text_field($_POST['vrgallery']);
866
- if ($vrgallery == 'on') {
867
- $vrgallery = true;
868
- }
869
- else {
870
- $vrgallery = false;
871
- }
872
 
873
- $vrgallery_title = sanitize_text_field($_POST['vrgallery_title']);
874
- if ($vrgallery_title == 'on') {
875
- $vrgallery_title = true;
876
- }
877
- else {
878
- $vrgallery_title = false;
879
- }
880
 
881
- $vrgallery_display = sanitize_text_field($_POST['vrgallery_display']);
882
- if ($vrgallery_display == 'on') {
883
- $vrgallery_display = true;
884
- }
885
- else {
886
- $vrgallery_display = false;
887
- }
888
 
889
- $gyro = false;
890
- if( isset($_POST['gyro']) ){
891
- $gyro = sanitize_text_field($_POST['gyro']);
892
- }
893
-
894
- $deviceorientationcontrol = sanitize_text_field($_POST['deviceorientationcontrol']);
895
 
896
- if ($gyro == 'on') {
897
- if (!is_ssl()) {
898
- wp_send_json_error('<p><span>Warning:</span> Please add SSL to enable Gyroscope for WP VR. </p>');
899
- die();
900
- }
901
- $gyro = true;
902
- if ($deviceorientationcontrol == 'on') {
903
- $deviceorientationcontrol = true;
904
- }
905
- else {
906
- $deviceorientationcontrol = false;
907
- }
908
- }
909
- else {
910
- $gyro = false;
911
- $deviceorientationcontrol = false;
912
- }
913
 
914
- $compass = sanitize_text_field($_POST['compass']);
915
- if ($compass == 'on') {
916
- $compass = true;
917
- }
918
- else {
919
- $compass = false;
920
- }
921
 
922
- $mouseZoom = sanitize_text_field($_POST['mouseZoom']);
923
- if ($mouseZoom == 'off') {
924
- $mouseZoom = false;
925
- }
926
- else {
927
- $mouseZoom = true;
928
- }
929
 
930
- $draggable = sanitize_text_field($_POST['draggable']);
931
- if ($draggable == 'off') {
932
- $draggable = false;
933
- }
934
- else {
935
- $draggable = true;
936
- }
937
 
938
- $diskeyboard = sanitize_text_field($_POST['diskeyboard']);
939
- if ($diskeyboard == 'on') {
940
- $diskeyboard = true;
941
- }
942
- else {
943
- $diskeyboard = false;
944
- }
945
 
946
- $keyboardzoom = sanitize_text_field($_POST['keyboardzoom']);
 
 
 
947
 
948
- if ($keyboardzoom == 'off') {
949
- $keyboardzoom = false;
950
- }
951
- else {
952
- $keyboardzoom = true;
953
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
954
 
955
- $autoload = sanitize_text_field($_POST['autoload']);
956
- if ($autoload == 'on') {
957
- $autoload = true;
958
- }
959
- else {
960
- $autoload = false;
961
  }
 
 
962
 
963
- $default_scene = '';
964
-
965
- $preview = '';
966
- $preview = esc_url($_POST['preview']);
967
 
968
- $rotation = '';
969
- $rotation = sanitize_text_field($_POST['rotation']);
970
 
971
- $autorotation = '';
972
- $autorotation = sanitize_text_field($_POST['autorotation']);
973
- $autorotationinactivedelay = '';
974
- $autorotationinactivedelay = sanitize_text_field($_POST['autorotationinactivedelay']);
975
- $autorotationstopdelay = '';
976
- $autorotationstopdelay = sanitize_text_field($_POST['autorotationstopdelay']);
 
977
 
 
 
 
 
 
978
 
 
 
 
 
979
 
980
- if (!empty($autorotationinactivedelay) && !empty($autorotationstopdelay)) {
981
- wp_send_json_error('<span class="pano-error-title">Dual Action Error for Auto-Rotation</span><p> You can not use both Resume Auto-rotation & Stop Auto-rotation on the same tour. You can use only one of them.</p>');
982
- die();
983
- }
984
 
985
- //===Company Logo===//
986
- $cpLogoSwitch = 'off';
987
- $cpLogoSwitch = $_POST['cpLogoSwitch'];
988
- $cpLogoImg = '';
989
- $cpLogoImg = $_POST['cpLogoImg'];
990
- $cpLogoContent = '';
991
- $cpLogoContent = sanitize_text_field($_POST['cpLogoContent']);
992
- //===Company Logo===//
993
-
994
-
995
- // update_post_meta($postid,'hotspot_colors',$_POST['customColor']);
996
-
997
- $scene_fade_duration = '';
998
- $scene_fade_duration = $_POST['scenefadeduration'];
999
-
1000
- $panodata = $_POST['panodata'];
1001
- $panolist = stripslashes($panodata);
1002
- $panodata = (array)json_decode($panolist);
1003
- $panolist = array();
1004
- if(is_array($panodata["scene-list"])) {
1005
- foreach ($panodata["scene-list"] as $scenes_data) {
1006
- $temp_array = array();
1007
- $temp_array = (array)$scenes_data;
1008
- // $scene_id_ = $temp_array["scene-id"];
1009
-
1010
- if ($temp_array['hotspot-list']) {
1011
- $_hotspot_array = array();
1012
- foreach ($temp_array['hotspot-list'] as $temp_hotspot) {
1013
-
1014
- $temp_hotspot = (array)$temp_hotspot;
1015
- $_hotspot_array[] = $temp_hotspot;
1016
  }
1017
- }
1018
-
1019
- $temp_array['hotspot-list'] = $_hotspot_array;
1020
- $panolist['scene-list'][] = $temp_array;
1021
- }
1022
- }
1023
- $panodata = $panolist;
1024
-
1025
- //===Error Control and Validation===//
1026
-
1027
- if ($panodata["scene-list"] != "") {
1028
- foreach ($panodata["scene-list"] as $scenes_val) {
1029
-
1030
- $scene_id_validate = $scenes_val["scene-id"];
1031
- if (!empty($scene_id_validate)) {
1032
- $scene_id_validated = preg_replace('/[^0-9a-zA-Z_]/',"",$scene_id_validate);
1033
- if ($scene_id_validated != $scene_id_validate) {
1034
- wp_send_json_error('<span class="pano-error-title">Invalid Scene ID</span> <p>Scene ID can\'t contain spaces and special characters. <br/>Please assign a unique Scene ID with letters and numbers where Scene ID is : '.$scene_id_validate.'</p>');
1035
  die();
1036
  }
1037
 
 
 
 
 
 
1038
  if (empty($scenes_val["scene-attachment-url"])) {
1039
- wp_send_json_error('<span class="pano-error-title">Missing Scene Image</span><p> Please upload a 360 Degree image where Scene ID is: '.$scene_id_validate.'</p>');
1040
  die();
1041
  }
 
1042
 
1043
- if (!empty($scenes_val["scene-pitch"])) {
1044
- $validate_scene_pitch = $scenes_val["scene-pitch"];
1045
- $validated_scene_pitch = preg_replace('/[^0-9.-]/','',$validate_scene_pitch);
1046
- if ($validated_scene_pitch != $validate_scene_pitch) {
1047
- wp_send_json_error('<span class="pano-error-title">Invalid Pitch Value</span><p> The Pitch Value can only contain float numbers where Scene ID: '.$scene_id_validate.'</p>');
1048
- die();
1049
- }
1050
  }
 
1051
 
1052
- if (!empty($scenes_val["scene-yaw"])) {
1053
- $validate_scene_yaw = $scenes_val["scene-yaw"];
1054
- $validated_scene_yaw = preg_replace('/[^0-9.-]/','',$validate_scene_yaw);
1055
- if ($validated_scene_yaw != $validate_scene_yaw) {
1056
- wp_send_json_error('<span class="pano-error-title">Invalid Yaw Value</span><p> The Yaw Value can only contain float numbers where Scene ID: '.$scene_id_validate.'</p>');
1057
- die();
1058
- }
1059
  }
 
1060
 
1061
- if (!empty($scenes_val["scene-zoom"])) {
1062
- $validate_default_zoom = $scenes_val["scene-zoom"];
1063
- $validated_default_zoom = preg_replace('/[^0-9-]/','',$validate_default_zoom);
1064
- if ($validated_default_zoom != $validate_default_zoom) {
1065
- wp_send_json_error('<span class="pano-error-title">Invalid Default Zoom Value</span><p> You can only set Default Zoom in Degree values from 50 to 120 where Scene ID: '.$scene_id_validate.'</p>');
1066
 
1067
- die();
1068
- }
1069
- $default_zoom_value = (int)$scenes_val["scene-zoom"];
1070
- if ($default_zoom_value > 120 || $default_zoom_value < 50) {
1071
- wp_send_json_error('<span class="pano-error-title">Invalid Default Zoom Value</span><p> You can only set Default Zoom in Degree values from 50 to 120 where Scene ID: '.$scene_id_validate.'</p>');
1072
 
1073
- die();
1074
- }
1075
  }
 
1076
 
1077
- if (!empty($scenes_val["scene-maxzoom"])) {
1078
- $validate_max_zoom = $scenes_val["scene-maxzoom"];
1079
- $validated_max_zoom = preg_replace('/[^0-9-]/','',$validate_max_zoom);
1080
- if ($validated_max_zoom != $validate_max_zoom) {
1081
- wp_send_json_error('<span class="pano-error-title">Invalid Max-zoom Value:</span><p> You can only set Max-zoom in degree values (50-120) where Scene ID: '.$scene_id_validate.'</p>');
1082
 
1083
- die();
1084
- }
1085
- $max_zoom_value = (int)$scenes_val["scene-maxzoom"];
1086
- if ($max_zoom_value > 120 ) {
1087
- wp_send_json_error('<span class="pano-error-title">Max-zoom Value Limit Exceeded</span><p> You can set the Max-zoom Value up to 120 degrees.</p>');
1088
 
1089
- die();
1090
- }
1091
  }
 
1092
 
1093
- if (!empty($scenes_val["scene-minzoom"])) {
1094
- $validate_min_zoom = $scenes_val["scene-minzoom"];
1095
- $validated_min_zoom = preg_replace('/[^0-9-]/','',$validate_min_zoom);
1096
- if ($validated_min_zoom != $validate_min_zoom) {
1097
- wp_send_json_error('<span class="pano-error-title">Invalid Min-zoom Value</span><p> You can only set Min-zoom in degree values (50-120) where Scene ID: '.$scene_id_validate.'</p>');
1098
- die();
1099
- }
1100
- $min_zoom_value = (int)$scenes_val["scene-minzoom"];
1101
- if ($min_zoom_value < 50 ) {
1102
- wp_send_json_error('<span class="pano-error-title">Low Min-Zoom Value</span><p> The Min-zoom value must be more than 50 in degree values where Scene ID: '.$scene_id_validate.'</p>');
1103
- die();
1104
- }
1105
  }
 
1106
 
1107
- if ($scenes_val["hotspot-list"] != "") {
1108
- foreach ($scenes_val["hotspot-list"] as $hotspot_val) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1109
 
1110
- $hotspot_title_validate = $hotspot_val["hotspot-title"];
1111
 
1112
- if (!empty($hotspot_title_validate)) {
1113
- $hotspot_title_validated = preg_replace('/[^0-9a-zA-Z_]/',"",$hotspot_title_validate);
1114
- if ($hotspot_title_validated != $hotspot_title_validate) {
1115
- wp_send_json_error('<span class="pano-error-title">Invalid Hotspot ID</span> <p>Hotspot ID can\'t contain spaces and special characters.<br/> Please assign a unique Hotspot ID with letters and numbers where Scene id: '.$scene_id_validate.' Hotspot ID is: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
1116
  die();
1117
  }
1118
- $hotspot_pitch_validate = $hotspot_val["hotspot-pitch"];
1119
- if (empty($hotspot_pitch_validate)) {
1120
- wp_send_json_error('<p><span>Warning:</span> Hotspot pitch is required for every hotspot where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
 
 
 
 
 
 
 
 
 
1121
  die();
1122
  }
1123
- if (!empty($hotspot_pitch_validate)) {
1124
- $hotspot_pitch_validated = preg_replace('/[^0-9.-]/','',$hotspot_pitch_validate);
1125
- if ($hotspot_pitch_validated != $hotspot_pitch_validate) {
1126
- wp_send_json_error('<span class="pano-error-title">Invalid Pitch Value</span> <p>The Pitch Value can only contain float numbers where Scene ID: '.$scene_id_validate.' Hotspot ID is: '.$hotspot_title_validate.'</p>');
1127
 
1128
-
 
 
 
 
1129
  die();
1130
  }
1131
  }
1132
-
1133
- $hotspot_yaw_validate = $hotspot_val["hotspot-yaw"];
1134
- if (empty($hotspot_yaw_validate)) {
1135
- wp_send_json_error('<p><span>Warning:</span> Hotspot yaw is required for every hotspot where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
1136
- die();
 
 
 
1137
  }
1138
- if (!empty($hotspot_yaw_validate)) {
1139
- $hotspot_yaw_validated = preg_replace('/[^0-9.-]/','',$hotspot_yaw_validate);
1140
- if ($hotspot_yaw_validated != $hotspot_yaw_validate) {
1141
- wp_send_json_error('<span class="pano-error-title">Invalid Yaw Value</span> <p>The Yaw Value can only contain float numbers where Scene ID: '.$scene_id_validate.' Hotspot ID is: '.$hotspot_title_validate.'</p>');
1142
 
1143
- die();
1144
- }
1145
- }
1146
 
1147
- if(is_plugin_active( 'wpvr-pro/wpvr-pro.php' )){
1148
- $status = get_option( 'wpvr_edd_license_status' );
1149
- if( $status !== false && $status == 'valid' ) {
1150
- if ($hotspot_val["hotspot-customclass-pro"] != 'none' && !empty($hotspot_val["hotspot-customclass"])) {
1151
- wp_send_json_error('<span class="pano-error-title">Warning!</span> <p>You can not use both Custom Icon and Custom Icon Class for a hotspot where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
1152
- die();
1153
- }
1154
- }
1155
  }
1156
- $hotspot_type_validate = $hotspot_val["hotspot-type"];
1157
- $hotspot_url_validate = $hotspot_val["hotspot-url"];
1158
- if (!empty($hotspot_url_validate)) {
1159
- $hotspot_url_validated = esc_url($hotspot_url_validate);
1160
- if ($hotspot_url_validated != $hotspot_url_validate) {
1161
- wp_send_json_error('<p><span>Warning:</span> Hotspot Url is invalid where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
1162
- die();
1163
- }
1164
  }
1165
- $hotspot_content_validate = $hotspot_val["hotspot-content"];
1166
 
1167
- $hotspot_scene_validate = $hotspot_val["hotspot-scene"];
1168
 
1169
- if ($hotspot_type_validate == "info") {
1170
- if (!empty($hotspot_scene_validate)) {
1171
- wp_send_json_error('<p><span>Warning:</span> Don\'t add Target Scene ID on info type hotspot where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
1172
- die();
1173
- }
1174
- if (!empty($hotspot_url_validate) && !empty($hotspot_content_validate)) {
1175
- wp_send_json_error('<span class="pano-error-title">Warning!</span> <p>You can not set both On Click Content and URL on a hotspot where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
1176
  die();
1177
  }
1178
  }
 
1179
 
1180
-
1181
-
1182
- if ($hotspot_type_validate == "shortcode_editor") {
1183
- if ( substr( $hotspot_val['hotspot-shortcode'], 0, 1 ) === '[' ) {
1184
- $pattern = get_shortcode_regex();
1185
- preg_match('/'.$pattern.'/s', $hotspot_val['hotspot-shortcode'], $matches);
1186
- if(is_array($matches) && !isset($matches[2])) {
1187
- wp_send_json_error('<p><span>Warning:</span> This is not a valid shortcode where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
1188
- die();
1189
- }
1190
- }
1191
- }
1192
-
1193
- if ($hotspot_type_validate == "scene") {
1194
- if (empty($hotspot_scene_validate)) {
1195
- wp_send_json_error('<span class="pano-error-title">Target Scene Missing</span> <p>Assign a Target Scene to the Scene-type Hotspot where Scene ID: '.$scene_id_validate.' and Hotspot ID : '.$hotspot_title_validate.'</p>');
1196
- die();
1197
- }
1198
- if (!empty($hotspot_url_validate) || !empty($hotspot_content_validate)) {
1199
- wp_send_json_error('<p><span>Warning:</span> Don\'t add Url or On click content on scene type hotspot where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
1200
- die();
1201
- }
1202
  }
1203
  }
1204
  }
@@ -1206,336 +1243,448 @@ class Wpvr_Ajax {
1206
  }
1207
  }
1208
  }
1209
- //===Error Control and Validation===//
1210
-
1211
- foreach ($panodata["scene-list"] as $panoscenes) {
1212
- if (empty($panoscenes['scene-id']) && !empty($panoscenes['scene-attachment-url'])) {
1213
- wp_send_json_error('<span class="pano-error-title">Missing Scene ID</span> <p>Please assign a unique Scene ID to your uploaded scene.</p>');
1214
- die();
1215
- }
1216
  }
 
1217
 
1218
- $allsceneids = array();
1219
 
1220
- foreach ($panodata["scene-list"] as $panoscenes) {
1221
- if (!empty($panoscenes['scene-id'])) {
1222
- array_push($allsceneids, $panoscenes['scene-id']);
1223
- }
1224
  }
 
1225
 
1226
- foreach ($panodata["scene-list"] as $panoscenes) {
1227
 
1228
- if ($panoscenes['dscene'] == 'on') {
1229
- $default_scene = $panoscenes['scene-id'];
1230
- }
1231
  }
1232
- if (empty($default_scene)) {
1233
- if ($allsceneids) {
1234
- $default_scene = $allsceneids[0];
1235
- }
1236
- else {
1237
- wp_send_json_error('<p><span>Warning:</span> No default scene selected and no scene id found to set as default. You need at least one scene to publish a tour </p>');
1238
- die();
1239
- }
1240
  }
 
1241
 
1242
- $allsceneids_count = array_count_values($allsceneids);
1243
- foreach ($allsceneids_count as $key => $value) {
1244
- if ($value > 1) {
1245
- wp_send_json_error('<span class="pano-error-title">Duplicate Scene ID</span> <p>You\'ve assigned a duplicate Scene ID. <br/>Please assign unique Scene IDs to each scene. </p>');
1246
- die();
1247
- }
1248
  }
 
1249
 
1250
- foreach ($panodata["scene-list"] as $panoscenes) {
1251
- if (!empty($panoscenes['scene-id'])) {
1252
- $allhotspot = array();
1253
- foreach ($panoscenes["hotspot-list"] as $hotspot_val) {
1254
- if (!empty($hotspot_val["hotspot-title"])) {
1255
- array_push($allhotspot, $hotspot_val["hotspot-title"]);
1256
- }
1257
- }
1258
- $allhotspotcount = array_count_values($allhotspot);
1259
- foreach ($allhotspotcount as $key => $value) {
1260
- if ($value > 1) {
1261
- wp_send_json_error('<span class="pano-error-title">Duplicate Hotspot ID</span> <p>You\'ve assigned a duplicate Hotspot ID. <br/>Please assign unique Hotspot IDs to each Hotspot.</p>');
1262
- die();
1263
- }
1264
- }
1265
  }
1266
  }
 
1267
 
1268
- $panolength = count($panodata["scene-list"]);
1269
- for ($i=0; $i < $panolength; $i++) {
1270
- if (empty($panodata["scene-list"][$i]['scene-id'])) {
1271
- unset($panodata["scene-list"][$i]);
1272
- }
1273
- else {
1274
- $panohotspotlength = count($panodata["scene-list"][$i]['hotspot-list']);
1275
- for ($j=0; $j < $panohotspotlength; $j++) {
1276
- if (empty($panodata["scene-list"][$i]['hotspot-list'][$j]['hotspot-title'])) {
1277
- unset($panodata["scene-list"][$i]['hotspot-list'][$j]);
1278
- }
1279
  }
1280
  }
1281
  }
 
1282
 
1283
- //===audio===//
1284
- $bg_music = 'off';
1285
- $bg_music_url = '';
1286
- $autoplay_bg_music = 'off';
1287
- $loop_bg_music = 'off';
1288
- $bg_music = sanitize_text_field($_POST['bg_music']);
1289
- $bg_music_url = esc_url_raw($_POST['bg_music_url']);
1290
- $autoplay_bg_music = sanitize_text_field($_POST['autoplay_bg_music']);
1291
- $loop_bg_music = sanitize_text_field($_POST['loop_bg_music']);
1292
- if ($bg_music == 'on') {
1293
- if (empty($bg_music_url)) {
1294
- wp_send_json_error('<p><span>Warning:</span> Please add an audio file as you enabled audio for this tour </p>');
1295
- die();
1296
- }
1297
  }
1298
- //===audio===//
 
1299
 
1300
- $pano_array = array();
1301
- $pano_array = array(__( "panoid" )=>$panoid,__( "autoLoad" )=>$autoload,__("hfov")=>$default_global_zoom,__("maxHfov")=>$max_global_zoom,__("minHfov")=>$min_global_zoom,__( "showControls" )=>$control,__( "cpLogoSwitch" )=>$cpLogoSwitch,__( "cpLogoImg" )=>$cpLogoImg,__( "cpLogoContent" )=>$cpLogoContent,__( "vrgallery" )=>$vrgallery,__( "vrgallery_title" )=>$vrgallery_title,__( "vrgallery_display" )=>$vrgallery_display,__( "customcontrol" )=>$custom_control,__( "gyro" )=>$gyro,__( "deviceorientationcontrol" )=>$deviceorientationcontrol,__( "compass" )=>$compass,__( "mouseZoom" )=>$mouseZoom,__( "draggable" )=>$draggable,__( "diskeyboard" )=>$diskeyboard,__( "keyboardzoom" )=>$keyboardzoom,__( "autoRotate" )=>$autorotation,__( "autoRotateInactivityDelay" )=>$autorotationinactivedelay,__( "autoRotateStopDelay" )=>$autorotationstopdelay,__( "preview" )=>$preview,__( "defaultscene" )=>$default_scene,__( "scenefadeduration" )=>$scene_fade_duration,__( "bg_music" )=>$bg_music,__( "bg_music_url" )=>$bg_music_url,__( "autoplay_bg_music" )=>$autoplay_bg_music,__( "loop_bg_music" )=>$loop_bg_music,__( "panodata" )=>$panodata,__("previewtext")=>$previewtext);
1302
 
1303
- if ($rotation == 'off') {
1304
- unset($pano_array['autoRotate']);
1305
- unset($pano_array['autoRotateInactivityDelay']);
1306
- unset($pano_array['autoRotateStopDelay']);
1307
- }
1308
- if (empty($autorotation)) {
1309
- unset($pano_array['autoRotate']);
1310
- unset($pano_array['autoRotateInactivityDelay']);
1311
- unset($pano_array['autoRotateStopDelay']);
1312
- }
1313
- if (empty($autorotationinactivedelay)) {
1314
- unset($pano_array['autoRotateInactivityDelay']);
1315
- }
1316
- if (empty($autorotationstopdelay)) {
1317
- unset($pano_array['autoRotateStopDelay']);
1318
- }
1319
- if (empty($autorotationstopdelay)) {
1320
- unset($pano_array['autoRotateStopDelay']);
1321
- }
1322
- update_post_meta( $postid, 'panodata', $pano_array );
1323
- die();
1324
  }
1325
 
1326
- function wpvr_file_import() {
1327
- set_time_limit(20000000000000000);
 
 
 
 
 
 
 
 
 
 
 
1328
  wpvr_delete_temp_file();
1329
- if ($_POST['fileurl']) {
1330
- WP_Filesystem();
1331
- $file_save_url = wp_upload_dir();
1332
- $fileurl = $_POST['fileurl'];
1333
- $attachment_id = $_POST['data_id'];
1334
- $zip_file_path = get_attached_file( $attachment_id );
1335
- $unzipfile = unzip_file($zip_file_path,$file_save_url['basedir'].'/wpvr/temp/');
1336
-
1337
- if ( is_wp_error( $unzipfile ) ) {
1338
- wpvr_delete_temp_file();
1339
- wp_send_json_error('Failed to unzip file');
1340
- }
1341
- $result = glob($file_save_url["basedir"].'/wpvr/temp/*.json');
1342
- if (!$result) {
1343
- wpvr_delete_temp_file();
1344
- wp_send_json_error('Tour json file not found');
1345
- }
1346
- $tour_json = $result[0];
1347
- $arrContextOptions=array(
1348
- "ssl"=>array(
1349
- "verify_peer"=>false,
1350
- "verify_peer_name"=>false,
1351
- ),
1352
- );
1353
- $getfile = file_get_contents($tour_json, false, stream_context_create($arrContextOptions));
1354
- $file_content = json_decode($getfile, true);
1355
-
1356
- $new_title = $file_content['title'];
1357
- $new_data = $file_content['data'];
1358
- $new_post_id = wp_insert_post( array(
1359
- 'post_title' => $new_title,
1360
- 'post_type' => 'wpvr_item',
1361
- 'post_status' => 'publish',
1362
- ) );
1363
- if ($new_post_id) {
1364
- if ($new_data['panoid']) {
1365
- $new_data['panoid'] = 'pano'.$new_post_id;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1366
  }
1367
- if ($new_data['preview']) {
1368
- $preview_url = $file_save_url['baseurl'].'/wpvr/temp/scene_preview.jpg';
1369
- $media_get = wpvr_handle_media_import($preview_url, $new_post_id);
1370
- if ($media_get['status'] == 'error') {
1371
- wp_delete_post($new_post_id, true);
1372
- wpvr_delete_temp_file();
1373
- wp_send_json_error($media_get['message']);
1374
- }
1375
- elseif ($media_get['status'] == 'success') {
1376
- $new_data['preview'] = $media_get['message'];
1377
- }
1378
- else {
1379
- wp_delete_post($new_post_id, true);
1380
- wpvr_delete_temp_file();
1381
- wp_send_json_error('Media transfer process failed');
1382
- }
 
1383
  }
1384
- if ($new_data['preview']) {
1385
- $preview_url = $file_save_url['baseurl'].'/wpvr/temp/scene_preview.jpg';
1386
- $media_get = wpvr_handle_media_import($preview_url, $new_post_id);
1387
- if ($media_get['status'] == 'error') {
1388
- wp_delete_post($new_post_id, true);
1389
- wpvr_delete_temp_file();
1390
- wp_send_json_error($media_get['message']);
1391
- }
1392
- elseif ($media_get['status'] == 'success') {
1393
- $new_data['preview'] = $media_get['message'];
1394
- }
1395
- else {
1396
- wp_delete_post($new_post_id, true);
1397
- wpvr_delete_temp_file();
1398
- wp_send_json_error('Media transfer process failed');
1399
- }
 
1400
  }
1401
- if ($new_data['cpLogoImg']) {
1402
- $logo = $new_data['cpLogoImg'];
1403
- $get_logo_format = explode(".", $logo);
1404
- $logo_format = end($get_logo_format);
1405
- $logo_img = $file_save_url['baseurl'].'/wpvr/temp/logo_img.'.$logo_format;
1406
- $media_get = wpvr_handle_media_import($logo_img, $new_post_id);
1407
- if ($media_get['status'] == 'error') {
1408
- wp_delete_post($new_post_id, true);
1409
- wpvr_delete_temp_file();
1410
- wp_send_json_error($media_get['message']);
1411
- }
1412
- elseif ($media_get['status'] == 'success') {
1413
- $new_data['cpLogoImg'] = $media_get['message'];
1414
- }
1415
- else {
1416
- wp_delete_post($new_post_id, true);
1417
- wpvr_delete_temp_file();
1418
- wp_send_json_error('Media transfer process failed');
1419
- }
1420
  }
1421
- if ($new_data['bg_music_url']) {
1422
- $music_url = $new_data['bg_music_url'];
1423
- $get_music_format = explode(".", $music_url);
1424
- $music_format = end($get_music_format);
1425
- $music_url = $file_save_url['baseurl'].'/wpvr/temp/music_url.'.$music_format;
1426
- $media_get = wpvr_handle_media_import($music_url, $new_post_id);
1427
- if ($media_get['status'] == 'error') {
1428
- wp_delete_post($new_post_id, true);
1429
- wpvr_delete_temp_file();
1430
- wp_send_json_error($media_get['message']);
1431
- }
1432
- elseif ($media_get['status'] == 'success') {
1433
- $new_data['bg_music_url'] = $media_get['message'];
1434
- }
1435
- else {
1436
- wp_delete_post($new_post_id, true);
1437
- wpvr_delete_temp_file();
1438
- wp_send_json_error('Media transfer process failed');
1439
- }
1440
  }
1441
- if ($new_data['panodata']) {
1442
-
1443
- if ($new_data['panodata']["scene-list"]) {
1444
-
1445
- foreach ($new_data['panodata']["scene-list"] as $key => $panoscenes) {
1446
- if ($panoscenes["scene-attachment-url"]) {
1447
- $scene_id = $panoscenes['scene-id'];
1448
- $url = $file_save_url['baseurl'].'/wpvr/temp/'.$scene_id.'.jpg';
1449
- $media_get = wpvr_handle_media_import($url, $new_post_id);
1450
- if ($media_get['status'] == 'error') {
1451
- wp_delete_post($new_post_id, true);
1452
- wpvr_delete_temp_file();
1453
- wp_send_json_error($media_get['message']);
1454
- }
1455
- elseif ($media_get['status'] == 'success') {
1456
- $new_data['panodata']["scene-list"][$key]['scene-attachment-url'] = $media_get['message'];
1457
- }
1458
- else {
1459
- wp_delete_post($new_post_id, true);
1460
- wpvr_delete_temp_file();
1461
- wp_send_json_error('Media transfer process failed');
1462
- }
1463
- }
1464
- }
1465
- }
1466
- update_post_meta( $new_post_id, 'panodata', $new_data );
 
 
 
 
 
1467
  wpvr_delete_temp_file();
 
 
1468
  }
 
1469
  }
 
 
 
1470
  }
1471
- else {
1472
- wpvr_delete_temp_file();
1473
- wp_send_json_error('No file found to import');
1474
- }
1475
- die();
1476
  }
 
 
1477
 
1478
  /**
1479
- * Video Preview show ajax function
1480
- */
1481
- function wpvrstreetview_preview() {
1482
- $panoid ='';
1483
- $postid = sanitize_text_field($_POST['postid']);
1484
- $panoid = 'pano'.$postid;
1485
- $randid = rand(1000, 1000000);
1486
- $streetviewid = 'streetview'.$randid;
1487
- $streetviewurl = $_POST['streetview'];
1488
- if ($streetviewurl) {
1489
- $html .= '<iframe src="'.$streetviewurl.'" width="600" height="400" frameborder="0" style="border:0;" allowfullscreen=""></iframe>';
1490
- }
 
 
1491
 
1492
- $response = array();
1493
- $response = array(__( "panoid" )=>$panoid,__( "panodata" )=>$html,__( "streetview" )=>$streetviewid);
1494
- wp_send_json_success( $response );
1495
  }
1496
 
1497
  /**
1498
- * Role management
1499
- */
1500
- function wpvr_role_management() {
1501
- $editor = sanitize_text_field($_POST['editor']);
1502
- $author = sanitize_text_field($_POST['author']);
1503
- $fontawesome = sanitize_text_field($_POST['fontawesome']);
1504
- $mobile_media_resize = sanitize_text_field($_POST['mobile_media_resize']);
1505
- $high_res_image = sanitize_text_field($_POST['high_res_image']);
1506
- $wpvr_frontend_notice = sanitize_text_field($_POST['wpvr_frontend_notice']);
1507
- $wpvr_frontend_notice_area = sanitize_text_field($_POST['wpvr_frontend_notice_area']);
1508
- $wpvr_script_control = sanitize_text_field($_POST['wpvr_script_control']);
1509
- $wpvr_script_list = sanitize_text_field($_POST['wpvr_script_list']);
1510
-
1511
- // $enable_woocommerce = sanitize_text_field($_POST['woocommerce']);
1512
-
1513
- $wpvr_script_list = str_replace(' ', '', $wpvr_script_list);
1514
-
1515
- update_option('wpvr_editor_active', $editor);
1516
- update_option('wpvr_author_active', $author);
1517
- update_option('wpvr_fontawesome_disable', $fontawesome);
1518
- update_option('mobile_media_resize', $mobile_media_resize);
1519
- update_option('high_res_image', $high_res_image);
1520
- update_option('wpvr_frontend_notice', $wpvr_frontend_notice);
1521
- update_option('wpvr_frontend_notice_area', $wpvr_frontend_notice_area);
1522
- update_option('wpvr_script_control', $wpvr_script_control);
1523
- update_option('wpvr_script_list', $wpvr_script_list);
1524
-
1525
- // update_option('wpvr_enable_woocommerce', $enable_woocommerce);
1526
-
1527
- $response = array(
1528
- 'status' => 'success',
1529
- 'message' => 'Successfully saved',
1530
- );
1531
- wp_send_json($response);
 
 
 
 
 
 
 
1532
  }
1533
 
1534
  /**
1535
- * Notice
1536
- */
1537
- function wpvr_notice() {
1538
- update_option( 'wpvr_warning', '1' );
 
1539
  }
1540
-
1541
  }
1
  <?php
2
+ if (!defined('ABSPATH')) exit; // Exit if accessed directly
3
  /**
4
  * The admin-specific Ajax files.
5
  *
10
  * @subpackage Wpvr/admin
11
  */
12
 
13
+ class Wpvr_Ajax
14
+ {
15
 
16
  /**
17
  * Preview show ajax function
18
  */
19
+ function wpvr_show_preview()
20
+ {
21
+ $panoid = '';
22
+ $postid = sanitize_text_field($_POST['postid']);
23
+ $post_type = get_post_type($postid);
24
+
25
+ $panoid = 'pano' . $postid;
26
+
27
+ $control = sanitize_text_field($_POST['control']);
28
+ if ($control == 'on') {
29
+ $control = true;
30
+ } else {
31
+ $control = false;
32
+ }
33
 
34
+ $compass = sanitize_text_field($_POST['compass']);
35
+ if ($compass == 'on') {
36
+ $compass = true;
37
+ } else {
38
+ $compass = false;
39
+ }
40
 
41
+ $mouseZoom = sanitize_text_field($_POST['mouseZoom']);
42
+ if ($mouseZoom == 'off') {
43
+ $mouseZoom = false;
44
+ } else {
45
+ $mouseZoom = true;
46
+ }
 
47
 
48
+ $draggable = sanitize_text_field($_POST['draggable']);
49
+ if ($draggable == 'off') {
50
+ $draggable = false;
51
+ } else {
52
+ $draggable = true;
53
+ }
 
54
 
55
+ $diskeyboard = sanitize_text_field($_POST['diskeyboard']);
56
+ if ($diskeyboard == 'on') {
57
+ $diskeyboard = true;
58
+ } else {
59
+ $diskeyboard = false;
60
+ }
 
61
 
62
+ $keyboardzoom = sanitize_text_field($_POST['keyboardzoom']);
63
+ if ($keyboardzoom == 'off') {
64
+ $keyboardzoom = false;
65
+ } else {
66
+ $keyboardzoom = true;
67
+ }
 
68
 
69
+ $autoload = sanitize_text_field($_POST['autoload']);
70
+ if ($autoload == 'on') {
71
+ $autoload = true;
72
+ } else {
73
+ $autoload = false;
74
+ }
 
75
 
76
+ $default_scene = '';
77
+ $default_scene = sanitize_text_field($_POST['defaultscene']);
78
+ $preview = '';
79
+ $preview = esc_url($_POST['preview']);
80
+
81
+ $rotation = '';
82
+ $rotation = sanitize_text_field($_POST['rotation']);
83
+
84
+ $autorotation = '';
85
+ $autorotation = sanitize_text_field($_POST['autorotation']);
86
+ $autorotationinactivedelay = '';
87
+ $autorotationinactivedelay = sanitize_text_field($_POST['autorotationinactivedelay']);
88
+ $autorotationstopdelay = '';
89
+ $autorotationstopdelay = sanitize_text_field($_POST['autorotationstopdelay']);
90
+
91
+ $default_global_zoom = '';
92
+ $max_global_zoom = '';
93
+ $min_global_zoom = '';
94
+ if (isset($_POST['gzoom']) == 'on') {
95
+ $default_global_zoom = $_POST['dzoom'];
96
+ $max_global_zoom = $_POST['maxzoom'];
97
+ $min_global_zoom = $_POST['minzoom'];
98
+ }
99
+ if (!empty($autorotationinactivedelay) && !empty($autorotationstopdelay)) {
100
+ wp_send_json_error('<span class="pano-error-title">Dual Action Error for Auto-Rotation</span><p> You can not use both Resume Auto-rotation & Stop Auto-rotation on the same tour. You can use only one of them.</p>');
101
 
102
+ die();
103
+ }
 
 
 
 
 
104
 
105
+ $scene_fade_duration = '';
106
+ $scene_fade_duration = sanitize_text_field($_POST['scenefadeduration']);
107
+
108
+ $panodata = $_POST['panodata'];
109
+ $panolist = stripslashes($panodata);
110
+ $panodata = (array)json_decode($panolist);
111
+ $panolist = array();
112
+ if (is_array($panodata["scene-list"])) {
113
+ foreach ($panodata["scene-list"] as $scenes_data) {
114
+ $temp_array = array();
115
+ $temp_array = (array)$scenes_data;
116
+ if ($temp_array['hotspot-list']) {
117
+ $_hotspot_array = array();
118
+ foreach ($temp_array['hotspot-list'] as $temp_hotspot) {
119
+ $temp_hotspot = (array)$temp_hotspot;
120
+ $_hotspot_array[] = $temp_hotspot;
121
+ }
122
+ }
123
+ $temp_array['hotspot-list'] = $_hotspot_array;
124
+ $panolist['scene-list'][] = $temp_array;
 
 
125
  }
126
+ }
127
+ $panodata = $panolist;
128
 
129
+ //===Error Control and Validation===//
 
130
 
131
+ if ($panodata["scene-list"] != "") {
132
+ foreach ($panodata["scene-list"] as $scenes_val) {
133
+
134
+ $scene_id_validate = $scenes_val["scene-id"];
135
+
136
+
137
+ if (!empty($scene_id_validate)) {
138
+ $scene_id_validated = preg_replace('/[^0-9a-zA-Z_]/', "", $scene_id_validate);
139
+ if ($scene_id_validated != $scene_id_validate) {
140
+ wp_send_json_error('<span class="pano-error-title">Invalid Scene ID</span> <p>Scene ID can\'t contain spaces and special characters. <br/>Please assign a unique Scene ID with letters and numbers where Scene ID is : ' . $scene_id_validate . '</p>');
141
+ die();
 
 
 
 
 
 
142
  }
 
 
 
 
 
 
 
143
 
144
+ if ($scenes_val['scene-type'] == 'cubemap') {
145
+ if (empty($scenes_val["scene-attachment-url-face0"])) {
146
+ wp_send_json_error('<span class="pano-error-title">Missing Cubemap Scene Face 0</span><p> Please upload a 360 Degree image where Scene ID is: ' . $scene_id_validate . '</p>');
147
+ die();
148
+ }
149
+
150
+ if (empty($scenes_val["scene-attachment-url-face1"])) {
151
+ wp_send_json_error('<span class="pano-error-title">Missing Cubemap Scene Face 1</span><p> Please upload a 360 Degree image where Scene ID is: ' . $scene_id_validate . '</p>');
152
+ die();
153
+ }
154
+
155
+ if (empty($scenes_val["scene-attachment-url-face2"])) {
156
+ wp_send_json_error('<span class="pano-error-title">Missing Cubemap Scene Face 2</span><p> Please upload a 360 Degree image where Scene ID is: ' . $scene_id_validate . '</p>');
157
+ die();
158
+ }
159
+
160
+ if (empty($scenes_val["scene-attachment-url-face3"])) {
161
+ wp_send_json_error('<span class="pano-error-title">Missing Cubemap Scene Face 3</span><p> Please upload a 360 Degree image where Scene ID is: ' . $scene_id_validate . '</p>');
162
+ die();
163
+ }
164
 
165
+ if (empty($scenes_val["scene-attachment-url-face4"])) {
166
+ wp_send_json_error('<span class="pano-error-title">Missing Cubemap Scene Face 4</span><p> Please upload a 360 Degree image where Scene ID is: ' . $scene_id_validate . '</p>');
167
+ die();
168
+ }
169
 
170
+ if (empty($scenes_val["scene-attachment-url-face5"])) {
171
+ wp_send_json_error('<span class="pano-error-title">Missing Cubemap Scene Face 5</span><p> Please upload a 360 Degree image where Scene ID is: ' . $scene_id_validate . '</p>');
 
 
 
172
  die();
173
  }
174
+ } else {
175
  if (empty($scenes_val["scene-attachment-url"])) {
176
+ wp_send_json_error('<span class="pano-error-title">Missing Scene Image</span><p> Please upload a 360 Degree image where Scene ID is: ' . $scene_id_validate . '</p>');
177
  die();
178
  }
179
+ }
180
 
181
+ if (!empty($scenes_val["scene-pitch"])) {
182
+ $validate_scene_pitch = $scenes_val["scene-pitch"];
183
+ $validated_scene_pitch = preg_replace('/[^0-9.-]/', '', $validate_scene_pitch);
184
+ if ($validated_scene_pitch != $validate_scene_pitch) {
185
+ wp_send_json_error('<span class="pano-error-title">Invalid Pitch Value</span><p> The Pitch Value can only contain float numbers where Scene ID: ' . $scene_id_validate . '</p>');
186
+ die();
 
187
  }
188
+ }
189
 
190
+ if (!empty($scenes_val["scene-yaw"])) {
191
+ $validate_scene_yaw = $scenes_val["scene-yaw"];
192
+ $validated_scene_yaw = preg_replace('/[^0-9.-]/', '', $validate_scene_yaw);
193
+ if ($validated_scene_yaw != $validate_scene_yaw) {
194
+ wp_send_json_error('<span class="pano-error-title">Invalid Yaw Value</span><p> The Yaw Value can only contain float numbers where Scene ID: ' . $scene_id_validate . '</p>');
195
+ die();
 
196
  }
197
+ }
198
 
199
+ if (!empty($scenes_val["scene-zoom"])) {
200
+ $validate_default_zoom = $scenes_val["scene-zoom"];
201
+ $validated_default_zoom = preg_replace('/[^0-9-]/', '', $validate_default_zoom);
202
+ if ($validated_default_zoom != $validate_default_zoom) {
203
+ wp_send_json_error('<span class="pano-error-title">Invalid Default Zoom Value</span><p> You can only set Default Zoom in Degree values from 50 to 120 where Scene ID: ' . $scene_id_validate . '</p>');
204
+ die();
205
+ }
206
+ $default_zoom_value = (int)$scenes_val["scene-zoom"];
207
+ if ($default_zoom_value > 120 || $default_zoom_value < 50) {
208
+ wp_send_json_error('<span class="pano-error-title">Invalid Default Zoom Value</span><p> You can only set Default Zoom in Degree values from 50 to 120 where Scene ID: ' . $scene_id_validate . '</p>');
209
 
210
+ die();
 
211
  }
212
+ }
213
 
214
+ if (!empty($scenes_val["scene-maxzoom"])) {
215
+ $validate_max_zoom = $scenes_val["scene-maxzoom"];
216
+ $validated_max_zoom = preg_replace('/[^0-9-]/', '', $validate_max_zoom);
217
+ if ($validated_max_zoom != $validate_max_zoom) {
218
+ wp_send_json_error('<span class="pano-error-title">Invalid Max-zoom Value:</span><p> You can only set Max-zoom in degree values (50-120) where Scene ID: ' . $scene_id_validate . '</p>');
219
 
220
+ die();
 
 
 
 
 
 
221
  }
222
+ $max_zoom_value = (int)$scenes_val["scene-maxzoom"];
223
+ if ($max_zoom_value > 120) {
224
+ wp_send_json_error('<span class="pano-error-title">Max-zoom Value Limit Exceeded</span><p> You can set the Max-zoom Value up to 120 degrees.</p>');
225
+ die();
226
+ }
227
+ }
228
 
229
+ if (!empty($scenes_val["scene-minzoom"])) {
230
+ $validate_min_zoom = $scenes_val["scene-minzoom"];
231
+ $validated_min_zoom = preg_replace('/[^0-9-]/', '', $validate_min_zoom);
232
+ if ($validated_min_zoom != $validate_min_zoom) {
233
+ wp_send_json_error('<span class="pano-error-title">Invalid Min-zoom Value</span><p> You can only set Min-zoom in degree values (50-120) where Scene ID: ' . $scene_id_validate . '</p>');
234
+ die();
235
+ }
236
+ $min_zoom_value = (int)$scenes_val["scene-minzoom"];
237
+ if ($min_zoom_value < 50) {
238
+ wp_send_json_error('<span class="pano-error-title">Low Min-Zoom Value</span><p> The Min-zoom value must be more than 50 in degree values where Scene ID: ' . $scene_id_validate . '</p>');
239
+ die();
 
240
  }
241
+ }
 
 
242
 
243
+ if ($scenes_val["hotspot-list"] != "") {
244
+ foreach ($scenes_val["hotspot-list"] as $hotspot_val) {
245
 
246
+ $hotspot_title_validate = $hotspot_val["hotspot-title"];
 
 
 
 
 
 
247
 
 
 
 
 
 
 
 
 
 
248
 
249
+ if (!empty($hotspot_title_validate)) {
250
+ $hotspot_title_validated = preg_replace('/[^0-9a-zA-Z_]/', "", $hotspot_title_validate);
251
+ if ($hotspot_title_validated != $hotspot_title_validate) {
252
+ wp_send_json_error('<span class="pano-error-title">Invalid Hotspot ID</span> <p>Hotspot ID can\'t contain spaces and special characters. <br/>Please assign a unique Hotspot ID with letters and numbers where Scene id: ' . $scene_id_validate . ' Hotspot ID is: ' . $hotspot_title_validate . '</p>');
253
+ die();
254
+ }
255
 
256
+ $hotspot_pitch_validate = $hotspot_val["hotspot-pitch"];
257
+ if (!empty($hotspot_pitch_validate)) {
258
+ $hotspot_pitch_validated = preg_replace('/[^0-9.-]/', '', $hotspot_pitch_validate);
259
+ if ($hotspot_pitch_validated != $hotspot_pitch_validate) {
260
+ wp_send_json_error('<span class="pano-error-title">Invalid Pitch Value</span> <p>The Pitch Value can only contain float numbers where Scene ID: ' . $scene_id_validate . ' Hotspot ID is: ' . $hotspot_title_validate . '</p>');
261
+
262
+ die();
263
  }
264
+ }
265
 
266
+ $hotspot_yaw_validate = $hotspot_val["hotspot-yaw"];
267
+ if (!empty($hotspot_yaw_validate)) {
268
+ $hotspot_yaw_validated = preg_replace('/[^0-9.-]/', '', $hotspot_yaw_validate);
269
+ if ($hotspot_yaw_validated != $hotspot_yaw_validate) {
270
+ wp_send_json_error('<span class="pano-error-title">Invalid Yaw Value</span> <p>The Yaw Value can only contain float numbers where Scene ID: ' . $scene_id_validate . ' Hotspot ID is: ' . $hotspot_title_validate . '</p>');
271
+
272
+ die();
 
273
  }
274
+ }
275
+
276
+ if (is_plugin_active('wpvr-pro/wpvr-pro.php')) {
277
+ $status = get_option('wpvr_edd_license_status');
278
+ if ($status !== false && $status == 'valid') {
279
+ if ($hotspot_val["hotspot-customclass-pro"] != 'none' && !empty($hotspot_val["hotspot-customclass"])) {
280
+ wp_send_json_error('<span class="pano-error-title">Warning!</span> <p>You can not use both Custom Icon and Custom Icon Class for a hotspot where scene id: ' . $scene_id_validate . ' and hotspot id : ' . $hotspot_title_validate . '</p>');
281
  die();
282
  }
283
  }
284
+ }
285
+ $hotspot_type_validate = $hotspot_val["hotspot-type"];
286
+ $hotspot_url_validate = $hotspot_val["hotspot-url"];
287
+ if (!empty($hotspot_url_validate)) {
288
+ $hotspot_url_validated = esc_url($hotspot_url_validate);
289
+ if ($hotspot_url_validated != $hotspot_url_validate) {
290
+ wp_send_json_error('<p><span>Warning:</span> Hotspot Url is invalid where scene id: ' . $scene_id_validate . ' and hotspot id : ' . $hotspot_title_validate . '</p>');
291
+ die();
292
+ }
293
+ }
294
+ $hotspot_content_validate = $hotspot_val["hotspot-content"];
295
 
296
+ $hotspot_scene_validate = $hotspot_val["hotspot-scene"];
297
 
298
+ if ($hotspot_type_validate == "info") {
299
+ if (!empty($hotspot_scene_validate)) {
300
+ wp_send_json_error('<p><span>Warning:</span> Don\'t add Target Scene ID on info type hotspot where scene id: ' . $scene_id_validate . ' and hotspot id : ' . $hotspot_title_validate . '</p>');
301
+ die();
302
+ }
303
+ if (!empty($hotspot_url_validate) && !empty($hotspot_content_validate)) {
304
+ wp_send_json_error('<span class="pano-error-title">Warning!</span> <p>You can not set both On Click Content and URL on a hotspot where scene id: ' . $scene_id_validate . ' and hotspot id : ' . $hotspot_title_validate . '</p>');
305
+ die();
 
306
  }
307
+ }
308
 
309
+ if ($hotspot_type_validate == "scene") {
310
+ if (empty($hotspot_scene_validate)) {
311
+ wp_send_json_error('<span class="pano-error-title">Target Scene Missing</span> <p>Assign a Target Scene to the Scene-type Hotspot where Scene ID: ' . $scene_id_validate . ' and Hotspot ID : ' . $hotspot_title_validate . '</p>');
312
+ die();
313
+ }
314
+ if (!empty($hotspot_url_validate) || !empty($hotspot_content_validate)) {
315
+ wp_send_json_error('<p><span>Warning:</span> Don\'t add Url or On click content on scene type hotspot where scene id: ' . $scene_id_validate . ' and hotspot id : ' . $hotspot_title_validate . '</p>');
316
+ die();
 
317
  }
318
  }
319
  }
321
  }
322
  }
323
  }
324
+ }
325
+ //===Error Control and Validation===//
326
+ foreach ($panodata["scene-list"] as $panoscenes) {
327
+ if (empty($panoscenes['scene-id']) && !empty($panoscenes['scene-attachment-url'])) {
328
+ wp_send_json_error('<span class="pano-error-title">Missing Scene ID</span> <p>Please assign a unique Scene ID to your uploaded scene.</p>');
329
+ die();
330
  }
331
+ }
332
 
333
+ $allsceneids = array();
334
 
335
+ foreach ($panodata["scene-list"] as $panoscenes) {
336
+ if (!empty($panoscenes['scene-id'])) {
337
+ array_push($allsceneids, $panoscenes['scene-id']);
 
338
  }
339
+ }
340
 
341
+ foreach ($panodata["scene-list"] as $panoscenes) {
342
 
343
+ if ($panoscenes['dscene'] == 'on') {
344
+ $default_scene = $panoscenes['scene-id'];
 
345
  }
346
+ }
347
+ if (empty($default_scene)) {
348
+ if ($allsceneids) {
349
+ $default_scene = $allsceneids[0];
350
+ } else {
351
+ wp_send_json_error('<p><span>Warning:</span> No default scene selected and no scene id found to set as default. You need at least one scene to publish a tour </p>');
352
+ die();
 
353
  }
354
+ }
355
 
356
+ $allsceneids_count = array_count_values($allsceneids);
357
+ foreach ($allsceneids_count as $key => $value) {
358
+ if ($value > 1) {
359
+ wp_send_json_error('<span class="pano-error-title">Duplicate Scene ID</span> <p>You\'ve assigned a duplicate Scene ID. <br/>Please assign unique Scene IDs to each scene. </p>');
360
+ die();
 
361
  }
362
+ }
363
 
364
+ foreach ($panodata["scene-list"] as $panoscenes) {
365
+ if (!empty($panoscenes['scene-id'])) {
366
+ $allhotspot = array();
367
+ foreach ($panoscenes["hotspot-list"] as $hotspot_val) {
368
+
369
+ if (!empty($hotspot_val["hotspot-title"])) {
370
+ array_push($allhotspot, $hotspot_val["hotspot-title"]);
371
+ }
372
+ }
373
+ $allhotspotcount = array_count_values($allhotspot);
374
+ foreach ($allhotspotcount as $key => $value) {
375
+ if ($value > 1) {
376
+ wp_send_json_error('<span class="pano-error-title">Duplicate Hotspot ID</span> <p>You\'ve assigned a duplicate Hotspot ID. <br/>Please assign unique Hotspot IDs to each Hotspot.</p>');
377
+ die();
378
+ }
 
379
  }
380
  }
381
+ }
382
 
383
+ $default_data = array();
384
+ if ($_POST['gzoom'] == 'on') {
385
+ $default_data = array("firstScene" => $default_scene, "sceneFadeDuration" => $scene_fade_duration, "hfov" => $default_global_zoom, "maxHfov" => $max_global_zoom, "minHfov" => $min_global_zoom);
386
+ } else {
387
+ $default_data = array("firstScene" => $default_scene, "sceneFadeDuration" => $scene_fade_duration);
388
+ }
389
+ $scene_data = array();
390
+ foreach ($panodata["scene-list"] as $panoscenes) {
391
+ if (!empty($panoscenes['scene-id'])) {
392
+ $scene_ititle = '';
393
+ $scene_ititle = sanitize_text_field($panoscenes["scene-ititle"]);
394
+ $scene_author = '';
395
+ $scene_author = sanitize_text_field($panoscenes["scene-author"]);
396
 
397
+ $scene_vaov = 180;
398
+ $scene_vaov = (float)$panoscenes["scene-vaov"];
399
 
400
+ $scene_haov = 360;
401
+ $scene_haov = (float)$panoscenes["scene-haov"];
402
 
403
+ $scene_vertical_offset = 0;
404
+ $scene_vertical_offset = (float)$panoscenes["scene-vertical-offset"];
405
 
406
+ $default_scene_pitch = null;
407
+ $default_scene_pitch = (float)$panoscenes["scene-pitch"];
408
 
409
+ $default_scene_yaw = null;
410
+ $default_scene_yaw = (float)$panoscenes["scene-yaw"];
411
 
412
+ $scene_max_pitch = '';
413
+ $scene_max_pitch = (float)$panoscenes["scene-maxpitch"];
414
 
415
+ $scene_min_pitch = '';
416
+ $scene_min_pitch = (float)$panoscenes["scene-minpitch"];
417
 
418
+ $scene_max_yaw = '';
419
+ $scene_max_yaw = (float)$panoscenes["scene-maxyaw"];
420
 
421
+ $scene_min_yaw = '';
422
+ $scene_min_yaw = (float)$panoscenes["scene-minyaw"];
423
 
424
+ $default_zoom = 100;
425
+ $default_zoom = $panoscenes["scene-zoom"];
426
+ if (!empty($default_zoom)) {
427
+ $default_zoom = (int)$panoscenes["scene-zoom"];
428
+ } else {
429
  $default_zoom = 100;
430
+ }
 
 
 
 
 
 
431
 
432
+ $max_zoom = 120;
433
+ $max_zoom = $panoscenes["scene-maxzoom"];
434
+ if (!empty($max_zoom)) {
435
+ $max_zoom = (int)$panoscenes["scene-maxzoom"];
436
+ } else {
437
  $max_zoom = 120;
438
+ }
 
 
 
 
 
 
439
 
440
+ $min_zoom = 50;
441
+ $min_zoom = $panoscenes["scene-minzoom"];
442
+ if (!empty($min_zoom)) {
443
+ $min_zoom = (int)$panoscenes["scene-minzoom"];
444
+ } else {
445
  $min_zoom = 50;
446
+ }
 
 
 
 
 
 
447
 
448
+ $hotspot_datas = $panoscenes["hotspot-list"];
449
 
450
+ $hotspots = array();
451
+ foreach ($hotspot_datas as $hotspot_data) {
452
 
453
+ if (!empty($hotspot_data["hotspot-title"])) {
454
 
455
+ $hotspot_type = $hotspot_data["hotspot-type"] !== 'scene' ? 'info' : $hotspot_data["hotspot-type"];
456
+ $hotspot_content = '';
457
 
458
+ ob_start();
459
+ do_action('wpvr_hotspot_content_admin', $hotspot_data);
460
+ $hotspot_content = ob_get_clean();
461
 
462
 
463
+ if (!$hotspot_content) $hotspot_content = $hotspot_data["hotspot-content"];
464
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
 
466
+ $hotspot_info = array(
467
+ "text" => $hotspot_data["hotspot-title"],
468
+ "pitch" => $hotspot_data["hotspot-pitch"],
469
+ "yaw" => $hotspot_data["hotspot-yaw"],
470
+ "type" => $hotspot_type,
471
+ "URL" => $hotspot_data["hotspot-url"],
472
+ "clickHandlerArgs" => $hotspot_content,
473
+ "createTooltipArgs" => $hotspot_data["hotspot-hover"],
474
+ "sceneId" => $hotspot_data["hotspot-scene"],
475
+ "targetPitch" => (float)$hotspot_data["hotspot-scene-pitch"],
476
+ "targetYaw" => (float)$hotspot_data["hotspot-scene-yaw"],
477
+ 'hotspot_type' => $hotspot_data['hotspot-type']
478
+ );
479
+
480
+ array_push($hotspots, $hotspot_info);
481
+ if (empty($hotspot_data["hotspot-scene"])) {
482
+ unset($hotspot_info['targetPitch']);
483
+ unset($hotspot_info['targetYaw']);
484
  }
485
  }
486
+ }
487
 
488
+ $scene_info = array();
489
+ if ($panoscenes["scene-type"] == 'cubemap') {
490
+ $pano_type = 'cubemap';
491
+ $pano_attachment = array(
492
+ $panoscenes["scene-attachment-url-face0"],
493
+ $panoscenes["scene-attachment-url-face1"],
494
+ $panoscenes["scene-attachment-url-face2"],
495
+ $panoscenes["scene-attachment-url-face3"],
496
+ $panoscenes["scene-attachment-url-face4"],
497
+ $panoscenes["scene-attachment-url-face5"]
498
+ );
499
 
500
+ $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, "vaov" => $scene_vaov, "haov" => $scene_haov, "vOffset" => $scene_vertical_offset, "hotSpots" => $hotspots);
501
+ } else {
502
+ $scene_info = array("type" => $panoscenes["scene-type"], "panorama" => $panoscenes["scene-attachment-url"], "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, "vaov" => $scene_vaov, "haov" => $scene_haov, "vOffset" => $scene_vertical_offset, "hotSpots" => $hotspots);
503
+ }
504
 
 
 
 
 
 
 
505
 
506
+ if ($panoscenes["ptyscene"] == "off") {
507
+ unset($scene_info['pitch']);
508
+ unset($scene_info['yaw']);
509
+ }
510
 
511
+ if (empty($panoscenes["scene-ititle"])) {
512
+ unset($scene_info['title']);
513
+ }
514
+ if (empty($panoscenes["scene-author"])) {
515
+ unset($scene_info['author']);
516
+ }
517
 
518
+ if (empty($scene_vaov)) {
519
+ unset($scene_info['vaov']);
520
+ }
521
 
522
+ if (empty($scene_haov)) {
523
+ unset($scene_info['haov']);
524
+ }
 
 
 
 
525
 
526
+ if (empty($scene_vertical_offset)) {
527
+ unset($scene_info['vOffset']);
528
+ }
529
 
530
+ if ($panoscenes["cvgscene"] == "off") {
531
+ unset($scene_info['maxPitch']);
532
+ unset($scene_info['minPitch']);
533
+ }
534
+ if (empty($panoscenes["scene-maxpitch"])) {
535
+ unset($scene_info['maxPitch']);
536
+ }
537
 
538
+ if (empty($panoscenes["scene-minpitch"])) {
539
+ unset($scene_info['minPitch']);
540
+ }
 
541
 
542
+ if ($panoscenes["chgscene"] == "off") {
543
+ unset($scene_info['maxYaw']);
544
+ unset($scene_info['minYaw']);
545
+ }
546
+ if (empty($panoscenes["scene-maxyaw"])) {
547
+ unset($scene_info['maxYaw']);
548
+ }
549
 
550
+ if (empty($panoscenes["scene-minyaw"])) {
551
+ unset($scene_info['minYaw']);
552
+ }
 
 
553
 
554
+ // if ($panoscenes["czscene"] == "off") {
555
+ // unset($scene_info['hfov']);
556
+ // unset($scene_info['maxHfov']);
557
+ // unset($scene_info['minHfov']);
558
+ // }
559
+
560
+ $scene_array = array();
561
+ $scene_array = array(
562
+ $panoscenes["scene-id"] => $scene_info
563
+ );
564
+ $scene_data[$panoscenes["scene-id"]] = $scene_info;
565
+ }
566
+ }
567
+
568
+ $pano_id_array = array();
569
+ $pano_id_array = array("panoid" => $panoid);
570
+ $pano_response = array();
571
+ $pano_response = array("autoLoad" => $autoload, "defaultZoom" => $default_global_zoom, "minZoom" => $min_global_zoom, "maxZoom" => $max_global_zoom, "showControls" => $control, "compass" => $compass, "mouseZoom" => $mouseZoom, "draggable" => $draggable, "disableKeyboardCtrl" => $diskeyboard, 'keyboardZoom' => $keyboardzoom, "preview" => $preview, "autoRotate" => $autorotation, "autoRotateInactivityDelay" => $autorotationinactivedelay, "autoRotateStopDelay" => $autorotationstopdelay, "default" => $default_data, "scenes" => $scene_data);
572
+
573
+ if ($rotation == 'off') {
574
+ unset($pano_response['autoRotate']);
575
+ unset($pano_response['autoRotateInactivityDelay']);
576
+ unset($pano_response['autoRotateStopDelay']);
577
+ }
578
+ if (empty($autorotation)) {
579
+ unset($pano_response['autoRotate']);
580
+ unset($pano_response['autoRotateInactivityDelay']);
581
+ unset($pano_response['autoRotateStopDelay']);
582
+ }
583
+ if (empty($autorotationinactivedelay)) {
584
+ unset($pano_response['autoRotateInactivityDelay']);
585
+ }
586
+ if (empty($autorotationstopdelay)) {
587
+ unset($pano_response['autoRotateStopDelay']);
588
+ }
589
+
590
+ // if($_POST['gzoom'] == 'off' ){
591
+ // unset($pano_response['defaultZoom']);
592
+ // unset($pano_response['minZoom']);
593
+ // unset($pano_response['maxZoom']);
594
+ // }
595
+ $response = array();
596
+ $response = array($pano_id_array, $pano_response);
597
+ wp_send_json_success($response);
598
+ }
599
+
600
+ /**
601
+ * Video Preview show ajax function
602
+ */
603
+ function wpvrvideo_preview()
604
+ {
605
+ $panoid = '';
606
+ $postid = sanitize_text_field($_POST['postid']);
607
+ $panoid = 'pano' . $postid;
608
+ $randid = rand(1000, 1000000);
609
+ $vidid = 'vid' . $randid;
610
+ $videourl = esc_url_raw($_POST['videourl']);
611
+ $autoplay = sanitize_text_field($_POST['autoplay']);
612
+ $loop = sanitize_text_field($_POST['loop']);
613
+
614
+ $vidtype = '';
615
+ if (strpos($videourl, 'youtube') > 0) {
616
+ $vidtype = 'youtube';
617
+ $explodeid = '';
618
+ $explodeid = explode("=", $videourl);
619
+
620
+ if ($autoplay == 'on') {
621
+ $autoplay = '&autoplay=1';
622
+ $muted = '&mute=1';
623
+ } else {
624
+ $autoplay = '';
625
+ $muted = '';
626
+ }
627
+
628
+ if ($loop == 'on') {
629
+ $loop = '&loop=1';
630
+ } else {
631
+ $loop = '';
632
+ }
633
+
634
+ $foundid = '';
635
+ $foundid = $explodeid[1] . '?' . $autoplay . $loop;
636
+ $html = '';
637
+ $html .= '
638
+ <iframe src="https://www.youtube.com/embed/' . $explodeid[1] . '?rel=0&modestbranding=1' . $loop . '&autohide=1' . $muted . '&showinfo=0&controls=1' . $autoplay . '" width="600" height="400" frameborder="0" allowfullscreen></iframe>
639
+ ';
640
+ } elseif (strpos($videourl, 'youtu.be') > 0) {
641
+ $vidtype = 'youtube';
642
+ $explodeid = '';
643
+ $explodeid = explode("/", $videourl);
644
+
645
+ if ($autoplay == 'on') {
646
+ $autoplay = '&autoplay=1';
647
+ } else {
648
+ $autoplay = '';
649
+ }
650
 
651
+ if ($loop == 'on') {
652
+ $loop = '&loop=1';
653
+ } else {
654
+ $loop = '';
655
  }
656
+
657
+ $foundid = '';
658
+ $foundid = $explodeid[3] . '?' . $autoplay . $loop;
659
+ $html = '';
660
+ $html .= '<iframe width="600" height="400" src="https://www.youtube.com/embed/' . $foundid . '" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
661
+ } elseif (strpos($videourl, 'vimeo') > 0) {
662
+ $vidtype = 'vimeo';
663
+ $explodeid = '';
664
+ $explodeid = explode("/", $videourl);
665
+ $foundid = '';
666
+
667
+ if ($autoplay == 'on') {
668
+ $autoplay = '&autoplay=1&muted=1';
669
+ } else {
670
+ $autoplay = '';
671
  }
672
+
673
+ if ($loop == 'on') {
674
+ $loop = '&loop=1';
675
+ } else {
676
+ $loop = '';
677
  }
678
+
679
+ $foundid = $explodeid[3] . '?' . $autoplay . $loop;
680
+ $html = '';
681
+ $html .= '<iframe src="https://player.vimeo.com/video/' . $foundid . '" width="600" height="400" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
682
+ } else {
683
+ $vidtype = 'selfhost';
684
+
685
+ if ($autoplay == 'on') {
686
+ $autoplay = 'autoplay';
687
+ } else {
688
+ $autoplay = '';
689
  }
690
+
691
+
692
+ if ($loop == 'on') {
693
+ $loop = 'loop';
694
+ } else {
695
+ $loop = '';
696
  }
697
 
698
+ $html = '';
699
+ $html .= '<video id="' . $vidid . '" class="video-js vjs-default-skin vjs-big-play-centered" ' . $autoplay . ' ' . $loop . ' controls preload="none" style="width:100%;height:400px;" poster="" >';
700
+ $html .= '<source src="' . $videourl . '" type="video/mp4"/>';
701
+ $html .= '<p class="vjs-no-js">';
702
+ $html .= 'To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com html5-video-support/" target="_blank">supports HTML5 video</a>';
703
+ $html .= '</p>';
704
+ $html .= '</video>';
705
+ }
706
+
707
+ $response = array();
708
+ $response = array(__("panoid") => $panoid, __("panodata") => $html, __("vidid") => $vidid, __("vidtype") => $vidtype);
709
+ wp_send_json_success($response);
710
  }
711
 
712
+ function wpvr_save_data()
713
+ {
714
+
715
+ $panoid = '';
716
+ $html = '';
717
+ $postid = sanitize_text_field($_POST['postid']);
718
+ $prevtext = sanitize_text_field($_POST['previewtext']);
719
+ // error_log(print_r($_POST['customColor'],1));
720
+ $previewtext = '';
721
+ if (strlen($prevtext) <= 50) {
722
+ $previewtext = $prevtext;
723
+ }
724
+ $post_type = get_post_type($postid);
725
+ if ($post_type != 'wpvr_item') {
726
+ die();
727
+ }
728
+ $panoid = 'pano' . $postid;
729
+
730
+ $default_global_zoom = '';
731
+ $max_global_zoom = '';
732
+ $min_global_zoom = '';
733
+ if (isset($_POST['gzoom']) == 'on') {
734
+ $default_global_zoom = $_POST['dzoom'];
735
+ $max_global_zoom = $_POST['maxzoom'];
736
+ $min_global_zoom = $_POST['minzoom'];
737
+ }
738
+
739
+ if (isset($_POST['streetview'])) {
740
+ $streetview = $_POST['streetview'];
741
+ if ($streetview == 'on') {
742
+ $streetviewurl = esc_url_raw($_POST['streetviewurl']);
743
+ if ($streetviewurl) {
744
+ $html .= '<iframe src="' . $streetviewurl . '" width="600" height="400" frameborder="0" style="border:0;" allowfullscreen=""></iframe>';
745
+ }
746
+ $streetviewarray = array();
747
+ $streetviewarray = array(__("panoid") => $panoid, __("streetviewdata") => $html, __("streetviewurl") => $streetviewurl, __("streetview") => $streetview);
748
+ update_post_meta($postid, 'panodata', $streetviewarray);
749
+ die();
750
+ }
751
+ }
752
+
753
+
754
+ $pnovideo = $_POST['panovideo'];
755
+ if ($pnovideo == "on") {
756
+
757
+ $vidid = 'vid' . $postid;
758
  $videourl = esc_url_raw($_POST['videourl']);
759
  $autoplay = sanitize_text_field($_POST['autoplay']);
760
+ $vidautoplay = sanitize_text_field($_POST['autoplay']);
761
  $loop = sanitize_text_field($_POST['loop']);
762
+ $vidloop = sanitize_text_field($_POST['loop']);
763
  $vidtype = '';
764
+
765
  if (strpos($videourl, 'youtube') > 0) {
766
  $vidtype = 'youtube';
767
  $explodeid = '';
768
+ $explodeid = explode("=", $videourl);
769
+ $foundid = '';
770
 
771
  if ($autoplay == 'on') {
772
  $autoplay = '&autoplay=1';
773
+ } else {
 
 
774
  $autoplay = '';
 
775
  }
776
 
777
  if ($loop == 'on') {
778
  $loop = '&loop=1';
779
+ } else {
 
780
  $loop = '';
781
  }
782
 
783
+ $foundid = $explodeid[1] . '?' . $autoplay . $loop;
 
784
  $html = '';
785
+ $html .= '<iframe width="600" height="400" src="https://www.youtube.com/embed/' . $foundid . '" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
 
 
 
786
  } elseif (strpos($videourl, 'youtu.be') > 0) {
787
  $vidtype = 'youtube';
788
  $explodeid = '';
789
+ $explodeid = explode("/", $videourl);
790
+ $foundid = '';
791
 
792
  if ($autoplay == 'on') {
793
  $autoplay = '&autoplay=1';
794
+ } else {
 
795
  $autoplay = '';
796
  }
797
 
798
  if ($loop == 'on') {
799
  $loop = '&loop=1';
800
+ } else {
 
801
  $loop = '';
802
  }
803
 
804
+ $foundid = $explodeid[3] . '?' . $autoplay . $loop;
 
805
  $html = '';
806
+ $html .= '<iframe width="600" height="400" src="https://www.youtube.com/embed/' . $foundid . '" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
807
+ } elseif (strpos($videourl, 'vimeo') > 0) {
 
 
808
  $vidtype = 'vimeo';
809
  $explodeid = '';
810
+ $explodeid = explode("/", $videourl);
811
  $foundid = '';
812
 
813
  if ($autoplay == 'on') {
814
  $autoplay = '&autoplay=1&muted=1';
815
+ } else {
 
816
  $autoplay = '';
817
  }
818
 
819
  if ($loop == 'on') {
820
  $loop = '&loop=1';
821
+ } else {
 
822
  $loop = '';
823
  }
824
 
825
+ $foundid = $explodeid[3] . '?' . $autoplay . $loop;
826
  $html = '';
827
+ $html .= '<iframe src="https://player.vimeo.com/video/' . $foundid . '" width="600" height="400" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
 
828
  } else {
829
  $vidtype = 'selfhost';
830
+ $vidautoplay = '';
831
+ // $vidautoplay = sanitize_text_field($_POST['vidautoplay']);
832
+ $vidautoplay = sanitize_text_field($_POST['autoplay']);
833
 
834
  if ($autoplay == 'on') {
835
+ $autoplay = 'autoplay muted';
836
+ } else {
 
837
  $autoplay = '';
838
  }
839
 
 
840
  if ($loop == 'on') {
841
  $loop = 'loop';
842
+ } else {
 
843
  $loop = '';
844
  }
845
 
846
  $html = '';
847
+ $html .= '<video id="' . $vidid . '" class="video-js vjs-default-skin vjs-big-play-centered" ' . $autoplay . ' ' . $loop . ' controls preload="auto" style="width:100%;height:100%;" poster="" >';
848
+ $html .= '<source src="' . $videourl . '" type="video/mp4"/>';
849
+ $html .= '<p class="vjs-no-js">';
850
+ $html .= 'To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com html5-video-support/" target="_blank">supports HTML5 video</a>';
851
+ $html .= '</p>';
852
  $html .= '</video>';
853
  }
854
 
 
 
 
 
855
 
 
856
 
857
+ $videoarray = array();
858
+ $videoarray = array(__("panoid") => $panoid, __("panoviddata") => $html, __("vidid") => $vidid, __("vidurl") => $videourl, __("autoplay") => $autoplay, __("loop") => $vidloop, __("vidtype") => $vidtype);
859
+ update_post_meta($postid, 'panodata', $videoarray);
860
+ die();
861
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
862
 
 
863
 
864
+ $control = sanitize_text_field($_POST['control']);
865
+ if ($control == 'on') {
866
+ $control = true;
867
+ } else {
868
+ $control = false;
869
+ }
870
 
871
+ //===Custom Control===//
872
+ $custom_control = $_POST['customcontrol'];
 
 
 
 
873
 
874
+ //===Custom Control End===//
 
 
 
 
 
875
 
876
+ $vrgallery = sanitize_text_field($_POST['vrgallery']);
877
+ if ($vrgallery == 'on') {
878
+ $vrgallery = true;
879
+ } else {
880
+ $vrgallery = false;
881
+ }
882
 
883
+ $vrgallery_title = sanitize_text_field($_POST['vrgallery_title']);
884
+ if ($vrgallery_title == 'on') {
885
+ $vrgallery_title = true;
886
+ } else {
887
+ $vrgallery_title = false;
888
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
889
 
890
+ $vrgallery_display = sanitize_text_field($_POST['vrgallery_display']);
891
+ if ($vrgallery_display == 'on') {
892
+ $vrgallery_display = true;
893
+ } else {
894
+ $vrgallery_display = false;
895
+ }
 
 
896
 
897
+ $gyro = false;
898
+ if (isset($_POST['gyro'])) {
899
+ $gyro = sanitize_text_field($_POST['gyro']);
900
+ }
901
 
902
+ $deviceorientationcontrol = sanitize_text_field($_POST['deviceorientationcontrol']);
903
 
904
+ if ($gyro == 'on') {
905
+ if (!is_ssl()) {
906
+ wp_send_json_error('<p><span>Warning:</span> Please add SSL to enable Gyroscope for WP VR. </p>');
907
  die();
908
  }
909
+ $gyro = true;
910
+ if ($deviceorientationcontrol == 'on') {
911
+ $deviceorientationcontrol = true;
912
+ } else {
913
+ $deviceorientationcontrol = false;
914
+ }
915
+ } else {
916
+ $gyro = false;
917
+ $deviceorientationcontrol = false;
918
+ }
919
 
920
+ $compass = sanitize_text_field($_POST['compass']);
921
+ if ($compass == 'on') {
922
+ $compass = true;
923
+ } else {
924
+ $compass = false;
925
+ }
926
 
927
+ $mouseZoom = sanitize_text_field($_POST['mouseZoom']);
928
+ if ($mouseZoom == 'off') {
929
+ $mouseZoom = false;
930
+ } else {
931
+ $mouseZoom = true;
932
+ }
 
933
 
934
+ $draggable = sanitize_text_field($_POST['draggable']);
935
+ if ($draggable == 'off') {
936
+ $draggable = false;
937
+ } else {
938
+ $draggable = true;
939
+ }
940
 
941
+ $diskeyboard = sanitize_text_field($_POST['diskeyboard']);
942
+ if ($diskeyboard == 'on') {
943
+ $diskeyboard = true;
944
+ } else {
945
+ $diskeyboard = false;
946
+ }
947
 
948
+ $keyboardzoom = sanitize_text_field($_POST['keyboardzoom']);
 
 
 
 
 
 
949
 
950
+ if ($keyboardzoom == 'off') {
951
+ $keyboardzoom = false;
952
+ } else {
953
+ $keyboardzoom = true;
954
+ }
 
 
955
 
956
+ $autoload = sanitize_text_field($_POST['autoload']);
957
+ if ($autoload == 'on') {
958
+ $autoload = true;
959
+ } else {
960
+ $autoload = false;
961
+ }
 
962
 
963
+ $default_scene = '';
 
 
 
 
 
964
 
965
+ $preview = '';
966
+ $preview = esc_url($_POST['preview']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
967
 
968
+ $rotation = '';
969
+ $rotation = sanitize_text_field($_POST['rotation']);
 
 
 
 
 
970
 
971
+ $autorotation = '';
972
+ $autorotation = sanitize_text_field($_POST['autorotation']);
973
+ $autorotationinactivedelay = '';
974
+ $autorotationinactivedelay = sanitize_text_field($_POST['autorotationinactivedelay']);
975
+ $autorotationstopdelay = '';
976
+ $autorotationstopdelay = sanitize_text_field($_POST['autorotationstopdelay']);
 
977
 
 
 
 
 
 
 
 
978
 
 
 
 
 
 
 
 
979
 
980
+ if (!empty($autorotationinactivedelay) && !empty($autorotationstopdelay)) {
981
+ wp_send_json_error('<span class="pano-error-title">Dual Action Error for Auto-Rotation</span><p> You can not use both Resume Auto-rotation & Stop Auto-rotation on the same tour. You can use only one of them.</p>');
982
+ die();
983
+ }
984
 
985
+ //===Company Logo===//
986
+ $cpLogoSwitch = 'off';
987
+ $cpLogoSwitch = $_POST['cpLogoSwitch'];
988
+ $cpLogoImg = '';
989
+ $cpLogoImg = $_POST['cpLogoImg'];
990
+ $cpLogoContent = '';
991
+ $cpLogoContent = sanitize_text_field($_POST['cpLogoContent']);
992
+ //===Company Logo===//
993
+
994
+ //===background tour ===//
995
+ $bg_tour_enabler = sanitize_text_field($_POST['wpvr_bg_tour_enabler']);
996
+ $bg_tour_navmenu = sanitize_text_field($_POST['wpvr_bg_tour_navmenu_enabler']);
997
+ $bg_tour_title = sanitize_text_field($_POST['bg_tour_title']);
998
+ $bg_tour_subtitle = sanitize_text_field($_POST['bg_tour_subtitle']);
999
+ //===background tour end ===//
1000
+
1001
+ // update_post_meta($postid,'hotspot_colors',$_POST['customColor']);
1002
+
1003
+ $scene_fade_duration = '';
1004
+ $scene_fade_duration = $_POST['scenefadeduration'];
1005
+
1006
+ $panodata = $_POST['panodata'];
1007
+ $panolist = stripslashes($panodata);
1008
+ $panodata = (array)json_decode($panolist);
1009
+ $panolist = array();
1010
+ if (is_array($panodata["scene-list"])) {
1011
+ foreach ($panodata["scene-list"] as $scenes_data) {
1012
+ $temp_array = array();
1013
+ $temp_array = (array)$scenes_data;
1014
+ // $scene_id_ = $temp_array["scene-id"];
1015
+
1016
+ if ($temp_array['hotspot-list']) {
1017
+ $_hotspot_array = array();
1018
+ foreach ($temp_array['hotspot-list'] as $temp_hotspot) {
1019
+
1020
+ $temp_hotspot = (array)$temp_hotspot;
1021
+ $_hotspot_array[] = $temp_hotspot;
1022
+ }
1023
+ }
1024
 
1025
+ $temp_array['hotspot-list'] = $_hotspot_array;
1026
+ $panolist['scene-list'][] = $temp_array;
 
 
 
 
1027
  }
1028
+ }
1029
+ $panodata = $panolist;
1030
 
1031
+ //===Error Control and Validation===//
 
 
 
1032
 
1033
+ if ($panodata["scene-list"] != "") {
1034
+ foreach ($panodata["scene-list"] as $scenes_val) {
1035
 
1036
+ $scene_id_validate = $scenes_val["scene-id"];
1037
+ if (!empty($scene_id_validate)) {
1038
+ $scene_id_validated = preg_replace('/[^0-9a-zA-Z_]/', "", $scene_id_validate);
1039
+ if ($scene_id_validated != $scene_id_validate) {
1040
+ wp_send_json_error('<span class="pano-error-title">Invalid Scene ID</span> <p>Scene ID can\'t contain spaces and special characters. <br/>Please assign a unique Scene ID with letters and numbers where Scene ID is : ' . $scene_id_validate . '</p>');
1041
+ die();
1042
+ }
1043
 
1044
+ if ($scenes_val['scene-type'] == 'cubemap') {
1045
+ if (empty($scenes_val["scene-attachment-url-face0"])) {
1046
+ wp_send_json_error('<span class="pano-error-title">Missing Cubemap Scene Face 0</span><p> Please upload a 360 Degree image where Scene ID is: ' . $scene_id_validate . '</p>');
1047
+ die();
1048
+ }
1049
 
1050
+ if (empty($scenes_val["scene-attachment-url-face1"])) {
1051
+ wp_send_json_error('<span class="pano-error-title">Missing Cubemap Scene Face 1</span><p> Please upload a 360 Degree image where Scene ID is: ' . $scene_id_validate . '</p>');
1052
+ die();
1053
+ }
1054
 
1055
+ if (empty($scenes_val["scene-attachment-url-face2"])) {
1056
+ wp_send_json_error('<span class="pano-error-title">Missing Cubemap Scene Face 2</span><p> Please upload a 360 Degree image where Scene ID is: ' . $scene_id_validate . '</p>');
1057
+ die();
1058
+ }
1059
 
1060
+ if (empty($scenes_val["scene-attachment-url-face3"])) {
1061
+ wp_send_json_error('<span class="pano-error-title">Missing Cubemap Scene Face 3</span><p> Please upload a 360 Degree image where Scene ID is: ' . $scene_id_validate . '</p>');
1062
+ die();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1063
  }
1064
+
1065
+ if (empty($scenes_val["scene-attachment-url-face4"])) {
1066
+ wp_send_json_error('<span class="pano-error-title">Missing Cubemap Scene Face 4</span><p> Please upload a 360 Degree image where Scene ID is: ' . $scene_id_validate . '</p>');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1067
  die();
1068
  }
1069
 
1070
+ if (empty($scenes_val["scene-attachment-url-face5"])) {
1071
+ wp_send_json_error('<span class="pano-error-title">Missing Cubemap Scene Face 5</span><p> Please upload a 360 Degree image where Scene ID is: ' . $scene_id_validate . '</p>');
1072
+ die();
1073
+ }
1074
+ } else {
1075
  if (empty($scenes_val["scene-attachment-url"])) {
1076
+ wp_send_json_error('<span class="pano-error-title">Missing Scene Image</span><p> Please upload a 360 Degree image where Scene ID is: ' . $scene_id_validate . '</p>');
1077
  die();
1078
  }
1079
+ }
1080
 
1081
+ if (!empty($scenes_val["scene-pitch"])) {
1082
+ $validate_scene_pitch = $scenes_val["scene-pitch"];
1083
+ $validated_scene_pitch = preg_replace('/[^0-9.-]/', '', $validate_scene_pitch);
1084
+ if ($validated_scene_pitch != $validate_scene_pitch) {
1085
+ wp_send_json_error('<span class="pano-error-title">Invalid Pitch Value</span><p> The Pitch Value can only contain float numbers where Scene ID: ' . $scene_id_validate . '</p>');
1086
+ die();
 
1087
  }
1088
+ }
1089
 
1090
+ if (!empty($scenes_val["scene-yaw"])) {
1091
+ $validate_scene_yaw = $scenes_val["scene-yaw"];
1092
+ $validated_scene_yaw = preg_replace('/[^0-9.-]/', '', $validate_scene_yaw);
1093
+ if ($validated_scene_yaw != $validate_scene_yaw) {
1094
+ wp_send_json_error('<span class="pano-error-title">Invalid Yaw Value</span><p> The Yaw Value can only contain float numbers where Scene ID: ' . $scene_id_validate . '</p>');
1095
+ die();
 
1096
  }
1097
+ }
1098
 
1099
+ if (!empty($scenes_val["scene-zoom"])) {
1100
+ $validate_default_zoom = $scenes_val["scene-zoom"];
1101
+ $validated_default_zoom = preg_replace('/[^0-9-]/', '', $validate_default_zoom);
1102
+ if ($validated_default_zoom != $validate_default_zoom) {
1103
+ wp_send_json_error('<span class="pano-error-title">Invalid Default Zoom Value</span><p> You can only set Default Zoom in Degree values from 50 to 120 where Scene ID: ' . $scene_id_validate . '</p>');
1104
 
1105
+ die();
1106
+ }
1107
+ $default_zoom_value = (int)$scenes_val["scene-zoom"];
1108
+ if ($default_zoom_value > 120 || $default_zoom_value < 50) {
1109
+ wp_send_json_error('<span class="pano-error-title">Invalid Default Zoom Value</span><p> You can only set Default Zoom in Degree values from 50 to 120 where Scene ID: ' . $scene_id_validate . '</p>');
1110
 
1111
+ die();
 
1112
  }
1113
+ }
1114
 
1115
+ if (!empty($scenes_val["scene-maxzoom"])) {
1116
+ $validate_max_zoom = $scenes_val["scene-maxzoom"];
1117
+ $validated_max_zoom = preg_replace('/[^0-9-]/', '', $validate_max_zoom);
1118
+ if ($validated_max_zoom != $validate_max_zoom) {
1119
+ wp_send_json_error('<span class="pano-error-title">Invalid Max-zoom Value:</span><p> You can only set Max-zoom in degree values (50-120) where Scene ID: ' . $scene_id_validate . '</p>');
1120
 
1121
+ die();
1122
+ }
1123
+ $max_zoom_value = (int)$scenes_val["scene-maxzoom"];
1124
+ if ($max_zoom_value > 120) {
1125
+ wp_send_json_error('<span class="pano-error-title">Max-zoom Value Limit Exceeded</span><p> You can set the Max-zoom Value up to 120 degrees.</p>');
1126
 
1127
+ die();
 
1128
  }
1129
+ }
1130
 
1131
+ if (!empty($scenes_val["scene-minzoom"])) {
1132
+ $validate_min_zoom = $scenes_val["scene-minzoom"];
1133
+ $validated_min_zoom = preg_replace('/[^0-9-]/', '', $validate_min_zoom);
1134
+ if ($validated_min_zoom != $validate_min_zoom) {
1135
+ wp_send_json_error('<span class="pano-error-title">Invalid Min-zoom Value</span><p> You can only set Min-zoom in degree values (50-120) where Scene ID: ' . $scene_id_validate . '</p>');
1136
+ die();
1137
+ }
1138
+ $min_zoom_value = (int)$scenes_val["scene-minzoom"];
1139
+ if ($min_zoom_value < 50) {
1140
+ wp_send_json_error('<span class="pano-error-title">Low Min-Zoom Value</span><p> The Min-zoom value must be more than 50 in degree values where Scene ID: ' . $scene_id_validate . '</p>');
1141
+ die();
 
1142
  }
1143
+ }
1144
 
1145
+ if ($scenes_val["hotspot-list"] != "") {
1146
+ foreach ($scenes_val["hotspot-list"] as $hotspot_val) {
1147
+
1148
+ $hotspot_title_validate = $hotspot_val["hotspot-title"];
1149
+
1150
+ if (!empty($hotspot_title_validate)) {
1151
+ $hotspot_title_validated = preg_replace('/[^0-9a-zA-Z_]/', "", $hotspot_title_validate);
1152
+ if ($hotspot_title_validated != $hotspot_title_validate) {
1153
+ wp_send_json_error('<span class="pano-error-title">Invalid Hotspot ID</span> <p>Hotspot ID can\'t contain spaces and special characters.<br/> Please assign a unique Hotspot ID with letters and numbers where Scene id: ' . $scene_id_validate . ' Hotspot ID is: ' . $scene_id_validate . ' and hotspot id : ' . $hotspot_title_validate . '</p>');
1154
+ die();
1155
+ }
1156
+ $hotspot_pitch_validate = $hotspot_val["hotspot-pitch"];
1157
+ if (empty($hotspot_pitch_validate)) {
1158
+ wp_send_json_error('<p><span>Warning:</span> Hotspot pitch is required for every hotspot where scene id: ' . $scene_id_validate . ' and hotspot id : ' . $hotspot_title_validate . '</p>');
1159
+ die();
1160
+ }
1161
+ if (!empty($hotspot_pitch_validate)) {
1162
+ $hotspot_pitch_validated = preg_replace('/[^0-9.-]/', '', $hotspot_pitch_validate);
1163
+ if ($hotspot_pitch_validated != $hotspot_pitch_validate) {
1164
+ wp_send_json_error('<span class="pano-error-title">Invalid Pitch Value</span> <p>The Pitch Value can only contain float numbers where Scene ID: ' . $scene_id_validate . ' Hotspot ID is: ' . $hotspot_title_validate . '</p>');
1165
 
 
1166
 
 
 
 
 
1167
  die();
1168
  }
1169
+ }
1170
+
1171
+ $hotspot_yaw_validate = $hotspot_val["hotspot-yaw"];
1172
+ if (empty($hotspot_yaw_validate)) {
1173
+ wp_send_json_error('<p><span>Warning:</span> Hotspot yaw is required for every hotspot where scene id: ' . $scene_id_validate . ' and hotspot id : ' . $hotspot_title_validate . '</p>');
1174
+ die();
1175
+ }
1176
+ if (!empty($hotspot_yaw_validate)) {
1177
+ $hotspot_yaw_validated = preg_replace('/[^0-9.-]/', '', $hotspot_yaw_validate);
1178
+ if ($hotspot_yaw_validated != $hotspot_yaw_validate) {
1179
+ wp_send_json_error('<span class="pano-error-title">Invalid Yaw Value</span> <p>The Yaw Value can only contain float numbers where Scene ID: ' . $scene_id_validate . ' Hotspot ID is: ' . $hotspot_title_validate . '</p>');
1180
+
1181
  die();
1182
  }
1183
+ }
 
 
 
1184
 
1185
+ if (is_plugin_active('wpvr-pro/wpvr-pro.php')) {
1186
+ $status = get_option('wpvr_edd_license_status');
1187
+ if ($status !== false && $status == 'valid') {
1188
+ if ($hotspot_val["hotspot-customclass-pro"] != 'none' && !empty($hotspot_val["hotspot-customclass"])) {
1189
+ wp_send_json_error('<span class="pano-error-title">Warning!</span> <p>You can not use both Custom Icon and Custom Icon Class for a hotspot where scene id: ' . $scene_id_validate . ' and hotspot id : ' . $hotspot_title_validate . '</p>');
1190
  die();
1191
  }
1192
  }
1193
+ }
1194
+ $hotspot_type_validate = $hotspot_val["hotspot-type"];
1195
+ $hotspot_url_validate = $hotspot_val["hotspot-url"];
1196
+ if (!empty($hotspot_url_validate)) {
1197
+ $hotspot_url_validated = esc_url($hotspot_url_validate);
1198
+ if ($hotspot_url_validated != $hotspot_url_validate) {
1199
+ wp_send_json_error('<p><span>Warning:</span> Hotspot Url is invalid where scene id: ' . $scene_id_validate . ' and hotspot id : ' . $hotspot_title_validate . '</p>');
1200
+ die();
1201
  }
1202
+ }
1203
+ $hotspot_content_validate = $hotspot_val["hotspot-content"];
 
 
1204
 
1205
+ $hotspot_scene_validate = $hotspot_val["hotspot-scene"];
 
 
1206
 
1207
+ if ($hotspot_type_validate == "info") {
1208
+ if (!empty($hotspot_scene_validate)) {
1209
+ wp_send_json_error('<p><span>Warning:</span> Don\'t add Target Scene ID on info type hotspot where scene id: ' . $scene_id_validate . ' and hotspot id : ' . $hotspot_title_validate . '</p>');
1210
+ die();
 
 
 
 
1211
  }
1212
+ if (!empty($hotspot_url_validate) && !empty($hotspot_content_validate)) {
1213
+ wp_send_json_error('<span class="pano-error-title">Warning!</span> <p>You can not set both On Click Content and URL on a hotspot where scene id: ' . $scene_id_validate . ' and hotspot id : ' . $hotspot_title_validate . '</p>');
1214
+ die();
 
 
 
 
 
1215
  }
1216
+ }
1217
 
 
1218
 
1219
+
1220
+ if ($hotspot_type_validate == "shortcode_editor") {
1221
+ if (substr($hotspot_val['hotspot-shortcode'], 0, 1) === '[') {
1222
+ $pattern = get_shortcode_regex();
1223
+ preg_match('/' . $pattern . '/s', $hotspot_val['hotspot-shortcode'], $matches);
1224
+ if (is_array($matches) && !isset($matches[2])) {
1225
+ wp_send_json_error('<p><span>Warning:</span> This is not a valid shortcode where scene id: ' . $scene_id_validate . ' and hotspot id : ' . $hotspot_title_validate . '</p>');
1226
  die();
1227
  }
1228
  }
1229
+ }
1230
 
1231
+ if ($hotspot_type_validate == "scene") {
1232
+ if (empty($hotspot_scene_validate)) {
1233
+ wp_send_json_error('<span class="pano-error-title">Target Scene Missing</span> <p>Assign a Target Scene to the Scene-type Hotspot where Scene ID: ' . $scene_id_validate . ' and Hotspot ID : ' . $hotspot_title_validate . '</p>');
1234
+ die();
1235
+ }
1236
+ if (!empty($hotspot_url_validate) || !empty($hotspot_content_validate)) {
1237
+ wp_send_json_error('<p><span>Warning:</span> Don\'t add Url or On click content on scene type hotspot where scene id: ' . $scene_id_validate . ' and hotspot id : ' . $hotspot_title_validate . '</p>');
1238
+ die();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1239
  }
1240
  }
1241
  }
1243
  }
1244
  }
1245
  }
1246
+ }
1247
+ //===Error Control and Validation===//
1248
+
1249
+ foreach ($panodata["scene-list"] as $panoscenes) {
1250
+ if (empty($panoscenes['scene-id']) && !empty($panoscenes['scene-attachment-url'])) {
1251
+ wp_send_json_error('<span class="pano-error-title">Missing Scene ID</span> <p>Please assign a unique Scene ID to your uploaded scene.</p>');
1252
+ die();
1253
  }
1254
+ }
1255
 
1256
+ $allsceneids = array();
1257
 
1258
+ foreach ($panodata["scene-list"] as $panoscenes) {
1259
+ if (!empty($panoscenes['scene-id'])) {
1260
+ array_push($allsceneids, $panoscenes['scene-id']);
 
1261
  }
1262
+ }
1263
 
1264
+ foreach ($panodata["scene-list"] as $panoscenes) {
1265
 
1266
+ if ($panoscenes['dscene'] == 'on') {
1267
+ $default_scene = $panoscenes['scene-id'];
 
1268
  }
1269
+ }
1270
+ if (empty($default_scene)) {
1271
+ if ($allsceneids) {
1272
+ $default_scene = $allsceneids[0];
1273
+ } else {
1274
+ wp_send_json_error('<p><span>Warning:</span> No default scene selected and no scene id found to set as default. You need at least one scene to publish a tour </p>');
1275
+ die();
 
1276
  }
1277
+ }
1278
 
1279
+ $allsceneids_count = array_count_values($allsceneids);
1280
+ foreach ($allsceneids_count as $key => $value) {
1281
+ if ($value > 1) {
1282
+ wp_send_json_error('<span class="pano-error-title">Duplicate Scene ID</span> <p>You\'ve assigned a duplicate Scene ID. <br/>Please assign unique Scene IDs to each scene. </p>');
1283
+ die();
 
1284
  }
1285
+ }
1286
 
1287
+ foreach ($panodata["scene-list"] as $panoscenes) {
1288
+ if (!empty($panoscenes['scene-id'])) {
1289
+ $allhotspot = array();
1290
+ foreach ($panoscenes["hotspot-list"] as $hotspot_val) {
1291
+ if (!empty($hotspot_val["hotspot-title"])) {
1292
+ array_push($allhotspot, $hotspot_val["hotspot-title"]);
1293
+ }
1294
+ }
1295
+ $allhotspotcount = array_count_values($allhotspot);
1296
+ foreach ($allhotspotcount as $key => $value) {
1297
+ if ($value > 1) {
1298
+ wp_send_json_error('<span class="pano-error-title">Duplicate Hotspot ID</span> <p>You\'ve assigned a duplicate Hotspot ID. <br/>Please assign unique Hotspot IDs to each Hotspot.</p>');
1299
+ die();
1300
+ }
 
1301
  }
1302
  }
1303
+ }
1304
 
1305
+ $panolength = count($panodata["scene-list"]);
1306
+ for ($i = 0; $i < $panolength; $i++) {
1307
+ if (empty($panodata["scene-list"][$i]['scene-id'])) {
1308
+ unset($panodata["scene-list"][$i]);
1309
+ } else {
1310
+ $panohotspotlength = count($panodata["scene-list"][$i]['hotspot-list']);
1311
+ for ($j = 0; $j < $panohotspotlength; $j++) {
1312
+ if (empty($panodata["scene-list"][$i]['hotspot-list'][$j]['hotspot-title'])) {
1313
+ unset($panodata["scene-list"][$i]['hotspot-list'][$j]);
 
 
1314
  }
1315
  }
1316
  }
1317
+ }
1318
 
1319
+ //===audio===//
1320
+ $bg_music = 'off';
1321
+ $bg_music_url = '';
1322
+ $autoplay_bg_music = 'off';
1323
+ $loop_bg_music = 'off';
1324
+ $bg_music = sanitize_text_field($_POST['bg_music']);
1325
+ $bg_music_url = esc_url_raw($_POST['bg_music_url']);
1326
+ $autoplay_bg_music = sanitize_text_field($_POST['autoplay_bg_music']);
1327
+ $loop_bg_music = sanitize_text_field($_POST['loop_bg_music']);
1328
+ if ($bg_music == 'on') {
1329
+ if (empty($bg_music_url)) {
1330
+ wp_send_json_error('<p><span>Warning:</span> Please add an audio file as you enabled audio for this tour </p>');
1331
+ die();
 
1332
  }
1333
+ }
1334
+ //===audio===//
1335
 
1336
+ $pano_array = array();
1337
+ $pano_array = array(__("panoid") => $panoid, __("autoLoad") => $autoload, __("hfov") => $default_global_zoom, __("maxHfov") => $max_global_zoom, __("minHfov") => $min_global_zoom, __("showControls") => $control, __("cpLogoSwitch") => $cpLogoSwitch, __("cpLogoImg") => $cpLogoImg, __("cpLogoContent") => $cpLogoContent, __("vrgallery") => $vrgallery, __("vrgallery_title") => $vrgallery_title, __("vrgallery_display") => $vrgallery_display, __("customcontrol") => $custom_control, __("gyro") => $gyro, __("deviceorientationcontrol") => $deviceorientationcontrol, __("compass") => $compass, __("mouseZoom") => $mouseZoom, __("draggable") => $draggable, __("diskeyboard") => $diskeyboard, __("keyboardzoom") => $keyboardzoom, __("autoRotate") => $autorotation, __("autoRotateInactivityDelay") => $autorotationinactivedelay, __("autoRotateStopDelay") => $autorotationstopdelay, __("preview") => $preview, __("defaultscene") => $default_scene, __("scenefadeduration") => $scene_fade_duration, __("bg_music") => $bg_music, __("bg_music_url") => $bg_music_url, __("autoplay_bg_music") => $autoplay_bg_music, __("loop_bg_music") => $loop_bg_music, __("panodata") => $panodata, __("previewtext") => $previewtext, __("bg_tour_enabler") => $bg_tour_enabler, __("bg_tour_navmenu") => $bg_tour_navmenu, __("bg_tour_title") => $bg_tour_title, __("bg_tour_subtitle") => $bg_tour_subtitle);
1338
 
1339
+ if ($rotation == 'off') {
1340
+ unset($pano_array['autoRotate']);
1341
+ unset($pano_array['autoRotateInactivityDelay']);
1342
+ unset($pano_array['autoRotateStopDelay']);
1343
+ }
1344
+ if (empty($autorotation)) {
1345
+ unset($pano_array['autoRotate']);
1346
+ unset($pano_array['autoRotateInactivityDelay']);
1347
+ unset($pano_array['autoRotateStopDelay']);
1348
+ }
1349
+ if (empty($autorotationinactivedelay)) {
1350
+ unset($pano_array['autoRotateInactivityDelay']);
1351
+ }
1352
+ if (empty($autorotationstopdelay)) {
1353
+ unset($pano_array['autoRotateStopDelay']);
1354
+ }
1355
+ if (empty($autorotationstopdelay)) {
1356
+ unset($pano_array['autoRotateStopDelay']);
1357
+ }
1358
+ update_post_meta($postid, 'panodata', $pano_array);
1359
+ die();
1360
  }
1361
 
1362
+ function wpvr_file_import()
1363
+ {
1364
+ set_time_limit(20000000000000000);
1365
+ wpvr_delete_temp_file();
1366
+ if ($_POST['fileurl']) {
1367
+ WP_Filesystem();
1368
+ $file_save_url = wp_upload_dir();
1369
+ $fileurl = $_POST['fileurl'];
1370
+ $attachment_id = $_POST['data_id'];
1371
+ $zip_file_path = get_attached_file($attachment_id);
1372
+ $unzipfile = unzip_file($zip_file_path, $file_save_url['basedir'] . '/wpvr/temp/');
1373
+
1374
+ if (is_wp_error($unzipfile)) {
1375
  wpvr_delete_temp_file();
1376
+ wp_send_json_error('Failed to unzip file');
1377
+ }
1378
+ $result = glob($file_save_url["basedir"] . '/wpvr/temp/*.json');
1379
+ // var_dump($result);
1380
+ // die();
1381
+ if (!$result) {
1382
+ wpvr_delete_temp_file();
1383
+ wp_send_json_error('Tour json file not found');
1384
+ }
1385
+ $tour_json = $result[0];
1386
+ $arrContextOptions = array(
1387
+ "ssl" => array(
1388
+ "verify_peer" => false,
1389
+ "verify_peer_name" => false,
1390
+ ),
1391
+ );
1392
+ $getfile = file_get_contents($tour_json, false, stream_context_create($arrContextOptions));
1393
+ $file_content = json_decode($getfile, true);
1394
+
1395
+ $new_title = $file_content['title'];
1396
+ $new_data = $file_content['data'];
1397
+ $new_post_id = wp_insert_post(array(
1398
+ 'post_title' => $new_title,
1399
+ 'post_type' => 'wpvr_item',
1400
+ 'post_status' => 'publish',
1401
+ ));
1402
+ if ($new_post_id) {
1403
+ if ($new_data['panoid']) {
1404
+ $new_data['panoid'] = 'pano' . $new_post_id;
1405
+ }
1406
+ if ($new_data['preview']) {
1407
+ $preview_url = $file_save_url['baseurl'] . '/wpvr/temp/scene_preview.jpg';
1408
+ $media_get = wpvr_handle_media_import($preview_url, $new_post_id);
1409
+ if ($media_get['status'] == 'error') {
1410
+ wp_delete_post($new_post_id, true);
1411
+ wpvr_delete_temp_file();
1412
+ wp_send_json_error($media_get['message']);
1413
+ } elseif ($media_get['status'] == 'success') {
1414
+ $new_data['preview'] = $media_get['message'];
1415
+ } else {
1416
+ wp_delete_post($new_post_id, true);
1417
+ wpvr_delete_temp_file();
1418
+ wp_send_json_error('Media transfer process failed');
1419
+ }
1420
+ }
1421
+ if ($new_data['preview']) {
1422
+ $preview_url = $file_save_url['baseurl'] . '/wpvr/temp/scene_preview.jpg';
1423
+ $media_get = wpvr_handle_media_import($preview_url, $new_post_id);
1424
+ if ($media_get['status'] == 'error') {
1425
+ wp_delete_post($new_post_id, true);
1426
+ wpvr_delete_temp_file();
1427
+ wp_send_json_error($media_get['message']);
1428
+ } elseif ($media_get['status'] == 'success') {
1429
+ $new_data['preview'] = $media_get['message'];
1430
+ } else {
1431
+ wp_delete_post($new_post_id, true);
1432
+ wpvr_delete_temp_file();
1433
+ wp_send_json_error('Media transfer process failed');
1434
+ }
1435
+ }
1436
+ if ($new_data['cpLogoImg']) {
1437
+ $logo = $new_data['cpLogoImg'];
1438
+ $get_logo_format = explode(".", $logo);
1439
+ $logo_format = end($get_logo_format);
1440
+ $logo_img = $file_save_url['baseurl'] . '/wpvr/temp/logo_img.' . $logo_format;
1441
+ $media_get = wpvr_handle_media_import($logo_img, $new_post_id);
1442
+ if ($media_get['status'] == 'error') {
1443
+ wp_delete_post($new_post_id, true);
1444
+ wpvr_delete_temp_file();
1445
+ wp_send_json_error($media_get['message']);
1446
+ } elseif ($media_get['status'] == 'success') {
1447
+ $new_data['cpLogoImg'] = $media_get['message'];
1448
+ } else {
1449
+ wp_delete_post($new_post_id, true);
1450
+ wpvr_delete_temp_file();
1451
+ wp_send_json_error('Media transfer process failed');
1452
+ }
1453
+ }
1454
+ if ($new_data['bg_music_url']) {
1455
+ $music_url = $new_data['bg_music_url'];
1456
+ $get_music_format = explode(".", $music_url);
1457
+ $music_format = end($get_music_format);
1458
+ $music_url = $file_save_url['baseurl'] . '/wpvr/temp/music_url.' . $music_format;
1459
+ $media_get = wpvr_handle_media_import($music_url, $new_post_id);
1460
+ if ($media_get['status'] == 'error') {
1461
+ wp_delete_post($new_post_id, true);
1462
+ wpvr_delete_temp_file();
1463
+ wp_send_json_error($media_get['message']);
1464
+ } elseif ($media_get['status'] == 'success') {
1465
+ $new_data['bg_music_url'] = $media_get['message'];
1466
+ } else {
1467
+ wp_delete_post($new_post_id, true);
1468
+ wpvr_delete_temp_file();
1469
+ wp_send_json_error('Media transfer process failed');
1470
+ }
1471
+ }
1472
+ if ($new_data['panodata']) {
1473
+
1474
+ if ($new_data['panodata']["scene-list"]) {
1475
+
1476
+ foreach ($new_data['panodata']["scene-list"] as $key => $panoscenes) {
1477
+
1478
+ if ($panoscenes['scene-type'] == 'cubemap') {
1479
+
1480
+ // face 0
1481
+ if ($panoscenes["scene-attachment-url-face0"]) {
1482
+ $scene_id = $panoscenes['scene-id'];
1483
+ $url = $file_save_url['baseurl'] . '/wpvr/temp/' . $scene_id . '_face0.jpg';
1484
+ $media_get = wpvr_handle_media_import($url, $new_post_id);
1485
+ if ($media_get['status'] == 'error') {
1486
+ wp_delete_post($new_post_id, true);
1487
+ wpvr_delete_temp_file();
1488
+ wp_send_json_error($media_get['message']);
1489
+ } elseif ($media_get['status'] == 'success') {
1490
+ $new_data['panodata']["scene-list"][$key]['scene-attachment-url'] = $media_get['message'];
1491
+ } else {
1492
+ wp_delete_post($new_post_id, true);
1493
+ wpvr_delete_temp_file();
1494
+ wp_send_json_error('Media transfer process failed');
1495
+ }
1496
  }
1497
+
1498
+ // face 1
1499
+ if ($panoscenes["scene-attachment-url-face1"]) {
1500
+ $scene_id = $panoscenes['scene-id'];
1501
+ $url = $file_save_url['baseurl'] . '/wpvr/temp/' . $scene_id . '_face1.jpg';
1502
+ $media_get = wpvr_handle_media_import($url, $new_post_id);
1503
+ if ($media_get['status'] == 'error') {
1504
+ wp_delete_post($new_post_id, true);
1505
+ wpvr_delete_temp_file();
1506
+ wp_send_json_error($media_get['message']);
1507
+ } elseif ($media_get['status'] == 'success') {
1508
+ $new_data['panodata']["scene-list"][$key]['scene-attachment-url'] = $media_get['message'];
1509
+ } else {
1510
+ wp_delete_post($new_post_id, true);
1511
+ wpvr_delete_temp_file();
1512
+ wp_send_json_error('Media transfer process failed');
1513
+ }
1514
  }
1515
+
1516
+ // face 2
1517
+ if ($panoscenes["scene-attachment-url-face2"]) {
1518
+ $scene_id = $panoscenes['scene-id'];
1519
+ $url = $file_save_url['baseurl'] . '/wpvr/temp/' . $scene_id . '_face2.jpg';
1520
+ $media_get = wpvr_handle_media_import($url, $new_post_id);
1521
+ if ($media_get['status'] == 'error') {
1522
+ wp_delete_post($new_post_id, true);
1523
+ wpvr_delete_temp_file();
1524
+ wp_send_json_error($media_get['message']);
1525
+ } elseif ($media_get['status'] == 'success') {
1526
+ $new_data['panodata']["scene-list"][$key]['scene-attachment-url'] = $media_get['message'];
1527
+ } else {
1528
+ wp_delete_post($new_post_id, true);
1529
+ wpvr_delete_temp_file();
1530
+ wp_send_json_error('Media transfer process failed');
1531
+ }
1532
  }
1533
+
1534
+ // face 3
1535
+ if ($panoscenes["scene-attachment-url-face0"]) {
1536
+ $scene_id = $panoscenes['scene-id'];
1537
+ $url = $file_save_url['baseurl'] . '/wpvr/temp/' . $scene_id . '_face3.jpg';
1538
+ $media_get = wpvr_handle_media_import($url, $new_post_id);
1539
+ if ($media_get['status'] == 'error') {
1540
+ wp_delete_post($new_post_id, true);
1541
+ wpvr_delete_temp_file();
1542
+ wp_send_json_error($media_get['message']);
1543
+ } elseif ($media_get['status'] == 'success') {
1544
+ $new_data['panodata']["scene-list"][$key]['scene-attachment-url'] = $media_get['message'];
1545
+ } else {
1546
+ wp_delete_post($new_post_id, true);
1547
+ wpvr_delete_temp_file();
1548
+ wp_send_json_error('Media transfer process failed');
1549
+ }
 
 
1550
  }
1551
+
1552
+ // face 4
1553
+ if ($panoscenes["scene-attachment-url-face4"]) {
1554
+ $scene_id = $panoscenes['scene-id'];
1555
+ $url = $file_save_url['baseurl'] . '/wpvr/temp/' . $scene_id . '_face4.jpg';
1556
+ $media_get = wpvr_handle_media_import($url, $new_post_id);
1557
+ if ($media_get['status'] == 'error') {
1558
+ wp_delete_post($new_post_id, true);
1559
+ wpvr_delete_temp_file();
1560
+ wp_send_json_error($media_get['message']);
1561
+ } elseif ($media_get['status'] == 'success') {
1562
+ $new_data['panodata']["scene-list"][$key]['scene-attachment-url'] = $media_get['message'];
1563
+ } else {
1564
+ wp_delete_post($new_post_id, true);
1565
+ wpvr_delete_temp_file();
1566
+ wp_send_json_error('Media transfer process failed');
1567
+ }
 
 
1568
  }
1569
+
1570
+ // face 5
1571
+ if ($panoscenes["scene-attachment-url-face5"]) {
1572
+ $scene_id = $panoscenes['scene-id'];
1573
+ $url = $file_save_url['baseurl'] . '/wpvr/temp/' . $scene_id . '_face5.jpg';
1574
+ $media_get = wpvr_handle_media_import($url, $new_post_id);
1575
+ if ($media_get['status'] == 'error') {
1576
+ wp_delete_post($new_post_id, true);
1577
+ wpvr_delete_temp_file();
1578
+ wp_send_json_error($media_get['message']);
1579
+ } elseif ($media_get['status'] == 'success') {
1580
+ $new_data['panodata']["scene-list"][$key]['scene-attachment-url'] = $media_get['message'];
1581
+ } else {
1582
+ wp_delete_post($new_post_id, true);
1583
+ wpvr_delete_temp_file();
1584
+ wp_send_json_error('Media transfer process failed');
1585
+ }
1586
+ }
1587
+ } else {
1588
+ if ($panoscenes["scene-attachment-url"]) {
1589
+ $scene_id = $panoscenes['scene-id'];
1590
+ $url = $file_save_url['baseurl'] . '/wpvr/temp/' . $scene_id . '.jpg';
1591
+ $media_get = wpvr_handle_media_import($url, $new_post_id);
1592
+ if ($media_get['status'] == 'error') {
1593
+ wp_delete_post($new_post_id, true);
1594
+ wpvr_delete_temp_file();
1595
+ wp_send_json_error($media_get['message']);
1596
+ } elseif ($media_get['status'] == 'success') {
1597
+ $new_data['panodata']["scene-list"][$key]['scene-attachment-url'] = $media_get['message'];
1598
+ } else {
1599
+ wp_delete_post($new_post_id, true);
1600
  wpvr_delete_temp_file();
1601
+ wp_send_json_error('Media transfer process failed');
1602
+ }
1603
  }
1604
+ }
1605
  }
1606
+ }
1607
+ update_post_meta($new_post_id, 'panodata', $new_data);
1608
+ wpvr_delete_temp_file();
1609
  }
1610
+ }
1611
+ } else {
1612
+ wpvr_delete_temp_file();
1613
+ wp_send_json_error('No file found to import');
 
1614
  }
1615
+ die();
1616
+ }
1617
 
1618
  /**
1619
+ * Video Preview show ajax function
1620
+ */
1621
+ function wpvrstreetview_preview()
1622
+ {
1623
+ $panoid = '';
1624
+ $html = '';
1625
+ $postid = sanitize_text_field($_POST['postid']);
1626
+ $panoid = 'pano' . $postid;
1627
+ $randid = rand(1000, 1000000);
1628
+ $streetviewid = 'streetview' . $randid;
1629
+ $streetviewurl = $_POST['streetview'];
1630
+ if ($streetviewurl) {
1631
+ $html .= '<iframe src="' . $streetviewurl . '" width="600" height="400" frameborder="0" style="border:0;" allowfullscreen=""></iframe>';
1632
+ }
1633
 
1634
+ $response = array();
1635
+ $response = array(__("panoid") => $panoid, __("panodata") => $html, __("streetview") => $streetviewid);
1636
+ wp_send_json_success($response);
1637
  }
1638
 
1639
  /**
1640
+ * Role management
1641
+ */
1642
+ function wpvr_role_management()
1643
+ {
1644
+ $editor = sanitize_text_field($_POST['editor']);
1645
+ $author = sanitize_text_field($_POST['author']);
1646
+ $fontawesome = sanitize_text_field($_POST['fontawesome']);
1647
+ $mobile_media_resize = sanitize_text_field($_POST['mobile_media_resize']);
1648
+ $high_res_image = sanitize_text_field($_POST['high_res_image']);
1649
+ $wpvr_frontend_notice = sanitize_text_field($_POST['wpvr_frontend_notice']);
1650
+ $wpvr_frontend_notice_area = sanitize_text_field($_POST['wpvr_frontend_notice_area']);
1651
+ $wpvr_script_control = sanitize_text_field($_POST['wpvr_script_control']);
1652
+ $wpvr_script_list = sanitize_text_field($_POST['wpvr_script_list']);
1653
+
1654
+ $wpvr_video_script_control = sanitize_text_field($_POST['wpvr_video_script_control']);
1655
+ $wpvr_video_script_list = sanitize_text_field($_POST['wpvr_video_script_list']);
1656
+
1657
+ // $enable_woocommerce = sanitize_text_field($_POST['woocommerce']);
1658
+
1659
+ $wpvr_script_list = str_replace(' ', '', $wpvr_script_list);
1660
+
1661
+ update_option('wpvr_editor_active', $editor);
1662
+ update_option('wpvr_author_active', $author);
1663
+ update_option('wpvr_fontawesome_disable', $fontawesome);
1664
+ update_option('mobile_media_resize', $mobile_media_resize);
1665
+ update_option('high_res_image', $high_res_image);
1666
+ update_option('wpvr_frontend_notice', $wpvr_frontend_notice);
1667
+ update_option('wpvr_frontend_notice_area', $wpvr_frontend_notice_area);
1668
+ update_option('wpvr_script_control', $wpvr_script_control);
1669
+ update_option('wpvr_script_list', $wpvr_script_list);
1670
+
1671
+ update_option('wpvr_video_script_control', $wpvr_video_script_control);
1672
+ update_option('wpvr_video_script_list', $wpvr_video_script_list);
1673
+
1674
+ // update_option('wpvr_enable_woocommerce', $enable_woocommerce);
1675
+
1676
+ $response = array(
1677
+ 'status' => 'success',
1678
+ 'message' => 'Successfully saved',
1679
+ );
1680
+ wp_send_json($response);
1681
  }
1682
 
1683
  /**
1684
+ * Notice
1685
+ */
1686
+ function wpvr_notice()
1687
+ {
1688
+ update_option('wpvr_warning', '1');
1689
  }
 
1690
  }
admin/css/wpvr-admin.css CHANGED
@@ -821,7 +821,7 @@ div.custom-tooltip:hover span:after {
821
  }
822
 
823
  .rex-pano-tab-content .rex-pano-tab.streetview,
824
- .rex-pano-tab-content .rex-pano-tab.backgroundTour,
825
  .rex-pano-tab-content .rex-pano-tab.video,
826
  .rex-pano-tab-content .rex-pano-tab.export,
827
  .rex-pano-tab-content .rex-pano-tab.general {
@@ -1062,6 +1062,7 @@ div.custom-tooltip:hover span:after {
1062
 
1063
  /* ---autoload--- */
1064
 
 
1065
  .rex-pano-tab-content .general .inner-nav-content .single-settings:not(.preview-setting) {
1066
  width: 100%;
1067
  padding: 14px 15px;
@@ -1079,6 +1080,7 @@ div.custom-tooltip:hover span:after {
1079
  height: 33px;
1080
  }
1081
 
 
1082
  .rex-pano-tab-content .general .inner-nav-content .single-settings .wpvr-switcher {
1083
  min-width: auto;
1084
  padding-right: 0;
@@ -2086,8 +2088,35 @@ button.delete-scene {
2086
  }
2087
 
2088
 
2089
- /* -------product------- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2090
 
 
2091
  .single-hotspot .hotspot-products {
2092
  margin-bottom: 20px;
2093
  }
@@ -2481,15 +2510,19 @@ button.delete-scene {
2481
  margin-right: 0;
2482
  margin-bottom: 5px;
2483
  }
 
2484
  .rex-pano-tab-content .general .inner-nav-content .inner-single-content .content-wrapper {
2485
  display: block;
2486
  }
 
 
2487
  .rex-pano-tab-content .general .inner-nav-content .inner-single-content .content-wrapper .left {
2488
  width: 100%;
2489
  padding-right: 0;
2490
  border-right: none;
2491
  margin-bottom: 20px;
2492
  }
 
2493
  .rex-pano-tab-content .general .inner-nav-content .inner-single-content .content-wrapper .right {
2494
  width: 100%;
2495
  padding-left: 0;
821
  }
822
 
823
  .rex-pano-tab-content .rex-pano-tab.streetview,
824
+ .rex-pano-tab-content .rex-pano-tab.background-tour,
825
  .rex-pano-tab-content .rex-pano-tab.video,
826
  .rex-pano-tab-content .rex-pano-tab.export,
827
  .rex-pano-tab-content .rex-pano-tab.general {
1062
 
1063
  /* ---autoload--- */
1064
 
1065
+ .rex-pano-tab-content .background-tour .single-settings.inline-style,
1066
  .rex-pano-tab-content .general .inner-nav-content .single-settings:not(.preview-setting) {
1067
  width: 100%;
1068
  padding: 14px 15px;
1080
  height: 33px;
1081
  }
1082
 
1083
+ .rex-pano-tab-content .background-tour .single-settings.inline-style .wpvr-switcher,
1084
  .rex-pano-tab-content .general .inner-nav-content .single-settings .wpvr-switcher {
1085
  min-width: auto;
1086
  padding-right: 0;
2088
  }
2089
 
2090
 
2091
+ /* ---------background tour style---------- */
2092
+ .rex-pano-tab-content .background-tour .content-wrapper {
2093
+ display: flex;
2094
+ flex-flow: row wrap;
2095
+ border-bottom: 1px solid #e4e4e4;
2096
+ }
2097
+ .rex-pano-tab-content .background-tour .background-tour-left {
2098
+ width: 50%;
2099
+ padding-right: 15px;
2100
+ /* border-right: 1px solid #e4e4e4; */
2101
+ }
2102
+ .rex-pano-tab-content .background-tour .background-tour-right {
2103
+ width: 50%;
2104
+ padding-left: 15px;
2105
+ }
2106
+ .rex-pano-tab-content .background-tour .single-settings:not(.inline-style) {
2107
+ display: block;
2108
+ margin-bottom: 20px;
2109
+ }
2110
+ .rex-pano-tab-content .background-tour .single-settings:not(.inline-style) > span {
2111
+ margin-bottom: 6px;
2112
+ }
2113
+ .rex-pano-tab-content .background-tour .single-settings:not(.inline-style) > input {
2114
+ max-width: 100%;
2115
+ margin: 0;
2116
+ }
2117
+
2118
 
2119
+ /* -------product------- */
2120
  .single-hotspot .hotspot-products {
2121
  margin-bottom: 20px;
2122
  }
2510
  margin-right: 0;
2511
  margin-bottom: 5px;
2512
  }
2513
+ .rex-pano-tab-content .background-tour .content-wrapper,
2514
  .rex-pano-tab-content .general .inner-nav-content .inner-single-content .content-wrapper {
2515
  display: block;
2516
  }
2517
+
2518
+ .rex-pano-tab-content .background-tour .background-tour-left,
2519
  .rex-pano-tab-content .general .inner-nav-content .inner-single-content .content-wrapper .left {
2520
  width: 100%;
2521
  padding-right: 0;
2522
  border-right: none;
2523
  margin-bottom: 20px;
2524
  }
2525
+ .rex-pano-tab-content .background-tour .background-tour-right,
2526
  .rex-pano-tab-content .general .inner-nav-content .inner-single-content .content-wrapper .right {
2527
  width: 100%;
2528
  padding-left: 0;
admin/icon/bg-tour-hover.png ADDED
Binary file
admin/icon/bg-tour-regular.png ADDED
Binary file
admin/js/wpvr-admin.js CHANGED
@@ -1,4 +1,4 @@
1
- (function($) {
2
  'use strict';
3
  var j = 1;
4
  var color = '#00b4ff';
@@ -31,12 +31,12 @@
31
  * practising this, we should strive to set a better example in our own work.
32
  */
33
 
34
-
35
- $(document).ready(function() {
36
  $(".vrowl-carousel").owlCarousel({
37
  margin: 10,
38
  autoWidth: true,
39
- nav:true
40
  });
41
 
42
  var primary_markng = $('#scene-1').find('input.sceneid').val();
@@ -50,16 +50,16 @@
50
  $('.postbox .hndle').css('cursor', 'pointer');
51
  });
52
 
53
- $(document).on("change", "input.vr-switcher-check", function(event) {
54
  if (this.checked) {
55
  $(this).val('on');
56
  } else {
57
  $(this).val('off');
58
  }
59
  });
60
-
61
 
62
- $(document).on("click", ".scene-nav ul li span", function(event) {
 
63
  $('.owl-item').removeClass('marked');
64
  var target = $(this).attr("data-index");
65
  var data = $('#scene-' + target).find('input.sceneid').val();
@@ -68,11 +68,11 @@
68
  }
69
  });
70
 
71
- jQuery(document).ready(function($) {
72
-
73
  j = $('#scene-1').find('.hotspot-nav li').eq(-2).find('span').attr('data-index');
74
  var ajaxurl = wpvr_obj.ajaxurl;
75
- $('#panolenspreview').on('click', function(e) {
76
  e.preventDefault();
77
  $('.wpvr-loading').show();
78
  var postid = $("#post_ID").val();
@@ -91,8 +91,8 @@
91
  var panodata = $('.scene-setup').repeaterVal();
92
  var panolist = JSON.stringify(panodata);
93
  var previewtext = $('.previewtext').val();
94
-
95
-
96
  jQuery.ajax({
97
  type: "POST",
98
  url: ajaxurl,
@@ -111,10 +111,10 @@
111
  preview: preview,
112
  scenefadeduration: scenefadeduration,
113
  },
114
-
115
- success: function(response) {
116
  $('.wpvr-loading').hide();
117
-
118
  if (response.success == true) {
119
  $('#error_occured').hide();
120
  $('#error_occuredpub').hide();
@@ -122,8 +122,8 @@
122
  var scenes = response.data[1];
123
 
124
  if (scenes) {
125
- $.each(scenes.scenes, function(i) {
126
- $.each(scenes.scenes[i]['hotSpots'], function(key, val) {
127
  if (val["clickHandlerArgs"] != "") {
128
  val["clickHandlerFunc"] = wpvrhotspot;
129
  }
@@ -136,7 +136,7 @@
136
  if (scenes) {
137
  $('.scene-gallery').trigger('destroy.owl.carousel');
138
  $('.scene-gallery').empty();
139
- $.each(scenes.scenes, function(key, val) {
140
  $('.scene-gallery').append('<ul style="width:150px;"><li class="owlscene owl' + key + '">' + key + '</li><li title="Double click to view scene"><img class="scctrl" id="' + key + '_gallery" src="' + val.panorama + '"></li></ul>');
141
  });
142
  $(".vrowl-carousel").owlCarousel({
@@ -149,21 +149,21 @@
149
  }
150
  var panoshow = pannellum.viewer(response.data[0]["panoid"], scenes);
151
  if (scenes.autoRotate) {
152
- panoshow.on('load', function() {
153
- setTimeout(function() {
154
  panoshow.startAutoRotate(scenes.autoRotate, 0);
155
  }, 3000);
156
  });
157
- panoshow.on('scenechange', function() {
158
- setTimeout(function() {
159
  panoshow.startAutoRotate(scenes.autoRotate, 0);
160
  }, 3000);
161
  });
162
  }
163
  var touchtime = 0;
164
  if (scenes) {
165
- $.each(scenes.scenes, function(key, val) {
166
- document.getElementById('' + key + '_gallery').addEventListener('click', function(e) {
167
  if (touchtime == 0) {
168
  touchtime = new Date().getTime();
169
  } else {
@@ -181,7 +181,7 @@
181
  scrollTop: $("#wpvr_item_builder__box").offset().top
182
  }, 500);
183
  //set preview text
184
- if("" != previewtext){
185
  $('.pnlm-load-button p').text(previewtext);
186
  }
187
  } else {
@@ -200,10 +200,10 @@
200
  });
201
  });
202
 
203
- jQuery(document).ready(function($){
204
-
205
  var ajaxurl = wpvr_obj.ajaxurl;
206
- $('#videopreview').on('click', function(e) {
207
  e.preventDefault();
208
  $('.wpvr-loading').show();
209
  var postid = $("#post_ID").val();
@@ -221,7 +221,7 @@
221
  vidcontrol: vidcontrol,
222
  },
223
 
224
- success: function(response) {
225
  $('.wpvr-loading').hide();
226
  if (response.success == true) {
227
  $('#' + response.data["panoid"]).empty();
@@ -236,16 +236,16 @@
236
  $('html, body').animate({
237
  scrollTop: $("#wpvr_item_builder__box").offset().top
238
  }, 500);
239
- } else {}
240
  }
241
  });
242
  });
243
  });
244
 
245
- jQuery(document).ready(function($) {
246
-
247
  var flag_ok = false;
248
- $('#publish').on('click', function(e) {
249
  var x = $(this).val();
250
  if (!flag_ok) {
251
  e.preventDefault();
@@ -267,7 +267,7 @@
267
  var previewtext = $('.previewtext').val();
268
  if ($('.scene-setup')[0]) {
269
  var panodata = $('.scene-setup').repeaterVal();
270
-
271
  var panolist = JSON.stringify(panodata);
272
  } else {
273
  var panodata = '';
@@ -295,10 +295,10 @@
295
  autorotationinactivedelay: autorotationinactivedelay,
296
  autorotationstopdelay: autorotationstopdelay,
297
  scenefadeduration: scenefadeduration,
298
- previewtext:previewtext,
299
  },
300
 
301
- success: function(response) {
302
  $('.wpvr-loading').hide();
303
  if (response.success == false) {
304
  $('#error_occured').show();
@@ -320,27 +320,27 @@
320
  });
321
  });
322
 
323
- jQuery(document).ready(function($) {
324
- $("body, .pano-error-close-btn").on("click", function(e) {
325
  $("#error_occured").hide();
326
  $('body').removeClass('error-overlay');
327
  });
328
 
329
- $("#panolenspreview, #error_occured").on("click", function(e) {
330
  e.stopPropagation();
331
  });
332
  });
333
- jQuery(document).ready(function($) {
334
  var previewtext = $('.previewtext').val();
335
- if( "" != previewtext){
336
  $('.pnlm-load-button p').text(previewtext);
337
  }
338
  });
339
 
340
- jQuery(document).ready(function($) {
341
 
342
  var flag_ok = false;
343
- $('#save-post').on('click', function(e) {
344
  var x = $(this).val();
345
  if (!flag_ok) {
346
  e.preventDefault();
@@ -390,7 +390,7 @@
390
  scenefadeduration: scenefadeduration,
391
  },
392
 
393
- success: function(response) {
394
  $('.wpvr-loading').hide();
395
  if (response.success == false) {
396
  $('#error_occured').show();
@@ -444,8 +444,8 @@
444
  span.style.marginTop = -span.scrollHeight - 12 + 'px';
445
  }
446
 
447
- jQuery(document).ready(function($) {
448
- $("#cross").on("click", function(e) {
449
  e.preventDefault();
450
  $("#custom-ifram").fadeOut();
451
  $(".iframe-wrapper").removeClass("show-modal");
@@ -453,7 +453,7 @@
453
  });
454
  });
455
 
456
- jQuery(document).ready(function($) {
457
 
458
  var i = $('.scene-nav li').eq(-2).find('span').attr('data-index');
459
  i = parseInt(i);
@@ -468,7 +468,7 @@
468
  'chgscene': 'off',
469
  'czscene': 'off',
470
  },
471
- show: function() {
472
 
473
  if ($(this).parents(".scene-setup").attr("data-limit").length > 0) {
474
 
@@ -513,7 +513,7 @@
513
  $('#wpvr_active_scenes').val(i);
514
  $('#wpvr_active_hotspot').val(1);
515
  },
516
- hide: function(deleteElement) {
517
  var hide_id = $(this).attr("id");
518
  var _hide_id = hide_id.split('-').pop();
519
  hide_id = "#" + hide_id;
@@ -527,41 +527,41 @@
527
  var str1 = 'scene';
528
  var str2 = 'hotspot';
529
  if (elementcontains.indexOf(str1) != -1 && elementcontains.indexOf(str2) == -1) {
530
-
531
  var _this = $(this);
532
  $('.wpvr-delete-alert-wrapper').addClass('pano-error-color').css('display', 'flex');
533
  $('#confirm_text').html(' Are you sure you want to delete this Scene?');
534
- $('.wpvr-delete-confirm-btn .yes').click(function(e){
535
- e.preventDefault();
536
- jQuery(_this).slideUp(deleteElement);
537
- if (current == fchild) {
538
- $(_this).next().addClass("active");
539
- $(_this).parent().parent('.scene-setup').find('.scene-nav li span[data-href="' + hide_id + '"]').parent("li").next().addClass("active");
540
- $(_this).parent().parent('.scene-setup').find('.scene-nav li span[data-href="' + hide_id + '"]').parent("li").next().children("span").trigger("click");
541
- } else {
542
- $(_this).prev().addClass("active");
543
- $(_this).parent().parent('.scene-setup').find('.scene-nav li span[data-href="' + hide_id + '"]').parent("li").prev().addClass("active");
544
- $(_this).parent().parent('.scene-setup').find('.scene-nav li span[data-href="' + hide_id + '"]').parent("li").prev().children("span").trigger("click");
545
- }
546
- $(_this).parent().parent('.scene-setup').find('.scene-nav li span[data-href="' + hide_id + '"]').parent("li").remove();
547
- setTimeout(deleteinfodata, 1000);
548
 
549
- //tab active setup
550
- if (parseInt(_hide_id) - 1 > 0) {
551
- $('#wpvr_active_scenes').val(parseInt(_hide_id) - 1);
552
- } else {
553
- $('#wpvr_active_scenes').val(1);
554
- }
555
- $('#wpvr_active_hotspot').val(1);
556
- $('.wpvr-delete-alert-wrapper').removeClass('pano-error-color').css('display', 'none');
557
- $('.wpvr-delete-alert-wrapper').hide();
558
- });
559
 
560
- $(document).on("click", ".wpvr-delete-confirm-btn .cancel, .wpvr-delete-alert-wrapper .cross", function(e) {
561
- e.preventDefault();
562
- $('.wpvr-delete-alert-wrapper').removeClass('pano-error-color').css('display', 'none');
563
- $('.wpvr-delete-alert-wrapper').hide();
564
- });
565
  // if (confirm('Are you sure you want to delete?')) {
566
  // jQuery(this).slideUp(deleteElement);
567
  // if (current == fchild) {
@@ -594,7 +594,7 @@
594
  'hotspot-type': 'info',
595
  'hotspot-customclass-pro': 'none',
596
  },
597
- show: function() {
598
  if ($(this).parents(".hotspot-setup").attr("data-limit").length > 0) {
599
 
600
  if ($(this).parents(".hotspot-setup").find("div[data-repeater-item]").length <= $(this).parents(".hotspot-setup").attr("data-limit")) {
@@ -644,7 +644,7 @@
644
  }
645
  $('#wpvr_active_hotspot').val(j);
646
  },
647
- hide: function(deleteElement) {
648
  var hotspot_hide_id = $(this).attr("id");
649
  var _hide_id = hotspot_hide_id.split('-').pop();
650
  hotspot_hide_id = "#" + hotspot_hide_id;
@@ -655,13 +655,13 @@
655
  var hpstr1 = 'scene';
656
  var hpstr2 = 'hotspot';
657
  if (hpelementcontains.indexOf(hpstr1) != -1 && hpelementcontains.indexOf(hpstr2) != -1) {
658
-
659
  var _this = $(this);
660
 
661
  $('#confirm_text').html(' Are you sure you want to delete this Hotspot?');
662
  $('.wpvr-delete-alert-wrapper').addClass('pano-error-color').css('display', 'flex');
663
-
664
- $('.wpvr-delete-confirm-btn .yes').click(function(e){
665
  e.preventDefault();
666
  jQuery(_this).slideUp(deleteElement);
667
  if (hotspot_current == hotspot_fchild) {
@@ -685,14 +685,14 @@
685
  $('.wpvr-delete-alert-wrapper').hide();
686
  });
687
 
688
- $(document).on("click", ".wpvr-delete-confirm-btn .cancel, .wpvr-delete-alert-wrapper .cross", function(e) {
689
  e.preventDefault();
690
  $('.wpvr-delete-alert-wrapper').removeClass('pano-error-color').css('display', 'none');
691
  $('.wpvr-delete-alert-wrapper').hide();
692
  });
693
-
694
  // if (confirm('Are you sure you want to deletee?')) {
695
-
696
  // jQuery(this).slideUp(deleteElement);
697
  // if (hotspot_current == hotspot_fchild) {
698
  // $(this).next().addClass("active");
@@ -722,7 +722,7 @@
722
 
723
  var file_frame;
724
  var parent;
725
- $(document).on("click", ".scene-upload", function(event) {
726
  event.preventDefault();
727
  parent = $(this).parent('.form-group');
728
 
@@ -742,7 +742,7 @@
742
  multiple: false
743
  });
744
 
745
- file_frame.on('select', function() {
746
 
747
  var attachment = file_frame.state().get('selection').first().toJSON();
748
  parent.find('.scene-attachment-url').val(attachment.url);
@@ -753,7 +753,7 @@
753
  });
754
 
755
  var file_frames;
756
- $(document).on("click", ".video-upload", function(event) {
757
  event.preventDefault();
758
 
759
  parent = $(this).parent('.form-group');
@@ -774,7 +774,7 @@
774
  multiple: false
775
  });
776
 
777
- file_frames.on('select', function() {
778
  var attachment = file_frames.state().get('selection').first().toJSON();
779
  parent.find('.video-attachment-url').val(attachment.url);
780
  });
@@ -784,7 +784,7 @@
784
 
785
  var file_fram;
786
 
787
- $(document).on("click", ".preview-upload", function(event) {
788
  event.preventDefault();
789
  parent = $(this).parent('.form-group');
790
 
@@ -804,7 +804,7 @@
804
  multiple: false
805
  });
806
 
807
- file_fram.on('select', function() {
808
  var attachment = file_fram.state().get('selection').first().toJSON();
809
  parent.find('.preview-attachment-url').val(attachment.url);
810
  parent.find('.img-upload-frame').css('background-image', 'url(' + attachment.url + ')');
@@ -816,7 +816,7 @@
816
  });
817
 
818
  //----remove tour preview image----
819
- $(document).on("click", ".remove-attachment", function(event) {
820
  $(this).hide();
821
  parent = $(this).parents('.form-group');
822
 
@@ -826,7 +826,7 @@
826
  });
827
 
828
 
829
- $(document).on("change", "select[name*=hotspot-type]", function(event) {
830
 
831
  var getparent = $(this).parent();
832
 
@@ -843,13 +843,13 @@
843
  });
844
 
845
 
846
- $(document).on("click", ".pano-error-close-btn", function(e) {
847
  e.preventDefault();
848
  $('.wpvr-delete-alert-wrapper').css('display', 'none');
849
  $('.wpvr-delete-alert-wrapper').hide();
850
  });
851
-
852
- $(document).on("change", "input[type=radio][name=panovideo]", function(event) {
853
  var getvalue = $(this).val();
854
  if (getvalue == 'on') {
855
  $('#confirm_text').html('Turning On The Video Option Will Erase Your Virtual Tour Data. Are You Sure?');
@@ -864,27 +864,27 @@
864
  $("li.streetview").show();
865
  }
866
 
867
- $(document).on("click", ".wpvr-delete-confirm-btn .cancel", function(e) {
868
  e.preventDefault();
869
  $('.wpvr-delete-alert-wrapper').css('display', 'none');
870
  $('.wpvr-delete-alert-wrapper').hide();
871
-
872
  $(".video_on").prop('checked', false);
873
  $(".video_off").prop('checked', true);
874
-
875
  $("li.general").show();
876
  $("li.scene").show();
877
  $("li.hotspot").show();
878
  $("li.streetview").show();
879
-
880
-
881
  });
882
 
883
- $(document).on("click", ".wpvr-delete-confirm-btn .yes", function(e) {
884
  e.preventDefault();
885
  $('.wpvr-delete-alert-wrapper').css('display', 'none');
886
  $('.wpvr-delete-alert-wrapper').hide();
887
-
888
  $(".video_off").prop('checked', false);
889
  $(".video_on").prop('checked', true);
890
  $(".video-setting").show();
@@ -892,16 +892,16 @@
892
  $("li.scene").hide();
893
  $("li.hotspot").hide();
894
  $("li.streetview").hide();
895
-
896
  });
897
  });
898
 
899
 
900
  // $(document).on("change", "input[type=radio][name=panovideo]", function(event) {
901
  // var getvalue = $(this).val();
902
-
903
  // if (getvalue == 'on') {
904
-
905
  // $(".video-setting").show();
906
  // $("li.general").hide();
907
  // $("li.scene").hide();
@@ -916,10 +916,10 @@
916
  // }
917
  // });
918
 
919
- jQuery(document).ready(function($) {
920
  var viddata = $("input[name='panovideo']:checked").val();
921
  if (viddata == 'on') {
922
-
923
  $("li.general").removeClass('active');
924
  $(".rex-pano-tab.general").removeClass('active');
925
  $("li.video").addClass('active');
@@ -936,20 +936,20 @@
936
  }
937
  });
938
 
939
- $(document).on("change", "select[name*=hotspot-customclass-pro]", function(event) {
940
  var getval = $(this).val();
941
  $(this).parent('.hotspot-setting').children('span.change-icon').html('<i class="' + getval + '"></i>');
942
 
943
  });
944
 
945
- $(document).on("change", ".hotspot-customclass-color", function(event) {
946
  var getcolor = $(this).val();
947
  color = getcolor;
948
  $('.hotspot-customclass-color-icon-value').val(getcolor);
949
  $('.hotspot-customclass-color').val(getcolor);
950
  });
951
 
952
- jQuery(document).ready(function($) {
953
  if ($(".icon-found-value")[0]) {
954
  color = $('.hotspot-customclass-color-icon-value.icon-found-value').val();
955
  } else {
@@ -965,7 +965,7 @@
965
  //------------panolens tab js------------------
966
 
967
 
968
- $(document).on("click", ".scene-nav ul li:not(:last-child) span", function() {
969
 
970
  var scene_id = $(this).data('index');
971
  scene_id = '#scene-' + scene_id;
@@ -977,7 +977,7 @@
977
  });
978
 
979
  //add click
980
- $(document).on("click", ".scene-nav ul li:last-child span", function() {
981
  var scene_id = $(this).parent('li').prev().children("span").data('index');
982
  scene_id = '#scene-' + scene_id;
983
  $(scene_id).removeAttr("style");
@@ -999,12 +999,12 @@
999
  });
1000
 
1001
  //end add click
1002
- $(document).on("click", ".hotspot-nav ul li:not(:last-child) span", function() {
1003
  $('#wpvr_active_hotspot').val($(this).data('index'));
1004
  $([$(this).parent()[0], $($(this).data('href'))[0]]).addClass('active').siblings('.active').removeClass('active');
1005
  });
1006
 
1007
- $(document).on("click", ".hotspot-nav ul li:last-child span", function() {
1008
  $(this).parent('li').siblings('.active').removeClass('active');
1009
  $(this).parent('li').prev().addClass('active');
1010
  var sceneinfo = $('.scene-setup').repeaterVal();
@@ -1031,57 +1031,57 @@
1031
 
1032
  }
1033
 
1034
- $(document).on("click", ".rex-pano-nav-menu.main-nav ul li span", function() {
1035
  var screen = $(this).parent().attr('data-screen');
1036
  $('#wpvr_active_tab').val(screen);
1037
- if('hotspot' == screen){
1038
- $('.active_scene_id').show();
1039
  var id = $('.single-scene.active').attr('id');
1040
- $('.active_scene_id p').text("Adding Hotspots on Scene: ");
1041
- var scenceID = $('#'+id+' .sceneid' ).val();
1042
- var span = '<span>('+scenceID+')</span>'
1043
  $('.active_scene_id p').append(span);
1044
- $('.active_scene_id').css({"background-color":"#E0E1F7","width":"100%","padding":"1px","text-align":"center", "padding":"10px 15px"});
1045
- $('.active_scene_id p').css({"color":"black","font-size":"15px"});
1046
- $('.active_scene_id p span').css({"color":"#004efa","font-size":"15px"});
1047
-
1048
- }else{
1049
- $('.active_scene_id').hide();
1050
  }
1051
  $([$(this).parent()[0], $($(this).data('href'))[0]]).addClass('active').siblings('.active').removeClass('active');
1052
  });
1053
 
1054
  //----------alert dismiss--------//
1055
- $(document).on("click", "body", function() {
1056
  $('body').removeClass('error-overlay2');
1057
  $('.pano-alert').removeClass('pano-default-warning').hide();
1058
  });
1059
- $(document).on("click", ".pano-alert .pano-error-close-btn", function() {
1060
  $('body').removeClass('error-overlay2');
1061
  $('.pano-alert').removeClass('pano-default-warning').hide();
1062
  });
1063
- $(document).on("click", ".pano-alert, .rex-pano-sub-tabs .rex-pano-tab-nav li.add", function(e) {
1064
  e.stopPropagation();
1065
  });
1066
 
1067
 
1068
- $(document).on("click", ".main-nav li.hotspot span", function() {
1069
  $(".hotspot-setup.rex-pano-sub-tabs").show();
1070
  $(".scene-setup > nav.scene-nav").hide();
1071
  $(".scene-setup .single-scene > .scene-content").hide();
1072
  $(".scene-setup .delete-scene").hide();
1073
  });
1074
 
1075
- $(document).on("click", ".main-nav li.scene span", function() {
1076
  $(".hotspot-setup.rex-pano-sub-tabs").hide();
1077
  $(".scene-setup > nav.scene-nav").show();
1078
  $(".scene-setup .single-scene > .scene-content").show();
1079
  $(".scene-setup .delete-scene").show();
1080
  });
1081
 
1082
- $(document).on("change", ".dscen", function() {
1083
  var dscene = $(this).val();
1084
- $(".dscen").not(this).each(function() {
1085
  var oth_scene = $(this).val();
1086
  if (dscene == 'on' && oth_scene == 'on') {
1087
  $('#error_occured').show();
@@ -1091,12 +1091,12 @@
1091
  scrollTop: $("#error_occured").offset().top
1092
  }, 500);
1093
  $(this).val('off');
1094
-
1095
  }
1096
  });
1097
  });
1098
 
1099
- $(document).on("change", ".sceneid", function() {
1100
  var sceneinfo = $('.scene-setup').repeaterVal();
1101
  var infodata = sceneinfo['scene-list'];
1102
  $('.hotspotscene').find('option').remove();
@@ -1124,7 +1124,7 @@
1124
  }
1125
  }
1126
 
1127
- $(document).on("change", ".hotspotscene", function() {
1128
 
1129
  var chanheghtptpval = $(this).val();
1130
  if (chanheghtptpval != "none") {
@@ -1134,21 +1134,21 @@
1134
  }
1135
  });
1136
 
1137
- $(document).on("click", ".hotpitch", function(event) {
1138
  var datacoords = $('#panodata').text().split(',');
1139
  var pitchsplit = datacoords[0];
1140
  var pitch = pitchsplit.split(':');
1141
  $(this).parent().parent('.hotspot-setting').children('.hotspot-pitch').val(pitch[1]);
1142
  });
1143
 
1144
- $(document).on("click", ".hotyaw", function(event) {
1145
  var datacoords = $('#panodata').text().split(',');
1146
  var yawsplit = datacoords[1];
1147
  var yaw = yawsplit.split(':');
1148
  $(this).parent().parent('.hotspot-setting').children('.hotspot-yaw').val(yaw[1]);
1149
  });
1150
 
1151
- jQuery(document).ready(function($) {
1152
 
1153
  if ($(".scene-setup").length > 0) {
1154
  var sceneinfo = $('.scene-setup').repeaterVal();
@@ -1164,7 +1164,7 @@
1164
  }
1165
  });
1166
 
1167
- $(document).on("click", ".toppitch", function(event) {
1168
  var datacoords = $('#panodata').text().split(',');
1169
  var pitchsplit = datacoords[0];
1170
  var pitch = pitchsplit.split(':');
@@ -1174,14 +1174,14 @@
1174
  $('div.single-scene.rex-pano-tab.active').children('div.hotspot-setup.rex-pano-sub-tabs').children('div.rex-pano-tab-content').children('div.single-hotspot.rex-pano-tab.active.clearfix').find('.hotspot-pitch').val(pitch[1]);
1175
  $('div.single-scene.rex-pano-tab.active').children('div.hotspot-setup.rex-pano-sub-tabs').children('div.rex-pano-tab-content').children('div.single-hotspot.rex-pano-tab.active.clearfix').find('.hotspot-yaw').val(yaw[1]);
1176
  });
1177
- jQuery(document).ready(function($) {
1178
  $('.hotspot-customclass-pro-select').fontIconPicker();
1179
  });
1180
- jQuery(document).ready(function($) {
1181
  $('span.change-icon').hide();
1182
  });
1183
 
1184
- jQuery(document).ready(function($) {
1185
  var autrotateset = $("input[name='autorotation']").val();
1186
  if (autrotateset == 'off') {
1187
  $('.autorotationdata-wrapper').hide();
@@ -1190,7 +1190,7 @@
1190
  }
1191
  });
1192
 
1193
- $(document).on("change", "input[name='autorotation']", function(event) {
1194
  var autrotateset = $(this).val();
1195
 
1196
  if (autrotateset == 'on') {
@@ -1200,7 +1200,7 @@
1200
  }
1201
  });
1202
 
1203
- $(document).on("change", ".ptyscene", function(event) {
1204
  var ptyscene = $(this).val();
1205
  if (ptyscene == 'off') {
1206
  $(this).parent('.single-settings').siblings('.ptyscenedata').hide();
@@ -1209,7 +1209,7 @@
1209
  }
1210
  });
1211
 
1212
- $(document).on("change", ".cvgscene", function(event) {
1213
  var cvgscene = $(this).val();
1214
  if (cvgscene == 'off') {
1215
  $(this).parent('.single-settings').siblings('.cvgscenedata').hide();
@@ -1218,7 +1218,7 @@
1218
  }
1219
  });
1220
 
1221
- $(document).on("change", ".chgscene", function(event) {
1222
  var chgscenedata = $(this).val();
1223
  if (chgscenedata == 'off') {
1224
  $(this).parent('.single-settings').siblings('.chgscenedata').hide();
@@ -1227,7 +1227,7 @@
1227
  }
1228
  });
1229
 
1230
- $(document).on("change", ".czscene", function(event) {
1231
  var czscene = $(this).val();
1232
  if (czscene == 'off') {
1233
  $(this).parent('.single-settings').siblings('.czscenedata').hide();
@@ -1240,7 +1240,7 @@
1240
  * Nasim
1241
  * enable script button on chnage action
1242
  */
1243
- $("#wpvr_script_control").change(function() {
1244
 
1245
  if ($('#wpvr_script_control').is(':checked')) {
1246
 
@@ -1253,6 +1253,23 @@
1253
 
1254
  });
1255
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1256
 
1257
  /**
1258
  * Nasim
@@ -1268,7 +1285,21 @@
1268
  $(".wpvr_enqueue_script_list").hide();
1269
  }
1270
 
1271
- $(document).on("click", "#wpvr_role_submit", function(e) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1272
  e.preventDefault();
1273
  var ajaxurl = wpvr_obj.ajaxurl;
1274
  $('#wpvr_role_progress').show();
@@ -1281,6 +1312,8 @@
1281
  var wpvr_frontend_notice_area = $('#wpvr_frontend_notice_area').val();
1282
  var wpvr_script_control = $('#wpvr_script_control').is(':checked');
1283
  var wpvr_script_list = $('#wpvr_script_list').val();
 
 
1284
  var high_res_image = $('#high_res_image').is(':checked');
1285
 
1286
  /**
@@ -1305,8 +1338,10 @@
1305
  wpvr_frontend_notice_area: wpvr_frontend_notice_area,
1306
  wpvr_script_control: wpvr_script_control,
1307
  wpvr_script_list: wpvr_script_list,
 
 
1308
  },
1309
- success: function(response) {
1310
  $('#wpvr_role_progress').hide();
1311
  $('#wpvr_role_submit').attr('disabled', false);
1312
  if (response.status == 'success') {
@@ -1334,8 +1369,10 @@
1334
  wpvr_frontend_notice_area: wpvr_frontend_notice_area,
1335
  wpvr_script_control: wpvr_script_control,
1336
  wpvr_script_list: wpvr_script_list,
 
 
1337
  },
1338
- success: function(response) {
1339
  $('#wpvr_role_progress').hide();
1340
  $('#wpvr_role_submit').attr('disabled', false);
1341
  if (response.status == 'success') {
@@ -1351,9 +1388,9 @@
1351
 
1352
 
1353
  //------general tab's inner tab-------
1354
- jQuery(document).ready(function($) {
1355
-
1356
- $('.general-inner-tab .inner-nav li span').on('click', function() {
1357
  var this_id = $(this).attr('data-href');
1358
  $(this_id).show();
1359
  $(this_id).siblings().hide();
@@ -1398,32 +1435,32 @@
1398
  // console.log("fgfg")
1399
  // $('#confirm_text').html('Turning On The Video Option Will Erase Your Virtual Tour Data. Are You Sure?');
1400
  // $('.wpvr-delete-alert-wrapper').css('display', 'flex');
1401
-
1402
  // } else {
1403
  // $('.wpvr-delete-alert-wrapper').css('display', 'none');
1404
-
1405
  // }
1406
-
1407
  // $(document).on("click", ".wpvr-delete-confirm-btn .cancel", function(e) {
1408
  // e.preventDefault();
1409
  // $('.wpvr-delete-alert-wrapper').css('display', 'none');
1410
  // $('.wpvr-delete-alert-wrapper').hide();
1411
-
1412
  // $(".video_on").prop('checked', false);
1413
  // $(".video_off").prop('checked', true);
1414
  // $(".video-setting").hide();
1415
  // $("li.general").show();
1416
  // $("li.scene").show();
1417
  // $("li.hotspot").show();
1418
-
1419
  // });
1420
-
1421
  // $(document).on("click", ".wpvr-delete-confirm-btn .yes", function(e) {
1422
  // e.preventDefault();
1423
  // $('.wpvr-delete-alert-wrapper').css('display', 'none');
1424
  // $('.wpvr-delete-alert-wrapper').hide();
1425
  // return false;
1426
-
1427
  // });
1428
  // });
1429
  // });
@@ -1445,7 +1482,7 @@
1445
  // return false;
1446
  // });
1447
 
1448
-
1449
  });
1450
 
1451
 
@@ -1453,8 +1490,8 @@
1453
 
1454
 
1455
  //------active tab scripts-------
1456
- jQuery(document).ready(function($) {
1457
-
1458
  function getUrlVars() {
1459
  var vars = [],
1460
  hash;
@@ -1500,7 +1537,7 @@
1500
  var scenesIds = [];
1501
  var sceneID = '#scene-' + _sceneID;
1502
  var scene_nav_items = scene_nav.find('li');
1503
- scene_nav.find('li').each(function() {
1504
  var index = $(this).find('span').attr('data-index');
1505
  if (index) {
1506
  scenesIds.push(index);
@@ -1508,7 +1545,7 @@
1508
  });
1509
  if (scenesIds.includes(_sceneID)) {
1510
  scene_nav_items.removeClass('active');
1511
- scene_nav.find('li').each(function() {
1512
  var index = $(this).find('span').attr('data-index');
1513
  if (_sceneID == index) {
1514
  $(this).addClass('active');
@@ -1539,7 +1576,7 @@
1539
  var hotspotIds = [];
1540
  var hotspot_nav_items = $('.single-scene.active').find('.hotspot-nav').find('li');
1541
  var activeHotspotId = '#scene-' + _sceneID + 'hotspot-' + _hotspotID;
1542
- hotspot_nav_items.each(function() {
1543
  var index = $(this).find('span').attr('data-index');
1544
  if (index) {
1545
  hotspotIds.push(index);
@@ -1548,7 +1585,7 @@
1548
  });
1549
  if (hotspotIds.includes(_hotspotID)) {
1550
  hotspot_nav_items.removeClass('active');
1551
- hotspot_nav.find('li').each(function() {
1552
  var index = $(this).find('span').attr('data-index');
1553
  if (_hotspotID === index) {
1554
  $(this).addClass('active');
@@ -1563,7 +1600,7 @@
1563
  }
1564
  }
1565
 
1566
-
1567
  });
1568
 
1569
 
1
+ (function ($) {
2
  'use strict';
3
  var j = 1;
4
  var color = '#00b4ff';
31
  * practising this, we should strive to set a better example in our own work.
32
  */
33
 
34
+
35
+ $(document).ready(function () {
36
  $(".vrowl-carousel").owlCarousel({
37
  margin: 10,
38
  autoWidth: true,
39
+ nav: true
40
  });
41
 
42
  var primary_markng = $('#scene-1').find('input.sceneid').val();
50
  $('.postbox .hndle').css('cursor', 'pointer');
51
  });
52
 
53
+ $(document).on("change", "input.vr-switcher-check", function (event) {
54
  if (this.checked) {
55
  $(this).val('on');
56
  } else {
57
  $(this).val('off');
58
  }
59
  });
 
60
 
61
+
62
+ $(document).on("click", ".scene-nav ul li span", function (event) {
63
  $('.owl-item').removeClass('marked');
64
  var target = $(this).attr("data-index");
65
  var data = $('#scene-' + target).find('input.sceneid').val();
68
  }
69
  });
70
 
71
+ jQuery(document).ready(function ($) {
72
+
73
  j = $('#scene-1').find('.hotspot-nav li').eq(-2).find('span').attr('data-index');
74
  var ajaxurl = wpvr_obj.ajaxurl;
75
+ $('#panolenspreview').on('click', function (e) {
76
  e.preventDefault();
77
  $('.wpvr-loading').show();
78
  var postid = $("#post_ID").val();
91
  var panodata = $('.scene-setup').repeaterVal();
92
  var panolist = JSON.stringify(panodata);
93
  var previewtext = $('.previewtext').val();
94
+
95
+
96
  jQuery.ajax({
97
  type: "POST",
98
  url: ajaxurl,
111
  preview: preview,
112
  scenefadeduration: scenefadeduration,
113
  },
114
+
115
+ success: function (response) {
116
  $('.wpvr-loading').hide();
117
+
118
  if (response.success == true) {
119
  $('#error_occured').hide();
120
  $('#error_occuredpub').hide();
122
  var scenes = response.data[1];
123
 
124
  if (scenes) {
125
+ $.each(scenes.scenes, function (i) {
126
+ $.each(scenes.scenes[i]['hotSpots'], function (key, val) {
127
  if (val["clickHandlerArgs"] != "") {
128
  val["clickHandlerFunc"] = wpvrhotspot;
129
  }
136
  if (scenes) {
137
  $('.scene-gallery').trigger('destroy.owl.carousel');
138
  $('.scene-gallery').empty();
139
+ $.each(scenes.scenes, function (key, val) {
140
  $('.scene-gallery').append('<ul style="width:150px;"><li class="owlscene owl' + key + '">' + key + '</li><li title="Double click to view scene"><img class="scctrl" id="' + key + '_gallery" src="' + val.panorama + '"></li></ul>');
141
  });
142
  $(".vrowl-carousel").owlCarousel({
149
  }
150
  var panoshow = pannellum.viewer(response.data[0]["panoid"], scenes);
151
  if (scenes.autoRotate) {
152
+ panoshow.on('load', function () {
153
+ setTimeout(function () {
154
  panoshow.startAutoRotate(scenes.autoRotate, 0);
155
  }, 3000);
156
  });
157
+ panoshow.on('scenechange', function () {
158
+ setTimeout(function () {
159
  panoshow.startAutoRotate(scenes.autoRotate, 0);
160
  }, 3000);
161
  });
162
  }
163
  var touchtime = 0;
164
  if (scenes) {
165
+ $.each(scenes.scenes, function (key, val) {
166
+ document.getElementById('' + key + '_gallery').addEventListener('click', function (e) {
167
  if (touchtime == 0) {
168
  touchtime = new Date().getTime();
169
  } else {
181
  scrollTop: $("#wpvr_item_builder__box").offset().top
182
  }, 500);
183
  //set preview text
184
+ if ("" != previewtext) {
185
  $('.pnlm-load-button p').text(previewtext);
186
  }
187
  } else {
200
  });
201
  });
202
 
203
+ jQuery(document).ready(function ($) {
204
+
205
  var ajaxurl = wpvr_obj.ajaxurl;
206
+ $('#videopreview').on('click', function (e) {
207
  e.preventDefault();
208
  $('.wpvr-loading').show();
209
  var postid = $("#post_ID").val();
221
  vidcontrol: vidcontrol,
222
  },
223
 
224
+ success: function (response) {
225
  $('.wpvr-loading').hide();
226
  if (response.success == true) {
227
  $('#' + response.data["panoid"]).empty();
236
  $('html, body').animate({
237
  scrollTop: $("#wpvr_item_builder__box").offset().top
238
  }, 500);
239
+ } else { }
240
  }
241
  });
242
  });
243
  });
244
 
245
+ jQuery(document).ready(function ($) {
246
+
247
  var flag_ok = false;
248
+ $('#publish').on('click', function (e) {
249
  var x = $(this).val();
250
  if (!flag_ok) {
251
  e.preventDefault();
267
  var previewtext = $('.previewtext').val();
268
  if ($('.scene-setup')[0]) {
269
  var panodata = $('.scene-setup').repeaterVal();
270
+
271
  var panolist = JSON.stringify(panodata);
272
  } else {
273
  var panodata = '';
295
  autorotationinactivedelay: autorotationinactivedelay,
296
  autorotationstopdelay: autorotationstopdelay,
297
  scenefadeduration: scenefadeduration,
298
+ previewtext: previewtext,
299
  },
300
 
301
+ success: function (response) {
302
  $('.wpvr-loading').hide();
303
  if (response.success == false) {
304
  $('#error_occured').show();
320
  });
321
  });
322
 
323
+ jQuery(document).ready(function ($) {
324
+ $("body, .pano-error-close-btn").on("click", function (e) {
325
  $("#error_occured").hide();
326
  $('body').removeClass('error-overlay');
327
  });
328
 
329
+ $("#panolenspreview, #error_occured").on("click", function (e) {
330
  e.stopPropagation();
331
  });
332
  });
333
+ jQuery(document).ready(function ($) {
334
  var previewtext = $('.previewtext').val();
335
+ if ("" != previewtext) {
336
  $('.pnlm-load-button p').text(previewtext);
337
  }
338
  });
339
 
340
+ jQuery(document).ready(function ($) {
341
 
342
  var flag_ok = false;
343
+ $('#save-post').on('click', function (e) {
344
  var x = $(this).val();
345
  if (!flag_ok) {
346
  e.preventDefault();
390
  scenefadeduration: scenefadeduration,
391
  },
392
 
393
+ success: function (response) {
394
  $('.wpvr-loading').hide();
395
  if (response.success == false) {
396
  $('#error_occured').show();
444
  span.style.marginTop = -span.scrollHeight - 12 + 'px';
445
  }
446
 
447
+ jQuery(document).ready(function ($) {
448
+ $("#cross").on("click", function (e) {
449
  e.preventDefault();
450
  $("#custom-ifram").fadeOut();
451
  $(".iframe-wrapper").removeClass("show-modal");
453
  });
454
  });
455
 
456
+ jQuery(document).ready(function ($) {
457
 
458
  var i = $('.scene-nav li').eq(-2).find('span').attr('data-index');
459
  i = parseInt(i);
468
  'chgscene': 'off',
469
  'czscene': 'off',
470
  },
471
+ show: function () {
472
 
473
  if ($(this).parents(".scene-setup").attr("data-limit").length > 0) {
474
 
513
  $('#wpvr_active_scenes').val(i);
514
  $('#wpvr_active_hotspot').val(1);
515
  },
516
+ hide: function (deleteElement) {
517
  var hide_id = $(this).attr("id");
518
  var _hide_id = hide_id.split('-').pop();
519
  hide_id = "#" + hide_id;
527
  var str1 = 'scene';
528
  var str2 = 'hotspot';
529
  if (elementcontains.indexOf(str1) != -1 && elementcontains.indexOf(str2) == -1) {
530
+
531
  var _this = $(this);
532
  $('.wpvr-delete-alert-wrapper').addClass('pano-error-color').css('display', 'flex');
533
  $('#confirm_text').html(' Are you sure you want to delete this Scene?');
534
+ $('.wpvr-delete-confirm-btn .yes').click(function (e) {
535
+ e.preventDefault();
536
+ jQuery(_this).slideUp(deleteElement);
537
+ if (current == fchild) {
538
+ $(_this).next().addClass("active");
539
+ $(_this).parent().parent('.scene-setup').find('.scene-nav li span[data-href="' + hide_id + '"]').parent("li").next().addClass("active");
540
+ $(_this).parent().parent('.scene-setup').find('.scene-nav li span[data-href="' + hide_id + '"]').parent("li").next().children("span").trigger("click");
541
+ } else {
542
+ $(_this).prev().addClass("active");
543
+ $(_this).parent().parent('.scene-setup').find('.scene-nav li span[data-href="' + hide_id + '"]').parent("li").prev().addClass("active");
544
+ $(_this).parent().parent('.scene-setup').find('.scene-nav li span[data-href="' + hide_id + '"]').parent("li").prev().children("span").trigger("click");
545
+ }
546
+ $(_this).parent().parent('.scene-setup').find('.scene-nav li span[data-href="' + hide_id + '"]').parent("li").remove();
547
+ setTimeout(deleteinfodata, 1000);
548
 
549
+ //tab active setup
550
+ if (parseInt(_hide_id) - 1 > 0) {
551
+ $('#wpvr_active_scenes').val(parseInt(_hide_id) - 1);
552
+ } else {
553
+ $('#wpvr_active_scenes').val(1);
554
+ }
555
+ $('#wpvr_active_hotspot').val(1);
556
+ $('.wpvr-delete-alert-wrapper').removeClass('pano-error-color').css('display', 'none');
557
+ $('.wpvr-delete-alert-wrapper').hide();
558
+ });
559
 
560
+ $(document).on("click", ".wpvr-delete-confirm-btn .cancel, .wpvr-delete-alert-wrapper .cross", function (e) {
561
+ e.preventDefault();
562
+ $('.wpvr-delete-alert-wrapper').removeClass('pano-error-color').css('display', 'none');
563
+ $('.wpvr-delete-alert-wrapper').hide();
564
+ });
565
  // if (confirm('Are you sure you want to delete?')) {
566
  // jQuery(this).slideUp(deleteElement);
567
  // if (current == fchild) {
594
  'hotspot-type': 'info',
595
  'hotspot-customclass-pro': 'none',
596
  },
597
+ show: function () {
598
  if ($(this).parents(".hotspot-setup").attr("data-limit").length > 0) {
599
 
600
  if ($(this).parents(".hotspot-setup").find("div[data-repeater-item]").length <= $(this).parents(".hotspot-setup").attr("data-limit")) {
644
  }
645
  $('#wpvr_active_hotspot').val(j);
646
  },
647
+ hide: function (deleteElement) {
648
  var hotspot_hide_id = $(this).attr("id");
649
  var _hide_id = hotspot_hide_id.split('-').pop();
650
  hotspot_hide_id = "#" + hotspot_hide_id;
655
  var hpstr1 = 'scene';
656
  var hpstr2 = 'hotspot';
657
  if (hpelementcontains.indexOf(hpstr1) != -1 && hpelementcontains.indexOf(hpstr2) != -1) {
658
+
659
  var _this = $(this);
660
 
661
  $('#confirm_text').html(' Are you sure you want to delete this Hotspot?');
662
  $('.wpvr-delete-alert-wrapper').addClass('pano-error-color').css('display', 'flex');
663
+
664
+ $('.wpvr-delete-confirm-btn .yes').click(function (e) {
665
  e.preventDefault();
666
  jQuery(_this).slideUp(deleteElement);
667
  if (hotspot_current == hotspot_fchild) {
685
  $('.wpvr-delete-alert-wrapper').hide();
686
  });
687
 
688
+ $(document).on("click", ".wpvr-delete-confirm-btn .cancel, .wpvr-delete-alert-wrapper .cross", function (e) {
689
  e.preventDefault();
690
  $('.wpvr-delete-alert-wrapper').removeClass('pano-error-color').css('display', 'none');
691
  $('.wpvr-delete-alert-wrapper').hide();
692
  });
693
+
694
  // if (confirm('Are you sure you want to deletee?')) {
695
+
696
  // jQuery(this).slideUp(deleteElement);
697
  // if (hotspot_current == hotspot_fchild) {
698
  // $(this).next().addClass("active");
722
 
723
  var file_frame;
724
  var parent;
725
+ $(document).on("click", ".scene-upload", function (event) {
726
  event.preventDefault();
727
  parent = $(this).parent('.form-group');
728
 
742
  multiple: false
743
  });
744
 
745
+ file_frame.on('select', function () {
746
 
747
  var attachment = file_frame.state().get('selection').first().toJSON();
748
  parent.find('.scene-attachment-url').val(attachment.url);
753
  });
754
 
755
  var file_frames;
756
+ $(document).on("click", ".video-upload", function (event) {
757
  event.preventDefault();
758
 
759
  parent = $(this).parent('.form-group');
774
  multiple: false
775
  });
776
 
777
+ file_frames.on('select', function () {
778
  var attachment = file_frames.state().get('selection').first().toJSON();
779
  parent.find('.video-attachment-url').val(attachment.url);
780
  });
784
 
785
  var file_fram;
786
 
787
+ $(document).on("click", ".preview-upload", function (event) {
788
  event.preventDefault();
789
  parent = $(this).parent('.form-group');
790
 
804
  multiple: false
805
  });
806
 
807
+ file_fram.on('select', function () {
808
  var attachment = file_fram.state().get('selection').first().toJSON();
809
  parent.find('.preview-attachment-url').val(attachment.url);
810
  parent.find('.img-upload-frame').css('background-image', 'url(' + attachment.url + ')');
816
  });
817
 
818
  //----remove tour preview image----
819
+ $(document).on("click", ".remove-attachment", function (event) {
820
  $(this).hide();
821
  parent = $(this).parents('.form-group');
822
 
826
  });
827
 
828
 
829
+ $(document).on("change", "select[name*=hotspot-type]", function (event) {
830
 
831
  var getparent = $(this).parent();
832
 
843
  });
844
 
845
 
846
+ $(document).on("click", ".pano-error-close-btn", function (e) {
847
  e.preventDefault();
848
  $('.wpvr-delete-alert-wrapper').css('display', 'none');
849
  $('.wpvr-delete-alert-wrapper').hide();
850
  });
851
+
852
+ $(document).on("change", "input[type=radio][name=panovideo]", function (event) {
853
  var getvalue = $(this).val();
854
  if (getvalue == 'on') {
855
  $('#confirm_text').html('Turning On The Video Option Will Erase Your Virtual Tour Data. Are You Sure?');
864
  $("li.streetview").show();
865
  }
866
 
867
+ $(document).on("click", ".wpvr-delete-confirm-btn .cancel", function (e) {
868
  e.preventDefault();
869
  $('.wpvr-delete-alert-wrapper').css('display', 'none');
870
  $('.wpvr-delete-alert-wrapper').hide();
871
+
872
  $(".video_on").prop('checked', false);
873
  $(".video_off").prop('checked', true);
874
+
875
  $("li.general").show();
876
  $("li.scene").show();
877
  $("li.hotspot").show();
878
  $("li.streetview").show();
879
+
880
+
881
  });
882
 
883
+ $(document).on("click", ".wpvr-delete-confirm-btn .yes", function (e) {
884
  e.preventDefault();
885
  $('.wpvr-delete-alert-wrapper').css('display', 'none');
886
  $('.wpvr-delete-alert-wrapper').hide();
887
+
888
  $(".video_off").prop('checked', false);
889
  $(".video_on").prop('checked', true);
890
  $(".video-setting").show();
892
  $("li.scene").hide();
893
  $("li.hotspot").hide();
894
  $("li.streetview").hide();
895
+
896
  });
897
  });
898
 
899
 
900
  // $(document).on("change", "input[type=radio][name=panovideo]", function(event) {
901
  // var getvalue = $(this).val();
902
+
903
  // if (getvalue == 'on') {
904
+
905
  // $(".video-setting").show();
906
  // $("li.general").hide();
907
  // $("li.scene").hide();
916
  // }
917
  // });
918
 
919
+ jQuery(document).ready(function ($) {
920
  var viddata = $("input[name='panovideo']:checked").val();
921
  if (viddata == 'on') {
922
+
923
  $("li.general").removeClass('active');
924
  $(".rex-pano-tab.general").removeClass('active');
925
  $("li.video").addClass('active');
936
  }
937
  });
938
 
939
+ $(document).on("change", "select[name*=hotspot-customclass-pro]", function (event) {
940
  var getval = $(this).val();
941
  $(this).parent('.hotspot-setting').children('span.change-icon').html('<i class="' + getval + '"></i>');
942
 
943
  });
944
 
945
+ $(document).on("change", ".hotspot-customclass-color", function (event) {
946
  var getcolor = $(this).val();
947
  color = getcolor;
948
  $('.hotspot-customclass-color-icon-value').val(getcolor);
949
  $('.hotspot-customclass-color').val(getcolor);
950
  });
951
 
952
+ jQuery(document).ready(function ($) {
953
  if ($(".icon-found-value")[0]) {
954
  color = $('.hotspot-customclass-color-icon-value.icon-found-value').val();
955
  } else {
965
  //------------panolens tab js------------------
966
 
967
 
968
+ $(document).on("click", ".scene-nav ul li:not(:last-child) span", function () {
969
 
970
  var scene_id = $(this).data('index');
971
  scene_id = '#scene-' + scene_id;
977
  });
978
 
979
  //add click
980
+ $(document).on("click", ".scene-nav ul li:last-child span", function () {
981
  var scene_id = $(this).parent('li').prev().children("span").data('index');
982
  scene_id = '#scene-' + scene_id;
983
  $(scene_id).removeAttr("style");
999
  });
1000
 
1001
  //end add click
1002
+ $(document).on("click", ".hotspot-nav ul li:not(:last-child) span", function () {
1003
  $('#wpvr_active_hotspot').val($(this).data('index'));
1004
  $([$(this).parent()[0], $($(this).data('href'))[0]]).addClass('active').siblings('.active').removeClass('active');
1005
  });
1006
 
1007
+ $(document).on("click", ".hotspot-nav ul li:last-child span", function () {
1008
  $(this).parent('li').siblings('.active').removeClass('active');
1009
  $(this).parent('li').prev().addClass('active');
1010
  var sceneinfo = $('.scene-setup').repeaterVal();
1031
 
1032
  }
1033
 
1034
+ $(document).on("click", ".rex-pano-nav-menu.main-nav ul li span", function () {
1035
  var screen = $(this).parent().attr('data-screen');
1036
  $('#wpvr_active_tab').val(screen);
1037
+ if ('hotspot' == screen) {
1038
+ $('.active_scene_id').show();
1039
  var id = $('.single-scene.active').attr('id');
1040
+ $('.active_scene_id p').text("Adding Hotspots on Scene: ");
1041
+ var scenceID = $('#' + id + ' .sceneid').val();
1042
+ var span = '<span>(' + scenceID + ')</span>'
1043
  $('.active_scene_id p').append(span);
1044
+ $('.active_scene_id').css({ "background-color": "#E0E1F7", "width": "100%", "padding": "1px", "text-align": "center", "padding": "10px 15px" });
1045
+ $('.active_scene_id p').css({ "color": "black", "font-size": "15px" });
1046
+ $('.active_scene_id p span').css({ "color": "#004efa", "font-size": "15px" });
1047
+
1048
+ } else {
1049
+ $('.active_scene_id').hide();
1050
  }
1051
  $([$(this).parent()[0], $($(this).data('href'))[0]]).addClass('active').siblings('.active').removeClass('active');
1052
  });
1053
 
1054
  //----------alert dismiss--------//
1055
+ $(document).on("click", "body", function () {
1056
  $('body').removeClass('error-overlay2');
1057
  $('.pano-alert').removeClass('pano-default-warning').hide();
1058
  });
1059
+ $(document).on("click", ".pano-alert .pano-error-close-btn", function () {
1060
  $('body').removeClass('error-overlay2');
1061
  $('.pano-alert').removeClass('pano-default-warning').hide();
1062
  });
1063
+ $(document).on("click", ".pano-alert, .rex-pano-sub-tabs .rex-pano-tab-nav li.add", function (e) {
1064
  e.stopPropagation();
1065
  });
1066
 
1067
 
1068
+ $(document).on("click", ".main-nav li.hotspot span", function () {
1069
  $(".hotspot-setup.rex-pano-sub-tabs").show();
1070
  $(".scene-setup > nav.scene-nav").hide();
1071
  $(".scene-setup .single-scene > .scene-content").hide();
1072
  $(".scene-setup .delete-scene").hide();
1073
  });
1074
 
1075
+ $(document).on("click", ".main-nav li.scene span", function () {
1076
  $(".hotspot-setup.rex-pano-sub-tabs").hide();
1077
  $(".scene-setup > nav.scene-nav").show();
1078
  $(".scene-setup .single-scene > .scene-content").show();
1079
  $(".scene-setup .delete-scene").show();
1080
  });
1081
 
1082
+ $(document).on("change", ".dscen", function () {
1083
  var dscene = $(this).val();
1084
+ $(".dscen").not(this).each(function () {
1085
  var oth_scene = $(this).val();
1086
  if (dscene == 'on' && oth_scene == 'on') {
1087
  $('#error_occured').show();
1091
  scrollTop: $("#error_occured").offset().top
1092
  }, 500);
1093
  $(this).val('off');
1094
+
1095
  }
1096
  });
1097
  });
1098
 
1099
+ $(document).on("change", ".sceneid", function () {
1100
  var sceneinfo = $('.scene-setup').repeaterVal();
1101
  var infodata = sceneinfo['scene-list'];
1102
  $('.hotspotscene').find('option').remove();
1124
  }
1125
  }
1126
 
1127
+ $(document).on("change", ".hotspotscene", function () {
1128
 
1129
  var chanheghtptpval = $(this).val();
1130
  if (chanheghtptpval != "none") {
1134
  }
1135
  });
1136
 
1137
+ $(document).on("click", ".hotpitch", function (event) {
1138
  var datacoords = $('#panodata').text().split(',');
1139
  var pitchsplit = datacoords[0];
1140
  var pitch = pitchsplit.split(':');
1141
  $(this).parent().parent('.hotspot-setting').children('.hotspot-pitch').val(pitch[1]);
1142
  });
1143
 
1144
+ $(document).on("click", ".hotyaw", function (event) {
1145
  var datacoords = $('#panodata').text().split(',');
1146
  var yawsplit = datacoords[1];
1147
  var yaw = yawsplit.split(':');
1148
  $(this).parent().parent('.hotspot-setting').children('.hotspot-yaw').val(yaw[1]);
1149
  });
1150
 
1151
+ jQuery(document).ready(function ($) {
1152
 
1153
  if ($(".scene-setup").length > 0) {
1154
  var sceneinfo = $('.scene-setup').repeaterVal();
1164
  }
1165
  });
1166
 
1167
+ $(document).on("click", ".toppitch", function (event) {
1168
  var datacoords = $('#panodata').text().split(',');
1169
  var pitchsplit = datacoords[0];
1170
  var pitch = pitchsplit.split(':');
1174
  $('div.single-scene.rex-pano-tab.active').children('div.hotspot-setup.rex-pano-sub-tabs').children('div.rex-pano-tab-content').children('div.single-hotspot.rex-pano-tab.active.clearfix').find('.hotspot-pitch').val(pitch[1]);
1175
  $('div.single-scene.rex-pano-tab.active').children('div.hotspot-setup.rex-pano-sub-tabs').children('div.rex-pano-tab-content').children('div.single-hotspot.rex-pano-tab.active.clearfix').find('.hotspot-yaw').val(yaw[1]);
1176
  });
1177
+ jQuery(document).ready(function ($) {
1178
  $('.hotspot-customclass-pro-select').fontIconPicker();
1179
  });
1180
+ jQuery(document).ready(function ($) {
1181
  $('span.change-icon').hide();
1182
  });
1183
 
1184
+ jQuery(document).ready(function ($) {
1185
  var autrotateset = $("input[name='autorotation']").val();
1186
  if (autrotateset == 'off') {
1187
  $('.autorotationdata-wrapper').hide();
1190
  }
1191
  });
1192
 
1193
+ $(document).on("change", "input[name='autorotation']", function (event) {
1194
  var autrotateset = $(this).val();
1195
 
1196
  if (autrotateset == 'on') {
1200
  }
1201
  });
1202
 
1203
+ $(document).on("change", ".ptyscene", function (event) {
1204
  var ptyscene = $(this).val();
1205
  if (ptyscene == 'off') {
1206
  $(this).parent('.single-settings').siblings('.ptyscenedata').hide();
1209
  }
1210
  });
1211
 
1212
+ $(document).on("change", ".cvgscene", function (event) {
1213
  var cvgscene = $(this).val();
1214
  if (cvgscene == 'off') {
1215
  $(this).parent('.single-settings').siblings('.cvgscenedata').hide();
1218
  }
1219
  });
1220
 
1221
+ $(document).on("change", ".chgscene", function (event) {
1222
  var chgscenedata = $(this).val();
1223
  if (chgscenedata == 'off') {
1224
  $(this).parent('.single-settings').siblings('.chgscenedata').hide();
1227
  }
1228
  });
1229
 
1230
+ $(document).on("change", ".czscene", function (event) {
1231
  var czscene = $(this).val();
1232
  if (czscene == 'off') {
1233
  $(this).parent('.single-settings').siblings('.czscenedata').hide();
1240
  * Nasim
1241
  * enable script button on chnage action
1242
  */
1243
+ $("#wpvr_script_control").change(function () {
1244
 
1245
  if ($('#wpvr_script_control').is(':checked')) {
1246
 
1253
 
1254
  });
1255
 
1256
+ /**
1257
+ * Sakib
1258
+ * enable script button on chnage action
1259
+ */
1260
+ $("#wpvr_video_script_control").change(function () {
1261
+
1262
+ if ($('#wpvr_video_script_control').is(':checked')) {
1263
+
1264
+ $(".wpvr_enqueue_video_script_list").show();
1265
+
1266
+ } else {
1267
+
1268
+ $(".wpvr_enqueue_video_script_list").hide();
1269
+ }
1270
+
1271
+ });
1272
+
1273
 
1274
  /**
1275
  * Nasim
1285
  $(".wpvr_enqueue_script_list").hide();
1286
  }
1287
 
1288
+ /**
1289
+ * Sakib
1290
+ * Check enable script button is on or not
1291
+ * if on then script list field will be show and if off then script list field will be hide
1292
+ */
1293
+ if ($('#wpvr_video_script_control').is(':checked')) {
1294
+
1295
+ $(".wpvr_enqueue_video_script_list").show();
1296
+
1297
+ } else {
1298
+
1299
+ $(".wpvr_enqueue_video_script_list").hide();
1300
+ }
1301
+
1302
+ $(document).on("click", "#wpvr_role_submit", function (e) {
1303
  e.preventDefault();
1304
  var ajaxurl = wpvr_obj.ajaxurl;
1305
  $('#wpvr_role_progress').show();
1312
  var wpvr_frontend_notice_area = $('#wpvr_frontend_notice_area').val();
1313
  var wpvr_script_control = $('#wpvr_script_control').is(':checked');
1314
  var wpvr_script_list = $('#wpvr_script_list').val();
1315
+ var wpvr_video_script_control = $('#wpvr_video_script_control').is(':checked');
1316
+ var wpvr_video_script_list = $('#wpvr_video_script_list').val();
1317
  var high_res_image = $('#high_res_image').is(':checked');
1318
 
1319
  /**
1338
  wpvr_frontend_notice_area: wpvr_frontend_notice_area,
1339
  wpvr_script_control: wpvr_script_control,
1340
  wpvr_script_list: wpvr_script_list,
1341
+ wpvr_video_script_control: wpvr_video_script_control,
1342
+ wpvr_video_script_list: wpvr_video_script_list,
1343
  },
1344
+ success: function (response) {
1345
  $('#wpvr_role_progress').hide();
1346
  $('#wpvr_role_submit').attr('disabled', false);
1347
  if (response.status == 'success') {
1369
  wpvr_frontend_notice_area: wpvr_frontend_notice_area,
1370
  wpvr_script_control: wpvr_script_control,
1371
  wpvr_script_list: wpvr_script_list,
1372
+ wpvr_video_script_control: wpvr_video_script_control,
1373
+ wpvr_video_script_list: wpvr_video_script_list,
1374
  },
1375
+ success: function (response) {
1376
  $('#wpvr_role_progress').hide();
1377
  $('#wpvr_role_submit').attr('disabled', false);
1378
  if (response.status == 'success') {
1388
 
1389
 
1390
  //------general tab's inner tab-------
1391
+ jQuery(document).ready(function ($) {
1392
+
1393
+ $('.general-inner-tab .inner-nav li span').on('click', function () {
1394
  var this_id = $(this).attr('data-href');
1395
  $(this_id).show();
1396
  $(this_id).siblings().hide();
1435
  // console.log("fgfg")
1436
  // $('#confirm_text').html('Turning On The Video Option Will Erase Your Virtual Tour Data. Are You Sure?');
1437
  // $('.wpvr-delete-alert-wrapper').css('display', 'flex');
1438
+
1439
  // } else {
1440
  // $('.wpvr-delete-alert-wrapper').css('display', 'none');
1441
+
1442
  // }
1443
+
1444
  // $(document).on("click", ".wpvr-delete-confirm-btn .cancel", function(e) {
1445
  // e.preventDefault();
1446
  // $('.wpvr-delete-alert-wrapper').css('display', 'none');
1447
  // $('.wpvr-delete-alert-wrapper').hide();
1448
+
1449
  // $(".video_on").prop('checked', false);
1450
  // $(".video_off").prop('checked', true);
1451
  // $(".video-setting").hide();
1452
  // $("li.general").show();
1453
  // $("li.scene").show();
1454
  // $("li.hotspot").show();
1455
+
1456
  // });
1457
+
1458
  // $(document).on("click", ".wpvr-delete-confirm-btn .yes", function(e) {
1459
  // e.preventDefault();
1460
  // $('.wpvr-delete-alert-wrapper').css('display', 'none');
1461
  // $('.wpvr-delete-alert-wrapper').hide();
1462
  // return false;
1463
+
1464
  // });
1465
  // });
1466
  // });
1482
  // return false;
1483
  // });
1484
 
1485
+
1486
  });
1487
 
1488
 
1490
 
1491
 
1492
  //------active tab scripts-------
1493
+ jQuery(document).ready(function ($) {
1494
+
1495
  function getUrlVars() {
1496
  var vars = [],
1497
  hash;
1537
  var scenesIds = [];
1538
  var sceneID = '#scene-' + _sceneID;
1539
  var scene_nav_items = scene_nav.find('li');
1540
+ scene_nav.find('li').each(function () {
1541
  var index = $(this).find('span').attr('data-index');
1542
  if (index) {
1543
  scenesIds.push(index);
1545
  });
1546
  if (scenesIds.includes(_sceneID)) {
1547
  scene_nav_items.removeClass('active');
1548
+ scene_nav.find('li').each(function () {
1549
  var index = $(this).find('span').attr('data-index');
1550
  if (_sceneID == index) {
1551
  $(this).addClass('active');
1576
  var hotspotIds = [];
1577
  var hotspot_nav_items = $('.single-scene.active').find('.hotspot-nav').find('li');
1578
  var activeHotspotId = '#scene-' + _sceneID + 'hotspot-' + _hotspotID;
1579
+ hotspot_nav_items.each(function () {
1580
  var index = $(this).find('span').attr('data-index');
1581
  if (index) {
1582
  hotspotIds.push(index);
1585
  });
1586
  if (hotspotIds.includes(_hotspotID)) {
1587
  hotspot_nav_items.removeClass('active');
1588
+ hotspot_nav.find('li').each(function () {
1589
  var index = $(this).find('span').attr('data-index');
1590
  if (_hotspotID === index) {
1591
  $(this).addClass('active');
1600
  }
1601
  }
1602
 
1603
+
1604
  });
1605
 
1606
 
admin/partials/wpvr-meta-box-builder-display.php CHANGED
@@ -351,8 +351,26 @@ if (isset($postdata['panodata'])) {
351
  }
352
 
353
  $scene_info = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
 
355
- $scene_info = array("type"=>$panoscenes["scene-type"],"panorama"=>$panoscenes["scene-attachment-url"],"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, "vaov"=>$scene_vaov, "haov"=>$scene_haov, "vOffset"=>$scene_vertical_offset, "hotSpots"=>$hotspots);
356
 
357
  if (isset($panoscenes["ptyscene"])) {
358
  if ($panoscenes["ptyscene"] == "off") {
@@ -511,8 +529,15 @@ var scenes = response[1];
511
  }
512
  if (scenes) {
513
  jQuery('.scene-gallery').empty();
 
514
  jQuery.each(scenes.scenes, function (key, val) {
515
- jQuery('.scene-gallery').append('<ul style="width:150px;"><li class="owlscene owl'+key+'">'+key+'</li><li title="Double click to view scene"><img class="scctrl" id="'+key+'_gallery" src="'+val.panorama+'"></li></ul>');
 
 
 
 
 
 
516
  });
517
  }
518
 
351
  }
352
 
353
  $scene_info = array();
354
+
355
+
356
+ if ($panoscenes["scene-type"] == 'cubemap') {
357
+ $pano_type = 'cubemap';
358
+ $pano_attachment = array(
359
+ $panoscenes["scene-attachment-url-face0"],
360
+ $panoscenes["scene-attachment-url-face1"],
361
+ $panoscenes["scene-attachment-url-face2"],
362
+ $panoscenes["scene-attachment-url-face3"],
363
+ $panoscenes["scene-attachment-url-face4"],
364
+ $panoscenes["scene-attachment-url-face5"]
365
+ );
366
+
367
+ $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, "vaov"=>$scene_vaov, "haov"=>$scene_haov, "vOffset"=>$scene_vertical_offset, "hotSpots"=>$hotspots);
368
+ }
369
+ else {
370
+ $scene_info = array("type"=>$panoscenes["scene-type"],"panorama"=>$panoscenes["scene-attachment-url"],"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, "vaov"=>$scene_vaov, "haov"=>$scene_haov, "vOffset"=>$scene_vertical_offset, "hotSpots"=>$hotspots);
371
+ }
372
 
373
+
374
 
375
  if (isset($panoscenes["ptyscene"])) {
376
  if ($panoscenes["ptyscene"] == "off") {
529
  }
530
  if (scenes) {
531
  jQuery('.scene-gallery').empty();
532
+
533
  jQuery.each(scenes.scenes, function (key, val) {
534
+ if (val.type == 'cubemap') {
535
+ var img_data = val.cubeMap[0];
536
+ }
537
+ else {
538
+ var img_data = val.panorama;
539
+ }
540
+ jQuery('.scene-gallery').append('<ul style="width:150px;"><li class="owlscene owl'+key+'">'+key+'</li><li title="Double click to view scene"><img class="scctrl" id="'+key+'_gallery" src="'+img_data+'"></li></ul>');
541
  });
542
  }
543
 
admin/partials/wpvr_documentation.php CHANGED
@@ -506,6 +506,8 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
506
  $mobile_media_resize = get_option('mobile_media_resize');
507
  $wpvr_script_control = get_option('wpvr_script_control');
508
  $wpvr_script_list = get_option('wpvr_script_list');
 
 
509
  $high_res_image = get_option('high_res_image');
510
  $enable_woocommerce = get_option('wpvr_enable_woocommerce', false);
511
 
@@ -685,6 +687,59 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
685
  <textarea id="wpvr_script_list" class="materialize-textarea" placeholder="https://example.com/tour1/,https://example.com/tour2/"><?php echo $wpvr_script_list; ?></textarea>
686
  </li>
687
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
688
  <!-- WPVR front-end notice -->
689
  <li class="enqueue-script front-notice">
690
  <?php
@@ -728,8 +783,9 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
728
  <form class="wpvr-version">
729
  <h6><?php _e('Select a Version to Rollback','wpvr'); ?></h6>
730
  <select name="wpvr_version">
731
- <option value="7.2.9">7.3.1</option>
732
- <option value="7.2.9">7.3.0</option>
 
733
  <option value="7.2.9">7.2.9</option>
734
  <option value="7.2.8">7.2.8</option>
735
  <option value="7.2.7">7.2.7</option>
506
  $mobile_media_resize = get_option('mobile_media_resize');
507
  $wpvr_script_control = get_option('wpvr_script_control');
508
  $wpvr_script_list = get_option('wpvr_script_list');
509
+ $wpvr_video_script_control = get_option('wpvr_video_script_control');
510
+ $wpvr_video_script_list = get_option('wpvr_video_script_list');
511
  $high_res_image = get_option('high_res_image');
512
  $enable_woocommerce = get_option('wpvr_enable_woocommerce', false);
513
 
687
  <textarea id="wpvr_script_list" class="materialize-textarea" placeholder="https://example.com/tour1/,https://example.com/tour2/"><?php echo $wpvr_script_list; ?></textarea>
688
  </li>
689
 
690
+
691
+
692
+
693
+
694
+
695
+
696
+ <li>
697
+
698
+ <h6><?php echo __( "Enable Video JS control (It will load the WP VR Video JS library in the listed pages only):", "wpvr" ); ?></h6>
699
+
700
+ <span class="wpvr-switcher">
701
+ <?php
702
+ if ($wpvr_video_script_control == "true") {
703
+ ?>
704
+ <input id="wpvr_video_script_control" type="checkbox" checked>
705
+ <?php
706
+ }
707
+ else {
708
+ ?>
709
+ <input id="wpvr_video_script_control" type="checkbox">
710
+ <?php
711
+ }
712
+ ?>
713
+ <label for="wpvr_video_script_control"></label>
714
+ </span>
715
+
716
+ <span class="wpvr-tooltip">
717
+ <span class="icon">
718
+ <img src="<?php echo WPVR_PLUGIN_DIR_URL . 'admin/icon/question-icon.png'?>" alt="check">
719
+ </span>
720
+ <p><?php echo __( "WP VR assets will be loaded on your allowed pages only. If you turn this on, you have to list the URL's of the pages with virtual tours on the 'List of allowed pages to load WP VR scripts' option", 'wpvr' ); ?></p>
721
+ </span>
722
+ </li>
723
+
724
+ <li class="enqueue-video-script wpvr_enqueue_video_script_list">
725
+ <h6><?php echo __( 'List of allowed pages to load WP VR Video JS library (The URLs of the pages on your site, You want to load Video JS):', 'wpvr' ); ?> </h6>
726
+
727
+ <span class="wpvr-tooltip">
728
+ <span class="icon">
729
+ <img src="<?php echo WPVR_PLUGIN_DIR_URL . 'admin/icon/question-icon.png'?>" alt="check">
730
+ </span>
731
+ <p><?php echo __( "List the pages like this: https://example.com/tour1/, https://example.com/tour2/", 'wpvr' ); ?></p>
732
+ </span>
733
+
734
+ <textarea id="wpvr_video_script_list" class="materialize-textarea" placeholder="https://example.com/video-tour1/,https://example.com/video-tour2/"><?php echo $wpvr_video_script_list; ?></textarea>
735
+ </li>
736
+
737
+
738
+
739
+
740
+
741
+
742
+
743
  <!-- WPVR front-end notice -->
744
  <li class="enqueue-script front-notice">
745
  <?php
783
  <form class="wpvr-version">
784
  <h6><?php _e('Select a Version to Rollback','wpvr'); ?></h6>
785
  <select name="wpvr_version">
786
+ <option value="7.3.2">7.3.2</option>
787
+ <option value="7.3.1">7.3.1</option>
788
+ <option value="7.3.0">7.3.0</option>
789
  <option value="7.2.9">7.2.9</option>
790
  <option value="7.2.8">7.2.8</option>
791
  <option value="7.2.7">7.2.7</option>
public/class-wpvr-public.php CHANGED
@@ -149,6 +149,15 @@ class Wpvr_Public
149
  foreach ($allowed_pages as $value) {
150
  $allowed_pages_modified[] = untrailingslashit($value);
151
  }
 
 
 
 
 
 
 
 
 
152
  $current_url = home_url(add_query_arg(array($_GET), $wp->request));
153
 
154
  if ($wpvr_script_control == 'true') {
@@ -180,6 +189,19 @@ class Wpvr_Public
180
  'notice' => $notice ,
181
  ));
182
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  }
184
 
185
  /**
@@ -654,7 +676,22 @@ class Wpvr_Public
654
 
655
  $scene_info = array();
656
 
657
- $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);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
658
 
659
  if (isset($panoscenes["ptyscene"])) {
660
  if ($panoscenes["ptyscene"] == "off") {
@@ -733,7 +770,6 @@ class Wpvr_Public
733
  $pano_id_array = array("panoid"=>$panoid);
734
  $pano_response = array();
735
  $pano_response = array("autoLoad"=>$autoload,"showControls"=>$control,"orientationSupport"=>'false',"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);
736
-
737
  if (empty($autorotation)) {
738
  unset($pano_response['autoRotate']);
739
  unset($pano_response['autoRotateInactivityDelay']);
@@ -835,9 +871,9 @@ class Wpvr_Public
835
  }
836
  }
837
  } elseif ($width == 'embed') {
838
- if (apply_filters('is_wpvr_embed_addon_premium', false)) {
839
  $html .= '<div id="pano'.$id.'" class="pano-wrap vrembed" style=" text-align:center; direction:ltr;" >';
840
- }
841
  } else {
842
  if ($radius) {
843
  $html .= '<div id="pano'.$id.'" class="pano-wrap" style=" text-align:center; max-width:100%; width: '.$width.'; height: '.$height.'; margin: 0 auto; border-radius:'.$radius.'; direction:ltr;">';
@@ -867,19 +903,47 @@ class Wpvr_Public
867
  //===company logo ends===//
868
 
869
  //===Background Tour===//
870
- // if(is_plugin_active( "wpvr-embed-addon/wpvr-embed-addon.php" )){
871
- // $html .= '
872
-
873
- // <div class="wpvr-topnav">
874
- // <a class="active" href="#home">Home</a>
875
- // <a href="#news">News</a>
876
- // <a href="#contact">Contact</a>
877
- // <a href="#about">About</a>
878
- // </div>
879
-
880
- // ';
881
- // $html .= '<div class="wpvr-home-text">Welcome to WordPress</div>';
882
- // }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
883
  //===Background Tour End===//
884
 
885
  //===Custom Control===//
@@ -951,7 +1015,12 @@ class Wpvr_Public
951
  } else {
952
  $scene_key_title = "";
953
  }
954
- $img_src_url = $panoscenes['scene-attachment-url'];
 
 
 
 
 
955
  $src_to_id = attachment_url_to_postid($img_src_url);
956
  $thumbnail_array = wp_get_attachment_image_src($src_to_id, 'thumbnail');
957
  if ($thumbnail_array) {
149
  foreach ($allowed_pages as $value) {
150
  $allowed_pages_modified[] = untrailingslashit($value);
151
  }
152
+
153
+ $wpvr_video_script_control = get_option('wpvr_video_script_control');
154
+ $wpvr_video_script_list = get_option('wpvr_video_script_list');
155
+ $allowed_video_pages_modified = array();
156
+ $allowed_video_pages = explode(",", $wpvr_video_script_list);
157
+ foreach ($allowed_video_pages as $value) {
158
+ $allowed_video_pages_modified[] = untrailingslashit($value);
159
+ }
160
+
161
  $current_url = home_url(add_query_arg(array($_GET), $wp->request));
162
 
163
  if ($wpvr_script_control == 'true') {
189
  'notice' => $notice ,
190
  ));
191
  }
192
+
193
+ $match_found = false;
194
+ if ($wpvr_video_script_control == 'true') {
195
+ foreach ($allowed_video_pages_modified as $value) {
196
+ if (strpos($current_url, $value) !== false) {
197
+ $match_found = true;
198
+ wp_enqueue_script('videojs-js', plugin_dir_url(__FILE__) . 'js/video.js', array(), true);
199
+ }
200
+ }
201
+ if(!$match_found) {
202
+ wp_dequeue_script( 'videojs-js' );
203
+ }
204
+ }
205
  }
206
 
207
  /**
676
 
677
  $scene_info = array();
678
 
679
+ if ($panoscenes["scene-type"] == 'cubemap') {
680
+ $pano_attachment = array(
681
+ $panoscenes["scene-attachment-url-face0"],
682
+ $panoscenes["scene-attachment-url-face1"],
683
+ $panoscenes["scene-attachment-url-face2"],
684
+ $panoscenes["scene-attachment-url-face3"],
685
+ $panoscenes["scene-attachment-url-face4"],
686
+ $panoscenes["scene-attachment-url-face5"]
687
+ );
688
+
689
+ $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);
690
+ }
691
+ else {
692
+ $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);
693
+ }
694
+
695
 
696
  if (isset($panoscenes["ptyscene"])) {
697
  if ($panoscenes["ptyscene"] == "off") {
770
  $pano_id_array = array("panoid"=>$panoid);
771
  $pano_response = array();
772
  $pano_response = array("autoLoad"=>$autoload,"showControls"=>$control,"orientationSupport"=>'false',"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);
 
773
  if (empty($autorotation)) {
774
  unset($pano_response['autoRotate']);
775
  unset($pano_response['autoRotateInactivityDelay']);
871
  }
872
  }
873
  } elseif ($width == 'embed') {
874
+ // if (apply_filters('is_wpvr_embed_addon_premium', false)) {
875
  $html .= '<div id="pano'.$id.'" class="pano-wrap vrembed" style=" text-align:center; direction:ltr;" >';
876
+ // }
877
  } else {
878
  if ($radius) {
879
  $html .= '<div id="pano'.$id.'" class="pano-wrap" style=" text-align:center; max-width:100%; width: '.$width.'; height: '.$height.'; margin: 0 auto; border-radius:'.$radius.'; direction:ltr;">';
903
  //===company logo ends===//
904
 
905
  //===Background Tour===//
906
+ if(isset($postdata['bg_tour_enabler'])) {
907
+
908
+ $bg_tour_enabler = $postdata['bg_tour_enabler'];
909
+ if($bg_tour_enabler == 'on') {
910
+ $bg_tour_navmenu = $postdata['bg_tour_navmenu'];
911
+ $bg_tour_title = $postdata['bg_tour_title'];
912
+ $bg_tour_subtitle = $postdata['bg_tour_subtitle'];
913
+
914
+ if($bg_tour_navmenu == 'on') {
915
+ $menuLocations = get_nav_menu_locations();
916
+ if( !empty( $menuLocations['primary'] ) ){
917
+ $menuID = $menuLocations['primary'];
918
+ $primaryNav = wp_get_nav_menu_items($menuID);
919
+ $html .= '<ul class="wpvr-navbar-container">';
920
+ foreach ($primaryNav as $primaryNav_key => $primaryNav_value) {
921
+ if($primaryNav_value->menu_item_parent == "0") {
922
+ $html .= '<li>';
923
+ $html .= '<a href="'.$primaryNav_value->url.'">'.$primaryNav_value->title.'</a>';
924
+ $html .= '<ul class="wpvr-navbar-dropdown">';
925
+ foreach ($primaryNav as $pm_key => $pm_value) {
926
+ if($pm_value->menu_item_parent == $primaryNav_value->ID) {
927
+ $html .= '<li>';
928
+ $html .= '<a href="'.$pm_value->url.'">'.$pm_value->title.'</a>';
929
+ $html .= '</li>';
930
+ }
931
+ }
932
+ $html .= '</ul>';
933
+ $html .= '</li>';
934
+ }
935
+ }
936
+ $html .= '</ul>';
937
+ }
938
+
939
+ }
940
+
941
+ $html .= '<div class="wpvr-home-content">';
942
+ $html .= '<div class="wpvr-home-title">'.$bg_tour_title.'</div>';
943
+ $html .= '<div class="wpvr-home-subtitle">'.$bg_tour_subtitle.'</div>';
944
+ $html .= '</div>';
945
+ }
946
+ }
947
  //===Background Tour End===//
948
 
949
  //===Custom Control===//
1015
  } else {
1016
  $scene_key_title = "";
1017
  }
1018
+ if ($panoscenes['scene-type'] == 'cubemap') {
1019
+ $img_src_url = $panoscenes['scene-attachment-url-face0'];
1020
+ }
1021
+ else {
1022
+ $img_src_url = $panoscenes['scene-attachment-url'];
1023
+ }
1024
  $src_to_id = attachment_url_to_postid($img_src_url);
1025
  $thumbnail_array = wp_get_attachment_image_src($src_to_id, 'thumbnail');
1026
  if ($thumbnail_array) {
public/css/wpvr-public.css CHANGED
@@ -3,15 +3,79 @@
3
  * included in this file.
4
  */
5
 
6
- .wpvr-home-text {
7
- position: absolute;
8
- bottom: 340px;
9
- color: #fff;
10
- font-size: 60px;
11
- z-index: 2;
12
- text-align: center;
13
- width: 100%;
14
- padding-bottom: 3px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  }
16
 
17
  .wpvr-topnav {
@@ -572,6 +636,15 @@ div.custom-ifram {
572
 
573
 
574
  /* ---------responsive style--------- */
 
 
 
 
 
 
 
 
 
575
  @media (max-width: 1199px){
576
  .pnlm-container {
577
  width: 100%!important;
3
  * included in this file.
4
  */
5
 
6
+ .wpvr-navbar-container {
7
+ position: absolute;
8
+ top: 5px;
9
+ width: 100%;
10
+ display: flex;
11
+ padding: 10px;
12
+ list-style: none;
13
+ color: #fff;
14
+ justify-content: flex-end;
15
+ z-index: 9;
16
+ right: 0;
17
+ }
18
+
19
+ .wpvr-navbar-container > li {
20
+ margin: 10px;
21
+
22
+ }
23
+
24
+ .wpvr-navbar-container > li > a {
25
+ color: #fff;
26
+ text-decoration: none;
27
+ font-size: 16px;
28
+ }
29
+
30
+ .wpvr-navbar-dropdown {
31
+ list-style: none;
32
+ display: none;
33
+ position: absolute;
34
+ }
35
+
36
+ .wpvr-navbar-container > li:hover .wpvr-navbar-dropdown {
37
+ display: block;
38
+ margin-left: -50px;
39
+ }
40
+
41
+ .wpvr-navbar-dropdown > li > a {
42
+ text-decoration: none;
43
+ color: #fff;
44
+ }
45
+
46
+
47
+ .wpvr-home-content {
48
+ color: #fff;
49
+ position: absolute;
50
+ top: 50%;
51
+ left: 50%;
52
+ z-index: 9;
53
+ transform: translate(-50%, -50%);
54
+ width: 100%;
55
+ padding: 0 15px;
56
+ box-sizing: border-box;
57
+ }
58
+ .wpvr-home-content * {
59
+ box-sizing: border-box;
60
+ }
61
+
62
+ .wpvr-home-title {
63
+ font-size: calc(24px + (60 - 24) * ((100vw - 320px) / (1920 - 320)));
64
+ line-height: 1.2;
65
+ margin-bottom: 10px;
66
+ }
67
+ .wpvr-home-subtitle {
68
+ font-size: calc(18px + (28 - 18) * ((100vw - 320px) / (1920 - 320)));
69
+ line-height: 1.2;
70
+ }
71
+
72
+ @media only screen and (min-width: 1921px) {
73
+ .wpvr-home-title {
74
+ font-size: 60px;
75
+ }
76
+ .wpvr-home-subtitle {
77
+ font-size: 18px;
78
+ }
79
  }
80
 
81
  .wpvr-topnav {
636
 
637
 
638
  /* ---------responsive style--------- */
639
+ @media only screen and (min-width: 1921px) {
640
+ .wpvr-home-title {
641
+ font-size: 70px;
642
+ }
643
+ .wpvr-home-subtitle {
644
+ font-size: 30px;
645
+ }
646
+ }
647
+
648
  @media (max-width: 1199px){
649
  .pnlm-container {
650
  width: 100%!important;
wpvr.php CHANGED
@@ -16,7 +16,7 @@
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: 7.3.2
20
  * Author: Rextheme
21
  * Author URI: http://rextheme.com/
22
  * License: GPL-2.0+
@@ -35,11 +35,11 @@ require plugin_dir_path(__FILE__) . 'elementor/elementor.php';
35
  * Start at version 1.0.0 and use SemVer - https://semver.org
36
  * Rename this for your plugin and update it as you release new versions.
37
  */
38
- define('WPVR', '7.3.0');
39
  define('WPVR_FILE', __FILE__);
40
  define("WPVR_PLUGIN_DIR_URL", plugin_dir_url(__FILE__));
41
  define("WPVR_PLUGIN_DIR_PATH", plugin_dir_path(__FILE__));
42
- define("WPVR_PLUGIN_PUBLIC_DIR_URL", plugin_dir_url(__FILE__) .'public/');
43
  define('WPVR_BASE', plugin_basename(WPVR_FILE));
44
 
45
  /**
@@ -106,15 +106,15 @@ function wpvr_in_array_r($needle, $haystack, $strict = false)
106
  */
107
  function appsero_init_tracker_wpvr()
108
  {
109
- if (! class_exists('Appsero\Client')) {
110
  require_once __DIR__ . '/appsero/src/Client.php';
111
  }
112
 
113
  if (class_exists('Appsero\Client')) {
114
  $client = new Appsero\Client('cab9761e-b067-4824-9c71-042df5d58598', 'WP VR', __FILE__);
115
  $client->insights()->init();
116
- if (method_exists($client,'updater')) {
117
- $client->updater();
118
  }
119
  }
120
  }
@@ -126,7 +126,7 @@ function wpvr_block()
126
  wp_register_script(
127
  'wpvr-block',
128
  plugins_url('build/index.build.js', __FILE__),
129
- array( 'wp-blocks', 'wp-element', 'wp-components', 'wp-editor' )
130
  );
131
  wp_enqueue_style(
132
  'gutyblocks/guty-block',
@@ -136,32 +136,32 @@ function wpvr_block()
136
 
137
  if (function_exists('register_block_type')) {
138
  register_block_type('wpvr/wpvr-block', array(
139
- 'attributes' => array(
140
- 'id' => array(
141
- 'type' => 'string',
142
- 'default' => '0',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  ),
144
- 'width' => array(
145
- 'type' => 'string',
146
- 'default' => '600',
147
- ),
148
- 'height' => array(
149
- 'type' => 'string',
150
- 'default' => '400',
151
- ),
152
- 'radius' => array(
153
- 'type' => 'string',
154
- 'default' => '0',
155
- ),
156
- 'content' => array(
157
- 'type' => 'string',
158
- 'source'=> 'html',
159
- 'default'=> '<script> </script>'
160
- ),
161
- ),
162
- 'editor_script' => 'wpvr-block',
163
- 'render_callback' => 'wpvr_block_render',
164
- ));
165
  }
166
  }
167
 
@@ -181,11 +181,11 @@ function wpvr_block_render($attributes)
181
  $height = $attributes['height'];
182
  }
183
  if (isset($attributes['radius'])) {
184
- $radius = $attributes['radius'].'px';
185
  }
186
 
187
  $postdata = get_post_meta($id, 'panodata', true);
188
- $panoid = 'pano'.$id;
189
 
190
  if (isset($postdata['streetviewdata'])) {
191
  if (empty($width)) {
@@ -196,8 +196,8 @@ function wpvr_block_render($attributes)
196
  }
197
  $streetviewurl = $postdata['streetviewurl'];
198
  $html = '';
199
- $html .= '<div class="vr-streetview" style="text-align: center; max-width:100%; width:'.$width.'px; height:'.$height.'px; margin: 0 auto;">';
200
- $html .= '<iframe src="'.$streetviewurl.'" frameborder="0" style="border:0; width:100px; height:100%;" allowfullscreen=""></iframe>';
201
  $html .= '</div>';
202
 
203
 
@@ -243,11 +243,11 @@ function wpvr_block_render($attributes)
243
  $loop = '';
244
  }
245
 
246
- $foundid = $explodeid[1].'?'.$autoplay.$loop;
247
  $html = '';
248
- $html .= '<div style="text-align:center; max-width:100%; width:'.$width.'px; height:'.$height.'px; margin: 0 auto;">';
249
  $html .= '
250
- <iframe src="https://www.youtube.com/embed/'.$explodeid[1].'?rel=0&modestbranding=1'.$loop.'&autohide=1'.$muted.'&showinfo=0&controls=1'.$autoplay.'" width="560" height="315" frameborder="0" allowfullscreen></iframe>
251
  ';
252
  $html .= '</div>';
253
  } elseif (strpos($videourl, 'vimeo') > 0) {
@@ -267,17 +267,17 @@ function wpvr_block_render($attributes)
267
  $loop = '';
268
  }
269
 
270
- $foundid = $explodeid[3].'?'.$autoplay.$loop;
271
  $html = '';
272
- $html .= '<div style="text-align:center; max-width:100%; width:'.$width.'px; height:'.$height.'px; margin: 0 auto;">';
273
- $html .= '<iframe src="https://player.vimeo.com/video/'.$foundid.'" width="'.$width.'" height="'.$height.'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
274
- $html .='</div>';
275
  } else {
276
  $html = '';
277
- $html .= '<div id="pano'.$id.'" class="pano-wrap" style="max-width:100%; width:'.$width.'px; height: '.$height.'px; margin: 0 auto;">';
278
- $html .= '<div style="width:100%; height:100%; ">'.$postdata['panoviddata'].'</div>';
279
  $html .= '<script>';
280
- $html .= 'videojs('.$postdata['vidid'].', {';
281
  $html .= 'plugins: {';
282
  $html .= 'pannellum: {}';
283
  $html .= '}';
@@ -412,7 +412,7 @@ function wpvr_block_render($attributes)
412
  $hotspoticoncolor = '#00b4ff';
413
  $hotspotblink = 'on';
414
  $default_data = array();
415
- $default_data = array('firstScene'=>$default_scene, 'sceneFadeDuration'=>$scene_fade_duration,'hfov'=>$default_zoom_global,'maxHfov'=>$max_zoom_global,'minHfov'=>$min_zoom_global );
416
  $scene_data = array();
417
 
418
  if (!empty($panodata['scene-list'])) {
@@ -483,29 +483,29 @@ function wpvr_block_render($attributes)
483
  $default_zoom = 100;
484
  if (isset($panoscenes["scene-zoom"]) && $panoscenes["scene-zoom"] != '') {
485
  $default_zoom = (int)$panoscenes["scene-zoom"];
486
- }else{
487
- if( $default_zoom_global != ''){
488
  $default_zoom = (int)$default_zoom_global;
489
- }
490
  }
491
 
492
 
493
  $max_zoom = 120;
494
  if (isset($panoscenes["scene-maxzoom"]) && $panoscenes["scene-maxzoom"] != '') {
495
  $max_zoom = (int)$panoscenes["scene-maxzoom"];
496
- }else{
497
- if( $max_zoom_global != ''){
498
  $max_zoom = (int)$max_zoom_global;
499
- }
500
  }
501
 
502
  $min_zoom = 120;
503
  if (isset($panoscenes["scene-minzoom"]) && $panoscenes["scene-minzoom"] != '') {
504
  $min_zoom = (int)$panoscenes["scene-minzoom"];
505
- }else{
506
- if( $min_zoom_global != ''){
507
  $min_zoom = (int)$min_zoom_global;
508
- }
509
  }
510
 
511
  $hotspot_datas = array();
@@ -547,18 +547,19 @@ function wpvr_block_render($attributes)
547
  }
548
 
549
  $hotspot_info = array(
550
- 'text'=>$hotspot_data['hotspot-title'],
551
- 'pitch'=>$hotspot_data['hotspot-pitch'],
552
- 'yaw'=>$hotspot_data['hotspot-yaw'],
553
- 'type'=>$hotspot_type,
554
- 'cssClass'=>$hotspot_data['hotspot-customclass'],
555
- 'URL'=>$hotspot_data['hotspot-url'],
556
- "clickHandlerArgs"=>$hotspot_content,
557
- 'createTooltipArgs'=>$hotspot_data['hotspot-hover'],
558
- "sceneId"=>$hotspot_data["hotspot-scene"],
559
- "targetPitch"=>(float)$hotspot_scene_pitch,
560
- "targetYaw"=>(float)$hotspot_scene_yaw,
561
- 'hotspot_type' => $hotspot_data['hotspot-type']);
 
562
 
563
  $hotspot_info['URL'] = ($hotspot_data['hotspot-type'] === 'fluent_form' || $hotspot_data['hotspot-type'] === 'wc_product') ? '' : $hotspot_info['URL'];
564
 
@@ -578,7 +579,7 @@ function wpvr_block_render($attributes)
578
  if ($mobile_media_resize == "true") {
579
  if ($file_accessible == "1") {
580
  $image_info = getimagesize($device_scene);
581
- if ( $image_info && $image_info[0] > 4096) {
582
  $src_to_id_for_mobile = '';
583
  $src_to_id_for_desktop = '';
584
  if (wpvr_isMobileDevice()) {
@@ -593,7 +594,7 @@ function wpvr_block_render($attributes)
593
  $src_to_id_for_desktop = attachment_url_to_postid($panoscenes['scene-attachment-url']);
594
  if ($src_to_id_for_desktop) {
595
  $desktop_scene = wp_get_attachment_image_src($src_to_id_for_mobile, 'full');
596
- if ( $desktop_scene && $desktop_scene[0] ) {
597
  $device_scene = $desktop_scene[0];
598
  }
599
  }
@@ -603,7 +604,25 @@ function wpvr_block_render($attributes)
603
  }
604
 
605
  $scene_info = array();
606
- $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);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
607
 
608
  if (isset($panoscenes["ptyscene"])) {
609
  if ($panoscenes["ptyscene"] == "off") {
@@ -672,17 +691,17 @@ function wpvr_block_render($attributes)
672
 
673
  $scene_array = array();
674
  $scene_array = array(
675
- $panoscenes['scene-id']=>$scene_info
676
  );
677
 
678
  $scene_data[$panoscenes['scene-id']] = $scene_info;
679
  }
680
  }
681
-
682
  $pano_id_array = array();
683
- $pano_id_array = array('panoid'=>$panoid);
684
  $pano_response = array();
685
- $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);
686
  if (empty($autorotation)) {
687
  unset($pano_response['autoRotate']);
688
  unset($pano_response['autoRotateInactivityDelay']);
@@ -696,7 +715,7 @@ function wpvr_block_render($attributes)
696
  }
697
 
698
  $response = array();
699
- $response = array($pano_id_array,$pano_response);
700
  if (!empty($response)) {
701
  $response = json_encode($response);
702
  }
@@ -726,35 +745,35 @@ function wpvr_block_render($attributes)
726
  overflow: hidden;
727
  }';
728
  }
729
- $html .= '#'.$panoid.' div.pnlm-hotspot-base.fas,
730
- #'.$panoid.' div.pnlm-hotspot-base.fab,
731
- #'.$panoid.' div.pnlm-hotspot-base.fa,
732
- #'.$panoid.' div.pnlm-hotspot-base.far {
733
  display: block !important;
734
- background-color: '.$hotspoticoncolor.';
735
- color: '.$foreground_color.';
736
  border-radius: 100%;
737
  width: 30px;
738
  height: 30px;
739
  font-size: 16px;
740
  line-height: 30px;
741
- animation: icon-pulse'.$panoid.' 1.5s infinite cubic-bezier(.25, 0, 0, 1);
742
  }';
743
  if ($hotspotblink == 'on') {
744
- $html .= '@-webkit-keyframes icon-pulse'.$panoid.' {
745
  0% {
746
- box-shadow: 0 0 0 0px rgba('.$pulse_color[0].', 1);
747
  }
748
  100% {
749
- box-shadow: 0 0 0 10px rgba('.$pulse_color[0].', 0);
750
  }
751
  }
752
- @keyframes icon-pulse'.$panoid.' {
753
  0% {
754
- box-shadow: 0 0 0 0px rgba('.$pulse_color[0].', 1);
755
  }
756
  100% {
757
- box-shadow: 0 0 0 10px rgba('.$pulse_color[0].', 0);
758
  }
759
  }';
760
  }
@@ -762,12 +781,12 @@ function wpvr_block_render($attributes)
762
  $status = get_option('wpvr_edd_license_status');
763
  if ($status !== false && $status == 'valid') {
764
  if (!$gyro) {
765
- $html .= '#'.$panoid.' div.pnlm-orientation-button {
766
  display: none;
767
  }';
768
  }
769
  } else {
770
- $html .= '#'.$panoid.' div.pnlm-orientation-button {
771
  display: none;
772
  }';
773
  }
@@ -776,12 +795,12 @@ function wpvr_block_render($attributes)
776
 
777
  if ($width == 'fullwidth') {
778
  if (wpvr_isMobileDevice()) {
779
- $html .= '<div id="pano'.$id.'" class="pano-wrap" style="text-align:center; border-radius:'.$radius.'; direction:ltr;" >';
780
  } else {
781
- $html .= '<div id="pano'.$id.'" class="pano-wrap vrfullwidth" style=" text-align:center; height: '.$height.'px; border-radius:'.$radius.'; direction:ltr;" >';
782
  }
783
  } else {
784
- $html .= '<div id="pano'.$id.'" class="pano-wrap" style=" text-align:center; max-width:100%; width: '.$width.'px; height: '.$height.'px; margin: 0 auto; border-radius:'.$radius.'; direction:ltr;">';
785
  }
786
 
787
  //===company logo===//
@@ -792,11 +811,11 @@ function wpvr_block_render($attributes)
792
  $html .= '<div id="cp-logo-controls">';
793
  $html .= '<div class="cp-logo-ctrl" id="cp-logo">';
794
  if ($cpLogoImg) {
795
- $html .= '<img src="'.$cpLogoImg.'" alt="Company Logo">';
796
  }
797
 
798
  if ($cpLogoContent) {
799
- $html .= '<div class="cp-info">'.$cpLogoContent.'</div>';
800
  }
801
  $html .= '</div>';
802
  $html .= '</div>';
@@ -804,25 +823,70 @@ function wpvr_block_render($attributes)
804
  }
805
  //===company logo ends===//
806
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
807
  //===Custom Control===//
808
  if (isset($custom_control)) {
809
  if ($custom_control['panZoomInSwitch'] == "on" || $custom_control['panZoomOutSwitch'] == "on" || $custom_control['gyroscopeSwitch'] == "on" || $custom_control['backToHomeSwitch'] == "on") {
810
- $html .= '<div id="zoom-in-out-controls'.$id.'" class="zoom-in-out-controls">';
811
 
812
  if ($custom_control['backToHomeSwitch'] == "on") {
813
- $html .= '<div class="ctrl" id="backToHome'.$id.'"><i class="'.$custom_control['backToHomeIcon'].'" style="color:'.$custom_control['backToHomeColor'].';"></i></div>';
814
  }
815
 
816
  if ($custom_control['panZoomInSwitch'] == "on") {
817
- $html .= '<div class="ctrl" id="zoom-in'.$id.'"><i class="'.$custom_control['panZoomInIcon'].'" style="color:'.$custom_control['panZoomInColor'].';"></i></div>';
818
  }
819
 
820
  if ($custom_control['panZoomOutSwitch'] == "on") {
821
- $html .= '<div class="ctrl" id="zoom-out'.$id.'"><i class="'.$custom_control['panZoomOutIcon'].'" style="color:'.$custom_control['panZoomOutColor'].';"></i></div>';
822
  }
823
 
824
  if ($custom_control['gyroscopeSwitch'] == "on") {
825
- $html .= '<div class="ctrl" id="gyroscope'.$id.'"><i class="'.$custom_control['gyroscopeIcon'].'" style="color:'.$custom_control['gyroscopeColor'].';"></i></div>';
826
  }
827
 
828
  $html .= '</div>';
@@ -831,27 +895,27 @@ function wpvr_block_render($attributes)
831
 
832
  if ($custom_control['panupSwitch'] == "on" || $custom_control['panDownSwitch'] == "on" || $custom_control['panLeftSwitch'] == "on" || $custom_control['panRightSwitch'] == "on" || $custom_control['panFullscreenSwitch'] == "on") {
833
 
834
- //===Custom Control===//
835
- $html .= '<div class="controls" id="controls'.$id.'">';
836
 
837
  if ($custom_control['panupSwitch'] == "on") {
838
- $html .= '<div class="ctrl pan-up" id="pan-up'.$id.'"><i class="'.$custom_control['panupIcon'].'" style="color:'.$custom_control['panupColor'].';"></i></div>';
839
  }
840
 
841
  if ($custom_control['panDownSwitch'] == "on") {
842
- $html .= '<div class="ctrl pan-down" id="pan-down'.$id.'"><i class="'.$custom_control['panDownIcon'].'" style="color:'.$custom_control['panDownColor'].';"></i></div>';
843
  }
844
 
845
  if ($custom_control['panLeftSwitch'] == "on") {
846
- $html .= '<div class="ctrl pan-left" id="pan-left'.$id.'"><i class="'.$custom_control['panLeftIcon'].'" style="color:'.$custom_control['panLeftColor'].';"></i></div>';
847
  }
848
 
849
  if ($custom_control['panRightSwitch'] == "on") {
850
- $html .= '<div class="ctrl pan-right" id="pan-right'.$id.'"><i class="'.$custom_control['panRightIcon'].'" style="color:'.$custom_control['panRightColor'].';"></i></div>';
851
  }
852
 
853
  if ($custom_control['panFullscreenSwitch'] == "on") {
854
- $html .= '<div class="ctrl fullscreen" id="fullscreen'.$id.'"><i class="'.$custom_control['panFullscreenIcon'].'" style="color:'.$custom_control['panFullscreenColor'].';"></i></div>';
855
  }
856
  $html .= '</div>';
857
  }
@@ -860,23 +924,30 @@ function wpvr_block_render($attributes)
860
 
861
  if ($vrgallery) {
862
  //===Carousal setup===//
863
- $html .= '<div id="vrgcontrols'.$id.'" class="vrgcontrols">';
864
 
865
- $html .= '<div class="vrgctrl'.$id.' vrbounce">';
866
  $html .= '</div>';
867
  $html .= '</div>';
868
 
869
- $html .= '<div id="sccontrols'.$id.'" class="scene-gallery vrowl-carousel owl-theme">';
870
  if (isset($panodata["scene-list"])) {
871
  foreach ($panodata["scene-list"] as $panoscenes) {
872
  $scene_key = $panoscenes['scene-id'];
873
  if ($vrgallery_title == 'on') {
874
  $scene_key_title = $panoscenes['scene-ititle'];
875
- // $scene_key_title = $panoscenes['scene-id'];
876
  } else {
877
  $scene_key_title = "";
878
  }
879
- $img_src_url = $panoscenes['scene-attachment-url'];
 
 
 
 
 
 
 
880
 
881
  $src_to_id = attachment_url_to_postid($img_src_url);
882
  $thumbnail_array = wp_get_attachment_image_src($src_to_id, 'thumbnail');
@@ -886,7 +957,7 @@ function wpvr_block_render($attributes)
886
  $thumbnail = $img_src_url;
887
  }
888
 
889
- $html .= '<ul style="width:150px;"><li title="Double click to view scene">'.$scene_key_title.'<img class="scctrl" id="'.$scene_key.'_gallery_'.$id.'" src="'.$thumbnail.'"></li></ul>';
890
  }
891
  }
892
  $html .= '</div>';
@@ -904,12 +975,12 @@ function wpvr_block_render($attributes)
904
  }
905
 
906
  if ($bg_music == 'on') {
907
- $html .= '<div id="adcontrol'.$id.'" class="adcontrol" style="right:'.$audio_right.'">';
908
- $html .= '<audio class="vrAudioDefault" id="vrAudio'.$id.'" data-autoplay="'.$autoplay_bg_music.'" onended="audionEnd'.$id.'()" '.$bg_loop.'>
909
- <source src="'.$bg_music_url.'" type="audio/mpeg">
910
  Your browser does not support the audio element.
911
  </audio>
912
- <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>
913
  ';
914
  $html .= '</div>';
915
  }
@@ -917,7 +988,7 @@ function wpvr_block_render($attributes)
917
 
918
 
919
  $html .= '<div class="wpvr-hotspot-tweak-contents-wrapper" style="display: none">';
920
- $html .= '<i class="fa fa-times cross" data-id="'.$id.'"></i>';
921
  $html .= '<div class="wpvr-hotspot-tweak-contents-flex">';
922
  $html .= '<div class="wpvr-hotspot-tweak-contents">';
923
  ob_start();
@@ -929,7 +1000,7 @@ function wpvr_block_render($attributes)
929
  $html .= '</div>';
930
 
931
  $html .= '<div class="custom-ifram-wrapper" style="display: none;">';
932
- $html .= '<i class="fa fa-times cross" data-id="'.$id.'"></i>';
933
  $html .= '<div class="custom-ifram-flex">';
934
  $html .= '<div class="custom-ifram">';
935
  $html .= '</div>';
@@ -943,51 +1014,51 @@ function wpvr_block_render($attributes)
943
  if (isset($postdata['bg_music'])) {
944
  if ($bg_music == 'on') {
945
  $html .= '
946
- var x'.$id.' = document.getElementById("vrAudio'.$id.'");
947
 
948
- var playing'.$id.' = false;
949
 
950
- function playPause'.$id.'() {
951
 
952
- if (playing'.$id.') {
953
- jQuery("#vr-volume'.$id.'").removeClass("fas fa-volume-up");
954
- jQuery("#vr-volume'.$id.'").addClass("fas fa-volume-mute");
955
- x'.$id.'.pause();
956
- jQuery("#audio_control'.$id.'").attr("data-play", "off");
957
- playing'.$id.' = false;
958
 
959
  }
960
  else {
961
- jQuery("#vr-volume'.$id.'").removeClass("fas fa-volume-mute");
962
- jQuery("#vr-volume'.$id.'").addClass("fas fa-volume-up");
963
- jQuery("#audio_control'.$id.'").attr("data-play", "on");
964
- x'.$id.'.play();
965
- playing'.$id.' = true;
966
  }
967
  }
968
 
969
- function audionEnd'.$id.'() {
970
- playing'.$id.' = false;
971
- jQuery("#vr-volume'.$id.'").removeClass("fas fa-volume-up");
972
- jQuery("#vr-volume'.$id.'").addClass("fas fa-volume-mute");
973
- jQuery("#audio_control'.$id.'").attr("data-play", "off");
974
  }
975
  ';
976
 
977
  if ($autoplay_bg_music == 'on') {
978
  $html .= '
979
- document.getElementById("pano'.$id.'").addEventListener("click", musicPlay'.$id.');
980
- function musicPlay'.$id.'() {
981
- playing'.$id.' = true;
982
- document.getElementById("vrAudio'.$id.'").play();
983
- document.getElementById("pano'.$id.'").removeEventListener("click", musicPlay'.$id.');
984
  }
985
  ';
986
  }
987
  }
988
  }
989
  $html .= 'jQuery(document).ready(function() {';
990
- $html .= 'var response = '.$response.';';
991
  $html .= 'var scenes = response[1];';
992
  $html .= 'if(scenes) {';
993
  $html .= 'var scenedata = scenes.scenes;';
@@ -1003,25 +1074,25 @@ function wpvr_block_render($attributes)
1003
  $html .= '}';
1004
  $html .= '}';
1005
  $html .= '}';
1006
- $html .= 'var panoshow'.$id.' = pannellum.viewer(response[0]["panoid"], scenes);';
1007
 
1008
- $html .= 'panoshow'.$id.'.on("load", function (){
1009
- if (jQuery("#pano'.$id.'").children().children(".pnlm-panorama-info:visible").length > 0) {
1010
- jQuery("#controls'.$id.'").css("bottom", "55px");
1011
  }
1012
  else {
1013
- jQuery("#controls'.$id.'").css("bottom", "5px");
1014
  }
1015
  });';
1016
 
1017
 
1018
  $html .= '
1019
  if (scenes.autoRotate) {
1020
- panoshow'.$id.'.on("load", function (){
1021
- setTimeout(function(){ panoshow'.$id.'.startAutoRotate(scenes.autoRotate, 0); }, 3000);
1022
  });
1023
- panoshow'.$id.'.on("scenechange", function (){
1024
- setTimeout(function(){ panoshow'.$id.'.startAutoRotate(scenes.autoRotate, 0); }, 3000);
1025
  });
1026
  }
1027
  ';
@@ -1030,14 +1101,14 @@ function wpvr_block_render($attributes)
1030
  if (isset($panodata["scene-list"])) {
1031
  foreach ($panodata["scene-list"] as $panoscenes) {
1032
  $scene_key = $panoscenes['scene-id'];
1033
- $scene_key_gallery = $panoscenes['scene-id'].'_gallery_'.$id;
1034
  $img_src_url = $panoscenes['scene-attachment-url'];
1035
- $html .= 'document.getElementById("'.$scene_key_gallery.'").addEventListener("click", function(e) { ';
1036
  $html .= 'if (touchtime == 0) {';
1037
  $html .= 'touchtime = new Date().getTime();';
1038
  $html .= '} else {';
1039
  $html .= 'if (((new Date().getTime()) - touchtime) < 800) {';
1040
- $html .= 'panoshow'.$id.'.loadScene("'.$scene_key.'");';
1041
  $html .= 'touchtime = 0;';
1042
  $html .= '} else {';
1043
  $html .= 'touchtime = new Date().getTime();';
@@ -1051,61 +1122,61 @@ function wpvr_block_render($attributes)
1051
  //===Custom Control===//
1052
  if (isset($custom_control)) {
1053
  if ($custom_control['panupSwitch'] == "on") {
1054
- $html .= 'document.getElementById("pan-up'.$id.'").addEventListener("click", function(e) {';
1055
- $html .= 'panoshow'.$id.'.setPitch(panoshow'.$id.'.getPitch() + 10);';
1056
  $html .= '});';
1057
  }
1058
 
1059
  if ($custom_control['panDownSwitch'] == "on") {
1060
- $html .= 'document.getElementById("pan-down'.$id.'").addEventListener("click", function(e) {';
1061
- $html .= 'panoshow'.$id.'.setPitch(panoshow'.$id.'.getPitch() - 10);';
1062
  $html .= '});';
1063
  }
1064
 
1065
  if ($custom_control['panLeftSwitch'] == "on") {
1066
- $html .= 'document.getElementById("pan-left'.$id.'").addEventListener("click", function(e) {';
1067
- $html .= 'panoshow'.$id.'.setYaw(panoshow'.$id.'.getYaw() - 10);';
1068
  $html .= '});';
1069
  }
1070
 
1071
  if ($custom_control['panRightSwitch'] == "on") {
1072
- $html .= 'document.getElementById("pan-right'.$id.'").addEventListener("click", function(e) {';
1073
- $html .= 'panoshow'.$id.'.setYaw(panoshow'.$id.'.getYaw() + 10);';
1074
  $html .= '});';
1075
  }
1076
 
1077
  if ($custom_control['panZoomInSwitch'] == "on") {
1078
- $html .= 'document.getElementById("zoom-in'.$id.'").addEventListener("click", function(e) {';
1079
- $html .= 'panoshow'.$id.'.setHfov(panoshow'.$id.'.getHfov() - 10);';
1080
  $html .= '});';
1081
  }
1082
 
1083
  if ($custom_control['panZoomOutSwitch'] == "on") {
1084
- $html .= 'document.getElementById("zoom-out'.$id.'").addEventListener("click", function(e) {';
1085
- $html .= 'panoshow'.$id.'.setHfov(panoshow'.$id.'.getHfov() + 10);';
1086
  $html .= '});';
1087
  }
1088
 
1089
  if ($custom_control['panFullscreenSwitch'] == "on") {
1090
- $html .= 'document.getElementById("fullscreen'.$id.'").addEventListener("click", function(e) {';
1091
- $html .= 'panoshow'.$id.'.toggleFullscreen();';
1092
  $html .= '});';
1093
  }
1094
 
1095
  if ($custom_control['backToHomeSwitch'] == "on") {
1096
- $html .= 'document.getElementById("backToHome'.$id.'").addEventListener("click", function(e) {';
1097
- $html .= 'panoshow'.$id.'.loadScene("'.$default_scene.'");';
1098
  $html .= '});';
1099
  }
1100
 
1101
  if ($custom_control['gyroscopeSwitch'] == "on") {
1102
- $html .= 'document.getElementById("gyroscope'.$id.'").addEventListener("click", function(e) {';
1103
  $html .= '
1104
- if (panoshow'.$id.'.isOrientationActive()) {
1105
- panoshow'.$id.'.stopOrientation();
1106
  }
1107
  else {
1108
- panoshow'.$id.'.startOrientation();
1109
  }
1110
 
1111
  ';
@@ -1118,82 +1189,81 @@ function wpvr_block_render($attributes)
1118
  $sin_qout = "'";
1119
 
1120
  if ($vrgallery_display) {
1121
- if (!$autoload) {
1122
- $html .= '
1123
  jQuery(document).ready(function($){
1124
- jQuery("#sccontrols'.$id.'").hide();
1125
- jQuery(".vrgctrl'.$id.'").html('.$sin_qout.$angle_up.$sin_qout.');
1126
- jQuery("#sccontrols'.$id.'").hide();
1127
  });
1128
  ';
1129
 
1130
- $html .= '
1131
- var slide'.$id.' = "down";
1132
- jQuery(document).on("click","#vrgcontrols'.$id.'",function() {
1133
 
1134
- if (slide'.$id.' == "up") {
1135
- jQuery(".vrgctrl'.$id.'").empty();
1136
- jQuery(".vrgctrl'.$id.'").html('.$sin_qout.$angle_up.$sin_qout.');
1137
- slide'.$id.' = "down";
1138
  }
1139
  else {
1140
- jQuery(".vrgctrl'.$id.'").empty();
1141
- jQuery(".vrgctrl'.$id.'").html('.$sin_qout.$angle_down.$sin_qout.');
1142
- slide'.$id.' = "up";
1143
  }
1144
- jQuery("#sccontrols'.$id.'").slideToggle();
1145
  });
1146
  ';
1147
- }
1148
- else {
1149
- $html .= '
1150
  jQuery(document).ready(function($){
1151
- jQuery("#sccontrols'.$id.'").show();
1152
- jQuery(".vrgctrl'.$id.'").html('.$sin_qout.$angle_down.$sin_qout.');
1153
  });
1154
  ';
1155
 
1156
- $html .= '
1157
- var slide'.$id.' = "down";
1158
- jQuery(document).on("click","#vrgcontrols'.$id.'",function() {
1159
 
1160
- if (slide'.$id.' == "up") {
1161
- jQuery(".vrgctrl'.$id.'").empty();
1162
- jQuery(".vrgctrl'.$id.'").html('.$sin_qout.$angle_down.$sin_qout.');
1163
- slide'.$id.' = "down";
1164
  }
1165
  else {
1166
- jQuery(".vrgctrl'.$id.'").empty();
1167
- jQuery(".vrgctrl'.$id.'").html('.$sin_qout.$angle_up.$sin_qout.');
1168
- slide'.$id.' = "up";
1169
  }
1170
- jQuery("#sccontrols'.$id.'").slideToggle();
1171
  });
1172
  ';
1173
- }
1174
  } else {
1175
  $html .= '
1176
  jQuery(document).ready(function($){
1177
- jQuery("#sccontrols'.$id.'").hide();
1178
- jQuery(".vrgctrl'.$id.'").html('.$sin_qout.$angle_up.$sin_qout.');
1179
  });
1180
  ';
1181
 
1182
  $html .= '
1183
- var slide'.$id.' = "down";
1184
- jQuery(document).on("click","#vrgcontrols'.$id.'",function() {
1185
 
1186
- if (slide'.$id.' == "up") {
1187
- jQuery(".vrgctrl'.$id.'").empty();
1188
- jQuery(".vrgctrl'.$id.'").html('.$sin_qout.$angle_up.$sin_qout.');
1189
- slide'.$id.' = "down";
1190
  }
1191
  else {
1192
- jQuery(".vrgctrl'.$id.'").empty();
1193
- jQuery(".vrgctrl'.$id.'").html('.$sin_qout.$angle_down.$sin_qout.');
1194
- slide'.$id.' = "up";
1195
  }
1196
- jQuery("#sccontrols'.$id.'").slideToggle();
1197
  });
1198
  ';
1199
  }
@@ -1202,38 +1272,38 @@ function wpvr_block_render($attributes)
1202
  $html .= '
1203
 
1204
  jQuery(document).ready(function(){
1205
- jQuery("#controls'.$id.'").hide();
1206
- jQuery("#zoom-in-out-controls'.$id.'").hide();
1207
- jQuery("#adcontrol'.$id.'").hide();
1208
- jQuery("#pano'.$id.'").find(".pnlm-panorama-info").hide();
1209
  });
1210
 
1211
  ';
1212
 
1213
- if ($vrgallery_display) {
1214
  $html .= 'var load_once = "true";';
1215
- $html .= 'panoshow'.$id.'.on("load", function (){
1216
  if (load_once == "true") {
1217
  load_once = "false";
1218
- jQuery("#sccontrols'.$id.'").slideToggle();
1219
  }
1220
  });';
1221
- }
1222
 
1223
- $html .= 'panoshow'.$id.'.on("load", function (){
1224
- jQuery("#controls'.$id.'").show();
1225
- jQuery("#zoom-in-out-controls'.$id.'").show();
1226
- jQuery("#adcontrol'.$id.'").show();
1227
- jQuery("#pano'.$id.'").find(".pnlm-panorama-info").show();
1228
  });';
1229
  }
1230
  if (isset($postdata['previewtext'])) {
1231
  $html .= '
1232
- jQuery("#pano'.$id.'").children(".pnlm-ui").find(".pnlm-load-button p").text("'.$postdata['previewtext'].'")
1233
  ';
1234
- }else{
1235
  $html .= '
1236
- jQuery("#pano'.$id.'").children(".pnlm-ui").find(".pnlm-load-button p").text("Click To Load Panorama")
1237
  ';
1238
  }
1239
  $html .= '});';
@@ -1249,16 +1319,16 @@ function wpvr_hex2rgb($colour)
1249
  $colour = substr($colour, 1);
1250
  }
1251
  if (strlen($colour) == 6) {
1252
- list($r, $g, $b) = array( $colour[0] . $colour[1], $colour[2] . $colour[3], $colour[4] . $colour[5] );
1253
  } elseif (strlen($colour) == 3) {
1254
- list($r, $g, $b) = array( $colour[0] . $colour[0], $colour[1] . $colour[1], $colour[2] . $colour[2] );
1255
  } else {
1256
  return false;
1257
  }
1258
  $r = hexdec($r);
1259
  $g = hexdec($g);
1260
  $b = hexdec($b);
1261
- return array( $r.', '.$g.', '.$b );
1262
  }
1263
 
1264
  function wpvr_HTMLToRGB($htmlCode)
@@ -1338,7 +1408,7 @@ function wpvr_rest_data_route()
1338
  'methods' => 'GET',
1339
  'callback' => 'wpvr_rest_data_set',
1340
  'permission_callback' => 'wpvr_rest_route_permission'
1341
- ));
1342
  }
1343
 
1344
  function wpvr_rest_route_permission()
@@ -1354,14 +1424,14 @@ function wpvr_rest_data_set()
1354
  ));
1355
 
1356
  $wpvr_list = array();
1357
- $list_none = array('value'=> 0,'label'=>'None');
1358
  array_push($wpvr_list, $list_none);
1359
  while ($query->have_posts()) {
1360
  $query->the_post();
1361
  $title = get_the_title();
1362
  $post_id = get_the_ID();
1363
- $title = $title.' : '.$post_id;
1364
- $list_ob = array('value'=>$post_id,'label'=>$title);
1365
  array_push($wpvr_list, $list_ob);
1366
  }
1367
  return $wpvr_list;
@@ -1377,7 +1447,7 @@ function wpvr_directory()
1377
  $upload = wp_upload_dir();
1378
  $upload_dir = $upload['basedir'];
1379
  $upload_dir_temp = $upload_dir . '/wpvr/temp/';
1380
- if (! is_dir($upload_dir_temp)) {
1381
  wp_mkdir_p($upload_dir_temp, 0700);
1382
  }
1383
  }
@@ -1386,7 +1456,7 @@ add_action('admin_init', 'wpvr_directory');
1386
  function wpvr_delete_temp_file()
1387
  {
1388
  $file_save_url = wp_upload_dir();
1389
- $rootPath = realpath($file_save_url['basedir'].'/wpvr/temp/');
1390
  $files = new RecursiveIteratorIterator(
1391
  new RecursiveDirectoryIterator($rootPath),
1392
  RecursiveIteratorIterator::LEAVES_ONLY
@@ -1473,46 +1543,46 @@ function wpvr_add_role_cap()
1473
  }
1474
  }
1475
 
1476
- add_action('admin_init', 'wpvr_add_role_cap', 999);
1477
-
1478
- function wpvr_role_management_from_post_type($args, $post_type)
1479
- {
1480
- if ('wpvr_item' !== $post_type) {
1481
- return $args;
1482
- }
1483
-
1484
- $editor_active = get_option('wpvr_editor_active');
1485
- $author_active = get_option('wpvr_author_active');
1486
- $user = wp_get_current_user();
1487
-
1488
- if ($editor_active == "true") {
1489
- if (in_array('editor', (array) $user->roles)) {
1490
- $args['show_in_menu'] = true;
1491
- }
1492
- }
1493
-
1494
- if ($author_active == "true") {
1495
- if (in_array('author', (array) $user->roles)) {
1496
- $args['show_in_menu'] = true;
1497
- }
1498
- }
1499
-
1500
- return $args;
1501
- }
1502
- add_filter('register_post_type_args', 'wpvr_role_management_from_post_type', 10, 2);
1503
-
1504
- function wpvr_cache_admin_notice()
1505
- {
1506
- $option = get_option('wpvr_warning');
1507
- if (!$option) {
1508
- ?>
1509
- <div class="notice notice-warning" id="wpvr-warning" style="position: relative;">
1510
- <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>
1511
- <button type="button" id="wpvr-dismissible" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>
1512
- </div>
1513
- <?php
1514
- }
1515
- }
1516
  // add_action('admin_notices', 'wpvr_cache_admin_notice');
1517
 
1518
  //===Oxygen widget===//
@@ -1531,9 +1601,9 @@ function wpvr_mobile_media_handle()
1531
 
1532
 
1533
  add_action(
1534
- /**
1535
- * @param $api \VisualComposer\Modules\Api\Factory
1536
- */
1537
  'vcv:api',
1538
  function ($api) {
1539
  $elementsToRegister = [
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: 7.3.3
20
  * Author: Rextheme
21
  * Author URI: http://rextheme.com/
22
  * License: GPL-2.0+
35
  * Start at version 1.0.0 and use SemVer - https://semver.org
36
  * Rename this for your plugin and update it as you release new versions.
37
  */
38
+ define('WPVR', '7.3.3');
39
  define('WPVR_FILE', __FILE__);
40
  define("WPVR_PLUGIN_DIR_URL", plugin_dir_url(__FILE__));
41
  define("WPVR_PLUGIN_DIR_PATH", plugin_dir_path(__FILE__));
42
+ define("WPVR_PLUGIN_PUBLIC_DIR_URL", plugin_dir_url(__FILE__) . 'public/');
43
  define('WPVR_BASE', plugin_basename(WPVR_FILE));
44
 
45
  /**
106
  */
107
  function appsero_init_tracker_wpvr()
108
  {
109
+ if (!class_exists('Appsero\Client')) {
110
  require_once __DIR__ . '/appsero/src/Client.php';
111
  }
112
 
113
  if (class_exists('Appsero\Client')) {
114
  $client = new Appsero\Client('cab9761e-b067-4824-9c71-042df5d58598', 'WP VR', __FILE__);
115
  $client->insights()->init();
116
+ if (method_exists($client, 'updater')) {
117
+ $client->updater();
118
  }
119
  }
120
  }
126
  wp_register_script(
127
  'wpvr-block',
128
  plugins_url('build/index.build.js', __FILE__),
129
+ array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
130
  );
131
  wp_enqueue_style(
132
  'gutyblocks/guty-block',
136
 
137
  if (function_exists('register_block_type')) {
138
  register_block_type('wpvr/wpvr-block', array(
139
+ 'attributes' => array(
140
+ 'id' => array(
141
+ 'type' => 'string',
142
+ 'default' => '0',
143
+ ),
144
+ 'width' => array(
145
+ 'type' => 'string',
146
+ 'default' => '600',
147
+ ),
148
+ 'height' => array(
149
+ 'type' => 'string',
150
+ 'default' => '400',
151
+ ),
152
+ 'radius' => array(
153
+ 'type' => 'string',
154
+ 'default' => '0',
155
+ ),
156
+ 'content' => array(
157
+ 'type' => 'string',
158
+ 'source' => 'html',
159
+ 'default' => '<script> </script>'
160
+ ),
161
  ),
162
+ 'editor_script' => 'wpvr-block',
163
+ 'render_callback' => 'wpvr_block_render',
164
+ ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  }
166
  }
167
 
181
  $height = $attributes['height'];
182
  }
183
  if (isset($attributes['radius'])) {
184
+ $radius = $attributes['radius'] . 'px';
185
  }
186
 
187
  $postdata = get_post_meta($id, 'panodata', true);
188
+ $panoid = 'pano' . $id;
189
 
190
  if (isset($postdata['streetviewdata'])) {
191
  if (empty($width)) {
196
  }
197
  $streetviewurl = $postdata['streetviewurl'];
198
  $html = '';
199
+ $html .= '<div class="vr-streetview" style="text-align: center; max-width:100%; width:' . $width . 'px; height:' . $height . 'px; margin: 0 auto;">';
200
+ $html .= '<iframe src="' . $streetviewurl . '" frameborder="0" style="border:0; width:100px; height:100%;" allowfullscreen=""></iframe>';
201
  $html .= '</div>';
202
 
203
 
243
  $loop = '';
244
  }
245
 
246
+ $foundid = $explodeid[1] . '?' . $autoplay . $loop;
247
  $html = '';
248
+ $html .= '<div style="text-align:center; max-width:100%; width:' . $width . 'px; height:' . $height . 'px; margin: 0 auto;">';
249
  $html .= '
250
+ <iframe src="https://www.youtube.com/embed/' . $explodeid[1] . '?rel=0&modestbranding=1' . $loop . '&autohide=1' . $muted . '&showinfo=0&controls=1' . $autoplay . '" width="560" height="315" frameborder="0" allowfullscreen></iframe>
251
  ';
252
  $html .= '</div>';
253
  } elseif (strpos($videourl, 'vimeo') > 0) {
267
  $loop = '';
268
  }
269
 
270
+ $foundid = $explodeid[3] . '?' . $autoplay . $loop;
271
  $html = '';
272
+ $html .= '<div style="text-align:center; max-width:100%; width:' . $width . 'px; height:' . $height . 'px; margin: 0 auto;">';
273
+ $html .= '<iframe src="https://player.vimeo.com/video/' . $foundid . '" width="' . $width . '" height="' . $height . '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
274
+ $html .= '</div>';
275
  } else {
276
  $html = '';
277
+ $html .= '<div id="pano' . $id . '" class="pano-wrap" style="max-width:100%; width:' . $width . 'px; height: ' . $height . 'px; margin: 0 auto;">';
278
+ $html .= '<div style="width:100%; height:100%; ">' . $postdata['panoviddata'] . '</div>';
279
  $html .= '<script>';
280
+ $html .= 'videojs(' . $postdata['vidid'] . ', {';
281
  $html .= 'plugins: {';
282
  $html .= 'pannellum: {}';
283
  $html .= '}';
412
  $hotspoticoncolor = '#00b4ff';
413
  $hotspotblink = 'on';
414
  $default_data = array();
415
+ $default_data = array('firstScene' => $default_scene, 'sceneFadeDuration' => $scene_fade_duration, 'hfov' => $default_zoom_global, 'maxHfov' => $max_zoom_global, 'minHfov' => $min_zoom_global);
416
  $scene_data = array();
417
 
418
  if (!empty($panodata['scene-list'])) {
483
  $default_zoom = 100;
484
  if (isset($panoscenes["scene-zoom"]) && $panoscenes["scene-zoom"] != '') {
485
  $default_zoom = (int)$panoscenes["scene-zoom"];
486
+ } else {
487
+ if ($default_zoom_global != '') {
488
  $default_zoom = (int)$default_zoom_global;
489
+ }
490
  }
491
 
492
 
493
  $max_zoom = 120;
494
  if (isset($panoscenes["scene-maxzoom"]) && $panoscenes["scene-maxzoom"] != '') {
495
  $max_zoom = (int)$panoscenes["scene-maxzoom"];
496
+ } else {
497
+ if ($max_zoom_global != '') {
498
  $max_zoom = (int)$max_zoom_global;
499
+ }
500
  }
501
 
502
  $min_zoom = 120;
503
  if (isset($panoscenes["scene-minzoom"]) && $panoscenes["scene-minzoom"] != '') {
504
  $min_zoom = (int)$panoscenes["scene-minzoom"];
505
+ } else {
506
+ if ($min_zoom_global != '') {
507
  $min_zoom = (int)$min_zoom_global;
508
+ }
509
  }
510
 
511
  $hotspot_datas = array();
547
  }
548
 
549
  $hotspot_info = array(
550
+ 'text' => $hotspot_data['hotspot-title'],
551
+ 'pitch' => $hotspot_data['hotspot-pitch'],
552
+ 'yaw' => $hotspot_data['hotspot-yaw'],
553
+ 'type' => $hotspot_type,
554
+ 'cssClass' => $hotspot_data['hotspot-customclass'],
555
+ 'URL' => $hotspot_data['hotspot-url'],
556
+ "clickHandlerArgs" => $hotspot_content,
557
+ 'createTooltipArgs' => $hotspot_data['hotspot-hover'],
558
+ "sceneId" => $hotspot_data["hotspot-scene"],
559
+ "targetPitch" => (float)$hotspot_scene_pitch,
560
+ "targetYaw" => (float)$hotspot_scene_yaw,
561
+ 'hotspot_type' => $hotspot_data['hotspot-type']
562
+ );
563
 
564
  $hotspot_info['URL'] = ($hotspot_data['hotspot-type'] === 'fluent_form' || $hotspot_data['hotspot-type'] === 'wc_product') ? '' : $hotspot_info['URL'];
565
 
579
  if ($mobile_media_resize == "true") {
580
  if ($file_accessible == "1") {
581
  $image_info = getimagesize($device_scene);
582
+ if ($image_info && $image_info[0] > 4096) {
583
  $src_to_id_for_mobile = '';
584
  $src_to_id_for_desktop = '';
585
  if (wpvr_isMobileDevice()) {
594
  $src_to_id_for_desktop = attachment_url_to_postid($panoscenes['scene-attachment-url']);
595
  if ($src_to_id_for_desktop) {
596
  $desktop_scene = wp_get_attachment_image_src($src_to_id_for_mobile, 'full');
597
+ if ($desktop_scene && $desktop_scene[0]) {
598
  $device_scene = $desktop_scene[0];
599
  }
600
  }
604
  }
605
 
606
  $scene_info = array();
607
+
608
+ if ($panoscenes["scene-type"] == 'cubemap') {
609
+ $pano_type = 'cubemap';
610
+ $pano_attachment = array(
611
+ $panoscenes["scene-attachment-url-face0"],
612
+ $panoscenes["scene-attachment-url-face1"],
613
+ $panoscenes["scene-attachment-url-face2"],
614
+ $panoscenes["scene-attachment-url-face3"],
615
+ $panoscenes["scene-attachment-url-face4"],
616
+ $panoscenes["scene-attachment-url-face5"]
617
+ );
618
+
619
+ $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);
620
+ }
621
+ else {
622
+ $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);
623
+ }
624
+
625
+
626
 
627
  if (isset($panoscenes["ptyscene"])) {
628
  if ($panoscenes["ptyscene"] == "off") {
691
 
692
  $scene_array = array();
693
  $scene_array = array(
694
+ $panoscenes['scene-id'] => $scene_info
695
  );
696
 
697
  $scene_data[$panoscenes['scene-id']] = $scene_info;
698
  }
699
  }
700
+
701
  $pano_id_array = array();
702
+ $pano_id_array = array('panoid' => $panoid);
703
  $pano_response = array();
704
+ $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);
705
  if (empty($autorotation)) {
706
  unset($pano_response['autoRotate']);
707
  unset($pano_response['autoRotateInactivityDelay']);
715
  }
716
 
717
  $response = array();
718
+ $response = array($pano_id_array, $pano_response);
719
  if (!empty($response)) {
720
  $response = json_encode($response);
721
  }
745
  overflow: hidden;
746
  }';
747
  }
748
+ $html .= '#' . $panoid . ' div.pnlm-hotspot-base.fas,
749
+ #' . $panoid . ' div.pnlm-hotspot-base.fab,
750
+ #' . $panoid . ' div.pnlm-hotspot-base.fa,
751
+ #' . $panoid . ' div.pnlm-hotspot-base.far {
752
  display: block !important;
753
+ background-color: ' . $hotspoticoncolor . ';
754
+ color: ' . $foreground_color . ';
755
  border-radius: 100%;
756
  width: 30px;
757
  height: 30px;
758
  font-size: 16px;
759
  line-height: 30px;
760
+ animation: icon-pulse' . $panoid . ' 1.5s infinite cubic-bezier(.25, 0, 0, 1);
761
  }';
762
  if ($hotspotblink == 'on') {
763
+ $html .= '@-webkit-keyframes icon-pulse' . $panoid . ' {
764
  0% {
765
+ box-shadow: 0 0 0 0px rgba(' . $pulse_color[0] . ', 1);
766
  }
767
  100% {
768
+ box-shadow: 0 0 0 10px rgba(' . $pulse_color[0] . ', 0);
769
  }
770
  }
771
+ @keyframes icon-pulse' . $panoid . ' {
772
  0% {
773
+ box-shadow: 0 0 0 0px rgba(' . $pulse_color[0] . ', 1);
774
  }
775
  100% {
776
+ box-shadow: 0 0 0 10px rgba(' . $pulse_color[0] . ', 0);
777
  }
778
  }';
779
  }
781
  $status = get_option('wpvr_edd_license_status');
782
  if ($status !== false && $status == 'valid') {
783
  if (!$gyro) {
784
+ $html .= '#' . $panoid . ' div.pnlm-orientation-button {
785
  display: none;
786
  }';
787
  }
788
  } else {
789
+ $html .= '#' . $panoid . ' div.pnlm-orientation-button {
790
  display: none;
791
  }';
792
  }
795
 
796
  if ($width == 'fullwidth') {
797
  if (wpvr_isMobileDevice()) {
798
+ $html .= '<div id="pano' . $id . '" class="pano-wrap" style="text-align:center; border-radius:' . $radius . '; direction:ltr;" >';
799
  } else {
800
+ $html .= '<div id="pano' . $id . '" class="pano-wrap vrfullwidth" style=" text-align:center; height: ' . $height . 'px; border-radius:' . $radius . '; direction:ltr;" >';
801
  }
802
  } else {
803
+ $html .= '<div id="pano' . $id . '" class="pano-wrap" style=" text-align:center; max-width:100%; width: ' . $width . 'px; height: ' . $height . 'px; margin: 0 auto; border-radius:' . $radius . '; direction:ltr;">';
804
  }
805
 
806
  //===company logo===//
811
  $html .= '<div id="cp-logo-controls">';
812
  $html .= '<div class="cp-logo-ctrl" id="cp-logo">';
813
  if ($cpLogoImg) {
814
+ $html .= '<img src="' . $cpLogoImg . '" alt="Company Logo">';
815
  }
816
 
817
  if ($cpLogoContent) {
818
+ $html .= '<div class="cp-info">' . $cpLogoContent . '</div>';
819
  }
820
  $html .= '</div>';
821
  $html .= '</div>';
823
  }
824
  //===company logo ends===//
825
 
826
+ //===Background Tour===//
827
+ if (isset($postdata['bg_tour_enabler'])) {
828
+
829
+ $bg_tour_enabler = $postdata['bg_tour_enabler'];
830
+ if ($bg_tour_enabler == 'on') {
831
+ $bg_tour_navmenu = $postdata['bg_tour_navmenu'];
832
+ $bg_tour_title = $postdata['bg_tour_title'];
833
+ $bg_tour_subtitle = $postdata['bg_tour_subtitle'];
834
+
835
+ if ($bg_tour_navmenu == 'on') {
836
+ $menuLocations = get_nav_menu_locations();
837
+ $menuID = $menuLocations['primary'];
838
+ $primaryNav = wp_get_nav_menu_items($menuID);
839
+
840
+ if ($primaryNav) {
841
+ $html .= '<div class="wpvr-navbar-container">';
842
+ foreach ($primaryNav as $primaryNav_key => $primaryNav_value) {
843
+ if ($primaryNav_value->menu_item_parent == "0") {
844
+ $html .= '<li>';
845
+ $html .= '<a href="' . $primaryNav_value->url . '">' . $primaryNav_value->title . '</a>';
846
+ $html .= '<ul class="wpvr-navbar-dropdown">';
847
+ foreach ($primaryNav as $pm_key => $pm_value) {
848
+ if ($pm_value->menu_item_parent == $primaryNav_value->ID) {
849
+ $html .= '<li>';
850
+ $html .= '<a href="' . $pm_value->url . '">' . $pm_value->title . '</a>';
851
+ $html .= '</li>';
852
+ }
853
+ }
854
+ $html .= '</ul>';
855
+ $html .= '</li>';
856
+ }
857
+ }
858
+ $html .= '</div>';
859
+ }
860
+
861
+ }
862
+
863
+ $html .= '<div class="wpvr-home-content">';
864
+ $html .= '<div class="wpvr-home-title">' . $bg_tour_title . '</div>';
865
+ $html .= '<div class="wpvr-home-subtitle">' . $bg_tour_subtitle . '</div>';
866
+ $html .= '</div>';
867
+ }
868
+ }
869
+ //===Background Tour End===//
870
+
871
  //===Custom Control===//
872
  if (isset($custom_control)) {
873
  if ($custom_control['panZoomInSwitch'] == "on" || $custom_control['panZoomOutSwitch'] == "on" || $custom_control['gyroscopeSwitch'] == "on" || $custom_control['backToHomeSwitch'] == "on") {
874
+ $html .= '<div id="zoom-in-out-controls' . $id . '" class="zoom-in-out-controls">';
875
 
876
  if ($custom_control['backToHomeSwitch'] == "on") {
877
+ $html .= '<div class="ctrl" id="backToHome' . $id . '"><i class="' . $custom_control['backToHomeIcon'] . '" style="color:' . $custom_control['backToHomeColor'] . ';"></i></div>';
878
  }
879
 
880
  if ($custom_control['panZoomInSwitch'] == "on") {
881
+ $html .= '<div class="ctrl" id="zoom-in' . $id . '"><i class="' . $custom_control['panZoomInIcon'] . '" style="color:' . $custom_control['panZoomInColor'] . ';"></i></div>';
882
  }
883
 
884
  if ($custom_control['panZoomOutSwitch'] == "on") {
885
+ $html .= '<div class="ctrl" id="zoom-out' . $id . '"><i class="' . $custom_control['panZoomOutIcon'] . '" style="color:' . $custom_control['panZoomOutColor'] . ';"></i></div>';
886
  }
887
 
888
  if ($custom_control['gyroscopeSwitch'] == "on") {
889
+ $html .= '<div class="ctrl" id="gyroscope' . $id . '"><i class="' . $custom_control['gyroscopeIcon'] . '" style="color:' . $custom_control['gyroscopeColor'] . ';"></i></div>';
890
  }
891
 
892
  $html .= '</div>';
895
 
896
  if ($custom_control['panupSwitch'] == "on" || $custom_control['panDownSwitch'] == "on" || $custom_control['panLeftSwitch'] == "on" || $custom_control['panRightSwitch'] == "on" || $custom_control['panFullscreenSwitch'] == "on") {
897
 
898
+ //===Custom Control===//
899
+ $html .= '<div class="controls" id="controls' . $id . '">';
900
 
901
  if ($custom_control['panupSwitch'] == "on") {
902
+ $html .= '<div class="ctrl pan-up" id="pan-up' . $id . '"><i class="' . $custom_control['panupIcon'] . '" style="color:' . $custom_control['panupColor'] . ';"></i></div>';
903
  }
904
 
905
  if ($custom_control['panDownSwitch'] == "on") {
906
+ $html .= '<div class="ctrl pan-down" id="pan-down' . $id . '"><i class="' . $custom_control['panDownIcon'] . '" style="color:' . $custom_control['panDownColor'] . ';"></i></div>';
907
  }
908
 
909
  if ($custom_control['panLeftSwitch'] == "on") {
910
+ $html .= '<div class="ctrl pan-left" id="pan-left' . $id . '"><i class="' . $custom_control['panLeftIcon'] . '" style="color:' . $custom_control['panLeftColor'] . ';"></i></div>';
911
  }
912
 
913
  if ($custom_control['panRightSwitch'] == "on") {
914
+ $html .= '<div class="ctrl pan-right" id="pan-right' . $id . '"><i class="' . $custom_control['panRightIcon'] . '" style="color:' . $custom_control['panRightColor'] . ';"></i></div>';
915
  }
916
 
917
  if ($custom_control['panFullscreenSwitch'] == "on") {
918
+ $html .= '<div class="ctrl fullscreen" id="fullscreen' . $id . '"><i class="' . $custom_control['panFullscreenIcon'] . '" style="color:' . $custom_control['panFullscreenColor'] . ';"></i></div>';
919
  }
920
  $html .= '</div>';
921
  }
924
 
925
  if ($vrgallery) {
926
  //===Carousal setup===//
927
+ $html .= '<div id="vrgcontrols' . $id . '" class="vrgcontrols">';
928
 
929
+ $html .= '<div class="vrgctrl' . $id . ' vrbounce">';
930
  $html .= '</div>';
931
  $html .= '</div>';
932
 
933
+ $html .= '<div id="sccontrols' . $id . '" class="scene-gallery vrowl-carousel owl-theme">';
934
  if (isset($panodata["scene-list"])) {
935
  foreach ($panodata["scene-list"] as $panoscenes) {
936
  $scene_key = $panoscenes['scene-id'];
937
  if ($vrgallery_title == 'on') {
938
  $scene_key_title = $panoscenes['scene-ititle'];
939
+ // $scene_key_title = $panoscenes['scene-id'];
940
  } else {
941
  $scene_key_title = "";
942
  }
943
+
944
+ if ($panoscenes['scene-type'] == 'cubemap') {
945
+ $img_src_url = $panoscenes['scene-attachment-url-face0'];
946
+ }
947
+ else {
948
+ $img_src_url = $panoscenes['scene-attachment-url'];
949
+ }
950
+
951
 
952
  $src_to_id = attachment_url_to_postid($img_src_url);
953
  $thumbnail_array = wp_get_attachment_image_src($src_to_id, 'thumbnail');
957
  $thumbnail = $img_src_url;
958
  }
959
 
960
+ $html .= '<ul style="width:150px;"><li title="Double click to view scene">' . $scene_key_title . '<img class="scctrl" id="' . $scene_key . '_gallery_' . $id . '" src="' . $thumbnail . '"></li></ul>';
961
  }
962
  }
963
  $html .= '</div>';
975
  }
976
 
977
  if ($bg_music == 'on') {
978
+ $html .= '<div id="adcontrol' . $id . '" class="adcontrol" style="right:' . $audio_right . '">';
979
+ $html .= '<audio class="vrAudioDefault" id="vrAudio' . $id . '" data-autoplay="' . $autoplay_bg_music . '" onended="audionEnd' . $id . '()" ' . $bg_loop . '>
980
+ <source src="' . $bg_music_url . '" type="audio/mpeg">
981
  Your browser does not support the audio element.
982
  </audio>
983
+ <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>
984
  ';
985
  $html .= '</div>';
986
  }
988
 
989
 
990
  $html .= '<div class="wpvr-hotspot-tweak-contents-wrapper" style="display: none">';
991
+ $html .= '<i class="fa fa-times cross" data-id="' . $id . '"></i>';
992
  $html .= '<div class="wpvr-hotspot-tweak-contents-flex">';
993
  $html .= '<div class="wpvr-hotspot-tweak-contents">';
994
  ob_start();
1000
  $html .= '</div>';
1001
 
1002
  $html .= '<div class="custom-ifram-wrapper" style="display: none;">';
1003
+ $html .= '<i class="fa fa-times cross" data-id="' . $id . '"></i>';
1004
  $html .= '<div class="custom-ifram-flex">';
1005
  $html .= '<div class="custom-ifram">';
1006
  $html .= '</div>';
1014
  if (isset($postdata['bg_music'])) {
1015
  if ($bg_music == 'on') {
1016
  $html .= '
1017
+ var x' . $id . ' = document.getElementById("vrAudio' . $id . '");
1018
 
1019
+ var playing' . $id . ' = false;
1020
 
1021
+ function playPause' . $id . '() {
1022
 
1023
+ if (playing' . $id . ') {
1024
+ jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up");
1025
+ jQuery("#vr-volume' . $id . '").addClass("fas fa-volume-mute");
1026
+ x' . $id . '.pause();
1027
+ jQuery("#audio_control' . $id . '").attr("data-play", "off");
1028
+ playing' . $id . ' = false;
1029
 
1030
  }
1031
  else {
1032
+ jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute");
1033
+ jQuery("#vr-volume' . $id . '").addClass("fas fa-volume-up");
1034
+ jQuery("#audio_control' . $id . '").attr("data-play", "on");
1035
+ x' . $id . '.play();
1036
+ playing' . $id . ' = true;
1037
  }
1038
  }
1039
 
1040
+ function audionEnd' . $id . '() {
1041
+ playing' . $id . ' = false;
1042
+ jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up");
1043
+ jQuery("#vr-volume' . $id . '").addClass("fas fa-volume-mute");
1044
+ jQuery("#audio_control' . $id . '").attr("data-play", "off");
1045
  }
1046
  ';
1047
 
1048
  if ($autoplay_bg_music == 'on') {
1049
  $html .= '
1050
+ document.getElementById("pano' . $id . '").addEventListener("click", musicPlay' . $id . ');
1051
+ function musicPlay' . $id . '() {
1052
+ playing' . $id . ' = true;
1053
+ document.getElementById("vrAudio' . $id . '").play();
1054
+ document.getElementById("pano' . $id . '").removeEventListener("click", musicPlay' . $id . ');
1055
  }
1056
  ';
1057
  }
1058
  }
1059
  }
1060
  $html .= 'jQuery(document).ready(function() {';
1061
+ $html .= 'var response = ' . $response . ';';
1062
  $html .= 'var scenes = response[1];';
1063
  $html .= 'if(scenes) {';
1064
  $html .= 'var scenedata = scenes.scenes;';
1074
  $html .= '}';
1075
  $html .= '}';
1076
  $html .= '}';
1077
+ $html .= 'var panoshow' . $id . ' = pannellum.viewer(response[0]["panoid"], scenes);';
1078
 
1079
+ $html .= 'panoshow' . $id . '.on("load", function (){
1080
+ if (jQuery("#pano' . $id . '").children().children(".pnlm-panorama-info:visible").length > 0) {
1081
+ jQuery("#controls' . $id . '").css("bottom", "55px");
1082
  }
1083
  else {
1084
+ jQuery("#controls' . $id . '").css("bottom", "5px");
1085
  }
1086
  });';
1087
 
1088
 
1089
  $html .= '
1090
  if (scenes.autoRotate) {
1091
+ panoshow' . $id . '.on("load", function (){
1092
+ setTimeout(function(){ panoshow' . $id . '.startAutoRotate(scenes.autoRotate, 0); }, 3000);
1093
  });
1094
+ panoshow' . $id . '.on("scenechange", function (){
1095
+ setTimeout(function(){ panoshow' . $id . '.startAutoRotate(scenes.autoRotate, 0); }, 3000);
1096
  });
1097
  }
1098
  ';
1101
  if (isset($panodata["scene-list"])) {
1102
  foreach ($panodata["scene-list"] as $panoscenes) {
1103
  $scene_key = $panoscenes['scene-id'];
1104
+ $scene_key_gallery = $panoscenes['scene-id'] . '_gallery_' . $id;
1105
  $img_src_url = $panoscenes['scene-attachment-url'];
1106
+ $html .= 'document.getElementById("' . $scene_key_gallery . '").addEventListener("click", function(e) { ';
1107
  $html .= 'if (touchtime == 0) {';
1108
  $html .= 'touchtime = new Date().getTime();';
1109
  $html .= '} else {';
1110
  $html .= 'if (((new Date().getTime()) - touchtime) < 800) {';
1111
+ $html .= 'panoshow' . $id . '.loadScene("' . $scene_key . '");';
1112
  $html .= 'touchtime = 0;';
1113
  $html .= '} else {';
1114
  $html .= 'touchtime = new Date().getTime();';
1122
  //===Custom Control===//
1123
  if (isset($custom_control)) {
1124
  if ($custom_control['panupSwitch'] == "on") {
1125
+ $html .= 'document.getElementById("pan-up' . $id . '").addEventListener("click", function(e) {';
1126
+ $html .= 'panoshow' . $id . '.setPitch(panoshow' . $id . '.getPitch() + 10);';
1127
  $html .= '});';
1128
  }
1129
 
1130
  if ($custom_control['panDownSwitch'] == "on") {
1131
+ $html .= 'document.getElementById("pan-down' . $id . '").addEventListener("click", function(e) {';
1132
+ $html .= 'panoshow' . $id . '.setPitch(panoshow' . $id . '.getPitch() - 10);';
1133
  $html .= '});';
1134
  }
1135
 
1136
  if ($custom_control['panLeftSwitch'] == "on") {
1137
+ $html .= 'document.getElementById("pan-left' . $id . '").addEventListener("click", function(e) {';
1138
+ $html .= 'panoshow' . $id . '.setYaw(panoshow' . $id . '.getYaw() - 10);';
1139
  $html .= '});';
1140
  }
1141
 
1142
  if ($custom_control['panRightSwitch'] == "on") {
1143
+ $html .= 'document.getElementById("pan-right' . $id . '").addEventListener("click", function(e) {';
1144
+ $html .= 'panoshow' . $id . '.setYaw(panoshow' . $id . '.getYaw() + 10);';
1145
  $html .= '});';
1146
  }
1147
 
1148
  if ($custom_control['panZoomInSwitch'] == "on") {
1149
+ $html .= 'document.getElementById("zoom-in' . $id . '").addEventListener("click", function(e) {';
1150
+ $html .= 'panoshow' . $id . '.setHfov(panoshow' . $id . '.getHfov() - 10);';
1151
  $html .= '});';
1152
  }
1153
 
1154
  if ($custom_control['panZoomOutSwitch'] == "on") {
1155
+ $html .= 'document.getElementById("zoom-out' . $id . '").addEventListener("click", function(e) {';
1156
+ $html .= 'panoshow' . $id . '.setHfov(panoshow' . $id . '.getHfov() + 10);';
1157
  $html .= '});';
1158
  }
1159
 
1160
  if ($custom_control['panFullscreenSwitch'] == "on") {
1161
+ $html .= 'document.getElementById("fullscreen' . $id . '").addEventListener("click", function(e) {';
1162
+ $html .= 'panoshow' . $id . '.toggleFullscreen();';
1163
  $html .= '});';
1164
  }
1165
 
1166
  if ($custom_control['backToHomeSwitch'] == "on") {
1167
+ $html .= 'document.getElementById("backToHome' . $id . '").addEventListener("click", function(e) {';
1168
+ $html .= 'panoshow' . $id . '.loadScene("' . $default_scene . '");';
1169
  $html .= '});';
1170
  }
1171
 
1172
  if ($custom_control['gyroscopeSwitch'] == "on") {
1173
+ $html .= 'document.getElementById("gyroscope' . $id . '").addEventListener("click", function(e) {';
1174
  $html .= '
1175
+ if (panoshow' . $id . '.isOrientationActive()) {
1176
+ panoshow' . $id . '.stopOrientation();
1177
  }
1178
  else {
1179
+ panoshow' . $id . '.startOrientation();
1180
  }
1181
 
1182
  ';
1189
  $sin_qout = "'";
1190
 
1191
  if ($vrgallery_display) {
1192
+ if (!$autoload) {
1193
+ $html .= '
1194
  jQuery(document).ready(function($){
1195
+ jQuery("#sccontrols' . $id . '").hide();
1196
+ jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
1197
+ jQuery("#sccontrols' . $id . '").hide();
1198
  });
1199
  ';
1200
 
1201
+ $html .= '
1202
+ var slide' . $id . ' = "down";
1203
+ jQuery(document).on("click","#vrgcontrols' . $id . '",function() {
1204
 
1205
+ if (slide' . $id . ' == "up") {
1206
+ jQuery(".vrgctrl' . $id . '").empty();
1207
+ jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
1208
+ slide' . $id . ' = "down";
1209
  }
1210
  else {
1211
+ jQuery(".vrgctrl' . $id . '").empty();
1212
+ jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . ');
1213
+ slide' . $id . ' = "up";
1214
  }
1215
+ jQuery("#sccontrols' . $id . '").slideToggle();
1216
  });
1217
  ';
1218
+ } else {
1219
+ $html .= '
 
1220
  jQuery(document).ready(function($){
1221
+ jQuery("#sccontrols' . $id . '").show();
1222
+ jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . ');
1223
  });
1224
  ';
1225
 
1226
+ $html .= '
1227
+ var slide' . $id . ' = "down";
1228
+ jQuery(document).on("click","#vrgcontrols' . $id . '",function() {
1229
 
1230
+ if (slide' . $id . ' == "up") {
1231
+ jQuery(".vrgctrl' . $id . '").empty();
1232
+ jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . ');
1233
+ slide' . $id . ' = "down";
1234
  }
1235
  else {
1236
+ jQuery(".vrgctrl' . $id . '").empty();
1237
+ jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
1238
+ slide' . $id . ' = "up";
1239
  }
1240
+ jQuery("#sccontrols' . $id . '").slideToggle();
1241
  });
1242
  ';
1243
+ }
1244
  } else {
1245
  $html .= '
1246
  jQuery(document).ready(function($){
1247
+ jQuery("#sccontrols' . $id . '").hide();
1248
+ jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
1249
  });
1250
  ';
1251
 
1252
  $html .= '
1253
+ var slide' . $id . ' = "down";
1254
+ jQuery(document).on("click","#vrgcontrols' . $id . '",function() {
1255
 
1256
+ if (slide' . $id . ' == "up") {
1257
+ jQuery(".vrgctrl' . $id . '").empty();
1258
+ jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . ');
1259
+ slide' . $id . ' = "down";
1260
  }
1261
  else {
1262
+ jQuery(".vrgctrl' . $id . '").empty();
1263
+ jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . ');
1264
+ slide' . $id . ' = "up";
1265
  }
1266
+ jQuery("#sccontrols' . $id . '").slideToggle();
1267
  });
1268
  ';
1269
  }
1272
  $html .= '
1273
 
1274
  jQuery(document).ready(function(){
1275
+ jQuery("#controls' . $id . '").hide();
1276
+ jQuery("#zoom-in-out-controls' . $id . '").hide();
1277
+ jQuery("#adcontrol' . $id . '").hide();
1278
+ jQuery("#pano' . $id . '").find(".pnlm-panorama-info").hide();
1279
  });
1280
 
1281
  ';
1282
 
1283
+ if ($vrgallery_display) {
1284
  $html .= 'var load_once = "true";';
1285
+ $html .= 'panoshow' . $id . '.on("load", function (){
1286
  if (load_once == "true") {
1287
  load_once = "false";
1288
+ jQuery("#sccontrols' . $id . '").slideToggle();
1289
  }
1290
  });';
1291
+ }
1292
 
1293
+ $html .= 'panoshow' . $id . '.on("load", function (){
1294
+ jQuery("#controls' . $id . '").show();
1295
+ jQuery("#zoom-in-out-controls' . $id . '").show();
1296
+ jQuery("#adcontrol' . $id . '").show();
1297
+ jQuery("#pano' . $id . '").find(".pnlm-panorama-info").show();
1298
  });';
1299
  }
1300
  if (isset($postdata['previewtext'])) {
1301
  $html .= '
1302
+ jQuery("#pano' . $id . '").children(".pnlm-ui").find(".pnlm-load-button p").text("' . $postdata['previewtext'] . '")
1303
  ';
1304
+ } else {
1305
  $html .= '
1306
+ jQuery("#pano' . $id . '").children(".pnlm-ui").find(".pnlm-load-button p").text("Click To Load Panorama")
1307
  ';
1308
  }
1309
  $html .= '});';
1319
  $colour = substr($colour, 1);
1320
  }
1321
  if (strlen($colour) == 6) {
1322
+ list($r, $g, $b) = array($colour[0] . $colour[1], $colour[2] . $colour[3], $colour[4] . $colour[5]);
1323
  } elseif (strlen($colour) == 3) {
1324
+ list($r, $g, $b) = array($colour[0] . $colour[0], $colour[1] . $colour[1], $colour[2] . $colour[2]);
1325
  } else {
1326
  return false;
1327
  }
1328
  $r = hexdec($r);
1329
  $g = hexdec($g);
1330
  $b = hexdec($b);
1331
+ return array($r . ', ' . $g . ', ' . $b);
1332
  }
1333
 
1334
  function wpvr_HTMLToRGB($htmlCode)
1408
  'methods' => 'GET',
1409
  'callback' => 'wpvr_rest_data_set',
1410
  'permission_callback' => 'wpvr_rest_route_permission'
1411
+ ));
1412
  }
1413
 
1414
  function wpvr_rest_route_permission()
1424
  ));
1425
 
1426
  $wpvr_list = array();
1427
+ $list_none = array('value' => 0, 'label' => 'None');
1428
  array_push($wpvr_list, $list_none);
1429
  while ($query->have_posts()) {
1430
  $query->the_post();
1431
  $title = get_the_title();
1432
  $post_id = get_the_ID();
1433
+ $title = $title . ' : ' . $post_id;
1434
+ $list_ob = array('value' => $post_id, 'label' => $title);
1435
  array_push($wpvr_list, $list_ob);
1436
  }
1437
  return $wpvr_list;
1447
  $upload = wp_upload_dir();
1448
  $upload_dir = $upload['basedir'];
1449
  $upload_dir_temp = $upload_dir . '/wpvr/temp/';
1450
+ if (!is_dir($upload_dir_temp)) {
1451
  wp_mkdir_p($upload_dir_temp, 0700);
1452
  }
1453
  }
1456
  function wpvr_delete_temp_file()
1457
  {
1458
  $file_save_url = wp_upload_dir();
1459
+ $rootPath = realpath($file_save_url['basedir'] . '/wpvr/temp/');
1460
  $files = new RecursiveIteratorIterator(
1461
  new RecursiveDirectoryIterator($rootPath),
1462
  RecursiveIteratorIterator::LEAVES_ONLY
1543
  }
1544
  }
1545
 
1546
+ add_action('admin_init', 'wpvr_add_role_cap', 999);
1547
+
1548
+ function wpvr_role_management_from_post_type($args, $post_type)
1549
+ {
1550
+ if ('wpvr_item' !== $post_type) {
1551
+ return $args;
1552
+ }
1553
+
1554
+ $editor_active = get_option('wpvr_editor_active');
1555
+ $author_active = get_option('wpvr_author_active');
1556
+ $user = wp_get_current_user();
1557
+
1558
+ if ($editor_active == "true") {
1559
+ if (in_array('editor', (array) $user->roles)) {
1560
+ $args['show_in_menu'] = true;
1561
+ }
1562
+ }
1563
+
1564
+ if ($author_active == "true") {
1565
+ if (in_array('author', (array) $user->roles)) {
1566
+ $args['show_in_menu'] = true;
1567
+ }
1568
+ }
1569
+
1570
+ return $args;
1571
+ }
1572
+ add_filter('register_post_type_args', 'wpvr_role_management_from_post_type', 10, 2);
1573
+
1574
+ function wpvr_cache_admin_notice()
1575
+ {
1576
+ $option = get_option('wpvr_warning');
1577
+ if (!$option) {
1578
+ ?>
1579
+ <div class="notice notice-warning" id="wpvr-warning" style="position: relative;">
1580
+ <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>
1581
+ <button type="button" id="wpvr-dismissible" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>
1582
+ </div>
1583
+ <?php
1584
+ }
1585
+ }
1586
  // add_action('admin_notices', 'wpvr_cache_admin_notice');
1587
 
1588
  //===Oxygen widget===//
1601
 
1602
 
1603
  add_action(
1604
+ /**
1605
+ * @param $api \VisualComposer\Modules\Api\Factory
1606
+ */
1607
  'vcv:api',
1608
  function ($api) {
1609
  $elementsToRegister = [