PluginProbe
WP Directory Kit / 1.5.9
WP Directory Kit v1.5.9
1.5.9 1.5.7 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 All 37 releases
wpdirectorykit / elementor-elements / classes / wdk-button-login.php

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

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