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

Version Description

  • Dynamic error reporting added.

=

Download this release

Release Info

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

Code changes from version 2.7.0 to 2.8.0

Files changed (3) hide show
  1. README.txt +4 -1
  2. admin/class-wpvr-ajax.php +137 -44
  3. wpvr.php +1 -1
README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://rextheme.com/wp-vr-360-panorama-and-virtual-tour-creator-fo
4
  Tags: virtual tour, real estate tour, panorama, panorama viewer, virtual tour, 360 panorama, interactive tour
5
  Requires at least: 4.0
6
  Tested up to: 5.2
7
- Stable tag: 2.7.0
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -195,5 +195,8 @@ To solve this issue, go to your WordPress Dashboard > Settings > General. Here m
195
  = 2.7.0 =
196
  * Post memory limit fix.
197
 
 
 
 
198
  == Upgrade Notice ==
199
  Please do update the WP VR to the latest version. Each update makes it sure your plugin is supporting all tour features.  
4
  Tags: virtual tour, real estate tour, panorama, panorama viewer, virtual tour, 360 panorama, interactive tour
5
  Requires at least: 4.0
6
  Tested up to: 5.2
7
+ Stable tag: 2.8.0
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
195
  = 2.7.0 =
196
  * Post memory limit fix.
197
 
198
+ = 2.8.0 =
199
+ * Dynamic error reporting added.
200
+
201
  == Upgrade Notice ==
202
  Please do update the WP VR to the latest version. Each update makes it sure your plugin is supporting all tour features.  
