PluginProbe
LoginPress | wp-login Custom Login Page Customizer / 1.3.1
LoginPress | wp-login Custom Login Page Customizer v1.3.1
6.2.5 6.2.4 6.2.3 6.2.2 6.2.1 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.3 1.0.4 All 118 releases
loginpress / include / compatibility.php

compatibility.php in LoginPress | wp-login Custom Login Page Customizer 1.3.1, at include/compatibility.php

258 lines 8.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 * @version 1.2.3
55 */
56 class LoginPress_Compatibility {
57
58 public function __construct() {
59 $this->dependencies();
60 }
61
62 public function dependencies() {
63
64 add_action( 'wp_print_scripts', array( $this, 'dequeue_conflicted_script' ), 100 );
65 add_action( 'login_headerurl', array( $this, 'remove_conflicted_action' ) );
66 add_action( 'init', array( $this, 'enqueue_loginpress_compatibility_script') );
67
68 /*************************************
69 WebArx Compatibility Fix // v1.2.3
70 *************************************/
71
72 add_filter( 'wp_redirect', array( $this, 'wp_redirect_remove_filter' ), 9 );
73 add_filter( 'site_url', array( $this, 'site_url_remove_filter' ) , 9 );
74 add_filter( 'network_site_url', array( $this, 'network_site_url_remove_filter' ), 9 );
75 add_action( 'plugins_loaded', array( $this, 'plugins_loaded_remove_action' ), 10 );
76 add_action( 'wp_loaded', array( $this, 'wp_loaded_remove_action' ), 9 );
77 add_action( 'init', array( $this, 'init_remove_action' ), 9 );
78 }
79
80 public function wp_redirect_remove_filter( $location ) {
81 if ( class_exists( 'Webarx' ) ) {
82
83 if ( ! function_exists( 'is_user_logged_in' ) ) {
84 return $location;
85 }
86
87 $webarx_login = get_option( 'webarx_mv_wp_login' );
88 $user_loged_in = is_user_logged_in();
89
90 if ( ( isset( $user_loged_in ) && true === $user_loged_in ) && ( isset( $webarx_login ) && '1' === $webarx_login ) ) {
91 remove_filter( 'wp_redirect', array( webarx()->hide_login, 'wp_redirect' ) );
92 }
93 }
94 return $location;
95 }
96
97 public function site_url_remove_filter( $url ) {
98 if ( class_exists( 'Webarx' ) ) {
99
100 if ( ! function_exists( 'is_user_logged_in' ) ) {
101 return $url;
102 }
103
104 $webarx_login = get_option( 'webarx_mv_wp_login' );
105 $user_loged_in = is_user_logged_in();
106
107 if ( ( isset( $user_loged_in ) && true === $user_loged_in ) && ( isset( $webarx_login ) && '1' === $webarx_login ) ) {
108 remove_filter('site_url', array( webarx()->hide_login, 'site_url' ) ) ;
109 }
110 }
111 return $url;
112 }
113
114 public function network_site_url_remove_filter( $url ) {
115 if ( class_exists( 'Webarx' ) ) {
116
117 if ( ! function_exists( 'is_user_logged_in' ) ) {
118 return $url;
119 }
120
121 $webarx_login = get_option( 'webarx_mv_wp_login' );
122 $user_loged_in = is_user_logged_in();
123
124 if ( ( isset( $user_loged_in ) && true === $user_loged_in ) && ( isset( $webarx_login ) && '1' === $webarx_login ) ) {
125 remove_filter('network_site_url', array( webarx()->hide_login, 'network_site_url' ) ) ;
126 }
127 }
128 return $url;
129 }
130
131 public function plugins_loaded_remove_action() {
132 if ( class_exists( 'Webarx' ) ) {
133
134 if ( ! function_exists( 'is_user_logged_in' ) ) {
135 return;
136 }
137
138 $webarx_login = get_option( 'webarx_mv_wp_login' );
139 $user_loged_in = is_user_logged_in();
140
141 if ( ( isset( $user_loged_in ) && true === $user_loged_in ) && ( isset( $webarx_login ) && '1' === $webarx_login ) ) {
142 remove_action( 'plugins_loaded', array( webarx()->hide_login, 'plugins_loaded' ), 9999 ) ;
143 }
144 }
145 }
146
147 public function wp_loaded_remove_action() {
148 if ( class_exists( 'Webarx' ) ) {
149
150 if ( ! function_exists( 'is_user_logged_in' ) ) {
151 return $url;
152 }
153
154 $webarx_login = get_option( 'webarx_mv_wp_login' );
155 $user_loged_in = is_user_logged_in();
156
157 if ( ( isset( $user_loged_in ) && true === $user_loged_in ) && ( isset( $webarx_login ) && '1' === $webarx_login ) ) {
158 remove_action( 'wp_loaded', array( webarx()->hide_login, 'wp_loaded' ) );
159 }
160 }
161 }
162
163 public function init_remove_action() {
164 if ( class_exists( 'Webarx' ) ) {
165
166 if ( ! function_exists( 'is_user_logged_in' ) ) {
167 return $url;
168 }
169
170 $webarx_login = get_option( 'webarx_mv_wp_login' );
171 $user_loged_in = is_user_logged_in();
172
173 if ( ( isset( $user_loged_in ) && true === $user_loged_in ) && ( isset( $webarx_login ) && '1' === $webarx_login ) ) {
174 remove_action( 'init', array( webarx()->hide_login, 'denyRequestsToWpLogin' ) ) ;
175 }
176 }
177 }
178
179 public function enqueue_loginpress_compatibility_script() {
180
181 /**
182 * Enqueue LoginPress CSS on Password_Protected plugin.
183 *
184 * Hooked to the password_protected_login_head action,
185 * Head URL on logo as well.
186 *
187 * so that it is after the script was enqueued.
188 * @since 1.0.3
189 */
190 if ( class_exists( 'Password_Protected' ) ) {
191 add_action( 'password_protected_login_head', array( $this, 'enqueue_loginpress_script' ) );
192 add_filter('password_protected_login_headerurl', array( $this, 'password_protected_login_headerurl_cb' ) );
193 }
194 }
195
196 /**
197 * dequeue_conflicted_script
198 * @since 1.0.3
199 */
200 public function dequeue_conflicted_script() {
201
202 /**
203 * Dequeue the Divi Login script.
204 *
205 * Hooked to the wp_print_scripts action, with a late priority (100),
206 * so that it is after the script was enqueued.
207 * @since 1.0.3
208 */
209 if ( class_exists( 'ET_Divi_100_Custom_Login_Page_Config' ) ) {
210 wp_dequeue_style( 'custom-login-pages' );
211 wp_dequeue_script( 'custom-login-pages-icon-font' );
212 wp_dequeue_script( 'custom-login-pages-scripts' );
213 }
214 }
215
216 /**
217 * remove_conflicted_action
218 * @since 1.0.3
219 */
220 public function remove_conflicted_action() {
221
222 /**
223 * Remove the Divi login_footer hook 'print_styles'
224 *So that confliction is removed.
225 *
226 * @since 1.0.3
227 */
228 if ( class_exists( 'ET_Divi_100_Custom_Login_Page_Config' ) ) {
229
230 remove_action( 'login_footer', array( ET_Divi_100_Custom_Login_Page::instance(), 'print_styles' ) );
231 }
232 }
233
234 /**
235 * Include LoginPress CSS for Support with other plugins.
236 * @since 1.0.3
237 */
238 public function enqueue_loginpress_script() {
239 include( LOGINPRESS_DIR_PATH . 'css/style-presets.php' );
240 include( LOGINPRESS_DIR_PATH . 'css/style-login.php' );
241 }
242
243 /**
244 * Password protected plugin compatlibility iwth logo url.
245 * @since 1.3.1
246 */
247 public function password_protected_login_headerurl_cb() {
248 $logo_url = get_option( 'loginpress_customization' );
249 $logo_url = $logo_url['customize_logo_hover'];
250
251 return $logo_url;
252 }
253
254 }
255
256 endif;
257
258 new LoginPress_Compatibility;