PluginProbe
Responsive Menu – Create Mobile-Friendly Menu / 4.7.4
Responsive Menu – Create Mobile-Friendly Menu v4.7.4
4.7.4 4.7.3 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.10 4.1.11 4.1.12 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 All 91 releases
responsive-menu / v4.0.0 / inc / classes / class-ui-manager.php

class-ui-manager.php in Responsive Menu – Create Mobile-Friendly Menu 4.7.4, at v4.0.0/inc/classes/class-ui-manager.php

290 lines 6.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * This file contain thh UI_Manager class and it's functionalities.
4 *
5 * @version 4.0.0
6 *
7 * @author Expresstech System
8 *
9 * @package responsive-menu
10 */
11
12 namespace RMP\Features\Inc;
13
14 use RMP\Features\Inc\Control_Manager;
15 use RMP\Features\Inc\Traits\Singleton;
16
17 // Disable the direct access to this class.
18 if ( ! defined( 'ABSPATH' ) ) {
19 exit;
20 }
21
22 /**
23 * Class UI_Manager
24 * This class is responsible for provide the UI.
25 *
26 * @version 4.0.0
27 */
28 class UI_Manager {
29
30 use Singleton;
31
32 /**
33 * Instance of this control manager class.
34 *
35 * @since 4.0.0
36 * @access protected
37 * @var object.
38 */
39
40 protected $control_manager;
41
42 protected $pro_plugin_url = 'https://responsive.menu/pricing?utm_source=free-plugin&utm_medium=option&utm_campaign=hide_on_mobile';
43
44 /**
45 * Construct method.
46 */
47 protected function __construct() {
48 $this->setup_hooks();
49 }
50
51 /**
52 * To setup action/filter.
53 *
54 * @version 4.0.0
55 *
56 * @return void
57 */
58 protected function setup_hooks() {
59 $this->control_manager = Control_Manager::get_instance();
60 }
61
62 public function accordion_divider() {
63 ?>
64 <div class="rmp-h-separator clearfix"></div>
65 <?php
66 }
67
68
69 public function start_accordion_item( $accordion_attr ) {
70 if ( empty( $accordion_attr ) ) {
71 return;
72 }
73
74 $item_class = '';
75 if ( ! empty( $accordion_attr['item_class'] ) ) {
76 $item_class = $accordion_attr['item_class'];
77 }
78 ?>
79 <li class="rmp-accordion-item <?php echo esc_attr( $item_class ); ?>">
80 <?php
81
82 // According header.
83 if ( ! empty( $accordion_attr['item_header'] ) ) {
84 $title_class = '';
85 if ( ! empty( $accordion_attr['item_header']['title_class'] ) ) {
86 $title_class = $accordion_attr['item_header']['title_class'];
87 }
88 ?>
89 <div class="rmp-accordion-title <?php echo esc_attr( $title_class ); ?>">
90 <?php
91
92 $title_span_class = 'accordion-item-title ';
93 if ( ! empty( $accordion_attr['item_header']['title_span_class'] ) ) {
94 $title_span_class = $accordion_attr['item_header']['title_span_class'];
95 }
96
97 $title_contents = '';
98 if ( ! empty( $accordion_attr['item_header']['item_title'] ) ) {
99 ?>
100 <span class="<?php echo esc_attr( $title_span_class ); ?>">
101 <?php
102 echo esc_html( $accordion_attr['item_header']['item_title'] );
103 // Check tooltip text is added or not.
104 if ( ! empty( $accordion_attr['tool_tip'] ) ) {
105 $this->control_manager->get_tool_tip( $accordion_attr['tool_tip'] );
106 }
107
108 // Check feature type.
109 if ( ! empty( $accordion_attr['feature_type'] ) ) {
110 ?>
111 <a target="_blank" rel="noopener" class="upgrade-tooltip" href="<?php echo esc_url( $this->pro_plugin_url ); ?>" >
112 <?php echo esc_html( $accordion_attr['feature_type'] ); ?>
113 </a>
114 <?php
115 }
116 ?>
117 </span>
118 <?php
119 }
120
121 if ( ! empty( $accordion_attr['item_header']['item_control']['switcher'] ) ) {
122 ?>
123 <span class="item-controls">
124 <input type="hidden" value="off" name="<?php echo esc_attr( $accordion_attr['item_header']['item_control']['name'] ); ?>"/>
125 <input type="checkbox" id="<?php echo esc_attr( $accordion_attr['item_header']['item_control']['id'] ); ?>" name="<?php echo esc_attr( $accordion_attr['item_header']['item_control']['name'] ); ?>" class="toggle <?php echo esc_attr( $accordion_attr['item_header']['item_control']['class'] ); ?>" value="on" <?php esc_attr( $accordion_attr['item_header']['item_control']['is_checked'] ); ?>>',
126 </span>
127 <?php
128 }
129 ?>
130 </div>
131 <?php
132 }
133
134 // If self_close_item is true then avoid contents for this accordion item and close it.
135 if ( ! empty( $accordion_attr['self_close_item'] ) ) {
136 ?>
137 </li>
138 <?php
139 return;
140 }
141
142 // Accordion contents start.
143 $content_class = '';
144 if ( ! empty( $accordion_attr['item_content']['content_class'] ) ) {
145 $content_class = $accordion_attr['item_content']['content_class'];
146 }
147 ?>
148 <div class="rmp-accordion-content rmp-menu-controls <?php echo esc_attr( $content_class ); ?>">
149 <?php
150 }
151
152 public function end_accordion_item() {
153 // Accordion contents end.
154 ?>
155 </div></li>
156 <?php
157 }
158
159
160 public function add_editor_menu_item( $tab_attr ) {
161 if ( empty( $tab_attr ) ) {
162 return;
163 }
164
165 global $wp_filesystem;
166 if ( empty( $wp_filesystem ) ) {
167 require_once ABSPATH . 'wp-admin/includes/file.php';
168 }
169 WP_Filesystem();
170
171 $item_class = '';
172 if ( ! empty( $tab_attr['item_class'] ) ) {
173 $item_class = $tab_attr['item_class'];
174 }
175
176 $aria_owns = '';
177 if ( ! empty( $tab_attr['aria_owns'] ) ) {
178 $aria_owns = $tab_attr['aria_owns'];
179 }
180 ?>
181 <li class="rmp-tab-item <?php echo esc_attr( $item_class ); ?>" aria-owns="<?php echo esc_attr( $aria_owns ); ?>">
182 <?php
183
184 // Item header.
185 if ( ! empty( $tab_attr['item_header'] ) ) {
186 $title_class = '';
187 if ( ! empty( $tab_attr['item_header']['title_class'] ) ) {
188 $title_class = $tab_attr['item_header']['title_class'];
189 }
190
191 // Item icon.
192 if ( ! empty( $tab_attr['item_header']['item_svg_icon'] ) ) {
193 ?>
194 <span class="rmp-tab-item-icon">
195 <?php
196 $svg_icon = $wp_filesystem->get_contents( $tab_attr['item_header']['item_svg_icon'] );
197 if ( $svg_icon ) {
198 echo wp_kses( $svg_icon, rmp_allow_svg_html_tags() );
199 }
200 ?>
201 </span>
202 <?php
203 }
204 ?>
205 <h3 class="rmp-tab-item-title <?php echo esc_attr( $title_class ); ?>">
206 <?php
207 if ( ! empty( $tab_attr['item_header']['item_title'] ) ) {
208 ?>
209 <span class="<?php echo esc_attr( $title_class ); ?>">
210 <?php echo esc_html( $tab_attr['item_header']['item_title'] ); ?>
211 </span>
212 <?php
213 }
214 ?>
215 </h3>
216 <?php
217 }
218 ?>
219 </li>
220 <?php
221 }
222
223 public function start_tabs_controls_panel( $param ) {
224 $items_count = 2;
225 if ( ! empty( $param['tab_items'] ) ) {
226 $items_count = count( $param['tab_items'] );
227 }
228 ?>
229 <div class="tabs <?php echo esc_attr( $param['tab_classes'] ); ?>">
230 <ul class="nav-tab-wrapper rmp-tab-items rmp-tab-items-<?php echo esc_attr( $items_count ); ?>" >
231 <?php
232
233 foreach ( $param['tab_items'] as $tab_item ) {
234 ?>
235 <li>
236 <a class="nav-tab <?php echo esc_attr( $tab_item['item_class'] ); ?>" href="#<?php echo esc_attr( $tab_item['item_target'] ); ?>">
237 <?php echo esc_html( $tab_item['item_text'] ); ?>
238 </a>
239 </li>
240 <?php
241 }
242 ?>
243 </ul>
244 <?php
245 }
246
247 public function end_tabs_controls_panel() {
248 ?>
249 </div>
250 <?php
251 }
252
253
254 public function start_tab_item( $param ) {
255 ?>
256 <div id="<?php echo esc_attr( $param['item_id'] ); ?>" class="<?php echo esc_attr( $param['item_class'] ); ?>">
257 <?php
258 }
259
260 public function end_tab_item() {
261 ?>
262 </div>
263 <?php
264 }
265
266 public function start_group_controls() {
267 ?>
268 <div class="rmp-input-control-group">
269 <?php
270 }
271
272 public function end_group_controls() {
273 ?>
274 </div>
275 <?php
276 }
277
278 public function start_sub_accordion() {
279 ?>
280 <ul class="rmp-sub-accordion-container">
281 <?php
282 }
283
284 public function end_sub_accordion() {
285 ?>
286 </ul>
287 <?php
288 }
289 }
290