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

570 lines 17.7 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 $this->end_controls_section();
355
356 }
357
358 private function generate_controls_layout() {
359
360 }
361
362 private function generate_controls_styles() {
363 $this->start_controls_section(
364 'link_style_section',
365 [
366 'label' => esc_html__('Style Button', 'wpdirectorykit'),
367 'tab' => 'tab_layout'
368 ]
369 );
370
371 $items = [
372 [
373 'key'=>'btn',
374 'label'=> esc_html__('Button', 'wpdirectorykit'),
375 'options'=>'full',
376 ]
377 ];
378
379 foreach ($items as $item) {
380 $this->add_responsive_control(
381 $item['key'].'_header',
382 [
383 'label' => $item['label'],
384 'type' => Controls_Manager::HEADING,
385 'separator' => 'before',
386 ]
387 );
388
389 $selectors = array(
390 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button',
391 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button%1$s'
392 );
393 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
394
395
396 /* END special for some elements */
397 }
398
399 $items = [
400 [
401 'key'=>'icon',
402 'label'=> esc_html__('Icon', 'wpdirectorykit'),
403 'options'=>'full',
404 ]
405 ];
406
407 foreach ($items as $item) {
408 $this->add_responsive_control(
409 $item['key'].'_header',
410 [
411 'label' => $item['label'],
412 'type' => Controls_Manager::HEADING,
413 'separator' => 'before',
414 ]
415 );
416 $selectors = array(
417 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button i,{{WRAPPER}} .wdk-element .wdk-element-button svg',
418 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button%1$s i,{{WRAPPER}} .wdk-element .wdk-element-button%1$s svg'
419 );
420 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
421
422
423 /* END special for some elements */
424 }
425 $this->end_controls_section();
426
427 /* special for login */
428 if(true){
429 $this->start_controls_section(
430 'link_style_login_section',
431 [
432 'label' => esc_html__('Style Special For Login Button', 'wpdirectorykit'),
433 'tab' => 'tab_layout'
434 ]
435 );
436
437 $items = [
438 [
439 'key'=>'btn_login',
440 'label'=> esc_html__('Button', 'wpdirectorykit'),
441 'options'=>'full',
442 ]
443 ];
444
445 foreach ($items as $item) {
446 $this->add_responsive_control(
447 $item['key'].'_header',
448 [
449 'label' => $item['label'],
450 'type' => Controls_Manager::HEADING,
451 'separator' => 'before',
452 ]
453 );
454
455 $selectors = array(
456 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button.login',
457 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button.login%1$s'
458 );
459 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
460
461
462 /* END special for some elements */
463 }
464
465 $items = [
466 [
467 'key'=>'icon_login',
468 'label'=> esc_html__('Icon', 'wpdirectorykit'),
469 'options'=>'full',
470 ]
471 ];
472
473 foreach ($items as $item) {
474 $this->add_responsive_control(
475 $item['key'].'_header',
476 [
477 'label' => $item['label'],
478 'type' => Controls_Manager::HEADING,
479 'separator' => 'before',
480 ]
481 );
482 $selectors = array(
483 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button.login i,{{WRAPPER}} .wdk-element .wdk-element-button.login svg',
484 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button.login%1$s i,{{WRAPPER}} .wdk-element .wdk-element-button.login%1$s svg'
485 );
486 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
487
488
489 /* END special for some elements */
490 }
491 $this->end_controls_section();
492 }
493
494 /* special for logout */
495 if(true){
496 $this->start_controls_section(
497 'link_style_logout_section',
498 [
499 'label' => esc_html__('Style Special For Logout Button', 'wpdirectorykit'),
500 'tab' => 'tab_layout'
501 ]
502 );
503
504 $items = [
505 [
506 'key'=>'btn_logout',
507 'label'=> esc_html__('Button', 'wpdirectorykit'),
508 'options'=>'full',
509 ]
510 ];
511 foreach ($items as $item) {
512 $this->add_responsive_control(
513 $item['key'].'_logout_header',
514 [
515 'label' => $item['label'],
516 'type' => Controls_Manager::HEADING,
517 'separator' => 'before',
518 ]
519 );
520
521 $selectors = array(
522 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button.logout',
523 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button.logout%1$s'
524 );
525 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
526
527
528 /* END special for some elements */
529 }
530
531 $items = [
532 [
533 'key'=>'icon_logout',
534 'label'=> esc_html__('Icon', 'wpdirectorykit'),
535 'options'=>'full',
536 ]
537 ];
538
539 foreach ($items as $item) {
540 $this->add_responsive_control(
541 $item['key'].'_header',
542 [
543 'label' => $item['label'],
544 'type' => Controls_Manager::HEADING,
545 'separator' => 'before',
546 ]
547 );
548 $selectors = array(
549 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button.logout i,{{WRAPPER}} .wdk-element .wdk-element-button.logout svg',
550 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button.logout%1$s i,{{WRAPPER}} .wdk-element .wdk-element-button.logout%1$s svg'
551 );
552 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
553
554
555 /* END special for some elements */
556 }
557 $this->end_controls_section();
558 }
559 }
560
561
562 private function generate_controls_content() {
563
564 }
565
566 public function enqueue_styles_scripts() {
567 wp_enqueue_style('wdk-element-button');
568 }
569 }
570