PluginProbe
LoginPress | wp-login Custom Login Page Customizer / 1.0.13
LoginPress | wp-login Custom Login Page Customizer v1.0.13
6.2.5 6.2.4 6.2.3 6.2.2 6.2.1 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.3 1.0.4 All 118 releases
loginpress / custom.php

custom.php in LoginPress | wp-login Custom Login Page Customizer 1.0.13, at custom.php

1,409 lines 50.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class LoginPress_Entities {
4
5 /**
6 * Variable that Check for LoginPress Key.
7 *
8 * @var string
9 * @since 1.0.0
10 */
11 public $loginpress_key;
12
13 /**
14 * Class constructor
15 */
16 public function __construct() {
17
18 $this->loginpress_key = get_option( 'loginpress_customization' );
19 $this->_hooks();
20 }
21
22
23 /**
24 * Hook into actions and filters
25 *
26 * @since 1.0.0
27 */
28 private function _hooks() {
29
30 add_filter( 'login_headerurl', array( $this, 'login_page_logo_url' ) );
31 add_filter( 'login_headertitle', array( $this, 'login_page_logo_title' ) );
32 add_filter( 'login_errors', array( $this, 'login_error_messages' ) );
33 add_filter( 'gettext', array( $this, 'change_lostpassword_message' ) );
34 add_filter( 'login_message', array( $this, 'change_welcome_message' ) );
35 add_action( 'customize_register', array( $this, 'customize_login_panel' ) );
36 add_action( 'login_footer', array( $this, 'login_page_custom_footer' ) );
37 add_action( 'login_head', array( $this, 'login_page_custom_head' ) );
38 add_action( 'init', array( $this, 'redirect_to_custom_page' ) );
39 add_action( 'admin_menu', array( $this, 'menu_url' ), 99 );
40
41 add_action( 'customize_controls_enqueue_scripts', array( $this, 'loginpress_customizer_js' ) );
42 // add_action( 'customize_preview_init', array( $this, 'loginpress_customizer_js' ) );
43
44
45 }
46
47 /**
48 * Enqueue jQuery and use wp_localize_script.
49 *
50 * @since 1.0.9
51 */
52 function loginpress_customizer_js() {
53 wp_enqueue_script('jquery');
54 wp_enqueue_script( 'loginpress-customize-control', plugins_url( 'js/customize-controls.js' , __FILE__ ), array( 'jquery', 'customize-preview' ), LOGINPRESS_VERSION, true );
55
56
57 // Get Background URL for use in Customizer JS.
58 $loginpress_bg = get_option( 'loginpress_customization');
59 $loginpress_bg_url = $loginpress_bg['setting_background'] ? $loginpress_bg['setting_background'] : false;
60
61 // Array for localize.
62 $loginpress_localize = array(
63 'admin_url' => admin_url(),
64 'plugin_url' => plugins_url(),
65 'login_theme' => get_option( 'customize_presets_settings', true ),
66 'loginpress_bg_url' => $loginpress_bg_url
67 );
68
69 wp_localize_script( 'loginpress-customize-control', 'loginpress_script', $loginpress_localize );
70
71 }
72
73
74
75 /**
76 * Register plugin settings Panel in WP Customizer
77 *
78 * @param $wp_customize
79 * @since 1.0.0
80 */
81 public function customize_login_panel( $wp_customize ){
82
83 include LOGINPRESS_ROOT_PATH .'classes/control-presets.php';
84
85 // =============================
86 // = Panel for the LoginPress =
87 // =============================
88 $wp_customize->add_panel( 'loginpress_panel', array(
89 'title' => __( 'LoginPress', 'loginpress' ),
90 'description' => __( 'Customize Your WordPress Login Page with LoginPress :)', 'loginpress' ),
91 'priority' => 30,
92 ) );
93
94 /**
95 * Start of Presets.
96 *
97 * @since 1.0.9
98 */
99 $wp_customize->add_section( 'customize_presets', array(
100 'title' => __( 'Themes', 'loginpress' ),
101 'description' => __( 'Choose Theme', 'loginpress' ),
102 'priority' => 1,
103 'panel' => 'loginpress_panel',
104 ) );
105
106 $wp_customize->add_setting( 'customize_presets_settings', array(
107 'default' => 'default1',
108 'type' => 'option',
109 'capability' => 'manage_options',
110 ) );
111
112 $loginpress_free_templates = array(
113 'default1' => array(
114 'img' => plugins_url( 'img/bg.jpg', __FILE__ ),
115 'thumbnail' => plugins_url( 'img/thumbnail/default-1.png', __FILE__ ),
116 'id' => 'default1',
117 'name' => 'Default'
118 ),
119 'default2' => array(
120 'thumbnail' => plugins_url( 'img/thumbnail/default-2.png', __FILE__ ),
121 'id' => 'default2',
122 'name' => __( 'Company', 'loginpress' ),
123 'pro' => 'yes'
124 ),
125 'default3' => array(
126 'thumbnail' => plugins_url( 'img/thumbnail/default-3.png', __FILE__ ),
127 'id' => 'default3',
128 'name' => __( 'Persona', 'loginpress' ),
129 'pro' => 'yes'
130 ),
131 'default4' => array(
132 'thumbnail' => plugins_url( 'img/thumbnail/default-4.jpg', __FILE__ ),
133 'id' => 'default4',
134 'name' => __( 'Corporate', 'loginpress' ),
135 'pro' => 'yes'
136 ),
137 'default5' => array(
138 'thumbnail' => plugins_url( 'img/thumbnail/default-5.png', __FILE__ ),
139 'id' => 'default5',
140 'name' => __( 'Corporate', 'loginpress' ),
141 'pro' => 'yes'
142 ),
143 'default6' => array(
144 'thumbnail' => plugins_url( 'img/thumbnail/default-6.png', __FILE__ ),
145 'id' => 'default6',
146 'name' => __( 'Startup', 'loginpress' ),
147 'pro' => 'yes'
148 ),
149 'default7' => array(
150 'thumbnail' => plugins_url( 'img/thumbnail/default-7.png', __FILE__ ),
151 'id' => 'default7',
152 'name' => __( 'Wedding', 'loginpress' ),
153 'pro' => 'yes'
154 ),
155 'default8' => array(
156 'thumbnail' => plugins_url( 'img/thumbnail/default-8.png', __FILE__ ),
157 'id' => 'default8',
158 'name' => __( 'Wedding #2', 'loginpress' ),
159 'pro' => 'yes'
160 ),
161 'default9' => array(
162 'thumbnail' => plugins_url( 'img/thumbnail/default-9.png', __FILE__ ),
163 'id' => 'default9',
164 'name' => __( 'Company', 'loginpress' ),
165 'pro' => 'yes'
166 ),
167 'default10' => array(
168 'thumbnail' => plugins_url( 'img/thumbnail/default-10.png', __FILE__ ),
169 'id' => 'default10',
170 'name' => __( 'Bikers', 'loginpress' ),
171 'pro' => 'yes'
172 ),
173 'default11' => array(
174 'thumbnail' => plugins_url( 'img/thumbnail/default-11.png', __FILE__ ),
175 'id' => 'default11',
176 'name' => __( 'Fitness', 'loginpress' ),
177 'pro' => 'yes'
178 ),
179 'default12' => array(
180 'thumbnail' => plugins_url( 'img/thumbnail/default-12.png', __FILE__ ),
181 'id' => 'default12',
182 'name' => __( 'Shopping', 'loginpress' ),
183 'pro' => 'yes'
184 ),
185 'default13' => array(
186 'thumbnail' => plugins_url( 'img/thumbnail/default-13.png', __FILE__ ),
187 'id' => 'default13',
188 'name' => __( 'Writers', 'loginpress' ),
189 'pro' => 'yes'
190 ),
191 'default14' => array(
192 'thumbnail' => plugins_url( 'img/thumbnail/default-14.png', __FILE__ ),
193 'id' => 'default14',
194 'name' => __( 'Persona', 'loginpress' ),
195 'pro' => 'yes'
196 ),
197 'default15' => array(
198 'thumbnail' => plugins_url( 'img/thumbnail/default-15.png', __FILE__ ),
199 'id' => 'default15',
200 'name' => __( 'Geek', 'loginpress' ),
201 'pro' => 'yes'
202 ),
203 'default16' => array(
204 'thumbnail' => plugins_url( 'img/thumbnail/default-16.png', __FILE__ ),
205 'id' => 'default16',
206 'name' => __( 'Innovation', 'loginpress' ),
207 'pro' => 'yes'
208 ),
209 'default17' => array(
210 'thumbnail' => plugins_url( 'img/thumbnail/default-17.png', __FILE__ ),
211 'id' => 'default17',
212 'name' => __( 'Photographers', 'loginpress' ),
213 'pro' => 'yes'
214 ),
215 'default18' => array(
216 'thumbnail' => plugins_url( 'img/thumbnail/custom-design.png', __FILE__ ),
217 'id' => 'default18',
218 'name' => 'Custom Design',
219 'pro' => 'yes'
220 )
221
222 );
223 $loginpress_templates = apply_filters( 'loginpress_pro_add_template', $loginpress_free_templates );
224
225 $wp_customize->add_control( new LoginPress_Presets( $wp_customize, 'customize_presets_settings',
226 array(
227 'section' => 'customize_presets',
228 // 'label' => __( 'Themes', 'loginpress' ),
229 'choices' => $loginpress_templates
230 ) ) );
231 //End of Presets.
232
233
234 // =============================
235 // = Section for Login Logo =
236 // =============================
237 $wp_customize->add_section( 'customize_logo_section', array(
238 'title' => __( 'Logo', 'loginpress' ),
239 'description' => __( 'Customize Your Logo Section', 'loginpress' ),
240 'priority' => 5,
241 'panel' => 'loginpress_panel',
242 ) );
243
244 $wp_customize->add_setting( 'loginpress_customization[setting_logo]', array(
245 'type' => 'option',
246 'capability' => 'manage_options',
247 'transport' => 'postMessage'
248 ) );
249
250 $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'loginpress_customization[setting_logo]', array(
251 'label' => __( 'Logo Image:', 'loginpress' ),
252 'section' => 'customize_logo_section',
253 'priority' => 5,
254 'settings' => 'loginpress_customization[setting_logo]'
255 ) ) );
256
257 $logo_control = array( 'customize_logo_width', 'customize_logo_height', 'customize_logo_padding', 'customize_logo_hover', 'customize_logo_hover_title' );
258 $logo_default = array( '84px', '84px', '5px', '', '' );
259 $logo_label = array(
260 __( 'Logo Width:', 'loginpress' ),
261 __( 'Logo Height:', 'loginpress' ),
262 __( 'Padding Bottom:', 'loginpress' ),
263 __( 'Logo URL:', 'loginpress' ),
264 __( 'Logo Hover Title:', 'loginpress' )
265 );
266
267 $logo = 0;
268 while ( $logo < 5 ) :
269
270 $wp_customize->add_setting( "loginpress_customization[{$logo_control[$logo]}]", array(
271 'default' => $logo_default[$logo],
272 'type' => 'option',
273 'capability' => 'manage_options',
274 'transport' => 'postMessage'
275 ) );
276
277 $wp_customize->add_control( "loginpress_customization[{$logo_control[$logo]}]", array(
278 'label' => $logo_label[$logo],
279 'section' => 'customize_logo_section',
280 'priority' => 10,
281 'settings' => "loginpress_customization[{$logo_control[$logo]}]"
282 ) );
283
284 $logo++;
285 endwhile;
286
287 // =============================
288 // = Section for Background =
289 // =============================
290 $wp_customize->add_section( 'section_background', array(
291 'title' => __( 'Background', 'loginpress' ),
292 'description' => '',
293 'priority' => 10,
294 'panel' => 'loginpress_panel',
295 ) );
296
297 $wp_customize->add_setting( 'loginpress_customization[loginpress_display_bg]', array(
298 'default' => true,
299 'type' => 'option',
300 'capability' => 'manage_options',
301 'transport' => 'postMessage'
302 ) );
303
304 $wp_customize->add_control( 'loginpress_customization[loginpress_display_bg]', array(
305 'settings' => 'loginpress_customization[loginpress_display_bg]',
306 'label' => __( 'Display Background Image?', 'loginpress'),
307 'section' => 'section_background',
308 'priority' => 5,
309 'type' => 'checkbox',
310 ) );
311
312 $wp_customize->add_setting( 'loginpress_customization[setting_background_color]', array(
313 // 'default' => '#ddd5c3',
314 'type' => 'option',
315 'capability' => 'manage_options',
316 'transport' => 'postMessage'
317 ) );
318
319 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[setting_background_color]', array(
320 'label' => __( 'Background Color:', 'loginpress' ),
321 'section' => 'section_background',
322 'priority' => 10,
323 'settings' => 'loginpress_customization[setting_background_color]'
324 ) ) );
325
326 $wp_customize->add_setting( 'loginpress_customization[setting_background]', array(
327 // 'default' => plugins_url( 'img/bg.jpg', __FILE__ ) ,
328 'type' => 'option',
329 'capability' => 'manage_options',
330 'transport' => 'postMessage'
331 ) );
332
333 $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'loginpress_customization[setting_background]', array(
334 'label' => __( 'Background Image:', 'loginpress' ),
335 'section' => 'section_background',
336 'priority' => 15,
337 'settings' => 'loginpress_customization[setting_background]',
338 ) ) );
339
340
341 $wp_customize->add_setting( 'loginpress_customization[background_repeat_radio]', array(
342 'default' => 'no-repeat',
343 'type' => 'option',
344 'capability' => 'manage_options',
345 'transport' => 'postMessage'
346 ) );
347
348 $wp_customize->add_control( 'loginpress_customization[background_repeat_radio]', array(
349 'label' => __( 'Background Repeat:', 'loginpress' ),
350 'section' => 'section_background',
351 'priority' => 20,
352 'settings' => 'loginpress_customization[background_repeat_radio]',
353 'type' => 'radio',
354 'choices' => array(
355 'repeat' => 'repeat',
356 'repeat-x' => 'repeat-x',
357 'repeat-y' => 'repeat-y',
358 'no-repeat' => 'no-repeat',
359 'initial' => 'initial',
360 'inherit' => 'inherit',
361 ),
362 ) );
363
364 $wp_customize->add_setting( 'loginpress_customization[background_position]', array(
365 'default' => 'center',
366 'type' => 'option',
367 'capability' => 'manage_options',
368 'transport' => 'postMessage'
369 ) );
370 $wp_customize->add_control( 'loginpress_customization[background_position]', array(
371 'settings' => 'loginpress_customization[background_position]',
372 'label' => __( 'Select Position:', 'loginpress' ),
373 'section' => 'section_background',
374 'priority' => 25,
375 'type' => 'select',
376 'choices' => array(
377 'left top' => 'left top',
378 'left center' => 'left center',
379 'left bottom' => 'left bottom',
380 'right top' => 'right top',
381 'right center' => 'right center',
382 'right bottom' => 'right bottom',
383 'center top' => 'center top',
384 'center' => 'center',
385 'center bottom' => 'center bottom',
386 ),
387 ) );
388
389 $wp_customize->add_setting( 'loginpress_customization[background_image_size]', array(
390 'default' => 'cover',
391 'type' => 'option',
392 'capability' => 'manage_options',
393 'transport' => 'postMessage'
394 ));
395
396 $wp_customize->add_control( 'loginpress_customization[background_image_size]', array(
397 'label' => __( 'Background Image Size: ', 'loginpress' ),
398 'section' => 'section_background',
399 'priority' => 30,
400 'settings' => 'loginpress_customization[background_image_size]',
401 'type' => 'select',
402 'choices' => array(
403 'auto' => 'auto',
404 'cover' => 'cover',
405 'contain' => 'contain',
406 'initial' => 'initial',
407 'inherit' => 'inherit',
408 ),
409 ) );
410
411 // =============================
412 // = Section for Form Beauty =
413 // =============================
414 $wp_customize->add_section( 'section_form', array(
415 'title' => __( 'Customize Login Form', 'loginpress' ),
416 'description' => '',
417 'priority' => 15,
418 'panel' => 'loginpress_panel',
419 ) );
420
421 $wp_customize->add_setting( 'loginpress_customization[setting_form_background]', array(
422 'type' => 'option',
423 'capability' => 'manage_options',
424 'transport' => 'postMessage'
425 ) );
426
427 $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'loginpress_customization[setting_form_background]', array(
428 'label' => __( 'Form Background Image', 'loginpress' ),
429 'section' => 'section_form',
430 'priority' => 5,
431 'settings' => 'loginpress_customization[setting_form_background]'
432 ) ) );
433
434 $form_control = array( 'customize_form_width', 'customize_form_height', 'customize_form_padding', 'customize_form_border', 'textfield_width', 'textfield_margin' );
435 $form_default = array( '', '200px', '26px 24px 46px', '', '100%', '2px 6px 16px 0px' );
436 $form_label = array(
437 __( 'Form Width:', 'loginpress' ),
438 __( 'Form Minimum Height:', 'loginpress' ),
439 __( 'Form Padding:', 'loginpress' ),
440 __( 'Border (Example: 2px dotted black):', 'loginpress' ),
441 __( 'Input Text Field Width:', 'loginpress' ),
442 __( 'Input Text Field Margin:', 'loginpress' )
443 );
444
445 $form = 0;
446 while ( $form < 6 ) :
447
448 $wp_customize->add_setting( "loginpress_customization[{$form_control[$form]}]", array(
449 'default' => $form_default[$form],
450 'type' => 'option',
451 'capability' => 'manage_options',
452 'transport' => 'postMessage'
453 ) );
454
455 $wp_customize->add_control( "loginpress_customization[{$form_control[$form]}]", array(
456 'label' => $form_label[$form],
457 'section' => 'section_form',
458 // 'priority' => 15,
459 'settings' => "loginpress_customization[{$form_control[$form]}]"
460 ) );
461
462 $form++;
463 endwhile;
464
465 $form_color_control = array( 'form_background_color', 'textfield_background_color', 'textfield_color', 'textfield_label_color' );
466 $form_color_default = array( '#FFF', '#FFF', '#333', '#777' );
467 $form_color_label = array(
468 __( 'Form Background Color:', 'loginpress' ),
469 __( 'Input Field Background Color:', 'loginpress' ),
470 __( 'Input Field Text Color:', 'loginpress' ),
471 __( 'Label Color:', 'loginpress' ),
472 );
473
474 $form_color = 0;
475 while ( $form_color < 4 ) :
476
477 $wp_customize->add_setting( "loginpress_customization[{$form_color_control[$form_color]}]", array(
478 // 'default' => $form_color_default[$form_color],
479 'type' => 'option',
480 'capability' => 'manage_options',
481 'transport' => 'postMessage'
482 ) );
483
484 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, "loginpress_customization[{$form_color_control[$form_color]}]", array(
485 'label' => $form_color_label[$form_color],
486 'section' => 'section_form',
487 // 'priority' => 50,
488 'settings' => "loginpress_customization[{$form_color_control[$form_color]}]"
489 ) ) );
490
491 $form_color++;
492 endwhile;
493
494 // =============================
495 // = Section for Forget Form =
496 // =============================
497 $wp_customize->add_section(
498 'section_forget_form',
499 array(
500 'title' => __( 'Customize Forget Form', 'loginpress' ),
501 'description' => '',
502 'priority' => 20,
503 'panel' => 'loginpress_panel',
504 ) );
505
506 $wp_customize->add_setting( 'loginpress_customization[forget_form_background]', array(
507 'type' => 'option',
508 'capability' => 'manage_options',
509 'transport' => 'postMessage'
510 ) );
511
512 $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'loginpress_customization[forget_form_background]', array(
513 'label' => __( 'Forget Form Background Image', 'loginpress' ),
514 'section' => 'section_forget_form',
515 'priority' => 5,
516 'settings' => 'loginpress_customization[forget_form_background]'
517 ) ) );
518
519 $wp_customize->add_setting( 'loginpress_customization[forget_form_background_color]', array(
520 // 'default' => '#FFF',
521 'type' => 'option',
522 'capability' => 'manage_options',
523 'transport' => 'postMessage'
524 ) );
525
526 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[forget_form_background_color]', array(
527 'label' => __( 'Forget Form Background Color', 'loginpress' ),
528 'section' => 'section_forget_form',
529 'priority' => 10,
530 'settings' => 'loginpress_customization[forget_form_background_color]'
531 ) ) );
532
533 // =============================
534 // = Section for Button Style =
535 // =============================
536 $wp_customize->add_section( 'section_button', array(
537 'title' => __( 'Button Beauty', 'loginpress' ),
538 'description' => '',
539 'priority' => 25,
540 'panel' => 'loginpress_panel',
541 ) );
542
543 $button_control = array( 'custom_button_color', 'button_border_color', 'button_hover_color', 'button_hover_border', 'custom_button_shadow', 'button_text_color' );
544 $button_default = array( '#2EA2CC', '#0074A2', '#1E8CBE', '#0074A2', '#78C8E6', '#FFF' );
545 $button_label = array(
546 __( 'Button Color:', 'loginpress' ),
547 __( 'Button Border Color:', 'loginpress' ),
548 __( 'Button Color (Hover):', 'loginpress' ),
549 __( 'Button Border (Hover):', 'loginpress' ),
550 __( 'Button Box Shadow:', 'loginpress' ),
551 __( 'Button Text Color:', 'loginpress' )
552 );
553
554 $button = 0;
555 while ( $button < 6 ) :
556
557 $wp_customize->add_setting( "loginpress_customization[{$button_control[$button]}]", array(
558 // 'default' => $button_default[$button],
559 'type' => 'option',
560 'capability' => 'manage_options',
561 'transport' => 'postMessage'
562 ) );
563
564 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, "loginpress_customization[{$button_control[$button]}]", array(
565 'label' => $button_label[$button],
566 'section' => 'section_button',
567 'priority' => 5,
568 'settings' => "loginpress_customization[{$button_control[$button]}]"
569 ) ) );
570
571 $button++;
572 endwhile;
573
574 // =============================
575 // = Section for Error message =
576 // =============================
577 $wp_customize->add_section( 'section_error', array(
578 'title' => __( 'Error Messages', 'loginpress' ),
579 'description' => '',
580 'priority' => 30,
581 'panel' => 'loginpress_panel',
582 ) );
583
584 $error_control = array( 'incorrect_username', 'incorrect_password', 'empty_username', 'empty_password', 'invalid_email', 'empty_email', 'invalidcombo_message' );
585 $error_default = array( 'Incorrect Username', 'Incorrect Password', 'Empty Username', 'Empty Password', 'The email address is incorrect.', 'The email address is empty.', 'Invalid Username or Email.' );
586 $error_label = array(
587 __( 'Incorrect Username Message:', 'loginpress' ),
588 __( 'Incorrect Password Message:', 'loginpress' ),
589 __( 'Empty Username Message:', 'loginpress' ),
590 __( 'Empty Password Message:', 'loginpress' ),
591 __( 'Invalid Email Message:', 'loginpress' ),
592 __( 'Empty Email Message:', 'loginpress' ),
593 __( 'Forget Password Message:', 'loginpress' ),
594 );
595
596 $error = 0;
597 while ( $error < 7 ) :
598
599 $wp_customize->add_setting( "loginpress_customization[{$error_control[$error]}]", array(
600 'default' => $error_default[$error],
601 'type' => 'option',
602 'capability' => 'manage_options',
603 'transport' => 'postMessage'
604 ) );
605
606 $wp_customize->add_control( "loginpress_customization[{$error_control[$error]}]", array(
607 'label' => $error_label[$error],
608 'section' => 'section_error',
609 'priority' => 5,
610 'settings' => "loginpress_customization[{$error_control[$error]}]",
611 ) );
612
613 $error++;
614 endwhile;
615
616 // =============================
617 // = Section for Welcome message
618 // =============================
619 $wp_customize->add_section( 'section_welcome', array(
620 'title' => __( 'Welcome Messages', 'loginpress' ),
621 'description' => '',
622 'priority' => 35,
623 'panel' => 'loginpress_panel',
624 ) );
625
626 $welcome_control = array( 'lostpwd_welcome_message', 'welcome_message', 'register_welcome_message', 'logout_message', 'message_background_border' );
627 $welcome_default = array( 'Forgot password?', 'Welcome', 'Register yourself', 'Logout', '' );
628 $welcome_label = array(
629 __( 'Welcome Message on Lost Password:', 'loginpress' ),
630 __( 'Welcome Message on Front Page:', 'loginpress' ),
631 __( 'Welcome Message on Registration:', 'loginpress' ),
632 __( 'Logout Message:', 'loginpress' ),
633 __( 'Message Field Border: ( Example: 1px solid #00a0d2; )', 'loginpress' ),
634 );
635
636 $welcome = 0;
637 while ( $welcome < 5 ) :
638
639 $wp_customize->add_setting( "loginpress_customization[{$welcome_control[$welcome]}]", array(
640 'default' => $welcome_default[ $welcome ],
641 'type' => 'option',
642 'capability' => 'manage_options',
643 'transport' => 'postMessage'
644 ));
645
646 $wp_customize->add_control( "loginpress_customization[{$welcome_control[$welcome]}]", array(
647 'label' => $welcome_label[ $welcome ],
648 'section' => 'section_welcome',
649 'priority' => 5,
650 'settings' => "loginpress_customization[{$welcome_control[$welcome]}]",
651 ) );
652
653 $welcome++;
654 endwhile;
655
656 $wp_customize->add_setting( 'loginpress_customization[message_background_color]', array(
657 // 'default' => '#fff',
658 'type' => 'option',
659 'capability' => 'manage_options',
660 'transport' => 'postMessage'
661 ) );
662
663 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[message_background_color]', array(
664 'label' => __( 'Message Field Background Color:', 'loginpress' ),
665 'section' => 'section_welcome',
666 'priority' => 30,
667 'settings' => 'loginpress_customization[message_background_color]'
668 ) ) );
669
670 // =============================
671 // = Section for Header message
672 // =============================
673 // $wp_customize->add_section(
674 // 'section_head',
675 // array(
676 // 'title' => __( 'Header Message', 'loginpress' ),
677 // 'description' => '',
678 // 'priority' => 35,
679 // 'panel' => 'loginpress_panel',
680 // ));
681 //
682 // $wp_customize->add_setting( 'loginpress_customization[login_hearder_message]', array(
683 // 'default' => 'Latest NEWS',
684 // 'type' => 'option',
685 // 'capability' => 'edit_theme_options',
686 // ));
687 //
688 // $wp_customize->add_control( 'login_hearder_message', array(
689 // 'label' => __( 'Header Message:', 'loginpress' ),
690 // 'section' => 'section_head',
691 // 'priority' => 5,
692 // 'settings' => 'loginpress_customization[login_hearder_message]',
693 // ));
694 //
695 // $wp_customize->add_setting( 'loginpress_customization[login_hearder_message_link]', array(
696 // 'default' => '#',
697 // 'type' => 'option',
698 // 'capability' => 'edit_theme_options',
699 // ));
700 //
701 // $wp_customize->add_control( 'login_hearder_message_link', array(
702 // 'label' => __( 'Header Message Link:', 'loginpress' ),
703 // 'section' => 'section_head',
704 // 'priority' => 5,
705 // 'settings' => 'loginpress_customization[login_hearder_message_link]',
706 // ));
707 //
708 // $wp_customize->add_setting( 'loginpress_customization[login_head_color]', array(
709 // 'default' => '#17a8e3',
710 // 'type' => 'option',
711 // 'capability' => 'edit_theme_options',
712 // ));
713 //
714 // $wp_customize->add_control(
715 // new WP_Customize_Color_Control(
716 // $wp_customize,
717 // 'login_head_color',
718 // array(
719 // 'label' => __( 'Header Text Color:', 'loginpress' ),
720 // 'section' => 'section_head',
721 // 'priority' => 10,
722 // 'settings' => 'loginpress_customization[login_head_color]'
723 // )));
724 //
725 // $wp_customize->add_setting( 'loginpress_customization[login_head_color_hover]', array(
726 // // 'default' => '#17a8e3',
727 // 'type' => 'option',
728 // 'capability' => 'edit_theme_options',
729 // ));
730 //
731 // $wp_customize->add_control(
732 // new WP_Customize_Color_Control(
733 // $wp_customize,
734 // 'login_head_color_hover',
735 // array(
736 // 'label' => __( 'Header Text Hover Color:', 'loginpress' ),
737 // 'section' => 'section_head',
738 // 'priority' => 15,
739 // 'settings' => 'loginpress_customization[login_head_color_hover]'
740 // )));
741 //
742 // $wp_customize->add_setting( 'loginpress_customization[login_head_font_size]', array(
743 // 'default' => '13px;',
744 // 'type' => 'option',
745 // 'capability' => 'edit_theme_options',
746 // ));
747 //
748 // $wp_customize->add_control( 'login_head_font_size', array(
749 // 'label' => __( 'Text Font Size:', 'loginpress' ),
750 // 'section' => 'section_head',
751 // 'priority' => 20,
752 // 'settings' => 'loginpress_customization[login_head_font_size]',
753 // ));
754 //
755 // $wp_customize->add_setting( 'loginpress_customization[login_head_bg_color]', array(
756 // // 'default' => '#17a8e3',
757 // 'type' => 'option',
758 // 'capability' => 'edit_theme_options',
759 // ));
760 //
761 // $wp_customize->add_control(
762 // new WP_Customize_Color_Control(
763 // $wp_customize,
764 // 'login_head_bg_color',
765 // array(
766 // 'label' => __( 'Header Background Color:', 'loginpress' ),
767 // 'section' => 'section_head',
768 // 'priority' => 25,
769 // 'settings' => 'loginpress_customization[login_head_bg_color]'
770 // )));
771
772 // =============================
773 // = Custom Header Login menu =
774 // =============================
775 // $menuVals = array();
776 // $menus = get_registered_nav_menus();
777 //
778 // foreach ( $menus as $location => $name ) {
779 // $menuVals[$location] = $name ;
780 // }
781 // $wp_customize->add_section(
782 // 'customize_menu_section',
783 // array(
784 // 'title' => __( 'Login Page Menus', 'loginpress' ),
785 // 'description' => '',
786 // 'priority' => 32,
787 // 'panel' => 'loginpress_panel',
788 // ));
789 //
790 // $wp_customize->add_setting('loginpress_customization[header_login_menu]', array(
791 // 'capability' => 'edit_theme_options',
792 // 'type' => 'option',
793 // ));
794 //
795 // $wp_customize->add_control('header_login_menu', array(
796 // 'settings' => 'loginpress_customization[header_login_menu]',
797 // 'label' => __( 'Display Header Menu?', 'loginpress'),
798 // 'section' => 'customize_menu_section',
799 // 'priority' => 5,
800 // 'type' => 'checkbox',
801 // ));
802 //
803 // $wp_customize->add_setting('loginpress_customization[customize_login_menu]', array(
804 // 'capability' => 'edit_theme_options',
805 // 'type' => 'option',
806 //
807 // ));
808 // $wp_customize->add_control( 'customize_login_menu', array(
809 // 'settings' => 'loginpress_customization[customize_login_menu]',
810 // 'label' => __( 'Select Menu for Header:', 'loginpress' ),
811 // 'section' => 'customize_menu_section',
812 // 'type' => 'select',
813 // 'priority' => 10,
814 // 'choices' => $menuVals,
815 // ));
816 //
817 // $wp_customize->add_setting('loginpress_customization[footer_login_menu]', array(
818 // 'capability' => 'edit_theme_options',
819 // 'type' => 'option',
820 // ));
821 //
822 // $wp_customize->add_control('footer_login_menu', array(
823 // 'settings' => 'loginpress_customization[footer_login_menu]',
824 // 'label' => __( 'Display Footer Menu?', 'loginpress' ),
825 // 'section' => 'customize_menu_section',
826 // 'priority' => 15,
827 // 'type' => 'checkbox',
828 // ));
829 //
830 // $wp_customize->add_setting('loginpress_customization[customize_login_footer_menu]', array(
831 // 'capability' => 'edit_theme_options',
832 // 'type' => 'option',
833 //
834 // ));
835 // $wp_customize->add_control( 'customize_login_footer_menu', array(
836 // 'settings' => 'loginpress_customization[customize_login_footer_menu]',
837 // 'label' => __( 'Select Menu:', 'loginpress' ),
838 // 'section' => 'customize_menu_section',
839 // 'priority' => 20,
840 // 'type' => 'select',
841 // 'choices' => $menuVals,
842 // ));
843
844 // =============================
845 // = Section for Form Footer =
846 // =============================
847 $wp_customize->add_section( 'section_fotter', array(
848 'title' => __( 'Form Footer', 'loginpress' ),
849 'description' => '',
850 'priority' => 40,
851 'panel' => 'loginpress_panel',
852 ) );
853
854 $wp_customize->add_setting( 'loginpress_customization[login_footer_text]', array(
855 'default' => 'Lost your password?',
856 'type' => 'option',
857 'capability' => 'manage_options',
858 'transport' => 'postMessage'
859 ) );
860
861 $wp_customize->add_control( 'loginpress_customization[login_footer_text]', array(
862 'label' => __( 'Lost Password Text', 'loginpress' ),
863 'section' => 'section_fotter',
864 'priority' => 5,
865 'settings' => 'loginpress_customization[login_footer_text]',
866 ) );
867
868 $wp_customize->add_setting( 'loginpress_customization[footer_display_text]', array(
869 'default' => 'block',
870 'type' => 'option',
871 'capability' => 'manage_options',
872 'transport' => 'postMessage'
873 ));
874
875 $wp_customize->add_control( 'loginpress_customization[footer_display_text]', array(
876 'label' => __( 'Footer Text Display:', 'loginpress' ),
877 'section' => 'section_fotter',
878 'priority' => 10,
879 'settings' => 'loginpress_customization[footer_display_text]',
880 'type' => 'radio',
881 'choices' => array(
882 'block' => 'show',
883 'none' => 'hide',
884 ),
885 ) );
886
887 $wp_customize->add_setting( 'loginpress_customization[login_footer_text_decoration]', array(
888 'default' => 'none',
889 'type' => 'option',
890 'capability' => 'manage_options',
891 'transport' => 'postMessage'
892
893 ) );
894 $wp_customize->add_control( 'loginpress_customization[login_footer_text_decoration]', array(
895 'settings' => 'loginpress_customization[login_footer_text_decoration]',
896 'label' => 'Select Text Decoration:',
897 'section' => 'section_fotter',
898 'priority' => 15,
899 'type' => 'select',
900 'choices' => array(
901 'none' => 'none',
902 'overline' => 'overline',
903 'line-through' => 'line-through',
904 'underline' => 'underline',
905 ),
906 ) );
907
908 $wp_customize->add_setting( 'loginpress_customization[login_footer_color]', array(
909 // 'default' => '#17a8e3',
910 'type' => 'option',
911 'capability' => 'manage_options',
912 'transport' => 'postMessage'
913 ) );
914
915 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_footer_color]', array(
916 'label' => __( 'Footer Text Color:', 'loginpress' ),
917 'section' => 'section_fotter',
918 'priority' => 20,
919 'settings' => 'loginpress_customization[login_footer_color]'
920 ) ) );
921
922 $wp_customize->add_setting( 'loginpress_customization[login_footer_color_hover]', array(
923 // 'default' => '#17a8e3',
924 'type' => 'option',
925 'capability' => 'manage_options',
926 'transport' => 'postMessage'
927 ) );
928
929 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_footer_color_hover]', array(
930 'label' => __( 'Footer Text Hover Color:', 'loginpress' ),
931 'section' => 'section_fotter',
932 'priority' => 25,
933 'settings' => 'loginpress_customization[login_footer_color_hover]'
934 ) ) );
935
936 $wp_customize->add_setting( 'loginpress_customization[login_footer_font_size]', array(
937 'default' => '13px',
938 'type' => 'option',
939 'capability' => 'manage_options',
940 'transport' => 'postMessage'
941 ) );
942
943 $wp_customize->add_control( 'loginpress_customization[login_footer_font_size]', array(
944 'label' => __( 'Text Font Size:', 'loginpress' ),
945 'section' => 'section_fotter',
946 'priority' => 30,
947 'settings' => 'loginpress_customization[login_footer_font_size]',
948 ) );
949
950 $wp_customize->add_setting( 'loginpress_customization[login_footer_bg_color]', array(
951 // 'default' => '#17a8e3',
952 'type' => 'option',
953 'capability' => 'manage_options',
954 'transport' => 'postMessage'
955 ) );
956
957 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_footer_bg_color]', array(
958 'label' => __( 'Footer Background Color:', 'loginpress' ),
959 'section' => 'section_fotter',
960 'priority' => 35,
961 'settings' => 'loginpress_customization[login_footer_bg_color]'
962 ) ) );
963 // Fields for Back Link
964 // $wp_customize->add_setting( 'login_back_text', array(
965 // 'default' => 'Lost your password?',
966 // 'type' => 'option',
967 // 'capability' => 'edit_theme_options',
968 // ));
969
970 // $wp_customize->add_control( 'login_back_text', array(
971 // 'label' => __( 'Lost Password Text', 'loginpress' ),
972 // 'section' => 'section_fotter',
973 // 'priority' => 40,
974 // 'settings' => 'login_back_text',
975 // ));
976
977 $wp_customize->add_setting( 'loginpress_customization[back_display_text]', array(
978 'default' => 'block',
979 'type' => 'option',
980 'capability' => 'manage_options',
981 'transport' => 'postMessage'
982 ) );
983
984 $wp_customize->add_control( 'loginpress_customization[back_display_text]', array(
985 'label' => __( '"Back to" Text Display:', 'loginpress' ),
986 'section' => 'section_fotter',
987 'priority' => 45,
988 'settings' => 'loginpress_customization[back_display_text]',
989 'type' => 'radio',
990 'choices' => array(
991 'block' => 'show',
992 'none' => 'hide',
993 ),
994 ) );
995
996 $wp_customize->add_setting( 'loginpress_customization[login_back_text_decoration]', array(
997 'default' => 'none',
998 'type' => 'option',
999 'capability' => 'manage_options',
1000 'transport' => 'postMessage'
1001
1002 ) );
1003 $wp_customize->add_control( 'loginpress_customization[login_back_text_decoration]', array(
1004 'settings' => 'loginpress_customization[login_back_text_decoration]',
1005 'label' => __( '"Back to" Text Decoration:', 'loginpress' ),
1006 'section' => 'section_fotter',
1007 'priority' => 50,
1008 'type' => 'select',
1009 'choices' => array(
1010 'none' => 'none',
1011 'overline' => 'overline',
1012 'line-through' => 'line-through',
1013 'underline' => 'underline',
1014 ),
1015 ) );
1016
1017 $wp_customize->add_setting( 'loginpress_customization[login_back_color]', array(
1018 // 'default' => '#17a8e3',
1019 'type' => 'option',
1020 'capability' => 'manage_options',
1021 'transport' => 'postMessage'
1022 ) );
1023
1024 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_back_color]', array(
1025 'label' => __( '"Back to" Text Color:', 'loginpress' ),
1026 'section' => 'section_fotter',
1027 'priority' => 55,
1028 'settings' => 'loginpress_customization[login_back_color]'
1029 ) ) );
1030
1031 $wp_customize->add_setting( 'loginpress_customization[login_back_color_hover]', array(
1032 // 'default' => '#17a8e3',
1033 'type' => 'option',
1034 'capability' => 'manage_options',
1035 'transport' => 'postMessage'
1036 ) );
1037
1038 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_back_color_hover]', array(
1039 'label' => __( '"Back to" Text Hover Color:', 'loginpress' ),
1040 'section' => 'section_fotter',
1041 'priority' => 60,
1042 'settings' => 'loginpress_customization[login_back_color_hover]'
1043 ) ) );
1044
1045 $wp_customize->add_setting( 'loginpress_customization[login_back_font_size]', array(
1046 'default' => '13px;',
1047 'type' => 'option',
1048 'capability' => 'manage_options',
1049 'transport' => 'postMessage'
1050 ) );
1051
1052 $wp_customize->add_control( 'loginpress_customization[login_back_font_size]', array(
1053 'label' => __( '"Back to" Text Font Size:', 'loginpress' ),
1054 'section' => 'section_fotter',
1055 'priority' => 65,
1056 'settings' => 'loginpress_customization[login_back_font_size]',
1057 ) );
1058
1059 $wp_customize->add_setting( 'loginpress_customization[login_back_bg_color]', array(
1060 // 'default' => '#17a8e3',
1061 'type' => 'option',
1062 'capability' => 'manage_options',
1063 'transport' => 'postMessage'
1064 ) );
1065
1066 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_back_bg_color]', array(
1067 'label' => __( 'Footer Background Color:', 'loginpress' ),
1068 'section' => 'section_fotter',
1069 'priority' => 70,
1070 'settings' => 'loginpress_customization[login_back_bg_color]'
1071 ) ) );
1072
1073 $wp_customize->add_setting( 'loginpress_customization[login_footer_copy_right]', array(
1074 'default' => sprintf( __('© 2017 %1$s, All Rights Reserved.', 'loginpress'), get_bloginfo('name') ),
1075 'type' => 'option',
1076 'capability' => 'manage_options',
1077 'transport' => 'postMessage'
1078 ) );
1079
1080 $wp_customize->add_control( 'loginpress_customization[login_footer_copy_right]', array(
1081 'label' => __( 'Copyright Note:', 'loginpress' ),
1082 'type' => 'textarea',
1083 'section' => 'section_fotter',
1084 'priority' => 75,
1085 'settings' => 'loginpress_customization[login_footer_copy_right]'
1086 ) );
1087
1088 // =============================
1089 // = Section for Custom CSS =
1090 // =============================
1091 $wp_customize->add_section(
1092 'section_css',
1093 array(
1094 'title' => __( 'Custom CSS', 'loginpress' ),
1095 'description' => '',
1096 'priority' => 50,
1097 'panel' => 'loginpress_panel',
1098 ) );
1099
1100 $wp_customize->add_setting( 'loginpress_customization[loginpress_custom_css]', array(
1101 'type' => 'option',
1102 'capability' => 'manage_options',
1103 'transport' => 'postMessage'
1104 ) );
1105
1106 $wp_customize->add_control( 'loginpress_customization[loginpress_custom_css]', array(
1107 'label' => __( 'Customize CSS', 'loginpress' ),
1108 'type' => 'textarea',
1109 'section' => 'section_css',
1110 'priority' => 5,
1111 'settings' => 'loginpress_customization[loginpress_custom_css]'
1112 ) );
1113
1114 // =============================
1115 // = Section for Custom JS =
1116 // =============================
1117 $wp_customize->add_section(
1118 'section_js',
1119 array(
1120 'title' => __( 'Custom JS', 'loginpress' ),
1121 'description' => '',
1122 'priority' => 55,
1123 'panel' => 'loginpress_panel',
1124 ) );
1125
1126 $wp_customize->add_setting( 'loginpress_customization[loginpress_custom_js]', array(
1127 'type' => 'option',
1128 'capability' => 'manage_options',
1129 'transport' => 'postMessage'
1130 ) );
1131
1132 $wp_customize->add_control( 'loginpress_customization[loginpress_custom_js]', array(
1133 'label' => __( 'Customize JS', 'loginpress' ),
1134 'type' => 'textarea',
1135 'section' => 'section_js',
1136 'priority' => 5,
1137 'settings' => 'loginpress_customization[loginpress_custom_js]'
1138 ) );
1139 }
1140
1141 /**
1142 * Manage the Login Footer Links
1143 *
1144 * @since 1.0.0
1145 * * * * * * * * * * * * * * * */
1146 public function login_page_custom_footer() {
1147
1148 if ( $this->loginpress_key ) {
1149
1150 // echo '</div></div>';
1151 echo '<div class="footer-wrapper">';
1152 echo '<div class="footer-cont">';
1153
1154 // if ( array_key_exists( 'footer_login_menu', $this->loginpress_key ) && checked( $this->loginpress_key['footer_login_menu'], true, false ) ) {
1155 //
1156 // wp_nav_menu( array(
1157 // 'theme_location' => $this->loginpress_key['customize_login_footer_menu'],
1158 // 'container' => false,
1159 // 'menu_class' => 'loginFooterMenu',
1160 // 'echo' => true,
1161 // )
1162 // );
1163 //
1164 // }
1165
1166 if ( array_key_exists( 'login_footer_copy_right', $this->loginpress_key ) && !empty( $this->loginpress_key['login_footer_copy_right'] ) ) {
1167
1168 echo '<div class="copyRight">'.$this->loginpress_key['login_footer_copy_right'].'</div>';
1169 }
1170
1171 echo '</div></div>';
1172 }
1173 }
1174
1175 /**
1176 * Manage the Login Head
1177 *
1178 * @since 1.0.0
1179 * * * * * * * * * * * */
1180 public function login_page_custom_head() {
1181
1182 // Include CSS File in heared.
1183
1184 include( LOGINPRESS_DIR_PATH . 'css/style-presets.php' );
1185 include( LOGINPRESS_DIR_PATH . 'css/style-login.php' );
1186
1187
1188 if ( $this->loginpress_key && array_key_exists( 'header_login_menu', $this->loginpress_key ) ) {
1189
1190 // echo '<div class="header-wrapper">';
1191 // echo '<div class="header-cell">';
1192 // if ( array_key_exists( 'header_login_menu', $this->loginpress_key ) && checked( $this->loginpress_key['header_login_menu'], true, false ) ) {
1193 //
1194 // wp_nav_menu( array(
1195 // 'theme_location' => $this->loginpress_key['customize_login_menu'],
1196 // 'container' => false,
1197 // 'menu_class' => 'loginHeaderMenu',
1198 // 'echo' => true,
1199 // )
1200 // );
1201 // }
1202 // echo '</div></div><div class="login-wrapper"><div class="login-cell">';
1203 }
1204 }
1205 /**
1206 * Set Redirect Path of Logo
1207 *
1208 * @since 1.0.0
1209 * @return mixed
1210 * * * * * * * * * * * * * */
1211 public function login_page_logo_url() {
1212
1213 if ( $this->loginpress_key && array_key_exists( 'customize_logo_hover', $this->loginpress_key ) ) {
1214 return $this->loginpress_key["customize_logo_hover"];
1215 } else {
1216 return home_url();
1217 }
1218 }
1219
1220 /**
1221 * Set hover Title of Logo
1222 *
1223 * @since 1.0.0
1224 * @return mixed
1225 * * * * * * * * * * * * */
1226 public function login_page_logo_title() {
1227 if ( $this->loginpress_key && array_key_exists( 'customize_logo_hover_title', $this->loginpress_key ) ) {
1228 return $this->loginpress_key["customize_logo_hover_title"];
1229 } else {
1230 return home_url();
1231 }
1232 }
1233
1234 /**
1235 * Set Errors Messages to Show off
1236 *
1237 * @param $error
1238 * @since 1.0.0
1239 * @return string
1240 * * * * * * * * * * * * * * * * */
1241 public function login_error_messages($error) {
1242
1243 global $errors;
1244 $error_codes = $errors->get_error_codes();
1245 if ( $this->loginpress_key ) {
1246
1247 $invalid_usrname = array_key_exists( 'incorrect_username', $this->loginpress_key ) ? $this->loginpress_key['incorrect_username']: esc_html__( 'Invalid Username', 'loginpress' );
1248
1249 $invalid_pasword = array_key_exists( 'incorrect_password', $this->loginpress_key ) ? $this->loginpress_key['incorrect_password']: esc_html__( 'Invalid Password', 'loginpress' );
1250
1251 $empty_username = array_key_exists( 'empty_username', $this->loginpress_key ) ? $this->loginpress_key['empty_username']: esc_html__( 'Empty Username', 'loginpress' );
1252
1253 $empty_password = array_key_exists( 'empty_password', $this->loginpress_key ) ? $this->loginpress_key['empty_password']: esc_html__( 'Empty Password', 'loginpress' );
1254
1255 $invalid_email = array_key_exists( 'invalid_email', $this->loginpress_key ) ? $this->loginpress_key['invalid_email']: esc_html__( 'The email address is incorrect.', 'loginpress' );
1256
1257 $empty_email = array_key_exists( 'empty_email', $this->loginpress_key ) ? $this->loginpress_key['empty_email']: esc_html__( 'The email address is empty.', 'loginpress' );
1258
1259 $invalidcombo = array_key_exists( 'invalidcombo_message', $this->loginpress_key ) ? $this->loginpress_key['invalidcombo_message']: esc_html__( 'Invalid Username or Email.', 'loginpress' );
1260
1261 if ( in_array( 'invalid_username', $error_codes ) ) return $invalid_usrname;
1262
1263 if ( in_array( 'incorrect_password', $error_codes ) ) return $invalid_pasword;
1264
1265 if ( in_array( 'empty_username', $error_codes ) ) return $empty_username;
1266
1267 if ( in_array( 'empty_password', $error_codes ) ) return $empty_password;
1268
1269 // registeration Form enteries
1270 if ( in_array( 'invalid_email', $error_codes ) ) return $invalid_email;
1271
1272 if ( in_array( 'empty_email', $error_codes ) ) return "</br>" . $empty_email;
1273
1274 //forget password entery
1275 if ( in_array( 'invalidcombo', $error_codes ) ) return $invalidcombo;
1276 }
1277
1278 return $error;
1279 }
1280
1281 /**
1282 * Change Lost Password Text from Form
1283 *
1284 * @param $text
1285 * @since 1.0.0
1286 * @return mixed
1287 * * * * * * * * * * * * * * * * * * */
1288 public function change_lostpassword_message ( $text ) {
1289 $savedText = '';
1290 if ( $this->loginpress_key && array_key_exists( 'login_footer_text', $this->loginpress_key ) ) {
1291
1292 $savedText = $this->loginpress_key['login_footer_text'];
1293 }
1294
1295 if ( $text == 'Lost your password?' || $text == $savedText ) {
1296
1297 if ( $this->loginpress_key && array_key_exists( 'login_footer_text', $this->loginpress_key ) ) {
1298
1299 $text = $savedText; //$this->loginpress_key['login_footer_text'];
1300 }
1301
1302 }
1303
1304 return $text;
1305
1306 }
1307
1308 /**
1309 * Manage Welcome Messages
1310 *
1311 * @param $message
1312 * @since 1.0.0
1313 * @return string
1314 * * * * * * * * * * * * */
1315 public function change_welcome_message ($message) {
1316 if ( $this->loginpress_key ) {
1317
1318 //Check, User Logedout.
1319 if ( isset($_GET['loggedout']) && TRUE == $_GET['loggedout'] ) {
1320
1321 if ( array_key_exists( 'logout_message', $this->loginpress_key ) ) {
1322
1323 $message = $this->loginpress_key['logout_message'];
1324 }
1325 }
1326
1327 //Logged In messages.
1328 else if ( strpos( $message,"Please enter your username or email address. You will receive a link to create a new password via email." ) == true ) {
1329
1330 if ( array_key_exists( 'lostpwd_welcome_message', $this->loginpress_key ) ) {
1331
1332 $message = $this->loginpress_key['lostpwd_welcome_message'];
1333 }
1334 }
1335
1336 else if( strpos( $message,"Register For This Site" ) == true ) {
1337
1338 if ( array_key_exists( 'register_welcome_message', $this->loginpress_key ) ) {
1339
1340 $message = $this->loginpress_key['register_welcome_message'];
1341 }
1342 }
1343
1344 else {
1345 if ( array_key_exists( 'welcome_message', $this->loginpress_key ) ) {
1346
1347 $message = $this->loginpress_key['welcome_message'];
1348 }
1349 }
1350
1351 return !empty($message) ? "<p class='custom-message'>" . $message. "</p>" : '';
1352 }
1353 }
1354
1355 /**
1356 * Hook to Redirect Page for Customize
1357 *
1358 * @since 1.0.0
1359 * * * * * * * * * * * * * * * * * * */
1360 public function redirect_to_custom_page() {
1361 if ( ! empty($_GET['page'] ) ) {
1362
1363 if( ( $_GET['page'] == "abw" ) || ( $_GET['page'] == "loginpress" ) ) {
1364
1365 wp_redirect(get_admin_url()."customize.php?url=".wp_login_url());
1366 }
1367 }
1368 }
1369
1370 /**
1371 * Redirect to the Admin Panel After Closing LoginPress Customizer
1372 *
1373 * @since 1.0.0
1374 * @return null
1375 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1376 public function menu_url() {
1377
1378 global $submenu;
1379
1380 $parent = 'index.php';
1381 $page = 'abw';
1382
1383 // Create specific url for login view
1384 $login_url = wp_login_url();
1385 $url = add_query_arg(
1386 array(
1387 'url' => urlencode( $login_url ),
1388 'return' => admin_url( 'themes.php' ),
1389 ),
1390 admin_url( 'customize.php' )
1391 );
1392
1393 // If is Not Design Menu, return
1394 if ( ! isset( $submenu[ $parent ] ) ) {
1395 return NULL;
1396 }
1397
1398 foreach ( $submenu[ $parent ] as $key => $value ) {
1399 // Set new URL for menu item
1400 if ( $page === $value[ 2 ] ) {
1401 $submenu[ $parent ][ $key ][ 2 ] = $url;
1402 break;
1403 }
1404 }
1405 }
1406 }
1407
1408 ?>
1409