PluginProbe
LoginPress | wp-login Custom Login Page Customizer / 1.1.4
LoginPress | wp-login Custom Login Page Customizer v1.1.4
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.1.4, at include/compatibility.php

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