PluginProbe
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress / 8.5.35
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress v8.5.35
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 8.5.4 All 221 releases
wpvr / admin / classes / class-wpvr-hotspot.php

class-wpvr-hotspot.php in WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress 8.5.35, at admin/classes/class-wpvr-hotspot.php

199 lines 6.6 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 * Responsible for managing Hotspot tab content on Setup meta box
5 *
6 * @link http://rextheme.com/
7 * @since 1.0.0
8 *
9 * @package Wpvr
10 * @subpackage Wpvr/admin/classes
11 */
12
13 class WPVR_Hotspot {
14
15 function __construct()
16 {
17 /**
18 * TODO hotspot setting class initiate
19 */
20 }
21
22 /**
23 * Render hotspot for default repeater item
24 *
25 * @param $s value of scene html id
26 * @param $h value of hotspot html id
27 *
28 * @return void
29 * @since 8.0.0
30 */
31 public function render_hotspot($s, $h)
32 {
33 ob_start();
34 ?>
35
36 <nav class="rex-pano-tab-nav rex-pano-nav-menu hotspot-nav">
37 <?php $this->render_hotspot_nav($s, $h); ?>
38 </nav>
39
40 <div data-repeater-list="hotspot-list" class="rex-pano-tab-content">
41 <div data-repeater-item class="single-hotspot rex-pano-tab active clearfix" id="scene-<?php echo $s; ?>-hotspot-<?php echo $h; ?>">
42 <?php $this->render_hotspot_repeater_item(); ?>
43 </div>
44 </div>
45
46 <?php
47 ob_end_flush();
48 }
49
50 /**
51 * Render hotspot which has panaromic data
52 *
53 * @param array $pano_hotspots value of hotspot list
54 * @param $s value of scene html id
55 *
56 * @return void
57 * @since 8.0.0
58 */
59 public function render_hotspot_with_panodata($pano_hotspots, $s)
60 {
61 ob_start();
62 ?>
63 <nav class="rex-pano-tab-nav rex-pano-nav-menu hotspot-nav">
64 <?php $this->render_hotspot_nav_with_panodata($pano_hotspots, $s); ?>
65 </nav>
66
67 <div data-repeater-list="hotspot-list" class="rex-pano-tab-content">
68 <?php $this->render_hotspot_repeater_item_with_panodata($pano_hotspots, $s); ?>
69 </div>
70 <?php
71 ob_end_flush();
72 }
73
74
75 /**
76 * Render hotspot nav for default scene
77 *
78 * @param int $s
79 * @param int $h
80 *
81 * @return void
82 * @since 8.0.0
83 */
84 private function render_hotspot_nav($s, $h)
85 {
86 ob_start();
87 ?>
88 <ul>
89 <li class="active"><span data-index="1" data-href="#scene-<?php echo $s; ?>-hotspot-<?php echo $h; ?>"><i class="far fa-dot-circle"></i></span></li>
90 <li class="add" data-repeater-create><span><i class="fa fa-plus-circle"></i> </span></li>
91 </ul>
92 <?php
93 ob_end_flush();
94 }
95
96
97 /**
98 * Render hotspot repeater item for default scene
99 *
100 * @return void
101 * @since 8.0.0
102 */
103 private function render_hotspot_repeater_item()
104 {
105 $postdata = WPVR_Meta_Field::get_primary_meta_fields();
106 $pano_hotspot = $postdata['panodata']['scene-list'][0]['hotspot-list'][0];
107 ob_start();
108 ?>
109 <h6 class="title"><i class="fa fa-cog"></i> <?php echo __('Hotspot Settings','wpvr') ?> </h6>
110
111 <div class="wrapper">
112 <?php WPVR_Meta_Field::render_hotspot_setting_left_fields($pano_hotspot); ?>
113 </div>
114
115 <div class="hotspot-type hotspot-setting">
116 <?php WPVR_Meta_Field::render_hotspot_setting_right_fields(); ?>
117 </div>
118 <!-- Hotspot type End -->
119 <button data-repeater-delete title="Delete Hotspot" type="button" class="delete-hotspot"><i class="far fa-trash-alt"></i></button>
120 <?php
121 ob_end_flush();
122 }
123
124
125 /**
126 * Render hotspot nav if scene has hotspot data
127 *
128 * @param array $pano_hotspots
129 * @param int $s
130 *
131 * @return void
132 * @since 8.0.0
133 */
134 private function render_hotspot_nav_with_panodata($pano_hotspots, $s)
135 {
136 ob_start();
137 ?>
138 <ul>
139 <?php $j = 1;
140
141 $firstvaluehotspot = reset($pano_hotspots);
142 foreach ($pano_hotspots as $pano_hotspot) { ?>
143 <li class="<?php if($pano_hotspot['hotspot-title'] == $firstvaluehotspot['hotspot-title']) { echo 'active'; } ?>"><span data-index="<?php echo $j;?>" data-href="#scene-<?php echo $s;?>-hotspot-<?php echo $j;?>"><i class="far fa-dot-circle"></i></span></li>
144 <?php $j++; } ?>
145 <li class="add" data-repeater-create><span><i class="fa fa-plus-circle"></i></span></li>
146 </ul>
147 <?php
148 ob_end_flush();
149 }
150
151
152 /**
153 * Render hotspot repeater item if scene has panodata
154 *
155 * @param array $pano_hotspots
156 * @param int $s
157 *
158 * @return void
159 * @since 8.0.0
160 */
161 private function render_hotspot_repeater_item_with_panodata($pano_hotspots, $s)
162 {
163 $h = 1;
164 $firstvaluehotspotset = reset($pano_hotspots);
165 $is_wpvr_premium = apply_filters('is_wpvr_premium', false);
166 foreach ($pano_hotspots as $pano_hotspot) { ob_start(); ?>
167 <div data-repeater-item class="single-hotspot rex-pano-tab clearfix <?php if($pano_hotspot['hotspot-title'] == $firstvaluehotspotset['hotspot-title']) { echo 'active'; } ?>" id="scene-<?php echo $s;?>-hotspot-<?php echo $h;?>">
168
169 <h6 class="title"><i class="fa fa-cog"></i> <?php echo __('Hotspot Settings','wpvr') ?> </h6>
170
171 <div class="wrapper">
172 <?php WPVR_Meta_Field::render_hotspot_setting_left_fields($pano_hotspot); ?>
173 </div>
174
175 <!-- Hotspot type -->
176
177 <?php if ($pano_hotspot['hotspot-type'] == "info") { ?>
178 <div class="hotspot-type hotspot-setting">
179 <?php WPVR_Meta_Field::render_hotspot_setting_info_fields($pano_hotspot); ?>
180 </div>
181 <?php }elseif($pano_hotspot['hotspot-type'] == "fluent_form" && $is_wpvr_premium == 1){ ?>
182 <div class="hotspot-type hotspot-setting">
183 <?php WPVR_Meta_Field::render_hotspot_setting_fluent_form_fields($pano_hotspot); ?>
184 </div>
185 <?php }elseif($pano_hotspot['hotspot-type'] == "wc_product" && $is_wpvr_premium == 1){ ?>
186 <div class="hotspot-type hotspot-setting">
187 <?php WPVR_Meta_Field::render_hotspot_setting_wc_product_fields($pano_hotspot); ?>
188 </div>
189 <?php } else { ?>
190 <div class="hotspot-type hotspot-setting">
191 <?php WPVR_Meta_Field::render_hotspot_setting_scene_fields($pano_hotspot); ?>
192 </div>
193 <?php } ?>
194 <!-- Hotspot type End -->
195 <button data-repeater-delete type="button" title="Delete Hotspot" class="delete-hotspot"><i class="far fa-trash-alt"></i></button>
196 </div>
197 <?php ob_end_flush(); $h++; }
198 }
199 }