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

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

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