PluginProbe
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress / 9.2.0
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress v9.2.0
9.2.0 9.1.4 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 All 224 releases
wpvr / legacy / admin / classes / class-wpvr-hotspot.php

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

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