| 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 |
* Variable that Check for LoginPress Settings. |
| 16 |
* |
| 17 |
* @var array |
| 18 |
* @since 6.0.0 |
| 19 |
*/ |
| 20 |
public $loginpress_settings; |
| 21 |
|
| 22 |
/** |
| 23 |
* LoginPress template name. |
| 24 |
* |
| 25 |
* @since 1.6.4 |
| 26 |
* @var string LoginPress template name. |
| 27 |
*/ |
| 28 |
public $loginpress_preset; |
| 29 |
|
| 30 |
/** |
| 31 |
* Class constructor |
| 32 |
*/ |
| 33 |
public function __construct() { |
| 34 |
|
| 35 |
$this->loginpress_key = get_option( 'loginpress_customization' ); |
| 36 |
$this->loginpress_settings = get_option( 'loginpress_setting' ); |
| 37 |
$this->loginpress_preset = get_option( 'customize_presets_settings', true ); |
| 38 |
$this->_hooks(); |
| 39 |
} |
| 40 |
|
| 41 |
|
| 42 |
/** |
| 43 |
* Hook into actions and filters |
| 44 |
* |
| 45 |
* @since 1.0.0 |
| 46 |
* @version 6.0.0 |
| 47 |
*/ |
| 48 |
private function _hooks() { |
| 49 |
|
| 50 |
add_filter( 'login_title', array( $this, 'login_page_title' ), 99 ); |
| 51 |
add_filter( 'login_headerurl', array( $this, 'login_page_logo_url' ) ); |
| 52 |
if ( version_compare( $GLOBALS['wp_version'], '5.2', '<' ) ) { |
| 53 |
add_filter( 'login_headertitle', array( $this, 'login_page_logo_title' ) ); |
| 54 |
} else { |
| 55 |
add_filter( 'login_headertext', array( $this, 'login_page_logo_title' ) ); |
| 56 |
} |
| 57 |
|
| 58 |
add_filter( 'login_errors', array( $this, 'login_error_messages' ) ); |
| 59 |
add_filter( 'login_message', array( $this, 'change_welcome_message' ), 1, 1 ); |
| 60 |
add_action( 'customize_register', array( $this, 'customize_login_panel' ) ); |
| 61 |
add_action( 'login_footer', array( $this, 'login_page_custom_footer' ) ); |
| 62 |
add_filter( 'site_icon_meta_tags', array( $this, 'login_page_custom_favicon' ), 1, 1 ); |
| 63 |
add_action( 'login_head', array( $this, 'login_page_custom_head' ) ); |
| 64 |
add_action( 'woocommerce_login_form', array( $this, 'loginpress_wc_login_page_url_redirection' ) ); |
| 65 |
add_action( 'init', array( $this, 'redirect_to_custom_page' ) ); |
| 66 |
add_action( 'admin_menu', array( $this, 'menu_url' ), 10 ); |
| 67 |
add_filter( 'wp_login_errors', array( $this, 'remove_error_messages_in_wp_customizer' ), 10, 2 ); |
| 68 |
add_action( 'login_enqueue_scripts', array( $this, 'loginpress_login_page_scripts' ) ); |
| 69 |
|
| 70 |
if ( version_compare( $GLOBALS['wp_version'], '5.9', '>=' ) ) { |
| 71 |
add_filter( 'login_display_language_dropdown', array( $this, 'loginpress_language_switch' ) ); |
| 72 |
} |
| 73 |
|
| 74 |
/** |
| 75 |
* This function enqueues scripts and styles in the Customizer. |
| 76 |
*/ |
| 77 |
add_action( 'customize_controls_enqueue_scripts', array( $this, 'loginpress_customizer_js' ) ); |
| 78 |
|
| 79 |
/** |
| 80 |
* This function is triggered on the initialization of the Previewer in the Customizer. |
| 81 |
* We add actions that pertain to the Previewer window here. |
| 82 |
* The actions added here are triggered only in the Previewer and not in the Customizer. |
| 83 |
* |
| 84 |
* @since 1.0.23 |
| 85 |
* @version 6.0.0 |
| 86 |
*/ |
| 87 |
add_action( 'customize_preview_init', array( $this, 'loginpress_customizer_previewer_js' ) ); |
| 88 |
add_filter( 'woocommerce_process_login_errors', array( $this, 'loginpress_woo_login_errors' ), 10, 3 ); |
| 89 |
|
| 90 |
if ( isset( $this->loginpress_settings['enable_special_chars'] ) && 'on' === $this->loginpress_settings['enable_special_chars'] |
| 91 |
&& isset( $this->loginpress_settings['allowed_username_characters'] ) && ! empty( $this->loginpress_settings['allowed_username_characters'] ) ) { |
| 92 |
|
| 93 |
add_filter( 'sanitize_user', array( $this, 'loginpress_sanitize_username' ), 10, 3 ); |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
/** |
| 98 |
* Login Page Custom Favicon ( Overwrites the default meta tags if favicon is set from LoginPress ). |
| 99 |
* |
| 100 |
* @param array $meta_tags default meta tags for login page. |
| 101 |
* @return array $meta_tags modified meta tags for login page. |
| 102 |
* |
| 103 |
* @since 3.0.0 |
| 104 |
*/ |
| 105 |
function login_page_custom_favicon( $meta_tags ) { |
| 106 |
$login_favicon = isset( $this->loginpress_key['login_favicon'] ) ? $this->loginpress_key['login_favicon'] : 'off'; |
| 107 |
|
| 108 |
if ( has_site_icon() && ! empty( $login_favicon ) ) { |
| 109 |
|
| 110 |
/** |
| 111 |
* If Login favicon is set then only show the favicon of login page else site icon will be shown. |
| 112 |
*/ |
| 113 |
if ( 'off' != $login_favicon && function_exists( 'login_header' ) ) { |
| 114 |
unset( $meta_tags ); |
| 115 |
$meta_tags[] = '<link rel="shortcut icon" href="' . $login_favicon . '" type="image/x-icon" />'; |
| 116 |
} |
| 117 |
} |
| 118 |
return $meta_tags; |
| 119 |
} |
| 120 |
|
| 121 |
/** |
| 122 |
* Login Page YouTube Video Background scripts. |
| 123 |
* |
| 124 |
* @since 3.0.0 |
| 125 |
*/ |
| 126 |
function loginpress_login_page_scripts() { |
| 127 |
|
| 128 |
$loginpress_customization = get_option( 'loginpress_customization' ); |
| 129 |
$loginpress_yt_id = isset( $loginpress_customization['yt_video_id'] ) && ! empty( $loginpress_customization['yt_video_id'] ) ? $loginpress_customization['yt_video_id'] : false; |
| 130 |
|
| 131 |
if ( $loginpress_yt_id ) { |
| 132 |
wp_enqueue_script( 'loginpress-yt-iframe', 'https://www.youtube.com/iframe_api' ); |
| 133 |
} |
| 134 |
} |
| 135 |
|
| 136 |
/** |
| 137 |
* Enqueue jQuery and use wp_localize_script. |
| 138 |
* |
| 139 |
* @since 1.0.9 |
| 140 |
* @version 6.0.0 |
| 141 |
*/ |
| 142 |
function loginpress_customizer_js() { |
| 143 |
|
| 144 |
wp_enqueue_script( 'jquery' ); |
| 145 |
wp_enqueue_script( 'loginpress-customize-control', plugins_url( 'js/customize-controls.js', LOGINPRESS_ROOT_FILE ), array( 'jquery' ), LOGINPRESS_VERSION, true ); |
| 146 |
wp_enqueue_script( 'loginpress-color-picker-iris-script', plugins_url( 'js/controls/loginpress-color-picker-alpha-iris.js', LOGINPRESS_ROOT_FILE ), array( 'wp-color-picker' ), LOGINPRESS_VERSION, true ); |
| 147 |
/* |
| 148 |
* Our Customizer script |
| 149 |
* |
| 150 |
* Dependencies: Customizer Controls script (core) |
| 151 |
*/ |
| 152 |
wp_enqueue_script( 'loginpress-control-script', plugins_url( 'js/customizer.js', LOGINPRESS_ROOT_FILE ), array( 'customize-controls' ), LOGINPRESS_VERSION, true ); |
| 153 |
|
| 154 |
// Get Background URL for use in Customizer JS. |
| 155 |
$user = wp_get_current_user(); |
| 156 |
$name = empty( $user->user_firstname ) ? ucfirst( $user->display_name ) : ucfirst( $user->user_firstname ); |
| 157 |
$loginpress_bg = get_option( 'loginpress_customization' ); |
| 158 |
$cap_type = isset( $this->loginpress_settings['recaptcha_type'] ) ? $this->loginpress_settings['recaptcha_type'] : 'v2-robot'; // 1.2.1 |
| 159 |
$loginpress_bg_url = $loginpress_bg['setting_background'] ? $loginpress_bg['setting_background'] : false; |
| 160 |
|
| 161 |
/** |
| 162 |
* Included in version 1.2.0. |
| 163 |
*/ |
| 164 |
if ( isset( $_GET['autofocus'] ) && $_GET['autofocus'] === 'loginpress_panel' ) { |
| 165 |
$loginpress_auto_focus = true; |
| 166 |
} else { |
| 167 |
$loginpress_auto_focus = false; |
| 168 |
} |
| 169 |
|
| 170 |
// Array for localize. |
| 171 |
$loginpress_localize = array( |
| 172 |
'admin_url' => admin_url(), |
| 173 |
'ajaxurl' => admin_url( 'admin-ajax.php' ), |
| 174 |
'plugin_url' => plugins_url(), |
| 175 |
'login_theme' => $this->loginpress_preset, |
| 176 |
'loginpress_bg_url' => $loginpress_bg_url, |
| 177 |
'preset_nonce' => wp_create_nonce( 'loginpress-preset-nonce' ), |
| 178 |
'attachment_nonce' => wp_create_nonce( 'loginpress-attachment-nonce' ), |
| 179 |
'preset_loader' => includes_url( 'js/tinymce/skins/lightgray/img/loader.gif' ), |
| 180 |
'autoFocusPanel' => $loginpress_auto_focus, |
| 181 |
'recaptchaType' => $cap_type, |
| 182 |
'filter_bg' => apply_filters( 'loginpress_default_bg', '' ), |
| 183 |
'translated_strings' => array( |
| 184 |
'wrong_yt_id' => _x( 'Wrong YouTube Video ID', 'Wrong YouTube Video ID (Customizer)', 'loginpress' ), |
| 185 |
), |
| 186 |
); |
| 187 |
|
| 188 |
$loginpress_customizer_localize = array( |
| 189 |
|
| 190 |
'translations' => array( |
| 191 |
'title' => _x( 'Add Images to Gallery', 'Add Images to Gallery (Customizer)', 'loginpress' ), |
| 192 |
'btn_text' => _x( 'Add to Gallery', 'Add to Gallery Button Text (Customizer)', 'loginpress' ), |
| 193 |
), |
| 194 |
); |
| 195 |
|
| 196 |
wp_localize_script( 'loginpress-customize-control', 'loginpress_script', $loginpress_localize ); |
| 197 |
wp_localize_script( 'loginpress-control-script', 'loginpress_customizer', $loginpress_customizer_localize ); |
| 198 |
} |
| 199 |
|
| 200 |
/** |
| 201 |
* This function is called only on the Previewer and enqueues scripts and styles. |
| 202 |
* Our Customizer script |
| 203 |
* |
| 204 |
* Dependencies: Customizer Preview script (core) |
| 205 |
* |
| 206 |
* @since 1.0.23 |
| 207 |
*/ |
| 208 |
function loginpress_customizer_previewer_js() { |
| 209 |
|
| 210 |
wp_enqueue_style( 'loginpress-customizer-previewer-style', plugins_url( 'css/style-previewer.css', LOGINPRESS_ROOT_FILE ), array(), LOGINPRESS_VERSION ); |
| 211 |
wp_enqueue_script( 'loginpress-customizer-previewer-script', plugins_url( 'js/customizer-previewer.js', LOGINPRESS_ROOT_FILE ), array( 'customize-preview' ), LOGINPRESS_VERSION, true ); |
| 212 |
} |
| 213 |
|
| 214 |
/** |
| 215 |
* Creates a method for setting and controlling LoginPress_Range_Control. |
| 216 |
* |
| 217 |
* @param object $wp_customize The WordPress Customize object. |
| 218 |
* @param string $control The control name. |
| 219 |
* @param string $default The default value. |
| 220 |
* @param string $label The label for the control. |
| 221 |
* @param array $input_attr Additional input attributes. |
| 222 |
* @param array $unit The unit for the control value. |
| 223 |
* @param int $index The index of the control. |
| 224 |
* @param int $priority To set the Priority of the section. |
| 225 |
* |
| 226 |
* @return object The modified WordPress Customize object. |
| 227 |
* |
| 228 |
* @since 1.1.3 |
| 229 |
*/ |
| 230 |
function loginpress_range_setting( $wp_customize, $control, $default, $label, $input_attr, $unit, $section, $index, $priority = '' ) { |
| 231 |
|
| 232 |
$wp_customize->add_setting( |
| 233 |
"loginpress_customization[{$control[$index]}]", |
| 234 |
array( |
| 235 |
'default' => $default[ $index ], |
| 236 |
'type' => 'option', |
| 237 |
'capability' => 'manage_options', |
| 238 |
'transport' => 'postMessage', |
| 239 |
'sanitize_callback' => 'absint', |
| 240 |
) |
| 241 |
); |
| 242 |
|
| 243 |
$wp_customize->add_control( |
| 244 |
new LoginPress_Range_Control( |
| 245 |
$wp_customize, |
| 246 |
"loginpress_customization[{$control[$index]}]", |
| 247 |
array( |
| 248 |
'type' => 'loginpress-range', |
| 249 |
'label' => $label[ $index ], |
| 250 |
'section' => $section, |
| 251 |
'priority' => $priority, |
| 252 |
'settings' => "loginpress_customization[{$control[$index]}]", |
| 253 |
'default' => $default[ $index ], |
| 254 |
'input_attrs' => $input_attr[ $index ], |
| 255 |
'unit' => $unit[ $index ], |
| 256 |
) |
| 257 |
) |
| 258 |
); |
| 259 |
} |
| 260 |
|
| 261 |
|
| 262 |
/** Creates a method for setting and controlling LoginPress_Group_Control. |
| 263 |
* |
| 264 |
* @param object $wp_customize The WordPress Customize object. |
| 265 |
* @param string $control The control name. |
| 266 |
* @param string $label The label for the control. |
| 267 |
* @param string $section The section name. |
| 268 |
* @param string $info_text The information text. |
| 269 |
* @param int $index The index of the control. |
| 270 |
* @param int $priority To set the Priority of the section. |
| 271 |
* |
| 272 |
* @return object The modified WordPress Customize object. |
| 273 |
* |
| 274 |
* @since 1.1.3 |
| 275 |
*/ |
| 276 |
function loginpress_group_setting( $wp_customize, $control, $label, $info_test, $section, $index, $priority = '' ) { |
| 277 |
|
| 278 |
$wp_customize->add_setting( |
| 279 |
"loginpress_customization[{$control[$index]}]", |
| 280 |
array( |
| 281 |
'type' => 'option', |
| 282 |
'capability' => 'manage_options', |
| 283 |
'transport' => 'postMessage', |
| 284 |
) |
| 285 |
); |
| 286 |
|
| 287 |
$wp_customize->add_control( |
| 288 |
new LoginPress_Group_Control( |
| 289 |
$wp_customize, |
| 290 |
"loginpress_customization[{$control[$index]}]", |
| 291 |
array( |
| 292 |
'settings' => "loginpress_customization[{$control[$index]}]", |
| 293 |
'label' => $label[ $index ], |
| 294 |
'section' => $section, |
| 295 |
'type' => 'group', |
| 296 |
'info_text' => $info_test[ $index ], |
| 297 |
'priority' => $priority, |
| 298 |
) |
| 299 |
) |
| 300 |
); |
| 301 |
} |
| 302 |
|
| 303 |
/** Creates a method for setting and controlling WP_Customize_Color_Control. |
| 304 |
* |
| 305 |
* @param object $wp_customize The WordPress Customize object. |
| 306 |
* @param string $control The control name. |
| 307 |
* @param string $label The label for the control. |
| 308 |
* @param string $section The section name. |
| 309 |
* @param int $index The index of the control. |
| 310 |
* @param int $priority To set the Priority of the section. |
| 311 |
* |
| 312 |
* @return object The modified WordPress Customize object. |
| 313 |
* @since 1.1.3 |
| 314 |
*/ |
| 315 |
function loginpress_color_setting( $wp_customize, $control, $label, $section, $index, $priority = '' ) { |
| 316 |
|
| 317 |
$wp_customize->add_setting( |
| 318 |
"loginpress_customization[{$control[$index]}]", |
| 319 |
array( |
| 320 |
// 'default' => $form_color_default[$form_color], |
| 321 |
'type' => 'option', |
| 322 |
'capability' => 'manage_options', |
| 323 |
'transport' => 'postMessage', |
| 324 |
'sanitize_callback' => 'sanitize_text_field', // validates 3 or 6 digit HTML hex color code. |
| 325 |
) |
| 326 |
); |
| 327 |
|
| 328 |
$wp_customize->add_control( |
| 329 |
new LoginPress_Color_Picker_Alpha( |
| 330 |
$wp_customize, |
| 331 |
"loginpress_customization[{$control[$index]}]", |
| 332 |
array( |
| 333 |
'label' => $label[ $index ], |
| 334 |
'section' => $section, |
| 335 |
'settings' => "loginpress_customization[{$control[$index]}]", |
| 336 |
'priority' => $priority, |
| 337 |
'input_attrs' => array( |
| 338 |
'name' => $label[ $index ], |
| 339 |
'data-alpha-enabled' => 'true', |
| 340 |
), |
| 341 |
) |
| 342 |
) |
| 343 |
); |
| 344 |
} |
| 345 |
|
| 346 |
/** |
| 347 |
* Creates a thematic break. |
| 348 |
* |
| 349 |
* @param object $wp_customize The WordPress Customize object. |
| 350 |
* @param string $control The control name. |
| 351 |
* @param string $section The section name. |
| 352 |
* @param int $index The index of the control. |
| 353 |
* @param int $priority To set the Priority of the section. |
| 354 |
* |
| 355 |
* @since 1.1.3 |
| 356 |
* @version 3.0.0 |
| 357 |
*/ |
| 358 |
function loginpress_hr_setting( $wp_customize, $control, $section, $index, $priority = '' ) { |
| 359 |
if ( isset( $control[ $index ] ) ) { |
| 360 |
$wp_customize->add_setting( |
| 361 |
"loginpress_customization[{$control[$index]}]", |
| 362 |
array( |
| 363 |
'sanitize_callback' => 'sanitize_text_field', |
| 364 |
) |
| 365 |
); |
| 366 |
|
| 367 |
$wp_customize->add_control( |
| 368 |
new LoginPress_Misc_Control( |
| 369 |
$wp_customize, |
| 370 |
"loginpress_customization[{$control[$index]}]", |
| 371 |
array( |
| 372 |
'section' => $section, |
| 373 |
'type' => 'hr', |
| 374 |
'priority' => $priority, |
| 375 |
) |
| 376 |
) |
| 377 |
); |
| 378 |
} |
| 379 |
} |
| 380 |
|
| 381 |
/** |
| 382 |
* Register plugin settings Panel in WP Customizer. |
| 383 |
* |
| 384 |
* @param $wp_customize The WordPress Customize object. |
| 385 |
* |
| 386 |
* @since 1.0.0 |
| 387 |
* @version 6.0.0 |
| 388 |
*/ |
| 389 |
public function customize_login_panel( $wp_customize ) { |
| 390 |
|
| 391 |
include LOGINPRESS_ROOT_PATH . 'classes/control-presets.php'; |
| 392 |
|
| 393 |
include LOGINPRESS_ROOT_PATH . 'classes/controls/background-gallery.php'; |
| 394 |
|
| 395 |
include LOGINPRESS_ROOT_PATH . 'classes/controls/range.php'; |
| 396 |
|
| 397 |
include LOGINPRESS_ROOT_PATH . 'classes/controls/group.php'; |
| 398 |
|
| 399 |
include LOGINPRESS_ROOT_PATH . 'classes/controls/radio-button.php'; |
| 400 |
|
| 401 |
include LOGINPRESS_ROOT_PATH . 'classes/controls/miscellaneous.php'; |
| 402 |
|
| 403 |
include LOGINPRESS_ROOT_PATH . 'classes/controls/color-picker-alpha.php'; |
| 404 |
|
| 405 |
include LOGINPRESS_ROOT_PATH . 'include/customizer-strings.php'; |
| 406 |
|
| 407 |
include LOGINPRESS_ROOT_PATH . 'include/customizer-validation.php'; |
| 408 |
|
| 409 |
include LOGINPRESS_ROOT_PATH . 'classes/controls/spacing-contols.php'; // Adjust path as necessary |
| 410 |
|
| 411 |
if ( ! has_action( 'loginpress_pro_add_template' ) ) : |
| 412 |
include LOGINPRESS_ROOT_PATH . 'classes/class-loginpress-promo.php'; |
| 413 |
endif; |
| 414 |
|
| 415 |
// ============================= |
| 416 |
// = Panel for the LoginPress = |
| 417 |
// ============================= |
| 418 |
$wp_customize->add_panel( |
| 419 |
'loginpress_panel', |
| 420 |
array( |
| 421 |
'title' => __( 'LoginPress', 'loginpress' ), |
| 422 |
'description' => __( 'Customize Your WordPress Login Page with LoginPress :)', 'loginpress' ), |
| 423 |
'priority' => 30, |
| 424 |
) |
| 425 |
); |
| 426 |
|
| 427 |
/** |
| 428 |
* Section for Presets. |
| 429 |
* |
| 430 |
* @since 1.0.9 |
| 431 |
* @version 3.0.3 |
| 432 |
*/ |
| 433 |
$wp_customize->add_section( |
| 434 |
'customize_presets', |
| 435 |
array( |
| 436 |
'title' => __( 'Themes', 'loginpress' ), |
| 437 |
'description' => __( 'Choose Theme', 'loginpress' ), |
| 438 |
'priority' => 1, |
| 439 |
'panel' => 'loginpress_panel', |
| 440 |
) |
| 441 |
); |
| 442 |
|
| 443 |
$loginpress_default_theme = $this->loginpress_preset === true && ( empty( $this->loginpress_key ) && empty( $this->loginpress_setting ) ) ? 'minimalist' : 'default1'; |
| 444 |
|
| 445 |
$wp_customize->add_setting( |
| 446 |
'customize_presets_settings', |
| 447 |
array( |
| 448 |
'default' => $loginpress_default_theme, |
| 449 |
'type' => 'option', |
| 450 |
// 'transport' => 'postMessage', |
| 451 |
'capability' => 'manage_options', |
| 452 |
) |
| 453 |
); |
| 454 |
|
| 455 |
$loginpress_free_templates = array(); |
| 456 |
$loginpress_theme_name = array( |
| 457 |
'', |
| 458 |
'', |
| 459 |
__( 'Company', 'loginpress' ), |
| 460 |
__( 'Persona', 'loginpress' ), |
| 461 |
__( 'Corporate', 'loginpress' ), |
| 462 |
__( 'Corporate', 'loginpress' ), |
| 463 |
__( 'Startup', 'loginpress' ), |
| 464 |
__( 'Wedding', 'loginpress' ), |
| 465 |
__( 'Wedding #2', 'loginpress' ), |
| 466 |
__( 'Company', 'loginpress' ), |
| 467 |
__( 'Bikers', 'loginpress' ), |
| 468 |
__( 'Fitness', 'loginpress' ), |
| 469 |
__( 'Shopping', 'loginpress' ), |
| 470 |
__( 'Writers', 'loginpress' ), |
| 471 |
__( 'Persona', 'loginpress' ), |
| 472 |
__( 'Geek', 'loginpress' ), |
| 473 |
__( 'Innovation', 'loginpress' ), |
| 474 |
__( 'Photographers', 'loginpress' ), |
| 475 |
__( 'Animated Wapo', 'loginpress' ), |
| 476 |
__( 'Animated Wapo 2', 'loginpress' ), |
| 477 |
); |
| 478 |
|
| 479 |
// 1st template that is default |
| 480 |
$loginpress_free_templates['default1'] = array( |
| 481 |
'img' => esc_url( apply_filters( 'loginpress_default_bg', plugins_url( 'img/minimalist.jpg', LOGINPRESS_PLUGIN_BASENAME ) ) ), |
| 482 |
'thumbnail' => esc_url( apply_filters( 'loginpress_default_bg', plugins_url( 'img/thumbnail/default-1.png', LOGINPRESS_ROOT_FILE ) ) ), |
| 483 |
'id' => 'default1', |
| 484 |
'name' => 'Default', |
| 485 |
); |
| 486 |
|
| 487 |
// 1st template that is default |
| 488 |
$loginpress_free_templates['minimalist'] = array( |
| 489 |
'img' => esc_url( apply_filters( 'loginpress_default_bg', plugins_url( 'img/bg-default.jpg', LOGINPRESS_PLUGIN_BASENAME ) ) ), |
| 490 |
'thumbnail' => esc_url( apply_filters( 'loginpress_default_bg', plugins_url( 'img/thumbnail/free-minimalist.png', LOGINPRESS_ROOT_FILE ) ) ), |
| 491 |
'id' => 'minimalist', |
| 492 |
'name' => 'Minimalist', |
| 493 |
); |
| 494 |
|
| 495 |
// Loop through the templates. |
| 496 |
$_count = 2; |
| 497 |
while ( $_count <= 18 ) : |
| 498 |
|
| 499 |
$loginpress_free_templates[ "default{$_count}" ] = array( |
| 500 |
// 'img' => plugins_url( 'img/bg.jpg', LOGINPRESS_ROOT_FILE ), |
| 501 |
'thumbnail' => plugins_url( "img/thumbnail/default-{$_count}.png", LOGINPRESS_ROOT_FILE ), |
| 502 |
'id' => "default{$_count}", |
| 503 |
'name' => $loginpress_theme_name[ $_count ], |
| 504 |
'pro' => 'yes', |
| 505 |
); |
| 506 |
++$_count; |
| 507 |
endwhile; |
| 508 |
|
| 509 |
// 18th template for custom design. |
| 510 |
$loginpress_free_templates['default19'] = array( |
| 511 |
'img' => plugins_url( 'loginpress/img/bg17.jpg', LOGINPRESS_ROOT_PATH ), |
| 512 |
'thumbnail' => plugins_url( 'loginpress/img/thumbnail/custom-design.png', LOGINPRESS_ROOT_PATH ), |
| 513 |
'id' => 'default19', |
| 514 |
'name' => __( 'Custom Design', 'loginpress' ), |
| 515 |
'link' => 'yes', |
| 516 |
); |
| 517 |
$loginpress_templates = apply_filters( 'loginpress_pro_add_template', $loginpress_free_templates ); |
| 518 |
|
| 519 |
$wp_customize->add_control( |
| 520 |
new LoginPress_Presets( |
| 521 |
$wp_customize, |
| 522 |
'customize_presets_settings', |
| 523 |
array( |
| 524 |
'section' => 'customize_presets', |
| 525 |
// 'label' => __( 'Themes', 'loginpress' ), |
| 526 |
'choices' => $loginpress_templates, |
| 527 |
) |
| 528 |
) |
| 529 |
); |
| 530 |
|
| 531 |
// End of Presets. |
| 532 |
|
| 533 |
// ============================= |
| 534 |
// = Section for Login Logo = |
| 535 |
// ============================= |
| 536 |
$this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'customize_logo_section', 8, 4 ); |
| 537 |
$wp_customize->add_section( |
| 538 |
'customize_logo_section', |
| 539 |
array( |
| 540 |
'title' => __( 'Logo', 'loginpress' ), |
| 541 |
'description' => __( 'Customize Your Logo Section', 'loginpress' ), |
| 542 |
'priority' => 5, |
| 543 |
'panel' => 'loginpress_panel', |
| 544 |
) |
| 545 |
); |
| 546 |
|
| 547 |
/** |
| 548 |
* [ Enable / Disable Logo Image with LoginPress_Radio_Control ] |
| 549 |
* |
| 550 |
* @since 1.1.3 |
| 551 |
*/ |
| 552 |
|
| 553 |
$wp_customize->add_setting( |
| 554 |
'loginpress_customization[setting_logo_display]', |
| 555 |
array( |
| 556 |
'default' => false, |
| 557 |
'type' => 'option', |
| 558 |
'capability' => 'manage_options', |
| 559 |
'transport' => 'postMessage', |
| 560 |
'sanitize_callback' => 'loginpress_sanitize_checkbox', |
| 561 |
) |
| 562 |
); |
| 563 |
|
| 564 |
$wp_customize->add_control( |
| 565 |
new LoginPress_Radio_Control( |
| 566 |
$wp_customize, |
| 567 |
'loginpress_customization[setting_logo_display]', |
| 568 |
array( |
| 569 |
'settings' => 'loginpress_customization[setting_logo_display]', |
| 570 |
'label' => __( 'Disable Logo:', 'loginpress' ), |
| 571 |
'section' => 'customize_logo_section', |
| 572 |
'priority' => 4, |
| 573 |
'type' => 'ios', // light, ios, flat |
| 574 |
) |
| 575 |
) |
| 576 |
); |
| 577 |
|
| 578 |
$wp_customize->add_setting( |
| 579 |
'loginpress_customization[setting_logo]', |
| 580 |
array( |
| 581 |
'type' => 'option', |
| 582 |
'capability' => 'manage_options', |
| 583 |
'transport' => 'postMessage', |
| 584 |
'sanitize_callback' => 'loginpress_sanitize_image', |
| 585 |
) |
| 586 |
); |
| 587 |
|
| 588 |
$wp_customize->add_control( |
| 589 |
new WP_Customize_Image_Control( |
| 590 |
$wp_customize, |
| 591 |
'loginpress_customization[setting_logo]', |
| 592 |
array( |
| 593 |
'label' => __( 'Logo Image:', 'loginpress' ), |
| 594 |
'section' => 'customize_logo_section', |
| 595 |
'priority' => 5, |
| 596 |
'settings' => 'loginpress_customization[setting_logo]', |
| 597 |
) |
| 598 |
) |
| 599 |
); |
| 600 |
|
| 601 |
$wp_customize->add_setting( |
| 602 |
'loginpress_customization[login_favicon]', |
| 603 |
array( |
| 604 |
'type' => 'option', |
| 605 |
'capability' => 'manage_options', |
| 606 |
'transport' => 'postMessage', |
| 607 |
'sanitize_callback' => 'loginpress_sanitize_image', |
| 608 |
) |
| 609 |
); |
| 610 |
|
| 611 |
$wp_customize->add_control( |
| 612 |
new WP_Customize_Image_Control( |
| 613 |
$wp_customize, |
| 614 |
'loginpress_customization[login_favicon]', |
| 615 |
array( |
| 616 |
'label' => __( 'Login Favicon:', 'loginpress' ), |
| 617 |
'section' => 'customize_logo_section', |
| 618 |
'description' => __( 'Add a custom favicon specific for your login page', 'loginpress' ), |
| 619 |
'priority' => 30, |
| 620 |
'settings' => 'loginpress_customization[login_favicon]', |
| 621 |
) |
| 622 |
) |
| 623 |
); |
| 624 |
|
| 625 |
/** |
| 626 |
* [ Change CSS Properties Input fields with LoginPress_Range_Control ] |
| 627 |
* |
| 628 |
* @since 1.0.1 |
| 629 |
* @version 3.0.0 |
| 630 |
*/ |
| 631 |
|
| 632 |
$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 ); |
| 633 |
$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 ); |
| 634 |
$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 ); |
| 635 |
|
| 636 |
/** |
| 637 |
* Login Page meta and form logo options. |
| 638 |
* |
| 639 |
* @version 3.0.0 |
| 640 |
*/ |
| 641 |
if ( version_compare( $GLOBALS['wp_version'], '5.2', '<' ) ) { |
| 642 |
$loginpress_logo_title = __( 'Logo Hover Title:', 'loginpress' ); |
| 643 |
} else { |
| 644 |
$loginpress_logo_title = __( 'Logo Title:', 'loginpress' ); |
| 645 |
} |
| 646 |
$logo_control = array( 'customize_logo_hover', 'customize_logo_hover_title', 'customize_login_page_title' ); |
| 647 |
$logo_default = array( '', '', '' ); |
| 648 |
$logo_label = array( __( 'Logo URL:', 'loginpress' ), $loginpress_logo_title, __( 'Login Page Title:', 'loginpress' ) ); |
| 649 |
$logo_sanitization = array( 'esc_url_raw', 'wp_strip_all_tags', 'wp_strip_all_tags' ); |
| 650 |
$logo_desc = array( '', '', __( 'Login page title that is shown on WordPress login page.', 'loginpress' ) ); |
| 651 |
|
| 652 |
$logo = 0; |
| 653 |
while ( $logo < 3 ) : |
| 654 |
|
| 655 |
$wp_customize->add_setting( |
| 656 |
"loginpress_customization[{$logo_control[$logo]}]", |
| 657 |
array( |
| 658 |
'default' => $logo_default[ $logo ], |
| 659 |
'type' => 'option', |
| 660 |
'capability' => 'manage_options', |
| 661 |
'transport' => 'postMessage', |
| 662 |
'sanitize_callback' => $logo_sanitization[ $logo ], |
| 663 |
) |
| 664 |
); |
| 665 |
|
| 666 |
$wp_customize->add_control( |
| 667 |
"loginpress_customization[{$logo_control[$logo]}]", |
| 668 |
array( |
| 669 |
'label' => $logo_label[ $logo ], |
| 670 |
'section' => 'customize_logo_section', |
| 671 |
'priority' => 25, |
| 672 |
'settings' => "loginpress_customization[{$logo_control[$logo]}]", |
| 673 |
'description' => $logo_desc[ $logo ], |
| 674 |
) |
| 675 |
); |
| 676 |
if ( 1 === $logo ) { |
| 677 |
$this->loginpress_hr_setting( $wp_customize, $close_control, 'customize_logo_section', 9, 25 ); |
| 678 |
$this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'customize_logo_section', 9, 25 ); |
| 679 |
} |
| 680 |
++$logo; |
| 681 |
endwhile; |
| 682 |
|
| 683 |
// ============================= |
| 684 |
// = Section for Background = |
| 685 |
// ============================= |
| 686 |
$wp_customize->add_section( |
| 687 |
'section_background', |
| 688 |
array( |
| 689 |
'title' => __( 'Background', 'loginpress' ), |
| 690 |
'description' => '', |
| 691 |
'priority' => 10, |
| 692 |
'panel' => 'loginpress_panel', |
| 693 |
) |
| 694 |
); |
| 695 |
|
| 696 |
$wp_customize->add_setting( |
| 697 |
'loginpress_customization[setting_background_color]', |
| 698 |
array( |
| 699 |
// 'default' => '#ddd5c3', |
| 700 |
'type' => 'option', |
| 701 |
'capability' => 'manage_options', |
| 702 |
'transport' => 'postMessage', |
| 703 |
'sanitize_callback' => 'sanitize_text_field', // validates 3 or 6 digit HTML hex color code. |
| 704 |
) |
| 705 |
); |
| 706 |
|
| 707 |
$wp_customize->add_control( |
| 708 |
new LoginPress_Color_Picker_Alpha( |
| 709 |
$wp_customize, |
| 710 |
'loginpress_customization[setting_background_color]', |
| 711 |
array( |
| 712 |
'label' => __( 'Background Color:', 'loginpress' ), |
| 713 |
'section' => 'section_background', |
| 714 |
'priority' => 5, |
| 715 |
'settings' => 'loginpress_customization[setting_background_color]', |
| 716 |
'input_attrs' => array( |
| 717 |
'name' => 'loginpress_customization[setting_background_color]', |
| 718 |
'data-alpha-enabled' => 'true', |
| 719 |
), |
| 720 |
) |
| 721 |
) |
| 722 |
); |
| 723 |
|
| 724 |
$wp_customize->add_setting( |
| 725 |
'loginpress_customization[loginpress_display_bg]', |
| 726 |
array( |
| 727 |
'default' => true, |
| 728 |
'type' => 'option', |
| 729 |
'capability' => 'manage_options', |
| 730 |
'transport' => 'postMessage', |
| 731 |
'sanitize_callback' => 'loginpress_sanitize_checkbox', |
| 732 |
) |
| 733 |
); |
| 734 |
|
| 735 |
$this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_background', 6, 6 ); |
| 736 |
|
| 737 |
/** |
| 738 |
* [Enable / Disable Background Image with LoginPress_Radio_Control] |
| 739 |
* |
| 740 |
* @since 1.0.1 |
| 741 |
* @version 1.0.23 |
| 742 |
*/ |
| 743 |
$wp_customize->add_control( |
| 744 |
new LoginPress_Radio_Control( |
| 745 |
$wp_customize, |
| 746 |
'loginpress_customization[loginpress_display_bg]', |
| 747 |
array( |
| 748 |
'settings' => 'loginpress_customization[loginpress_display_bg]', |
| 749 |
'label' => __( 'Enable Background Image?', 'loginpress' ), |
| 750 |
'section' => 'section_background', |
| 751 |
'priority' => 10, |
| 752 |
'type' => 'ios', // light, ios, flat |
| 753 |
) |
| 754 |
) |
| 755 |
); |
| 756 |
|
| 757 |
$wp_customize->add_setting( |
| 758 |
'loginpress_customization[setting_background]', |
| 759 |
array( |
| 760 |
// 'default' => plugins_url( 'img/bg.jpg', LOGINPRESS_ROOT_FILE ) , |
| 761 |
'type' => 'option', |
| 762 |
'capability' => 'manage_options', |
| 763 |
'transport' => 'postMessage', |
| 764 |
'sanitize_callback' => 'loginpress_sanitize_image', |
| 765 |
) |
| 766 |
); |
| 767 |
|
| 768 |
$wp_customize->add_control( |
| 769 |
new WP_Customize_Image_Control( |
| 770 |
$wp_customize, |
| 771 |
'loginpress_customization[setting_background]', |
| 772 |
array( |
| 773 |
'label' => __( 'Background Image:', 'loginpress' ), |
| 774 |
'section' => 'section_background', |
| 775 |
'priority' => 15, |
| 776 |
'settings' => 'loginpress_customization[setting_background]', |
| 777 |
'button_labels' => array( |
| 778 |
'select' => __( 'Select Image', 'loginpress' ), |
| 779 |
), |
| 780 |
) |
| 781 |
) |
| 782 |
); |
| 783 |
|
| 784 |
$wp_customize->add_setting( |
| 785 |
'loginpress_customization[mobile_background]', |
| 786 |
array( |
| 787 |
'type' => 'option', |
| 788 |
'capability' => 'manage_options', |
| 789 |
'transport' => 'postMessage', |
| 790 |
'sanitize_callback' => 'loginpress_sanitize_image', |
| 791 |
) |
| 792 |
); |
| 793 |
|
| 794 |
$wp_customize->add_control( |
| 795 |
new WP_Customize_Image_Control( |
| 796 |
$wp_customize, |
| 797 |
'loginpress_customization[mobile_background]', |
| 798 |
array( |
| 799 |
'label' => __( 'Mobile Background Image:', 'loginpress' ), |
| 800 |
'section' => 'section_background', |
| 801 |
'priority' => 17, |
| 802 |
'settings' => 'loginpress_customization[mobile_background]', |
| 803 |
'button_labels' => array( |
| 804 |
'select' => __( 'Select Image', 'loginpress' ), |
| 805 |
), |
| 806 |
) |
| 807 |
) |
| 808 |
); |
| 809 |
|
| 810 |
/** |
| 811 |
* [ Add Background Gallery ] |
| 812 |
* |
| 813 |
* @since 1.1.0 |
| 814 |
*/ |
| 815 |
$wp_customize->add_setting( |
| 816 |
'loginpress_customization[gallery_background]', |
| 817 |
array( |
| 818 |
'default' => plugins_url( 'img/gallery/img-1.jpg', LOGINPRESS_ROOT_FILE ), |
| 819 |
'type' => 'option', |
| 820 |
'capability' => 'manage_options', |
| 821 |
'transport' => 'postMessage', |
| 822 |
) |
| 823 |
); |
| 824 |
|
| 825 |
$loginpress_free_background = array(); |
| 826 |
$loginpress_background_name = array( |
| 827 |
'', |
| 828 |
__( 'Company', 'loginpress' ), |
| 829 |
__( 'Persona', 'loginpress' ), |
| 830 |
__( 'Corporate', 'loginpress' ), |
| 831 |
__( 'Corporate', 'loginpress' ), |
| 832 |
__( 'Startup', 'loginpress' ), |
| 833 |
__( 'Wedding', 'loginpress' ), |
| 834 |
__( 'Wedding #2', 'loginpress' ), |
| 835 |
__( 'Company', 'loginpress' ), |
| 836 |
__( 'Bikers', 'loginpress' ), |
| 837 |
); |
| 838 |
|
| 839 |
// Loop through the backgrounds. |
| 840 |
$bg_count = 1; |
| 841 |
while ( $bg_count <= 9 ) : |
| 842 |
|
| 843 |
$thumbnail = plugins_url( "img/gallery/img-{$bg_count}.jpg", LOGINPRESS_ROOT_FILE ); |
| 844 |
$loginpress_free_background[ $thumbnail ] = array( |
| 845 |
'thumbnail' => plugins_url( "img/thumbnail/gallery-img-{$bg_count}.jpg", LOGINPRESS_ROOT_FILE ), |
| 846 |
'id' => $thumbnail, |
| 847 |
'name' => $loginpress_background_name[ $bg_count ], |
| 848 |
); |
| 849 |
++$bg_count; |
| 850 |
endwhile; |
| 851 |
|
| 852 |
$loginpress_background = apply_filters( 'loginpress_pro_add_background', $loginpress_free_background ); |
| 853 |
|
| 854 |
$wp_customize->add_control( |
| 855 |
new LoginPress_Background_Gallery_Control( |
| 856 |
$wp_customize, |
| 857 |
'loginpress_customization[gallery_background]', |
| 858 |
array( |
| 859 |
'section' => 'section_background', |
| 860 |
'label' => __( 'Background Gallery:', 'loginpress' ), |
| 861 |
'choices' => $loginpress_background, |
| 862 |
) |
| 863 |
) |
| 864 |
); |
| 865 |
|
| 866 |
// @version 1.1.21 |
| 867 |
$wp_customize->add_setting( |
| 868 |
'loginpress_customization[background_repeat_radio]', |
| 869 |
array( |
| 870 |
'default' => 'no-repeat', |
| 871 |
'type' => 'option', |
| 872 |
'capability' => 'manage_options', |
| 873 |
'transport' => 'postMessage', |
| 874 |
// 'sanitize_callback' => 'loginpress_sanitize_checkbox' |
| 875 |
) |
| 876 |
); |
| 877 |
|
| 878 |
$wp_customize->add_control( |
| 879 |
'loginpress_customization[background_repeat_radio]', |
| 880 |
array( |
| 881 |
'label' => __( 'Background Repeat:', 'loginpress' ), |
| 882 |
'section' => 'section_background', |
| 883 |
'priority' => 20, |
| 884 |
'settings' => 'loginpress_customization[background_repeat_radio]', |
| 885 |
'type' => 'select', |
| 886 |
'choices' => array( |
| 887 |
'repeat' => 'repeat', |
| 888 |
'repeat-x' => 'repeat-x', |
| 889 |
'repeat-y' => 'repeat-y', |
| 890 |
'no-repeat' => 'no-repeat', |
| 891 |
'initial' => 'initial', |
| 892 |
'inherit' => 'inherit', |
| 893 |
), |
| 894 |
) |
| 895 |
); |
| 896 |
|
| 897 |
// @version 1.1.21 |
| 898 |
$wp_customize->add_setting( |
| 899 |
'loginpress_customization[background_position]', |
| 900 |
array( |
| 901 |
'default' => 'center', |
| 902 |
'type' => 'option', |
| 903 |
'capability' => 'manage_options', |
| 904 |
'transport' => 'postMessage', |
| 905 |
'sanitize_callback' => 'loginpress_sanitize_select', |
| 906 |
) |
| 907 |
); |
| 908 |
$wp_customize->add_control( |
| 909 |
'loginpress_customization[background_position]', |
| 910 |
array( |
| 911 |
'settings' => 'loginpress_customization[background_position]', |
| 912 |
'label' => __( 'Select Position:', 'loginpress' ), |
| 913 |
'section' => 'section_background', |
| 914 |
'priority' => 25, |
| 915 |
'type' => 'select', |
| 916 |
'choices' => array( |
| 917 |
'left-top' => 'left top', |
| 918 |
'left-center' => 'left center', |
| 919 |
'left-bottom' => 'left bottom', |
| 920 |
'right-top' => 'right top', |
| 921 |
'right-center' => 'right center', |
| 922 |
'right-bottom' => 'right bottom', |
| 923 |
'center-top' => 'center top', |
| 924 |
'center' => 'center', |
| 925 |
'center-bottom' => 'center bottom', |
| 926 |
), |
| 927 |
) |
| 928 |
); |
| 929 |
|
| 930 |
$wp_customize->add_setting( |
| 931 |
'loginpress_customization[background_image_size]', |
| 932 |
array( |
| 933 |
'default' => 'cover', |
| 934 |
'type' => 'option', |
| 935 |
'capability' => 'manage_options', |
| 936 |
'transport' => 'postMessage', |
| 937 |
'sanitize_callback' => 'loginpress_sanitize_select', |
| 938 |
) |
| 939 |
); |
| 940 |
|
| 941 |
$wp_customize->add_control( |
| 942 |
'loginpress_customization[background_image_size]', |
| 943 |
array( |
| 944 |
'label' => __( 'Background Image Size: ', 'loginpress' ), |
| 945 |
'section' => 'section_background', |
| 946 |
'priority' => 30, |
| 947 |
'settings' => 'loginpress_customization[background_image_size]', |
| 948 |
'type' => 'select', |
| 949 |
'choices' => array( |
| 950 |
'auto' => 'auto', |
| 951 |
'cover' => 'cover', |
| 952 |
'contain' => 'contain', |
| 953 |
'initial' => 'initial', |
| 954 |
'inherit' => 'inherit', |
| 955 |
), |
| 956 |
) |
| 957 |
); |
| 958 |
|
| 959 |
$this->loginpress_hr_setting( $wp_customize, $close_control, 'section_form', 10, 31 ); |
| 960 |
$this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_background', 10, 31 ); |
| 961 |
|
| 962 |
/** |
| 963 |
* [Enable / Disable Radom Background Images with LoginPress_Radio_Control] |
| 964 |
* |
| 965 |
* @since 6.0.0 |
| 966 |
*/ |
| 967 |
$wp_customize->add_setting( |
| 968 |
'loginpress_customization[lp_random_bg_img_check]', |
| 969 |
array( |
| 970 |
'default' => false, |
| 971 |
'type' => 'option', |
| 972 |
'capability' => 'manage_options', |
| 973 |
'transport' => 'postMessage', |
| 974 |
'sanitize_callback' => 'loginpress_sanitize_checkbox', |
| 975 |
) |
| 976 |
); |
| 977 |
|
| 978 |
$wp_customize->add_control( |
| 979 |
new LoginPress_Radio_Control( |
| 980 |
$wp_customize, |
| 981 |
'loginpress_customization[lp_random_bg_img_check]', |
| 982 |
array( |
| 983 |
'settings' => 'loginpress_customization[lp_random_bg_img_check]', |
| 984 |
'label' => __( 'Enable Random Background Images?', 'loginpress' ), |
| 985 |
'section' => 'section_background', |
| 986 |
'priority' => 32, |
| 987 |
'type' => 'ios', // light, ios, flat |
| 988 |
) |
| 989 |
) |
| 990 |
); |
| 991 |
$loginpress_default_backgrounds = array(); |
| 992 |
for ( $bg_count = 4; $bg_count <= 9; $bg_count++ ) { |
| 993 |
$loginpress_default_backgrounds[] = plugins_url( "img/gallery/img-{$bg_count}.jpg", LOGINPRESS_ROOT_FILE ); |
| 994 |
} |
| 995 |
|
| 996 |
$default_backgrounds_string = implode( ',', $loginpress_default_backgrounds ); |
| 997 |
$wp_customize->add_setting( |
| 998 |
'loginpress_customization[lp_random_bg_img_upload]', |
| 999 |
array( |
| 1000 |
'type' => 'option', |
| 1001 |
'default' => $default_backgrounds_string, |
| 1002 |
'transport' => 'postMessage', |
| 1003 |
) |
| 1004 |
); |
| 1005 |
|
| 1006 |
$wp_customize->add_control( |
| 1007 |
new LoginPress_Random_BG_Gallery_Control( |
| 1008 |
$wp_customize, |
| 1009 |
'loginpress_customization[lp_random_bg_img_upload]', |
| 1010 |
array( |
| 1011 |
'label' => __( 'Random Background Images', 'loginpress' ), |
| 1012 |
'section' => 'section_background', |
| 1013 |
'settings' => 'loginpress_customization[lp_random_bg_img_upload]', |
| 1014 |
'priority' => 33, |
| 1015 |
) |
| 1016 |
) |
| 1017 |
); |
| 1018 |
|
| 1019 |
$this->loginpress_hr_setting( $wp_customize, $close_control, 'section_form', 7, 35 ); |
| 1020 |
$this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_background', 7, 35 ); |
| 1021 |
/** |
| 1022 |
* [Enable / Disable Background Video with LoginPress_Radio_Control] |
| 1023 |
* |
| 1024 |
* @since 1.1.22 |
| 1025 |
*/ |
| 1026 |
$wp_customize->add_setting( |
| 1027 |
'loginpress_customization[loginpress_display_bg_video]', |
| 1028 |
array( |
| 1029 |
'default' => false, |
| 1030 |
'type' => 'option', |
| 1031 |
'capability' => 'manage_options', |
| 1032 |
'transport' => 'postMessage', |
| 1033 |
'sanitize_callback' => 'loginpress_sanitize_checkbox', |
| 1034 |
) |
| 1035 |
); |
| 1036 |
|
| 1037 |
$wp_customize->add_control( |
| 1038 |
new LoginPress_Radio_Control( |
| 1039 |
$wp_customize, |
| 1040 |
'loginpress_customization[loginpress_display_bg_video]', |
| 1041 |
array( |
| 1042 |
'settings' => 'loginpress_customization[loginpress_display_bg_video]', |
| 1043 |
'label' => __( 'Enable Background Video?', 'loginpress' ), |
| 1044 |
'section' => 'section_background', |
| 1045 |
'priority' => 40, |
| 1046 |
'type' => 'ios', // light, ios, flat |
| 1047 |
) |
| 1048 |
) |
| 1049 |
); |
| 1050 |
|
| 1051 |
/** |
| 1052 |
* Background Video Medium. |
| 1053 |
* |
| 1054 |
* @since 3.0.0 |
| 1055 |
*/ |
| 1056 |
$wp_customize->add_setting( |
| 1057 |
'loginpress_customization[bg_video_medium]', |
| 1058 |
array( |
| 1059 |
'default' => 'media', |
| 1060 |
'type' => 'option', |
| 1061 |
'capability' => 'manage_options', |
| 1062 |
'transport' => 'postMessage', |
| 1063 |
// 'sanitize_callback' => 'loginpress_sanitize_checkbox' |
| 1064 |
) |
| 1065 |
); |
| 1066 |
|
| 1067 |
$wp_customize->add_control( |
| 1068 |
'loginpress_customization[bg_video_medium]', |
| 1069 |
array( |
| 1070 |
'label' => __( 'Medium', 'loginpress' ), |
| 1071 |
'section' => 'section_background', |
| 1072 |
'priority' => 41, |
| 1073 |
'settings' => 'loginpress_customization[bg_video_medium]', |
| 1074 |
'type' => 'radio', |
| 1075 |
'choices' => array( |
| 1076 |
'media' => __( 'Media', 'loginpress' ), |
| 1077 |
'youtube' => __( 'YouTube', 'loginpress' ), |
| 1078 |
), |
| 1079 |
) |
| 1080 |
); |
| 1081 |
|
| 1082 |
/** |
| 1083 |
* [Launch Background Video feature with WP_Customize_Media_Control] |
| 1084 |
* |
| 1085 |
* @since 1.1.22 |
| 1086 |
*/ |
| 1087 |
$wp_customize->add_setting( |
| 1088 |
'loginpress_customization[background_video]', |
| 1089 |
array( |
| 1090 |
'type' => 'option', |
| 1091 |
'capability' => 'manage_options', |
| 1092 |
'transport' => 'postMessage', |
| 1093 |
// 'sanitize_callback' => 'section_background' |
| 1094 |
) |
| 1095 |
); |
| 1096 |
|
| 1097 |
$wp_customize->add_control( |
| 1098 |
new WP_Customize_Media_Control( |
| 1099 |
$wp_customize, |
| 1100 |
'loginpress_customization[background_video]', |
| 1101 |
array( |
| 1102 |
'label' => __( 'Background Video:', 'loginpress' ), |
| 1103 |
'section' => 'section_background', |
| 1104 |
'mime_type' => 'video', // Required. Can be image, audio, video, application, text |
| 1105 |
'priority' => 45, |
| 1106 |
'button_labels' => array( |
| 1107 |
'select' => __( 'Select Video', 'loginpress' ), |
| 1108 |
'change' => __( 'Change Video', 'loginpress' ), |
| 1109 |
'default' => __( 'Default', 'loginpress' ), |
| 1110 |
'remove' => __( 'Remove', 'loginpress' ), |
| 1111 |
'frame_title' => __( 'Select File', 'loginpress' ), |
| 1112 |
'frame_button' => __( 'Choose File', 'loginpress' ), |
| 1113 |
), |
| 1114 |
) |
| 1115 |
) |
| 1116 |
); |
| 1117 |
|
| 1118 |
/** |
| 1119 |
* Field settings for the error message |
| 1120 |
* |
| 1121 |
* @since 3.0.0 |
| 1122 |
*/ |
| 1123 |
$wp_customize->add_setting( |
| 1124 |
'loginpress_customization[background_video_error]', |
| 1125 |
array( |
| 1126 |
'sanitize_callback' => 'sanitize_text_field', |
| 1127 |
) |
| 1128 |
); |
| 1129 |
/** |
| 1130 |
* Field for Add a control for the error message |
| 1131 |
* |
| 1132 |
* @since 3.0.0 |
| 1133 |
*/ |
| 1134 |
$wp_customize->add_control( |
| 1135 |
new WP_Customize_Control( |
| 1136 |
$wp_customize, |
| 1137 |
'loginpress_customization[background_video_error]', |
| 1138 |
array( |
| 1139 |
'label' => __( 'Error Message:', 'loginpress' ), |
| 1140 |
'description' => 'Wrong Selection, Please select MP4, webm or ogg file only', |
| 1141 |
'section' => 'section_background', |
| 1142 |
'priority' => 46, // Place it after the video control |
| 1143 |
'type' => 'hidden', // Using hidden type to display only the description |
| 1144 |
) |
| 1145 |
) |
| 1146 |
); |
| 1147 |
/** |
| 1148 |
* Field for YouTube video ID. |
| 1149 |
* |
| 1150 |
* @since 3.0.0 |
| 1151 |
* @version 6.0.0 |
| 1152 |
*/ |
| 1153 |
$wp_customize->add_setting( |
| 1154 |
'loginpress_customization[yt_video_id]', |
| 1155 |
array( |
| 1156 |
'type' => 'option', |
| 1157 |
'capability' => 'manage_options', |
| 1158 |
'transport' => 'postMessage', |
| 1159 |
'sanitize_callback' => 'sanitize_text_field', |
| 1160 |
) |
| 1161 |
); |
| 1162 |
|
| 1163 |
$wp_customize->add_control( |
| 1164 |
'loginpress_customization[yt_video_id]', |
| 1165 |
array( |
| 1166 |
'label' => __( 'ID of the YouTube video', 'loginpress' ), |
| 1167 |
// translators: Live preview is not supported |
| 1168 |
'description' => sprintf( __( 'YouTube video ID is correct though the Live Preview is not supported. The video on the %1$slogin page%2$s can be checked, once it is published.', 'loginpress' ), '<a href="' . wp_login_url() . '" target="_blank">', '</a>' ), |
| 1169 |
'section' => 'section_background', |
| 1170 |
'priority' => 46, |
| 1171 |
'settings' => 'loginpress_customization[yt_video_id]', |
| 1172 |
'input_attrs' => array( |
| 1173 |
'placeholder' => 'GMAwsHomJlE', |
| 1174 |
), |
| 1175 |
) |
| 1176 |
); |
| 1177 |
|
| 1178 |
// @version 1.1.21 |
| 1179 |
$wp_customize->add_setting( |
| 1180 |
'loginpress_customization[background_video_object]', |
| 1181 |
array( |
| 1182 |
'default' => 'cover', |
| 1183 |
'type' => 'option', |
| 1184 |
'capability' => 'manage_options', |
| 1185 |
'transport' => 'postMessage', |
| 1186 |
'sanitize_callback' => 'loginpress_sanitize_select', |
| 1187 |
) |
| 1188 |
); |
| 1189 |
$wp_customize->add_control( |
| 1190 |
'loginpress_customization[background_video_object]', |
| 1191 |
array( |
| 1192 |
'settings' => 'loginpress_customization[background_video_object]', |
| 1193 |
// translators: Video Size. |
| 1194 |
'label' => __( 'Video Size:', 'loginpress' ), |
| 1195 |
'section' => 'section_background', |
| 1196 |
'priority' => 50, |
| 1197 |
'type' => 'select', |
| 1198 |
'choices' => array( |
| 1199 |
'fill' => 'fill', |
| 1200 |
'contain' => 'contain', |
| 1201 |
'cover' => 'cover', |
| 1202 |
'scale-down' => 'scale-down', |
| 1203 |
'none' => 'none', |
| 1204 |
), |
| 1205 |
) |
| 1206 |
); |
| 1207 |
|
| 1208 |
$wp_customize->add_setting( |
| 1209 |
'loginpress_customization[video_obj_position]', |
| 1210 |
array( |
| 1211 |
'type' => 'option', |
| 1212 |
'capability' => 'manage_options', |
| 1213 |
'transport' => 'postMessage', |
| 1214 |
'sanitize_callback' => 'wp_strip_all_tags', |
| 1215 |
) |
| 1216 |
); |
| 1217 |
|
| 1218 |
$wp_customize->add_control( |
| 1219 |
'loginpress_customization[video_obj_position]', |
| 1220 |
array( |
| 1221 |
'label' => __( 'Object Position:', 'loginpress' ), |
| 1222 |
'section' => 'section_background', |
| 1223 |
'priority' => 55, |
| 1224 |
'settings' => 'loginpress_customization[video_obj_position]', |
| 1225 |
'input_attrs' => array( |
| 1226 |
'placeholder' => __( '50% 50%', 'loginpress' ), |
| 1227 |
), |
| 1228 |
) |
| 1229 |
); |
| 1230 |
|
| 1231 |
/** |
| 1232 |
* [Enable / Disable Background Video with LoginPress_Radio_Control] |
| 1233 |
* |
| 1234 |
* @since 1.1.22 |
| 1235 |
*/ |
| 1236 |
$wp_customize->add_setting( |
| 1237 |
'loginpress_customization[background_video_muted]', |
| 1238 |
array( |
| 1239 |
'default' => true, |
| 1240 |
'type' => 'option', |
| 1241 |
'capability' => 'manage_options', |
| 1242 |
'transport' => 'postMessage', |
| 1243 |
'sanitize_callback' => 'loginpress_sanitize_checkbox', |
| 1244 |
) |
| 1245 |
); |
| 1246 |
|
| 1247 |
$wp_customize->add_control( |
| 1248 |
new LoginPress_Radio_Control( |
| 1249 |
$wp_customize, |
| 1250 |
'loginpress_customization[background_video_muted]', |
| 1251 |
array( |
| 1252 |
'settings' => 'loginpress_customization[background_video_muted]', |
| 1253 |
'label' => __( 'Muted Video?', 'loginpress' ), |
| 1254 |
'section' => 'section_background', |
| 1255 |
'priority' => 60, |
| 1256 |
'type' => 'ios', // light, ios, flat |
| 1257 |
) |
| 1258 |
) |
| 1259 |
); |
| 1260 |
|
| 1261 |
// ============================= |
| 1262 |
// = Section for Form Beauty = |
| 1263 |
// ============================= |
| 1264 |
$wp_customize->add_section( |
| 1265 |
'section_form', |
| 1266 |
array( |
| 1267 |
'title' => __( 'Customize Login Form', 'loginpress' ), |
| 1268 |
'description' => '', |
| 1269 |
'priority' => 15, |
| 1270 |
'panel' => 'loginpress_panel', |
| 1271 |
) |
| 1272 |
); |
| 1273 |
|
| 1274 |
$this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_form', 2, 4 ); |
| 1275 |
|
| 1276 |
/** |
| 1277 |
* [ Enable / Disable Form Background Image with LoginPress_Radio_Control ] |
| 1278 |
* |
| 1279 |
* @since 1.1.3 |
| 1280 |
*/ |
| 1281 |
|
| 1282 |
$wp_customize->add_setting( |
| 1283 |
'loginpress_customization[setting_form_display_bg]', |
| 1284 |
array( |
| 1285 |
'default' => false, |
| 1286 |
'type' => 'option', |
| 1287 |
'capability' => 'manage_options', |
| 1288 |
'transport' => 'postMessage', |
| 1289 |
'sanitize_callback' => 'loginpress_sanitize_checkbox', |
| 1290 |
) |
| 1291 |
); |
| 1292 |
|
| 1293 |
$wp_customize->add_control( |
| 1294 |
new LoginPress_Radio_Control( |
| 1295 |
$wp_customize, |
| 1296 |
'loginpress_customization[setting_form_display_bg]', |
| 1297 |
array( |
| 1298 |
'settings' => 'loginpress_customization[setting_form_display_bg]', |
| 1299 |
'label' => __( 'Enable Form Transparency:', 'loginpress' ), |
| 1300 |
'section' => 'section_form', |
| 1301 |
'priority' => 5, |
| 1302 |
'type' => 'ios', |
| 1303 |
) |
| 1304 |
) |
| 1305 |
); |
| 1306 |
|
| 1307 |
$wp_customize->add_setting( |
| 1308 |
'loginpress_customization[setting_form_background]', |
| 1309 |
array( |
| 1310 |
'type' => 'option', |
| 1311 |
'capability' => 'manage_options', |
| 1312 |
'transport' => 'postMessage', |
| 1313 |
'sanitize_callback' => 'loginpress_sanitize_image', |
| 1314 |
) |
| 1315 |
); |
| 1316 |
|
| 1317 |
$wp_customize->add_control( |
| 1318 |
new WP_Customize_Image_Control( |
| 1319 |
$wp_customize, |
| 1320 |
'loginpress_customization[setting_form_background]', |
| 1321 |
array( |
| 1322 |
'label' => __( 'Form Background Image:', 'loginpress' ), |
| 1323 |
'section' => 'section_form', |
| 1324 |
'priority' => 6, |
| 1325 |
'settings' => 'loginpress_customization[setting_form_background]', |
| 1326 |
) |
| 1327 |
) |
| 1328 |
); |
| 1329 |
|
| 1330 |
$wp_customize->register_control_type( LoginPress_Color_Picker_Alpha::class ); |
| 1331 |
|
| 1332 |
$this->loginpress_color_setting( $wp_customize, $form_color_control, $form_color_label, 'section_form', 0, 7 ); |
| 1333 |
|
| 1334 |
$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 ); |
| 1335 |
$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 ); |
| 1336 |
$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 ); |
| 1337 |
$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 ); |
| 1338 |
$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 ); |
| 1339 |
// Add settings for padding and margin |
| 1340 |
$wp_customize->add_setting( |
| 1341 |
'loginpress_customization[padding]', |
| 1342 |
array( |
| 1343 |
'default' => array( |
| 1344 |
'top' => 0, |
| 1345 |
'left' => 0, |
| 1346 |
'right' => 0, |
| 1347 |
'bottom' => 0, |
| 1348 |
'unit' => 'px', |
| 1349 |
'lock' => 0, |
| 1350 |
), |
| 1351 |
'type' => 'option', |
| 1352 |
'capability' => 'manage_options', |
| 1353 |
'transport' => 'postMessage', |
| 1354 |
'sanitize_callback' => 'sanitize_text_field', // Update with appropriate sanitization function |
| 1355 |
) |
| 1356 |
); |
| 1357 |
|
| 1358 |
$wp_customize->add_control( |
| 1359 |
new LoginPress_Spacing_Control( |
| 1360 |
$wp_customize, |
| 1361 |
'loginpress_customization-customize_form_padding_controls', |
| 1362 |
array( |
| 1363 |
'label' => __( 'Padding', 'loginpress' ), |
| 1364 |
'description' => __( 'Set the padding values.', 'loginpress' ), |
| 1365 |
'section' => 'section_form', |
| 1366 |
'settings' => 'loginpress_customization[padding]', |
| 1367 |
'is_margin' => false, // For padding |
| 1368 |
'priority' => 40, |
| 1369 |
'loginpresstarget' => 'customize-control-loginpress_customization-customize_form_padding', |
| 1370 |
) |
| 1371 |
) |
| 1372 |
); |
| 1373 |
$form_padding = 0; |
| 1374 |
while ( $form_padding < 2 ) : |
| 1375 |
|
| 1376 |
$wp_customize->add_setting( |
| 1377 |
"loginpress_customization[{$form_control[$form_padding]}]", |
| 1378 |
array( |
| 1379 |
'default' => $form_default[ $form_padding ], |
| 1380 |
'type' => 'option', |
| 1381 |
'capability' => 'manage_options', |
| 1382 |
'transport' => 'postMessage', |
| 1383 |
'sanitize_callback' => $form_sanitization[ $form_padding ], |
| 1384 |
) |
| 1385 |
); |
| 1386 |
|
| 1387 |
$wp_customize->add_control( |
| 1388 |
"loginpress_customization[{$form_control[$form_padding]}]", |
| 1389 |
array( |
| 1390 |
'label' => $form_label[ $form_padding ], |
| 1391 |
'section' => 'section_form', |
| 1392 |
'priority' => 40, |
| 1393 |
'settings' => "loginpress_customization[{$form_control[$form_padding]}]", |
| 1394 |
) |
| 1395 |
); |
| 1396 |
|
| 1397 |
++$form_padding; |
| 1398 |
endwhile; |
| 1399 |
|
| 1400 |
$this->loginpress_hr_setting( $wp_customize, $close_control, 'section_form', 3, 41 ); |
| 1401 |
|
| 1402 |
$this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_form', 0, 45 ); |
| 1403 |
// Add settings for margin |
| 1404 |
$wp_customize->add_setting( |
| 1405 |
'loginpress_customization[margin]', |
| 1406 |
array( |
| 1407 |
'default' => array( |
| 1408 |
'top' => 0, |
| 1409 |
'left' => 0, |
| 1410 |
'right' => 0, |
| 1411 |
'bottom' => 0, |
| 1412 |
'unit' => 'px', |
| 1413 |
'lock' => 0, |
| 1414 |
), |
| 1415 |
'type' => 'option', |
| 1416 |
'capability' => 'manage_options', |
| 1417 |
'transport' => 'postMessage', |
| 1418 |
'sanitize_callback' => 'sanitize_text_field', // Update with appropriate sanitization function |
| 1419 |
) |
| 1420 |
); |
| 1421 |
|
| 1422 |
// Add control for margin |
| 1423 |
$wp_customize->add_control( |
| 1424 |
new LoginPress_Spacing_Control( |
| 1425 |
$wp_customize, |
| 1426 |
'loginpress_customization-customize_form_margin', |
| 1427 |
array( |
| 1428 |
'label' => __( 'Margin', 'loginpress' ), |
| 1429 |
'description' => __( 'Set the margin values.', 'loginpress' ), |
| 1430 |
'section' => 'section_form', |
| 1431 |
'settings' => 'loginpress_customization[margin]', |
| 1432 |
'is_margin' => true, // For margin |
| 1433 |
'priority' => 49, // Adjust priority as needed |
| 1434 |
'loginpresstarget' => 'customize-control-loginpress_customization-textfield_margin', |
| 1435 |
) |
| 1436 |
) |
| 1437 |
); |
| 1438 |
|
| 1439 |
$this->loginpress_color_setting( $wp_customize, $form_color_control, $form_color_label, 'section_form', 1, 50 ); |
| 1440 |
$this->loginpress_color_setting( $wp_customize, $form_color_control, $form_color_label, 'section_form', 2, 55 ); |
| 1441 |
|
| 1442 |
$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 ); |
| 1443 |
// textfield_radius. |
| 1444 |
// $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 ); |
| 1445 |
// textfield_shadow. |
| 1446 |
// $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 ); |
| 1447 |
// textfield_shadow_opacity. |
| 1448 |
// $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 ); |
| 1449 |
|
| 1450 |
/** |
| 1451 |
* [ Enable / Disable Form Background Image with LoginPress_Radio_Control ] |
| 1452 |
* |
| 1453 |
* @since 1.1.3 |
| 1454 |
*/ |
| 1455 |
|
| 1456 |
// $wp_customize->add_setting( 'loginpress_customization[textfield_inset_shadow]', array( |
| 1457 |
// 'default' => false, |
| 1458 |
// 'type' => 'option', |
| 1459 |
// 'capability' => 'manage_options', |
| 1460 |
// 'transport' => 'postMessage' |
| 1461 |
// ) ); |
| 1462 |
// |
| 1463 |
// $wp_customize->add_control( new LoginPress_Radio_Control( $wp_customize, 'loginpress_customization[textfield_inset_shadow]', array( |
| 1464 |
// 'settings' => 'loginpress_customization[textfield_inset_shadow]', |
| 1465 |
// 'label' => __( 'Input Text Field Shadow Inset:', 'loginpress'), |
| 1466 |
// 'section' => 'section_form', |
| 1467 |
// 'priority' => 80, |
| 1468 |
// 'type' => 'ios',// light, ios, flat |
| 1469 |
// ) ) ); |
| 1470 |
|
| 1471 |
$input_padding = 2; |
| 1472 |
while ( $input_padding < 3 ) : |
| 1473 |
|
| 1474 |
$wp_customize->add_setting( |
| 1475 |
"loginpress_customization[{$form_control[$input_padding]}]", |
| 1476 |
array( |
| 1477 |
'default' => $form_default[ $input_padding ], |
| 1478 |
'type' => 'option', |
| 1479 |
'capability' => 'manage_options', |
| 1480 |
'transport' => 'postMessage', |
| 1481 |
'sanitize_callback' => $form_sanitization[ $input_padding ], |
| 1482 |
) |
| 1483 |
); |
| 1484 |
|
| 1485 |
$wp_customize->add_control( |
| 1486 |
"loginpress_customization[{$form_control[$input_padding]}]", |
| 1487 |
array( |
| 1488 |
'label' => $form_label[ $input_padding ], |
| 1489 |
'section' => 'section_form', |
| 1490 |
'priority' => 85, |
| 1491 |
'settings' => "loginpress_customization[{$form_control[$input_padding]}]", |
| 1492 |
) |
| 1493 |
); |
| 1494 |
|
| 1495 |
++$input_padding; |
| 1496 |
endwhile; |
| 1497 |
|
| 1498 |
$this->loginpress_hr_setting( $wp_customize, $close_control, 'section_form', 4, 86 ); |
| 1499 |
$this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_form', 1, 90 ); |
| 1500 |
|
| 1501 |
// $form_input_label = 3; |
| 1502 |
// while ( $form_input_label < 5 ) : |
| 1503 |
// |
| 1504 |
// $wp_customize->add_setting( "loginpress_customization[{$form_control[$form_input_label]}]", array( |
| 1505 |
// 'default' => $form_default[$form_input_label], |
| 1506 |
// 'type' => 'option', |
| 1507 |
// 'capability' => 'manage_options', |
| 1508 |
// 'transport' => 'postMessage' |
| 1509 |
// ) ); |
| 1510 |
// |
| 1511 |
// $wp_customize->add_control( "loginpress_customization[{$form_control[$form_input_label]}]", array( |
| 1512 |
// 'label' => $form_label[$form_input_label], |
| 1513 |
// 'section' => 'section_form', |
| 1514 |
// 'priority' => 91, |
| 1515 |
// 'settings' => "loginpress_customization[{$form_control[$form_input_label]}]" |
| 1516 |
// ) ); |
| 1517 |
// |
| 1518 |
// $form_input_label++; |
| 1519 |
// endwhile; |
| 1520 |
|
| 1521 |
$this->loginpress_color_setting( $wp_customize, $form_color_control, $form_color_label, 'section_form', 3, 95 ); |
| 1522 |
$this->loginpress_color_setting( $wp_customize, $form_color_control, $form_color_label, 'section_form', 4, 100 ); |
| 1523 |
|
| 1524 |
// customize_form_label. |
| 1525 |
$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 ); |
| 1526 |
// remember_me_font_size. |
| 1527 |
$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 ); |
| 1528 |
$this->loginpress_hr_setting( $wp_customize, $close_control, 'section_form', 5, 111 ); |
| 1529 |
|
| 1530 |
// ============================= |
| 1531 |
// = Section for Forget Form = |
| 1532 |
// ============================= |
| 1533 |
$wp_customize->add_section( |
| 1534 |
'section_forget_form', |
| 1535 |
array( |
| 1536 |
'title' => __( 'Customize Forget Form', 'loginpress' ), |
| 1537 |
'description' => '', |
| 1538 |
'priority' => 20, |
| 1539 |
'panel' => 'loginpress_panel', |
| 1540 |
) |
| 1541 |
); |
| 1542 |
|
| 1543 |
$wp_customize->add_setting( |
| 1544 |
'loginpress_customization[forget_form_background]', |
| 1545 |
array( |
| 1546 |
'type' => 'option', |
| 1547 |
'capability' => 'manage_options', |
| 1548 |
'transport' => 'postMessage', |
| 1549 |
'sanitize_callback' => 'loginpress_sanitize_image', |
| 1550 |
) |
| 1551 |
); |
| 1552 |
|
| 1553 |
$wp_customize->add_control( |
| 1554 |
new WP_Customize_Image_Control( |
| 1555 |
$wp_customize, |
| 1556 |
'loginpress_customization[forget_form_background]', |
| 1557 |
array( |
| 1558 |
'label' => __( 'Forget Form Background Image:', 'loginpress' ), |
| 1559 |
'section' => 'section_forget_form', |
| 1560 |
'priority' => 5, |
| 1561 |
'settings' => 'loginpress_customization[forget_form_background]', |
| 1562 |
) |
| 1563 |
) |
| 1564 |
); |
| 1565 |
|
| 1566 |
$wp_customize->add_setting( |
| 1567 |
'loginpress_customization[forget_form_background_color]', |
| 1568 |
array( |
| 1569 |
// 'default' => '#FFF', |
| 1570 |
'type' => 'option', |
| 1571 |
'capability' => 'manage_options', |
| 1572 |
'transport' => 'postMessage', |
| 1573 |
'sanitize_callback' => 'sanitize_text_field', // validates 3 or 6 digit HTML hex color code. |
| 1574 |
) |
| 1575 |
); |
| 1576 |
|
| 1577 |
$wp_customize->add_control( |
| 1578 |
new LoginPress_Color_Picker_Alpha( |
| 1579 |
$wp_customize, |
| 1580 |
'loginpress_customization[forget_form_background_color]', |
| 1581 |
array( |
| 1582 |
'label' => __( 'Forget Form Background Color:', 'loginpress' ), |
| 1583 |
'section' => 'section_forget_form', |
| 1584 |
'priority' => 10, |
| 1585 |
'settings' => 'loginpress_customization[forget_form_background_color]', |
| 1586 |
'input_attrs' => array( |
| 1587 |
'name' => 'loginpress_customization[forget_form_background_color]', |
| 1588 |
'data-alpha-enabled' => 'true', |
| 1589 |
), |
| 1590 |
) |
| 1591 |
) |
| 1592 |
); |
| 1593 |
|
| 1594 |
// ============================= |
| 1595 |
// = Section for Button Style = |
| 1596 |
// ============================= |
| 1597 |
$wp_customize->add_section( |
| 1598 |
'section_button', |
| 1599 |
array( |
| 1600 |
'title' => __( 'Button Beauty', 'loginpress' ), |
| 1601 |
'description' => '', |
| 1602 |
'priority' => 25, |
| 1603 |
'panel' => 'loginpress_panel', |
| 1604 |
) |
| 1605 |
); |
| 1606 |
|
| 1607 |
$this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 0, 5 ); |
| 1608 |
$this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 1, 10 ); |
| 1609 |
$this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 2, 15 ); |
| 1610 |
$this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 3, 20 ); |
| 1611 |
$this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 4, 25 ); |
| 1612 |
$this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 5, 30 ); |
| 1613 |
$this->loginpress_color_setting( $wp_customize, $button_control, $button_label, 'section_button', 6, 35 ); |
| 1614 |
|
| 1615 |
/** |
| 1616 |
* [ Change Button CSS Properties with LoginPress_Range_Control ] |
| 1617 |
* |
| 1618 |
* @since 1.0.1 |
| 1619 |
* @version 3.0.0 |
| 1620 |
*/ |
| 1621 |
|
| 1622 |
$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 ); |
| 1623 |
$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 ); |
| 1624 |
$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 ); |
| 1625 |
$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 ); |
| 1626 |
$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 ); |
| 1627 |
$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 ); |
| 1628 |
$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 ); |
| 1629 |
|
| 1630 |
// ============================= |
| 1631 |
// = Section for Error message = |
| 1632 |
// ============================= |
| 1633 |
$wp_customize->add_section( |
| 1634 |
'section_error', |
| 1635 |
array( |
| 1636 |
'title' => __( 'Error Messages', 'loginpress' ), |
| 1637 |
'description' => '', |
| 1638 |
'priority' => 30, |
| 1639 |
'panel' => 'loginpress_panel', |
| 1640 |
) |
| 1641 |
); |
| 1642 |
|
| 1643 |
$error = 0; |
| 1644 |
while ( $error < 11 ) : |
| 1645 |
|
| 1646 |
$wp_customize->add_setting( |
| 1647 |
"loginpress_customization[{$error_control[$error]}]", |
| 1648 |
array( |
| 1649 |
'default' => $error_default[ $error ], |
| 1650 |
'type' => 'option', |
| 1651 |
'capability' => 'manage_options', |
| 1652 |
'transport' => 'postMessage', |
| 1653 |
'sanitize_callback' => 'wp_kses_post', |
| 1654 |
) |
| 1655 |
); |
| 1656 |
|
| 1657 |
$wp_customize->add_control( |
| 1658 |
"loginpress_customization[{$error_control[$error]}]", |
| 1659 |
array( |
| 1660 |
'label' => $error_label[ $error ], |
| 1661 |
'section' => 'section_error', |
| 1662 |
'priority' => 5, |
| 1663 |
'settings' => "loginpress_customization[{$error_control[$error]}]", |
| 1664 |
) |
| 1665 |
); |
| 1666 |
|
| 1667 |
++$error; |
| 1668 |
endwhile; |
| 1669 |
|
| 1670 |
// ============================= |
| 1671 |
// = Section for Welcome message |
| 1672 |
// ============================= |
| 1673 |
$wp_customize->add_section( |
| 1674 |
'section_welcome', |
| 1675 |
array( |
| 1676 |
'title' => __( 'Welcome Messages', 'loginpress' ), |
| 1677 |
'description' => '', |
| 1678 |
'priority' => 35, |
| 1679 |
'panel' => 'loginpress_panel', |
| 1680 |
) |
| 1681 |
); |
| 1682 |
|
| 1683 |
$welcome = 0; |
| 1684 |
while ( $welcome < 5 ) : |
| 1685 |
|
| 1686 |
$wp_customize->add_setting( |
| 1687 |
"loginpress_customization[{$welcome_control[$welcome]}]", |
| 1688 |
array( |
| 1689 |
'type' => 'option', |
| 1690 |
'capability' => 'manage_options', |
| 1691 |
'transport' => 'postMessage', |
| 1692 |
'sanitize_callback' => $welcome_sanitization[ $welcome ], |
| 1693 |
) |
| 1694 |
); |
| 1695 |
|
| 1696 |
$wp_customize->add_control( |
| 1697 |
"loginpress_customization[{$welcome_control[$welcome]}]", |
| 1698 |
array( |
| 1699 |
'label' => $welcome_label[ $welcome ], |
| 1700 |
'section' => 'section_welcome', |
| 1701 |
'priority' => 5, |
| 1702 |
'settings' => "loginpress_customization[{$welcome_control[$welcome]}]", |
| 1703 |
'input_attrs' => array( |
| 1704 |
'placeholder' => $welcome_default[ $welcome ], |
| 1705 |
), |
| 1706 |
) |
| 1707 |
); |
| 1708 |
|
| 1709 |
++$welcome; |
| 1710 |
endwhile; |
| 1711 |
|
| 1712 |
$wp_customize->add_setting( |
| 1713 |
'loginpress_customization[message_background_color]', |
| 1714 |
array( |
| 1715 |
// 'default' => '#fff', |
| 1716 |
'type' => 'option', |
| 1717 |
'capability' => 'manage_options', |
| 1718 |
'transport' => 'postMessage', |
| 1719 |
'sanitize_callback' => 'sanitize_text_field', // validates 3 or 6 digit HTML hex color code. |
| 1720 |
) |
| 1721 |
); |
| 1722 |
|
| 1723 |
$wp_customize->add_control( |
| 1724 |
new LoginPress_Color_Picker_Alpha( |
| 1725 |
$wp_customize, |
| 1726 |
'loginpress_customization[message_background_color]', |
| 1727 |
array( |
| 1728 |
'label' => __( 'Message Field Background Color:', 'loginpress' ), |
| 1729 |
'section' => 'section_welcome', |
| 1730 |
'priority' => 30, |
| 1731 |
'settings' => 'loginpress_customization[message_background_color]', |
| 1732 |
'input_attrs' => array( |
| 1733 |
'name' => 'loginpress_customization[message_background_color]', |
| 1734 |
'data-alpha-enabled' => 'true', |
| 1735 |
), |
| 1736 |
) |
| 1737 |
) |
| 1738 |
); |
| 1739 |
|
| 1740 |
// ============================= |
| 1741 |
// = Section for Header message |
| 1742 |
// ============================= |
| 1743 |
// $wp_customize->add_section( |
| 1744 |
// 'section_head', |
| 1745 |
// array( |
| 1746 |
// 'title' => __( 'Header Message', 'loginpress' ), |
| 1747 |
// 'description' => '', |
| 1748 |
// 'priority' => 35, |
| 1749 |
// 'panel' => 'loginpress_panel', |
| 1750 |
// )); |
| 1751 |
// |
| 1752 |
// $wp_customize->add_setting( 'loginpress_customization[login_header_message]', array( |
| 1753 |
// 'default' => 'Latest NEWS', |
| 1754 |
// 'type' => 'option', |
| 1755 |
// 'capability' => 'edit_theme_options', |
| 1756 |
// )); |
| 1757 |
// |
| 1758 |
// $wp_customize->add_control( 'login_header_message', array( |
| 1759 |
// 'label' => __( 'Header Message:', 'loginpress' ), |
| 1760 |
// 'section' => 'section_head', |
| 1761 |
// 'priority' => 5, |
| 1762 |
// 'settings' => 'loginpress_customization[login_header_message]', |
| 1763 |
// )); |
| 1764 |
// |
| 1765 |
// $wp_customize->add_setting( 'loginpress_customization[login_header_message_link]', array( |
| 1766 |
// 'default' => '#', |
| 1767 |
// 'type' => 'option', |
| 1768 |
// 'capability' => 'edit_theme_options', |
| 1769 |
// )); |
| 1770 |
// |
| 1771 |
// $wp_customize->add_control( 'login_header_message_link', array( |
| 1772 |
// 'label' => __( 'Header Message Link:', 'loginpress' ), |
| 1773 |
// 'section' => 'section_head', |
| 1774 |
// 'priority' => 5, |
| 1775 |
// 'settings' => 'loginpress_customization[login_header_message_link]', |
| 1776 |
// )); |
| 1777 |
// |
| 1778 |
// $wp_customize->add_setting( 'loginpress_customization[login_head_color]', array( |
| 1779 |
// 'default' => '#17a8e3', |
| 1780 |
// 'type' => 'option', |
| 1781 |
// 'capability' => 'edit_theme_options', |
| 1782 |
// )); |
| 1783 |
// |
| 1784 |
// $wp_customize->add_control( |
| 1785 |
// new WP_Customize_Color_Control( |
| 1786 |
// $wp_customize, |
| 1787 |
// 'login_head_color', |
| 1788 |
// array( |
| 1789 |
// 'label' => __( 'Header Text Color:', 'loginpress' ), |
| 1790 |
// 'section' => 'section_head', |
| 1791 |
// 'priority' => 10, |
| 1792 |
// 'settings' => 'loginpress_customization[login_head_color]' |
| 1793 |
// ))); |
| 1794 |
// |
| 1795 |
// $wp_customize->add_setting( 'loginpress_customization[login_head_color_hover]', array( |
| 1796 |
// 'default' => '#17a8e3', |
| 1797 |
// 'type' => 'option', |
| 1798 |
// 'capability' => 'edit_theme_options', |
| 1799 |
// )); |
| 1800 |
// |
| 1801 |
// $wp_customize->add_control( |
| 1802 |
// new WP_Customize_Color_Control( |
| 1803 |
// $wp_customize, |
| 1804 |
// 'login_head_color_hover', |
| 1805 |
// array( |
| 1806 |
// 'label' => __( 'Header Text Hover Color:', 'loginpress' ), |
| 1807 |
// 'section' => 'section_head', |
| 1808 |
// 'priority' => 15, |
| 1809 |
// 'settings' => 'loginpress_customization[login_head_color_hover]' |
| 1810 |
// ))); |
| 1811 |
// |
| 1812 |
// $wp_customize->add_setting( 'loginpress_customization[login_head_font_size]', array( |
| 1813 |
// 'default' => '13px;', |
| 1814 |
// 'type' => 'option', |
| 1815 |
// 'capability' => 'edit_theme_options', |
| 1816 |
// )); |
| 1817 |
// |
| 1818 |
// $wp_customize->add_control( 'login_head_font_size', array( |
| 1819 |
// 'label' => __( 'Text Font Size:', 'loginpress' ), |
| 1820 |
// 'section' => 'section_head', |
| 1821 |
// 'priority' => 20, |
| 1822 |
// 'settings' => 'loginpress_customization[login_head_font_size]', |
| 1823 |
// )); |
| 1824 |
// |
| 1825 |
// $wp_customize->add_setting( 'loginpress_customization[login_head_bg_color]', array( |
| 1826 |
// 'default' => '#17a8e3', |
| 1827 |
// 'type' => 'option', |
| 1828 |
// 'capability' => 'edit_theme_options', |
| 1829 |
// )); |
| 1830 |
// |
| 1831 |
// $wp_customize->add_control( |
| 1832 |
// new WP_Customize_Color_Control( |
| 1833 |
// $wp_customize, |
| 1834 |
// 'login_head_bg_color', |
| 1835 |
// array( |
| 1836 |
// 'label' => __( 'Header Background Color:', 'loginpress' ), |
| 1837 |
// 'section' => 'section_head', |
| 1838 |
// 'priority' => 25, |
| 1839 |
// 'settings' => 'loginpress_customization[login_head_bg_color]' |
| 1840 |
// ))); |
| 1841 |
|
| 1842 |
// ============================= |
| 1843 |
// = Section for Form Footer = |
| 1844 |
// ============================= |
| 1845 |
$wp_customize->add_section( |
| 1846 |
'section_footer', |
| 1847 |
array( |
| 1848 |
'title' => __( 'Form Footer', 'loginpress' ), |
| 1849 |
'description' => '', |
| 1850 |
'priority' => 40, |
| 1851 |
'panel' => 'loginpress_panel', |
| 1852 |
) |
| 1853 |
); |
| 1854 |
|
| 1855 |
$this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_footer', 3, 4 ); |
| 1856 |
|
| 1857 |
$wp_customize->add_setting( |
| 1858 |
'loginpress_customization[footer_display_text]', |
| 1859 |
array( |
| 1860 |
'default' => true, |
| 1861 |
'type' => 'option', |
| 1862 |
'capability' => 'manage_options', |
| 1863 |
'transport' => 'postMessage', |
| 1864 |
'sanitize_callback' => 'loginpress_sanitize_checkbox', |
| 1865 |
) |
| 1866 |
); |
| 1867 |
|
| 1868 |
/** |
| 1869 |
* [Enable / Disable Footer Text with LoginPress_Radio_Control] |
| 1870 |
* |
| 1871 |
* @since 1.0.1 |
| 1872 |
* @version 1.0.23 |
| 1873 |
*/ |
| 1874 |
$wp_customize->add_control( |
| 1875 |
new LoginPress_Radio_Control( |
| 1876 |
$wp_customize, |
| 1877 |
'loginpress_customization[footer_display_text]', |
| 1878 |
array( |
| 1879 |
'settings' => 'loginpress_customization[footer_display_text]', |
| 1880 |
'label' => __( 'Enable Footer Text:', 'loginpress' ), |
| 1881 |
'section' => 'section_footer', |
| 1882 |
'priority' => 5, |
| 1883 |
'type' => 'ios', // light, ios, flat |
| 1884 |
) |
| 1885 |
) |
| 1886 |
); |
| 1887 |
|
| 1888 |
$wp_customize->add_setting( |
| 1889 |
'loginpress_customization[login_footer_text]', |
| 1890 |
array( |
| 1891 |
'default' => __( 'Lost your password?', 'loginpress' ), |
| 1892 |
'type' => 'option', |
| 1893 |
'capability' => 'manage_options', |
| 1894 |
'transport' => 'postMessage', |
| 1895 |
'sanitize_callback' => 'wp_kses_post', |
| 1896 |
) |
| 1897 |
); |
| 1898 |
|
| 1899 |
$wp_customize->add_control( |
| 1900 |
'loginpress_customization[login_footer_text]', |
| 1901 |
array( |
| 1902 |
'label' => __( 'Lost Password Text:', 'loginpress' ), |
| 1903 |
'section' => 'section_footer', |
| 1904 |
'priority' => 10, |
| 1905 |
'settings' => 'loginpress_customization[login_footer_text]', |
| 1906 |
) |
| 1907 |
); |
| 1908 |
|
| 1909 |
$wp_customize->add_setting( |
| 1910 |
'loginpress_customization[login_footer_text_decoration]', |
| 1911 |
array( |
| 1912 |
'default' => 'none', |
| 1913 |
'type' => 'option', |
| 1914 |
'capability' => 'manage_options', |
| 1915 |
'transport' => 'postMessage', |
| 1916 |
'sanitize_callback' => 'loginpress_sanitize_select', |
| 1917 |
) |
| 1918 |
); |
| 1919 |
|
| 1920 |
$wp_customize->add_control( |
| 1921 |
'loginpress_customization[login_footer_text_decoration]', |
| 1922 |
array( |
| 1923 |
'settings' => 'loginpress_customization[login_footer_text_decoration]', |
| 1924 |
'label' => __( 'Select Text Decoration:', 'loginpress' ), |
| 1925 |
'section' => 'section_footer', |
| 1926 |
'priority' => 15, |
| 1927 |
'type' => 'select', |
| 1928 |
'choices' => array( |
| 1929 |
'none' => 'none', |
| 1930 |
'overline' => 'overline', |
| 1931 |
'line-through' => 'line-through', |
| 1932 |
'underline' => 'underline', |
| 1933 |
), |
| 1934 |
) |
| 1935 |
); |
| 1936 |
|
| 1937 |
$wp_customize->add_setting( |
| 1938 |
'loginpress_customization[login_footer_color]', |
| 1939 |
array( |
| 1940 |
// 'default' => '#17a8e3', |
| 1941 |
'type' => 'option', |
| 1942 |
'capability' => 'manage_options', |
| 1943 |
'transport' => 'postMessage', |
| 1944 |
'sanitize_callback' => 'sanitize_text_field', // validates 3 or 6 digit HTML hex color code. |
| 1945 |
) |
| 1946 |
); |
| 1947 |
|
| 1948 |
$wp_customize->add_control( |
| 1949 |
new LoginPress_Color_Picker_Alpha( |
| 1950 |
$wp_customize, |
| 1951 |
'loginpress_customization[login_footer_color]', |
| 1952 |
array( |
| 1953 |
'label' => __( 'Footer Text Color:', 'loginpress' ), |
| 1954 |
'section' => 'section_footer', |
| 1955 |
'priority' => 20, |
| 1956 |
'settings' => 'loginpress_customization[login_footer_color]', |
| 1957 |
'input_attrs' => array( |
| 1958 |
'name' => 'loginpress_customization[login_footer_color]', |
| 1959 |
'data-alpha-enabled' => 'true', |
| 1960 |
), |
| 1961 |
) |
| 1962 |
) |
| 1963 |
); |
| 1964 |
|
| 1965 |
$wp_customize->add_setting( |
| 1966 |
'loginpress_customization[login_footer_color_hover]', |
| 1967 |
array( |
| 1968 |
// 'default' => '#17a8e3', |
| 1969 |
'type' => 'option', |
| 1970 |
'capability' => 'manage_options', |
| 1971 |
'transport' => 'postMessage', |
| 1972 |
'sanitize_callback' => 'sanitize_text_field', // validates 3 or 6 digit HTML hex color code. |
| 1973 |
) |
| 1974 |
); |
| 1975 |
|
| 1976 |
$wp_customize->add_control( |
| 1977 |
new LoginPress_Color_Picker_Alpha( |
| 1978 |
$wp_customize, |
| 1979 |
'loginpress_customization[login_footer_color_hover]', |
| 1980 |
array( |
| 1981 |
'label' => __( 'Footer Text Hover Color:', 'loginpress' ), |
| 1982 |
'section' => 'section_footer', |
| 1983 |
'priority' => 25, |
| 1984 |
'settings' => 'loginpress_customization[login_footer_color_hover]', |
| 1985 |
'input_attrs' => array( |
| 1986 |
'name' => 'loginpress_customization[login_footer_color_hover]', |
| 1987 |
'data-alpha-enabled' => 'true', |
| 1988 |
), |
| 1989 |
) |
| 1990 |
) |
| 1991 |
); |
| 1992 |
|
| 1993 |
$wp_customize->add_setting( |
| 1994 |
'loginpress_customization[login_footer_font_size]', |
| 1995 |
array( |
| 1996 |
'default' => '13', |
| 1997 |
'type' => 'option', |
| 1998 |
'capability' => 'manage_options', |
| 1999 |
'transport' => 'postMessage', |
| 2000 |
'sanitize_callback' => 'absint', |
| 2001 |
) |
| 2002 |
); |
| 2003 |
|
| 2004 |
/** |
| 2005 |
* [ Change login_footer_font_size Input fields with LoginPress_Range_Control ] |
| 2006 |
* |
| 2007 |
* @since 1.0.1 |
| 2008 |
* @version 1.0.23 |
| 2009 |
*/ |
| 2010 |
$wp_customize->add_control( |
| 2011 |
new LoginPress_Range_Control( |
| 2012 |
$wp_customize, |
| 2013 |
'loginpress_customization[login_footer_font_size]', |
| 2014 |
array( |
| 2015 |
'type' => 'loginpress-range', |
| 2016 |
'label' => __( 'Text Font Size:', 'loginpress' ), |
| 2017 |
'section' => 'section_footer', |
| 2018 |
'settings' => 'loginpress_customization[login_footer_font_size]', |
| 2019 |
'default' => '13', |
| 2020 |
'priority' => 30, |
| 2021 |
'input_attrs' => array( |
| 2022 |
'min' => 0, |
| 2023 |
'max' => 100, |
| 2024 |
'step' => 1, |
| 2025 |
'suffix' => 'px', |
| 2026 |
), |
| 2027 |
) |
| 2028 |
) |
| 2029 |
); |
| 2030 |
|
| 2031 |
$wp_customize->add_setting( |
| 2032 |
'loginpress_customization[login_footer_bg_color]', |
| 2033 |
array( |
| 2034 |
// 'default' => '#17a8e3', |
| 2035 |
'type' => 'option', |
| 2036 |
'capability' => 'manage_options', |
| 2037 |
'transport' => 'postMessage', |
| 2038 |
'sanitize_callback' => 'sanitize_text_field', // validates 3 or 6 digit HTML hex color code. |
| 2039 |
) |
| 2040 |
); |
| 2041 |
|
| 2042 |
$wp_customize->add_control( |
| 2043 |
new LoginPress_Color_Picker_Alpha( |
| 2044 |
$wp_customize, |
| 2045 |
'loginpress_customization[login_footer_bg_color]', |
| 2046 |
array( |
| 2047 |
'label' => __( 'Footer Background Color:', 'loginpress' ), |
| 2048 |
'section' => 'section_footer', |
| 2049 |
'priority' => 35, |
| 2050 |
'settings' => 'loginpress_customization[login_footer_bg_color]', |
| 2051 |
'input_attrs' => array( |
| 2052 |
'name' => 'loginpress_customization[login_footer_bg_color]', |
| 2053 |
'data-alpha-enabled' => 'true', |
| 2054 |
), |
| 2055 |
) |
| 2056 |
) |
| 2057 |
); |
| 2058 |
|
| 2059 |
$this->loginpress_hr_setting( $wp_customize, $close_control, 'section_footer', 0, 36 ); |
| 2060 |
|
| 2061 |
$this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_footer', 4, 40 ); |
| 2062 |
|
| 2063 |
$wp_customize->add_setting( |
| 2064 |
'loginpress_customization[back_display_text]', |
| 2065 |
array( |
| 2066 |
'default' => true, |
| 2067 |
'type' => 'option', |
| 2068 |
'capability' => 'manage_options', |
| 2069 |
'transport' => 'postMessage', |
| 2070 |
'sanitize_callback' => 'loginpress_sanitize_checkbox', |
| 2071 |
) |
| 2072 |
); |
| 2073 |
|
| 2074 |
/** |
| 2075 |
* [Enable / Disable Footer Text with LoginPress_Radio_Control] |
| 2076 |
* |
| 2077 |
* @since 1.0.1 |
| 2078 |
* @version 1.0.23 |
| 2079 |
*/ |
| 2080 |
$wp_customize->add_control( |
| 2081 |
new LoginPress_Radio_Control( |
| 2082 |
$wp_customize, |
| 2083 |
'loginpress_customization[back_display_text]', |
| 2084 |
array( |
| 2085 |
'settings' => 'loginpress_customization[back_display_text]', |
| 2086 |
'label' => __( 'Enable "Back to" Text:', 'loginpress' ), |
| 2087 |
'section' => 'section_footer', |
| 2088 |
'priority' => 45, |
| 2089 |
'type' => 'ios', // light, ios, flat |
| 2090 |
) |
| 2091 |
) |
| 2092 |
); |
| 2093 |
|
| 2094 |
$wp_customize->add_setting( |
| 2095 |
'loginpress_customization[login_back_text_decoration]', |
| 2096 |
array( |
| 2097 |
'default' => 'none', |
| 2098 |
'type' => 'option', |
| 2099 |
'capability' => 'manage_options', |
| 2100 |
'transport' => 'postMessage', |
| 2101 |
'sanitize_callback' => 'loginpress_sanitize_select', |
| 2102 |
|
| 2103 |
) |
| 2104 |
); |
| 2105 |
|
| 2106 |
$wp_customize->add_control( |
| 2107 |
'loginpress_customization[login_back_text_decoration]', |
| 2108 |
array( |
| 2109 |
'settings' => 'loginpress_customization[login_back_text_decoration]', |
| 2110 |
'label' => __( '"Back to" Text Decoration:', 'loginpress' ), |
| 2111 |
'section' => 'section_footer', |
| 2112 |
'priority' => 50, |
| 2113 |
'type' => 'select', |
| 2114 |
'choices' => array( |
| 2115 |
'none' => 'none', |
| 2116 |
'overline' => 'overline', |
| 2117 |
'line-through' => 'line-through', |
| 2118 |
'underline' => 'underline', |
| 2119 |
), |
| 2120 |
) |
| 2121 |
); |
| 2122 |
|
| 2123 |
$wp_customize->add_setting( |
| 2124 |
'loginpress_customization[login_back_color]', |
| 2125 |
array( |
| 2126 |
// 'default' => '#17a8e3', |
| 2127 |
'type' => 'option', |
| 2128 |
'capability' => 'manage_options', |
| 2129 |
'transport' => 'postMessage', |
| 2130 |
'sanitize_callback' => 'sanitize_text_field', // validates 3 or 6 digit HTML hex color code. |
| 2131 |
) |
| 2132 |
); |
| 2133 |
|
| 2134 |
$wp_customize->add_control( |
| 2135 |
new LoginPress_Color_Picker_Alpha( |
| 2136 |
$wp_customize, |
| 2137 |
'loginpress_customization[login_back_color]', |
| 2138 |
array( |
| 2139 |
'label' => __( '"Back to" Text Color:', 'loginpress' ), |
| 2140 |
'section' => 'section_footer', |
| 2141 |
'priority' => 55, |
| 2142 |
'settings' => 'loginpress_customization[login_back_color]', |
| 2143 |
'input_attrs' => array( |
| 2144 |
'name' => 'loginpress_customization[login_back_color]', |
| 2145 |
'data-alpha-enabled' => 'true', |
| 2146 |
), |
| 2147 |
) |
| 2148 |
) |
| 2149 |
); |
| 2150 |
|
| 2151 |
$wp_customize->add_setting( |
| 2152 |
'loginpress_customization[login_back_color_hover]', |
| 2153 |
array( |
| 2154 |
// 'default' => '#17a8e3', |
| 2155 |
'type' => 'option', |
| 2156 |
'capability' => 'manage_options', |
| 2157 |
'transport' => 'postMessage', |
| 2158 |
'sanitize_callback' => 'sanitize_text_field', // validates 3 or 6 digit HTML hex color code. |
| 2159 |
) |
| 2160 |
); |
| 2161 |
|
| 2162 |
$wp_customize->add_control( |
| 2163 |
new LoginPress_Color_Picker_Alpha( |
| 2164 |
$wp_customize, |
| 2165 |
'loginpress_customization[login_back_color_hover]', |
| 2166 |
array( |
| 2167 |
'label' => __( '"Back to" Text Hover Color:', 'loginpress' ), |
| 2168 |
'section' => 'section_footer', |
| 2169 |
'priority' => 60, |
| 2170 |
'settings' => 'loginpress_customization[login_back_color_hover]', |
| 2171 |
'input_attrs' => array( |
| 2172 |
'name' => 'loginpress_customization[login_back_color_hover]', |
| 2173 |
'data-alpha-enabled' => 'true', |
| 2174 |
), |
| 2175 |
) |
| 2176 |
) |
| 2177 |
); |
| 2178 |
|
| 2179 |
$wp_customize->add_setting( |
| 2180 |
'loginpress_customization[login_back_font_size]', |
| 2181 |
array( |
| 2182 |
'default' => '13', |
| 2183 |
'type' => 'option', |
| 2184 |
'capability' => 'manage_options', |
| 2185 |
'transport' => 'postMessage', |
| 2186 |
'sanitize_callback' => 'absint', |
| 2187 |
) |
| 2188 |
); |
| 2189 |
$wp_customize->add_setting( |
| 2190 |
'loginpress_customization[loginpress_show_love]', |
| 2191 |
array( |
| 2192 |
'default' => true, |
| 2193 |
'type' => 'option', |
| 2194 |
'capability' => 'manage_options', |
| 2195 |
'transport' => 'postMessage', |
| 2196 |
'sanitize_callback' => 'loginpress_sanitize_checkbox', |
| 2197 |
) |
| 2198 |
); |
| 2199 |
|
| 2200 |
/** |
| 2201 |
* [ Change login_back_font_size Input fields with LoginPress_Range_Control ] |
| 2202 |
* |
| 2203 |
* @since 1.0.1 |
| 2204 |
* @version 1.0.23 |
| 2205 |
*/ |
| 2206 |
$wp_customize->add_control( |
| 2207 |
new LoginPress_Range_Control( |
| 2208 |
$wp_customize, |
| 2209 |
'loginpress_customization[login_back_font_size]', |
| 2210 |
array( |
| 2211 |
'type' => 'loginpress-range', |
| 2212 |
'label' => __( '"Back to" Text Font Size:', 'loginpress' ), |
| 2213 |
'section' => 'section_footer', |
| 2214 |
'settings' => 'loginpress_customization[login_back_font_size]', |
| 2215 |
'default' => '13', |
| 2216 |
'priority' => 65, |
| 2217 |
'input_attrs' => array( |
| 2218 |
'min' => 0, |
| 2219 |
'max' => 100, |
| 2220 |
'step' => 1, |
| 2221 |
'suffix' => 'px', |
| 2222 |
), |
| 2223 |
) |
| 2224 |
) |
| 2225 |
); |
| 2226 |
|
| 2227 |
$wp_customize->add_setting( |
| 2228 |
'loginpress_customization[login_back_bg_color]', |
| 2229 |
array( |
| 2230 |
// 'default' => '#17a8e3', |
| 2231 |
'type' => 'option', |
| 2232 |
'capability' => 'manage_options', |
| 2233 |
'transport' => 'postMessage', |
| 2234 |
'sanitize_callback' => 'sanitize_text_field', // validates 3 or 6 digit HTML hex color code. |
| 2235 |
) |
| 2236 |
); |
| 2237 |
|
| 2238 |
$wp_customize->add_control( |
| 2239 |
new LoginPress_Color_Picker_Alpha( |
| 2240 |
$wp_customize, |
| 2241 |
'loginpress_customization[login_back_bg_color]', |
| 2242 |
array( |
| 2243 |
'label' => __( '"Back to" Background Color:', 'loginpress' ), |
| 2244 |
'section' => 'section_footer', |
| 2245 |
'priority' => 70, |
| 2246 |
'settings' => 'loginpress_customization[login_back_bg_color]', |
| 2247 |
'input_attrs' => array( |
| 2248 |
'name' => 'loginpress_customization[login_back_bg_color]', |
| 2249 |
'data-alpha-enabled' => 'true', |
| 2250 |
), |
| 2251 |
) |
| 2252 |
) |
| 2253 |
); |
| 2254 |
|
| 2255 |
$this->loginpress_hr_setting( $wp_customize, $close_control, 'section_footer', 1, 71 ); |
| 2256 |
|
| 2257 |
$this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_footer', 5, 72 ); |
| 2258 |
|
| 2259 |
/** |
| 2260 |
* [Enable / Disable Footer Text with LoginPress_Radio_Control] |
| 2261 |
* |
| 2262 |
* @since 1.1.3 |
| 2263 |
*/ |
| 2264 |
$wp_customize->add_setting( |
| 2265 |
'loginpress_customization[login_copy_right_display]', |
| 2266 |
array( |
| 2267 |
'default' => false, |
| 2268 |
'type' => 'option', |
| 2269 |
'capability' => 'manage_options', |
| 2270 |
'transport' => 'postMessage', |
| 2271 |
'sanitize_callback' => 'loginpress_sanitize_checkbox', |
| 2272 |
) |
| 2273 |
); |
| 2274 |
$wp_customize->add_control( |
| 2275 |
new LoginPress_Radio_Control( |
| 2276 |
$wp_customize, |
| 2277 |
'loginpress_customization[login_copy_right_display]', |
| 2278 |
array( |
| 2279 |
'settings' => 'loginpress_customization[login_copy_right_display]', |
| 2280 |
'section' => 'section_footer', |
| 2281 |
'priority' => 73, |
| 2282 |
'type' => 'ios', // light, ios, flat |
| 2283 |
'label' => __( 'Enable Copyright Note:', 'loginpress' ), |
| 2284 |
) |
| 2285 |
) |
| 2286 |
); |
| 2287 |
|
| 2288 |
$wp_customize->add_setting( |
| 2289 |
'loginpress_customization[copyright_background_color]', |
| 2290 |
array( |
| 2291 |
'default' => '#efefef', |
| 2292 |
'type' => 'option', |
| 2293 |
'capability' => 'manage_options', |
| 2294 |
'transport' => 'postMessage', |
| 2295 |
'sanitize_callback' => 'sanitize_text_field', |
| 2296 |
) |
| 2297 |
); |
| 2298 |
|
| 2299 |
$wp_customize->add_control( |
| 2300 |
new LoginPress_Color_Picker_Alpha( |
| 2301 |
$wp_customize, |
| 2302 |
'loginpress_customization[copyright_background_color]', |
| 2303 |
array( |
| 2304 |
'label' => __( '"Copyright" Background Color:', 'loginpress' ), |
| 2305 |
'section' => 'section_footer', |
| 2306 |
'priority' => 74, |
| 2307 |
'settings' => 'loginpress_customization[copyright_background_color]', |
| 2308 |
'input_attrs' => array( |
| 2309 |
'name' => 'loginpress_customization[copyright_background_color]', |
| 2310 |
'data-alpha-enabled' => 'true', |
| 2311 |
), |
| 2312 |
) |
| 2313 |
) |
| 2314 |
); |
| 2315 |
|
| 2316 |
// Form Footer Text Color |
| 2317 |
$wp_customize->add_setting( |
| 2318 |
'loginpress_customization[copyright_text_color]', |
| 2319 |
array( |
| 2320 |
'default' => '#000000', |
| 2321 |
'type' => 'option', |
| 2322 |
'capability' => 'manage_options', |
| 2323 |
'transport' => 'postMessage', |
| 2324 |
'sanitize_callback' => 'sanitize_text_field', |
| 2325 |
) |
| 2326 |
); |
| 2327 |
|
| 2328 |
$wp_customize->add_control( |
| 2329 |
new LoginPress_Color_Picker_Alpha( |
| 2330 |
$wp_customize, |
| 2331 |
'loginpress_customization[copyright_text_color]', |
| 2332 |
array( |
| 2333 |
'label' => __( '"Copyright" Text Color:', 'loginpress' ), |
| 2334 |
'section' => 'section_footer', |
| 2335 |
'priority' => 75, |
| 2336 |
'settings' => 'loginpress_customization[copyright_text_color]', |
| 2337 |
'input_attrs' => array( |
| 2338 |
'name' => 'loginpress_customization[copyright_text_color]', |
| 2339 |
'data-alpha-enabled' => 'true', |
| 2340 |
), |
| 2341 |
) |
| 2342 |
) |
| 2343 |
); |
| 2344 |
|
| 2345 |
$wp_customize->add_setting( |
| 2346 |
'loginpress_customization[login_footer_copy_right]', |
| 2347 |
array( |
| 2348 |
'default' => sprintf( |
| 2349 |
// translators: Rights Reserved |
| 2350 |
__( '© %1$s %2$s, All Rights Reserved.', 'loginpress' ), |
| 2351 |
date( 'Y' ), |
| 2352 |
get_bloginfo( 'name' ) |
| 2353 |
), |
| 2354 |
'type' => 'option', |
| 2355 |
'capability' => 'manage_options', |
| 2356 |
'transport' => 'postMessage', |
| 2357 |
'sanitize_callback' => 'wp_kses_post', |
| 2358 |
) |
| 2359 |
); |
| 2360 |
|
| 2361 |
// Show Some Love text Color |
| 2362 |
// $wp_customize->add_setting( 'loginpress_customization[show_some_love_text_color]', array( |
| 2363 |
// 'default' => '#17a8e3', |
| 2364 |
// 'type' => 'option', |
| 2365 |
// 'capability' => 'manage_options', |
| 2366 |
// 'transport' => 'postMessage', |
| 2367 |
// 'sanitize_callback' => 'sanitize_hex_color' // validates 3 or 6 digit HTML hex color code. |
| 2368 |
// ) ); |
| 2369 |
|
| 2370 |
// $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'loginpress_customization[show_some_love_text_color]', array( |
| 2371 |
// 'label' => __( '"Show Some Love" Text Color:', 'loginpress' ), |
| 2372 |
// 'section' => 'section_footer', |
| 2373 |
// 'priority' => 76, |
| 2374 |
// 'settings' => 'loginpress_customization[show_some_love_text_color]' |
| 2375 |
// ) ) ); |
| 2376 |
|
| 2377 |
/** |
| 2378 |
* [Add Copyright string in the footer along with year] |
| 2379 |
* |
| 2380 |
* @version 1.5.4 |
| 2381 |
*/ |
| 2382 |
$wp_customize->add_setting( |
| 2383 |
'loginpress_customization[login_footer_copy_right]', |
| 2384 |
array( |
| 2385 |
'default' => sprintf( |
| 2386 |
// translators: Rights Reserved |
| 2387 |
__( '© %1$s %2$s, All Rights Reserved.', 'loginpress' ), |
| 2388 |
'$YEAR$', |
| 2389 |
get_bloginfo( 'name' ) |
| 2390 |
), |
| 2391 |
'type' => 'option', |
| 2392 |
'capability' => 'manage_options', |
| 2393 |
'transport' => 'postMessage', |
| 2394 |
'sanitize_callback' => 'wp_kses_post', |
| 2395 |
) |
| 2396 |
); |
| 2397 |
$wp_customize->add_control( |
| 2398 |
'loginpress_customization[login_footer_copy_right]', |
| 2399 |
array( |
| 2400 |
'label' => __( 'Copyright Note:', 'loginpress' ), |
| 2401 |
'description' => sprintf( |
| 2402 |
// translators: Copyright Note |
| 2403 |
__( '%1$s will be replaced with the current year.', 'loginpress' ), |
| 2404 |
'<code>$YEAR$</code>' |
| 2405 |
), |
| 2406 |
'type' => 'textarea', |
| 2407 |
'section' => 'section_footer', |
| 2408 |
'priority' => 77, |
| 2409 |
'settings' => 'loginpress_customization[login_footer_copy_right]', |
| 2410 |
) |
| 2411 |
); |
| 2412 |
|
| 2413 |
/** |
| 2414 |
* [Enable / Disable Footer Text with LoginPress_Radio_Control] |
| 2415 |
* |
| 2416 |
* @since 1.0.1 |
| 2417 |
* @version 1.0.23 |
| 2418 |
*/ |
| 2419 |
$wp_customize->add_control( |
| 2420 |
new LoginPress_Radio_Control( |
| 2421 |
$wp_customize, |
| 2422 |
'loginpress_customization[loginpress_show_love]', |
| 2423 |
array( |
| 2424 |
'settings' => 'loginpress_customization[loginpress_show_love]', |
| 2425 |
'section' => 'section_footer', |
| 2426 |
'priority' => 80, |
| 2427 |
'type' => 'ios', // light, ios, flat |
| 2428 |
'label' => __( 'Show some Love. Please help others learn about this free plugin by placing small link in footer. Thank you very much!', 'loginpress' ), |
| 2429 |
) |
| 2430 |
) |
| 2431 |
); |
| 2432 |
|
| 2433 |
/** |
| 2434 |
* [Love position on footer.] |
| 2435 |
* |
| 2436 |
* @since 1.1.3 |
| 2437 |
*/ |
| 2438 |
$wp_customize->add_setting( |
| 2439 |
'loginpress_customization[show_love_position]', |
| 2440 |
array( |
| 2441 |
'default' => 'right', |
| 2442 |
'type' => 'option', |
| 2443 |
'capability' => 'manage_options', |
| 2444 |
'transport' => 'postMessage', |
| 2445 |
// 'sanitize_callback' => 'loginpress_sanitize_checkbox' |
| 2446 |
) |
| 2447 |
); |
| 2448 |
|
| 2449 |
$wp_customize->add_control( |
| 2450 |
'loginpress_customization[show_love_position]', |
| 2451 |
array( |
| 2452 |
'label' => __( 'Love Position:', 'loginpress' ), |
| 2453 |
'section' => 'section_footer', |
| 2454 |
'priority' => 85, |
| 2455 |
'settings' => 'loginpress_customization[show_love_position]', |
| 2456 |
'type' => 'radio', |
| 2457 |
'choices' => array( |
| 2458 |
'left' => __( 'Left', 'loginpress' ), |
| 2459 |
'right' => __( 'Right', 'loginpress' ), |
| 2460 |
), |
| 2461 |
) |
| 2462 |
); |
| 2463 |
$this->loginpress_hr_setting( $wp_customize, $close_control, 'section_footer', 2, 90 ); |
| 2464 |
// $this->loginpress_group_setting( $wp_customize, $group_control, $group_label, $group_info, 'section_footer', 2, 90 ); |
| 2465 |
|
| 2466 |
// ============================= |
| 2467 |
// = Section for Custom CSS/JS = |
| 2468 |
// ============================= |
| 2469 |
$wp_customize->add_section( |
| 2470 |
'loginpress_custom_css_js', |
| 2471 |
array( |
| 2472 |
'title' => __( 'Custom CSS/JS', 'loginpress' ), |
| 2473 |
'description' => '', |
| 2474 |
'priority' => 50, |
| 2475 |
'panel' => 'loginpress_panel', |
| 2476 |
) |
| 2477 |
); |
| 2478 |
|
| 2479 |
$wp_customize->add_setting( |
| 2480 |
'loginpress_customization[loginpress_custom_css]', |
| 2481 |
array( |
| 2482 |
'type' => 'option', |
| 2483 |
'capability' => 'manage_options', |
| 2484 |
'transport' => 'postMessage', |
| 2485 |
) |
| 2486 |
); |
| 2487 |
|
| 2488 |
$wp_customize->add_control( |
| 2489 |
'loginpress_customization[loginpress_custom_css]', |
| 2490 |
array( |
| 2491 |
'label' => __( 'Customize CSS:', 'loginpress' ), |
| 2492 |
'type' => 'textarea', |
| 2493 |
'section' => 'loginpress_custom_css_js', |
| 2494 |
'priority' => 5, |
| 2495 |
'settings' => 'loginpress_customization[loginpress_custom_css]', |
| 2496 |
'description' => sprintf( |
| 2497 |
// translators: Customize CSS |
| 2498 |
__( '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' ), |
| 2499 |
'<a href="' . wp_login_url() . '"title="Login" target="_blank">', |
| 2500 |
'</a>' |
| 2501 |
), |
| 2502 |
) |
| 2503 |
); |
| 2504 |
|
| 2505 |
$wp_customize->add_setting( |
| 2506 |
'loginpress_customization[loginpress_custom_js]', |
| 2507 |
array( |
| 2508 |
'type' => 'option', |
| 2509 |
'capability' => 'manage_options', |
| 2510 |
'transport' => 'postMessage', |
| 2511 |
) |
| 2512 |
); |
| 2513 |
|
| 2514 |
$wp_customize->add_control( |
| 2515 |
'loginpress_customization[loginpress_custom_js]', |
| 2516 |
array( |
| 2517 |
'label' => __( 'Customize JS:', 'loginpress' ), |
| 2518 |
'type' => 'textarea', |
| 2519 |
'section' => 'loginpress_custom_css_js', |
| 2520 |
'priority' => 10, |
| 2521 |
'settings' => 'loginpress_customization[loginpress_custom_js]', |
| 2522 |
'description' => sprintf( |
| 2523 |
// translators: Customize JS |
| 2524 |
__( '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' ), |
| 2525 |
'<a href="' . wp_login_url() . '"title="Login" target="_blank">', |
| 2526 |
'</a>' |
| 2527 |
), |
| 2528 |
) |
| 2529 |
); |
| 2530 |
} |
| 2531 |
|
| 2532 |
/** |
| 2533 |
* Manage the Login Footer Links. |
| 2534 |
* |
| 2535 |
* @since 1.0.0 |
| 2536 |
* @version 3.0.0 |
| 2537 |
*/ |
| 2538 |
public function login_page_custom_footer() { |
| 2539 |
|
| 2540 |
/** |
| 2541 |
* Add brand position class. |
| 2542 |
* |
| 2543 |
* @since 1.1.3 |
| 2544 |
* @version 3.0.0 |
| 2545 |
*/ |
| 2546 |
$position = ''; // Empty variable for storing position class. |
| 2547 |
if ( $this->loginpress_key ) { |
| 2548 |
if ( isset( $this->loginpress_key['show_love_position'] ) && $this->loginpress_key['show_love_position'] == 'left' ) { |
| 2549 |
$position = ' love-position'; |
| 2550 |
} |
| 2551 |
} |
| 2552 |
|
| 2553 |
/** |
| 2554 |
* Add functionality of disabling the templates of LoginPress. |
| 2555 |
* |
| 2556 |
* @since 1.6.4 |
| 2557 |
*/ |
| 2558 |
$disable_default_style = (bool) apply_filters( 'loginpress_disable_default_style', false ); |
| 2559 |
|
| 2560 |
if ( $this->loginpress_preset === 'default1' && $disable_default_style ) { |
| 2561 |
include LOGINPRESS_DIR_PATH . 'include/login-footer.php'; |
| 2562 |
} |
| 2563 |
|
| 2564 |
if ( empty( $this->loginpress_key ) || ( isset( $this->loginpress_key['loginpress_show_love'] ) && $this->loginpress_key['loginpress_show_love'] != '' ) ) { |
| 2565 |
echo '<div class="loginpress-show-love' . $position . '">' . __( 'Powered by:', 'loginpress' ) . ' <a href="https://wpbrigade.com" target="_blank">LoginPress</a></div>'; |
| 2566 |
} |
| 2567 |
|
| 2568 |
echo '<div class="footer-wrapper">'; |
| 2569 |
echo '<div class="footer-cont">'; |
| 2570 |
|
| 2571 |
if ( $this->loginpress_key ) { |
| 2572 |
// do_action( 'loginpress_footer_wrapper' ); |
| 2573 |
do_action( 'loginpress_footer_menu' ); |
| 2574 |
|
| 2575 |
if ( array_key_exists( 'login_copy_right_display', $this->loginpress_key ) && true == $this->loginpress_key['login_copy_right_display'] ) { |
| 2576 |
|
| 2577 |
/** |
| 2578 |
* Replace the "$YEAR$" with current year if and where found. |
| 2579 |
* |
| 2580 |
* @since 1.5.4 |
| 2581 |
*/ |
| 2582 |
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 ) { |
| 2583 |
$year = date( 'Y' ); |
| 2584 |
// Setting the value with current year and saving in the 'login_footer_copy_right' key |
| 2585 |
$this->loginpress_key['login_footer_copy_right'] = str_replace( '$YEAR$', $year, $this->loginpress_key['login_footer_copy_right'] ); |
| 2586 |
} |
| 2587 |
|
| 2588 |
// Show a default value if not changed or show the changed text string for 'login_footer_copy_right' |
| 2589 |
$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( |
| 2590 |
// translators: Rights Reserved |
| 2591 |
__( '© %1$s %2$s, All Rights Reserved.', 'loginpress' ), |
| 2592 |
date( 'Y' ), |
| 2593 |
get_bloginfo( 'name' ) |
| 2594 |
); |
| 2595 |
|
| 2596 |
echo '<div class="copyRight">' . apply_filters( 'loginpress_footer_copyright', $footer_text ) . '</div>'; |
| 2597 |
} |
| 2598 |
} |
| 2599 |
echo '</div></div>'; |
| 2600 |
|
| 2601 |
/** |
| 2602 |
* Include LoginPress script in footer. |
| 2603 |
* |
| 2604 |
* @since 1.2.2 |
| 2605 |
*/ |
| 2606 |
include LOGINPRESS_DIR_PATH . 'js/script-login.php'; |
| 2607 |
} |
| 2608 |
|
| 2609 |
/** |
| 2610 |
* Manage the Login Head |
| 2611 |
* |
| 2612 |
* @since 1.0.0 |
| 2613 |
* @version 6.0.0 |
| 2614 |
*/ |
| 2615 |
public function login_page_custom_head() { |
| 2616 |
|
| 2617 |
add_filter( 'gettext', array( $this, 'change_lostpassword_message' ), 20, 3 ); |
| 2618 |
add_filter( 'gettext', array( $this, 'change_username_label' ), 20, 3 ); |
| 2619 |
// add_filter( 'gettext', array( $this, 'change_password_label' ), 20, 3 ); |
| 2620 |
// Include CSS File in header. |
| 2621 |
if ( isset( $this->loginpress_key['loginpress_custom_js'] ) && ! empty( $this->loginpress_key['loginpress_custom_js'] ) ) { // 1.2.2 |
| 2622 |
wp_enqueue_script( 'jquery' ); |
| 2623 |
} |
| 2624 |
|
| 2625 |
/** |
| 2626 |
* Add functionality of disabling the templates of LoginPress. |
| 2627 |
* |
| 2628 |
* @since 1.6.4 |
| 2629 |
*/ |
| 2630 |
$disable_default_style = (bool) apply_filters( 'loginpress_disable_default_style', false ); |
| 2631 |
|
| 2632 |
if ( ! $disable_default_style || 'default1' !== $this->loginpress_preset ) { |
| 2633 |
include LOGINPRESS_DIR_PATH . 'css/style-presets.php'; |
| 2634 |
include_once LOGINPRESS_DIR_PATH . 'css/style-login.php'; |
| 2635 |
} |
| 2636 |
|
| 2637 |
do_action( 'loginpress_header_menu' ); |
| 2638 |
// do_action( 'loginpress_header_wrapper' ); |
| 2639 |
|
| 2640 |
/** |
| 2641 |
* Filter for changing the lost password URL of lifter LMS plugin to default Lost Password URL of WordPress |
| 2642 |
* By using this filter, you can prevent the redirection of lost password to Lifter LMS's lost password page over lost password link. |
| 2643 |
* |
| 2644 |
* @param bool |
| 2645 |
* |
| 2646 |
* @since 1.5.3 |
| 2647 |
*/ |
| 2648 |
if ( apply_filters( 'loginpress_llms_lostpassword_url', false ) ) { |
| 2649 |
remove_filter( 'lostpassword_url', 'llms_lostpassword_url', 10 ); |
| 2650 |
} |
| 2651 |
|
| 2652 |
if ( ! has_site_icon() && ! is_customize_preview() ) { |
| 2653 |
$login_favicon = isset( $this->loginpress_key['login_favicon'] ) ? $this->loginpress_key['login_favicon'] : 'off'; |
| 2654 |
|
| 2655 |
if ( 'off' != $login_favicon && function_exists( 'login_header' ) ) { |
| 2656 |
echo '<link rel="shortcut icon" href="' . $login_favicon . '" />'; |
| 2657 |
} |
| 2658 |
} |
| 2659 |
} |
| 2660 |
|
| 2661 |
/** |
| 2662 |
* Redirecting the WooCommerce lost password url to default WP lost password url. |
| 2663 |
* |
| 2664 |
* @since 3.0.8 |
| 2665 |
*/ |
| 2666 |
function loginpress_wc_login_page_url_redirection() { |
| 2667 |
|
| 2668 |
$loginpress_setting = get_option( 'loginpress_setting' ); |
| 2669 |
$lostpassword_url = isset( $loginpress_setting['lostpassword_url'] ) ? $loginpress_setting['lostpassword_url'] : 'off'; |
| 2670 |
|
| 2671 |
if ( 'on' == $lostpassword_url ) { |
| 2672 |
remove_filter( 'lostpassword_url', 'wc_lostpassword_url', 10 ); |
| 2673 |
} |
| 2674 |
} |
| 2675 |
|
| 2676 |
/** |
| 2677 |
* Filters the Languages select input activation on the login screen. |
| 2678 |
* |
| 2679 |
* @param bool $arg Whether to display the Languages select input on the login screen. |
| 2680 |
* |
| 2681 |
* @since 1.5.11 |
| 2682 |
* @version 6.0.0 |
| 2683 |
* @return bool |
| 2684 |
*/ |
| 2685 |
function loginpress_language_switch( $arg ) { |
| 2686 |
|
| 2687 |
$language_switcher = isset( $this->loginpress_settings['enable_language_switcher'] ) ? $this->loginpress_settings['enable_language_switcher'] : 'off'; |
| 2688 |
|
| 2689 |
if ( 'off' === $language_switcher ) { |
| 2690 |
return true; |
| 2691 |
} else { |
| 2692 |
return false; |
| 2693 |
} |
| 2694 |
} |
| 2695 |
|
| 2696 |
/** |
| 2697 |
* Set Redirect Path of Logo |
| 2698 |
* |
| 2699 |
* @since 1.0.0 |
| 2700 |
* @version 1.5.3 |
| 2701 |
*/ |
| 2702 |
public function login_page_logo_url() { |
| 2703 |
|
| 2704 |
if ( $this->loginpress_key && array_key_exists( 'customize_logo_hover', $this->loginpress_key ) && ! empty( $this->loginpress_key['customize_logo_hover'] ) ) { |
| 2705 |
return __( $this->loginpress_key['customize_logo_hover'], 'loginpress' ); // @codingStandardsIgnoreLine. |
| 2706 |
} else { |
| 2707 |
return home_url(); |
| 2708 |
} |
| 2709 |
} |
| 2710 |
|
| 2711 |
/** |
| 2712 |
* Remove the filter login_errors from woocommerce login form. |
| 2713 |
* |
| 2714 |
* @since 1.0.16 |
| 2715 |
* |
| 2716 |
* @return errors |
| 2717 |
*/ |
| 2718 |
function loginpress_woo_login_errors( $validation_error, $arg1, $arg2 ) { |
| 2719 |
|
| 2720 |
remove_filter( 'login_errors', array( $this, 'login_error_messages' ) ); |
| 2721 |
return $validation_error; |
| 2722 |
} |
| 2723 |
|
| 2724 |
|
| 2725 |
/** |
| 2726 |
* Set hover Title of Logo |
| 2727 |
* |
| 2728 |
* @since 1.0.0 |
| 2729 |
* @version 1.5.3 |
| 2730 |
* |
| 2731 |
* @return mixed |
| 2732 |
*/ |
| 2733 |
public function login_page_logo_title() { |
| 2734 |
|
| 2735 |
if ( $this->loginpress_key && array_key_exists( 'customize_logo_hover_title', $this->loginpress_key ) && ! empty( $this->loginpress_key['customize_logo_hover_title'] ) ) { |
| 2736 |
return __( $this->loginpress_key['customize_logo_hover_title'], 'loginpress' ); // @codingStandardsIgnoreLine. |
| 2737 |
} else { |
| 2738 |
return home_url(); |
| 2739 |
} |
| 2740 |
} |
| 2741 |
|
| 2742 |
/** |
| 2743 |
* Set Errors Messages to Show off |
| 2744 |
* |
| 2745 |
* @param $error |
| 2746 |
* @since 1.0.0 |
| 2747 |
* @version 1.2.5 |
| 2748 |
* |
| 2749 |
* @return string |
| 2750 |
*/ |
| 2751 |
public function login_error_messages( $error ) { |
| 2752 |
|
| 2753 |
global $errors; |
| 2754 |
|
| 2755 |
if ( isset( $errors ) && apply_filters( 'loginpress_display_custom_errors', true ) ) { |
| 2756 |
|
| 2757 |
$error_codes = $errors->get_error_codes(); |
| 2758 |
|
| 2759 |
if ( $this->loginpress_key ) { |
| 2760 |
|
| 2761 |
$invalid_username = array_key_exists( 'incorrect_username', $this->loginpress_key ) && ! empty( $this->loginpress_key['incorrect_username'] ) ? $this->loginpress_key['incorrect_username'] : sprintf( |
| 2762 |
// translators: Username not valid |
| 2763 |
__( '%1$sError:%2$s Invalid Username.', 'loginpress' ), |
| 2764 |
'<strong>', |
| 2765 |
'</strong>' |
| 2766 |
); |
| 2767 |
|
| 2768 |
$invalid_password = array_key_exists( 'incorrect_password', $this->loginpress_key ) && ! empty( $this->loginpress_key['incorrect_password'] ) ? $this->loginpress_key['incorrect_password'] : sprintf( |
| 2769 |
// translators: Password not valid |
| 2770 |
__( '%1$sError:%2$s Invalid Password.', 'loginpress' ), |
| 2771 |
'<strong>', |
| 2772 |
'</strong>' |
| 2773 |
); |
| 2774 |
|
| 2775 |
$empty_username = array_key_exists( 'empty_username', $this->loginpress_key ) && ! empty( $this->loginpress_key['empty_username'] ) ? $this->loginpress_key['empty_username'] : sprintf( |
| 2776 |
// translators: Username field empty |
| 2777 |
__( '%1$sError:%2$s The username field is empty.', 'loginpress' ), |
| 2778 |
'<strong>', |
| 2779 |
'</strong>' |
| 2780 |
); |
| 2781 |
|
| 2782 |
$empty_password = array_key_exists( 'empty_password', $this->loginpress_key ) && ! empty( $this->loginpress_key['empty_password'] ) ? $this->loginpress_key['empty_password'] : sprintf( |
| 2783 |
// translators: Password field empty |
| 2784 |
__( '%1$sError:%2$s The password field is empty.', 'loginpress' ), |
| 2785 |
'<strong>', |
| 2786 |
'</strong>' |
| 2787 |
); |
| 2788 |
|
| 2789 |
$invalid_email = array_key_exists( 'invalid_email', $this->loginpress_key ) && ! empty( $this->loginpress_key['invalid_email'] ) ? $this->loginpress_key['invalid_email'] : sprintf( |
| 2790 |
// translators: Incorrect email |
| 2791 |
__( '%1$sError:%2$s The email address isn\'t correct..', 'loginpress' ), |
| 2792 |
'<strong>', |
| 2793 |
'</strong>' |
| 2794 |
); |
| 2795 |
|
| 2796 |
$empty_email = array_key_exists( 'empty_email', $this->loginpress_key ) && ! empty( $this->loginpress_key['empty_email'] ) ? $this->loginpress_key['empty_email'] : sprintf( |
| 2797 |
// translators: Enter email |
| 2798 |
__( '%1$sError:%2$s Please type your email address.', 'loginpress' ), |
| 2799 |
'<strong>', |
| 2800 |
'</strong>' |
| 2801 |
); |
| 2802 |
|
| 2803 |
$username_exists = array_key_exists( 'username_exists', $this->loginpress_key ) && ! empty( $this->loginpress_key['username_exists'] ) ? $this->loginpress_key['username_exists'] : sprintf( |
| 2804 |
// translators: Username already taken |
| 2805 |
__( '%1$sError:%2$s This username is already registered. Please choose another one.', 'loginpress' ), |
| 2806 |
'<strong>', |
| 2807 |
'</strong>' |
| 2808 |
); |
| 2809 |
|
| 2810 |
$email_exists = array_key_exists( 'email_exists', $this->loginpress_key ) && ! empty( $this->loginpress_key['email_exists'] ) ? $this->loginpress_key['email_exists'] : sprintf( |
| 2811 |
// translators: Email already taken |
| 2812 |
__( '%1$sError:%2$s This email is already registered, please choose another one.', 'loginpress' ), |
| 2813 |
'<strong>', |
| 2814 |
'</strong>' |
| 2815 |
); |
| 2816 |
|
| 2817 |
$password_mismatch = array_key_exists( 'password_mismatch', $this->loginpress_key ) && ! empty( $this->loginpress_key['password_mismatch'] ) ? $this->loginpress_key['password_mismatch'] : sprintf( |
| 2818 |
// translators: Password mismatch |
| 2819 |
__( '%1$sError:%2$s Passwords Don\'t match.', 'loginpress' ), |
| 2820 |
'<strong>', |
| 2821 |
'</strong>' |
| 2822 |
); |
| 2823 |
|
| 2824 |
$invalidcombo = array_key_exists( 'invalidcombo_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['invalidcombo_message'] ) ? $this->loginpress_key['invalidcombo_message'] : sprintf( |
| 2825 |
// translators: Username or Password not vaild |
| 2826 |
__( '%1$sError:%2$s Invalid username or email.', 'loginpress' ), |
| 2827 |
'<strong>', |
| 2828 |
'</strong>' |
| 2829 |
); |
| 2830 |
|
| 2831 |
if ( in_array( 'invalid_username', $error_codes ) ) { |
| 2832 |
return $invalid_username; |
| 2833 |
} |
| 2834 |
|
| 2835 |
if ( in_array( 'incorrect_password', $error_codes ) ) { |
| 2836 |
return $invalid_password; |
| 2837 |
} |
| 2838 |
|
| 2839 |
if ( in_array( 'empty_username', $error_codes ) ) { |
| 2840 |
return $empty_username; |
| 2841 |
} |
| 2842 |
|
| 2843 |
if ( in_array( 'empty_password', $error_codes ) ) { |
| 2844 |
return $empty_password; |
| 2845 |
} |
| 2846 |
|
| 2847 |
// registration Form entries. |
| 2848 |
if ( in_array( 'invalid_email', $error_codes ) ) { |
| 2849 |
return $invalid_email; |
| 2850 |
} |
| 2851 |
|
| 2852 |
if ( in_array( 'empty_email', $error_codes ) ) { |
| 2853 |
return '</br>' . $empty_email; |
| 2854 |
} |
| 2855 |
|
| 2856 |
if ( in_array( 'username_exists', $error_codes ) ) { |
| 2857 |
return $username_exists; |
| 2858 |
} |
| 2859 |
|
| 2860 |
if ( in_array( 'email_exists', $error_codes ) ) { |
| 2861 |
return $email_exists; |
| 2862 |
} |
| 2863 |
|
| 2864 |
// forget password entry. |
| 2865 |
if ( in_array( 'invalidcombo', $error_codes ) ) { |
| 2866 |
return $invalidcombo; |
| 2867 |
} |
| 2868 |
|
| 2869 |
// Password mismatch custom error message. |
| 2870 |
if ( in_array( 'password_mismatch', $error_codes ) ) { |
| 2871 |
return $password_mismatch; |
| 2872 |
} |
| 2873 |
} |
| 2874 |
} |
| 2875 |
|
| 2876 |
return $error; |
| 2877 |
} |
| 2878 |
|
| 2879 |
/** |
| 2880 |
* Redirecting the Lost Password url to default lost post password page when Woocommerce is active |
| 2881 |
* |
| 2882 |
* @since 3.1.1 |
| 2883 |
*/ |
| 2884 |
function loginpress_reset_pass_url_in_notify() { |
| 2885 |
$siteURL = get_option( 'siteurl' ); |
| 2886 |
$login_url = wp_login_url(); |
| 2887 |
$login_url = explode( '/', $login_url ); |
| 2888 |
$path = $login_url[3]; |
| 2889 |
return "{$siteURL}/{$path}?action=lostpassword"; |
| 2890 |
} |
| 2891 |
|
| 2892 |
/** |
| 2893 |
* Checks if the Lost password URL is enabled |
| 2894 |
* |
| 2895 |
* @since 3.1.1 |
| 2896 |
* @version 6.0.0 |
| 2897 |
*/ |
| 2898 |
public function loginpress_lostpassword_url_changed() { |
| 2899 |
|
| 2900 |
$lostpassword_url = isset( $this->loginpress_settings['lostpassword_url'] ) ? $this->loginpress_settings['lostpassword_url'] : 'off'; |
| 2901 |
|
| 2902 |
if ( 'on' == $lostpassword_url ) { |
| 2903 |
add_filter( 'lostpassword_url', array( $this, 'loginpress_reset_pass_url_in_notify' ), 11, 0 ); |
| 2904 |
} |
| 2905 |
} |
| 2906 |
|
| 2907 |
/** |
| 2908 |
* Change Lost Password Text from Form |
| 2909 |
* |
| 2910 |
* @param $text |
| 2911 |
* @since 1.0.0 |
| 2912 |
* @version 3.0.0 |
| 2913 |
* |
| 2914 |
* @return mixed |
| 2915 |
*/ |
| 2916 |
public function change_lostpassword_message( $translated_text, $text, $domain ) { |
| 2917 |
|
| 2918 |
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'] ) ) { |
| 2919 |
|
| 2920 |
return trim( __( $this->loginpress_key['login_footer_text'], 'loginpress' ) ); // @codingStandardsIgnoreLine. |
| 2921 |
} |
| 2922 |
|
| 2923 |
return $translated_text; |
| 2924 |
} |
| 2925 |
|
| 2926 |
/** |
| 2927 |
* Change Label of the Username from login Form. |
| 2928 |
* |
| 2929 |
* @param string $translated_text Translated text. |
| 2930 |
* @param string $text The text to translate. |
| 2931 |
* @param string $domain The text domain. |
| 2932 |
* |
| 2933 |
* @since 1.1.3 |
| 2934 |
* @version 6.0.0 |
| 2935 |
* @return string |
| 2936 |
*/ |
| 2937 |
public function change_username_label( $translated_text, $text, $domain ) { |
| 2938 |
|
| 2939 |
if ( $this->loginpress_settings ) { |
| 2940 |
|
| 2941 |
$default = 'Username or Email Address'; |
| 2942 |
// $options = $this->loginpress_key; |
| 2943 |
// $label = array_key_exists( 'form_username_label', $options ) ? $options['form_username_label'] : ''; |
| 2944 |
$login_order = isset( $this->loginpress_settings['login_order'] ) ? $this->loginpress_settings['login_order'] : ''; |
| 2945 |
|
| 2946 |
// If the option does not exist, return the text unchanged. |
| 2947 |
if ( ! $this->loginpress_settings && $default === $text ) { |
| 2948 |
return $translated_text; |
| 2949 |
} |
| 2950 |
|
| 2951 |
// If options exist, then translate away. |
| 2952 |
if ( $this->loginpress_settings && $default === $text ) { |
| 2953 |
// Check if the option exists. |
| 2954 |
if ( '' != $login_order && 'default' != $login_order ) { |
| 2955 |
if ( 'username' == $login_order ) { |
| 2956 |
$label = __( 'Username', 'loginpress' ); |
| 2957 |
} elseif ( 'email' == $login_order ) { |
| 2958 |
$label = __( 'Email Address', 'loginpress' ); |
| 2959 |
} else { |
| 2960 |
$label = __( 'Username or Email Address', 'loginpress' ); |
| 2961 |
} |
| 2962 |
$translated_text = esc_html( $label ); |
| 2963 |
} |
| 2964 |
$translated_text = esc_html( apply_filters( 'loginpress_username_label', $translated_text ) ); |
| 2965 |
} |
| 2966 |
} |
| 2967 |
return $translated_text; |
| 2968 |
} |
| 2969 |
/** |
| 2970 |
* Change Password Label from Form. |
| 2971 |
* |
| 2972 |
* @param [type] $translated_text [description] |
| 2973 |
* @param [type] $text [description] |
| 2974 |
* @param [type] $domain [description] |
| 2975 |
* @since 1.1.3 |
| 2976 |
* |
| 2977 |
* @return string |
| 2978 |
*/ |
| 2979 |
public function change_password_label( $translated_text, $text, $domain ) { |
| 2980 |
|
| 2981 |
if ( $this->loginpress_key ) { |
| 2982 |
$default = 'Password'; |
| 2983 |
$options = $this->loginpress_key; |
| 2984 |
$label = array_key_exists( 'form_password_label', $options ) ? $options['form_password_label'] : ''; |
| 2985 |
|
| 2986 |
// If the option does not exist, return the text unchanged. |
| 2987 |
if ( ! $options && $default === $text ) { |
| 2988 |
return $translated_text; |
| 2989 |
} |
| 2990 |
|
| 2991 |
// If options exist, then translate away. |
| 2992 |
if ( $options && $default === $text ) { |
| 2993 |
|
| 2994 |
// Check if the option exists. |
| 2995 |
if ( array_key_exists( 'form_password_label', $options ) ) { |
| 2996 |
$translated_text = esc_html( $label ); |
| 2997 |
} else { |
| 2998 |
return $translated_text; |
| 2999 |
} |
| 3000 |
} |
| 3001 |
} |
| 3002 |
return $translated_text; |
| 3003 |
} |
| 3004 |
|
| 3005 |
/** |
| 3006 |
* Manage Welcome Messages |
| 3007 |
* |
| 3008 |
* @param $message |
| 3009 |
* @since 1.0.0 |
| 3010 |
* @version 1.5.3 |
| 3011 |
* |
| 3012 |
* @return string |
| 3013 |
*/ |
| 3014 |
public function change_welcome_message( $message ) { |
| 3015 |
if ( strpos( $message, __( 'Please enter your username or email address. You will receive an email message with instructions on how to reset your password.', 'loginpress' ) ) == true ) { |
| 3016 |
return $message; |
| 3017 |
} |
| 3018 |
if ( $this->loginpress_key ) { |
| 3019 |
|
| 3020 |
// Check, User Logged out. |
| 3021 |
if ( isset( $_GET['loggedout'] ) && true == $_GET['loggedout'] ) { |
| 3022 |
|
| 3023 |
if ( array_key_exists( 'logout_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['logout_message'] ) ) { |
| 3024 |
|
| 3025 |
$loginpress_message = __( $this->loginpress_key['logout_message'], 'loginpress' ); // @codingStandardsIgnoreLine. |
| 3026 |
} |
| 3027 |
} |
| 3028 |
|
| 3029 |
// Logged In messages. |
| 3030 |
elseif ( isset( $_GET['action'] ) && 'lostpassword' == $_GET['action'] ) { |
| 3031 |
|
| 3032 |
if ( array_key_exists( 'lostpwd_welcome_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['lostpwd_welcome_message'] ) ) { |
| 3033 |
|
| 3034 |
$loginpress_message = __( $this->loginpress_key['lostpwd_welcome_message'], 'loginpress' ); // @codingStandardsIgnoreLine. |
| 3035 |
} |
| 3036 |
} elseif ( isset( $_GET['action'] ) && 'register' == $_GET['action'] ) { |
| 3037 |
|
| 3038 |
if ( array_key_exists( 'register_welcome_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['register_welcome_message'] ) ) { |
| 3039 |
|
| 3040 |
$loginpress_message = __( $this->loginpress_key['register_welcome_message'], 'loginpress' ); // @codingStandardsIgnoreLine. |
| 3041 |
} |
| 3042 |
} |
| 3043 |
|
| 3044 |
// @since 1.0.18 |
| 3045 |
// else if ( strpos( $message, __( "Enter your new password below." ) ) == true ) { |
| 3046 |
// |
| 3047 |
// if ( array_key_exists( 'reset_hint_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['reset_hint_message'] ) ) { |
| 3048 |
// |
| 3049 |
// $loginpress_message = $this->loginpress_key['reset_hint_message']; |
| 3050 |
// } |
| 3051 |
// } |
| 3052 |
|
| 3053 |
// @since 1.0.18 |
| 3054 |
|
| 3055 |
elseif ( strpos( $message, __( 'Your password has been reset.', 'loginpress' ) ) == true ) { |
| 3056 |
|
| 3057 |
// if ( array_key_exists( 'after_reset_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['after_reset_message'] ) ) { |
| 3058 |
|
| 3059 |
$loginpress_message = __( 'Your password has been reset.', 'loginpress' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in', 'loginpress' ) . '</a></p>'; |
| 3060 |
// } |
| 3061 |
} elseif ( array_key_exists( 'welcome_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['welcome_message'] ) ) { |
| 3062 |
|
| 3063 |
$loginpress_message = __( $this->loginpress_key['welcome_message'], 'loginpress' ); // @codingStandardsIgnoreLine. |
| 3064 |
} |
| 3065 |
|
| 3066 |
return ! empty( $loginpress_message ) ? "<p class='custom-message'>" . $loginpress_message . '</p>' : $message; |
| 3067 |
} |
| 3068 |
} |
| 3069 |
|
| 3070 |
/** |
| 3071 |
* Set WordPress login page title. |
| 3072 |
* |
| 3073 |
* @since 1.4.6 |
| 3074 |
* @version 1.5.3 |
| 3075 |
|
| 3076 |
* @return string |
| 3077 |
*/ |
| 3078 |
public function login_page_title( $title ) { |
| 3079 |
|
| 3080 |
if ( $this->loginpress_key && array_key_exists( 'customize_login_page_title', $this->loginpress_key ) && ! empty( $this->loginpress_key['customize_login_page_title'] ) ) { |
| 3081 |
return __( $this->loginpress_key['customize_login_page_title'], 'loginpress' ); // @codingStandardsIgnoreLine. |
| 3082 |
} else { |
| 3083 |
return $title; |
| 3084 |
} |
| 3085 |
} |
| 3086 |
|
| 3087 |
/** |
| 3088 |
* Hook to Redirect Page for Customize |
| 3089 |
* |
| 3090 |
* @since 1.1.3 |
| 3091 |
* @version 3.2.1 |
| 3092 |
*/ |
| 3093 |
public function redirect_to_custom_page() { |
| 3094 |
if ( ! empty( $_GET['page'] ) ) { |
| 3095 |
|
| 3096 |
if ( ( $_GET['page'] == 'abw' ) || ( $_GET['page'] == 'loginpress' ) ) { |
| 3097 |
|
| 3098 |
if ( is_multisite() ) { // if subdirectories are used in multisite. |
| 3099 |
|
| 3100 |
$loginpress_obj = new LoginPress(); |
| 3101 |
$loginpress_page = $loginpress_obj->get_loginpress_page(); |
| 3102 |
|
| 3103 |
$page = get_permalink( $loginpress_page ); |
| 3104 |
|
| 3105 |
// Generate the redirect url. |
| 3106 |
$url = add_query_arg( |
| 3107 |
array( |
| 3108 |
'autofocus[panel]' => 'loginpress_panel', |
| 3109 |
'url' => rawurlencode( $page ), |
| 3110 |
), |
| 3111 |
admin_url( 'customize.php' ) |
| 3112 |
); |
| 3113 |
|
| 3114 |
wp_safe_redirect( $url ); |
| 3115 |
|
| 3116 |
} else { |
| 3117 |
$login_url = wp_login_url(); |
| 3118 |
$site_url = site_url(); |
| 3119 |
|
| 3120 |
// Parse the URLs only once to avoid redundancy. |
| 3121 |
$parsed_login_url = parse_url( $login_url ); |
| 3122 |
$parsed_site_url = parse_url( $site_url ); |
| 3123 |
|
| 3124 |
// Determine login path. |
| 3125 |
$login_path = isset( $parsed_login_url['path'] ) ? $parsed_login_url['path'] : '/wp-login.php'; |
| 3126 |
$subdirectory = isset( $parsed_site_url['path'] ) ? $parsed_site_url['path'] : ''; |
| 3127 |
|
| 3128 |
// If the login path starts with the subdirectory, remove the subdirectory from it. |
| 3129 |
if ( ! empty( $subdirectory ) && strpos( $login_path, $subdirectory ) === 0 ) { |
| 3130 |
$login_path = substr( $login_path, strlen( $subdirectory ) ); |
| 3131 |
} |
| 3132 |
|
| 3133 |
$login_path = sanitize_text_field( rtrim( $login_path, '/' ) ); |
| 3134 |
|
| 3135 |
// Redirect to the login page URL. |
| 3136 |
wp_redirect( get_admin_url() . 'customize.php?url=' . esc_url( site_url( $login_path, 'login_post' ) ) . '&autofocus=loginpress_panel' ); |
| 3137 |
exit; |
| 3138 |
} |
| 3139 |
} |
| 3140 |
} |
| 3141 |
} |
| 3142 |
|
| 3143 |
/** |
| 3144 |
* Sanitize username with allowed characters. |
| 3145 |
* |
| 3146 |
* @since 6.0.0 |
| 3147 |
* |
| 3148 |
* @param string $username The username to sanitize. |
| 3149 |
* @param string $raw_username The raw username input. |
| 3150 |
* @param bool $strict Whether to apply strict sanitization. |
| 3151 |
* |
| 3152 |
* @return string Sanitized username. |
| 3153 |
*/ |
| 3154 |
public function loginpress_sanitize_username( $username, $raw_username, $strict ) { |
| 3155 |
|
| 3156 |
$allowed_chars = isset( $this->loginpress_settings['allowed_username_characters'] ) && is_array( $this->loginpress_settings['allowed_username_characters'] ) ? array_keys( $this->loginpress_settings['allowed_username_characters'] ) : array(); |
| 3157 |
if ( ! is_array( $allowed_chars ) ) { |
| 3158 |
$allowed_chars = array(); |
| 3159 |
} |
| 3160 |
|
| 3161 |
$unicode_map = array( |
| 3162 |
'arabic' => '\\p{Arabic}', |
| 3163 |
'latin' => '\\p{Latin}', |
| 3164 |
'armenian' => '\\p{Armenian}', |
| 3165 |
'bengali' => '\\p{Bengali}', |
| 3166 |
'bopomofo' => '\\p{Bopomofo}', |
| 3167 |
'cyrillic' => '\\p{Cyrillic}', |
| 3168 |
'georgian' => '\\p{Georgian}', |
| 3169 |
'greek' => '\\p{Greek}', |
| 3170 |
); |
| 3171 |
// Validate unicode_map keys to prevent injection |
| 3172 |
$allowed_chars = array_intersect( (array) $allowed_chars, array_keys( $unicode_map ) ); |
| 3173 |
$pattern = '|[^a-z0-9 _.\-@' . implode( '', array_intersect_key( $unicode_map, array_flip( $allowed_chars ) ) ) . ']|iu'; |
| 3174 |
|
| 3175 |
$username = wp_strip_all_tags( $raw_username ); |
| 3176 |
$username = remove_accents( $username ); |
| 3177 |
$username = preg_replace( |
| 3178 |
array( '|%([a-fA-F0-9][a-fA-F0-9])|', '/&.+?;/', $pattern, '|\s+|' ), |
| 3179 |
array( '', '', '', ' ' ), |
| 3180 |
trim( $username ) |
| 3181 |
); |
| 3182 |
return $username; |
| 3183 |
} |
| 3184 |
|
| 3185 |
/** |
| 3186 |
* Redirect to the Admin Panel After Closing LoginPress Customizer |
| 3187 |
* |
| 3188 |
* @since 1.0.0 |
| 3189 |
* @version 3.0.6 |
| 3190 |
* @return null |
| 3191 |
*/ |
| 3192 |
public function menu_url() { |
| 3193 |
|
| 3194 |
global $submenu; |
| 3195 |
|
| 3196 |
$parent = 'index.php'; |
| 3197 |
$page = 'abw'; |
| 3198 |
|
| 3199 |
// Create specific url for login view. |
| 3200 |
$login_url = wp_login_url(); |
| 3201 |
$parsed_url = parse_url( $login_url ); |
| 3202 |
$login_url = isset( $parsed_url['path'] ) ? sanitize_text_field( $parsed_url['path'] ) : 'wp-login.php'; |
| 3203 |
$url = add_query_arg( |
| 3204 |
array( |
| 3205 |
'url' => esc_url( site_url( $login_url, 'login_post' ) ), |
| 3206 |
'return' => admin_url( 'themes.php' ), |
| 3207 |
), |
| 3208 |
admin_url( 'customize.php' ) |
| 3209 |
); |
| 3210 |
|
| 3211 |
// If is Not Design Menu, return |
| 3212 |
if ( ! isset( $submenu[ $parent ] ) ) { |
| 3213 |
return null; |
| 3214 |
} |
| 3215 |
|
| 3216 |
foreach ( $submenu[ $parent ] as $key => $value ) { |
| 3217 |
// Set new URL for menu item |
| 3218 |
if ( $page === $value[2] ) { |
| 3219 |
$submenu[ $parent ][ $key ][2] = $url; |
| 3220 |
break; |
| 3221 |
} |
| 3222 |
} |
| 3223 |
} |
| 3224 |
|
| 3225 |
/** |
| 3226 |
* This function is removed the error messages in the customizer. |
| 3227 |
* |
| 3228 |
* @param array $errors [description] |
| 3229 |
* @param string $redirect_to [description] |
| 3230 |
* @since 1.2.0 |
| 3231 |
* @version 3.0.6 |
| 3232 |
*/ |
| 3233 |
function remove_error_messages_in_wp_customizer( $errors, $redirect_to ) { |
| 3234 |
|
| 3235 |
if ( is_customize_preview() && version_compare( $GLOBALS['wp_version'], '5.2', '>=' ) ) { |
| 3236 |
return new WP_Error( '', '' ); |
| 3237 |
} |
| 3238 |
// If Logout message is set and not empty then remove the default logout message from WordPress. |
| 3239 |
if ( isset( $this->loginpress_key ) && is_array( $this->loginpress_key ) && array_key_exists( 'logout_message', $this->loginpress_key ) && ! empty( $this->loginpress_key['logout_message'] ) ) { |
| 3240 |
if ( isset( $_GET['loggedout'] ) && true == $_GET['loggedout'] && isset( $errors->errors['loggedout'] ) ) { |
| 3241 |
unset( $errors->errors['loggedout'] ); |
| 3242 |
} |
| 3243 |
} |
| 3244 |
return $errors; |
| 3245 |
} |
| 3246 |
} |
| 3247 |
|