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

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