Rename wp-login.php - Version 1.8

Version Description

  • OOP PHP.
  • Requires WordPress 3.7 or higher.
  • MultiViews compatible.
Download this release

Release Info

Developer avryl
Plugin Icon 128x128 Rename wp-login.php
Version 1.8
Comparing to
See all releases

Code changes from version 1.7 to 1.8

Files changed (4) hide show
  1. readme.md +13 -17
  2. readme.txt +12 -12
  3. rename-wp-login.php +280 -198
  4. rwl-login.php +3 -1
readme.md CHANGED
@@ -1,10 +1,10 @@
1
  # Rename wp-login.php
2
 
3
  **Contributors:** avryl
4
- **Tags:** rename, login, wp-login, wp-login.php, brute force, attacks
5
- **Requires at least:** 3.6
6
- **Tested up to:** 3.7
7
- **Stable tag:** 1.7
8
  **License:** GPLv2 or later
9
  **License URI:** http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -17,7 +17,7 @@ Please bookmark or remember your login url, accessing wp-login.php or wp-admin w
17
 
18
  ### Compatibility
19
 
20
- Works perfectly on WordPress 3.6 or higher. The registration form, lost password form, login widget and expired sessions will keep working.
21
 
22
  Compatible with plugins like:
23
 
@@ -44,10 +44,6 @@ While you could use this plugin to prevent a lot of brute force attacks, it does
44
 
45
  If you want to keep your login url secret, you should make sure there aren’t any links pointing to it on your website.
46
 
