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

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