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

2,324 lines 87.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class LoginPress_Entities {
4
5 /**
6 * Variable that Check for LoginPress Key.
7 *
8 * @var string
9 * @since 1.0.0
10 * @version 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 * Field settings for the error message
821 *
822 * @since 3.0.0
823 */
824 $wp_customize->add_setting( 'loginpress_customization[background_video_error]', array(
825 'sanitize_callback' => 'sanitize_text_field',
826 ) );
827 /**
828 * Field for Add a control for the error message
829 *
830 * @since 3.0.0
831 */
832 $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'loginpress_customization[background_video_error]', array(
833 'label' => __( 'Error Message:', 'loginpress' ),
834 'description' => 'Wrong Selection, Please select MP4, webm or ogg file only',
835 'section' => 'section_background',
836 'priority' => 46, // Place it after the video control
837 'type' => 'hidden', // Using hidden type to display only the description
838 ) ) );
839 /**
840 * Field for YouTube video ID.
841 *
842 * @since 3.0.0
843 */
844 $wp_customize->add_setting( "loginpress_customization[yt_video_id]", array(
845 'type' => 'option',
846 'capability' => 'manage_options',
847 'transport' => 'postMessage',
848 'sanitize_callback' => 'sanitize_text_field'
849 ));
850
851 $wp_customize->add_control( "loginpress_customization[yt_video_id]", array(
852 'label' => __( 'ID of the YouTube video', 'loginpress' ),
853 '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>' ),
854 'section' => 'section_background',
855 'priority' => 47,
856 'settings' => "loginpress_customization[yt_video_id]",
857 'input_attrs' => array(
858 'placeholder' => 'GMAwsHomJlE',
859 )
860 ) );
861
862 // @version 1.1.21
863 $wp_customize->add_setting( 'loginpress_customization[background_video_object]', array(
864 'default' => 'cover',
865 'type' => 'option',
866 'capability' => 'manage_options',
867 'transport' => 'postMessage',
868 'sanitize_callback' => 'loginpress_sanitize_select'
869 ) );
870 $wp_customize->add_control( 'loginpress_customization[background_video_object]', array(
871 'settings' => 'loginpress_customization[background_video_object]',
872 'label' => __( 'Video Size:', 'loginpress' ),
873 'section' => 'section_background',
874 'priority' => 50,
875 'type' => 'select',
876 'choices' => array(
877 'fill' => 'fill',
878 'contain' => 'contain',
879 'cover' => 'cover',
880 'scale-down' => 'scale-down',
881 'none' => 'none',
882 ),
883 ) );
884
885 $wp_customize->add_setting( "loginpress_customization[video_obj_position]", array(
886 'type' => 'option',
887 'capability' => 'manage_options',
888 'transport' => 'postMessage',
889 'sanitize_callback' => 'wp_strip_all_tags'
890 ) );
891
892 $wp_customize->add_control( "loginpress_customization[video_obj_position]", array(
893 'label' => __( 'Object Position:', 'loginpress' ),
894 'section' => 'section_background',
895 'priority' => 55,
896 'settings' => "loginpress_customization[video_obj_position]",
897 'input_attrs' => array(
898 'placeholder' => __( '50% 50%' ),
899 )
900 ) );
901
902 /**
903 * [Enable / Disable Background Video with LoginPress_Radio_Control]
904 *
905 * @since 1.1.22
906 */
907 $wp_customize->add_setting( 'loginpress_customization[background_video_muted]', array(
908 'default' => true,
909 'type' => 'option',
910 'capability' => 'manage_options',
911 'transport' => 'postMessage',
912 'sanitize_callback' => 'loginpress_sanitize_checkbox'
913 ) );
914
915 $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[background_video_muted]', array(
916 'settings' => 'loginpress_customization[background_video_muted]',
917 'label' => __( 'Muted Video?', 'loginpress'),
918 'section' => 'section_background',
919 'priority' => 60,
920 'type' => 'ios', // light, ios, flat
921 ) ) );
922
923 // =============================
924 // = Section for Form Beauty =
925 // =============================
926 $wp_customize->add_section( 'section_form', array(
927 'title' => __( 'Customize Login Form', 'loginpress' ),
928 'description' => '',
929 'priority' => 15,
930 'panel' => 'loginpress_panel',
931 ) );
932
933 $this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_form', 2, 4 );
934
935 /**
936 * [ Enable / Disable Form Background Image with LoginPress_Radio_Control ]
937 *
938 * @since 1.1.3
939 */
940
941 $wp_customize->add_setting( 'loginpress_customization[setting_form_display_bg]', array(
942 'default' => false,
943 'type' => 'option',
944 'capability' => 'manage_options',
945 'transport' => 'postMessage',
946 'sanitize_callback' => 'loginpress_sanitize_checkbox'
947 ) );
948
949 $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[setting_form_display_bg]', array(
950 'settings' => 'loginpress_customization[setting_form_display_bg]',
951 'label' => __( 'Enable Form Transparency:', 'loginpress'),
952 'section' => 'section_form',
953 'priority' => 5,
954 'type' => 'ios',
955 ) ) );
956
957 $wp_customize->add_setting( 'loginpress_customization[setting_form_background]', array(
958 'type' => 'option',
959 'capability' => 'manage_options',
960 'transport' => 'postMessage',
961 'sanitize_callback' => 'loginpress_sanitize_image'
962 ) );
963
964 $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'loginpress_customization[setting_form_background]', array(
965 'label' => __( 'Form Background Image:', 'loginpress' ),
966 'section' => 'section_form',
967 'priority' => 6,
968 'settings' => 'loginpress_customization[setting_form_background]'
969 ) ) );
970
971 $this->loginpress_color_setting( $wp_customize, $form_color_control, $form_color_label, 'section_form', 0, 7 );
972
973 $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 );
974 $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 );
975 $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 );
976 $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 );
977 $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 );
978
979 $form_padding = 0;
980 while ( $form_padding < 2 ) :
981
982 $wp_customize->add_setting( "loginpress_customization[{$form_control[$form_padding]}]", array(
983 'default' => $form_default[$form_padding],
984 'type' => 'option',
985 'capability' => 'manage_options',
986 'transport' => 'postMessage',
987 'sanitize_callback' => $form_sanitization[$form_padding]
988 ) );
989
990 $wp_customize->add_control( "loginpress_customization[{$form_control[$form_padding]}]", array(
991 'label' => $form_label[$form_padding],
992 'section' => 'section_form',
993 'priority' => 40,
994 'settings' => "loginpress_customization[{$form_control[$form_padding]}]"
995 ) );
996
997 $form_padding++;
998 endwhile;
999
1000 $this->loginpress_hr_setting( $wp_customize, $close_control, 'section_form', 3, 41 );
1001
1002 $this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_form', 0, 45 );
1003
1004 $this->loginpress_color_setting( $wp_customize, $form_color_control, $form_color_label, 'section_form', 1, 50 );
1005 $this->loginpress_color_setting( $wp_customize, $form_color_control, $form_color_label, 'section_form', 2, 55 );
1006
1007 $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 );
1008 // textfield_radius.
1009 // $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 );
1010 // textfield_shadow.
1011 // $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 );
1012 // textfield_shadow_opacity.
1013 // $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 );
1014
1015 /**
1016 * [ Enable / Disable Form Background Image with LoginPress_Radio_Control ]
1017 * @since 1.1.3
1018 */
1019
1020 // $wp_customize->add_setting( 'loginpress_customization[textfield_inset_shadow]', array(
1021 // 'default' => false,
1022 // 'type' => 'option',
1023 // 'capability' => 'manage_options',
1024 // 'transport' => 'postMessage'
1025 // ) );
1026 //
1027 // $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[textfield_inset_shadow]', array(
1028 // 'settings' => 'loginpress_customization[textfield_inset_shadow]',
1029 // 'label' => __( 'Input Text Field Shadow Inset:', 'loginpress'),
1030 // 'section' => 'section_form',
1031 // 'priority' => 80,
1032 // 'type' => 'ios',// light, ios, flat
1033 // ) ) );
1034
1035 $input_padding = 2;
1036 while ( $input_padding < 3 ) :
1037
1038 $wp_customize->add_setting( "loginpress_customization[{$form_control[$input_padding]}]", array(
1039 'default' => $form_default[$input_padding],
1040 'type' => 'option',
1041 'capability' => 'manage_options',
1042 'transport' => 'postMessage',
1043 'sanitize_callback' => $form_sanitization[$input_padding]
1044 ) );
1045
1046 $wp_customize->add_control( "loginpress_customization[{$form_control[$input_padding]}]", array(
1047 'label' => $form_label[$input_padding],
1048 'section' => 'section_form',
1049 'priority' => 85,
1050 'settings' => "loginpress_customization[{$form_control[$input_padding]}]"
1051 ) );
1052
1053 $input_padding++;
1054 endwhile;
1055
1056 $this->loginpress_hr_setting( $wp_customize, $close_control, 'section_form', 4, 86 );
1057 $this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_form', 1, 90 );
1058
1059 // $form_input_label = 3;
1060 // while ( $form_input_label < 5 ) :
1061 //
1062 // $wp_customize->add_setting( "loginpress_customization[{$form_control[$form_input_label]}]", array(
1063 // 'default' => $form_default[$form_input_label],
1064 // 'type' => 'option',
1065 // 'capability' => 'manage_options',
1066 // 'transport' => 'postMessage'
1067 // ) );
1068 //
1069 // $wp_customize->add_control( "loginpress_customization[{$form_control[$form_input_label]}]", array(
1070 // 'label' => $form_label[$form_input_label],
1071 // 'section' => 'section_form',
1072 // 'priority' => 91,
1073 // 'settings' => "loginpress_customization[{$form_control[$form_input_label]}]"
1074 // ) );
1075 //
1076 // $form_input_label++;
1077 // endwhile;
1078
1079 $this->loginpress_color_setting( $wp_customize, $form_color_control, $form_color_label, 'section_form', 3, 95 );
1080 $this->loginpress_color_setting( $wp_customize, $form_color_control, $form_color_label, 'section_form', 4, 100 );
1081
1082 // customize_form_label.
1083 $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 );
1084 // remember_me_font_size.
1085 $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 );
1086 $this->loginpress_hr_setting( $wp_customize, $close_control, 'section_form', 5, 111 );
1087
1088 // =============================
1089 // = Section for Forget Form =
1090 // =============================
1091 $wp_customize->add_section( 'section_forget_form', array(
1092 'title' => __( 'Customize Forget Form', 'loginpress' ),
1093 'description' => '',
1094 'priority' => 20,
1095 'panel' => 'loginpress_panel',
1096 ) );
1097
1098 $wp_customize->add_setting( 'loginpress_customization[forget_form_background]', array(
1099 'type' => 'option',
1100 'capability' => 'manage_options',
1101 'transport' => 'postMessage',
1102 'sanitize_callback' => 'loginpress_sanitize_image'
1103 ) );
1104
1105 $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'loginpress_customization[forget_form_background]', array(
1106 'label' => __( 'Forget Form Background Image:', 'loginpress' ),
1107 'section' => 'section_forget_form',
1108 'priority' => 5,
1109 'settings' => 'loginpress_customization[forget_form_background]'
1110 ) ) );
1111
1112 $wp_customize->add_setting( 'loginpress_customization[forget_form_background_color]', array(
1113 // 'default' => '#FFF',
1114 'type' => 'option',
1115 'capability' => 'manage_options',
1116 'transport' => 'postMessage',
1117 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1118 ) );
1119
1120 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[forget_form_background_color]', array(
1121 'label' => __( 'Forget Form Background Color:', 'loginpress' ),
1122 'section' => 'section_forget_form',
1123 'priority' => 10,
1124 'settings' => 'loginpress_customization[forget_form_background_color]'
1125 ) ) );
1126
1127 // =============================
1128 // = Section for Button Style =
1129 // =============================
1130 $wp_customize->add_section( 'section_button', array(
1131 'title' => __( 'Button Beauty', 'loginpress' ),
1132 'description' => '',
1133 'priority' => 25,
1134 'panel' => 'loginpress_panel',
1135 ) );
1136
1137 $this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 0, 5 );
1138 $this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 1, 10 );
1139 $this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 2, 15 );
1140 $this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 3, 20 );
1141 $this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 4, 25 );
1142 $this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 5, 30 );
1143 $this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 6, 35 );
1144
1145 /**
1146 * [ Change Button CSS Properties with LoginPress_Range_Control ]
1147 * @since 1.0.1
1148 * @version 3.0.0
1149 */
1150
1151 $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 );
1152 $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 );
1153 $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 );
1154 $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 );
1155 $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 );
1156 $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 );
1157 $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 );
1158
1159 // =============================
1160 // = Section for Error message =
1161 // =============================
1162 $wp_customize->add_section( 'section_error', array(
1163 'title' => __( 'Error Messages', 'loginpress' ),
1164 'description' => '',
1165 'priority' => 30,
1166 'panel' => 'loginpress_panel',
1167 ) );
1168
1169 $error = 0;
1170 while ( $error < 11 ) :
1171
1172 $wp_customize->add_setting( "loginpress_customization[{$error_control[$error]}]", array(
1173 'default' => $error_default[$error],
1174 'type' => 'option',
1175 'capability' => 'manage_options',
1176 'transport' => 'postMessage',
1177 'sanitize_callback' => 'wp_kses_post'
1178 ) );
1179
1180 $wp_customize->add_control( "loginpress_customization[{$error_control[$error]}]", array(
1181 'label' => $error_label[$error],
1182 'section' => 'section_error',
1183 'priority' => 5,
1184 'settings' => "loginpress_customization[{$error_control[$error]}]",
1185 ) );
1186
1187 $error++;
1188 endwhile;
1189
1190 // =============================
1191 // = Section for Welcome message
1192 // =============================
1193 $wp_customize->add_section( 'section_welcome', array(
1194 'title' => __( 'Welcome Messages', 'loginpress' ),
1195 'description' => '',
1196 'priority' => 35,
1197 'panel' => 'loginpress_panel',
1198 ) );
1199
1200 $welcome = 0;
1201 while ( $welcome < 5 ) :
1202
1203 $wp_customize->add_setting( "loginpress_customization[{$welcome_control[$welcome]}]", array(
1204 'type' => 'option',
1205 'capability' => 'manage_options',
1206 'transport' => 'postMessage',
1207 'sanitize_callback' => $welcome_sanitization[$welcome]
1208 ));
1209
1210 $wp_customize->add_control( "loginpress_customization[{$welcome_control[$welcome]}]", array(
1211 'label' => $welcome_label[ $welcome ],
1212 'section' => 'section_welcome',
1213 'priority' => 5,
1214 'settings' => "loginpress_customization[{$welcome_control[$welcome]}]",
1215 'input_attrs' => array(
1216 'placeholder' => $welcome_default[ $welcome ],
1217 )
1218 ) );
1219
1220 $welcome++;
1221 endwhile;
1222
1223 $wp_customize->add_setting( 'loginpress_customization[message_background_color]', array(
1224 // 'default' => '#fff',
1225 'type' => 'option',
1226 'capability' => 'manage_options',
1227 'transport' => 'postMessage',
1228 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1229 ) );
1230
1231 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[message_background_color]', array(
1232 'label' => __( 'Message Field Background Color:', 'loginpress' ),
1233 'section' => 'section_welcome',
1234 'priority' => 30,
1235 'settings' => 'loginpress_customization[message_background_color]'
1236 ) ) );
1237
1238 // =============================
1239 // = Section for Header message
1240 // =============================
1241 // $wp_customize->add_section(
1242 // 'section_head',
1243 // array(
1244 // 'title' => __( 'Header Message', 'loginpress' ),
1245 // 'description' => '',
1246 // 'priority' => 35,
1247 // 'panel' => 'loginpress_panel',
1248 // ));
1249 //
1250 // $wp_customize->add_setting( 'loginpress_customization[login_header_message]', array(
1251 // 'default' => 'Latest NEWS',
1252 // 'type' => 'option',
1253 // 'capability' => 'edit_theme_options',
1254 // ));
1255 //
1256 // $wp_customize->add_control( 'login_header_message', array(
1257 // 'label' => __( 'Header Message:', 'loginpress' ),
1258 // 'section' => 'section_head',
1259 // 'priority' => 5,
1260 // 'settings' => 'loginpress_customization[login_header_message]',
1261 // ));
1262 //
1263 // $wp_customize->add_setting( 'loginpress_customization[login_header_message_link]', array(
1264 // 'default' => '#',
1265 // 'type' => 'option',
1266 // 'capability' => 'edit_theme_options',
1267 // ));
1268 //
1269 // $wp_customize->add_control( 'login_header_message_link', array(
1270 // 'label' => __( 'Header Message Link:', 'loginpress' ),
1271 // 'section' => 'section_head',
1272 // 'priority' => 5,
1273 // 'settings' => 'loginpress_customization[login_header_message_link]',
1274 // ));
1275 //
1276 // $wp_customize->add_setting( 'loginpress_customization[login_head_color]', array(
1277 // 'default' => '#17a8e3',
1278 // 'type' => 'option',
1279 // 'capability' => 'edit_theme_options',
1280 // ));
1281 //
1282 // $wp_customize->add_control(
1283 // new WP_Customize_Color_Control(
1284 // $wp_customize,
1285 // 'login_head_color',
1286 // array(
1287 // 'label' => __( 'Header Text Color:', 'loginpress' ),
1288 // 'section' => 'section_head',
1289 // 'priority' => 10,
1290 // 'settings' => 'loginpress_customization[login_head_color]'
1291 // )));
1292 //
1293 // $wp_customize->add_setting( 'loginpress_customization[login_head_color_hover]', array(
1294 // // 'default' => '#17a8e3',
1295 // 'type' => 'option',
1296 // 'capability' => 'edit_theme_options',
1297 // ));
1298 //
1299 // $wp_customize->add_control(
1300 // new WP_Customize_Color_Control(
1301 // $wp_customize,
1302 // 'login_head_color_hover',
1303 // array(
1304 // 'label' => __( 'Header Text Hover Color:', 'loginpress' ),
1305 // 'section' => 'section_head',
1306 // 'priority' => 15,
1307 // 'settings' => 'loginpress_customization[login_head_color_hover]'
1308 // )));
1309 //
1310 // $wp_customize->add_setting( 'loginpress_customization[login_head_font_size]', array(
1311 // 'default' => '13px;',
1312 // 'type' => 'option',
1313 // 'capability' => 'edit_theme_options',
1314 // ));
1315 //
1316 // $wp_customize->add_control( 'login_head_font_size', array(
1317 // 'label' => __( 'Text Font Size:', 'loginpress' ),
1318 // 'section' => 'section_head',
1319 // 'priority' => 20,
1320 // 'settings' => 'loginpress_customization[login_head_font_size]',
1321 // ));
1322 //
1323 // $wp_customize->add_setting( 'loginpress_customization[login_head_bg_color]', array(
1324 // // 'default' => '#17a8e3',
1325 // 'type' => 'option',
1326 // 'capability' => 'edit_theme_options',
1327 // ));
1328 //
1329 // $wp_customize->add_control(
1330 // new WP_Customize_Color_Control(
1331 // $wp_customize,
1332 // 'login_head_bg_color',
1333 // array(
1334 // 'label' => __( 'Header Background Color:', 'loginpress' ),
1335 // 'section' => 'section_head',
1336 // 'priority' => 25,
1337 // 'settings' => 'loginpress_customization[login_head_bg_color]'
1338 // )));
1339
1340 // =============================
1341 // = Section for Form Footer =
1342 // =============================
1343 $wp_customize->add_section( 'section_footer', array(
1344 'title' => __( 'Form Footer', 'loginpress' ),
1345 'description' => '',
1346 'priority' => 40,
1347 'panel' => 'loginpress_panel',
1348 ) );
1349
1350 $this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_footer', 3, 4 );
1351
1352 $wp_customize->add_setting( 'loginpress_customization[footer_display_text]', array(
1353 'default' => true,
1354 'type' => 'option',
1355 'capability' => 'manage_options',
1356 'transport' => 'postMessage',
1357 'sanitize_callback' => 'loginpress_sanitize_checkbox'
1358 ));
1359
1360 /**
1361 * [Enable / Disable Footer Text with LoginPress_Radio_Control]
1362 * @since 1.0.1
1363 * @version 1.0.23
1364 */
1365 $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[footer_display_text]', array(
1366 'settings' => 'loginpress_customization[footer_display_text]',
1367 'label' => __( 'Enable Footer Text:', 'loginpress' ),
1368 'section' => 'section_footer',
1369 'priority' => 5,
1370 'type' => 'ios',// light, ios, flat
1371 ) ) );
1372
1373 $wp_customize->add_setting( 'loginpress_customization[login_footer_text]', array(
1374 'default' => __( 'Lost your password?', 'loginpress' ),
1375 'type' => 'option',
1376 'capability' => 'manage_options',
1377 'transport' => 'postMessage',
1378 'sanitize_callback' => 'wp_kses_post'
1379 ) );
1380
1381 $wp_customize->add_control( 'loginpress_customization[login_footer_text]', array(
1382 'label' => __( 'Lost Password Text:', 'loginpress' ),
1383 'section' => 'section_footer',
1384 'priority' => 10,
1385 'settings' => 'loginpress_customization[login_footer_text]',
1386 ) );
1387
1388 $wp_customize->add_setting( 'loginpress_customization[login_footer_text_decoration]', array(
1389 'default' => 'none',
1390 'type' => 'option',
1391 'capability' => 'manage_options',
1392 'transport' => 'postMessage',
1393 'sanitize_callback' => 'loginpress_sanitize_select'
1394 ) );
1395
1396 $wp_customize->add_control( 'loginpress_customization[login_footer_text_decoration]', array(
1397 'settings' => 'loginpress_customization[login_footer_text_decoration]',
1398 'label' => __( 'Select Text Decoration:', 'loginpress' ),
1399 'section' => 'section_footer',
1400 'priority' => 15,
1401 'type' => 'select',
1402 'choices' => array(
1403 'none' => 'none',
1404 'overline' => 'overline',
1405 'line-through' => 'line-through',
1406 'underline' => 'underline',
1407 ),
1408 ) );
1409
1410 $wp_customize->add_setting( 'loginpress_customization[login_footer_color]', array(
1411 // 'default' => '#17a8e3',
1412 'type' => 'option',
1413 'capability' => 'manage_options',
1414 'transport' => 'postMessage',
1415 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1416 ) );
1417
1418 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_footer_color]', array(
1419 'label' => __( 'Footer Text Color:', 'loginpress' ),
1420 'section' => 'section_footer',
1421 'priority' => 20,
1422 'settings' => 'loginpress_customization[login_footer_color]'
1423 ) ) );
1424
1425 $wp_customize->add_setting( 'loginpress_customization[login_footer_color_hover]', array(
1426 // 'default' => '#17a8e3',
1427 'type' => 'option',
1428 'capability' => 'manage_options',
1429 'transport' => 'postMessage',
1430 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1431 ) );
1432
1433 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_footer_color_hover]', array(
1434 'label' => __( 'Footer Text Hover Color:', 'loginpress' ),
1435 'section' => 'section_footer',
1436 'priority' => 25,
1437 'settings' => 'loginpress_customization[login_footer_color_hover]'
1438 ) ) );
1439
1440 $wp_customize->add_setting( "loginpress_customization[login_footer_font_size]", array(
1441 'default' => '13',
1442 'type' => 'option',
1443 'capability' => 'manage_options',
1444 'transport' => 'postMessage',
1445 'sanitize_callback' => 'absint',
1446 ) );
1447
1448 /**
1449 * [ Change login_footer_font_size Input fields with LoginPress_Range_Control ]
1450 * @since 1.0.1
1451 * @version 1.0.23
1452 */
1453 $wp_customize->add_control( new LoginPress_Range_Control( $wp_customize, "loginpress_customization[login_footer_font_size]", array(
1454 'type' => 'loginpress-range',
1455 'label' => __( 'Text Font Size:', 'loginpress' ),
1456 'section' => 'section_footer',
1457 'settings' => "loginpress_customization[login_footer_font_size]",
1458 'default' => '13',
1459 'priority' => 30,
1460 'input_attrs' => array(
1461 'min' => 0,
1462 'max' => 100,
1463 'step' => 1,
1464 'suffix' => 'px'
1465 )
1466 ) ) );
1467
1468 $wp_customize->add_setting( 'loginpress_customization[login_footer_bg_color]', array(
1469 // 'default' => '#17a8e3',
1470 'type' => 'option',
1471 'capability' => 'manage_options',
1472 'transport' => 'postMessage',
1473 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1474 ) );
1475
1476 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_footer_bg_color]', array(
1477 'label' => __( 'Footer Background Color:', 'loginpress' ),
1478 'section' => 'section_footer',
1479 'priority' => 35,
1480 'settings' => 'loginpress_customization[login_footer_bg_color]'
1481 ) ) );
1482
1483 $this->loginpress_hr_setting( $wp_customize, $close_control, 'section_footer', 0, 36 );
1484
1485 $this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_footer', 4, 40 );
1486
1487 $wp_customize->add_setting( 'loginpress_customization[back_display_text]', array(
1488 'default' => true,
1489 'type' => 'option',
1490 'capability' => 'manage_options',
1491 'transport' => 'postMessage',
1492 'sanitize_callback' => 'loginpress_sanitize_checkbox'
1493 ) );
1494
1495 /**
1496 * [Enable / Disable Footer Text with LoginPress_Radio_Control]
1497 * @since 1.0.1
1498 * @version 1.0.23
1499 */
1500 $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[back_display_text]', array(
1501 'settings' => 'loginpress_customization[back_display_text]',
1502 'label' => __( 'Enable "Back to" Text:', 'loginpress' ),
1503 'section' => 'section_footer',
1504 'priority' => 45,
1505 'type' => 'ios', // light, ios, flat
1506 ) ) );
1507
1508 $wp_customize->add_setting( 'loginpress_customization[login_back_text_decoration]', array(
1509 'default' => 'none',
1510 'type' => 'option',
1511 'capability' => 'manage_options',
1512 'transport' => 'postMessage',
1513 'sanitize_callback' => 'loginpress_sanitize_select'
1514
1515 ) );
1516
1517 $wp_customize->add_control( 'loginpress_customization[login_back_text_decoration]', array(
1518 'settings' => 'loginpress_customization[login_back_text_decoration]',
1519 'label' => __( '"Back to" Text Decoration:', 'loginpress' ),
1520 'section' => 'section_footer',
1521 'priority' => 50,
1522 'type' => 'select',
1523 'choices' => array(
1524 'none' => 'none',
1525 'overline' => 'overline',
1526 'line-through' => 'line-through',
1527 'underline' => 'underline',
1528 ),
1529 ) );
1530
1531 $wp_customize->add_setting( 'loginpress_customization[login_back_color]', array(
1532 // 'default' => '#17a8e3',
1533 'type' => 'option',
1534 'capability' => 'manage_options',
1535 'transport' => 'postMessage',
1536 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1537 ) );
1538
1539 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_back_color]', array(
1540 'label' => __( '"Back to" Text Color:', 'loginpress' ),
1541 'section' => 'section_footer',
1542 'priority' => 55,
1543 'settings' => 'loginpress_customization[login_back_color]'
1544 ) ) );
1545
1546 $wp_customize->add_setting( 'loginpress_customization[login_back_color_hover]', array(
1547 // 'default' => '#17a8e3',
1548 'type' => 'option',
1549 'capability' => 'manage_options',
1550 'transport' => 'postMessage',
1551 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1552 ) );
1553
1554 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_back_color_hover]', array(
1555 'label' => __( '"Back to" Text Hover Color:', 'loginpress' ),
1556 'section' => 'section_footer',
1557 'priority' => 60,
1558 'settings' => 'loginpress_customization[login_back_color_hover]'
1559 ) ) );
1560
1561 $wp_customize->add_setting( "loginpress_customization[login_back_font_size]", array(
1562 'default' => '13',
1563 'type' => 'option',
1564 'capability' => 'manage_options',
1565 'transport' => 'postMessage',
1566 'sanitize_callback' => 'absint',
1567 ) );
1568 $wp_customize->add_setting( 'loginpress_customization[loginpress_show_love]', array(
1569 'default' => true,
1570 'type' => 'option',
1571 'capability' => 'manage_options',
1572 'transport' => 'postMessage',
1573 'sanitize_callback' => 'loginpress_sanitize_checkbox'
1574 ) );
1575
1576 /**
1577 * [ Change login_back_font_size Input fields with LoginPress_Range_Control ]
1578 * @since 1.0.1
1579 * @version 1.0.23
1580 */
1581 $wp_customize->add_control( new LoginPress_Range_Control( $wp_customize, "loginpress_customization[login_back_font_size]", array(
1582 'type' => 'loginpress-range',
1583 'label' => __( '"Back to" Text Font Size:', 'loginpress' ),
1584 'section' => 'section_footer',
1585 'settings' => "loginpress_customization[login_back_font_size]",
1586 'default' => '13',
1587 'priority' => 65,
1588 'input_attrs' => array(
1589 'min' => 0,
1590 'max' => 100,
1591 'step' => 1,
1592 'suffix' => 'px'
1593 )
1594 ) ) );
1595
1596 $wp_customize->add_setting( 'loginpress_customization[login_back_bg_color]', array(
1597 // 'default' => '#17a8e3',
1598 'type' => 'option',
1599 'capability' => 'manage_options',
1600 'transport' => 'postMessage',
1601 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1602 ) );
1603
1604 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[login_back_bg_color]', array(
1605 'label' => __( '"Back to" Background Color:', 'loginpress' ),
1606 'section' => 'section_footer',
1607 'priority' => 70,
1608 'settings' => 'loginpress_customization[login_back_bg_color]'
1609 ) ) );
1610
1611 $this->loginpress_hr_setting( $wp_customize, $close_control, 'section_footer', 1, 71 );
1612
1613 $this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_footer', 5, 72 );
1614
1615 /**
1616 * [Enable / Disable Footer Text with LoginPress_Radio_Control]
1617 * @since 1.1.3
1618 */
1619 $wp_customize->add_setting( 'loginpress_customization[login_copy_right_display]', array(
1620 'default' => false,
1621 'type' => 'option',
1622 'capability' => 'manage_options',
1623 'transport' => 'postMessage',
1624 'sanitize_callback' => 'loginpress_sanitize_checkbox'
1625 ) );
1626 $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[login_copy_right_display]', array(
1627 'settings' => 'loginpress_customization[login_copy_right_display]',
1628 'section' => 'section_footer',
1629 'priority' => 73,
1630 'type' => 'ios',// light, ios, flat
1631 'label' => __( 'Enable Copyright Note:', 'loginpress' ),
1632 ) ) );
1633
1634 $wp_customize->add_setting( 'loginpress_customization[copyright_background_color]', array(
1635 'default' => '#efefef',
1636 'type' => 'option',
1637 'capability' => 'manage_options',
1638 'transport' => 'postMessage',
1639 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1640 ) );
1641
1642 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[copyright_background_color]', array(
1643 'label' => __( '"Copyright" Background Color:', 'loginpress' ),
1644 'section' => 'section_footer',
1645 'priority' => 74,
1646 'settings' => 'loginpress_customization[copyright_background_color]'
1647 ) ) );
1648
1649 //Form Footer Text Color
1650 $wp_customize->add_setting( 'loginpress_customization[copyright_text_color]', array(
1651 'default' => '#000000',
1652 'type' => 'option',
1653 'capability' => 'manage_options',
1654 'transport' => 'postMessage',
1655 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1656 ) );
1657
1658 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[copyright_text_color]', array(
1659 'label' => __( '"Copyright" Text Color:', 'loginpress' ),
1660 'section' => 'section_footer',
1661 'priority' => 75,
1662 'settings' => 'loginpress_customization[copyright_text_color]'
1663 ) ) );
1664
1665 $wp_customize->add_setting( 'loginpress_customization[login_footer_copy_right]', array(
1666 'default' => sprintf( __('© %1$s %2$s, All Rights Reserved.', 'loginpress'), date("Y"), get_bloginfo('name') ),
1667 'type' => 'option',
1668 'capability' => 'manage_options',
1669 'transport' => 'postMessage',
1670 'sanitize_callback' => 'wp_kses_post'
1671 ) );
1672
1673 //Show Some Love text Color
1674 // $wp_customize->add_setting( 'loginpress_customization[show_some_love_text_color]', array(
1675 // // 'default' => '#17a8e3',
1676 // 'type' => 'option',
1677 // 'capability' => 'manage_options',
1678 // 'transport' => 'postMessage',
1679 // 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code.
1680 // ) );
1681
1682 // $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[show_some_love_text_color]', array(
1683 // 'label' => __( '"Show Some Love" Text Color:', 'loginpress' ),
1684 // 'section' => 'section_footer',
1685 // 'priority' => 76,
1686 // 'settings' => 'loginpress_customization[show_some_love_text_color]'
1687 // ) ) );
1688
1689 /**
1690 * [Add Copyright string in the footer along with year]
1691 *
1692 * @version 1.5.4
1693 */
1694 $wp_customize->add_setting( 'loginpress_customization[login_footer_copy_right]', array(
1695 'default' => sprintf( __('© %1$s %2$s, All Rights Reserved.', 'loginpress'), '$YEAR$' , get_bloginfo('name') ),
1696 'type' => 'option',
1697 'capability' => 'manage_options',
1698 'transport' => 'postMessage',
1699 'sanitize_callback' => 'wp_kses_post'
1700 ) );
1701 $wp_customize->add_control( 'loginpress_customization[login_footer_copy_right]', array(
1702 'label' => __( 'Copyright Note:', 'loginpress' ),
1703 'description' => sprintf( __( '%1$s will be replaced with the current year.', 'loginpress' ), '<code>$YEAR$</code>' ),
1704 'type' => 'textarea',
1705 'section' => 'section_footer',
1706 'priority' => 77,
1707 'settings' => 'loginpress_customization[login_footer_copy_right]'
1708 ) );
1709
1710 /**
1711 * [Enable / Disable Footer Text with LoginPress_Radio_Control]
1712 * @since 1.0.1
1713 * @version 1.0.23
1714 */
1715 $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[loginpress_show_love]', array(
1716 'settings' => 'loginpress_customization[loginpress_show_love]',
1717 'section' => 'section_footer',
1718 'priority' => 80,
1719 'type' => 'ios', // light, ios, flat
1720 'label' => __( 'Show some Love. Please help others learn about this free plugin by placing small link in footer. Thank you very much!', 'loginpress' ),
1721 ) ) );
1722
1723 /**
1724 * [Love position on footer.]
1725 * @since 1.1.3
1726 */
1727 $wp_customize->add_setting( 'loginpress_customization[show_love_position]', array(
1728 'default' => 'right',
1729 'type' => 'option',
1730 'capability' => 'manage_options',
1731 'transport' => 'postMessage',
1732 // 'sanitize_callback' => 'loginpress_sanitize_checkbox'
1733 ) );
1734
1735 $wp_customize->add_control( 'loginpress_customization[show_love_position]', array(
1736 'label' => __( 'Love Position:', 'loginpress' ),
1737 'section' => 'section_footer',
1738 'priority' => 85,
1739 'settings' => 'loginpress_customization[show_love_position]',
1740 'type' => 'radio',
1741 'choices' => array(
1742 'left' => __( 'Left', 'loginpress' ),
1743 'right' => __( 'Right', 'loginpress' ),
1744 ),
1745 ) );
1746 $this->loginpress_hr_setting( $wp_customize, $close_control, 'section_footer', 2, 90 );
1747 // $this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_footer', 2, 90 );
1748
1749 // =============================
1750 // = Section for Custom CSS/JS =
1751 // =============================
1752 $wp_customize->add_section( 'loginpress_custom_css_js', array(
1753 'title' => __( 'Custom CSS/JS', 'loginpress' ),
1754 'description' => '',
1755 'priority' => 50,
1756 'panel' => 'loginpress_panel',
1757 ) );
1758
1759 $wp_customize->add_setting( 'loginpress_customization[loginpress_custom_css]', array(
1760 'type' => 'option',
1761 'capability' => 'manage_options',
1762 'transport' => 'postMessage'
1763 ) );
1764
1765 $wp_customize->add_control( 'loginpress_customization[loginpress_custom_css]', array(
1766 'label' => __( 'Customize CSS:', 'loginpress' ),
1767 'type' => 'textarea',
1768 'section' => 'loginpress_custom_css_js',
1769 'priority' => 5,
1770 'settings' => 'loginpress_customization[loginpress_custom_css]',
1771 '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>')
1772 ) );
1773
1774 $wp_customize->add_setting( 'loginpress_customization[loginpress_custom_js]', array(
1775 'type' => 'option',
1776 'capability' => 'manage_options',
1777 'transport' => 'postMessage'
1778 ) );
1779
1780 $wp_customize->add_control( 'loginpress_customization[loginpress_custom_js]', array(
1781 'label' => __( 'Customize JS:', 'loginpress' ),
1782 'type' => 'textarea',
1783 'section' => 'loginpress_custom_css_js',
1784 'priority' => 10,
1785 'settings' => 'loginpress_customization[loginpress_custom_js]',
1786 '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>')
1787 ) );
1788 }
1789
1790 /**
1791 * Manage the Login Footer Links.
1792 *
1793 * @since 1.0.0
1794 * @version 3.0.0
1795 */
1796 public function login_page_custom_footer() {
1797
1798 /**
1799 * Add brand position class.
1800 * @since 1.1.3
1801 * @version 3.0.0
1802 */
1803 $position = ''; // Empty variable for storing position class.
1804 if ( $this->loginpress_key ) {
1805 if ( isset( $this->loginpress_key['show_love_position'] ) && $this->loginpress_key['show_love_position'] == 'left' ) {
1806 $position = ' love-position';
1807 }
1808 }
1809
1810 /**
1811 * Add functionality of disabling the templates of LoginPress.
1812 *
1813 * @since 1.6.4
1814 */
1815 $disable_default_style = (bool) apply_filters( 'loginpress_disable_default_style', false );
1816
1817 if ( $this->loginpress_preset === 'default1' && $disable_default_style ) {
1818 include( LOGINPRESS_DIR_PATH . 'include/login-footer.php' );
1819 }
1820
1821 if ( empty( $this->loginpress_key ) || ( isset( $this->loginpress_key['loginpress_show_love'] ) && $this->loginpress_key['loginpress_show_love'] != '' ) ) {
1822 echo '<div class="loginpress-show-love' . $position . '">' . __( 'Powered by:', 'loginpress' ) . ' <a href="https://wpbrigade.com" target="_blank">LoginPress</a></div>';
1823 }
1824
1825 echo '<div class="footer-wrapper">';
1826 echo '<div class="footer-cont">';
1827
1828 if ( $this->loginpress_key ) {
1829 // do_action( 'loginpress_footer_wrapper' );
1830 do_action( 'loginpress_footer_menu' );
1831
1832 if ( array_key_exists( 'login_copy_right_display', $this->loginpress_key ) && true == $this->loginpress_key['login_copy_right_display'] ) {
1833
1834 /**
1835 * Replace the "$YEAR$" with current year if and where found.
1836 * @since 1.5.4
1837 */
1838 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 ) {
1839 $year = date( "Y" );
1840 //Setting the value with current year and saving in the 'login_footer_copy_right' key
1841 $this->loginpress_key['login_footer_copy_right'] = str_replace( '$YEAR$', $year, $this->loginpress_key['login_footer_copy_right'] );
1842 }
1843
1844 // Show a default value if not changed or show the changed text string for 'login_footer_copy_right'
1845 $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' ) );
1846
1847 echo '<div class="copyRight">'. apply_filters( 'loginpress_footer_copyright', $footer_text ) .'</div>';
1848 }
1849 }
1850 echo '</div></div>';
1851
1852 /**
1853 * Include LoginPress script in footer.
1854 * @since 1.2.2
1855 */
1856 include( LOGINPRESS_DIR_PATH . 'js/script-login.php' );
1857 }
1858
1859 /**
1860 * Manage the Login Head
1861 *
1862 * @since 1.0.0
1863 * @version 1.6.4
1864 */
1865 public function login_page_custom_head() {
1866
1867 $loginpress_setting = get_option( 'loginpress_setting' );
1868 $lostpassword_url = isset( $loginpress_setting['lostpassword_url'] ) ? $loginpress_setting['lostpassword_url'] : 'off';
1869
1870 add_filter( 'gettext', array( $this, 'change_lostpassword_message' ), 20, 3 );
1871 add_filter( 'gettext', array( $this, 'change_username_label' ), 20, 3 );
1872 // add_filter( 'gettext', array( $this, 'change_password_label' ), 20, 3 );
1873 // Include CSS File in header.
1874 if ( isset( $this->loginpress_key['loginpress_custom_js'] ) && ! empty( $this->loginpress_key['loginpress_custom_js'] ) ) { // 1.2.2
1875 wp_enqueue_script( 'jquery' );
1876 }
1877
1878 /**
1879 * Add functionality of disabling the templates of LoginPress.
1880 *
1881 * @since 1.6.4
1882 */
1883 $disable_default_style = (bool) apply_filters( 'loginpress_disable_default_style', false );
1884
1885 if ( ! $disable_default_style || 'default1' !== $this->loginpress_preset ) {
1886 include( LOGINPRESS_DIR_PATH . 'css/style-presets.php' );
1887 include( LOGINPRESS_DIR_PATH . 'css/style-login.php' );
1888 }
1889
1890 do_action( 'loginpress_header_menu' );
1891 // do_action( 'loginpress_header_wrapper' );
1892
1893 if ( 'on' == $lostpassword_url ) {
1894 remove_filter( 'lostpassword_url', 'wc_lostpassword_url', 10 );
1895 }
1896
1897 /**
1898 * Filter for changing the lost password URL of lifter LMS plugin to default Lost Password URL of WordPress
1899 * By using this filter, you can prevent the redirection of lost password to Lifter LMS's lost password page over lost password link.
1900 *
1901 * @param bool
1902 *
1903 * @since 1.5.3
1904 */
1905 if ( apply_filters( 'loginpress_llms_lostpassword_url', false ) ) {
1906 remove_filter( 'lostpassword_url', 'llms_lostpassword_url', 10 );
1907 }
1908
1909 if ( ! has_site_icon() && ! is_customize_preview() ) {
1910 $login_favicon = isset( $this->loginpress_key['login_favicon'] ) ? $this->loginpress_key['login_favicon'] : 'off';
1911
1912 if ( 'off' != $login_favicon && function_exists('login_header') ) {
1913 echo '<link rel="shortcut icon" href="' . $login_favicon . '" />';
1914 }
1915 }
1916 }
1917
1918 /**
1919 * Filters the Languages select input activation on the login screen.
1920 *
1921 * @param bool $arg Whether to display the Languages select input on the login screen.
1922 *
1923 * @since 1.5.11
1924 * @return bool
1925 */
1926 function loginpress_language_switch( $arg ) {
1927
1928 $loginpress_setting = get_option( 'loginpress_setting' );
1929 $language_switcher = isset( $loginpress_setting['enable_language_switcher'] ) ? $loginpress_setting['enable_language_switcher'] : 'off';
1930
1931 if ( 'off' === $language_switcher ) {
1932 return true;
1933 } else {
1934 return false;
1935 }
1936 }
1937
1938 /**
1939 * Set Redirect Path of Logo
1940 *
1941 * @since 1.0.0
1942 * @version 1.5.3
1943 */
1944 public function login_page_logo_url() {
1945
1946 if ( $this->loginpress_key && array_key_exists( 'customize_logo_hover', $this->loginpress_key ) && ! empty( $this->loginpress_key['customize_logo_hover'] ) ) {
1947 return __( $this->loginpress_key["customize_logo_hover"], 'loginpress' );
1948 } else {
1949 return home_url();
1950 }
1951 }
1952
1953 /**
1954 * Remove the filter login_errors from woocommerce login form.
1955 *
1956 * @since 1.0.16
1957 *
1958 * @return errors
1959 */
1960 function loginpress_woo_login_errors( $validation_error, $arg1, $arg2 ) {
1961
1962 remove_filter( 'login_errors', array( $this, 'login_error_messages' ) );
1963 return $validation_error;
1964 }
1965
1966
1967 /**
1968 * Set hover Title of Logo
1969 *
1970 * @since 1.0.0
1971 * @version 1.5.3
1972 *
1973 * @return mixed
1974 */
1975 public function login_page_logo_title() {
1976
1977 if ( $this->loginpress_key && array_key_exists( 'customize_logo_hover_title', $this->loginpress_key ) && ! empty( $this->loginpress_key['customize_logo_hover_title'] ) ) {
1978 return __( $this->loginpress_key["customize_logo_hover_title"], 'loginpress' );
1979 } else {
1980 return home_url();
1981 }
1982 }
1983
1984 /**
1985 * Set Errors Messages to Show off
1986 *
1987 * @param $error
1988 * @since 1.0.0
1989 * @version 1.2.5
1990 *
1991 * @return string
1992 */
1993 public function login_error_messages($error) {
1994
1995 global $errors;
1996
1997 if ( isset( $errors ) && apply_filters( 'loginpress_display_custom_errors', true ) ) {
1998
1999 $error_codes = $errors->get_error_codes();
2000
2001 if ( $this->loginpress_key ) {
2002
2003 $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>' );
2004
2005 $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>' );
2006
2007 $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>' );
2008
2009 $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>' );
2010
2011 $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>' );
2012
2013 $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>' );
2014
2015 $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>' );
2016
2017 $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>' );
2018
2019 $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>' );
2020
2021 $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>' );
2022
2023 if ( in_array( 'invalid_username', $error_codes ) ) return $invalid_username;
2024
2025 if ( in_array( 'incorrect_password', $error_codes ) ) return $invalid_password;
2026
2027 if ( in_array( 'empty_username', $error_codes ) ) return $empty_username;
2028
2029 if ( in_array( 'empty_password', $error_codes ) ) return $empty_password;
2030
2031 // registration Form entries.
2032 if ( in_array( 'invalid_email', $error_codes ) ) return $invalid_email;
2033
2034 if ( in_array( 'empty_email', $error_codes ) ) return "</br>" . $empty_email;
2035
2036 if ( in_array( 'username_exists', $error_codes ) ) return $username_exists;
2037
2038 if ( in_array( 'email_exists', $error_codes ) ) return $email_exists;
2039
2040 // forget password entry.
2041 if ( in_array( 'invalidcombo', $error_codes ) ) return $invalidcombo;
2042
2043 // Password mismatch custom error message.
2044 if ( in_array( 'password_mismatch', $error_codes ) ) return $password_mismatch;
2045
2046 }
2047 }
2048
2049 return $error;
2050 }
2051
2052 /**
2053 * Change Lost Password Text from Form
2054 *
2055 * @param $text
2056 * @since 1.0.0
2057 * @version 3.0.0
2058 *
2059 * @return mixed
2060 */
2061 public function change_lostpassword_message( $translated_text, $text, $domain ) {
2062
2063 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'] ) ) {
2064
2065 return trim( __( $this->loginpress_key['login_footer_text'], 'loginpress' ) );
2066 }
2067
2068 return $translated_text;
2069 }
2070
2071 /**
2072 * Change Label of the Username from login Form.
2073 *
2074 * @param string $translated_text Translated text.
2075 * @param string $text The text to translate.
2076 * @param string $domain The text domain.
2077 *
2078 * @since 1.1.3
2079 * @version 3.0.0
2080 * @return string
2081 */
2082 public function change_username_label( $translated_text, $text, $domain ){
2083
2084 $loginpress_setting = get_option( 'loginpress_setting' );
2085
2086 if ( $loginpress_setting ) {
2087
2088 $default = 'Username or Email Address';
2089 // $options = $this->loginpress_key;
2090 // $label = array_key_exists( 'form_username_label', $options ) ? $options['form_username_label'] : '';
2091 $login_order = isset( $loginpress_setting['login_order'] ) ? $loginpress_setting['login_order'] : '';
2092
2093 // If the option does not exist, return the text unchanged.
2094 if ( ! $loginpress_setting && $default === $text ) {
2095 return $translated_text;
2096 }
2097
2098 // If options exist, then translate away.
2099 if ( $loginpress_setting && $default === $text ) {
2100 // Check if the option exists.
2101 if ( '' != $login_order && 'default' != $login_order ) {
2102 if ( 'username' == $login_order ) {
2103 $label = __( 'Username', 'loginpress' );
2104 } elseif ( 'email' == $login_order ) {
2105 $label = __( 'Email Address', 'loginpress' );
2106 } else {
2107 $label = __( 'Username or Email Address', 'loginpress' );
2108 }
2109 $translated_text = esc_html( $label );
2110 }
2111 $translated_text = esc_html( apply_filters( 'loginpress_username_label', $translated_text ) );
2112 }
2113 }
2114 return $translated_text;
2115 }
2116 /**
2117 * Change Password Label from Form.
2118 * @param [type] $translated_text [description]
2119 * @param [type] $text [description]
2120 * @param [type] $domain [description]
2121 * @since 1.1.3
2122 *
2123 * @return string
2124 *
2125 */
2126 public function change_password_label( $translated_text, $text, $domain ) {
2127
2128 if ( $this->loginpress_key ) {
2129 $default = 'Password';
2130 $options = $this->loginpress_key;
2131 $label = array_key_exists( 'form_password_label', $options ) ? $options['form_password_label'] : '';
2132
2133 // If the option does not exist, return the text unchanged.
2134 if ( ! $options && $default === $text ) {
2135 return $translated_text;
2136 }
2137
2138 // If options exist, then translate away.
2139 if ( $options && $default === $text ) {
2140
2141 // Check if the option exists.
2142 if ( array_key_exists( 'form_password_label', $options ) ) {
2143 $translated_text = esc_html( $label );
2144 } else {
2145 return $translated_text;
2146 }
2147 }
2148 }
2149 return $translated_text;
2150 }
2151
2152 /**
2153 * Manage Welcome Messages
2154 *
2155 * @param $message
2156 * @since 1.0.0
2157 * @version 1.5.3
2158 *
2159 * @return string
2160 */
2161 public function change_welcome_message( $message ) {
2162
2163 if ( $this->loginpress_key ) {
2164
2165 //Check, User Logged out.
2166 if ( isset( $_GET['loggedout'] ) && TRUE == $_GET['loggedout'] ) {
2167
2168 if ( array_key_exists( 'logout_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['logout_message'] ) ) {
2169
2170 $loginpress_message = __( $this->loginpress_key['logout_message'], 'loginpress' );
2171 }
2172 }
2173
2174 //Logged In messages.
2175 else if ( isset( $_GET['action'] ) && 'lostpassword' == $_GET['action'] ) {
2176
2177 if ( array_key_exists( 'lostpwd_welcome_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['lostpwd_welcome_message'] ) ) {
2178
2179 $loginpress_message = __( $this->loginpress_key['lostpwd_welcome_message'], 'loginpress' );
2180 }
2181 }
2182
2183 else if( isset( $_GET['action'] ) && 'register' == $_GET['action'] ) {
2184
2185 if ( array_key_exists( 'register_welcome_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['register_welcome_message'] ) ) {
2186
2187 $loginpress_message = __( $this->loginpress_key['register_welcome_message'], 'loginpress' );
2188 }
2189 }
2190
2191 // @since 1.0.18
2192 // else if ( strpos( $message, __( "Enter your new password below." ) ) == true ) {
2193 //
2194 // if ( array_key_exists( 'reset_hint_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['reset_hint_message'] ) ) {
2195 //
2196 // $loginpress_message = $this->loginpress_key['reset_hint_message'];
2197 // }
2198 // }
2199
2200 // @since 1.0.18
2201 else if ( strpos( $message, __( "Your password has been reset." ) ) == true ) {
2202
2203 // if ( array_key_exists( 'after_reset_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['after_reset_message'] ) ) {
2204
2205 $loginpress_message = __( 'Your password has been reset.' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in' ) . '</a></p>';
2206 // }
2207 }
2208
2209 else {
2210 if ( array_key_exists( 'welcome_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['welcome_message'] ) ) {
2211
2212 $loginpress_message = __( $this->loginpress_key['welcome_message'], 'loginpress' );
2213 }
2214 }
2215
2216 return ! empty( $loginpress_message ) ? "<p class='custom-message'>" . $loginpress_message. "</p>" : $message;
2217 }
2218 }
2219
2220 /**
2221 * Set WordPress login page title.
2222 *
2223 * @since 1.4.6
2224 * @version 1.5.3
2225
2226 * @return string
2227 */
2228 public function login_page_title( $title ) {
2229
2230 if ( $this->loginpress_key && array_key_exists( 'customize_login_page_title', $this->loginpress_key ) && ! empty( $this->loginpress_key['customize_login_page_title'] ) ) {
2231 return __( $this->loginpress_key["customize_login_page_title"], 'loginpress' );
2232 } else {
2233 return $title;
2234 }
2235 }
2236
2237 /**
2238 * Hook to Redirect Page for Customize
2239 *
2240 * @since 1.1.3
2241 */
2242 public function redirect_to_custom_page() {
2243 if ( ! empty($_GET['page'] ) ) {
2244
2245 if( ( $_GET['page'] == "abw" ) || ( $_GET['page'] == "loginpress" ) ) {
2246
2247 if ( is_multisite() ) { // if subdirectories are used in multisite.
2248
2249 $loginpress_obj = new LoginPress();
2250 $loginpress_page = $loginpress_obj->get_loginpress_page();
2251
2252 $page = get_permalink( $loginpress_page );
2253
2254 // Generate the redirect url.
2255 $url = add_query_arg(
2256 array(
2257 'autofocus[panel]' => 'loginpress_panel',
2258 'url' => rawurlencode( $page ),
2259 ),
2260 admin_url( 'customize.php' )
2261 );
2262
2263 wp_safe_redirect( $url );
2264
2265 } else {
2266
2267 wp_redirect( get_admin_url() . "customize.php?url=" . wp_login_url() . '&autofocus=loginpress_panel' );
2268 }
2269 }
2270 }
2271 }
2272
2273 /**
2274 * Redirect to the Admin Panel After Closing LoginPress Customizer
2275 *
2276 * @since 1.0.0
2277 * @return null
2278 */
2279 public function menu_url() {
2280
2281 global $submenu;
2282
2283 $parent = 'index.php';
2284 $page = 'abw';
2285
2286 // Create specific url for login view
2287 $login_url = wp_login_url();
2288 $url = add_query_arg(
2289 array(
2290 'url' => urlencode( $login_url ),
2291 'return' => admin_url( 'themes.php' ),
2292 ),
2293 admin_url( 'customize.php' )
2294 );
2295
2296 // If is Not Design Menu, return
2297 if ( ! isset( $submenu[ $parent ] ) ) {
2298 return NULL;
2299 }
2300
2301 foreach ( $submenu[ $parent ] as $key => $value ) {
2302 // Set new URL for menu item
2303 if ( $page === $value[ 2 ] ) {
2304 $submenu[ $parent ][ $key ][ 2 ] = $url;
2305 break;
2306 }
2307 }
2308 }
2309
2310 /**
2311 * This function is removed the error messages in the customizer.
2312 * @param array $errors [description]
2313 * @param string $redirect_to [description]
2314 * @since 1.2.0
2315 */
2316 function remove_error_messages_in_wp_customizer( $errors, $redirect_to ) {
2317
2318 if ( is_customize_preview() && version_compare( $GLOBALS['wp_version'], '5.2', '>=' ) ) {
2319 return new WP_Error( '', '' );
2320 }
2321 return $errors;
2322 }
2323 }
2324