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

class-setup-meta-box.php in WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress 9.1.3, at legacy/admin/classes/class-setup-meta-box.php

268 lines 10.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) exit; // Exit if accessed directly
3 /**
4 * Setup meta box related functionalities
5 *
6 * @link http://rextheme.com/
7 * @since 8.0.0
8 *
9 * @package Wpvr
10 * @subpackage Wpvr/admin/classes
11 */
12
13 class WPVR_Setup_Meta_Box extends WPVR_Meta_Box {
14
15 /**
16 * @var string
17 * @since 8.0.0
18 */
19 protected $title = '';
20
21 /**
22 * Metabox ID
23 *
24 * @var string
25 * @since 8.0.0
26 */
27 protected $slug = '';
28
29 /**
30 * @var string
31 * @since 8.0.0
32 */
33 protected $post_type = '';
34
35 /**
36 * Metabox context
37 *
38 * @var string
39 * @since 8.0.0
40 */
41 protected $context = '';
42
43 /**
44 * Metabox priority
45 *
46 * @var string
47 * @since 8.0.0
48 */
49 protected $priority = '';
50
51 /**
52 * Instance of WPVR_Scene class
53 *
54 * @var object
55 * @since 8.0.0
56 */
57 protected $scene;
58
59 /**
60 * Instance of WPVR_Video class
61 *
62 * @var object
63 * @since 8.0.0
64 */
65 protected $video;
66
67 /**
68 * Instance of WPVR_General class
69 *
70 * @var object
71 * @since 8.0.0
72 */
73 protected $general;
74
75
76 public function __construct( $slug, $title, $post_type, $context, $priority ) {
77 if( $slug == '' || $context == '' || $priority == '' ) {
78 return;
79 }
80
81 if( $title == '' ) {
82 $this->title = ucfirst( $slug );
83 }
84
85 if( empty( $post_type ) ) {
86 return;
87 }
88
89 $this->title = $title;
90 $this->slug = $slug;
91 $this->post_type = $post_type;
92 $this->context = $context;
93 $this->priority = $priority;
94
95 $this->scene = new WPVR_Scene();
96 $this->video = new WPVR_Video();
97 $this->general = new WPVR_General();
98
99 add_action( 'add_meta_boxes', array( $this, 'register' ) );
100 }
101
102
103 /**
104 * Register custom meta box
105 *
106 * @param string $post_type
107 *
108 * @return void
109 * @since 8.0.0
110 */
111 public function register( $post_type ) {
112 if ( $post_type == $this->post_type ) {
113 add_meta_box( $this->slug, $this->title, array( $this, 'render' ), $post_type, $this->context, $this->priority );
114 }
115 }
116
117
118 /**
119 * Render custom meta box
120 *
121 * @param object $post
122 *
123 * @return void
124 * @since 8.0.0
125 */
126 public function render( $post ) {
127
128 $primary = WPVR_Meta_Field::get_primary_meta_fields();
129 $post_meta_data = get_post_meta($post->ID, 'panodata', true);
130 $post_meta_data = (is_array($post_meta_data)) ? $post_meta_data : array($post_meta_data);
131
132 $postdata = array_merge($primary, $post_meta_data);
133 // active tab variables
134 $active_tab = 'scene';
135 if ( ( isset( $postdata['tour-type'] ) && $postdata['tour-type'] === 'video' ) || ! empty( $postdata['vidid'] ) || ! empty( $postdata['vidurl'] ) ) {
136 $active_tab = 'video';
137 }
138 $scene_active_tab = 1;
139 $hotspot_active_tab = 1;
140 if (isset($_GET['active_tab'])) {
141 $active_tab = sanitize_text_field(wp_unslash($_GET['active_tab'])); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
142 }
143 if (isset($_GET['scene'])) {
144 $scene_active_tab = sanitize_text_field(wp_unslash($_GET['scene'])); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
145 }
146 if (isset($_GET['hotspot'])) {
147 $hotspot_active_tab = sanitize_text_field(wp_unslash($_GET['hotspot'])); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
148 }
149
150 // Start custom meta box rendering
151 ob_start();
152
153 ?>
154
155 <div class="pano-setup">
156
157 <input type="hidden" value="<?php echo esc_attr($active_tab);?>" name="wpvr_active_tab" id="wpvr_active_tab"/>
158 <input type="hidden" value="<?php echo esc_attr($scene_active_tab);?>" name="wpvr_active_scenes" id="wpvr_active_scenes"/>
159 <input type="hidden" value="<?php echo esc_attr($hotspot_active_tab);?>" name="wpvr_active_hotspot" id="wpvr_active_hotspot"/>
160
161 <!-- start rex-pano-tabs -->
162 <div class="rex-pano-tabs">
163
164 <?php WPVR_Meta_Field::render_pano_tab_nav($postdata); ?>
165 <!-- start rex-pano-tab-content -->
166 <div class="rex-pano-tab-content" id="wpvr-main-tab-contents">
167
168 <!-- start scenes tab -->
169 <div class="rex-pano-tab wpvr_scene active" id="scenes">
170 <?php
171 $this->scene->render_scene($postdata);
172 ?>
173 </div>
174
175 <!-- start general tab -->
176 <div class="rex-pano-tab general" id="general">
177 <?php
178 $this->general->render_setting($postdata);
179 ?>
180 </div>
181
182 <!-- start video tab content -->
183 <div class="rex-pano-tab video" id="video">
184 <?php
185 $this->video->render_video($postdata);
186 ?>
187 </div>
188
189 <!-- This hook will render floor plan tab content -->
190 <?php do_action( 'include_floor_plan_meta_content', $postdata )?>
191
192 <!-- This hook will render background Tour tab content -->
193 <?php do_action( 'include_background_tour_meta_content', $postdata )?>
194
195 <!-- This hook will render Street View tab content -->
196 <?php do_action( 'include_street_view_meta_content', $postdata )?>
197
198 <?php do_action( 'include_export_meta_content', $postdata, $post )?>
199
200 </div>
201 <!-- end rex-pano-tab-content -->
202 </div>
203 <!-- end rex-pano-tabs -->
204
205 <div class="wpvr-help-resource">
206 <div class="wpvr-help-resource__playlist">
207 <span class="wpvr-help-resource__video-section">
208 <svg class="wpvr-help-resource__video-icon" xmlns="http://www.w3.org/2000/svg" width="13" height="14" viewBox="0 0 13 14" fill="none">
209 <path d="M11.2225 6.51521L11.2244 6.5163C11.59 6.73102 11.5918 7.26492 11.2235 7.4819L11.2227 7.4824L1.59806 13.1697L1.59703 13.1703C1.22418 13.3914 0.75 13.1232 0.75 12.6861V1.30884C0.75 1.03617 0.875311 0.890942 1.03011 0.814073C1.21377 0.722878 1.43862 0.731136 1.59792 0.825199C1.59797 0.825226 1.59802 0.825253 1.59806 0.82528L11.2225 6.51521Z" stroke="#73707D" stroke-width="1.5"/>
210 </svg>
211 <p class="wpvr-help-resource__video-title"><?php esc_html_e('Video', 'wpvr') ?></p>
212 </span>
213 </div>
214
215 <div class="wpvr-help-resource__dropdown">
216 <div class="wpvr-help-resource__dropdown-section" id="wpvr-help-resource__dropdown-section">
217 <svg width="12" height="18" fill="none" viewBox="0 0 12 18" class="wpvr-help-resource__dropdown-icon">
218 <path fill="#7A8B9A" d="M5.438 13.604a.646.646 0 01-.646-.647c0-.846.12-1.576.358-2.19.176-.464.46-.93.851-1.402.288-.344.804-.845 1.55-1.503.747-.659 1.232-1.183 1.456-1.574a2.53 2.53 0 00.335-1.282c0-.839-.328-1.574-.982-2.209-.654-.635-1.456-.952-2.407-.952-.918 0-1.685.288-2.299.863-.449.42-.786 1.013-1.01 1.779a1.121 1.121 0 01-1.209.796A1.122 1.122 0 01.49 3.854c.302-1.023.808-1.848 1.518-2.474C2.993.507 4.296.072 5.918.072c1.715 0 3.084.467 4.107 1.401 1.022.935 1.532 2.064 1.532 3.39 0 .766-.18 1.473-.539 2.118-.358.647-1.062 1.433-2.107 2.36-.702.622-1.161 1.082-1.377 1.377a3.05 3.05 0 00-.48 1.018c-.076.284-.129.702-.158 1.25a.652.652 0 01-.65.617h-.808v.001zM4.672 16.7a1.228 1.228 0 112.455 0 1.228 1.228 0 01-2.455 0z"></path>
219 </svg>
220 </div>
221
222 <ul class="wpvr-help-resource__dropdown-list" id="wpvr-help-resource__dropdown-list">
223 <li class="wpvr-help-resource__dropdown-item"><a target="_blank" href="https://rextheme.com/docs-category/wp-vr/" class="wpvr-help-resource__dropdown-link">Documentation</a></li>
224 <!-- <li class="wpvr-help-resource__dropdown-item"><a target="_blank" href="#" class="wpvr-help-resource__dropdown-link">Social Group</a></li> -->
225 <li class="wpvr-help-resource__dropdown-item"><a target="_blank" href="https://www.youtube.com/watch?v=aNwB066MYko&list=PLelDqLncNWcUndi1NkXJh2BH62OYmIayt&ab_channel=RexTheme" class="wpvr-help-resource__dropdown-link">YouTube Video</a></li>
226 </ul>
227 </div>
228
229 </div>
230
231 <!-- End Help Resource -->
232
233 <div class="wpvr-iframe-modal">
234 <div class="wpvr-iframe-modal__content">
235 <span type="button" class="wpvr-iframe-modal__cross-icon">
236 <svg width="10" height="10" fill="none" viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg">
237 <path fill="#686f7f" d="M.948 9.995a.94.94 0 01-.673-.23.966.966 0 010-1.352L8.317.278a.94.94 0 011.339.045c.323.35.342.887.044 1.258L1.611 9.765a.94.94 0 01-.663.23z"></path>
238 <path fill="#686f7f" d="M8.98 9.995a.942.942 0 01-.664-.278L.275 1.582A.966.966 0 01.378.23a.939.939 0 011.232 0L9.7 8.366a.966.966 0 010 1.399.94.94 0 01-.72.23z"></path>
239 </svg>
240 </span>
241
242 <iframe
243 class="video-link"
244 width="560"
245 height="315"
246 src="https://www.youtube.com/embed/kKHUlVKtesQ"
247 title="YouTube video player"
248 frameborder="0"
249 allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
250 id ="wpvr-help-video-iframe"
251 allowfullscreen>
252 </iframe>
253
254
255 </div>
256 </div>
257
258
259
260 </div>
261 <div class="wpvr-loading" style="display:none;">Loading&#8230;</div>
262
263 <?php
264 // ob_end_flush();
265 // End custom meta box rendering
266 }
267
268 }