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 | ![]() |
Version | 7.3.3 |
Comparing to | |
See all releases |
Code changes from version 7.3.2 to 7.3.3
- README.txt +18 -8
- admin/class-wpvr-ajax.php +1360 -1211
- admin/css/wpvr-admin.css +35 -2
- admin/icon/bg-tour-hover.png +0 -0
- admin/icon/bg-tour-regular.png +0 -0
- admin/js/wpvr-admin.js +210 -173
- admin/partials/wpvr-meta-box-builder-display.php +27 -2
- admin/partials/wpvr_documentation.php +58 -2
- public/class-wpvr-public.php +87 -18
- public/css/wpvr-public.css +82 -9
- wpvr.php +360 -290
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,
|
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.
|
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
|
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
|
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 (
|
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 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
}
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
}
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
}
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
}
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
}
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
$autoload = true;
|
76 |
-
}
|
77 |
-
else {
|
78 |
-
$autoload = false;
|
79 |
-
}
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
$
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
$
|
101 |
-
$max_global_zoom = $_POST['maxzoom'];
|
102 |
-
$min_global_zoom = $_POST['minzoom'];
|
103 |
}
|
104 |
-
|
105 |
-
|
106 |
|
107 |
-
|
108 |
-
}
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
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 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
-
|
|
|
|
|
|
|
140 |
|
141 |
-
|
142 |
-
|
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: '
|
150 |
die();
|
151 |
}
|
|
|
152 |
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
}
|
160 |
}
|
|
|
161 |
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
}
|
169 |
}
|
|
|
170 |
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
|
182 |
-
|
183 |
-
}
|
184 |
}
|
|
|
185 |
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
|
192 |
-
|
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 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
}
|
213 |
}
|
214 |
-
|
215 |
-
if ($scenes_val["hotspot-list"] != "") {
|
216 |
-
foreach ($scenes_val["hotspot-list"] as $hotspot_val) {
|
217 |
|
218 |
-
|
|
|
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 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
|
|
243 |
|
244 |
-
|
245 |
-
|
|
|
|
|
|
|
|
|
|
|
246 |
}
|
|
|
247 |
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
}
|
256 |
}
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
|
|
263 |
die();
|
264 |
}
|
265 |
}
|
266 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
|
268 |
-
|
269 |
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
}
|
279 |
}
|
|
|
280 |
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
}
|
290 |
}
|
291 |
}
|
292 |
}
|
@@ -294,911 +321,921 @@ class Wpvr_Ajax {
|
|
294 |
}
|
295 |
}
|
296 |
}
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
}
|
|
|
304 |
|
305 |
-
|
306 |
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
}
|
311 |
}
|
|
|
312 |
|
313 |
-
|
314 |
|
315 |
-
|
316 |
-
|
317 |
-
}
|
318 |
}
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
}
|
327 |
}
|
|
|
328 |
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
}
|
335 |
}
|
|
|
336 |
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
}
|
353 |
}
|
354 |
}
|
|
|
355 |
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
|
370 |
-
|
371 |
-
|
372 |
|
373 |
-
|
374 |
-
|
375 |
|
376 |
-
|
377 |
-
|
378 |
|
379 |
-
|
380 |
-
|
381 |
|
382 |
-
|
383 |
-
|
384 |
|
385 |
-
|
386 |
-
|
387 |
|
388 |
-
|
389 |
-
|
390 |
|
391 |
-
|
392 |
-
|
393 |
|
394 |
-
|
395 |
-
|
396 |
|
|
|
|
|
|
|
|
|
|
|
397 |
$default_zoom = 100;
|
398 |
-
|
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 |
-
|
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 |
-
|
417 |
-
if (!empty($min_zoom)) {
|
418 |
-
$min_zoom = (int)$panoscenes["scene-minzoom"];
|
419 |
-
}
|
420 |
-
else {
|
421 |
-
$min_zoom = 50;
|
422 |
-
}
|
423 |
|
424 |
-
|
425 |
|
426 |
-
|
427 |
-
|
428 |
|
429 |
-
|
430 |
|
431 |
-
|
432 |
-
|
433 |
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
|
438 |
|
439 |
-
|
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 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
461 |
}
|
462 |
}
|
|
|
463 |
|
464 |
-
|
465 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
|
467 |
-
|
468 |
-
|
469 |
-
|
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 |
-
|
480 |
-
|
481 |
-
|
|
|
482 |
|
483 |
-
|
484 |
-
|
485 |
-
|
|
|
|
|
|
|
486 |
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
}
|
495 |
-
if (empty($panoscenes["scene-maxpitch"])) {
|
496 |
-
unset($scene_info['maxPitch']);
|
497 |
-
}
|
498 |
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
|
503 |
-
|
504 |
-
|
505 |
-
|
|
|
|
|
|
|
|
|
506 |
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
}
|
511 |
|
512 |
-
|
513 |
-
|
514 |
-
|
|
|
|
|
|
|
|
|
515 |
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
// unset($scene_info['minHfov']);
|
520 |
-
// }
|
521 |
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
528 |
|
|
|
|
|
|
|
|
|
529 |
}
|
530 |
-
|
531 |
-
$
|
532 |
-
$
|
533 |
-
$
|
534 |
-
$
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
|
|
|
|
|
|
|
|
|
|
540 |
}
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
|
|
545 |
}
|
546 |
-
|
547 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
548 |
}
|
549 |
-
|
550 |
-
|
|
|
|
|
|
|
|
|
551 |
}
|
552 |
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
$
|
559 |
-
$
|
560 |
-
|
|
|
|
|
|
|
|
|
561 |
}
|
562 |
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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("="
|
|
|
581 |
|
582 |
if ($autoplay == 'on') {
|
583 |
$autoplay = '&autoplay=1';
|
584 |
-
|
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("/"
|
|
|
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/'
|
628 |
-
|
629 |
-
}
|
630 |
-
elseif (strpos($videourl, 'vimeo') > 0) {
|
631 |
$vidtype = 'vimeo';
|
632 |
$explodeid = '';
|
633 |
-
$explodeid = explode("/"
|
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].'?'
|
651 |
$html = '';
|
652 |
-
$html .= '<iframe src="https://player.vimeo.com/video/'
|
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="'
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
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 |
-
$
|
689 |
-
$
|
690 |
-
$
|
691 |
-
|
692 |
-
|
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 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
|
|
794 |
|
795 |
-
|
796 |
-
|
797 |
-
}
|
798 |
-
else {
|
799 |
-
$autoplay = '';
|
800 |
-
}
|
801 |
|
802 |
-
|
803 |
-
$loop = '&loop=1';
|
804 |
-
}
|
805 |
-
else {
|
806 |
-
$loop = '';
|
807 |
-
}
|
808 |
|
809 |
-
|
810 |
-
|
811 |
-
|
|
|
|
|
|
|
812 |
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
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 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
$html .= '</video>';
|
841 |
-
}
|
842 |
|
|
|
|
|
|
|
|
|
843 |
|
|
|
844 |
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
die();
|
849 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
850 |
|
|
|
|
|
|
|
|
|
|
|
|
|
851 |
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
}
|
859 |
|
860 |
-
|
861 |
-
|
|
|
|
|
|
|
|
|
862 |
|
863 |
-
|
|
|
|
|
|
|
|
|
|
|
864 |
|
865 |
-
|
866 |
-
if ($vrgallery == 'on') {
|
867 |
-
$vrgallery = true;
|
868 |
-
}
|
869 |
-
else {
|
870 |
-
$vrgallery = false;
|
871 |
-
}
|
872 |
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
$vrgallery_title = false;
|
879 |
-
}
|
880 |
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
}
|
888 |
|
889 |
-
|
890 |
-
if( isset($_POST['gyro']) ){
|
891 |
-
$gyro = sanitize_text_field($_POST['gyro']);
|
892 |
-
}
|
893 |
-
|
894 |
-
$deviceorientationcontrol = sanitize_text_field($_POST['deviceorientationcontrol']);
|
895 |
|
896 |
-
|
897 |
-
|
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 |
-
|
915 |
-
|
916 |
-
$compass = true;
|
917 |
-
}
|
918 |
-
else {
|
919 |
-
$compass = false;
|
920 |
-
}
|
921 |
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
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 |
-
|
|
|
|
|
|
|
947 |
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
954 |
|
955 |
-
|
956 |
-
|
957 |
-
$autoload = true;
|
958 |
-
}
|
959 |
-
else {
|
960 |
-
$autoload = false;
|
961 |
}
|
|
|
|
|
962 |
|
963 |
-
|
964 |
-
|
965 |
-
$preview = '';
|
966 |
-
$preview = esc_url($_POST['preview']);
|
967 |
|
968 |
-
|
969 |
-
|
970 |
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
|
|
977 |
|
|
|
|
|
|
|
|
|
|
|
978 |
|
|
|
|
|
|
|
|
|
979 |
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
|
985 |
-
|
986 |
-
|
987 |
-
|
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 |
-
|
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: '
|
1040 |
die();
|
1041 |
}
|
|
|
1042 |
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
}
|
1050 |
}
|
|
|
1051 |
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
}
|
1059 |
}
|
|
|
1060 |
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
|
1073 |
-
|
1074 |
-
}
|
1075 |
}
|
|
|
1076 |
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
|
1089 |
-
|
1090 |
-
}
|
1091 |
}
|
|
|
1092 |
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
}
|
1105 |
}
|
|
|
1106 |
|
1107 |
-
|
1108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
1119 |
-
|
1120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1121 |
die();
|
1122 |
}
|
1123 |
-
|
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 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
|
|
|
|
|
|
1137 |
}
|
1138 |
-
|
1139 |
-
|
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 |
-
|
1144 |
-
}
|
1145 |
-
}
|
1146 |
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
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 |
-
$
|
1157 |
-
|
1158 |
-
|
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 |
-
|
1166 |
|
1167 |
-
$hotspot_scene_validate = $hotspot_val["hotspot-scene"];
|
1168 |
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
if (
|
1175 |
-
wp_send_json_error('<span
|
1176 |
die();
|
1177 |
}
|
1178 |
}
|
|
|
1179 |
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
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 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
}
|
|
|
1217 |
|
1218 |
-
|
1219 |
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
}
|
1224 |
}
|
|
|
1225 |
|
1226 |
-
|
1227 |
|
1228 |
-
|
1229 |
-
|
1230 |
-
}
|
1231 |
}
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
}
|
1240 |
}
|
|
|
1241 |
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
}
|
1248 |
}
|
|
|
1249 |
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
}
|
1265 |
}
|
1266 |
}
|
|
|
1267 |
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
unset($panodata["scene-list"][$i]['hotspot-list'][$j]);
|
1278 |
-
}
|
1279 |
}
|
1280 |
}
|
1281 |
}
|
|
|
1282 |
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
}
|
1297 |
}
|
1298 |
-
|
|
|
1299 |
|
1300 |
-
|
1301 |
-
|
1302 |
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
}
|
1325 |
|
1326 |
-
|
1327 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1328 |
wpvr_delete_temp_file();
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1366 |
}
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
|
|
1383 |
}
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
|
|
1400 |
}
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
wp_send_json_error('Media transfer process failed');
|
1419 |
-
}
|
1420 |
}
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
wp_send_json_error('Media transfer process failed');
|
1439 |
-
}
|
1440 |
}
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
|
|
|
|
|
|
|
|
|
|
1467 |
wpvr_delete_temp_file();
|
|
|
|
|
1468 |
}
|
|
|
1469 |
}
|
|
|
|
|
|
|
1470 |
}
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
die();
|
1476 |
}
|
|
|
|
|
1477 |
|
1478 |
/**
|
1479 |
-
|
1480 |
-
|
1481 |
-
function wpvrstreetview_preview()
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
|
|
|
|
1491 |
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
}
|
1496 |
|
1497 |
/**
|
1498 |
-
|
1499 |
-
|
1500 |
-
function wpvr_role_management()
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1532 |
}
|
1533 |
|
1534 |
/**
|
1535 |
-
|
1536 |
-
|
1537 |
-
function wpvr_notice()
|
1538 |
-
|
|
|
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 |
+
|