admin/class-wpvr-ajax.php CHANGED
@@ -95,12 +95,12 @@ class Wpvr_Ajax {
95
  if (!empty($scene_id_validate)) {
96
  $scene_id_validated = preg_replace('/[^0-9a-zA-Z_]/',"",$scene_id_validate);
97
  if ($scene_id_validated != $scene_id_validate) {
98
- wp_send_json_error('<p><span>Warning:</span> The scene id can only contain letters and numbers</p>');
99
  die();
100
  }
101
  if (empty($scenes_val["scene-attachment-url"])) {
102
  // var_dump($scenes_val["scene-attachment-url"]);
103
- wp_send_json_error('<p><span>Warning:</span> A scene image is required for every scene.</p>');
104
  die();
105
  }
106
 
@@ -108,7 +108,7 @@ class Wpvr_Ajax {
108
  $validate_scene_pitch = $scenes_val["scene-pitch"];
109
  $validated_scene_pitch = preg_replace('/[^0-9.-]/','',$validate_scene_pitch);
110
  if ($validated_scene_pitch != $validate_scene_pitch) {
111
- wp_send_json_error('<p><span>Warning:</span> Default pitch value can only contain float numbers</p>');
112
  die();
113
  }
114
  }
@@ -117,7 +117,7 @@ class Wpvr_Ajax {
117
  $validate_scene_yaw = $scenes_val["scene-yaw"];
118
  $validated_scene_yaw = preg_replace('/[^0-9.-]/','',$validate_scene_yaw);
119
  if ($validated_scene_yaw != $validate_scene_yaw) {
120
- wp_send_json_error('<p><span>Warning:</span> Default yaw value can only contain float numbers</p>');
121
  die();
122
  }
123
  }
@@ -126,12 +126,12 @@ class Wpvr_Ajax {
126
  $validate_default_zoom = $scenes_val["scene-zoom"];
127
  $validated_default_zoom = preg_replace('/[^0-9-]/','',$validate_default_zoom);
128
  if ($validated_default_zoom != $validate_default_zoom) {
129
- wp_send_json_error('<p><span>Warning:</span> Default zoom value can only contain number in degree from 50 to 120</p>');
130
  die();
131
  }
132
  $default_zoom_value = (int)$scenes_val["scene-zoom"];
133
  if ($default_zoom_value > 120 || $default_zoom_value < 50) {
134
- wp_send_json_error('<p><span>Warning:</span> Default zoom value can only contain number in degree from 50 to 120</p>');
135
  die();
136
  }
137
  }
@@ -140,12 +140,12 @@ class Wpvr_Ajax {
140
  $validate_max_zoom = $scenes_val["scene-maxzoom"];
141
  $validated_max_zoom = preg_replace('/[^0-9-]/','',$validate_max_zoom);
142
  if ($validated_max_zoom != $validate_max_zoom) {
143
- wp_send_json_error('<p><span>Warning:</span> Max zoom out value can only contain number in degree.</p>');
144
  die();
145
  }
146
  $max_zoom_value = (int)$scenes_val["scene-maxzoom"];
147
  if ($max_zoom_value > 120 ) {
148
- wp_send_json_error('<p><span>Warning:</span> Max zoom out value can only contain number in degree below 120.</p>');
149
  die();
150
  }
151
  }
@@ -154,12 +154,12 @@ class Wpvr_Ajax {
154
  $validate_min_zoom = $scenes_val["scene-minzoom"];
155
  $validated_min_zoom = preg_replace('/[^0-9-]/','',$validate_min_zoom);
156
  if ($validated_min_zoom != $validate_min_zoom) {
157
- wp_send_json_error('<p><span>Warning:</span> Max zoom in value can only contain number in degree.</p>');
158
  die();
159
  }
160
  $min_zoom_value = (int)$scenes_val["scene-minzoom"];
161
  if ($min_zoom_value < 50 ) {
162
- wp_send_json_error('<p><span>Warning:</span> Max zoom in value can only contain number in degree above 50.</p>');
163
  die();
164
  }
165
  }
@@ -172,7 +172,7 @@ class Wpvr_Ajax {
172
  if (!empty($hotspot_title_validate)) {
173
  $hotspot_title_validated = preg_replace('/[^0-9a-zA-Z_]/',"",$hotspot_title_validate);
174
  if ($hotspot_title_validated != $hotspot_title_validate) {
175
- wp_send_json_error('<p><span>Warning:</span> Hotspot title can only contain letters and numbers</p>');
176
  die();
177
  }
178
 
@@ -180,7 +180,7 @@ class Wpvr_Ajax {
180
  if (!empty($hotspot_pitch_validate)) {
181
  $hotspot_pitch_validated = preg_replace('/[^0-9.-]/','',$hotspot_pitch_validate);
182
  if ($hotspot_pitch_validated != $hotspot_pitch_validate) {
183
- wp_send_json_error('<p><span>Warning:</span> Hotspot pitch can only contain float numbers</p>');
184
  die();
185
  }
186
  }
@@ -189,7 +189,7 @@ class Wpvr_Ajax {
189
  if (!empty($hotspot_yaw_validate)) {
190
  $hotspot_yaw_validated = preg_replace('/[^0-9.-]/','',$hotspot_yaw_validate);
191
  if ($hotspot_yaw_validated != $hotspot_yaw_validate) {
192
- wp_send_json_error('<p><span>Warning:</span> Hotspot yaw can only contain float numbers</p>');
193
  die();
194
  }
195
  }
@@ -198,7 +198,7 @@ class Wpvr_Ajax {
198
  $status = get_option( 'wpvr_edd_license_status' );
199
  if( $status !== false && $status == 'valid' ) {
200
  if ($hotspot_val["hotspot-customclass-pro"] != 'none' && !empty($hotspot_val["hotspot-customclass"])) {
201
- wp_send_json_error('<p><span>Warning:</span> Don\'t add Custom icon class and custom icon both.</p>');
202
  die();
203
  }
204
  }
@@ -208,7 +208,7 @@ class Wpvr_Ajax {
208
  if (!empty($hotspot_url_validate)) {
209
  $hotspot_url_validated = esc_url($hotspot_url_validate);
210
  if ($hotspot_url_validated != $hotspot_url_validate) {
211
- wp_send_json_error('<p><span>Warning:</span> Hotspot Url is invalid</p>');
212
  die();
213
  }
214
  }
@@ -218,22 +218,22 @@ class Wpvr_Ajax {
218
 
219
  if ($hotspot_type_validate == "info") {
220
  if (!empty($hotspot_scene_validate)) {
221
- wp_send_json_error('<p><span>Warning:</span> Don\'t add Target Scene ID on info type hotspot</p>');
222
  die();
223
  }
224
  if (!empty($hotspot_url_validate) && !empty($hotspot_content_validate)) {
225
- wp_send_json_error('<p><span>Warning:</span> Don\'t add Url and On click content both on same hotspot.</p>');
226
  die();
227
  }
228
  }
229
 
230
  if ($hotspot_type_validate == "scene") {
231
  if (empty($hotspot_scene_validate)) {
232
- wp_send_json_error('<p><span>Warning:</span> Target scene id is required for scene type hotspot.</p>');
233
  die();
234
  }
235
  if (!empty($hotspot_url_validate) || !empty($hotspot_content_validate)) {
236
- wp_send_json_error('<p><span>Warning:</span> Don\'t add Url or On click content on scene type hotspot.</p>');
237
  die();
238
  }
239
  }
@@ -244,6 +244,20 @@ class Wpvr_Ajax {
244
  }
245
  }
246
  //===Error Control and Validation===//
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
 
248
  foreach ($panodata["scene-list"] as $panoscenes) {
249
 
@@ -252,8 +266,39 @@ class Wpvr_Ajax {
252
  }
253
  }
254
  if (empty($default_scene)) {
255
- wp_send_json_error('<p><span>Warning:</span> Default scene is required. Set a scene as deafualt to load it by deafult.</p>');
256
- die();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  }
258
 
259
  $default_data = array();
@@ -657,12 +702,12 @@ class Wpvr_Ajax {
657
  if (!empty($scene_id_validate)) {
658
  $scene_id_validated = preg_replace('/[^0-9a-zA-Z_]/',"",$scene_id_validate);
659
  if ($scene_id_validated != $scene_id_validate) {
660
- wp_send_json_error('<p><span>Warning:</span> The scene id can only contain letters and numbers.</p>');
661
  die();
662
  }
663
 
664
  if (empty($scenes_val["scene-attachment-url"])) {
665
- wp_send_json_error('<p><span>Warning:</span> A scene image is required for every scene.</p>');
666
  die();
667
  }
668
 
@@ -670,7 +715,7 @@ class Wpvr_Ajax {
670
  $validate_scene_pitch = $scenes_val["scene-pitch"];
671
  $validated_scene_pitch = preg_replace('/[^0-9.-]/','',$validate_scene_pitch);
672
  if ($validated_scene_pitch != $validate_scene_pitch) {
673
- wp_send_json_error('<p><span>Warning:</span> Default pitch value can only contain float numbers</p>');
674
  die();
675
  }
676
  }
@@ -679,7 +724,7 @@ class Wpvr_Ajax {
679
  $validate_scene_yaw = $scenes_val["scene-yaw"];
680
  $validated_scene_yaw = preg_replace('/[^0-9.-]/','',$validate_scene_yaw);
681
  if ($validated_scene_yaw != $validate_scene_yaw) {
682
- wp_send_json_error('<p><span>Warning:</span> Default yaw value can only contain float numbers</p>');
683
  die();
684
  }
685
  }
@@ -688,12 +733,12 @@ class Wpvr_Ajax {
688
  $validate_default_zoom = $scenes_val["scene-zoom"];
689
  $validated_default_zoom = preg_replace('/[^0-9-]/','',$validate_default_zoom);
690
  if ($validated_default_zoom != $validate_default_zoom) {
691
- wp_send_json_error('<p><span>Warning:</span> Default zoom value can only contain number in degree from 50 to 120</p>');
692
  die();
693
  }
694
  $default_zoom_value = (int)$scenes_val["scene-zoom"];
695
  if ($default_zoom_value > 120 || $default_zoom_value < 50) {
696
- wp_send_json_error('<p><span>Warning:</span> Default zoom value can only contain number in degree from 50 to 120</p>');
697
  die();
698
  }
699
  }
@@ -702,12 +747,12 @@ class Wpvr_Ajax {
702
  $validate_max_zoom = $scenes_val["scene-maxzoom"];
703
  $validated_max_zoom = preg_replace('/[^0-9-]/','',$validate_max_zoom);
704
  if ($validated_max_zoom != $validate_max_zoom) {
705
- wp_send_json_error('<p><span>Warning:</span> Max zoom out value can only contain number in degree.</p>');
706
  die();
707
  }
708
  $max_zoom_value = (int)$scenes_val["scene-maxzoom"];
709
  if ($max_zoom_value > 120 ) {
710
- wp_send_json_error('<p><span>Warning:</span> Max zoom out value can only contain number in degree below 120.</p>');
711
  die();
712
  }
713
  }
@@ -716,12 +761,12 @@ class Wpvr_Ajax {
716
  $validate_min_zoom = $scenes_val["scene-minzoom"];
717
  $validated_min_zoom = preg_replace('/[^0-9-]/','',$validate_min_zoom);
718
  if ($validated_min_zoom != $validate_min_zoom) {
719
- wp_send_json_error('<p><span>Warning:</span> Max zoom in value can only contain number in degree.</p>');
720
  die();
721
  }
722
  $min_zoom_value = (int)$scenes_val["scene-minzoom"];
723
  if ($min_zoom_value < 50 ) {
724
- wp_send_json_error('<p><span>Warning:</span> Max zoom in value can only contain number in degree above 50.</p>');
725
  die();
726
  }
727
  }
@@ -734,31 +779,31 @@ class Wpvr_Ajax {
734
  if (!empty($hotspot_title_validate)) {
735
  $hotspot_title_validated = preg_replace('/[^0-9a-zA-Z_]/',"",$hotspot_title_validate);
736
  if ($hotspot_title_validated != $hotspot_title_validate) {
737
- wp_send_json_error('<p><span>Warning:</span> Hotspot title can only contain letters and numbers.</p>');
738
  die();
739
  }
740
  $hotspot_pitch_validate = $hotspot_val["hotspot-pitch"];
741
  if (empty($hotspot_pitch_validate)) {
742
- wp_send_json_error('<p><span>Warning:</span> Hotspot pitch is required for every hotspot.</p>');
743
  die();
744
  }
745
  if (!empty($hotspot_pitch_validate)) {
746
  $hotspot_pitch_validated = preg_replace('/[^0-9.-]/','',$hotspot_pitch_validate);
747
  if ($hotspot_pitch_validated != $hotspot_pitch_validate) {
748
- wp_send_json_error('<p><span>Warning:</span> Hotspot pitch can only contain float numbers.</p>');
749
  die();
750
  }
751
  }
752
 
753
  $hotspot_yaw_validate = $hotspot_val["hotspot-yaw"];
754
  if (empty($hotspot_yaw_validate)) {
755
- wp_send_json_error('<p><span>Warning:</span> Hotspot yaw is required for every hotspot.</p>');
756
  die();
757
  }
758
  if (!empty($hotspot_yaw_validate)) {
759
  $hotspot_yaw_validated = preg_replace('/[^0-9.-]/','',$hotspot_yaw_validate);
760
  if ($hotspot_yaw_validated != $hotspot_yaw_validate) {
761
- wp_send_json_error('<p><span>Warning:</span> Hotspot yaw can only contain float numbers.</p>');
762
  die();
763
  }
764
  }
@@ -767,7 +812,7 @@ class Wpvr_Ajax {
767
  $status = get_option( 'wpvr_edd_license_status' );
768
  if( $status !== false && $status == 'valid' ) {
769
  if ($hotspot_val["hotspot-customclass-pro"] != 'none' && !empty($hotspot_val["hotspot-customclass"])) {
770
- wp_send_json_error('<p><span>Warning:</span> Don\'t add Custom icon class and custom icon both.</p>');
771
  die();
772
  }
773
  }
@@ -777,7 +822,7 @@ class Wpvr_Ajax {
777
  if (!empty($hotspot_url_validate)) {
778
  $hotspot_url_validated = esc_url($hotspot_url_validate);
779
  if ($hotspot_url_validated != $hotspot_url_validate) {
780
- wp_send_json_error('<p><span>Warning:</span> Hotspot Url is invalid.</p>');
781
  die();
782
  }
783
  }
@@ -787,22 +832,22 @@ class Wpvr_Ajax {
787
 
788
  if ($hotspot_type_validate == "info") {
789
  if (!empty($hotspot_scene_validate)) {
790
- wp_send_json_error('<p><span>Warning:</span> Don\'t add Target Scene ID on info type hotspot.</p>');
791
  die();
792
  }
793
  if (!empty($hotspot_url_validate) && !empty($hotspot_content_validate)) {
794
- wp_send_json_error('<p><span>Warning:</span> Don\'t add Url and On click content both on same hotspot.</p>');
795
  die();
796
  }
797
  }
798
 
799
  if ($hotspot_type_validate == "scene") {
800
  if (empty($hotspot_scene_validate)) {
801
- wp_send_json_error('<p><span>Warning:</span> Target scene id is required for scene type hotspot.</p>');
802
  die();
803
  }
804
  if (!empty($hotspot_url_validate) || !empty($hotspot_content_validate)) {
805
- wp_send_json_error('<p><span>Warning:</span> Don\'t add Url or On click content on scene type hotspot.</p>');
806
  die();
807
  }
808
  }
@@ -813,14 +858,62 @@ class Wpvr_Ajax {
813
  }
814
  }
815
  //===Error Control and Validation===//
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
816
  foreach ($panodata["scene-list"] as $panoscenes) {
 
817
  if ($panoscenes['dscene'] == 'on') {
818
  $default_scene = $panoscenes['scene-id'];
819
  }
820
  }
821
  if (empty($default_scene)) {
822
- wp_send_json_error('<p><span>Warning:</span> Default scene is required. Set a scene as deafualt to load it by deafult.</p>');
823
- die();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
824
  }
825
 
826
  $panolength = count($panodata["scene-list"]);
95
  if (!empty($scene_id_validate)) {
96
  $scene_id_validated = preg_replace('/[^0-9a-zA-Z_]/',"",$scene_id_validate);
97
  if ($scene_id_validated != $scene_id_validate) {
98
+ wp_send_json_error('<p><span>Warning:</span> The scene id can only contain letters and numbers where scene id: '.$scene_id_validate.'</p>');
99
  die();
100
  }
101
  if (empty($scenes_val["scene-attachment-url"])) {
102
  // var_dump($scenes_val["scene-attachment-url"]);
103
+ wp_send_json_error('<p><span>Warning:</span> A scene image is required for every scene where scene id: '.$scene_id_validate.'</p>');
104
  die();
105
  }
106
 
108
  $validate_scene_pitch = $scenes_val["scene-pitch"];
109
  $validated_scene_pitch = preg_replace('/[^0-9.-]/','',$validate_scene_pitch);
110
  if ($validated_scene_pitch != $validate_scene_pitch) {
111
+ wp_send_json_error('<p><span>Warning:</span> Default pitch value can only contain float numbers where scene id: '.$scene_id_validate.'</p>');
112
  die();
113
  }
114
  }
117
  $validate_scene_yaw = $scenes_val["scene-yaw"];
118
  $validated_scene_yaw = preg_replace('/[^0-9.-]/','',$validate_scene_yaw);
119
  if ($validated_scene_yaw != $validate_scene_yaw) {
120
+ wp_send_json_error('<p><span>Warning:</span> Default yaw value can only contain float numbers where scene id: '.$scene_id_validate.'</p>');
121
  die();
122
  }
123
  }
126
  $validate_default_zoom = $scenes_val["scene-zoom"];
127
  $validated_default_zoom = preg_replace('/[^0-9-]/','',$validate_default_zoom);
128
  if ($validated_default_zoom != $validate_default_zoom) {
129
+ wp_send_json_error('<p><span>Warning:</span> Default zoom value can only contain number in degree from 50 to 120 where scene id: '.$scene_id_validate.'</p>');
130
  die();
131
  }
132
  $default_zoom_value = (int)$scenes_val["scene-zoom"];
133
  if ($default_zoom_value > 120 || $default_zoom_value < 50) {
134
+ wp_send_json_error('<p><span>Warning:</span> Default zoom value can only contain number in degree from 50 to 120 where scene id: '.$scene_id_validate.'</p>');
135
  die();
136
  }
137
  }
140
  $validate_max_zoom = $scenes_val["scene-maxzoom"];
141
  $validated_max_zoom = preg_replace('/[^0-9-]/','',$validate_max_zoom);
142
  if ($validated_max_zoom != $validate_max_zoom) {
143
+ wp_send_json_error('<p><span>Warning:</span> Max zoom out value can only contain number in degree where scene id: '.$scene_id_validate.'</p>');
144
  die();
145
  }
146
  $max_zoom_value = (int)$scenes_val["scene-maxzoom"];
147
  if ($max_zoom_value > 120 ) {
148
+ wp_send_json_error('<p><span>Warning:</span> Max zoom out value can only contain number in degree below 120 where scene id: '.$scene_id_validate.'</p>');
149
  die();
150
  }
151
  }
154
  $validate_min_zoom = $scenes_val["scene-minzoom"];
155
  $validated_min_zoom = preg_replace('/[^0-9-]/','',$validate_min_zoom);
156
  if ($validated_min_zoom != $validate_min_zoom) {
157
+ wp_send_json_error('<p><span>Warning:</span> Max zoom in value can only contain number in degree where scene id: '.$scene_id_validate.'</p>');
158
  die();
159
  }
160
  $min_zoom_value = (int)$scenes_val["scene-minzoom"];
161
  if ($min_zoom_value < 50 ) {
162
+ wp_send_json_error('<p><span>Warning:</span> Max zoom in value can only contain number in degree above 50 where scene id: '.$scene_id_validate.'</p>');
163
  die();
164
  }
165
  }
172
  if (!empty($hotspot_title_validate)) {
173
  $hotspot_title_validated = preg_replace('/[^0-9a-zA-Z_]/',"",$hotspot_title_validate);
174
  if ($hotspot_title_validated != $hotspot_title_validate) {
175
+ wp_send_json_error('<p><span>Warning:</span> Hotspot title can only contain letters and numbers where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
176
  die();
177
  }
178
 
180
  if (!empty($hotspot_pitch_validate)) {
181
  $hotspot_pitch_validated = preg_replace('/[^0-9.-]/','',$hotspot_pitch_validate);
182
  if ($hotspot_pitch_validated != $hotspot_pitch_validate) {
183
+ wp_send_json_error('<p><span>Warning:</span> Hotspot pitch can only contain float numbers where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
184
  die();
185
  }
186
  }
189
  if (!empty($hotspot_yaw_validate)) {
190
  $hotspot_yaw_validated = preg_replace('/[^0-9.-]/','',$hotspot_yaw_validate);
191
  if ($hotspot_yaw_validated != $hotspot_yaw_validate) {
192
+ wp_send_json_error('<p><span>Warning:</span> Hotspot yaw can only contain float numbers where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
193
  die();
194
  }
195
  }
198
  $status = get_option( 'wpvr_edd_license_status' );
199
  if( $status !== false && $status == 'valid' ) {
200
  if ($hotspot_val["hotspot-customclass-pro"] != 'none' && !empty($hotspot_val["hotspot-customclass"])) {
201
+ wp_send_json_error('<p><span>Warning:</span> Don\'t add Custom icon class and custom icon both where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
202
  die();
203
  }
204
  }
208
  if (!empty($hotspot_url_validate)) {
209
  $hotspot_url_validated = esc_url($hotspot_url_validate);
210
  if ($hotspot_url_validated != $hotspot_url_validate) {
211
+ 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>');
212
  die();
213
  }
214
  }
218
 
219
  if ($hotspot_type_validate == "info") {
220
  if (!empty($hotspot_scene_validate)) {
221
+ 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>');
222
  die();
223
  }
224
  if (!empty($hotspot_url_validate) && !empty($hotspot_content_validate)) {
225
+ wp_send_json_error('<p><span>Warning:</span> Don\'t add Url and On click content both on same hotspot where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
226
  die();
227
  }
228
  }
229
 
230
  if ($hotspot_type_validate == "scene") {
231
  if (empty($hotspot_scene_validate)) {
232
+ wp_send_json_error('<p><span>Warning:</span> Target scene id is required for scene type hotspot where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
233
  die();
234
  }
235
  if (!empty($hotspot_url_validate) || !empty($hotspot_content_validate)) {
236
+ 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>');
237
  die();
238
  }
239
  }
244
  }
245
  }
246
  //===Error Control and Validation===//
247
+ foreach ($panodata["scene-list"] as $panoscenes) {
248
+ if (empty($panoscenes['scene-id']) && !empty($panoscenes['scene-attachment-url'])) {
249
+ wp_send_json_error('<p><span>Warning:</span> You have added a scene image but empty scene id. Please add scene id and update </p>');
250
+ die();
251
+ }
252
+ }
253
+
254
+ $allsceneids = array();
255
+
256
+ foreach ($panodata["scene-list"] as $panoscenes) {
257
+ if (!empty($panoscenes['scene-id'])) {
258
+ array_push($allsceneids, $panoscenes['scene-id']);
259
+ }
260
+ }
261
 
262
  foreach ($panodata["scene-list"] as $panoscenes) {
263
 
266
  }
267
  }
268
  if (empty($default_scene)) {
269
+ if ($allsceneids) {
270
+ $default_scene = $allsceneids[0];
271
+ }
272
+ else {
273
+ 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>');
274
+ die();
275
+ }
276
+ }
277
+
278
+ $allsceneids_count = array_count_values($allsceneids);
279
+ foreach ($allsceneids_count as $key => $value) {
280
+ if ($value > 1) {
281
+ wp_send_json_error('<p><span>Warning:</span> You can not use same scene id on multiple scene </p>');
282
+ die();
283
+ }
284
+ }
285
+
286
+ foreach ($panodata["scene-list"] as $panoscenes) {
287
+ if (!empty($panoscenes['scene-id'])) {
288
+ $allhotspot = array();
289
+ foreach ($panoscenes["hotspot-list"] as $hotspot_val) {
290
+ if (!empty($hotspot_val["hotspot-title"])) {
291
+ array_push($allhotspot, $hotspot_val["hotspot-title"]);
292
+ }
293
+ }
294
+ $allhotspotcount = array_count_values($allhotspot);
295
+ foreach ($allhotspotcount as $key => $value) {
296
+ if ($value > 1) {
297
+ wp_send_json_error('<p><span>Warning:</span> You can not use same hotspot id on multiple hotspot for same scene </p>');
298
+ die();
299
+ }
300
+ }
301
+ }
302
  }
303
 
304
  $default_data = array();
702
  if (!empty($scene_id_validate)) {
703
  $scene_id_validated = preg_replace('/[^0-9a-zA-Z_]/',"",$scene_id_validate);
704
  if ($scene_id_validated != $scene_id_validate) {
705
+ wp_send_json_error('<p><span>Warning:</span> The scene id can only contain letters and numbers where scene id: '.$scene_id_validate.'</p>');
706
  die();
707
  }
708
 
709
  if (empty($scenes_val["scene-attachment-url"])) {
710
+ wp_send_json_error('<p><span>Warning:</span> A scene image is required for every scene where scene id: '.$scene_id_validate.'</p>');
711
  die();
712
  }
713
 
715
  $validate_scene_pitch = $scenes_val["scene-pitch"];
716
  $validated_scene_pitch = preg_replace('/[^0-9.-]/','',$validate_scene_pitch);
717
  if ($validated_scene_pitch != $validate_scene_pitch) {
718
+ wp_send_json_error('<p><span>Warning:</span> Default pitch value can only contain float numbers where scene id: '.$scene_id_validate.'</p>');
719
  die();
720
  }
721
  }
724
  $validate_scene_yaw = $scenes_val["scene-yaw"];
725
  $validated_scene_yaw = preg_replace('/[^0-9.-]/','',$validate_scene_yaw);
726
  if ($validated_scene_yaw != $validate_scene_yaw) {
727
+ wp_send_json_error('<p><span>Warning:</span> Default yaw value can only contain float numbers where scene id: '.$scene_id_validate.'</p>');
728
  die();
729
  }
730
  }
733
  $validate_default_zoom = $scenes_val["scene-zoom"];
734
  $validated_default_zoom = preg_replace('/[^0-9-]/','',$validate_default_zoom);
735
  if ($validated_default_zoom != $validate_default_zoom) {
736
+ wp_send_json_error('<p><span>Warning:</span> Default zoom value can only contain number in degree from 50 to 120 where scene id: '.$scene_id_validate.'</p>');
737
  die();
738
  }
739
  $default_zoom_value = (int)$scenes_val["scene-zoom"];
740
  if ($default_zoom_value > 120 || $default_zoom_value < 50) {
741
+ wp_send_json_error('<p><span>Warning:</span> Default zoom value can only contain number in degree from 50 to 120 where scene id: '.$scene_id_validate.'</p>');
742
  die();
743
  }
744
  }
747
  $validate_max_zoom = $scenes_val["scene-maxzoom"];
748
  $validated_max_zoom = preg_replace('/[^0-9-]/','',$validate_max_zoom);
749
  if ($validated_max_zoom != $validate_max_zoom) {
750
+ wp_send_json_error('<p><span>Warning:</span> Max zoom out value can only contain number in degree where scene id: '.$scene_id_validate.'</p>');
751
  die();
752
  }
753
  $max_zoom_value = (int)$scenes_val["scene-maxzoom"];
754
  if ($max_zoom_value > 120 ) {
755
+ wp_send_json_error('<p><span>Warning:</span> Max zoom out value can only contain number in degree below 120 where scene id: '.$scene_id_validate.'</p>');
756
  die();
757
  }
758
  }
761
  $validate_min_zoom = $scenes_val["scene-minzoom"];
762
  $validated_min_zoom = preg_replace('/[^0-9-]/','',$validate_min_zoom);
763
  if ($validated_min_zoom != $validate_min_zoom) {
764
+ wp_send_json_error('<p><span>Warning:</span> Max zoom in value can only contain number in degree where scene id: '.$scene_id_validate.'</p>');
765
  die();
766
  }
767
  $min_zoom_value = (int)$scenes_val["scene-minzoom"];
768
  if ($min_zoom_value < 50 ) {
769
+ wp_send_json_error('<p><span>Warning:</span> Max zoom in value can only contain number in degree above 50 where scene id: '.$scene_id_validate.'</p>');
770
  die();
771
  }
772
  }
779
  if (!empty($hotspot_title_validate)) {
780
  $hotspot_title_validated = preg_replace('/[^0-9a-zA-Z_]/',"",$hotspot_title_validate);
781
  if ($hotspot_title_validated != $hotspot_title_validate) {
782
+ wp_send_json_error('<p><span>Warning:</span> Hotspot title can only contain letters and numbers where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
783
  die();
784
  }
785
  $hotspot_pitch_validate = $hotspot_val["hotspot-pitch"];
786
  if (empty($hotspot_pitch_validate)) {
787
+ 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>');
788
  die();
789
  }
790
  if (!empty($hotspot_pitch_validate)) {
791
  $hotspot_pitch_validated = preg_replace('/[^0-9.-]/','',$hotspot_pitch_validate);
792
  if ($hotspot_pitch_validated != $hotspot_pitch_validate) {
793
+ wp_send_json_error('<p><span>Warning:</span> Hotspot pitch can only contain float numbers where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
794
  die();
795
  }
796
  }
797
 
798
  $hotspot_yaw_validate = $hotspot_val["hotspot-yaw"];
799
  if (empty($hotspot_yaw_validate)) {
800
+ 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>');
801
  die();
802
  }
803
  if (!empty($hotspot_yaw_validate)) {
804
  $hotspot_yaw_validated = preg_replace('/[^0-9.-]/','',$hotspot_yaw_validate);
805
  if ($hotspot_yaw_validated != $hotspot_yaw_validate) {
806
+ wp_send_json_error('<p><span>Warning:</span> Hotspot yaw can only contain float numbers where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
807
  die();
808
  }
809
  }
812
  $status = get_option( 'wpvr_edd_license_status' );
813
  if( $status !== false && $status == 'valid' ) {
814
  if ($hotspot_val["hotspot-customclass-pro"] != 'none' && !empty($hotspot_val["hotspot-customclass"])) {
815
+ wp_send_json_error('<p><span>Warning:</span> Don\'t add Custom icon class and custom icon both where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
816
  die();
817
  }
818
  }
822
  if (!empty($hotspot_url_validate)) {
823
  $hotspot_url_validated = esc_url($hotspot_url_validate);
824
  if ($hotspot_url_validated != $hotspot_url_validate) {
825
+ 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>');
826
  die();
827
  }
828
  }
832
 
833
  if ($hotspot_type_validate == "info") {
834
  if (!empty($hotspot_scene_validate)) {
835
+ 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>');
836
  die();
837
  }
838
  if (!empty($hotspot_url_validate) && !empty($hotspot_content_validate)) {
839
+ wp_send_json_error('<p><span>Warning:</span> Don\'t add Url and On click content both on same hotspot where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
840
  die();
841
  }
842
  }
843
 
844
  if ($hotspot_type_validate == "scene") {
845
  if (empty($hotspot_scene_validate)) {
846
+ wp_send_json_error('<p><span>Warning:</span> Target scene id is required for scene type hotspot where scene id: '.$scene_id_validate.' and hotspot id : '.$hotspot_title_validate.'</p>');
847
  die();
848
  }
849
  if (!empty($hotspot_url_validate) || !empty($hotspot_content_validate)) {
850
+ 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>');
851
  die();
852
  }
853
  }
858
  }
859
  }
860
  //===Error Control and Validation===//
861
+
862
+ foreach ($panodata["scene-list"] as $panoscenes) {
863
+ if (empty($panoscenes['scene-id']) && !empty($panoscenes['scene-attachment-url'])) {
864
+ wp_send_json_error('<p><span>Warning:</span> You have added a scene image but empty scene id. Please add scene id and update </p>');
865
+ die();
866
+ }
867
+ }
868
+
869
+ $allsceneids = array();
870
+
871
+ foreach ($panodata["scene-list"] as $panoscenes) {
872
+ if (!empty($panoscenes['scene-id'])) {
873
+ array_push($allsceneids, $panoscenes['scene-id']);
874
+ }
875
+ }
876
+
877
  foreach ($panodata["scene-list"] as $panoscenes) {
878
+
879
  if ($panoscenes['dscene'] == 'on') {
880
  $default_scene = $panoscenes['scene-id'];
881
  }
882
  }
883
  if (empty($default_scene)) {
884
+ if ($allsceneids) {
885
+ $default_scene = $allsceneids[0];
886
+ }
887
+ else {
888
+ 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>');
889
+ die();
890
+ }
891
+ }
892
+
893
+ $allsceneids_count = array_count_values($allsceneids);
894
+ foreach ($allsceneids_count as $key => $value) {
895
+ if ($value > 1) {
896
+ wp_send_json_error('<p><span>Warning:</span> You can not use same scene id on multiple scene </p>');
897
+ die();
898
+ }
899
+ }
900
+
901
+ foreach ($panodata["scene-list"] as $panoscenes) {
902
+ if (!empty($panoscenes['scene-id'])) {
903
+ $allhotspot = array();
904
+ foreach ($panoscenes["hotspot-list"] as $hotspot_val) {
905
+ if (!empty($hotspot_val["hotspot-title"])) {
906
+ array_push($allhotspot, $hotspot_val["hotspot-title"]);
907
+ }
908
+ }
909
+ $allhotspotcount = array_count_values($allhotspot);
910
+ foreach ($allhotspotcount as $key => $value) {
911
+ if ($value > 1) {
912
+ wp_send_json_error('<p><span>Warning:</span> You can not use same hotspot id on multiple hotspot for same scene </p>');
913
+ die();
914
+ }
915
+ }
916
+ }
917
  }
918
 
919
  $panolength = count($panodata["scene-list"]);
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: 2.7.0
20
  * Author: Rextheme
21
  * Author URI: http://rextheme.com/
22
  * License: GPL-2.0+
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: 2.8.0
20
  * Author: Rextheme
21
  * Author URI: http://rextheme.com/
22
  * License: GPL-2.0+