PluginProbe
WP Directory Kit / 1.3.1
WP Directory Kit v1.3.1
1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 1.4.0 1.4.1 All 35 releases
wpdirectorykit / elementor-elements / classes / wdk-button-login.php

wdk-button-login.php in WP Directory Kit 1.3.1, at elementor-elements/classes/wdk-button-login.php

602 lines 19.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Wdk\Elementor\Widgets;
4
5 use Wdk\Elementor\Widgets\WdkElementorBase;
6 use Elementor\Widget_Base;
7 use Elementor\Controls_Manager;
8 use Elementor\Utils;
9 use Elementor\Typography;
10 use Elementor\Editor;
11 use Elementor\Plugin;
12 use Elementor\Repeater;
13 use Elementor\Core\Schemes;
14 use Elementor\Icons_Manager;
15 use Elementor\Group_Control_Typography;
16 use Elementor\Group_Control_Border;
17 use Elementor\Group_Control_Box_Shadow;
18
19 if (!defined('ABSPATH'))
20 exit; // Exit if accessed directly
21
22 /**
23 * @since 1.1.0
24 */
25 class WdkButtonLogin extends WdkElementorBase {
26
27 public $field_id = NULL;
28 public $fields_list = array();
29
30 public function __construct($data = array(), $args = null) {
31
32 \Elementor\Controls_Manager::add_tab(
33 'tab_conf',
34 esc_html__('Settings', 'wpdirectorykit')
35 );
36
37 \Elementor\Controls_Manager::add_tab(
38 'tab_layout',
39 esc_html__('Layout', 'wpdirectorykit')
40 );
41
42 \Elementor\Controls_Manager::add_tab(
43 'tab_content',
44 esc_html__('Main', 'wpdirectorykit')
45 );
46
47
48 if ($this->is_edit_mode_load()) {
49 $this->enqueue_styles_scripts();
50 }
51
52 parent::__construct($data, $args);
53
54 }
55
56
57 /**
58 * Retrieve the widget name.
59 *
60 * @since 1.1.0
61 *
62 * @access public
63 *
64 * @return string Widget name.
65 */
66 public function get_name() {
67 return 'wdk-button-login';
68 }
69
70 /**
71 * Retrieve the widget title.
72 *
73 * @since 1.1.0
74 *
75 * @access public
76 *
77 * @return string Widget title.
78 */
79 public function get_title() {
80 return esc_html__('Wdk Button Login', 'wpdirectorykit');
81 }
82
83 /**
84 * Retrieve the widget icon.
85 *
86 * @since 1.1.0
87 *
88 * @access public
89 *
90 * @return string Widget icon.
91 */
92 public function get_icon() {
93 return 'eicon-button';
94 }
95
96 /**
97 * Register the widget controls.
98 *
99 * Adds different input fields to allow the user to change and customize the widget settings.
100 *
101 * @since 1.1.0
102 *
103 * @access protected
104 */
105 protected function register_controls() {
106 $this->generate_controls_conf();
107 $this->generate_controls_layout();
108 $this->generate_controls_styles();
109 $this->generate_controls_content();
110
111 $this->insert_pro_message('1');
112
113 parent::register_controls();
114 }
115
116 /**
117 * Render the widget output on the frontend.
118 *
119 * Written in PHP and used to generate the final HTML.
120 *
121 * @since 1.1.0
122 *
123 * @access protected
124 */
125 protected function render() {
126 parent::render();
127
128 $this->data['id_element'] = $this->get_id();
129 $this->data['settings'] = $this->get_settings();
130
131 $this->data['settings']['link_not_login_url'] = wp_login_url();
132 $this->data['settings']['link_login_url'] = wp_logout_url(get_home_url());
133 $this->data['settings']['link_dash_url'] = get_admin_url() . "admin.php?page=wdk";
134
135 if(wdk_get_option('wdk_membership_login_page')){
136 $this->data['settings']['link_not_login_url'] = get_permalink(wdk_get_option('wdk_membership_login_page'));
137 }
138
139 if(function_exists('wdk_dash_url') && wdk_get_option('wdk_membership_dash_page')){
140 $this->data['settings']['link_dash_url'] = wdk_dash_url();
141 }
142
143 $this->data['is_edit_mode']= false;
144 if(Plugin::$instance->editor->is_edit_mode()){
145 $this->data['is_edit_mode']= true;
146 } else {
147 }
148
149 echo $this->view('wdk-button-login', $this->data);
150 }
151
152
153 private function generate_controls_conf() {
154 $this->start_controls_section(
155 'tab_conf_main_section',
156 [
157 'label' => esc_html__('Main', 'wpdirectorykit'),
158 'tab' => '1',
159 ]
160 );
161
162 $this->add_group_control(
163 \Elementor\Group_Control_Background::get_type(),
164 [
165 'name' => 'background',
166 'label' => __( 'Background', 'wpdirectorykit' ),
167 'types' => [ 'classic', 'gradient' ],
168 'selector' => '{{WRAPPER}} .wdk-element .wdk-element-button',
169 ]
170 );
171
172 $this->add_responsive_control(
173 'link_not_login_header',
174 [
175 'label' => esc_html__('Not Login Button', 'wpdirectorykit'),
176 'type' => Controls_Manager::HEADING,
177 'separator' => 'before',
178 ]
179 );
180
181 $this->add_control(
182 'link_not_login_text',
183 [
184 'label' => __('Login Title', 'wpdirectorykit'),
185 'type' => \Elementor\Controls_Manager::TEXT,
186 'default' => __('Login', 'wpdirectorykit'),
187 'separator' => 'before',
188 ]
189 );
190
191 $this->add_control(
192 'link_not_login_id',
193 [
194 'label' => __('Special attr id for link', 'wpdirectorykit'),
195 'type' => \Elementor\Controls_Manager::TEXT,
196 'default' => '',
197 ]
198 );
199
200 $this->add_control(
201 'link_not_login_icon',
202 [
203 'label' => esc_html__('Icon', 'wpdirectorykit'),
204 'type' => Controls_Manager::ICONS,
205 'label_block' => true,
206 'default' => [
207 'value' => 'fa fa-user',
208 'library' => 'solid',
209 ],
210 ]
211 );
212
213 $this->add_control(
214 'link_not_login_icon_position',
215 [
216 'label' => esc_html__('icon Position', 'wpdirectorykit'),
217 'type' => Controls_Manager::SELECT,
218 'options' => [
219 'left' => esc_html__('Left', 'wpdirectorykit'),
220 'right' => esc_html__('Right', 'wpdirectorykit'),
221 ],
222 'default' => 'left',
223 ]
224 );
225
226 $this->add_responsive_control(
227 'link_login_header',
228 [
229 'label' => esc_html__('When Login Button', 'wpdirectorykit'),
230 'type' => Controls_Manager::HEADING,
231 'separator' => 'before',
232 ]
233 );
234
235 $this->add_control(
236 'link_login_text',
237 [
238 'label' => __('Logout Text', 'wpdirectorykit'),
239 'type' => \Elementor\Controls_Manager::TEXT,
240 'default' => '',
241 'separator' => 'before',
242 ]
243 );
244
245 $this->add_control(
246 'link_login_text_attr',
247 [
248 'label' => __('Logout Text Attribute', 'wpdirectorykit'),
249 'type' => \Elementor\Controls_Manager::TEXT,
250 'default' => __('Logout', 'wpdirectorykit'),
251 'separator' => 'before',
252 ]
253 );
254
255 $this->add_control(
256 'link_login_id',
257 [
258 'label' => __('Special attr id for link', 'wpdirectorykit'),
259 'type' => \Elementor\Controls_Manager::TEXT,
260 'default' => '',
261 ]
262 );
263
264 $this->add_control(
265 'link_login_icon',
266 [
267 'label' => esc_html__('Icon', 'wpdirectorykit'),
268 'type' => Controls_Manager::ICONS,
269 'label_block' => true,
270 'default' => [
271 'value' => 'fa fa-user',
272 'library' => 'solid',
273 ],
274 ]
275 );
276
277 $this->add_control(
278 'link_login_icon_position',
279 [
280 'label' => esc_html__('icon Position', 'wpdirectorykit'),
281 'type' => Controls_Manager::SELECT,
282 'options' => [
283 'left' => esc_html__('Left', 'wpdirectorykit'),
284 'right' => esc_html__('Right', 'wpdirectorykit'),
285 ],
286 'default' => 'left',
287 ]
288 );
289
290 $this->add_responsive_control(
291 'link_dash_header',
292 [
293 'label' => esc_html__('Dashboard Button', 'wpdirectorykit'),
294 'type' => Controls_Manager::HEADING,
295 'separator' => 'before',
296 ]
297 );
298
299 $this->add_control(
300 'link_dash_text',
301 [
302 'label' => __('Dash Text', 'wpdirectorykit'),
303 'type' => \Elementor\Controls_Manager::TEXT,
304 'default' => '',
305 'separator' => 'before',
306 ]
307 );
308
309 $this->add_control(
310 'link_dash_text_attr',
311 [
312 'label' => __('Dash Text Attribute', 'wpdirectorykit'),
313 'type' => \Elementor\Controls_Manager::TEXT,
314 'default' => __('Dash', 'wpdirectorykit'),
315 'separator' => 'before',
316 ]
317 );
318
319 $this->add_control(
320 'link_dash_id',
321 [
322 'label' => __('Special attr id for link', 'wpdirectorykit'),
323 'type' => \Elementor\Controls_Manager::TEXT,
324 'default' => '',
325 ]
326 );
327
328 $this->add_control(
329 'link_dash_icon',
330 [
331 'label' => esc_html__('Icon', 'wpdirectorykit'),
332 'type' => Controls_Manager::ICONS,
333 'label_block' => true,
334 'default' => [
335 'value' => 'fa fa-tachometer-alt',
336 'library' => 'solid',
337 ],
338 ]
339 );
340
341 $this->add_control(
342 'link_dash_icon_position',
343 [
344 'label' => esc_html__('icon Position', 'wpdirectorykit'),
345 'type' => Controls_Manager::SELECT,
346 'options' => [
347 'left' => esc_html__('Left', 'wpdirectorykit'),
348 'right' => esc_html__('Right', 'wpdirectorykit'),
349 ],
350 'default' => 'left',
351 ]
352 );
353
354 /* chat button */
355 $this->add_responsive_control(
356 'link_chat_header',
357 [
358 'label' => esc_html__('Chat Button', 'wpdirectorykit'),
359 'type' => Controls_Manager::HEADING,
360 'separator' => 'before',
361 ]
362 );
363
364 $this->add_control(
365 'important_note',
366 [
367 'label' => '',
368 'type' => \Elementor\Controls_Manager::RAW_HTML,
369 'raw' => wdk_sprintf(__( 'Only for addon <a href="%1$s" target="_blank"> Live Messages Chat </a>', 'wpdirectorykit' ), '//wpdirectorykit.com/plugins/wp-directory-messages-chat.html'),
370 'content_classes' => 'wdk_elementor_hint',
371 ]
372 );
373
374
375 $selectors = array(
376 'normal' => '{{WRAPPER}} .wdk-button-login .dash-span .count_messages',
377 'hover'=>'{{WRAPPER}} .wdk-button-login .dash-span .count_messages%1$s'
378 );
379 $this->generate_renders_tabs($selectors, 'link_chat_dynamic', ['margin','typo','color','background','border','border_radius','padding','shadow','transition', 'height', 'width','background_group']);
380
381 $this->end_controls_section();
382
383 }
384
385 private function generate_controls_layout() {
386
387 }
388
389 private function generate_controls_styles() {
390 $this->start_controls_section(
391 'link_style_section',
392 [
393 'label' => esc_html__('Style Button', 'wpdirectorykit'),
394 'tab' => 'tab_layout'
395 ]
396 );
397
398 $items = [
399 [
400 'key'=>'btn',
401 'label'=> esc_html__('Button', 'wpdirectorykit'),
402 'options'=>['margin','typo','color','background','border','border_radius','padding','shadow','transition'],
403 ]
404 ];
405
406 foreach ($items as $item) {
407 $this->add_responsive_control(
408 $item['key'].'_header',
409 [
410 'label' => $item['label'],
411 'type' => Controls_Manager::HEADING,
412 'separator' => 'before',
413 ]
414 );
415
416 $selectors = array(
417 'normal' => '{{WRAPPER}} .wdk-element',
418 );
419 $this->generate_renders_tabs($selectors, $item['key'].'_box_dynamic', ['align']);
420
421 $selectors = array(
422 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button',
423 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button%1$s'
424 );
425 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
426
427
428 /* END special for some elements */
429 }
430
431 $items = [
432 [
433 'key'=>'icon',
434 'label'=> esc_html__('Icon', 'wpdirectorykit'),
435 'options'=>'full',
436 ]
437 ];
438
439 foreach ($items as $item) {
440 $this->add_responsive_control(
441 $item['key'].'_header',
442 [
443 'label' => $item['label'],
444 'type' => Controls_Manager::HEADING,
445 'separator' => 'before',
446 ]
447 );
448 $selectors = array(
449 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button i,{{WRAPPER}} .wdk-element .wdk-element-button svg',
450 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button%1$s i,{{WRAPPER}} .wdk-element .wdk-element-button%1$s svg'
451 );
452 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
453
454
455 /* END special for some elements */
456 }
457 $this->end_controls_section();
458
459 /* special for login */
460 if(true){
461 $this->start_controls_section(
462 'link_style_login_section',
463 [
464 'label' => esc_html__('Style Special For Login Button', 'wpdirectorykit'),
465 'tab' => 'tab_layout'
466 ]
467 );
468
469 $items = [
470 [
471 'key'=>'btn_login',
472 'label'=> esc_html__('Button', 'wpdirectorykit'),
473 'options'=>'full',
474 ]
475 ];
476
477 foreach ($items as $item) {
478 $this->add_responsive_control(
479 $item['key'].'_header',
480 [
481 'label' => $item['label'],
482 'type' => Controls_Manager::HEADING,
483 'separator' => 'before',
484 ]
485 );
486
487 $selectors = array(
488 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button.login',
489 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button.login%1$s'
490 );
491 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
492
493
494 /* END special for some elements */
495 }
496
497 $items = [
498 [
499 'key'=>'icon_login',
500 'label'=> esc_html__('Icon', 'wpdirectorykit'),
501 'options'=>'full',
502 ]
503 ];
504
505 foreach ($items as $item) {
506 $this->add_responsive_control(
507 $item['key'].'_header',
508 [
509 'label' => $item['label'],
510 'type' => Controls_Manager::HEADING,
511 'separator' => 'before',
512 ]
513 );
514 $selectors = array(
515 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button.login i,{{WRAPPER}} .wdk-element .wdk-element-button.login svg',
516 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button.login%1$s i,{{WRAPPER}} .wdk-element .wdk-element-button.login%1$s svg'
517 );
518 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
519
520
521 /* END special for some elements */
522 }
523 $this->end_controls_section();
524 }
525
526 /* special for logout */
527 if(true){
528 $this->start_controls_section(
529 'link_style_logout_section',
530 [
531 'label' => esc_html__('Style Special For Logout Button', 'wpdirectorykit'),
532 'tab' => 'tab_layout'
533 ]
534 );
535
536 $items = [
537 [
538 'key'=>'btn_logout',
539 'label'=> esc_html__('Button', 'wpdirectorykit'),
540 'options'=>'full',
541 ]
542 ];
543 foreach ($items as $item) {
544 $this->add_responsive_control(
545 $item['key'].'_logout_header',
546 [
547 'label' => $item['label'],
548 'type' => Controls_Manager::HEADING,
549 'separator' => 'before',
550 ]
551 );
552
553 $selectors = array(
554 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button.logout',
555 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button.logout%1$s'
556 );
557 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
558
559
560 /* END special for some elements */
561 }
562
563 $items = [
564 [
565 'key'=>'icon_logout',
566 'label'=> esc_html__('Icon', 'wpdirectorykit'),
567 'options'=>['margin','font-size','color','background','border','border_radius','padding'],
568 ]
569 ];
570
571 foreach ($items as $item) {
572 $this->add_responsive_control(
573 $item['key'].'_header',
574 [
575 'label' => $item['label'],
576 'type' => Controls_Manager::HEADING,
577 'separator' => 'before',
578 ]
579 );
580 $selectors = array(
581 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button.logout i,{{WRAPPER}} .wdk-element .wdk-element-button.logout svg',
582 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button.logout%1$s i,{{WRAPPER}} .wdk-element .wdk-element-button.logout%1$s svg'
583 );
584 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
585
586
587 /* END special for some elements */
588 }
589 $this->end_controls_section();
590 }
591 }
592
593
594 private function generate_controls_content() {
595
596 }
597
598 public function enqueue_styles_scripts() {
599 wp_enqueue_style('wdk-element-button');
600 }
601 }
602