| 1 |
<?php |
| 2 |
/** |
| 3 |
* LoginPress Compatibility Functions. |
| 4 |
* |
| 5 |
* This is a LoginPress Compatibility to make it compatible for older versions. |
| 6 |
* |
| 7 |
* @package LoginPress |
| 8 |
* @since 1.0.22 |
| 9 |
* @version 6.2.0 |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
|
| 16 |
// phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed -- Reason: local helper function used only in this file |
| 17 |
/** |
| 18 |
* Run a compatibility check on 1.0.21 and change the settings. |
| 19 |
* |
| 20 |
* @since 1.0.22 |
| 21 |
*/ |
| 22 |
add_filter( 'init', 'loginpress_upgrade_1_0_22', 1 ); |
| 23 |
|
| 24 |
$loginpress_preset = get_option( 'customize_presets_settings' ); |
| 25 |
|
| 26 |
if ( ( ! isset( $loginpress_preset ) || empty( $loginpress_preset ) ) ) { |
| 27 |
add_action( 'init', 'loginpress_upgrade_3_0_3', 1 ); |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Select a default theme preset when user updates and no customization has been made. |
| 32 |
* |
| 33 |
* @since 3.0.3 |
| 34 |
* @return void |
| 35 |
*/ |
| 36 |
function loginpress_upgrade_3_0_3() { |
| 37 |
$loginpress_customizer = get_option( 'loginpress_customization' ); |
| 38 |
|
| 39 |
if ( empty( $loginpress_customizer ) ) { |
| 40 |
update_option( 'customize_presets_settings', 'minimalist', true ); |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* LoginPress upgrade function for version 1.0.22. |
| 46 |
* |
| 47 |
* Remove element 'login_with_email' from loginpress_setting array that was defined in 1.0.21 |
| 48 |
* and update 'login_order' in loginpress_setting for compatibility. |
| 49 |
* |
| 50 |
* @since 1.0.22 |
| 51 |
* @return array<string, mixed> update loginpress_setting |
| 52 |
*/ |
| 53 |
function loginpress_upgrade_1_0_22() { |
| 54 |
|
| 55 |
$loginpress_setting = get_option( 'loginpress_setting' ); |
| 56 |
$login_with_email = isset( $loginpress_setting['login_with_email'] ) ? $loginpress_setting['login_with_email'] : ''; |
| 57 |
|
| 58 |
if ( isset( $loginpress_setting['login_with_email'] ) ) { |
| 59 |
|
| 60 |
if ( 'on' === $login_with_email ) { |
| 61 |
|
| 62 |
$loginpress_setting['login_order'] = 'email'; |
| 63 |
unset( $loginpress_setting['login_with_email'] ); |
| 64 |
update_option( 'loginpress_setting', $loginpress_setting ); |
| 65 |
return $loginpress_setting; |
| 66 |
} elseif ( 'off' === $login_with_email ) { |
| 67 |
|
| 68 |
$loginpress_setting['login_order'] = 'default'; |
| 69 |
unset( $loginpress_setting['login_with_email'] ); |
| 70 |
update_option( 'loginpress_setting', $loginpress_setting ); |
| 71 |
return $loginpress_setting; |
| 72 |
} |
| 73 |
} |
| 74 |
return $loginpress_setting; |
| 75 |
} |
| 76 |
|
| 77 |
if ( ! class_exists( 'LoginPress_Compatibility' ) ) : |
| 78 |
|
| 79 |
/** |
| 80 |
* LoginPress compatibility Class is used to make LoginPress compatible with other plugins. |
| 81 |
* Remove conflict. |
| 82 |
* Add CSS Support. |
| 83 |
* |
| 84 |
* @since 1.0.3 |
| 85 |
* @version 1.3.2 |
| 86 |
*/ |
| 87 |
class LoginPress_Compatibility { |
| 88 |
|
| 89 |
/** |
| 90 |
* Variable that Check for LoginPress Key. |
| 91 |
* |
| 92 |
* @var array<string, mixed>|string |
| 93 |
* @since 1.3.2 |
| 94 |
*/ |
| 95 |
public $loginpress_key; |
| 96 |
|
| 97 |
/** |
| 98 |
* Constructor. |
| 99 |
* |
| 100 |
* @since 1.3.2 |
| 101 |
*/ |
| 102 |
public function __construct() { |
| 103 |
$this->loginpress_key = get_option( 'loginpress_customization' ); |
| 104 |
$this->dependencies(); |
| 105 |
} |
| 106 |
|
| 107 |
/** |
| 108 |
* Add dependencies and hooks. |
| 109 |
* |
| 110 |
* @return void |
| 111 |
*/ |
| 112 |
public function dependencies() { |
| 113 |
|
| 114 |
add_action( 'wp_print_scripts', array( $this, 'dequeue_conflicted_script' ), 100 ); |
| 115 |
add_action( 'login_headerurl', array( $this, 'remove_conflicted_action' ) ); |
| 116 |
add_action( 'init', array( $this, 'enqueue_loginpress_compatibility_script' ) ); |
| 117 |
|
| 118 |
/* |
| 119 |
WebArx Compatibility Fix // v1.2.3. |
| 120 |
*/ |
| 121 |
add_action( 'plugins_loaded', array( $this, 'plugins_loaded_remove_action' ), 10 ); |
| 122 |
add_action( 'init', array( $this, 'loginpress_webarx_compatibility' ), 9 ); |
| 123 |
|
| 124 |
/** |
| 125 |
* Login page Compatibility Fix. |
| 126 |
* |
| 127 |
* @since v1.3.2 |
| 128 |
*/ |
| 129 |
add_action( 'login_enqueue_scripts', array( $this, 'dequeue_login_page_conflicting_scripts' ), 99 ); |
| 130 |
|
| 131 |
/** |
| 132 |
* Oxygen Builder Compatibility Fix. |
| 133 |
* |
| 134 |
* @since v1.4.0 |
| 135 |
*/ |
| 136 |
add_filter( 'template_include', array( $this, 'template_include_ob' ), 100 ); |
| 137 |
|
| 138 |
/** |
| 139 |
* All In One WP Security & Firewall Compatibility Fix. |
| 140 |
* |
| 141 |
* @since 1.4.0 |
| 142 |
*/ |
| 143 |
add_action( 'init', array( $this, 'aiowps_login_init_remove_action' ) ); |
| 144 |
|
| 145 |
/** |
| 146 |
* BuddyBoss theme Compatibility with login page Fix. |
| 147 |
* |
| 148 |
* @since 3.0.9 |
| 149 |
*/ |
| 150 |
add_action( 'login_head', array( $this, 'lp_remove_filter_buddyboss' ) ); |
| 151 |
|
| 152 |
/** |
| 153 |
* WPS Hide Login Fix. |
| 154 |
* |
| 155 |
* @version 3.0.8 |
| 156 |
*/ |
| 157 |
add_filter( 'whl_logged_in_redirect', array( $this, 'wps_hide_login_compatibility' ), 10, 3 ); |
| 158 |
add_filter( 'wps_hide_login_before_redirect', array( $this, 'wps_hide_login_redirect' ) ); |
| 159 |
} |
| 160 |
|
| 161 |
/** |
| 162 |
* Dequeue login page styles. |
| 163 |
* |
| 164 |
* @since 1.3.2 |
| 165 |
* @version 1.4.3 |
| 166 |
*/ |
| 167 |
/** |
| 168 |
* Dequeue conflicting scripts on login page. |
| 169 |
* |
| 170 |
* @since 1.0.22 |
| 171 |
* @return void |
| 172 |
*/ |
| 173 |
public function dequeue_login_page_conflicting_scripts() { |
| 174 |
|
| 175 |
/** |
| 176 |
* Dequeue thrive theme login page styles. |
| 177 |
* |
| 178 |
* @since 1.3.2 |
| 179 |
*/ |
| 180 |
wp_dequeue_style( 'thrive-custom-login' ); |
| 181 |
wp_dequeue_script( 'thrive-custom-login' ); |
| 182 |
|
| 183 |
/** |
| 184 |
* Dequeue listing-pro theme login page styles. |
| 185 |
* |
| 186 |
* @since 1.4.3 |
| 187 |
*/ |
| 188 |
wp_dequeue_style( 'listable-custom-login' ); |
| 189 |
|
| 190 |
/** |
| 191 |
* PCI Compliance. |
| 192 |
* |
| 193 |
* @since 1.7.2 |
| 194 |
* @version 6.2.0 |
| 195 |
*/ |
| 196 |
$loginpress_setting = get_option( 'loginpress_setting' ); |
| 197 |
$pci_compliance = isset( $loginpress_setting['enable_pci_compliance'] ) ? $loginpress_setting['enable_pci_compliance'] : 'off'; |
| 198 |
|
| 199 |
if ( 'off' !== $pci_compliance ) { |
| 200 |
|
| 201 |
// Register an empty handle so we can attach inline script to it. |
| 202 |
// Use false/empty string as the src so no external file is enqueued. |
| 203 |
wp_register_script( 'loginpress-disable-autocomplete', '', array(), LOGINPRESS_VERSION, true ); |
| 204 |
wp_enqueue_script( 'loginpress-disable-autocomplete' ); |
| 205 |
|
| 206 |
$inline_js = 'document.addEventListener("DOMContentLoaded", function () { |
| 207 |
var inputs = document.querySelectorAll(\'input[type="text"],input[type="password"],input[type="email"]\'); |
| 208 |
if (!inputs || inputs.length === 0) { |
| 209 |
return; |
| 210 |
} |
| 211 |
for (var i = 0; i < inputs.length; i++) { |
| 212 |
try { |
| 213 |
inputs[i].setAttribute("autocomplete", "off"); |
| 214 |
} catch (e) { |
| 215 |
/* ignore if a browser throws on setAttribute */ |
| 216 |
} |
| 217 |
} |
| 218 |
});'; |
| 219 |
|
| 220 |
wp_add_inline_script( 'loginpress-disable-autocomplete', $inline_js ); |
| 221 |
} |
| 222 |
} |
| 223 |
|
| 224 |
/** |
| 225 |
* Override the oxygen template with loginpress on login customizer screen. |
| 226 |
* |
| 227 |
* @since 1.4.0 |
| 228 |
* @param string $template The template path. |
| 229 |
* @return string |
| 230 |
*/ |
| 231 |
public function template_include_ob( $template ) { |
| 232 |
|
| 233 |
// Safely exit if methods not defined yet. |
| 234 |
if ( ! function_exists( 'is_customize_preview' ) || ! function_exists( 'wp_get_referer' ) ) { |
| 235 |
return $template; |
| 236 |
} |
| 237 |
|
| 238 |
$referer = wp_get_referer(); |
| 239 |
if ( is_customize_preview() && ABSPATH . 'wp-content/plugins/oxygen/component-framework//oxygen-main-template.php' === $template && ( false !== strpos( $referer ? $referer : '', 'autofocus[panel]=loginpress_panel' ) ) ) { |
| 240 |
return ABSPATH . 'wp-content/plugins/loginpress/include/template-loginpress.php'; |
| 241 |
} |
| 242 |
|
| 243 |
return $template; |
| 244 |
} |
| 245 |
|
| 246 |
/** |
| 247 |
* BuddyBoss theme Compatibility Fix for login page logo. |
| 248 |
* |
| 249 |
* @since 3.0.9 |
| 250 |
* @return void |
| 251 |
*/ |
| 252 |
public function lp_remove_filter_buddyboss() { |
| 253 |
$active_theme = get_template(); |
| 254 |
if ( 'buddyboss-theme' === $active_theme ) { |
| 255 |
remove_filter( 'login_headerurl', 'change_wp_login_url' ); |
| 256 |
remove_filter( 'login_headertext', 'change_wp_login_title' ); |
| 257 |
} |
| 258 |
} |
| 259 |
|
| 260 |
/** |
| 261 |
* To check the WebARX hooks if class exist. |
| 262 |
* |
| 263 |
* @since 3.1.1 |
| 264 |
* @return void |
| 265 |
*/ |
| 266 |
public function loginpress_webarx_compatibility() { |
| 267 |
if ( class_exists( 'Webarx' ) ) { |
| 268 |
$this->init_remove_action(); |
| 269 |
add_filter( 'wp_redirect', array( $this, 'wp_redirect_remove_filter' ), 9 ); |
| 270 |
add_filter( 'site_url', array( $this, 'site_url_remove_filter' ), 9 ); |
| 271 |
add_filter( 'network_site_url', array( $this, 'network_site_url_remove_filter' ), 9 ); |
| 272 |
add_action( 'wp_loaded', array( $this, 'wp_loaded_remove_action' ), 9 ); |
| 273 |
} |
| 274 |
} |
| 275 |
|
| 276 |
/** |
| 277 |
* WebArx Compatibility Fix for wp_redirect filter. |
| 278 |
* |
| 279 |
* @param string $location The current location. |
| 280 |
* @return string $location Modified current location. |
| 281 |
* |
| 282 |
* @since 1.2.3 |
| 283 |
* @version 3.1.1 |
| 284 |
*/ |
| 285 |
public function wp_redirect_remove_filter( $location ) { |
| 286 |
|
| 287 |
if ( ! function_exists( 'is_user_logged_in' ) ) { |
| 288 |
return $location; |
| 289 |
} |
| 290 |
|
| 291 |
$webarx_login = get_option( 'webarx_mv_wp_login' ); |
| 292 |
$user_logged_in = is_user_logged_in(); |
| 293 |
|
| 294 |
if ( true === $user_logged_in && ( isset( $webarx_login ) && '1' === $webarx_login ) ) { |
| 295 |
/** |
| 296 |
* Remove WebArx wp_redirect filter. |
| 297 |
* |
| 298 |
* @phpstan-ignore-next-line |
| 299 |
*/ |
| 300 |
remove_filter( 'wp_redirect', array( webarx()->hide_login, 'wp_redirect' ) ); |
| 301 |
} |
| 302 |
return $location; |
| 303 |
} |
| 304 |
|
| 305 |
/** |
| 306 |
* WebArx Compatibility Fix for site URL removal. |
| 307 |
* |
| 308 |
* @param string $url The URL. |
| 309 |
* @return string $url Modified URL. |
| 310 |
* |
| 311 |
* @since 1.2.3 |
| 312 |
* @version 3.1.1 |
| 313 |
*/ |
| 314 |
public function site_url_remove_filter( $url ) { |
| 315 |
if ( ! function_exists( 'is_user_logged_in' ) ) { |
| 316 |
return $url; |
| 317 |
} |
| 318 |
$webarx_login = get_option( 'webarx_mv_wp_login' ); |
| 319 |
$user_logged_in = is_user_logged_in(); |
| 320 |
if ( true === $user_logged_in && ( isset( $webarx_login ) && '1' === $webarx_login ) ) { |
| 321 |
/** |
| 322 |
* Remove WebArx site_url filter. |
| 323 |
* |
| 324 |
* @phpstan-ignore-next-line |
| 325 |
*/ |
| 326 |
remove_filter( 'site_url', array( webarx()->hide_login, 'site_url' ) ); |
| 327 |
} |
| 328 |
return $url; |
| 329 |
} |
| 330 |
|
| 331 |
/** |
| 332 |
* WebArx Compatibility Fix for multi-site URL removal. |
| 333 |
* |
| 334 |
* @param string $url The URL. |
| 335 |
* @return string $url Modified URL. |
| 336 |
* |
| 337 |
* @since 1.2.3 |
| 338 |
* @version 3.1.1 |
| 339 |
*/ |
| 340 |
public function network_site_url_remove_filter( $url ) { |
| 341 |
if ( ! function_exists( 'is_user_logged_in' ) ) { |
| 342 |
return $url; |
| 343 |
} |
| 344 |
$webarx_login = get_option( 'webarx_mv_wp_login' ); |
| 345 |
$user_logged_in = is_user_logged_in(); |
| 346 |
|
| 347 |
if ( true === $user_logged_in && ( isset( $webarx_login ) && '1' === $webarx_login ) ) { |
| 348 |
/** |
| 349 |
* Remove WebArx network_site_url filter. |
| 350 |
* |
| 351 |
* @phpstan-ignore-next-line |
| 352 |
*/ |
| 353 |
remove_filter( 'network_site_url', array( webarx()->hide_login, 'network_site_url' ) ); |
| 354 |
} |
| 355 |
return $url; |
| 356 |
} |
| 357 |
|
| 358 |
/** |
| 359 |
* WebArx Compatibility Fix for multi-site URL removal. |
| 360 |
* |
| 361 |
* @since 1.2.3 |
| 362 |
* @return void |
| 363 |
*/ |
| 364 |
public function plugins_loaded_remove_action() { |
| 365 |
if ( class_exists( 'Webarx' ) ) { |
| 366 |
|
| 367 |
if ( ! function_exists( 'is_user_logged_in' ) ) { |
| 368 |
return; |
| 369 |
} |
| 370 |
|
| 371 |
$webarx_login = get_option( 'webarx_mv_wp_login' ); |
| 372 |
$user_logged_in = is_user_logged_in(); |
| 373 |
|
| 374 |
if ( true === $user_logged_in && ( isset( $webarx_login ) && '1' === $webarx_login ) ) { |
| 375 |
/** |
| 376 |
* Remove WebArx plugins_loaded action. |
| 377 |
* |
| 378 |
* @phpstan-ignore-next-line |
| 379 |
*/ |
| 380 |
remove_action( 'plugins_loaded', array( webarx()->hide_login, 'plugins_loaded' ), 9999 ); |
| 381 |
} |
| 382 |
} |
| 383 |
} |
| 384 |
/** |
| 385 |
* Remove wp_loaded action hook for WebArx compatibility. |
| 386 |
* |
| 387 |
* @since 1.2.3 |
| 388 |
* @version 3.1.1 |
| 389 |
* @return void |
| 390 |
*/ |
| 391 |
public function wp_loaded_remove_action() { |
| 392 |
|
| 393 |
if ( ! function_exists( 'is_user_logged_in' ) ) { |
| 394 |
return; |
| 395 |
} |
| 396 |
|
| 397 |
$webarx_login = get_option( 'webarx_mv_wp_login' ); |
| 398 |
$user_logged_in = is_user_logged_in(); |
| 399 |
|
| 400 |
if ( true === $user_logged_in && ( isset( $webarx_login ) && '1' === $webarx_login ) ) { |
| 401 |
/** |
| 402 |
* Remove WebArx wp_loaded action. |
| 403 |
* |
| 404 |
* @phpstan-ignore-next-line |
| 405 |
*/ |
| 406 |
remove_action( 'wp_loaded', array( webarx()->hide_login, 'wp_loaded' ) ); |
| 407 |
} |
| 408 |
} |
| 409 |
/** |
| 410 |
* Remove init action hook for WebArx compatibility. |
| 411 |
* |
| 412 |
* @since 1.2.3 |
| 413 |
* @version 3.1.1 |
| 414 |
* @return void |
| 415 |
*/ |
| 416 |
public function init_remove_action() { |
| 417 |
|
| 418 |
if ( ! function_exists( 'is_user_logged_in' ) ) { |
| 419 |
return; |
| 420 |
} |
| 421 |
|
| 422 |
$webarx_login = get_option( 'webarx_mv_wp_login' ); |
| 423 |
$user_logged_in = is_user_logged_in(); |
| 424 |
|
| 425 |
if ( true === $user_logged_in && ( isset( $webarx_login ) && '1' === $webarx_login ) ) { |
| 426 |
/** |
| 427 |
* Remove WebArx init action. |
| 428 |
* |
| 429 |
* @phpstan-ignore-next-line |
| 430 |
*/ |
| 431 |
remove_action( 'init', array( webarx()->hide_login, 'denyRequestsToWpLogin' ) ); |
| 432 |
} |
| 433 |
} |
| 434 |
|
| 435 |
|
| 436 |
/** |
| 437 |
* Remove login security check in customizer screen only. |
| 438 |
* No need for this check as the user is already logged in and using customizer. |
| 439 |
* |
| 440 |
* @since 1.4.0 |
| 441 |
* @return void |
| 442 |
*/ |
| 443 |
public function aiowps_login_init_remove_action() { |
| 444 |
if ( ! is_customize_preview() ) { |
| 445 |
return; |
| 446 |
} |
| 447 |
|
| 448 |
if ( ! class_exists( 'AIO_WP_Security' ) ) { |
| 449 |
return; |
| 450 |
} |
| 451 |
|
| 452 |
global $aio_wp_security; |
| 453 |
|
| 454 |
if ( ! is_a( $aio_wp_security, 'AIO_WP_Security' ) ) { |
| 455 |
return; |
| 456 |
} |
| 457 |
|
| 458 |
if ( remove_action( 'wp_loaded', array( $aio_wp_security, 'aiowps_wp_loaded_handler' ) ) ) { |
| 459 |
add_filter( 'option_aio_wp_security_configs', array( $this, 'aiowps_filter_options' ) ); |
| 460 |
} |
| 461 |
} |
| 462 |
|
| 463 |
/** |
| 464 |
* Filter options aio_wp_security_configs. |
| 465 |
* |
| 466 |
* @since 1.4.0 |
| 467 |
* @param array<string, mixed> $option The option array. |
| 468 |
* @return array<string, mixed> |
| 469 |
*/ |
| 470 |
public function aiowps_filter_options( $option ) { |
| 471 |
|
| 472 |
unset( $option['aiowps_enable_rename_login_page'] ); |
| 473 |
return $option; |
| 474 |
} |
| 475 |
|
| 476 |
/** |
| 477 |
* Enqueue LoginPress CSS on Password_Protected plugin. |
| 478 |
* |
| 479 |
* @return void |
| 480 |
*/ |
| 481 |
public function enqueue_loginpress_compatibility_script() { |
| 482 |
|
| 483 |
/** |
| 484 |
* Enqueue LoginPress CSS on Password_Protected plugin. |
| 485 |
* |
| 486 |
* Hooked to the password_protected_login_head action, |
| 487 |
* Head URL & Title on logo as well. |
| 488 |
* |
| 489 |
* so that it is after the script was enqueued. |
| 490 |
* |
| 491 |
* @since 1.0.3 |
| 492 |
* @version 1.3.2 |
| 493 |
*/ |
| 494 |
if ( class_exists( 'Password_Protected' ) ) { |
| 495 |
add_action( 'password_protected_login_head', array( $this, 'enqueue_loginpress_script' ) ); |
| 496 |
add_filter( 'password_protected_login_headerurl', array( $this, 'password_protected_login_headerurl_cb' ) ); |
| 497 |
add_filter( 'password_protected_login_headertitle', array( $this, 'password_protected_login_headertitle_cb' ) ); |
| 498 |
} |
| 499 |
} |
| 500 |
|
| 501 |
/** |
| 502 |
* Enqueue the Divi Login script. |
| 503 |
* |
| 504 |
* @since 1.0.3 |
| 505 |
* @return void |
| 506 |
*/ |
| 507 |
public function dequeue_conflicted_script() { |
| 508 |
|
| 509 |
/** |
| 510 |
* Dequeue the Divi Login script. |
| 511 |
* |
| 512 |
* Hooked to the wp_print_scripts action, with a late priority (100), |
| 513 |
* so that it is after the script was enqueued. |
| 514 |
* |
| 515 |
* @since 1.0.3 |
| 516 |
*/ |
| 517 |
if ( class_exists( 'ET_Divi_100_Custom_Login_Page_Config' ) ) { |
| 518 |
wp_dequeue_style( 'custom-login-pages' ); |
| 519 |
wp_dequeue_script( 'custom-login-pages-icon-font' ); |
| 520 |
wp_dequeue_script( 'custom-login-pages-scripts' ); |
| 521 |
} |
| 522 |
} |
| 523 |
|
| 524 |
/** |
| 525 |
* Remove the Divi login_footer hook 'print_styles'. |
| 526 |
* |
| 527 |
* @since 1.0.3 |
| 528 |
* @return void |
| 529 |
*/ |
| 530 |
public function remove_conflicted_action() { |
| 531 |
|
| 532 |
/** |
| 533 |
* Remove the Divi login_footer hook 'print_styles' |
| 534 |
* So that conflict is removed. |
| 535 |
* |
| 536 |
* @since 1.0.3 |
| 537 |
*/ |
| 538 |
if ( class_exists( 'ET_Divi_100_Custom_Login_Page_Config' ) ) { |
| 539 |
/** |
| 540 |
* Remove Divi login footer action. |
| 541 |
* |
| 542 |
* @phpstan-ignore-next-line |
| 543 |
*/ |
| 544 |
remove_action( 'login_footer', array( ET_Divi_100_Custom_Login_Page::instance(), 'print_styles' ) ); |
| 545 |
} |
| 546 |
} |
| 547 |
|
| 548 |
/** |
| 549 |
* Include LoginPress CSS for Support with other plugins. |
| 550 |
* |
| 551 |
* @since 1.0.3 |
| 552 |
* @return void |
| 553 |
*/ |
| 554 |
public function enqueue_loginpress_script() { |
| 555 |
|
| 556 |
/** |
| 557 |
* Include LoginPress style presets. |
| 558 |
* |
| 559 |
* @phpstan-ignore-next-line |
| 560 |
*/ |
| 561 |
include LOGINPRESS_DIR_PATH . 'css/style-presets.php'; |
| 562 |
/** |
| 563 |
* Include LoginPress login styles. |
| 564 |
* |
| 565 |
* @phpstan-ignore-next-line |
| 566 |
*/ |
| 567 |
include_once LOGINPRESS_DIR_PATH . 'css/style-login.php'; |
| 568 |
} |
| 569 |
|
| 570 |
/** |
| 571 |
* Password protected plugin compatibility with logo url. |
| 572 |
* |
| 573 |
* @since 1.3.1 |
| 574 |
* @version 1.3.2 |
| 575 |
* @return string |
| 576 |
*/ |
| 577 |
public function password_protected_login_headerurl_cb() { |
| 578 |
|
| 579 |
$logo_url = home_url( '/' ); |
| 580 |
if ( is_array( $this->loginpress_key ) && isset( $this->loginpress_key['customize_logo_hover'] ) && ! empty( $this->loginpress_key['customize_logo_hover'] ) ) { |
| 581 |
$logo_url = $this->loginpress_key['customize_logo_hover']; |
| 582 |
} |
| 583 |
|
| 584 |
return $logo_url; |
| 585 |
} |
| 586 |
|
| 587 |
/** |
| 588 |
* Password protected plugin compatibility with logo title. |
| 589 |
* |
| 590 |
* @since 1.3.2 |
| 591 |
* @return string |
| 592 |
*/ |
| 593 |
public function password_protected_login_headertitle_cb() { |
| 594 |
|
| 595 |
$logo_title = get_bloginfo( 'name' ); |
| 596 |
if ( is_array( $this->loginpress_key ) && isset( $this->loginpress_key['customize_logo_hover_title'] ) && ! empty( $this->loginpress_key['customize_logo_hover_title'] ) ) { |
| 597 |
$logo_title = $this->loginpress_key['customize_logo_hover_title']; |
| 598 |
} |
| 599 |
|
| 600 |
return $logo_title; |
| 601 |
} |
| 602 |
|
| 603 |
/** |
| 604 |
* The redirect of Hide Login compatibility with LoginPress. |
| 605 |
* |
| 606 |
* @since 1.0.19 |
| 607 |
* @version 3.0.8 |
| 608 |
* @return string |
| 609 |
*/ |
| 610 |
public function wps_hide_login_redirect() { |
| 611 |
return wp_login_url(); |
| 612 |
} |
| 613 |
|
| 614 |
/** |
| 615 |
* Filters the "Go to site" link displayed in the login page footer. |
| 616 |
* |
| 617 |
* @param string $redirect_to The page where it will be redirected to. |
| 618 |
* @param string $requested_redirect_to The requested page to redirect. |
| 619 |
* @param WP_User|false $user The user object. |
| 620 |
* @since 1.0.19 |
| 621 |
* @version 3.0.8 |
| 622 |
* @return string |
| 623 |
*/ |
| 624 |
public function wps_hide_login_compatibility( $redirect_to, $requested_redirect_to, $user ) { |
| 625 |
if ( ! headers_sent() ) { |
| 626 |
// Create these variables to overcome couple PHP Warnings in customizer while calling wp-login.php. |
| 627 |
$user_login = isset( $user->user_login ) ? $user->user_login : ''; |
| 628 |
$error = isset( $user->error ) ? $user->error : ''; |
| 629 |
|
| 630 |
/** |
| 631 |
* Include WordPress login file. |
| 632 |
* |
| 633 |
* @phpstan-ignore-next-line |
| 634 |
*/ |
| 635 |
require_once ABSPATH . 'wp-login.php'; |
| 636 |
die(); |
| 637 |
} |
| 638 |
return false; |
| 639 |
} |
| 640 |
} |
| 641 |
endif; |
| 642 |
// phpcs:enable Universal.Files.SeparateFunctionsFromOO.Mixed |
| 643 |
new LoginPress_Compatibility(); |
| 644 |
|