PluginProbe
WP Directory Kit / 1.2.3
WP Directory Kit v1.2.3
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.2.3, at elementor-elements/classes/wdk-button-login.php

597 lines 18.9 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' => 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'=>'full',
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 .wdk-element-button',
418 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button%1$s'
419 );
420 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
421
422
423 /* END special for some elements */
424 }
425
426 $items = [
427 [
428 'key'=>'icon',
429 'label'=> esc_html__('Icon', 'wpdirectorykit'),
430 'options'=>'full',
431 ]
432 ];
433
434 foreach ($items as $item) {
435 $this->add_responsive_control(
436 $item['key'].'_header',
437 [
438 'label' => $item['label'],
439 'type' => Controls_Manager::HEADING,
440 'separator' => 'before',
441 ]
442 );
443 $selectors = array(
444 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button i,{{WRAPPER}} .wdk-element .wdk-element-button svg',
445 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button%1$s i,{{WRAPPER}} .wdk-element .wdk-element-button%1$s svg'
446 );
447 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
448
449
450 /* END special for some elements */
451 }
452 $this->end_controls_section();
453
454 /* special for login */
455 if(true){
456 $this->start_controls_section(
457 'link_style_login_section',
458 [
459 'label' => esc_html__('Style Special For Login Button', 'wpdirectorykit'),
460 'tab' => 'tab_layout'
461 ]
462 );
463
464 $items = [
465 [
466 'key'=>'btn_login',
467 'label'=> esc_html__('Button', 'wpdirectorykit'),
468 'options'=>'full',
469 ]
470 ];
471
472 foreach ($items as $item) {
473 $this->add_responsive_control(
474 $item['key'].'_header',
475 [
476 'label' => $item['label'],
477 'type' => Controls_Manager::HEADING,
478 'separator' => 'before',
479 ]
480 );
481
482 $selectors = array(
483 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button.login',
484 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button.login%1$s'
485 );
486 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
487
488
489 /* END special for some elements */
490 }
491
492 $items = [
493 [
494 'key'=>'icon_login',
495 'label'=> esc_html__('Icon', 'wpdirectorykit'),
496 'options'=>'full',
497 ]
498 ];
499
500 foreach ($items as $item) {
501 $this->add_responsive_control(
502 $item['key'].'_header',
503 [
504 'label' => $item['label'],
505 'type' => Controls_Manager::HEADING,
506 'separator' => 'before',
507 ]
508 );
509 $selectors = array(
510 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button.login i,{{WRAPPER}} .wdk-element .wdk-element-button.login svg',
511 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button.login%1$s i,{{WRAPPER}} .wdk-element .wdk-element-button.login%1$s svg'
512 );
513 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
514
515
516 /* END special for some elements */
517 }
518 $this->end_controls_section();
519 }
520
521 /* special for logout */
522 if(true){
523 $this->start_controls_section(
524 'link_style_logout_section',
525 [
526 'label' => esc_html__('Style Special For Logout Button', 'wpdirectorykit'),
527 'tab' => 'tab_layout'
528 ]
529 );
530
531 $items = [
532 [
533 'key'=>'btn_logout',
534 'label'=> esc_html__('Button', 'wpdirectorykit'),
535 'options'=>'full',
536 ]
537 ];
538 foreach ($items as $item) {
539 $this->add_responsive_control(
540 $item['key'].'_logout_header',
541 [
542 'label' => $item['label'],
543 'type' => Controls_Manager::HEADING,
544 'separator' => 'before',
545 ]
546 );
547
548 $selectors = array(
549 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button.logout',
550 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button.logout%1$s'
551 );
552 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
553
554
555 /* END special for some elements */
556 }
557
558 $items = [
559 [
560 'key'=>'icon_logout',
561 'label'=> esc_html__('Icon', 'wpdirectorykit'),
562 'options'=>['margin','font-size','color','background','border','border_radius','padding'],
563 ]
564 ];
565
566 foreach ($items as $item) {
567 $this->add_responsive_control(
568 $item['key'].'_header',
569 [
570 'label' => $item['label'],
571 'type' => Controls_Manager::HEADING,
572 'separator' => 'before',
573 ]
574 );
575 $selectors = array(
576 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button.logout i,{{WRAPPER}} .wdk-element .wdk-element-button.logout svg',
577 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button.logout%1$s i,{{WRAPPER}} .wdk-element .wdk-element-button.logout%1$s svg'
578 );
579 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
580
581
582 /* END special for some elements */
583 }
584 $this->end_controls_section();
585 }
586 }
587
588
589 private function generate_controls_content() {
590
591 }
592
593 public function enqueue_styles_scripts() {
594 wp_enqueue_style('wdk-element-button');
595 }
596 }
597