| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* This is a LoginPress Compatibility to make it compatible for older versions. |
| 5 |
* |
| 6 |
* @since 1.0.22 |
| 7 |
* @version 1.2.2 |
| 8 |
*/ |
| 9 |
|
| 10 |
|
| 11 |
/** |
| 12 |
* Run a compatibility check on 1.0.21 and change the settings. |
| 13 |
* |
| 14 |
*/ |
| 15 |
add_action( 'init', 'loginpress_upgrade_1_0_22', 1 ); |
| 16 |
|
| 17 |
|
| 18 |
/** |
| 19 |
* loginpress_upgrade_1_0_22 |
| 20 |
* Remove elemant 'login_with_email' from loginpress_setting array that was defined in 1.0.21 |
| 21 |
* and update 'login_order' in loginpress_setting for compatiblity. |
| 22 |
* |
| 23 |
* @since 1.0.22 |
| 24 |
* @return array update loginpress_setting |
| 25 |
*/ |
| 26 |
function loginpress_upgrade_1_0_22() { |
| 27 |
|
| 28 |
$loginpress_setting = get_option( 'loginpress_setting' ); |
| 29 |
$login_with_email = isset( $loginpress_setting['login_with_email'] ) ? $loginpress_setting['login_with_email'] : ''; |
| 30 |
|
| 31 |
if ( isset( $loginpress_setting['login_with_email'] ) ) { |
| 32 |
|
| 33 |
if( 'on' == $login_with_email ) { |
| 34 |
|
| 35 |
$loginpress_setting['login_order'] = 'email'; |
| 36 |
unset( $loginpress_setting['login_with_email'] ); |
| 37 |
update_option( 'loginpress_setting', $loginpress_setting ); |
| 38 |
} else if ( 'off' == $login_with_email ) { |
| 39 |
|
| 40 |
$loginpress_setting['login_order'] = 'default'; |
| 41 |
unset( $loginpress_setting['login_with_email'] ); |
| 42 |
update_option( 'loginpress_setting', $loginpress_setting ); |
| 43 |
} |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
if ( ! class_exists( 'LoginPress_Compatibility' ) ) : |
| 48 |
|
| 49 |
/** |
| 50 |
* LoginPress compatibility Class is used to make LoginPress compatibile with other plugins. |
| 51 |
* Remove conflictions. |
| 52 |
* Add CSS Support. |
| 53 |
* @since 1.0.3 |
| 54 |
*/ |
| 55 |
class LoginPress_Compatibility { |
| 56 |
|
| 57 |
public function __construct() { |
| 58 |
$this->dependencies(); |
| 59 |
} |
| 60 |
|
| 61 |
public function dependencies() { |
| 62 |
|
| 63 |
add_action( 'wp_print_scripts', array( $this, 'dequeue_conflicted_script' ), 100 ); |
| 64 |
add_action( 'login_headerurl', array( $this, 'remove_conflicted_action' ) ); |
| 65 |
add_action( 'init', array( $this, 'enqueue_loginpress_compatibility_script') ); |
| 66 |
} |
| 67 |
|
| 68 |
public function enqueue_loginpress_compatibility_script() { |
| 69 |
|
| 70 |
/** |
| 71 |
* Enqueue LoginPress CSS on Password_Protected plugin. |
| 72 |
* |
| 73 |
* Hooked to the password_protected_login_head action, |
| 74 |
* so that it is after the script was enqueued. |
| 75 |
* @since 1.0.3 |
| 76 |
*/ |
| 77 |
if ( class_exists( 'Password_Protected' ) ) { |
| 78 |
add_action( 'password_protected_login_head', array( $this, 'enqueue_loginpress_script' ) ); |
| 79 |
} |
| 80 |
} |
| 81 |
|
| 82 |
/** |
| 83 |
* dequeue_conflicted_script |
| 84 |
* @since 1.0.3 |
| 85 |
*/ |
| 86 |
public function dequeue_conflicted_script() { |
| 87 |
|
| 88 |
/** |
| 89 |
* Dequeue the Divi Login script. |
| 90 |
* |
| 91 |
* Hooked to the wp_print_scripts action, with a late priority (100), |
| 92 |
* so that it is after the script was enqueued. |
| 93 |
* @since 1.0.3 |
| 94 |
*/ |
| 95 |
if ( class_exists( 'ET_Divi_100_Custom_Login_Page_Config' ) ) { |
| 96 |
wp_dequeue_style( 'custom-login-pages' ); |
| 97 |
wp_dequeue_script( 'custom-login-pages-icon-font' ); |
| 98 |
wp_dequeue_script( 'custom-login-pages-scripts' ); |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
/** |
| 103 |
* remove_conflicted_action |
| 104 |
* @since 1.0.3 |
| 105 |
*/ |
| 106 |
public function remove_conflicted_action() { |
| 107 |
|
| 108 |
/** |
| 109 |
* Remove the Divi login_footer hook 'print_styles' |
| 110 |
*So that confliction is removed. |
| 111 |
* |
| 112 |
* @since 1.0.3 |
| 113 |
*/ |
| 114 |
if ( class_exists( 'ET_Divi_100_Custom_Login_Page_Config' ) ) { |
| 115 |
|
| 116 |
remove_action( 'login_footer', array( ET_Divi_100_Custom_Login_Page::instance(), 'print_styles' ) ); |
| 117 |
} |
| 118 |
} |
| 119 |
|
| 120 |
/** |
| 121 |
* Include LoginPress CSS for Support with other plugins. |
| 122 |
* @since 1.0.3 |
| 123 |
*/ |
| 124 |
public function enqueue_loginpress_script() { |
| 125 |
include( LOGINPRESS_DIR_PATH . 'css/style-presets.php' ); |
| 126 |
include( LOGINPRESS_DIR_PATH . 'css/style-login.php' ); |
| 127 |
} |
| 128 |
|
| 129 |
} |
| 130 |
|
| 131 |
endif; |
| 132 |
|
| 133 |
new LoginPress_Compatibility; |
| 134 |
?> |
| 135 |
|