PluginProbe ʕ •ᴥ•ʔ
Spider Elements – Premium Elementor Widgets & Addons Library / 1.5.0
Spider Elements – Premium Elementor Widgets & Addons Library v1.5.0
trunk 1.0.0 1.1.0 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.7.0 1.8.0 1.9.0
spider-elements / widgets / Pricing_Table_Tabs.php
spider-elements / widgets Last commit date
templates 1 year ago Accordion.php 1 year ago Alerts_Box.php 1 year ago Animated_Heading.php 1 year ago Before_after.php 1 year ago Blog_Grid.php 1 year ago Buttons.php 1 year ago Cheat_sheet.php 1 year ago Counter.php 1 year ago Fullscreen_Slider.php 1 year ago Icon_box.php 1 year ago Instagram.php 1 year ago Integrations.php 1 year ago List_Item.php 1 year ago Pricing_Table_Switcher.php 1 year ago Pricing_Table_Tabs.php 1 year ago Tabs.php 1 year ago Team_Carousel.php 1 year ago Testimonial.php 1 year ago Timeline.php 1 year ago Video_Playlist.php 1 year ago Video_Popup.php 1 year ago
Pricing_Table_Tabs.php
404 lines
1 <?php
2
3 namespace SPEL\Widgets;
4
5 use Elementor\Group_Control_Background;
6 use Elementor\Repeater;
7 use Elementor\Widget_Base;
8 use Elementor\Controls_Manager;
9 use Elementor\Group_Control_Typography;
10
11 // Exit if accessed directly
12 if (!defined('ABSPATH')) {
13 exit;
14 }
15
16 /**
17 * Class Pricing_Table_Tabs
18 */
19 class Pricing_Table_Tabs extends Widget_Base
20 {
21 public function get_name ()
22 {
23 return 'landpagy_pricing_table_tabs'; // ID of the widget (Don't change this name)
24 }
25
26 public function get_title ()
27 {
28 return esc_html__('Pricing Table Tabs', 'spider-elements');
29 }
30
31 public function get_icon ()
32 {
33 return 'eicon-price-table spel-icon';
34 }
35
36 public function get_keywords ()
37 {
38 return [ 'spider', 'spider elements', 'pricing', 'table', 'tabs' ];
39 }
40
41 public function get_categories ()
42 {
43 return [ 'spider-elements' ];
44 }
45
46 /**
47 * Name: get_style_depends()
48 * Desc: Register the required CSS dependencies for the frontend.
49 */
50 public function get_style_depends ()
51 {
52 return [ 'spel-main' ];
53 }
54
55 /**
56 * Name: get_script_depends()
57 * Desc: Register the required JS dependencies for the frontend.
58 */
59 public function get_script_depends ()
60 {
61 return [ 'spel-el-widgets' ];
62 }
63
64 /**
65 * Name: register_controls()
66 * Desc: Register controls for these widgets
67 * Params: no params
68 * Return: @void
69 * Since: @1.0.0
70 * Package: @spider-elements
71 * Author: spider-themes
72 */
73 protected function register_controls ()
74 {
75 $this->elementor_content_control();
76 $this->elementor_style_control();
77 }
78
79 /**
80 * Name: elementor_content_control()
81 * Desc: Register the Content Tab output on the Elementor editor.
82 * Params: no params
83 * Return: @void
84 * Since: @1.0.0
85 * Package: @spider-elements
86 * Author: spider-themes
87 */
88 public function elementor_content_control ()
89 {
90
91 // ------------------------------------------- Pricing Table Tabs ----------------------------------------- //
92 $this->start_controls_section(
93 'pricing_table_tabs', [
94 'label' => esc_html__('Pricing Tables', 'spider-elements'),
95 ]
96 );
97
98 $repeater = new Repeater();
99 $repeater->add_control(
100 'is_active',
101 [
102 'label' => esc_html__('Active Table', 'spider-elements'),
103 'type' => Controls_Manager::SWITCHER,
104 'return_value' => 'yes',
105 'default' => 'no',
106 ]
107 );
108
109 $repeater->add_control(
110 'tab_title', [
111 'label' => esc_html__('Tab Title', 'spider-elements'),
112 'type' => Controls_Manager::TEXT,
113 'separator' => 'after'
114 ]
115 );
116
117 $repeater->add_control(
118 'discount', [
119 'label' => esc_html__('Discount Badge', 'spider-elements'),
120 'type' => Controls_Manager::TEXT,
121 ]
122 );
123
124 $repeater->add_control(
125 'title', [
126 'label' => esc_html__('Title', 'spider-elements'),
127 'type' => Controls_Manager::TEXT,
128 'default' => 'Free'
129 ]
130 );
131
132 $repeater->add_control(
133 'price_dollar', [
134 'label' => esc_html__('Price USD', 'spider-elements'),
135 'type' => Controls_Manager::TEXT,
136 'default' => '$5'
137 ]
138 );
139
140 $repeater->add_control(
141 'price_euro', [
142 'label' => esc_html__('Price EURO', 'spider-elements'),
143 'type' => Controls_Manager::TEXT,
144 'default' => '€4.43'
145 ]
146 );
147
148 $repeater->add_control(
149 'duration', [
150 'label' => esc_html__('Duration', 'spider-elements'),
151 'type' => Controls_Manager::TEXT,
152 'default' => '/user/mo'
153 ]
154 );
155
156 $repeater->add_control(
157 'description', [
158 'label' => esc_html__('Description', 'spider-elements'),
159 'type' => Controls_Manager::TEXT,
160 'label_block' => true,
161 'default' => '1 user'
162 ]
163 );
164
165 $repeater->add_control(
166 'contents', [
167 'label' => esc_html__('Contents', 'spider-elements'),
168 'type' => Controls_Manager::WYSIWYG,
169 ]
170 );
171
172 $repeater->add_control(
173 'btn_group_heading', [
174 'label' => esc_html__('Button Group', 'spider-elements'),
175 'type' => Controls_Manager::HEADING,
176 'separator' => 'before'
177 ]
178 );
179
180 $repeater->add_control(
181 'btn_label_1', [
182 'label' => esc_html__('Button Title 01', 'spider-elements'),
183 'type' => Controls_Manager::TEXT,
184 'label_block' => true,
185 'default' => 'Continue'
186 ]
187 );
188
189 $repeater->add_control(
190 'btn_url_1', [
191 'label' => esc_html__('Button URL 01', 'spider-elements'),
192 'type' => Controls_Manager::URL,
193 'default' => [
194 'url' => '#'
195 ],
196 'separator' => 'before'
197 ]
198 );
199
200 $repeater->add_control(
201 'btn_label_2', [
202 'label' => esc_html__('Button Title 02', 'spider-elements'),
203 'type' => Controls_Manager::TEXT,
204 'label_block' => true,
205 'default' => 'Continue'
206 ]
207 );
208
209 $repeater->add_control(
210 'btn_url_2', [
211 'label' => esc_html__('Button URL 02', 'spider-elements'),
212 'type' => Controls_Manager::URL,
213 'default' => [
214 'url' => '#'
215 ],
216 'separator' => 'after'
217 ]
218 );
219
220 $repeater->add_group_control(
221 Group_Control_Background::get_type(), [
222 'name' => 'item_box_bg_color',
223 'label' => esc_html__('Background', 'spider-elements'),
224 'types' => [ 'classic', 'gradient' ],
225 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}',
226 ]
227 );
228
229 $this->add_control(
230 'pricing_tables', [
231 'label' => esc_html__('Pricing Table', 'spider-elements'),
232 'type' => Controls_Manager::REPEATER,
233 'prevent_empty' => false,
234 'fields' => $repeater->get_controls(),
235 'title_field' => '{{{ tab_title }}}',
236 ]
237 );
238
239 $this->add_control(
240 'ribbon_label', [
241 'label' => esc_html__('Ribbon Label', 'spider-elements'),
242 'type' => Controls_Manager::MEDIA,
243 'separator' => 'before'
244
245 ]
246 );
247
248 $this->end_controls_section();
249
250 }
251
252
253 /**
254 * Name: elementor_style_control()
255 * Desc: Register the Style Tab output on the Elementor editor.
256 * Params: no params
257 * Return: @void
258 * Since: @1.0.0
259 * Package: @spider-elements
260 * Author: spider-themes
261 */
262 public function elementor_style_control ()
263 {
264
265
266 }
267
268
269 /**
270 * Name: elementor_render()
271 * Desc: Render widget output on the frontend.
272 * Params: no params
273 * Return: @void
274 * Since: @1.0.0
275 * Package: @spider-elements
276 * Author: spider-themes
277 */
278 protected function render ()
279 {
280 $settings = $this->get_settings_for_display();
281
282 $pricing_tables = $settings[ 'pricing_tables' ];
283 $cats = array_column($pricing_tables, 'tab_title');
284 $getCats = array_unique($cats);
285 $table_data = spel_get_tab_data($getCats, $pricing_tables);
286
287 ?>
288 <div class="ezd-grid ezd-grid-cols-12">
289 <div class="ezd-md-col-8">
290 <ul class="nav nav-tabs pricing-tabs ezd-tab-menu">
291 <?php
292 if (is_array($pricing_tables) && count($pricing_tables) > 0) {
293 $tabs = '';
294 $i = 0;
295 foreach ( $getCats as $cat ) {
296 $catForFilter = sanitize_title_with_dashes($cat);
297 $catForFilter = str_replace('-', '', $catForFilter);
298 $i++;
299 $active = $i == 1 ? ' active' : '';
300 $aria_selected = $i == 1 ? 'true' : 'false';
301 $tabs .= '<li class="nav-item">
302 <button class="nav-link' . esc_attr($active) . '" data-rel="' . esc_attr($catForFilter . '-' . $this->get_id()) . '">
303 ' . esc_html($cat) . '
304 </button>
305 </li>';
306 $i++;
307 }
308 echo wp_kses_post($tabs);
309 }
310 ?>
311 </ul>
312 </div>
313 <div class="ezd-md-col-4">
314 <select class="pricing-currency" data-id="data-<?php echo esc_attr($this->get_id()); ?>">
315 <option data-display="USD"><?php esc_html_e('USD', 'spider-elements'); ?></option>
316 <option data-display="EURO"><?php esc_html_e('EURO', 'spider-elements'); ?></option>
317 </select>
318 </div>
319 </div>
320 <div class="tab-content pricing-tabs-content" id="myTabContent">
321 <?php
322 if (!empty($table_data)) {
323 $i = 0;
324 foreach ( $table_data as $key => $value ) {
325 $tagforfilter = sanitize_title_with_dashes($key);
326 $catForFilter = str_replace('-', '', $tagforfilter);
327 $i++;
328 $active = $i == 1 ? 'active' : '';
329 ?>
330 <div class="tab-pane ezd-tab-box <?php echo esc_attr($active) ?>"
331 id="<?php echo esc_attr($catForFilter . '-' . $this->get_id()); ?>">
332 <div class="ezd-grid ezd-grid-cols-12">
333 <?php
334 foreach ( $value as $table_item ) {
335 $id = wp_unique_id($catForFilter . '-1');
336 ?>
337 <div class="ezd-sm-col-6 ezd-md-col-3" id="<?php echo esc_attr($id); ?>">
338 <div class="pricing-item elementor-repeater-item-<?php echo esc_attr($table_item[ '_id' ]) ?><?php echo esc_attr($table_item[ 'is_active' ] == 'yes' ? ' active' : '') ?>">
339 <?php
340 if (!empty($table_item[ 'discount' ])) { ?>
341 <div class="badge"><?php echo esc_html($table_item[ 'discount' ]) ?></div>
342 <?php
343 }
344 if (!empty($table_item[ 'title' ])) { ?>
345 <h3 class="pricing-title"><?php echo esc_html($table_item[ 'title' ]) ?></h3>
346 <?php
347 }
348 if (!empty($table_item[ 'price_dollar' ]) || !empty($table_item[ 'price_euro' ])) {
349 ?>
350 <div class="price" data-id="data-<?php echo esc_attr($this->get_id()); ?>">
351 <?php
352 if (!empty($table_item[ 'price_dollar' ])) { ?>
353 <span class="dollar"><?php echo esc_html($table_item[ 'price_dollar' ]) ?></span>
354 <?php
355 }
356 if (!empty($table_item[ 'price_euro' ])) { ?>
357 <span class="euro"><?php echo esc_html($table_item[ 'price_euro' ]) ?></span>
358 <?php
359 }
360 if (!empty($table_item[ 'duration' ])) { ?>
361 <sup> <?php echo esc_html($table_item[ 'duration' ]) ?></sup>
362 <?php
363 }
364 ?>
365 </div>
366 <?php
367 }
368 if (!empty($table_item[ 'description' ])) { ?>
369 <span class="pricing-item-user"><?php echo esc_html($table_item[ 'description' ]) ?></span>
370 <?php
371 }
372 if (!empty($table_item[ 'btn_label_1' ])) { ?>
373 <a <?php spel_button_link($table_item[ 'btn_url_1' ]) ?> class="pricing-btn">
374 <?php echo esc_html($table_item[ 'btn_label_1' ]) ?>
375 </a>
376 <?php
377 }
378 if (!empty($table_item[ 'contents' ])) { ?>
379 <?php echo spel_kses_post($table_item[ 'contents' ]) ?>
380 <?php
381 }
382 if (!empty($table_item[ 'btn_label_2' ])) { ?>
383 <a <?php spel_button_link($table_item[ 'btn_url_2' ]) ?> class="pricing-btn">
384 <?php echo esc_html($table_item[ 'btn_label_2' ]) ?>
385 </a>
386 <?php
387 }
388 ?>
389 </div>
390 </div>
391 <?php
392 }
393 ?>
394 </div>
395 <?php spel_el_image($settings[ 'ribbon_label' ], 'Popular', 'popular ezd-d-none ezd-d-lg-block') ?>
396 </div>
397 <?php
398 }
399 }
400 ?>
401 </div>
402 <?php
403 }
404 }