PluginProbe
LoginPress | wp-login Custom Login Page Customizer / 3.0.6
LoginPress | wp-login Custom Login Page Customizer v3.0.6
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 3.0.6, at custom.php

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