47
- ### GitHub
48
-
49
- This plugin has a [mirror](https://github.com/avryl/rename-wp-login) on GitHub.
50
-
51
  ## Installation
52
 
53
  1. Go to Plugins › Add New.
@@ -64,7 +60,13 @@ Either go to your MySQL database and look for the value of `rwl_page` in the opt
64
 
65
  ## Changelog
66
 
67
- ### 1.6
 
 
 
 
 
 
68
 
69
  * Made compatible with WordPress 3.7.
70
 
@@ -97,10 +99,4 @@ Either go to your MySQL database and look for the value of `rwl_page` in the opt
97
 
98
  ### 1.0
99
 
100
- * Initial version.
101
-
102
- ## Upgrade Notice
103
-
104
- ### 1.7
105
-
106
- Always immediately update this plugin please!
1
  # Rename wp-login.php
2
 
3
  **Contributors:** avryl
4
+ **Tags:** rename, login, wp-login, wp-login.php, brute force attacks, custom login url
5
+ **Requires at least:** 3.7
6
+ **Tested up to:** 3.7.1
7
+ **Stable tag:** 1.8
8
  **License:** GPLv2 or later
9
  **License URI:** http://www.gnu.org/licenses/gpl-2.0.html
10
 
17
 
18
  ### Compatibility
19
 
20
+ Requires WordPress 3.7 or higher. The registration form, lost password form, login widget and expired sessions will keep working.
21
 
22
  Compatible with plugins like:
23
 
44
 
45
  If you want to keep your login url secret, you should make sure there aren’t any links pointing to it on your website.
46
 
 
 
 
 
47
  ## Installation
48
 
49
  1. Go to Plugins › Add New.
60
 
61
  ## Changelog
62
 
63
+ ### 1.8
64
+
65
+ * OOP PHP.
66
+ * Requires WordPress 3.7 or higher.
67
+ * MultiViews compatible.
68
+
69
+ ### 1.7
70
 
71
  * Made compatible with WordPress 3.7.
72
 
99
 
100
  ### 1.0
101
 
102
+ * Initial version.
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Rename wp-login.php ===
2
 
3
  Contributors: avryl
4
- Tags: rename, login, wp-login, wp-login.php, brute force, attacks
5
- Requires at least: 3.6
6
- Tested up to: 3.7
7
- Stable tag: 1.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -17,7 +17,7 @@ Please bookmark or remember your login url, accessing wp-login.php or wp-admin w
17
 
18
  = Compatibility =
19
 
20
- Works perfectly on WordPress 3.6 or higher. The registration form, lost password form, login widget and expired sessions will keep working.
21
 
22
  Compatible with plugins like:
23
 
@@ -64,6 +64,12 @@ Either go to your MySQL database and look for the value of `rwl_page` in the opt
64
 
65
  == Changelog ==
66
 
 
 
 
 
 
 
67
  = 1.7 =
68
 
69
  * Made compatible with WordPress 3.7.
@@ -97,10 +103,4 @@ Either go to your MySQL database and look for the value of `rwl_page` in the opt
97
 
98
  = 1.0 =
99
 
100
- * Initial version.
101
-
102
- == Upgrade Notice ==
103
-
104
- = 1.7 =
105
-
106
- Always immediately update this plugin please!
1
  === Rename wp-login.php ===
2
 
3
  Contributors: avryl
4
+ Tags: rename, login, wp-login, wp-login.php, brute force attacks, custom login url
5
+ Requires at least: 3.7
6
+ Tested up to: 3.7.1
7
+ Stable tag: 1.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
17
 
18
  = Compatibility =
19
 
20
+ Requires WordPress 3.7 or higher. The registration form, lost password form, login widget and expired sessions will keep working.
21
 
22
  Compatible with plugins like:
23
 
64
 
65
  == Changelog ==
66
 
67
+ = 1.8 =
68
+
69
+ * OOP PHP.
70
+ * Requires WordPress 3.7 or higher.
71
+ * MultiViews compatible.
72
+
73
  = 1.7 =
74
 
75
  * Made compatible with WordPress 3.7.
103
 
104
  = 1.0 =
105
 
106
+ * Initial version.
 
 
 
 
 
 
rename-wp-login.php CHANGED
@@ -6,240 +6,322 @@ Plugin URI: http://wordpress.org/plugins/rename-wp-login/
6
  Description: Change wp-login.php to whatever you want. It can also prevent a lot of brute force attacks.
7
  Author: avryl
8
  Author URI: http://profiles.wordpress.org/avryl/
9
- Version: 1.7
10
  Text Domain: rename-wp-login
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
  */
14
 
15
- register_activation_hook( __FILE__, 'rwl_activation' );
16
- register_uninstall_hook( __FILE__, 'rwl_uninstall' );
17
-
18
- add_action( 'admin_init', 'rwl_admin_init' );
19
- add_action( 'admin_notices', 'rwl_admin_notices' );
20
-
21
- add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'rwl_plugin_action_links' );
22
-
23
- function rwl_activation() {
24
-
25
- add_option( 'rwl_redirect', '1' );
26
- add_option( 'rwl_admin', '0' );
27
- add_option( 'rwl_page', wp_unique_post_slug( 'login', 0, 'publish', 'page', 0 ) );
28
-
29
- }
30
-
31
- function rwl_uninstall() {
32
-
33
- delete_option( 'rwl_page' );
34
- delete_option( 'rwl_admin' );
35
 
36
- }
37
-
38
- function rwl_admin_init() {
39
-
40
- add_settings_section( 'rename-wp-login-section', 'Login', '__return_false', 'permalink' );
41
-
42
- add_settings_field( 'rwl-page', '<label for="rwl-page-input">Rename wp-login.php</label>', 'rwl_page', 'permalink', 'rename-wp-login-section' );
43
- add_settings_field( 'rwl-admin', '<label for="rwl-admin-input">Redirect wp-admin to new login page (not recommended)</label>', 'rwl_admin', 'permalink', 'rename-wp-login-section' );
44
-
45
- if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
46
 
47
- if ( ! empty( $_POST['rwl_page'] ) ) {
48
 
49
- update_option( 'rwl_page', wp_unique_post_slug( sanitize_title_with_dashes( $_POST['rwl_page'] ), 0, 'publish', 'page', 0 ) );
50
 
51
  }
52
 
53
- update_option( 'rwl_admin', isset( $_POST['rwl_admin'] ) ? $_POST['rwl_admin'] : '0' );
 
 
 
 
54
 
55
- }
56
-
57
- if ( get_option( 'rwl_redirect' ) == '1' ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
- delete_option( 'rwl_redirect' );
 
 
 
 
60
 
61
- wp_redirect( admin_url( 'options-permalink.php#rwl-page-input' ) );
 
 
 
 
 
 
 
62
 
63
- }
64
-
65
- }
66
-
67
- function rwl_page() {
68
-
69
- echo '<code>' . home_url() . '/</code> <input id="rwl-page-input" type="text" name="rwl_page" value="' . get_option( 'rwl_page' ) . '" /> <code>/</code>';
70
-
71
- }
72
-
73
- function rwl_admin() {
74
-
75
- echo '<input id="rwl-admin-input" type="checkbox" name="rwl_admin" value="1" ' . checked( get_option( 'rwl_admin' ), true, false ) . ' />';
76
-
77
- }
78
-
79
- function rwl_admin_notices() {
80
-
81
- global $pagenow;
82
-
83
- if ( ! get_option( 'permalink_structure' ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
- echo '<div class="error"><p><strong>Rename wp-login.php</strong> doesn’t work if you’re using the default permalink structure.<br>You must <a href="' . admin_url( 'options-permalink.php' ) . '">choose</a> another permalink structure for it to work.</p></div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
- } elseif ( isset( $_GET['settings-updated'] ) && $pagenow == 'options-permalink.php' ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
- echo '<div class="updated"><p>Your login page is now here: <a href="' . home_url() . '/' . get_option( 'rwl_page' ) . '/">' . home_url() . '/<strong>' . get_option( 'rwl_page' ) . '</strong>/</a>. Bookmark this page!</p></div>';
 
 
 
 
90
 
91
- }
92
-
93
- }
94
-
95
- function rwl_plugin_action_links( $links ) {
96
-
97
- array_unshift( $links, '<a href="options-permalink.php#rwl-page-input">Settings</a>' );
98
-
99
- return $links;
100
-
101
- }
102
-
103
- if ( ! get_option('permalink_structure') )
104
- return;
105
-
106
- add_action( 'init', 'rwl_init', 11 );
107
- add_action( 'login_init', 'rwl_login_init' );
108
-
109
- add_filter( 'site_url', 'rwl_filter_site_url', 10, 4 );
110
- add_filter( 'login_url', 'rwl_filter_login_url', 10, 2 );
111
- add_filter( 'logout_url', 'rwl_filter_logout_url', 10, 2 );
112
- add_filter( 'register_url', 'rwl_filter_register_url', 10, 1 );
113
- add_filter( 'lostpassword_url', 'rwl_filter_lostpassword_url', 10, 2 );
114
-
115
- function rwl_init() {
116
-
117
- if ( is_admin() && ! is_user_logged_in() && ! defined( 'DOING_AJAX' ) && get_option( 'rwl_admin' ) != '1' ) {
118
 
119
- remove_action( 'wp_head', 'mp6_override_toolbar_margin', 11 );
 
 
 
 
120
 
121
- rwl_404();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
- }
124
-
125
- if ( ! get_option( 'rwl_page' ) || get_option( 'rwl_page' ) == '' ) {
 
 
 
 
126
 
127
- update_option( 'rwl_page', wp_unique_post_slug( 'login', 0, 'publish', 'page', 0 ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
 
129
- }
130
-
131
- if ( strpos( $_SERVER['REQUEST_URI'], get_option( 'rwl_page' ) ) ) {
 
 
 
 
 
 
132
 
133
- $home_url = parse_url( home_url() );
 
 
 
 
134
 
135
- $home_path = '';
136
- if ( isset( $home_url['path'] ) )
137
- $home_path = $home_url['path'];
138
- $home_path = trim( $home_path, '/' );
 
 
 
 
 
 
139
 
140
- $req_uri = $_SERVER['REQUEST_URI'];
141
- $req_uri_array = explode( '?', $req_uri );
142
- $req_uri = $req_uri_array[0];
143
- $req_uri = trim( $req_uri, '/' );
144
- $req_uri = preg_replace( "|^$home_path|i", '', $req_uri );
145
- $req_uri = trim( $req_uri, '/' );
 
 
 
 
 
 
 
146
 
147
- if ( $req_uri == get_option('rwl_page') ) {
148
 
149
- status_header( 200 );
150
 
151
- require_once( dirname( __FILE__ ) . '/rwl-login.php' );
 
 
152
 
153
- exit;
 
 
 
 
 
 
 
154
 
155
  }
156
 
157
- }
158
-
159
- }
160
-
161
- function rwl_login_init() {
162
-
163
- if ( strpos( $_SERVER['REQUEST_URI'], 'wp-login.php' ) ) {
164
 
165
- rwl_404();
166
 
167
  }
168
 
169
- }
170
-
171
- function rwl_filter_site_url( $url, $path, $scheme, $blog_id ) {
172
-
173
- return ( strpos( $path, 'wp-login.php' ) !== false && $scheme == 'login_post' ) ? rwl_login_url() . str_replace( 'wp-login.php', '', $path ) : $url;
174
-
175
- }
176
-
177
- function rwl_filter_login_url( $login_url, $redirect = '' ) {
178
-
179
- $login_url = rwl_login_url();
180
-
181
- if ( ! empty( $redirect ) )
182
- $login_url = add_query_arg( 'redirect_to', urlencode( $redirect ), $login_url );
183
-
184
- return $login_url;
185
-
186
- }
187
-
188
- function rwl_filter_logout_url( $login_url, $redirect = '' ) {
189
-
190
- $args = array();
191
- $args['action'] = 'logout';
192
- if ( ! empty( $redirect ) )
193
- $args['redirect_to'] = urlencode( $redirect );
194
-
195
- $logout_url = add_query_arg( $args, rwl_login_url() );
196
- $logout_url = wp_nonce_url( $logout_url, 'log-out' );
197
-
198
- return $logout_url;
199
-
200
- }
201
-
202
- function rwl_filter_register_url( $register_url ) {
203
-
204
- return rwl_login_url() . '?action=register';
205
-
206
- }
207
-
208
- function rwl_filter_lostpassword_url( $lostpassword_url, $redirect = '' ) {
209
-
210
- $args = array();
211
- $args['action'] = 'lostpassword';
212
- if ( ! empty( $redirect) )
213
- $args['redirect_to'] = urlencode( $redirect );
214
-
215
- $lostpassword_url = add_query_arg( $args, rwl_login_url() );
216
-
217
- return $lostpassword_url;
218
-
219
- }
220
-
221
- function rwl_login_url() {
222
-
223
- return home_url() . '/' . get_option( 'rwl_page' ) . '/';
224
-
225
- }
226
-
227
- function rwl_404() {
228
-
229
- global $wp_query;
230
-
231
- status_header( 404 );
232
-
233
- $wp_query->set_404();
234
-
235
- $template = get_404_template();
236
-
237
- if ( ! $template )
238
- $template = get_index_template();
239
-
240
- if ( $template = apply_filters( 'template_include', $template ) )
241
- include( $template );
242
-
243
- exit;
244
-
245
  }
6
  Description: Change wp-login.php to whatever you want. It can also prevent a lot of brute force attacks.
7
  Author: avryl
8
  Author URI: http://profiles.wordpress.org/avryl/
9
+ Version: 1.8
10
  Text Domain: rename-wp-login
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
  */
14
 
15
+ if ( ! class_exists( 'Rename_WP_Login' ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
+ class Rename_WP_Login {
18
+
19
+ private static $instance;
 
 
 
 
 
 
 
20
 
21
+ private function basename() {
22
 
23
+ return plugin_basename( __FILE__ );
24
 
25
  }
26
 
27
+ private function url() {
28
+
29
+ return plugin_dir_url( __FILE__ );
30
+
31
+ }
32
 
33
+ private function path() {
34
+
35
+ return trailingslashit( dirname( __FILE__ ) );
36
+
37
+ }
38
+
39
+ private function set_404() {
40
+
41
+ global $wp_query;
42
+
43
+ status_header( 404 );
44
+
45
+ $wp_query->set_404();
46
+
47
+ $template = get_404_template();
48
+
49
+ if ( ! $template )
50
+ $template = get_index_template();
51
+
52
+ if ( $template = apply_filters( 'template_include', $template ) )
53
+ include( $template );
54
+
55
+ exit;
56
+
57
+ }
58
 
59
+ private function new_login_url() {
60
+
61
+ return home_url() . '/' . get_option( 'rwl_page' ) . '/';
62
+
63
+ }
64
 
65
+ public static function instance() {
66
+
67
+ if ( ! self::$instance )
68
+ self::$instance = new self;
69
+
70
+ return self::$instance;
71
+
72
+ }
73
 
74
+ private function __construct() {
75
+
76
+ global $wp_version;
77
+
78
+ if ( version_compare( $wp_version, '3.7', '<' ) ) {
79
+
80
+ add_action( 'admin_init', array( $this, 'admin_init_incompatible' ) );
81
+ add_action( 'admin_notices', array( $this, 'admin_notices_incompatible' ) );
82
+
83
+ return;
84
+
85
+ }
86
+
87
+ register_activation_hook( $this->basename(), array( $this, 'activate' ) );
88
+ register_uninstall_hook( $this->basename(), array( 'Rename_WP_Login', 'uninstall' ) );
89
+
90
+ add_action( 'admin_init', array( $this, 'admin_init' ) );
91
+ add_action( 'admin_notices', array( $this, 'admin_notices' ) );
92
+
93
+ add_filter( 'plugin_action_links_' . $this->basename(), array( $this, 'plugin_action_links' ) );
94
+
95
+ if ( ! get_option('permalink_structure') )
96
+ return;
97
+
98
+ add_action( 'init', array( $this, 'init' ), 11 );
99
+ add_action( 'login_init', array( $this, 'login_init' ) );
100
+
101
+ add_filter( 'site_url', array( $this, 'site_url' ), 10, 4 );
102
+ add_filter( 'login_url', array( $this, 'login_url' ), 10, 2 );
103
+ add_filter( 'logout_url', array( $this, 'logout_url' ), 10, 2 );
104
+ add_filter( 'register_url', array( $this, 'register_url' ), 10, 1 );
105
+ add_filter( 'lostpassword_url', array( $this, 'lostpassword_url' ), 10, 2 );
106
+
107
+ }
108
 
109
+ public function admin_init_incompatible() {
110
+
111
+ deactivate_plugins( $this->basename() );
112
+
113
+ }
114
+
115
+ public function admin_notices_incompatible() {
116
+
117
+ echo '<div class="error"><p>Please upgrade to the latest version of WordPress before activating <strong>Rename wp-login.php</strong>.</p></div>';
118
+
119
+ if ( isset( $_GET['activate'] ) )
120
+ unset( $_GET['activate'] );
121
+
122
+ }
123
+
124
+ public function activate() {
125
+
126
+ add_option( 'rwl_redirect', '1' );
127
+ add_option( 'rwl_page', 'login' );
128
+
129
+ }
130
+
131
+ public static function uninstall() {
132
+
133
+ delete_option( 'rwl_page' );
134
+ delete_option( 'rwl_admin' );
135
+
136
+ }
137
 
138
+ public function admin_init() {
139
+
140
+ add_settings_section( 'rename-wp-login-section', 'Login', '__return_false', 'permalink' );
141
+
142
+ add_settings_field( 'rwl-page', '<label for="rwl-page-input">Rename wp-login.php</label>', array( $this, 'rwl_page_input' ), 'permalink', 'rename-wp-login-section' );
143
+ add_settings_field( 'rwl-admin', '<label for="rwl-admin-input">Redirect wp-admin</label>', array( $this, 'rwl_admin_input' ), 'permalink', 'rename-wp-login-section' );
144
+
145
+ if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
146
+
147
+ if ( ! empty( $_POST['rwl_page'] ) ) {
148
+
149
+ update_option( 'rwl_page', sanitize_title_with_dashes( $_POST['rwl_page'] ) );
150
+
151
+ }
152
+
153
+ if ( isset( $_POST['rwl_admin'] ) ) {
154
+
155
+ update_option( 'rwl_admin', '1' );
156
+
157
+ } else {
158
+
159
+ delete_option( 'rwl_admin' );
160
+
161
+ }
162
+
163
+
164
+
165
+ }
166
+
167
+ if ( get_option( 'rwl_redirect' ) ) {
168
+
169
+ delete_option( 'rwl_redirect' );
170
+
171
+ wp_redirect( admin_url( 'options-permalink.php#rwl-page-input' ) );
172
 
173
+ exit;
174
+
175
+ }
176
+
177
+ }
178
 
179
+ public function rwl_page_input() {
180
+
181
+ echo '<code>' . home_url() . '/</code> <input id="rwl-page-input" type="text" name="rwl_page" value="' . get_option( 'rwl_page' ) . '"> <code>/</code>';
182
+
183
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
 
185
+ public function rwl_admin_input() {
186
+
187
+ echo '<input id="rwl-admin-input" type="checkbox" name="rwl_admin" value="1" ' . checked( get_option( 'rwl_admin' ), true, false ) . '> Enabling this option will redirect any admin requests to the new login page if not logged in, but beware that this will reveal the location of it.';
188
+
189
+ }
190
 
191
+ public function admin_notices() {
192
+
193
+ global $pagenow;
194
+
195
+ if ( ! get_option( 'permalink_structure' ) ) {
196
+
197
+ echo '<div class="error"><p><strong>Rename wp-login.php</strong> doesn’t work if you’re using the default permalink structure.<br>You must <a href="' . admin_url( 'options-permalink.php' ) . '">choose</a> another permalink structure for it to work.</p></div>';
198
+
199
+ } elseif ( isset( $_GET['settings-updated'] ) && $pagenow == 'options-permalink.php' ) {
200
+
201
+ echo '<div class="updated"><p>Your login page is now here: <a href="' . $this->new_login_url() . '">' . home_url() . '/<strong>' . get_option( 'rwl_page' ) . '</strong>/</a>. Bookmark this page!</p></div>';
202
+
203
+ }
204
+
205
+ }
206
 
207
+ public function plugin_action_links( $links ) {
208
+
209
+ array_unshift( $links, '<a href="options-permalink.php#rwl-page-input">Settings</a>' );
210
+
211
+ return $links;
212
+
213
+ }
214
 
215
+ public function init() {
216
+
217
+ if ( is_admin() && ! is_user_logged_in() && ! defined( 'DOING_AJAX' ) && ! get_option( 'rwl_admin' ) ) {
218
+
219
+ remove_action( 'wp_head', 'mp6_override_toolbar_margin', 11 );
220
+
221
+ $this->set_404();
222
+
223
+ }
224
+
225
+ if ( ! get_option( 'rwl_page' ) ) {
226
+
227
+ update_option( 'rwl_page', 'login' );
228
+
229
+ }
230
+
231
+ if ( strpos( $_SERVER['REQUEST_URI'], get_option( 'rwl_page' ) ) ) {
232
+
233
+ $home_url = parse_url( home_url() );
234
+
235
+ $home_path = '';
236
+ if ( isset( $home_url['path'] ) )
237
+ $home_path = $home_url['path'];
238
+ $home_path = trim( $home_path, '/' );
239
+
240
+ $req_uri = $_SERVER['REQUEST_URI'];
241
+ $req_uri_array = explode( '?', $req_uri );
242
+ $req_uri = $req_uri_array[0];
243
+ $req_uri = trim( $req_uri, '/' );
244
+ $req_uri = preg_replace( "|^$home_path|i", '', $req_uri );
245
+ $req_uri = trim( $req_uri, '/' );
246
+
247
+ if ( $req_uri == get_option('rwl_page') ) {
248
+
249
+ status_header( 200 );
250
+
251
+ require_once( dirname( __FILE__ ) . '/rwl-login.php' );
252
+
253
+ exit;
254
+
255
+ }
256
+
257
+ }
258
+
259
+ }
260
 
261
+ public function login_init() {
262
+
263
+ if ( strpos( $_SERVER['REQUEST_URI'], 'wp-login' ) ) {
264
+
265
+ $this->set_404();
266
+
267
+ }
268
+
269
+ }
270
 
271
+ public function site_url( $url, $path, $scheme, $blog_id ) {
272
+
273
+ return ( strpos( $path, 'wp-login.php' ) !== false && $scheme == 'login_post' ) ? $this->new_login_url() . str_replace( 'wp-login.php', '', $path ) : $url;
274
+
275
+ }
276
 
277
+ public function login_url( $login_url, $redirect = '' ) {
278
+
279
+ $login_url = $this->new_login_url();
280
+
281
+ if ( ! empty( $redirect ) )
282
+ $login_url = add_query_arg( 'redirect_to', urlencode( $redirect ), $login_url );
283
+
284
+ return $login_url;
285
+
286
+ }
287
 
288
+ public function logout_url( $login_url, $redirect = '' ) {
289
+
290
+ $args = array();
291
+ $args['action'] = 'logout';
292
+ if ( ! empty( $redirect ) )
293
+ $args['redirect_to'] = urlencode( $redirect );
294
+
295
+ $logout_url = add_query_arg( $args, $this->new_login_url() );
296
+ $logout_url = wp_nonce_url( $logout_url, 'log-out' );
297
+
298
+ return $logout_url;
299
+
300
+ }
301
 
302
+ public function register_url( $register_url ) {
303
 
304
+ return $this->new_login_url() . '?action=register';
305
 
306
+ }
307
+
308
+ public function lostpassword_url( $lostpassword_url, $redirect = '' ) {
309
 
310
+ $args = array();
311
+ $args['action'] = 'lostpassword';
312
+ if ( ! empty( $redirect) )
313
+ $args['redirect_to'] = urlencode( $redirect );
314
+
315
+ $lostpassword_url = add_query_arg( $args, $this->new_login_url() );
316
+
317
+ return $lostpassword_url;
318
 
319
  }
320
 
 
 
 
 
 
 
 
321
 
 
322
 
323
  }
324
 
325
+ Rename_WP_Login::instance();
326
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
327
  }
rwl-login.php CHANGED
@@ -829,7 +829,9 @@ default:
829
  wp_clear_auth_cookie();
830
 
831
  login_header(__('Log In'), '', $errors);
832
-
 
 
833
  if ( isset($_POST['log']) )
834
  $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(wp_unslash($_POST['log'])) : '';
835
  $rememberme = ! empty( $_POST['rememberme'] );
829
  wp_clear_auth_cookie();
830
 
831
  login_header(__('Log In'), '', $errors);
832
+
833
+ $user_login = '';
834
+
835
  if ( isset($_POST['log']) )
836
  $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(wp_unslash($_POST['log'])) : '';
837
  $rememberme = ! empty( $_POST['rememberme'] );