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