PluginProbe
LoginPress | wp-login Custom Login Page Customizer / 1.1.22
LoginPress | wp-login Custom Login Page Customizer v1.1.22
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.1.22, at custom.php

1,920 lines 77.7 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 * @version 1.1.22
11 */
12 public $loginpress_key;
13
14 /**
15 * Class constructor
16 */
17 public function __construct() {
18
19 $this->loginpress_key = get_option( 'loginpress_customization' );
20 $this->_hooks();
21 }
22
23
24 /**
25 * Hook into actions and filters
26 *
27 * @since 1.0.0
28 */
29 private function _hooks() {
30
31 add_filter( 'login_headerurl', array( $this, 'login_page_logo_url' ) );
32 add_filter( 'login_headertitle', array( $this, 'login_page_logo_title' ) );
33 add_filter( 'login_errors', array( $this, 'login_error_messages' ) );
34
35 add_filter( 'login_message', array( $this, 'change_welcome_message' ) );
36 add_action( 'customize_register', array( $this, 'customize_login_panel' ) );
37 add_action( 'login_footer', array( $this, 'login_page_custom_footer' ) );
38 add_action( 'login_head', array( $this, 'login_page_custom_head' ) );
39 add_action( 'init', array( $this, 'redirect_to_custom_page' ) );
40 add_action( 'admin_menu', array( $this, 'menu_url' ), 10 );
41
42 /**
43 * This function enqueues scripts and styles in the Customizer.
44 */
45 add_action( 'customize_controls_enqueue_scripts', array( $this, 'loginpress_customizer_js' ) );
46
47 /**
48 * This function is triggered on the initialization of the Previewer in the Customizer.
49 * We add actions that pertain to the Previewer window here.
50 * The actions added here are triggered only in the Previewer and not in the Customizer.
51 * @since 1.0.23
52 */
53 add_action( 'customize_preview_init', array( $this, 'loginpress_customizer_previewer_js' ) );
54 add_filter( 'woocommerce_process_login_errors', array( $this, 'loginpress_woo_login_errors' ), 10, 3 );
55
56 }
57
58
59 /**
60 * Enqueue jQuery and use wp_localize_script.
61 *
62 * @since 1.0.9
63 * @version 1.1.3
64 */
65 function loginpress_customizer_js() {
66 wp_enqueue_script('jquery');
67 wp_enqueue_script( 'loginpress-customize-control', plugins_url( 'js/customize-controls.js' , LOGINPRESS_ROOT_FILE ), array( 'jquery', 'customize-preview' ), LOGINPRESS_VERSION, true );
68
69 /*
70 * Our Customizer script
71 *
72 * Dependencies: Customizer Controls script (core)
73 */
74 wp_enqueue_script( 'loginpress-control-script', plugins_url( 'js/customizer.js' , LOGINPRESS_ROOT_FILE ), array( 'customize-controls' ), LOGINPRESS_VERSION, true );
75
76
77 // Get Background URL for use in Customizer JS.
78 $user = wp_get_current_user();
79 $name = empty( $user->user_firstname ) ? ucfirst( $user->display_name ) : ucfirst( $user->user_firstname );
80 $loginpress_bg = get_option( 'loginpress_customization');
81 $loginpress_bg_url = $loginpress_bg['setting_background'] ? $loginpress_bg['setting_background'] : false;
82
83 // Array for localize.
84 $loginpress_localize = array(
85 'admin_url' => admin_url(),
86 'ajaxurl' => admin_url( 'admin-ajax.php' ),
87 'plugin_url' => plugins_url(),
88 'login_theme' => get_option( 'customize_presets_settings', true ),
89 'loginpress_bg_url' => $loginpress_bg_url,
90 'preset_nonce' => wp_create_nonce('loginpress-preset-nonce'),
91 'attachment_nonce' => wp_create_nonce('loginpress-attachment-nonce'),
92 'preset_loader' => includes_url( 'js/tinymce/skins/lightgray/img/loader.gif' ),
93 );
94
95 wp_localize_script( 'loginpress-customize-control', 'loginpress_script', $loginpress_localize );
96
97 }
98
99 /**
100 * This function is called only on the Previwer and enqueues scripts and styles.
101 * Our Customizer script
102 *
103 * Dependencies: Customizer Preview script (core)
104 * @since 1.0.23
105 */
106 function loginpress_customizer_previewer_js() {
107
108 wp_enqueue_style( 'loginpress-customizer-previewer-style', plugins_url( 'css/style-previewer.css' , LOGINPRESS_ROOT_FILE ), array(), LOGINPRESS_VERSION );
109
110 wp_enqueue_script( 'loginpress-customizer-previewer-script', plugins_url( 'js/customizer-previewer.js' , LOGINPRESS_ROOT_FILE ), array( 'customize-preview' ), LOGINPRESS_VERSION, true );
111
112 }
113
114 /**
115 * Create a method of setting and control for LoginPress_Range_Control.
116 * @param object $wp_customize
117 * @param string $control
118 * @param string $default
119 * @param string $label
120 * @param array $input_attr
121 * @param array $unit
122 * @param int $index
123 * @return object
124 * @since 1.1.3
125 */
126 function loginpress_rangle_seting( $wp_customize, $control, $default, $label, $input_attr, $unit, $section, $index, $priority = '' ){
127
128 $wp_customize->add_setting( "loginpress_customization[{$control[$index]}]", array(
129 'default' => $default[$index],
130 'type' => 'option',
131 'capability' => 'manage_options',
132 'transport' => 'postMessage',
133 'sanitize_callback' => 'absint',
134 ) );
135
136 $wp_customize->add_control( new LoginPress_Range_Control( $wp_customize, "loginpress_customization[{$control[$index]}]", array(
137 'type' => 'loginpress-range',
138 'label' => $label[$index],
139 'section' => $section,
140 'priority' => $priority,
141 'settings' => "loginpress_customization[{$control[$index]}]",
142 'default' => $default[$index],
143 'input_attrs' => $input_attr[$index],
144 'unit' => $unit[$index],
145 ) ) );
146 }
147
148 /**
149 * Create a method of setting and control for LoginPress_Group_Control.
150 * @param object $wp_customize
151 * @param string $control
152 * @param string $label
153 * @param string $section
154 * @param string $info_test
155 * @param int $index
156 * @return object
157 * @since 1.1.3
158 */
159 function loginpress_group_setting( $wp_customize, $control, $label, $info_test, $section, $index, $priority = '' ){
160
161 $wp_customize->add_setting( "loginpress_customization[{$control[$index]}]", array(
162 'type' => 'option',
163 'capability' => 'manage_options',
164 'transport' => 'postMessage'
165 ) );
166
167 $wp_customize->add_control( new LoginPress_Group_Control( $wp_customize, "loginpress_customization[{$control[$index]}]", array(
168 'settings' => "loginpress_customization[{$control[$index]}]",
169 'label' => $label[$index],
170 'section' => $section,
171 'type' => 'group',
172 'info_text' => $info_test[$index],
173 'priority' => $priority,
174 ) ) );
175 }
176
177 /**
178 * Create a method of setting and control for WP_Customize_Color_Control.
179 * @param object $wp_customize
180 * @param string $control
181 * @param string $label
182 * @param string $section
183 * @param int $index
184 * @return object
185 * @since 1.1.3
186 */
187 function loginpress_color_setting( $wp_customize, $control, $label, $section, $index, $priority = '' ){
188
189 $wp_customize->add_setting( "loginpress_customization[{$control[$index]}]", array(
190 // 'default' => $form_color_default[$form_color],
191 'type' => 'option',
192 'capability' => 'manage_options',
193 'transport' => 'postMessage',
194 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
195 ) );
196
197 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, "loginpress_customization[{$control[$index]}]", array(
198 'label' => $label[$index],
199 'section' => $section,
200 'settings' => "loginpress_customization[{$control[$index]}]",
201 'priority' => $priority,
202 ) ) );
203 }
204
205 function loginpress_hr_setting( $wp_customize, $control, $section, $index, $priority = '' ){
206
207 $wp_customize->add_setting( "loginpress_customization[{$control[$index]}]", array(
208 'sanitize_callback' => 'sanitize_text_field',
209 ) );
210
211 $wp_customize->add_control( new LoginPress_Misc_Control( $wp_customize, "loginpress_customization[{$control[$index]}]", array(
212 'section' => $section,
213 'type' => 'hr',
214 'priority' => $priority,
215 ) ) );
216 }
217
218 /**
219 * Register plugin settings Panel in WP Customizer
220 *
221 * @param $wp_customize
222 * @since 1.0.0
223 */
224 public function customize_login_panel( $wp_customize ) {
225
226 include LOGINPRESS_ROOT_PATH . 'classes/control-presets.php';
227
228 include LOGINPRESS_ROOT_PATH . 'classes/controls/background-gallery.php';
229
230 include LOGINPRESS_ROOT_PATH . 'classes/controls/range.php';
231
232 include LOGINPRESS_ROOT_PATH . 'classes/controls/group.php';
233
234 include LOGINPRESS_ROOT_PATH . 'classes/controls/radio-button.php';
235
236 include LOGINPRESS_ROOT_PATH . 'classes/controls/miscellaneous.php';
237
238 include LOGINPRESS_ROOT_PATH . 'include/customizer-strings.php';
239
240 include LOGINPRESS_ROOT_PATH . 'include/customizer-validation.php';
241
242 if ( ! has_action( 'loginpress_pro_add_template' ) ) :
243 include LOGINPRESS_ROOT_PATH . 'classes/class-loginpress-promo.php';
244 endif;
245
246 // =============================
247 // = Panel for the LoginPress =
248 // =============================
249 $wp_customize->add_panel( 'loginpress_panel', array(
250 'title' => __( 'LoginPress', 'loginpress' ),
251 'description' => __( 'Customize Your WordPress Login Page with LoginPress :)', 'loginpress' ),
252 'priority' => 30,
253 ) );
254
255 /**
256 * =============================
257 * = Section for Presets =
258 * =============================
259 *
260 * @since 1.0.9
261 * @version 1.1.16
262 */
263 $wp_customize->add_section( 'customize_presets', array(
264 'title' => __( 'Themes', 'loginpress' ),
265 'description' => __( 'Choose Theme', 'loginpress' ),
266 'priority' => 1,
267 'panel' => 'loginpress_panel',
268 ) );
269
270 $wp_customize->add_setting( 'customize_presets_settings', array(
271 'default' => 'default1',
272 'type' => 'option',
273 // 'transport' => 'postMessage',
274 'capability' => 'manage_options',
275 ) );
276
277 $loginpress_free_templates = array();
278 $loginpress_theme_name = array( "", "",
279 __( 'Company', 'loginpress' ),
280 __( 'Persona', 'loginpress' ),
281 __( 'Corporate', 'loginpress' ),
282 __( 'Corporate', 'loginpress' ),
283 __( 'Startup', 'loginpress' ),
284 __( 'Wedding', 'loginpress' ),
285 __( 'Wedding #2', 'loginpress' ),
286 __( 'Company', 'loginpress' ),
287 __( 'Bikers', 'loginpress' ),
288 __( 'Fitness', 'loginpress' ),
289 __( 'Shopping', 'loginpress' ),
290 __( 'Writers', 'loginpress' ),
291 __( 'Persona', 'loginpress' ),
292 __( 'Geek', 'loginpress' ),
293 __( 'Innovation', 'loginpress' ),
294 __( 'Photographers', 'loginpress' ) );
295
296 // 1st template that is default
297 $loginpress_free_templates["default1" ] = array(
298 'img' => plugins_url( 'img/bg.jpg', LOGINPRESS_ROOT_FILE ),
299 'thumbnail' => plugins_url( 'img/thumbnail/default-1.png', LOGINPRESS_ROOT_FILE ),
300 'id' => 'default1',
301 'name' => 'Default'
302 ) ;
303
304 // Loof through the templates.
305 $_count = 2;
306 while ( $_count <= 17 ) :
307
308 $loginpress_free_templates["default{$_count}" ] = array(
309 // 'img' => plugins_url( 'img/bg.jpg', LOGINPRESS_ROOT_FILE ),
310 'thumbnail' => plugins_url( "img/thumbnail/default-{$_count}.png", LOGINPRESS_ROOT_FILE ),
311 'id' => "default{$_count}",
312 'name' => $loginpress_theme_name[$_count],
313 'pro' => 'yes'
314 );
315 $_count++;
316 endwhile;
317
318 // 18th template for custom design.
319 $loginpress_free_templates["default18" ] = array(
320 'img' => plugins_url( 'loginpress/img/bg17.jpg', LOGINPRESS_ROOT_PATH ),
321 'thumbnail' => plugins_url( 'loginpress/img/thumbnail/custom-design.png', LOGINPRESS_ROOT_PATH ),
322 'id' => 'default18',
323 'name' => __( 'Custom Design', 'loginpress' ),
324 'link' => 'yes'
325 );
326 $loginpress_templates = apply_filters( 'loginpress_pro_add_template', $loginpress_free_templates );
327
328 $wp_customize->add_control( new LoginPress_Presets( $wp_customize, 'customize_presets_settings',
329 array(
330 'section' => 'customize_presets',
331 // 'label' => __( 'Themes', 'loginpress' ),
332 'choices' => $loginpress_templates
333 ) ) );
334 //End of Presets.
335
336
337 // =============================
338 // = Section for Login Logo =
339 // =============================
340 $wp_customize->add_section( 'customize_logo_section', array(
341 'title' => __( 'Logo', 'loginpress' ),
342 'description' => __( 'Customize Your Logo Section', 'loginpress' ),
343 'priority' => 5,
344 'panel' => 'loginpress_panel',
345 ) );
346
347 /**
348 * [ Enable / Disabe Logo Image with LoginPress_Radio_Control ]
349 * @since 1.1.3
350 */
351
352 $wp_customize->add_setting( 'loginpress_customization[setting_logo_display]', array(
353 'default' => false,
354 'type' => 'option',
355 'capability' => 'manage_options',
356 'transport' => 'postMessage',
357 'sanitize_callback' => 'loginpress_sanitize_checkbox'
358 ) );
359
360 $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[setting_logo_display]', array(
361 'settings' => 'loginpress_customization[setting_logo_display]',
362 'label' => __( 'Disable Logo:', 'loginpress'),
363 'section' => 'customize_logo_section',
364 'priority' => 4,
365 'type' => 'ios', // light, ios, flat
366 ) ) );
367
368 $wp_customize->add_setting( 'loginpress_customization[setting_logo]', array(
369 'type' => 'option',
370 'capability' => 'manage_options',
371 'transport' => 'postMessage',
372 'sanitize_callback' => 'loginpress_sanitize_image'
373 ) );
374
375 $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'loginpress_customization[setting_logo]', array(
376 'label' => __( 'Logo Image:', 'loginpress' ),
377 'section' => 'customize_logo_section',
378 'priority' => 5,
379 'settings' => 'loginpress_customization[setting_logo]'
380 ) ) );
381
382 /**
383 * [ Change CSS Properties Input fields with LoginPress_Range_Control ]
384 * @since 1.0.1
385 * @version 1.1.3
386 */
387
388 $this->loginpress_rangle_seting( $wp_customize, $logo_range_control, $logo_range_default, $logo_range_label, $logo_range_attrs, $logo_range_unit, 'customize_logo_section', 0, 10 );
389 $this->loginpress_rangle_seting( $wp_customize, $logo_range_control, $logo_range_default, $logo_range_label, $logo_range_attrs, $logo_range_unit, 'customize_logo_section', 1, 15 );
390 $this->loginpress_rangle_seting( $wp_customize, $logo_range_control, $logo_range_default, $logo_range_label, $logo_range_attrs, $logo_range_unit, 'customize_logo_section', 2, 20 );
391
392 $logo_control = array( 'customize_logo_hover', 'customize_logo_hover_title' );
393 $logo_default = array( '', '' );
394 $logo_label = array( __( 'Logo URL:', 'loginpress' ), __( 'Logo Hover Title:', 'loginpress' ) );
395 $logo_sanitization = array( 'esc_url_raw', 'wp_strip_all_tags' );
396
397 $logo = 0;
398 while ( $logo < 2 ) :
399
400 $wp_customize->add_setting( "loginpress_customization[{$logo_control[$logo]}]", array(
401 'default' => $logo_default[$logo],
402 'type' => 'option',
403 'capability' => 'manage_options',
404 'transport' => 'postMessage',
405 'sanitize_callback' => $logo_sanitization[$logo]
406 ) );
407
408 $wp_customize->add_control( "loginpress_customization[{$logo_control[$logo]}]", array(
409 'label' => $logo_label[$logo],
410 'section' => 'customize_logo_section',
411 'priority' => 25,
412 'settings' => "loginpress_customization[{$logo_control[$logo]}]"
413 ) );
414
415 $logo++;
416 endwhile;
417
418 // =============================
419 // = Section for Background =
420 // =============================
421 $wp_customize->add_section( 'section_background', array(
422 'title' => __( 'Background', 'loginpress' ),
423 'description' => '',
424 'priority' => 10,
425 'panel' => 'loginpress_panel',
426 ) );
427
428 $wp_customize->add_setting( 'loginpress_customization[setting_background_color]', array(
429 // 'default' => '#ddd5c3',
430 'type' => 'option',
431 'capability' => 'manage_options',
432 'transport' => 'postMessage',
433 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
434 ) );
435
436 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[setting_background_color]', array(
437 'label' => __( 'Background Color:', 'loginpress' ),
438 'section' => 'section_background',
439 'priority' => 5,
440 'settings' => 'loginpress_customization[setting_background_color]'
441 ) ) );
442
443 $wp_customize->add_setting( 'loginpress_customization[loginpress_display_bg]', array(
444 'default' => true,
445 'type' => 'option',
446 'capability' => 'manage_options',
447 'transport' => 'postMessage',
448 'sanitize_callback' => 'loginpress_sanitize_checkbox'
449 ) );
450
451 $this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_background', 6, 6 );
452
453 /**
454 * [Enable / Disabe Background Image with LoginPress_Radio_Control]
455 * @since 1.0.1
456 * @version 1.0.23
457 */
458 $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[loginpress_display_bg]', array(
459 'settings' => 'loginpress_customization[loginpress_display_bg]',
460 'label' => __( 'Enable Background Image?', 'loginpress'),
461 'section' => 'section_background',
462 'priority' => 10,
463 'type' => 'ios',// light, ios, flat
464 ) ) );
465
466 $wp_customize->add_setting( 'loginpress_customization[setting_background]', array(
467 // 'default' => plugins_url( 'img/bg.jpg', LOGINPRESS_ROOT_FILE ) ,
468 'type' => 'option',
469 'capability' => 'manage_options',
470 'transport' => 'postMessage',
471 'sanitize_callback' => 'loginpress_sanitize_image'
472 ) );
473
474 $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'loginpress_customization[setting_background]', array(
475 'label' => __( 'Background Image:', 'loginpress' ),
476 'section' => 'section_background',
477 'priority' => 15,
478 'settings' => 'loginpress_customization[setting_background]',
479 'button_labels' => array(
480 'select' => __( 'Select Image', 'loginpress' ),
481 ) ) ) );
482
483 /**
484 * [ Add Background Gallery ]
485 * @since 1.1.0
486 */
487 $wp_customize->add_setting( 'loginpress_customization[gallery_background]', array(
488 'default' => plugins_url( "img/gallery/img-1.jpg", LOGINPRESS_ROOT_FILE ),
489 'type' => 'option',
490 'capability' => 'manage_options',
491 'transport' => 'postMessage'
492 ) );
493
494 $loginpress_free_background = array();
495 $loginpress_background_name = array( "",
496 __( 'Company', 'loginpress' ),
497 __( 'Persona', 'loginpress' ),
498 __( 'Corporate', 'loginpress' ),
499 __( 'Corporate', 'loginpress' ),
500 __( 'Startup', 'loginpress' ),
501 __( 'Wedding', 'loginpress' ),
502 __( 'Wedding #2', 'loginpress' ),
503 __( 'Company', 'loginpress' ),
504 __( 'Bikers', 'loginpress' ) );
505
506 // Loof through the backgrounds.
507 $bg_count = 1;
508 while ( $bg_count <= 9 ) :
509
510 $thumbname = plugins_url( "img/gallery/img-{$bg_count}.jpg", LOGINPRESS_ROOT_FILE );
511 $loginpress_free_background[$thumbname] = array(
512 'thumbnail' => plugins_url( "img/thumbnail/gallery-img-{$bg_count}.jpg", LOGINPRESS_ROOT_FILE ),
513 'id' => $thumbname,
514 'name' => $loginpress_background_name[$bg_count]
515 );
516 $bg_count++;
517 endwhile;
518
519 $loginpress_background = apply_filters( 'loginpress_pro_add_background', $loginpress_free_background );
520
521 $wp_customize->add_control( new LoginPress_Background_Gallery_Control( $wp_customize, 'loginpress_customization[gallery_background]',
522 array(
523 'section' => 'section_background',
524 'label' => __( 'Background Gallery:', 'loginpress' ),
525 'choices' => $loginpress_background
526 ) ) );
527
528 // @version 1.1.21
529 $wp_customize->add_setting( 'loginpress_customization[background_repeat_radio]', array(
530 'default' => 'no-repeat',
531 'type' => 'option',
532 'capability' => 'manage_options',
533 'transport' => 'postMessage',
534 // 'sanitize_callback' => 'loginpress_sanitize_checkbox'
535 ) );
536
537 $wp_customize->add_control( 'loginpress_customization[background_repeat_radio]', array(
538 'label' => __( 'Background Repeat:', 'loginpress' ),
539 'section' => 'section_background',
540 'priority' => 20,
541 'settings' => 'loginpress_customization[background_repeat_radio]',
542 'type' => 'select',
543 'choices' => array(
544 'repeat' => 'repeat',
545 'repeat-x' => 'repeat-x',
546 'repeat-y' => 'repeat-y',
547 'no-repeat' => 'no-repeat',
548 'initial' => 'initial',
549 'inherit' => 'inherit',
550 ),
551 ) );
552
553 // @version 1.1.21
554 $wp_customize->add_setting( 'loginpress_customization[background_position]', array(
555 'default' => 'center',
556 'type' => 'option',
557 'capability' => 'manage_options',
558 'transport' => 'postMessage',
559 'sanitize_callback' => 'loginpress_sanitize_select'
560 ) );
561 $wp_customize->add_control( 'loginpress_customization[background_position]', array(
562 'settings' => 'loginpress_customization[background_position]',
563 'label' => __( 'Select Position:', 'loginpress' ),
564 'section' => 'section_background',
565 'priority' => 25,
566 'type' => 'select',
567 'choices' => array(
568 'left-top' => 'left top',
569 'left-center' => 'left center',
570 'left-bottom' => 'left bottom',
571 'right-top' => 'right top',
572 'right-center' => 'right center',
573 'right-bottom' => 'right bottom',
574 'center-top' => 'center top',
575 'center' => 'center',
576 'center-bottom' => 'center bottom',
577 ),
578 ) );
579
580 $wp_customize->add_setting( 'loginpress_customization[background_image_size]', array(
581 'default' => 'cover',
582 'type' => 'option',
583 'capability' => 'manage_options',
584 'transport' => 'postMessage',
585 'sanitize_callback' => 'loginpress_sanitize_select'
586 ));
587
588 $wp_customize->add_control( 'loginpress_customization[background_image_size]', array(
589 'label' => __( 'Background Image Size: ', 'loginpress' ),
590 'section' => 'section_background',
591 'priority' => 30,
592 'settings' => 'loginpress_customization[background_image_size]',
593 'type' => 'select',
594 'choices' => array(
595 'auto' => 'auto',
596 'cover' => 'cover',
597 'contain' => 'contain',
598 'initial' => 'initial',
599 'inherit' => 'inherit',
600 ),
601 ) );
602
603
604 $this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_background', 7, 35 );
605 /**
606 * [Enable / Disabe Background Video with LoginPress_Radio_Control]
607 * @since 1.1.22
608 */
609 $wp_customize->add_setting( 'loginpress_customization[loginpress_display_bg_video]', array(
610 'default' => false,
611 'type' => 'option',
612 'capability' => 'manage_options',
613 'transport' => 'postMessage',
614 'sanitize_callback' => 'loginpress_sanitize_checkbox'
615 ) );
616
617 $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[loginpress_display_bg_video]', array(
618 'settings' => 'loginpress_customization[loginpress_display_bg_video]',
619 'label' => __( 'Enable Background Video?', 'loginpress'),
620 'section' => 'section_background',
621 'priority' => 40,
622 'type' => 'ios', // light, ios, flat
623 ) ) );
624
625 /**
626 * [Launch Background Video feature with WP_Customize_Media_Control]
627 * @since 1.1.22
628 */
629 $wp_customize->add_setting( 'loginpress_customization[background_video]', array(
630 'type' => 'option',
631 'capability' => 'manage_options',
632 'transport' => 'postMessage',
633 // 'sanitize_callback' => 'section_background'
634 ) );
635
636 $wp_customize->add_control( new WP_Customize_Media_Control( $wp_customize, 'loginpress_customization[background_video]', array(
637 'label' => __( 'Background Video:', 'loginpress' ),
638 'section' => 'section_background',
639 'mime_type' => 'video', // Required. Can be image, audio, video, application, text
640 'priority' => 45,
641 'button_labels' => array(
642 'select' => __( 'Select Video', 'loginpress' ),
643 'change' => __( 'Change Video', 'loginpress' ),
644 'default' => __( 'Default', 'loginpress' ),
645 'remove' => __( 'Remove', 'loginpress' ),
646 'frame_title' => __( 'Select File', 'loginpress' ),
647 'frame_button' => __( 'Choose File', 'loginpress' ),
648 ) ) ) );
649
650 // @version 1.1.21
651 $wp_customize->add_setting( 'loginpress_customization[background_video_object]', array(
652 'default' => 'cover',
653 'type' => 'option',
654 'capability' => 'manage_options',
655 'transport' => 'postMessage',
656 'sanitize_callback' => 'loginpress_sanitize_select'
657 ) );
658 $wp_customize->add_control( 'loginpress_customization[background_video_object]', array(
659 'settings' => 'loginpress_customization[background_video_object]',
660 'label' => __( 'Video Size:', 'loginpress' ),
661 'section' => 'section_background',
662 'priority' => 50,
663 'type' => 'select',
664 'choices' => array(
665 'fill' => 'fill',
666 'contain' => 'contain',
667 'cover' => 'cover',
668 'scale-down' => 'scale-down',
669 'none' => 'none',
670 ),
671 ) );
672
673 $wp_customize->add_setting( "loginpress_customization[video_obj_position]", array(
674 'type' => 'option',
675 'capability' => 'manage_options',
676 'transport' => 'postMessage',
677 'sanitize_callback' => 'wp_strip_all_tags'
678 ) );
679
680 $wp_customize->add_control( "loginpress_customization[video_obj_position]", array(
681 'label' => __( 'Object Postion:', 'loginpress' ),
682 'section' => 'section_background',
683 'priority' => 55,
684 'settings' => "loginpress_customization[video_obj_position]",
685 'input_attrs' => array(
686 'placeholder' => __( '50% 50%', 'directorist' ),
687 )
688 ) );
689
690 /**
691 * [Enable / Disabe Background Video with LoginPress_Radio_Control]
692 * @since 1.1.22
693 */
694 $wp_customize->add_setting( 'loginpress_customization[background_video_muted]', array(
695 'default' => true,
696 'type' => 'option',
697 'capability' => 'manage_options',
698 'transport' => 'postMessage',
699 'sanitize_callback' => 'loginpress_sanitize_checkbox'
700 ) );
701
702 $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[background_video_muted]', array(
703 'settings' => 'loginpress_customization[background_video_muted]',
704 'label' => __( 'Muted Video?', 'loginpress'),
705 'section' => 'section_background',
706 'priority' => 60,
707 'type' => 'ios', // light, ios, flat
708 ) ) );
709
710 // =============================
711 // = Section for Form Beauty =
712 // =============================
713 $wp_customize->add_section( 'section_form', array(
714 'title' => __( 'Customize Login Form', 'loginpress' ),
715 'description' => '',
716 'priority' => 15,
717 'panel' => 'loginpress_panel',
718 ) );
719
720 $this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_form', 2, 4 );
721
722 /**
723 * [ Enable / Disabe Form Background Image with LoginPress_Radio_Control ]
724 * @since 1.1.3
725 */
726
727 $wp_customize->add_setting( 'loginpress_customization[setting_form_display_bg]', array(
728 'default' => false,
729 'type' => 'option',
730 'capability' => 'manage_options',
731 'transport' => 'postMessage',
732 'sanitize_callback' => 'loginpress_sanitize_checkbox'
733 ) );
734
735 $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[setting_form_display_bg]', array(
736 'settings' => 'loginpress_customization[setting_form_display_bg]',
737 'label' => __( 'Enable Form Transparency:', 'loginpress'),
738 'section' => 'section_form',
739 'priority' => 5,
740 'type' => 'ios',
741 ) ) );
742
743 $wp_customize->add_setting( 'loginpress_customization[setting_form_background]', array(
744 'type' => 'option',
745 'capability' => 'manage_options',
746 'transport' => 'postMessage',
747 'sanitize_callback' => 'loginpress_sanitize_image'
748 ) );
749
750 $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'loginpress_customization[setting_form_background]', array(
751 'label' => __( 'Form Background Image:', 'loginpress' ),
752 'section' => 'section_form',
753 'priority' => 6,
754 'settings' => 'loginpress_customization[setting_form_background]'
755 ) ) );
756
757 $this->loginpress_color_setting( $wp_customize, $form_color_control, $form_color_label, 'section_form', 0, 7 );
758
759 $this->loginpress_rangle_seting( $wp_customize, $form_range_control, $form_range_default, $form_range_label, $form_range_attrs, $form_range_unit, 'section_form', 0, 15 );
760 $this->loginpress_rangle_seting( $wp_customize, $form_range_control, $form_range_default, $form_range_label, $form_range_attrs, $form_range_unit, 'section_form', 1, 20 );
761 $this->loginpress_rangle_seting( $wp_customize, $form_range_control, $form_range_default, $form_range_label, $form_range_attrs, $form_range_unit, 'section_form', 2, 25 );
762 $this->loginpress_rangle_seting( $wp_customize, $form_range_control, $form_range_default, $form_range_label, $form_range_attrs, $form_range_unit, 'section_form', 3, 30 );
763 $this->loginpress_rangle_seting( $wp_customize, $form_range_control, $form_range_default, $form_range_label, $form_range_attrs, $form_range_unit, 'section_form', 4, 35 );
764
765 $form_padding = 0;
766 while ( $form_padding < 2 ) :
767
768 $wp_customize->add_setting( "loginpress_customization[{$form_control[$form_padding]}]", array(
769 'default' => $form_default[$form_padding],
770 'type' => 'option',
771 'capability' => 'manage_options',
772 'transport' => 'postMessage',
773 'sanitize_callback' => $form_sanitization[$form_padding]
774 ) );
775
776 $wp_customize->add_control( "loginpress_customization[{$form_control[$form_padding]}]", array(
777 'label' => $form_label[$form_padding],
778 'section' => 'section_form',
779 'priority' => 40,
780 'settings' => "loginpress_customization[{$form_control[$form_padding]}]"
781 ) );
782
783 $form_padding++;
784 endwhile;
785
786 $this->loginpress_hr_setting( $wp_customize, $close_control, 'section_form', 3, 41 );
787
788 $this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_form', 0, 45 );
789
790 $this->loginpress_color_setting( $wp_customize, $form_color_control, $form_color_label, 'section_form', 1, 50 );
791 $this->loginpress_color_setting( $wp_customize, $form_color_control, $form_color_label, 'section_form', 2, 55 );
792
793 $this->loginpress_rangle_seting( $wp_customize, $form_range_control, $form_range_default, $form_range_label, $form_range_attrs, $form_range_unit, 'section_form', 5, 60 );
794 // textfield_radius.
795 // $this->loginpress_rangle_seting( $wp_customize, $form_range_control, $form_range_default, $form_range_label, $form_range_attrs, $form_range_unit, 'section_form', 6, 65 );
796 // textfield_shadow.
797 // $this->loginpress_rangle_seting( $wp_customize, $form_range_control, $form_range_default, $form_range_label, $form_range_attrs, $form_range_unit, 'section_form', 7, 70 );
798 // textfield_shadow_opacity.
799 // $this->loginpress_rangle_seting( $wp_customize, $form_range_control, $form_range_default, $form_range_label, $form_range_attrs, $form_range_unit, 'section_form', 8, 75 );
800
801 /**
802 * [ Enable / Disabe Form Background Image with LoginPress_Radio_Control ]
803 * @since 1.1.3
804 */
805
806 // $wp_customize->add_setting( 'loginpress_customization[textfield_inset_shadow]', array(
807 // 'default' => false,
808 // 'type' => 'option',
809 // 'capability' => 'manage_options',
810 // 'transport' => 'postMessage'
811 // ) );
812 //
813 // $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[textfield_inset_shadow]', array(
814 // 'settings' => 'loginpress_customization[textfield_inset_shadow]',
815 // 'label' => __( 'Input Text Field Shadow Inset:', 'loginpress'),
816 // 'section' => 'section_form',
817 // 'priority' => 80,
818 // 'type' => 'ios',// light, ios, flat
819 // ) ) );
820
821 $input_padding = 2;
822 while ( $input_padding < 3 ) :
823
824 $wp_customize->add_setting( "loginpress_customization[{$form_control[$input_padding]}]", array(
825 'default' => $form_default[$input_padding],
826 'type' => 'option',
827 'capability' => 'manage_options',
828 'transport' => 'postMessage',
829 'sanitize_callback' => $form_sanitization[$input_padding]
830 ) );
831
832 $wp_customize->add_control( "loginpress_customization[{$form_control[$input_padding]}]", array(
833 'label' => $form_label[$input_padding],
834 'section' => 'section_form',
835 'priority' => 85,
836 'settings' => "loginpress_customization[{$form_control[$input_padding]}]"
837 ) );
838
839 $input_padding++;
840 endwhile;
841
842 $this->loginpress_hr_setting( $wp_customize, $close_control, 'section_form', 4, 86 );
843 $this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_form', 1, 90 );
844
845 // $form_input_label = 3;
846 // while ( $form_input_label < 5 ) :
847 //
848 // $wp_customize->add_setting( "loginpress_customization[{$form_control[$form_input_label]}]", array(
849 // 'default' => $form_default[$form_input_label],
850 // 'type' => 'option',
851 // 'capability' => 'manage_options',
852 // 'transport' => 'postMessage'
853 // ) );
854 //
855 // $wp_customize->add_control( "loginpress_customization[{$form_control[$form_input_label]}]", array(
856 // 'label' => $form_label[$form_input_label],
857 // 'section' => 'section_form',
858 // 'priority' => 91,
859 // 'settings' => "loginpress_customization[{$form_control[$form_input_label]}]"
860 // ) );
861 //
862 // $form_input_label++;
863 // endwhile;
864
865 $this->loginpress_color_setting( $wp_customize, $form_color_control, $form_color_label, 'section_form', 3, 95 );
866 $this->loginpress_color_setting( $wp_customize, $form_color_control, $form_color_label, 'section_form', 4, 100 );
867
868 // customize_form_label.
869 // $this->loginpress_rangle_seting( $wp_customize, $form_range_control, $form_range_default, $form_range_label, $form_range_attrs, $form_range_unit, 'section_form', 9, 105 );
870 // remember_me_font_size.
871 // $this->loginpress_rangle_seting( $wp_customize, $form_range_control, $form_range_default, $form_range_label, $form_range_attrs, $form_range_unit, 'section_form', 10, 110 );
872 $this->loginpress_hr_setting( $wp_customize, $close_control, 'section_form', 5, 111 );
873
874 // =============================
875 // = Section for Forget Form =
876 // =============================
877 $wp_customize->add_section(
878 'section_forget_form',
879 array(
880 'title' => __( 'Customize Forget Form', 'loginpress' ),
881 'description' => '',
882 'priority' => 20,
883 'panel' => 'loginpress_panel',
884 ) );
885
886 $wp_customize->add_setting( 'loginpress_customization[forget_form_background]', array(
887 'type' => 'option',
888 'capability' => 'manage_options',
889 'transport' => 'postMessage',
890 'sanitize_callback' => 'loginpress_sanitize_image'
891 ) );
892
893 $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'loginpress_customization[forget_form_background]', array(
894 'label' => __( 'Forget Form Background Image:', 'loginpress' ),
895 'section' => 'section_forget_form',
896 'priority' => 5,
897 'settings' => 'loginpress_customization[forget_form_background]'
898 ) ) );
899
900 $wp_customize->add_setting( 'loginpress_customization[forget_form_background_color]', array(
901 // 'default' => '#FFF',
902 'type' => 'option',
903 'capability' => 'manage_options',
904 'transport' => 'postMessage',
905 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
906 ) );
907
908 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[forget_form_background_color]', array(
909 'label' => __( 'Forget Form Background Color:', 'loginpress' ),
910 'section' => 'section_forget_form',
911 'priority' => 10,
912 'settings' => 'loginpress_customization[forget_form_background_color]'
913 ) ) );
914
915 // =============================
916 // = Section for Button Style =
917 // =============================
918 $wp_customize->add_section( 'section_button', array(
919 'title' => __( 'Button Beauty', 'loginpress' ),
920 'description' => '',
921 'priority' => 25,
922 'panel' => 'loginpress_panel',
923 ) );
924
925 $this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 0, 5 );
926 $this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 1, 10 );
927 $this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 2, 15 );
928 $this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 3, 20 );
929 $this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 4, 25 );
930 $this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 5, 30 );
931
932 /**
933 * [ Change Button CSS Properties with LoginPress_Range_Control ]
934 * @since 1.0.1
935 * @version 1.1.3
936 */
937
938 $this->loginpress_rangle_seting( $wp_customize, $button_range_control, $button_range_default, $button_range_label, $button_range_attrs, $button_range_unit, 'section_button', 0, 35 );
939 $this->loginpress_rangle_seting( $wp_customize, $button_range_control, $button_range_default, $button_range_label, $button_range_attrs, $button_range_unit, 'section_button', 1, 40 );
940 $this->loginpress_rangle_seting( $wp_customize, $button_range_control, $button_range_default, $button_range_label, $button_range_attrs, $button_range_unit, 'section_button', 2, 45 );
941 $this->loginpress_rangle_seting( $wp_customize, $button_range_control, $button_range_default, $button_range_label, $button_range_attrs, $button_range_unit, 'section_button', 3, 50 );
942 $this->loginpress_rangle_seting( $wp_customize, $button_range_control, $button_range_default, $button_range_label, $button_range_attrs, $button_range_unit, 'section_button', 4, 55 );
943 $this->loginpress_rangle_seting( $wp_customize, $button_range_control, $button_range_default, $button_range_label, $button_range_attrs, $button_range_unit, 'section_button', 5, 60 );
944 $this->loginpress_rangle_seting( $wp_customize, $button_range_control, $button_range_default, $button_range_label, $button_range_attrs, $button_range_unit, 'section_button', 6, 65 );
945
946 // =============================
947 // = Section for Error message =
948 // =============================
949 $wp_customize->add_section( 'section_error', array(
950 'title' => __( 'Error Messages', 'loginpress' ),
951 'description' => '',
952 'priority' => 30,
953 'panel' => 'loginpress_panel',
954 ) );
955
956 $error = 0;
957 while ( $error < 10 ) :
958
959 $wp_customize->add_setting( "loginpress_customization[{$error_control[$error]}]", array(
960 'default' => $error_default[$error],
961 'type' => 'option',
962 'capability' => 'manage_options',
963 'transport' => 'postMessage',
964 'sanitize_callback' => 'wp_kses_post'
965 ) );
966
967 $wp_customize->add_control( "loginpress_customization[{$error_control[$error]}]", array(
968 'label' => $error_label[$error],
969 'section' => 'section_error',
970 'priority' => 5,
971 'settings' => "loginpress_customization[{$error_control[$error]}]",
972 ) );
973
974 $error++;
975 endwhile;
976
977 // =============================
978 // = Section for Welcome message
979 // =============================
980 $wp_customize->add_section( 'section_welcome', array(
981 'title' => __( 'Welcome Messages', 'loginpress' ),
982 'description' => '',
983 'priority' => 35,
984 'panel' => 'loginpress_panel',
985 ) );
986
987 $welcome = 0;
988 while ( $welcome < 5 ) :
989
990 $wp_customize->add_setting( "loginpress_customization[{$welcome_control[$welcome]}]", array(
991 'type' => 'option',
992 'capability' => 'manage_options',
993 'transport' => 'postMessage',
994 'sanitize_callback' => $welcome_sanitization[$welcome]
995 ));
996
997 $wp_customize->add_control( "loginpress_customization[{$welcome_control[$welcome]}]", array(
998 'label' => $welcome_label[ $welcome ],
999 'section' => 'section_welcome',
1000 'priority' => 5,
1001 'settings' => "loginpress_customization[{$welcome_control[$welcome]}]",
1002 'input_attrs' => array(
1003 'placeholder' => $welcome_default[ $welcome ],
1004 )
1005 ) );
1006
1007 $welcome++;
1008 endwhile;
1009
1010 $wp_customize->add_setting( 'loginpress_customization[message_background_color]', array(
1011 // 'default' => '#fff',
1012 'type' => 'option',
1013 'capability' => 'manage_options',
1014 'transport' => 'postMessage',
1015 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1016 ) );
1017
1018 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[message_background_color]', array(
1019 'label' => __( 'Message Field Background Color:', 'loginpress' ),
1020 'section' => 'section_welcome',
1021 'priority' => 30,
1022 'settings' => 'loginpress_customization[message_background_color]'
1023 ) ) );
1024
1025 // =============================
1026 // = Section for Header message
1027 // =============================
1028 // $wp_customize->add_section(
1029 // 'section_head',
1030 // array(
1031 // 'title' => __( 'Header Message', 'loginpress' ),
1032 // 'description' => '',
1033 // 'priority' => 35,
1034 // 'panel' => 'loginpress_panel',
1035 // ));
1036 //
1037 // $wp_customize->add_setting( 'loginpress_customization[login_hearder_message]', array(
1038 // 'default' => 'Latest NEWS',
1039 // 'type' => 'option',
1040 // 'capability' => 'edit_theme_options',
1041 // ));
1042 //
1043 // $wp_customize->add_control( 'login_hearder_message', array(
1044 // 'label' => __( 'Header Message:', 'loginpress' ),
1045 // 'section' => 'section_head',
1046 // 'priority' => 5,
1047 // 'settings' => 'loginpress_customization[login_hearder_message]',
1048 // ));
1049 //
1050 // $wp_customize->add_setting( 'loginpress_customization[login_hearder_message_link]', array(
1051 // 'default' => '#',
1052 // 'type' => 'option',
1053 // 'capability' => 'edit_theme_options',
1054 // ));
1055 //
1056 // $wp_customize->add_control( 'login_hearder_message_link', array(
1057 // 'label' => __( 'Header Message Link:', 'loginpress' ),
1058 // 'section' => 'section_head',
1059 // 'priority' => 5,
1060 // 'settings' => 'loginpress_customization[login_hearder_message_link]',
1061 // ));
1062 //
1063 // $wp_customize->add_setting( 'loginpress_customization[login_head_color]', array(
1064 // 'default' => '#17a8e3',
1065 // 'type' => 'option',
1066 // 'capability' => 'edit_theme_options',
1067 // ));
1068 //
1069 // $wp_customize->add_control(
1070 // new WP_Customize_Color_Control(
1071 // $wp_customize,
1072 // 'login_head_color',
1073 // array(
1074 // 'label' => __( 'Header Text Color:', 'loginpress' ),
1075 // 'section' => 'section_head',
1076 // 'priority' => 10,
1077 // 'settings' => 'loginpress_customization[login_head_color]'
1078 // )));
1079 //
1080 // $wp_customize->add_setting( 'loginpress_customization[login_head_color_hover]', array(
1081 // // 'default' => '#17a8e3',
1082 // 'type' => 'option',
1083 // 'capability' => 'edit_theme_options',
1084 // ));
1085 //
1086 // $wp_customize->add_control(
1087 // new WP_Customize_Color_Control(
1088 // $wp_customize,
1089 // 'login_head_color_hover',
1090 // array(
1091 // 'label' => __( 'Header Text Hover Color:', 'loginpress' ),
1092 // 'section' => 'section_head',
1093 // 'priority' => 15,
1094 // 'settings' => 'loginpress_customization[login_head_color_hover]'
1095 // )));
1096 //
1097 // $wp_customize->add_setting( 'loginpress_customization[login_head_font_size]', array(
1098 // 'default' => '13px;',
1099 // 'type' => 'option',
1100 // 'capability' => 'edit_theme_options',
1101 // ));
1102 //
1103 // $wp_customize->add_control( 'login_head_font_size', array(
1104 // 'label' => __( 'Text Font Size:', 'loginpress' ),
1105 // 'section' => 'section_head',
1106 // 'priority' => 20,
1107 // 'settings' => 'loginpress_customization[login_head_font_size]',
1108 // ));
1109 //
1110 // $wp_customize->add_setting( 'loginpress_customization[login_head_bg_color]', array(
1111 // // 'default' => '#17a8e3',
1112 // 'type' => 'option',
1113 // 'capability' => 'edit_theme_options',
1114 // ));
1115 //
1116 // $wp_customize->add_control(
1117 // new WP_Customize_Color_Control(
1118 // $wp_customize,
1119 // 'login_head_bg_color',
1120 // array(
1121 // 'label' => __( 'Header Background Color:', 'loginpress' ),
1122 // 'section' => 'section_head',
1123 // 'priority' => 25,
1124 // 'settings' => 'loginpress_customization[login_head_bg_color]'
1125 // )));
1126
1127 // =============================
1128 // = Section for Form Footer =
1129 // =============================
1130 $wp_customize->add_section( 'section_fotter', array(
1131 'title' => __( 'Form Footer', 'loginpress' ),
1132 'description' => '',
1133 'priority' => 40,
1134 'panel' => 'loginpress_panel',
1135 ) );
1136
1137 $this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_fotter', 3, 4 );
1138
1139 $wp_customize->add_setting( 'loginpress_customization[footer_display_text]', array(
1140 'default' => true,
1141 'type' => 'option',
1142 'capability' => 'manage_options',
1143 'transport' => 'postMessage',
1144 'sanitize_callback' => 'loginpress_sanitize_checkbox'
1145 ));
1146
1147 /**
1148 * [Enable / Disabe Footer Text with LoginPress_Radio_Control]
1149 * @since 1.0.1
1150 * @version 1.0.23
1151 */
1152 $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[footer_display_text]', array(
1153 'settings' => 'loginpress_customization[footer_display_text]',
1154 'label' => __( 'Enable Footer Text:', 'loginpress' ),
1155 'section' => 'section_fotter',
1156 'priority' => 5,
1157 'type' => 'ios',// light, ios, flat
1158 ) ) );
1159
1160 $wp_customize->add_setting( 'loginpress_customization[login_footer_text]', array(
1161 'default' => __( 'Lost your password?', 'loginpress' ),
1162 'type' => 'option',
1163 'capability' => 'manage_options',
1164 'transport' => 'postMessage',
1165 'sanitize_callback' => 'wp_kses_post'
1166 ) );
1167
1168 $wp_customize->add_control( 'loginpress_customization[login_footer_text]', array(
1169 'label' => __( 'Lost Password Text:', 'loginpress' ),
1170 'section' => 'section_fotter',
1171 'priority' => 10,
1172 'settings' => 'loginpress_customization[login_footer_text]',
1173 ) );
1174
1175 $wp_customize->add_setting( 'loginpress_customization[login_footer_text_decoration]', array(
1176 'default' => 'none',
1177 'type' => 'option',
1178 'capability' => 'manage_options',
1179 'transport' => 'postMessage',
1180 'sanitize_callback' => 'loginpress_sanitize_select'
1181
1182 ) );
1183 $wp_customize->add_control( 'loginpress_customization[login_footer_text_decoration]', array(
1184 'settings' => 'loginpress_customization[login_footer_text_decoration]',
1185 'label' => __( 'Select Text Decoration:', 'loginpress' ),
1186 'section' => 'section_fotter',
1187 'priority' => 15,
1188 'type' => 'select',
1189 'choices' => array(
1190 'none' => 'none',
1191 'overline' => 'overline',
1192 'line-through' => 'line-through',
1193 'underline' => 'underline',
1194 ),
1195 ) );
1196
1197 $wp_customize->add_setting( 'loginpress_customization[login_footer_color]', array(
1198 // 'default' => '#17a8e3',
1199 'type' => 'option',
1200 'capability' => 'manage_options',
1201 'transport' => 'postMessage',
1202 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1203 ) );
1204
1205 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_footer_color]', array(
1206 'label' => __( 'Footer Text Color:', 'loginpress' ),
1207 'section' => 'section_fotter',
1208 'priority' => 20,
1209 'settings' => 'loginpress_customization[login_footer_color]'
1210 ) ) );
1211
1212 $wp_customize->add_setting( 'loginpress_customization[login_footer_color_hover]', array(
1213 // 'default' => '#17a8e3',
1214 'type' => 'option',
1215 'capability' => 'manage_options',
1216 'transport' => 'postMessage',
1217 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1218 ) );
1219
1220 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_footer_color_hover]', array(
1221 'label' => __( 'Footer Text Hover Color:', 'loginpress' ),
1222 'section' => 'section_fotter',
1223 'priority' => 25,
1224 'settings' => 'loginpress_customization[login_footer_color_hover]'
1225 ) ) );
1226
1227 $wp_customize->add_setting( "loginpress_customization[login_footer_font_size]", array(
1228 'default' => '13',
1229 'type' => 'option',
1230 'capability' => 'manage_options',
1231 'transport' => 'postMessage',
1232 'sanitize_callback' => 'absint',
1233 ) );
1234
1235 /**
1236 * [ Change login_footer_font_size Input fields with LoginPress_Range_Control ]
1237 * @since 1.0.1
1238 * @version 1.0.23
1239 */
1240 $wp_customize->add_control( new LoginPress_Range_Control( $wp_customize, "loginpress_customization[login_footer_font_size]", array(
1241 'type' => 'loginpress-range',
1242 'label' => __( 'Text Font Size:', 'loginpress' ),
1243 'section' => 'section_fotter',
1244 'settings' => "loginpress_customization[login_footer_font_size]",
1245 'default' => '13',
1246 'priority' => 30,
1247 'input_attrs' => array( 'min' => 0, 'max' => 100, 'step' => 1, 'suffix' => 'px' )
1248 ) ) );
1249
1250 $wp_customize->add_setting( 'loginpress_customization[login_footer_bg_color]', array(
1251 // 'default' => '#17a8e3',
1252 'type' => 'option',
1253 'capability' => 'manage_options',
1254 'transport' => 'postMessage',
1255 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1256 ) );
1257
1258 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_footer_bg_color]', array(
1259 'label' => __( 'Footer Background Color:', 'loginpress' ),
1260 'section' => 'section_fotter',
1261 'priority' => 35,
1262 'settings' => 'loginpress_customization[login_footer_bg_color]'
1263 ) ) );
1264
1265 $this->loginpress_hr_setting( $wp_customize, $close_control, 'section_fotter', 0, 36 );
1266
1267 $this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_fotter', 4, 40 );
1268
1269 $wp_customize->add_setting( 'loginpress_customization[back_display_text]', array(
1270 'default' => true,
1271 'type' => 'option',
1272 'capability' => 'manage_options',
1273 'transport' => 'postMessage',
1274 'sanitize_callback' => 'loginpress_sanitize_checkbox'
1275 ) );
1276
1277 /**
1278 * [Enable / Disabe Footer Text with LoginPress_Radio_Control]
1279 * @since 1.0.1
1280 * @version 1.0.23
1281 */
1282 $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[back_display_text]', array(
1283 'settings' => 'loginpress_customization[back_display_text]',
1284 'label' => __( 'Enable "Back to" Text:', 'loginpress' ),
1285 'section' => 'section_fotter',
1286 'priority' => 45,
1287 'type' => 'ios', // light, ios, flat
1288 ) ) );
1289
1290 $wp_customize->add_setting( 'loginpress_customization[login_back_text_decoration]', array(
1291 'default' => 'none',
1292 'type' => 'option',
1293 'capability' => 'manage_options',
1294 'transport' => 'postMessage',
1295 'sanitize_callback' => 'loginpress_sanitize_select'
1296
1297 ) );
1298 $wp_customize->add_control( 'loginpress_customization[login_back_text_decoration]', array(
1299 'settings' => 'loginpress_customization[login_back_text_decoration]',
1300 'label' => __( '"Back to" Text Decoration:', 'loginpress' ),
1301 'section' => 'section_fotter',
1302 'priority' => 50,
1303 'type' => 'select',
1304 'choices' => array(
1305 'none' => 'none',
1306 'overline' => 'overline',
1307 'line-through' => 'line-through',
1308 'underline' => 'underline',
1309 ),
1310 ) );
1311
1312 $wp_customize->add_setting( 'loginpress_customization[login_back_color]', array(
1313 // 'default' => '#17a8e3',
1314 'type' => 'option',
1315 'capability' => 'manage_options',
1316 'transport' => 'postMessage',
1317 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1318 ) );
1319
1320 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_back_color]', array(
1321 'label' => __( '"Back to" Text Color:', 'loginpress' ),
1322 'section' => 'section_fotter',
1323 'priority' => 55,
1324 'settings' => 'loginpress_customization[login_back_color]'
1325 ) ) );
1326
1327 $wp_customize->add_setting( 'loginpress_customization[login_back_color_hover]', array(
1328 // 'default' => '#17a8e3',
1329 'type' => 'option',
1330 'capability' => 'manage_options',
1331 'transport' => 'postMessage',
1332 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1333 ) );
1334
1335 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_back_color_hover]', array(
1336 'label' => __( '"Back to" Text Hover Color:', 'loginpress' ),
1337 'section' => 'section_fotter',
1338 'priority' => 60,
1339 'settings' => 'loginpress_customization[login_back_color_hover]'
1340 ) ) );
1341
1342 $wp_customize->add_setting( "loginpress_customization[login_back_font_size]", array(
1343 'default' => '13',
1344 'type' => 'option',
1345 'capability' => 'manage_options',
1346 'transport' => 'postMessage',
1347 'sanitize_callback' => 'absint',
1348 ) );
1349
1350 /**
1351 * [ Change login_back_font_size Input fields with LoginPress_Range_Control ]
1352 * @since 1.0.1
1353 * @version 1.0.23
1354 */
1355 $wp_customize->add_control( new LoginPress_Range_Control( $wp_customize, "loginpress_customization[login_back_font_size]", array(
1356 'type' => 'loginpress-range',
1357 'label' => __( '"Back to" Text Font Size:', 'loginpress' ),
1358 'section' => 'section_fotter',
1359 'settings' => "loginpress_customization[login_back_font_size]",
1360 'default' => '13',
1361 'priority' => 65,
1362 'input_attrs' => array( 'min' => 0, 'max' => 100, 'step' => 1, 'suffix' => 'px' )
1363 ) ) );
1364
1365 $wp_customize->add_setting( 'loginpress_customization[login_back_bg_color]', array(
1366 // 'default' => '#17a8e3',
1367 'type' => 'option',
1368 'capability' => 'manage_options',
1369 'transport' => 'postMessage',
1370 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1371 ) );
1372
1373 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_back_bg_color]', array(
1374 'label' => __( '"Back to" Background Color:', 'loginpress' ),
1375 'section' => 'section_fotter',
1376 'priority' => 70,
1377 'settings' => 'loginpress_customization[login_back_bg_color]'
1378 ) ) );
1379
1380 $this->loginpress_hr_setting( $wp_customize, $close_control, 'section_fotter', 1, 71 );
1381
1382 $this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_fotter', 5, 72 );
1383
1384 /**
1385 * [Enable / Disabe Footer Text with LoginPress_Radio_Control]
1386 * @since 1.1.3
1387 */
1388 $wp_customize->add_setting( 'loginpress_customization[login_copy_right_display]', array(
1389 'default' => false,
1390 'type' => 'option',
1391 'capability' => 'manage_options',
1392 'transport' => 'postMessage',
1393 'sanitize_callback' => 'loginpress_sanitize_checkbox'
1394 ) );
1395 $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[login_copy_right_display]', array(
1396 'settings' => 'loginpress_customization[login_copy_right_display]',
1397 'section' => 'section_fotter',
1398 'priority' => 73,
1399 'type' => 'ios',// light, ios, flat
1400 'label' => __( 'Enable Copyright Note:', 'loginpress' ),
1401 ) ) );
1402
1403 $wp_customize->add_setting( 'loginpress_customization[login_footer_copy_right]', array(
1404 'default' => sprintf( __('© %1$s %2$s, All Rights Reserved.', 'loginpress'), date("Y"), get_bloginfo('name') ),
1405 'type' => 'option',
1406 'capability' => 'manage_options',
1407 'transport' => 'postMessage',
1408 'sanitize_callback' => 'wp_kses_post'
1409 ) );
1410
1411 $wp_customize->add_control( 'loginpress_customization[login_footer_copy_right]', array(
1412 'label' => __( 'Copyright Note:', 'loginpress' ),
1413 'type' => 'textarea',
1414 'section' => 'section_fotter',
1415 'priority' => 75,
1416 'settings' => 'loginpress_customization[login_footer_copy_right]'
1417 ) );
1418
1419 $wp_customize->add_setting( 'loginpress_customization[loginpress_show_love]', array(
1420 'default' => true,
1421 'type' => 'option',
1422 'capability' => 'manage_options',
1423 'transport' => 'postMessage',
1424 'sanitize_callback' => 'loginpress_sanitize_checkbox'
1425 ) );
1426
1427 /**
1428 * [Enable / Disabe Footer Text with LoginPress_Radio_Control]
1429 * @since 1.0.1
1430 * @version 1.0.23
1431 */
1432 $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[loginpress_show_love]', array(
1433 'settings' => 'loginpress_customization[loginpress_show_love]',
1434 'section' => 'section_fotter',
1435 'priority' => 80,
1436 'type' => 'ios',// light, ios, flat
1437 'label' => __( 'Show some Love. Please help others learn about this free plugin by placing small link in footer. Thank you very much!', 'loginpress' ),
1438 ) ) );
1439
1440 /**
1441 * [Love position on footer.]
1442 * @since 1.1.3
1443 */
1444 $wp_customize->add_setting( 'loginpress_customization[show_love_position]', array(
1445 'default' => 'right',
1446 'type' => 'option',
1447 'capability' => 'manage_options',
1448 'transport' => 'postMessage',
1449 // 'sanitize_callback' => 'loginpress_sanitize_checkbox'
1450 ) );
1451
1452 $wp_customize->add_control( 'loginpress_customization[show_love_position]', array(
1453 'label' => __( 'Love Position:', 'loginpress' ),
1454 'section' => 'section_fotter',
1455 'priority' => 85,
1456 'settings' => 'loginpress_customization[show_love_position]',
1457 'type' => 'radio',
1458 'choices' => array(
1459 'left' => __( 'Left', 'loginpress' ),
1460 'right' => __( 'Right', 'loginpress' ),
1461 ),
1462 ) );
1463 $this->loginpress_hr_setting( $wp_customize, $close_control, 'section_fotter', 2, 90 );
1464
1465 // =============================
1466 // = Section for Custom CSS/JS =
1467 // =============================
1468 $wp_customize->add_section(
1469 'loginpress_custom_css_js',
1470 array(
1471 'title' => __( 'Custom CSS/JS', 'loginpress' ),
1472 'description' => '',
1473 'priority' => 50,
1474 'panel' => 'loginpress_panel',
1475 ) );
1476
1477 $wp_customize->add_setting( 'loginpress_customization[loginpress_custom_css]', array(
1478 'type' => 'option',
1479 'capability' => 'manage_options',
1480 'transport' => 'postMessage'
1481 ) );
1482
1483 $wp_customize->add_control( 'loginpress_customization[loginpress_custom_css]', array(
1484 'label' => __( 'Customize CSS:', 'loginpress' ),
1485 'type' => 'textarea',
1486 'section' => 'loginpress_custom_css_js',
1487 'priority' => 5,
1488 'settings' => 'loginpress_customization[loginpress_custom_css]',
1489 'description' => sprintf( __( 'Custom CSS doen\'t make effect live. For preview please save the setting and visit %1$s login%2$s page or after save refresh the customizer.', "loginpress" ), '<a href="' . wp_login_url() .'"title="Login" target="_blank">', '</a>')
1490 ) );
1491
1492 $wp_customize->add_setting( 'loginpress_customization[loginpress_custom_js]', array(
1493 'type' => 'option',
1494 'capability' => 'manage_options',
1495 'transport' => 'postMessage'
1496 ) );
1497
1498 $wp_customize->add_control( 'loginpress_customization[loginpress_custom_js]', array(
1499 'label' => __( 'Customize JS:', 'loginpress' ),
1500 'type' => 'textarea',
1501 'section' => 'loginpress_custom_css_js',
1502 'priority' => 10,
1503 'settings' => 'loginpress_customization[loginpress_custom_js]',
1504 'description' => sprintf( __( 'Custom JS doen\'t make effect live. For preview please save the setting and visit %1$s login%2$s page or after save refresh the customizer.', "loginpress" ), '<a href="' . wp_login_url() .'"title="Login" target="_blank">', '</a>')
1505 ) );
1506 }
1507
1508 /**
1509 * Manage the Login Footer Links
1510 *
1511 * @since 1.0.0
1512 * @version 1.1.7
1513 * * * * * * * * * * * * * * * */
1514 public function login_page_custom_footer() {
1515
1516 /**
1517 * Add brand postion class.
1518 * @since 1.1.3
1519 */
1520 $position = ''; // Empty variable for storing position class.
1521 if ( $this->loginpress_key ) {
1522 if ( isset( $this->loginpress_key['show_love_position'] ) && $this->loginpress_key['show_love_position'] == 'left' ) {
1523 $position = ' love-postion';
1524 }
1525 }
1526
1527 if ( empty( $this->loginpress_key ) || ( isset( $this->loginpress_key['loginpress_show_love'] ) && $this->loginpress_key['loginpress_show_love'] != '' ) ) {
1528 echo '<div class="loginpress-show-love' . $position . '">' . __( 'Powered by:', 'loginpress' ) . ' <a href="https://wpbrigade.com" target="_blank">LoginPress</a></div>';
1529 } elseif ( empty( $this->loginpress_key ) || ( ! isset( $this->loginpress_key['loginpress_show_love'] ) ) ) {
1530 echo '<div class="loginpress-show-love' . $position . '">' . __( 'Powered by:', 'loginpress' ) . ' <a href="https://wpbrigade.com" target="_blank">LoginPress</a></div>';
1531 }
1532
1533 echo '<div class="footer-wrapper">';
1534 echo '<div class="footer-cont">';
1535
1536 if ( $this->loginpress_key ) {
1537
1538 // do_action( 'loginpress_footer_wrapper' );
1539 do_action( 'loginpress_footer_menu' );
1540
1541 if ( array_key_exists( 'login_copy_right_display', $this->loginpress_key ) && true == $this->loginpress_key['login_copy_right_display'] ) {
1542 if ( array_key_exists( 'login_footer_copy_right', $this->loginpress_key ) && ! empty( $this->loginpress_key['login_footer_copy_right'] ) ) {
1543 echo '<div class="copyRight">'.$this->loginpress_key['login_footer_copy_right'].'</div>';
1544 } else {
1545 echo '<div class="copyRight">'. sprintf( __('© %1$s %2$s, All Rights Reserved.', 'loginpress'), date("Y"), get_bloginfo('name') ) .'</div>';
1546 }
1547 }
1548
1549 }
1550 echo '</div></div>';
1551 }
1552
1553 /**
1554 * Manage the Login Head
1555 *
1556 * @since 1.0.0
1557 * @version 1.1.7
1558 * * * * * * * * * * * */
1559 public function login_page_custom_head() {
1560
1561 $loginpress_setting = get_option( 'loginpress_setting' );
1562 $lostpassword_url = isset( $loginpress_setting['lostpassword_url'] ) ? $loginpress_setting['lostpassword_url'] : 'off';
1563
1564 add_filter( 'gettext', array( $this, 'change_lostpassword_message' ), 20, 3 );
1565 add_filter( 'gettext', array( $this, 'change_username_label' ), 20, 3 );
1566 // add_filter( 'gettext', array( $this, 'change_password_label' ), 20, 3 );
1567 // Include CSS File in heared.
1568 wp_enqueue_script( 'jquery' );
1569 include( LOGINPRESS_DIR_PATH . 'css/style-presets.php' );
1570 include( LOGINPRESS_DIR_PATH . 'css/style-login.php' );
1571
1572 do_action( 'loginpress_header_menu' );
1573 // do_action( 'loginpress_header_wrapper' );
1574
1575 if ( 'on' == $lostpassword_url ) {
1576 remove_filter( 'lostpassword_url', 'wc_lostpassword_url', 10 );
1577 }
1578 }
1579 /**
1580 * Set Redirect Path of Logo
1581 *
1582 * @since 1.0.0
1583 * @return mixed
1584 * * * * * * * * * * * * * */
1585 public function login_page_logo_url() {
1586
1587 if ( $this->loginpress_key && array_key_exists( 'customize_logo_hover', $this->loginpress_key ) && ! empty( $this->loginpress_key['customize_logo_hover'] ) ) {
1588 return $this->loginpress_key["customize_logo_hover"];
1589 } else {
1590 return home_url();
1591 }
1592 }
1593
1594 /**
1595 * Remove the filter login_errors from woocommerce login form.
1596 *
1597 * @since 1.0.16
1598 * @return errors
1599 * * * * * * * * * * * * */
1600 function loginpress_woo_login_errors( $validation_error, $arg1, $arg2 ) {
1601
1602 remove_filter( 'login_errors', array( $this, 'login_error_messages' ) );
1603 return $validation_error;
1604 }
1605
1606
1607 /**
1608 * Set hover Title of Logo
1609 *
1610 * @since 1.0.0
1611 * @return mixed
1612 * * * * * * * * * * * * */
1613 public function login_page_logo_title() {
1614
1615 if ( $this->loginpress_key && array_key_exists( 'customize_logo_hover_title', $this->loginpress_key ) && ! empty( $this->loginpress_key['customize_logo_hover_title'] ) ) {
1616 return $this->loginpress_key["customize_logo_hover_title"];
1617 } else {
1618 return home_url();
1619 }
1620 }
1621
1622 /**
1623 * Set Errors Messages to Show off
1624 *
1625 * @param $error
1626 * @since 1.0.0
1627 * @return string
1628 * * * * * * * * * * * * * * * * */
1629 public function login_error_messages($error) {
1630
1631 global $errors;
1632
1633 if ( isset( $errors ) ){
1634
1635 $error_codes = $errors->get_error_codes();
1636
1637 if ( $this->loginpress_key ) {
1638
1639 $invalid_usrname = array_key_exists( 'incorrect_username', $this->loginpress_key ) && ! empty( $this->loginpress_key['incorrect_username'] ) ? $this->loginpress_key['incorrect_username'] : sprintf( __( '%1$sError:%2$s Invalid Username.', 'loginpress' ), '<strong>', '</strong>' );
1640
1641 $invalid_pasword = array_key_exists( 'incorrect_password', $this->loginpress_key ) && ! empty( $this->loginpress_key['incorrect_password'] ) ? $this->loginpress_key['incorrect_password'] : sprintf( __( '%1$sError:%2$s Invalid Password.', 'loginpress' ), '<strong>', '</strong>' );
1642
1643 $empty_username = array_key_exists( 'empty_username', $this->loginpress_key ) && ! empty( $this->loginpress_key['empty_username'] ) ? $this->loginpress_key['empty_username'] : sprintf( __( '%1$sError:%2$s The username field is empty.', 'loginpress' ), '<strong>', '</strong>' );
1644
1645 $empty_password = array_key_exists( 'empty_password', $this->loginpress_key ) && ! empty( $this->loginpress_key['empty_password'] ) ? $this->loginpress_key['empty_password'] : sprintf( __( '%1$sError:%2$s The password field is empty.', 'loginpress' ), '<strong>', '</strong>' );
1646
1647 $invalid_email = array_key_exists( 'invalid_email', $this->loginpress_key ) && ! empty( $this->loginpress_key['invalid_email'] ) ? $this->loginpress_key['invalid_email'] : sprintf( __( '%1$sError:%2$s The email address isn\'t correct..', 'loginpress' ), '<strong>', '</strong>' );
1648
1649 $empty_email = array_key_exists( 'empty_email', $this->loginpress_key ) && ! empty( $this->loginpress_key['empty_email'] ) ? $this->loginpress_key['empty_email'] : sprintf( __( '%1$sError:%2$s Please type your email address.', 'loginpress' ), '<strong>', '</strong>' );
1650
1651 $username_exists = array_key_exists( 'username_exists', $this->loginpress_key ) && ! empty( $this->loginpress_key['username_exists'] ) ? $this->loginpress_key['username_exists'] : sprintf( __( '%1$sError:%2$s This username is already registered. Please choose another one.', 'loginpress' ), '<strong>', '</strong>' );
1652
1653 $email_exists = array_key_exists( 'email_exists', $this->loginpress_key ) && ! empty( $this->loginpress_key['email_exists'] ) ? $this->loginpress_key['email_exists'] : sprintf( __( '%1$sError:%2$s This email is already registered, please choose another one.', 'loginpress' ), '<strong>', '</strong>' );
1654
1655 $invalidcombo = array_key_exists( 'invalidcombo_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['invalidcombo_message'] ) ? $this->loginpress_key['invalidcombo_message'] : sprintf( __( '%1$sError:%2$s Invalid username or email.', 'loginpress' ), '<strong>', '</strong>' );
1656
1657 if ( in_array( 'invalid_username', $error_codes ) ) return $invalid_usrname;
1658
1659 if ( in_array( 'incorrect_password', $error_codes ) ) return $invalid_pasword;
1660
1661 if ( in_array( 'empty_username', $error_codes ) ) return $empty_username;
1662
1663 if ( in_array( 'empty_password', $error_codes ) ) return $empty_password;
1664
1665 // registeration Form enteries.
1666 if ( in_array( 'invalid_email', $error_codes ) ) return $invalid_email;
1667
1668 if ( in_array( 'empty_email', $error_codes ) ) return "</br>" . $empty_email;
1669
1670 if ( in_array( 'username_exists', $error_codes ) ) return $username_exists;
1671
1672 if ( in_array( 'email_exists', $error_codes ) ) return $email_exists;
1673
1674 // forget password entery.
1675 if ( in_array( 'invalidcombo', $error_codes ) ) return $invalidcombo;
1676 }
1677 }
1678
1679 return $error;
1680 }
1681
1682 /**
1683 * Change Lost Password Text from Form
1684 *
1685 * @param $text
1686 * @since 1.0.0
1687 * @version 1.0.21
1688 * @return mixed
1689 * * * * * * * * * * * * * * * * * * */
1690 public function change_lostpassword_message ( $translated_text, $text, $domain ) {
1691
1692 if ( is_array( $this->loginpress_key ) && array_key_exists( 'login_footer_text', $this->loginpress_key ) && $text == 'Lost your password?' && 'default' == $domain && trim( $this->loginpress_key['login_footer_text'] ) ) {
1693
1694 return trim( $this->loginpress_key['login_footer_text'] );
1695 }
1696
1697 return $translated_text;
1698 }
1699 /**
1700 * Change Label of the Username from login Form.
1701 * @param [type] $translated_text [description]
1702 * @param [type] $text [description]
1703 * @param [type] $domain [description]
1704 * @return string
1705 * @since 1.1.3
1706 * @version 1.1.7
1707 */
1708 public function change_username_label( $translated_text, $text, $domain ){
1709
1710 $loginpress_setting = get_option( 'loginpress_setting' );
1711
1712 if ( $loginpress_setting ) {
1713
1714 $default = 'Username or Email Address';
1715 // $options = $this->loginpress_key;
1716 // $label = array_key_exists( 'form_username_label', $options ) ? $options['form_username_label'] : '';
1717 $login_order = isset( $loginpress_setting['login_order'] ) ? $loginpress_setting['login_order'] : '';
1718
1719 // If the option does not exist, return the text unchanged.
1720 if ( ! $loginpress_setting && $default === $text ) {
1721 return $translated_text;
1722 }
1723
1724 // If options exsit, then translate away.
1725 if ( $loginpress_setting && $default === $text ) {
1726
1727 // Check if the option exists.
1728 if ( '' != $login_order && 'default' != $login_order ) {
1729 if ( 'username' == $login_order ) {
1730 $label = __( 'Username', 'loginpress' );
1731 } elseif ( 'email' == $login_order ) {
1732 $label = __( 'Email Address', 'loginpress' );
1733 } else {
1734 $label = 'Username or Email Address';
1735 }
1736 $translated_text = esc_html( $label );
1737 } else {
1738 return $translated_text;
1739 }
1740 }
1741 }
1742 return $translated_text;
1743 }
1744 /**
1745 * Change Password Label from Form.
1746 * @param [type] $translated_text [description]
1747 * @param [type] $text [description]
1748 * @param [type] $domain [description]
1749 * @return string
1750 * @since 1.1.3
1751 */
1752 public function change_password_label( $translated_text, $text, $domain ) {
1753
1754 if ( $this->loginpress_key ) {
1755 $default = 'Password';
1756 $options = $this->loginpress_key;
1757 $label = array_key_exists( 'form_password_label', $options ) ? $options['form_password_label'] : '';
1758
1759 // If the option does not exist, return the text unchanged.
1760 if ( ! $options && $default === $text ) {
1761 return $translated_text;
1762 }
1763
1764 // If options exsit, then translate away.
1765 if ( $options && $default === $text ) {
1766
1767 // Check if the option exists.
1768 if ( array_key_exists( 'form_password_label', $options ) ) {
1769 $translated_text = esc_html( $label );
1770 } else {
1771 return $translated_text;
1772 }
1773 }
1774 }
1775 return $translated_text;
1776 }
1777
1778 /**
1779 * Manage Welcome Messages
1780 *
1781 * @param $message
1782 * @since 1.0.0
1783 * @return string
1784 * * * * * * * * * * * * */
1785 public function change_welcome_message ($message) {
1786
1787 if ( $this->loginpress_key ) {
1788
1789 //Check, User Logedout.
1790 if ( isset( $_GET['loggedout'] ) && TRUE == $_GET['loggedout'] ) {
1791
1792 if ( array_key_exists( 'logout_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['logout_message'] ) ) {
1793
1794 $loginpress_message = $this->loginpress_key['logout_message'];
1795 }
1796 }
1797
1798 //Logged In messages.
1799 else if ( strpos( $message, __( "Please enter your username or email address. You will receive a link to create a new password via email." ) ) == true ) {
1800
1801 if ( array_key_exists( 'lostpwd_welcome_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['lostpwd_welcome_message'] ) ) {
1802
1803 $loginpress_message = $this->loginpress_key['lostpwd_welcome_message'];
1804 }
1805 }
1806
1807 else if( strpos( $message, __( "Register For This Site" ) ) == true ) {
1808
1809 if ( array_key_exists( 'register_welcome_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['register_welcome_message'] ) ) {
1810
1811 $loginpress_message = $this->loginpress_key['register_welcome_message'];
1812 }
1813 }
1814
1815 // @since 1.0.18
1816 // else if ( strpos( $message, __( "Enter your new password below." ) ) == true ) {
1817 //
1818 // if ( array_key_exists( 'reset_hint_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['reset_hint_message'] ) ) {
1819 //
1820 // $loginpress_message = $this->loginpress_key['reset_hint_message'];
1821 // }
1822 // }
1823
1824 // @since 1.0.18
1825 else if ( strpos( $message, __( "Your password has been reset." ) ) == true ) {
1826
1827 // if ( array_key_exists( 'after_reset_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['after_reset_message'] ) ) {
1828
1829 $loginpress_message = __( 'Your password has been reset.' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in' ) . '</a></p>';
1830 // }
1831 }
1832
1833 else {
1834 if ( array_key_exists( 'welcome_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['welcome_message'] ) ) {
1835
1836 $loginpress_message = $this->loginpress_key['welcome_message'];
1837 }
1838 }
1839
1840
1841 return ! empty( $loginpress_message ) ? "<p class='custom-message'>" . $loginpress_message. "</p>" : $message;
1842 }
1843 }
1844
1845 /**
1846 * Hook to Redirect Page for Customize
1847 *
1848 * @since 1.1.3
1849 * * * * * * * * * * * * * * * * * * */
1850 public function redirect_to_custom_page() {
1851 if ( ! empty($_GET['page'] ) ) {
1852
1853 if( ( $_GET['page'] == "abw" ) || ( $_GET['page'] == "loginpress" ) ) {
1854
1855 if ( is_multisite() ) { // if subdirectories are used in multisite.
1856
1857 $loginpress_obj = new LoginPress();
1858 $loginpress_page = $loginpress_obj->get_loginpress_page();
1859
1860 $page = get_permalink( $loginpress_page );
1861
1862 // Generate the redirect url.
1863 $url = add_query_arg(
1864 array(
1865 'autofocus[panel]' => 'loginpress_panel',
1866 'url' => rawurlencode( $page ),
1867 ),
1868 admin_url( 'customize.php' )
1869 );
1870
1871 wp_safe_redirect( $url );
1872
1873 } else {
1874
1875 wp_redirect( get_admin_url() . "customize.php?url=" . wp_login_url() );
1876 }
1877 }
1878 }
1879 }
1880
1881 /**
1882 * Redirect to the Admin Panel After Closing LoginPress Customizer
1883 *
1884 * @since 1.0.0
1885 * @return null
1886 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1887 public function menu_url() {
1888
1889 global $submenu;
1890
1891 $parent = 'index.php';
1892 $page = 'abw';
1893
1894 // Create specific url for login view
1895 $login_url = wp_login_url();
1896 $url = add_query_arg(
1897 array(
1898 'url' => urlencode( $login_url ),
1899 'return' => admin_url( 'themes.php' ),
1900 ),
1901 admin_url( 'customize.php' )
1902 );
1903
1904 // If is Not Design Menu, return
1905 if ( ! isset( $submenu[ $parent ] ) ) {
1906 return NULL;
1907 }
1908
1909 foreach ( $submenu[ $parent ] as $key => $value ) {
1910 // Set new URL for menu item
1911 if ( $page === $value[ 2 ] ) {
1912 $submenu[ $parent ][ $key ][ 2 ] = $url;
1913 break;
1914 }
1915 }
1916 }
1917 }
1918
1919 ?>
1920