Version Description
- Works now with non-pretty permalinks!
- Gives a message when using W3 Total Cache or WP Super Cache to update options.
Download this release
Release Info
Developer | avryl |
Plugin | Rename wp-login.php |
Version | 2.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.1 to 2.1
- readme.md +6 -3
- readme.txt +7 -3
- rename-wp-login.php +114 -75
readme.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
**Tags:** rename, login, wp-login, wp-login.php, brute force attacks, custom login url
|
5 |
**Requires at least:** 3.8
|
6 |
**Tested up to:** 3.8
|
7 |
-
**Stable tag:** 2.
|
8 |
**License:** GPLv2 or later
|
9 |
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -19,8 +19,6 @@ Please bookmark or remember your login url, accessing wp-login.php or wp-admin w
|
|
19 |
|
20 |
Requires WordPress 3.8 or higher. The registration form, lost password form, login widget and expired sessions will keep working.
|
21 |
|
22 |
-
You also must have pretty, or almost pretty, permalinks enabled.
|
23 |
-
|
24 |
Compatible with plugins like:
|
25 |
|
26 |
* BuddyPress,
|
@@ -62,6 +60,11 @@ Either go to your MySQL database and look for the value of `rwl_page` in the opt
|
|
62 |
|
63 |
## Changelog
|
64 |
|
|
|
|
|
|
|
|
|
|
|
65 |
### 2.0.1
|
66 |
|
67 |
* Prevents pretty redirects such as /login and /admin.
|
4 |
**Tags:** rename, login, wp-login, wp-login.php, brute force attacks, custom login url
|
5 |
**Requires at least:** 3.8
|
6 |
**Tested up to:** 3.8
|
7 |
+
**Stable tag:** 2.1
|
8 |
**License:** GPLv2 or later
|
9 |
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
19 |
|
20 |
Requires WordPress 3.8 or higher. The registration form, lost password form, login widget and expired sessions will keep working.
|
21 |
|
|
|
|
|
22 |
Compatible with plugins like:
|
23 |
|
24 |
* BuddyPress,
|
60 |
|
61 |
## Changelog
|
62 |
|
63 |
+
### 2.1
|
64 |
+
|
65 |
+
* Works now with non-pretty permalinks!
|
66 |
+
* Gives a message when using W3 Total Cache or WP Super Cache to update options.
|
67 |
+
|
68 |
### 2.0.1
|
69 |
|
70 |
* Prevents pretty redirects such as /login and /admin.
|
readme.txt
CHANGED
@@ -1,10 +1,11 @@
|
|
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.8
|
6 |
Tested up to: 3.8
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -19,8 +20,6 @@ Please bookmark or remember your login url, accessing wp-login.php or wp-admin w
|
|
19 |
|
20 |
Requires WordPress 3.8 or higher. The registration form, lost password form, login widget and expired sessions will keep working.
|
21 |
|
22 |
-
You also must have pretty, or almost pretty, permalinks enabled.
|
23 |
-
|
24 |
Compatible with plugins like:
|
25 |
|
26 |
* BuddyPress,
|
@@ -66,6 +65,11 @@ Either go to your MySQL database and look for the value of `rwl_page` in the opt
|
|
66 |
|
67 |
== Changelog ==
|
68 |
|
|
|
|
|
|
|
|
|
|
|
69 |
= 2.0.1 =
|
70 |
|
71 |
* Prevents pretty redirects such as /login and /admin.
|
1 |
=== Rename wp-login.php ===
|
2 |
|
3 |
Contributors: avryl
|
4 |
+
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=49WXVSPP2HUKG
|
5 |
Tags: rename, login, wp-login, wp-login.php, brute force attacks, custom login url
|
6 |
Requires at least: 3.8
|
7 |
Tested up to: 3.8
|
8 |
+
Stable tag: 2.1
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
20 |
|
21 |
Requires WordPress 3.8 or higher. The registration form, lost password form, login widget and expired sessions will keep working.
|
22 |
|
|
|
|
|
23 |
Compatible with plugins like:
|
24 |
|
25 |
* BuddyPress,
|
65 |
|
66 |
== Changelog ==
|
67 |
|
68 |
+
= 2.1 =
|
69 |
+
|
70 |
+
* Works now with non-pretty permalinks!
|
71 |
+
* Gives a message when using W3 Total Cache or WP Super Cache to update options.
|
72 |
+
|
73 |
= 2.0.1 =
|
74 |
|
75 |
* Prevents pretty redirects such as /login and /admin.
|
rename-wp-login.php
CHANGED
@@ -6,13 +6,14 @@ 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: 2.
|
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 |
|
@@ -64,7 +65,17 @@ if ( ! class_exists( 'Rename_WP_Login' ) ) {
|
|
64 |
|
65 |
public function new_login_url() {
|
66 |
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
}
|
70 |
|
@@ -82,20 +93,14 @@ if ( ! class_exists( 'Rename_WP_Login' ) ) {
|
|
82 |
}
|
83 |
|
84 |
register_activation_hook( $this->basename(), array( $this, 'activate' ) );
|
85 |
-
register_deactivation_hook( $this->basename(), array( $this, 'deactivate' ) );
|
86 |
register_uninstall_hook( $this->basename(), array( 'Rename_WP_Login', 'uninstall' ) );
|
87 |
|
88 |
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
89 |
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
90 |
add_action( 'network_admin_notices', array( $this, 'admin_notices' ) );
|
91 |
|
92 |
-
if (
|
93 |
-
|
94 |
-
return;
|
95 |
-
|
96 |
-
}
|
97 |
-
|
98 |
-
if ( is_multisite() && ! function_exists( 'is_plugin_active_for_network' ) ) {
|
99 |
|
100 |
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
101 |
|
@@ -103,7 +108,8 @@ if ( ! class_exists( 'Rename_WP_Login' ) ) {
|
|
103 |
|
104 |
add_filter( 'plugin_action_links_' . $this->basename(), array( $this, 'plugin_action_links' ) );
|
105 |
|
106 |
-
if ( is_multisite()
|
|
|
107 |
|
108 |
add_filter( 'network_admin_plugin_action_links_' . $this->basename(), array( $this, 'plugin_action_links' ) );
|
109 |
|
@@ -118,14 +124,16 @@ if ( ! class_exists( 'Rename_WP_Login' ) ) {
|
|
118 |
add_filter( 'site_url', array( $this, 'site_url' ), 10, 2 );
|
119 |
add_filter( 'network_site_url', array( $this, 'site_url' ), 10, 2 );
|
120 |
add_filter( 'wp_redirect', array( $this, 'wp_redirect' ), 10, 2 );
|
121 |
-
|
|
|
|
|
122 |
remove_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );
|
123 |
|
124 |
}
|
125 |
|
126 |
public function admin_notices_incompatible() {
|
127 |
|
128 |
-
echo '<div class="
|
129 |
|
130 |
}
|
131 |
|
@@ -135,26 +143,6 @@ if ( ! class_exists( 'Rename_WP_Login' ) ) {
|
|
135 |
|
136 |
delete_option( 'rwl_admin' );
|
137 |
|
138 |
-
if ( is_network_admin() ) {
|
139 |
-
|
140 |
-
$rwl_page = get_site_option( 'rwl_page', 'login' );
|
141 |
-
|
142 |
-
$welcome_email = get_site_option( 'welcome_email' );
|
143 |
-
$welcome_email = preg_replace( "/(BLOG_URL)([\w\-]+)(\/|\.php)/", "$1$rwl_page/", $welcome_email );
|
144 |
-
|
145 |
-
update_site_option( 'welcome_email', $welcome_email );
|
146 |
-
|
147 |
-
}
|
148 |
-
|
149 |
-
}
|
150 |
-
|
151 |
-
public function deactivate() {
|
152 |
-
|
153 |
-
$welcome_email = get_site_option( 'welcome_email' );
|
154 |
-
$welcome_email = preg_replace( "/(BLOG_URL)([\w\-]+)(\/|\.php)/", "$1wp-login.php", $welcome_email );
|
155 |
-
|
156 |
-
update_site_option( 'welcome_email', $welcome_email );
|
157 |
-
|
158 |
}
|
159 |
|
160 |
public static function uninstall() {
|
@@ -163,29 +151,29 @@ if ( ! class_exists( 'Rename_WP_Login' ) ) {
|
|
163 |
|
164 |
if ( is_multisite() ) {
|
165 |
|
166 |
-
|
167 |
|
168 |
-
|
169 |
|
170 |
-
|
171 |
|
172 |
-
|
173 |
|
174 |
-
|
175 |
|
176 |
-
|
177 |
|
178 |
-
|
179 |
|
180 |
-
|
181 |
|
182 |
-
|
183 |
|
184 |
}
|
185 |
-
|
186 |
else {
|
187 |
|
188 |
-
|
189 |
|
190 |
}
|
191 |
|
@@ -193,7 +181,9 @@ if ( ! class_exists( 'Rename_WP_Login' ) ) {
|
|
193 |
|
194 |
public function wpmu_options() {
|
195 |
|
196 |
-
$out = '
|
|
|
|
|
197 |
$out .= '<p>This option allows you to set a networkwide default, which can be overridden by individual sites. Simply go to to the site’s permalink settings to change the url.</p>';
|
198 |
$out .= '<p>Need help? Try the <a href="http://wordpress.org/support/plugin/rename-wp-login#postform" target="_blank">support forum</a>.</p>';
|
199 |
$out .= '<table class="form-table">';
|
@@ -210,15 +200,11 @@ if ( ! class_exists( 'Rename_WP_Login' ) ) {
|
|
210 |
public function update_wpmu_options() {
|
211 |
|
212 |
if ( ( $rwl_page = sanitize_title_with_dashes( $_POST['rwl_page'] ) )
|
213 |
-
&& strpos( $rwl_page, 'wp-login' ) === false
|
|
|
214 |
|
215 |
update_site_option( 'rwl_page', $rwl_page );
|
216 |
|
217 |
-
$welcome_email = get_site_option( 'welcome_email' );
|
218 |
-
$welcome_email = preg_replace( "/(BLOG_URL)([\w\-]+)(\/|\.php)/", "$1$rwl_page/", $welcome_email );
|
219 |
-
|
220 |
-
update_site_option( 'welcome_email', $welcome_email );
|
221 |
-
|
222 |
}
|
223 |
|
224 |
}
|
@@ -246,14 +232,15 @@ if ( ! class_exists( 'Rename_WP_Login' ) ) {
|
|
246 |
&& $pagenow === 'options-permalink.php' ) {
|
247 |
|
248 |
if ( ( $rwl_page = sanitize_title_with_dashes( $_POST['rwl_page'] ) )
|
249 |
-
&& strpos( $rwl_page, 'wp-login' ) === false
|
|
|
250 |
|
251 |
if ( $rwl_page === get_site_option( 'rwl_page', 'login' ) ) {
|
252 |
|
253 |
delete_option( 'rwl_page' );
|
254 |
|
255 |
}
|
256 |
-
|
257 |
else {
|
258 |
|
259 |
update_option( 'rwl_page', $rwl_page );
|
@@ -315,27 +302,53 @@ if ( ! class_exists( 'Rename_WP_Login' ) ) {
|
|
315 |
|
316 |
public function rwl_page_input() {
|
317 |
|
318 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
|
320 |
}
|
321 |
|
322 |
public function admin_notices() {
|
323 |
|
324 |
-
global $pagenow;
|
325 |
|
326 |
$out = '';
|
327 |
|
328 |
-
if ( !
|
|
|
|
|
329 |
|
330 |
-
$out .= '<div class="
|
331 |
|
332 |
}
|
333 |
|
334 |
-
if (
|
335 |
-
&&
|
336 |
-
&&
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
|
338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
|
340 |
}
|
341 |
|
@@ -372,8 +385,8 @@ if ( ! class_exists( 'Rename_WP_Login' ) ) {
|
|
372 |
|
373 |
}
|
374 |
|
375 |
-
if ( ! is_multisite()
|
376 |
-
( strpos( $_SERVER['REQUEST_URI'], 'wp-signup' ) !== false
|
377 |
|| strpos( $_SERVER['REQUEST_URI'], 'wp-activate' ) ) !== false ) {
|
378 |
|
379 |
wp_die( __( 'This feature is not enabled.' ) );
|
@@ -384,13 +397,15 @@ if ( ! class_exists( 'Rename_WP_Login' ) ) {
|
|
384 |
|
385 |
if ( $request['path'] === home_url( $this->new_login_slug(), 'relative' ) ) {
|
386 |
|
387 |
-
wp_safe_redirect( $this->new_login_url() );
|
388 |
|
389 |
die;
|
390 |
|
391 |
}
|
392 |
|
393 |
-
if ( untrailingslashit( $request['path'] ) === home_url( $this->new_login_slug(), 'relative' )
|
|
|
|
|
394 |
|
395 |
status_header( 200 );
|
396 |
|
@@ -435,11 +450,35 @@ if ( ! class_exists( 'Rename_WP_Login' ) ) {
|
|
435 |
|
436 |
public function site_url( $url, $path ) {
|
437 |
|
438 |
-
|
439 |
|
440 |
-
|
441 |
|
442 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
443 |
|
444 |
}
|
445 |
|
@@ -447,17 +486,17 @@ if ( ! class_exists( 'Rename_WP_Login' ) ) {
|
|
447 |
|
448 |
}
|
449 |
|
450 |
-
public function
|
451 |
|
452 |
-
|
453 |
|
454 |
-
|
455 |
|
456 |
-
|
457 |
|
458 |
-
|
459 |
|
460 |
-
return $
|
461 |
|
462 |
}
|
463 |
|
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: 2.1
|
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 |
+
&& defined( 'ABSPATH' ) ) {
|
17 |
|
18 |
class Rename_WP_Login {
|
19 |
|
65 |
|
66 |
public function new_login_url() {
|
67 |
|
68 |
+
if ( get_option( 'permalink_structure' ) ) {
|
69 |
+
|
70 |
+
return trailingslashit( trailingslashit( home_url() ) . $this->new_login_slug() );
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
else {
|
75 |
+
|
76 |
+
return trailingslashit( home_url() ) . '?' . $this->new_login_slug();
|
77 |
+
|
78 |
+
}
|
79 |
|
80 |
}
|
81 |
|
93 |
}
|
94 |
|
95 |
register_activation_hook( $this->basename(), array( $this, 'activate' ) );
|
|
|
96 |
register_uninstall_hook( $this->basename(), array( 'Rename_WP_Login', 'uninstall' ) );
|
97 |
|
98 |
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
99 |
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
100 |
add_action( 'network_admin_notices', array( $this, 'admin_notices' ) );
|
101 |
|
102 |
+
if ( is_multisite()
|
103 |
+
&& ! function_exists( 'is_plugin_active_for_network' ) ) {
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
106 |
|
108 |
|
109 |
add_filter( 'plugin_action_links_' . $this->basename(), array( $this, 'plugin_action_links' ) );
|
110 |
|
111 |
+
if ( is_multisite()
|
112 |
+
&& is_plugin_active_for_network( $this->basename() ) ) {
|
113 |
|
114 |
add_filter( 'network_admin_plugin_action_links_' . $this->basename(), array( $this, 'plugin_action_links' ) );
|
115 |
|
124 |
add_filter( 'site_url', array( $this, 'site_url' ), 10, 2 );
|
125 |
add_filter( 'network_site_url', array( $this, 'site_url' ), 10, 2 );
|
126 |
add_filter( 'wp_redirect', array( $this, 'wp_redirect' ), 10, 2 );
|
127 |
+
|
128 |
+
add_filter( 'site_option_welcome_email', array( $this, 'welcome_email' ) );
|
129 |
+
|
130 |
remove_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );
|
131 |
|
132 |
}
|
133 |
|
134 |
public function admin_notices_incompatible() {
|
135 |
|
136 |
+
echo '<div class="update-nag"><p>Please upgrade to the latest version of WordPress to activate <strong>Rename wp-login.php</strong>.</p></div>';
|
137 |
|
138 |
}
|
139 |
|
143 |
|
144 |
delete_option( 'rwl_admin' );
|
145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
}
|
147 |
|
148 |
public static function uninstall() {
|
151 |
|
152 |
if ( is_multisite() ) {
|
153 |
|
154 |
+
$blogs = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
|
155 |
|
156 |
+
if ( $blogs ) {
|
157 |
|
158 |
+
foreach( $blogs as $blog ) {
|
159 |
|
160 |
+
switch_to_blog( $blog );
|
161 |
|
162 |
+
delete_option( 'rwl_page' );
|
163 |
|
164 |
+
}
|
165 |
|
166 |
+
restore_current_blog();
|
167 |
|
168 |
+
}
|
169 |
|
170 |
+
delete_site_option( 'rwl_page' );
|
171 |
|
172 |
}
|
173 |
+
|
174 |
else {
|
175 |
|
176 |
+
delete_option( 'rwl_page' );
|
177 |
|
178 |
}
|
179 |
|
181 |
|
182 |
public function wpmu_options() {
|
183 |
|
184 |
+
$out = '';
|
185 |
+
|
186 |
+
$out .= '<h3>Rename wp-login.php</h3>';
|
187 |
$out .= '<p>This option allows you to set a networkwide default, which can be overridden by individual sites. Simply go to to the site’s permalink settings to change the url.</p>';
|
188 |
$out .= '<p>Need help? Try the <a href="http://wordpress.org/support/plugin/rename-wp-login#postform" target="_blank">support forum</a>.</p>';
|
189 |
$out .= '<table class="form-table">';
|
200 |
public function update_wpmu_options() {
|
201 |
|
202 |
if ( ( $rwl_page = sanitize_title_with_dashes( $_POST['rwl_page'] ) )
|
203 |
+
&& strpos( $rwl_page, 'wp-login' ) === false
|
204 |
+
&& ! in_array( $rwl_page, $this->forbidden_slugs() ) ) {
|
205 |
|
206 |
update_site_option( 'rwl_page', $rwl_page );
|
207 |
|
|
|
|
|
|
|
|
|
|
|
208 |
}
|
209 |
|
210 |
}
|
232 |
&& $pagenow === 'options-permalink.php' ) {
|
233 |
|
234 |
if ( ( $rwl_page = sanitize_title_with_dashes( $_POST['rwl_page'] ) )
|
235 |
+
&& strpos( $rwl_page, 'wp-login' ) === false
|
236 |
+
&& ! in_array( $rwl_page, $this->forbidden_slugs() ) ) {
|
237 |
|
238 |
if ( $rwl_page === get_site_option( 'rwl_page', 'login' ) ) {
|
239 |
|
240 |
delete_option( 'rwl_page' );
|
241 |
|
242 |
}
|
243 |
+
|
244 |
else {
|
245 |
|
246 |
update_option( 'rwl_page', $rwl_page );
|
302 |
|
303 |
public function rwl_page_input() {
|
304 |
|
305 |
+
if ( get_option( 'permalink_structure' ) ) {
|
306 |
+
|
307 |
+
echo '<code>' . trailingslashit( home_url() ) . '</code> <input id="rwl-page-input" type="text" name="rwl_page" value="' . $this->new_login_slug() . '"> <code>/</code>';
|
308 |
+
|
309 |
+
}
|
310 |
+
|
311 |
+
else {
|
312 |
+
|
313 |
+
echo '<code>' . trailingslashit( home_url() ) . '?</code> <input id="rwl-page-input" type="text" name="rwl_page" value="' . $this->new_login_slug() . '">';
|
314 |
+
|
315 |
+
}
|
316 |
|
317 |
}
|
318 |
|
319 |
public function admin_notices() {
|
320 |
|
321 |
+
global $pagenow, $cache_rejected_uri;
|
322 |
|
323 |
$out = '';
|
324 |
|
325 |
+
if ( ! is_network_admin()
|
326 |
+
&& $pagenow === 'options-permalink.php'
|
327 |
+
&& isset( $_GET['settings-updated'] ) ) {
|
328 |
|
329 |
+
$out .= '<div class="updated"><p>Your login page is now here: <strong><a href="' . $this->new_login_url() . '">' . $this->new_login_url() . '</a></strong>. Bookmark this page!</p></div>';
|
330 |
|
331 |
}
|
332 |
|
333 |
+
if ( current_user_can( 'manage_options' )
|
334 |
+
&& function_exists( 'w3_instance' )
|
335 |
+
&& ( $w3tc = w3_instance( 'W3_Config' ) )
|
336 |
+
&& ( $w3tc = $w3tc->get_array( 'pgcache.reject.uri' ) )
|
337 |
+
&& ! in_array( $this->new_login_slug(), $w3tc ) ) {
|
338 |
+
|
339 |
+
$admin_url = admin_url( 'admin.php?page=w3tc_pgcache#pgcache_reject_uri' );
|
340 |
+
|
341 |
+
$out .= '<div class="update-nag"><strong>W3 Total Cache</strong> is enabled on your website. To make sure <strong>Rename wp-login.php</strong> works correctly, you should add <strong>' . $this->new_login_slug() . '</strong> to <a href="' . $admin_url . '">Never cache the following pages</a>. This notice will disappear once you’ve done that correctly.</div>';
|
342 |
+
|
343 |
+
}
|
344 |
|
345 |
+
if ( current_user_can( 'manage_options' )
|
346 |
+
&& is_array( $cache_rejected_uri )
|
347 |
+
&& ! in_array( $this->new_login_slug(), $cache_rejected_uri ) ) {
|
348 |
+
|
349 |
+
$admin_url = is_network_admin() ? network_admin_url( 'settings.php?page=wpsupercache&tab=settings#rejecturi' ) : admin_url( 'options-general.php?page=wpsupercache&tab=settings#rejecturi' );
|
350 |
+
|
351 |
+
$out .= '<div class="update-nag"><strong>WP Super Cache</strong> is enabled on your website. To make sure <strong>Rename wp-login.php</strong> works correctly, you should add <strong>' . $this->new_login_slug() . '</strong> to <a href="' . $admin_url . '">Rejected URIs</a>. This notice will disappear once you’ve done that correctly.</div>';
|
352 |
|
353 |
}
|
354 |
|
385 |
|
386 |
}
|
387 |
|
388 |
+
if ( ! is_multisite()
|
389 |
+
&& ( strpos( $_SERVER['REQUEST_URI'], 'wp-signup' ) !== false
|
390 |
|| strpos( $_SERVER['REQUEST_URI'], 'wp-activate' ) ) !== false ) {
|
391 |
|
392 |
wp_die( __( 'This feature is not enabled.' ) );
|
397 |
|
398 |
if ( $request['path'] === home_url( $this->new_login_slug(), 'relative' ) ) {
|
399 |
|
400 |
+
wp_safe_redirect( $this->new_login_url() . ( ! empty( $_SERVER['QUERY_STRING'] ) ? '?' . $_SERVER['QUERY_STRING'] : '' ) );
|
401 |
|
402 |
die;
|
403 |
|
404 |
}
|
405 |
|
406 |
+
if ( untrailingslashit( $request['path'] ) === home_url( $this->new_login_slug(), 'relative' )
|
407 |
+
|| ( ! get_option( 'permalink_structure' )
|
408 |
+
&& isset( $_GET[$this->new_login_slug()] ) ) ) {
|
409 |
|
410 |
status_header( 200 );
|
411 |
|
450 |
|
451 |
public function site_url( $url, $path ) {
|
452 |
|
453 |
+
return $this->filter_wp_login_php( $url );
|
454 |
|
455 |
+
}
|
456 |
|
457 |
+
public function wp_redirect( $location, $status ) {
|
458 |
+
|
459 |
+
return $this->filter_wp_login_php( $location );
|
460 |
+
|
461 |
+
}
|
462 |
+
|
463 |
+
public function filter_wp_login_php( $url ) {
|
464 |
+
|
465 |
+
if ( strpos( $url, 'wp-login.php' ) !== false ) {
|
466 |
+
|
467 |
+
$args = explode( '?', $url );
|
468 |
+
|
469 |
+
if ( isset( $args[1] ) ) {
|
470 |
+
|
471 |
+
parse_str( $args[1], $args );
|
472 |
+
|
473 |
+
$url = add_query_arg( $args, $this->new_login_url() );
|
474 |
+
|
475 |
+
}
|
476 |
+
|
477 |
+
else {
|
478 |
+
|
479 |
+
$url = $this->new_login_url();
|
480 |
+
|
481 |
+
}
|
482 |
|
483 |
}
|
484 |
|
486 |
|
487 |
}
|
488 |
|
489 |
+
public function welcome_email( $value ) {
|
490 |
|
491 |
+
return $value = preg_replace( '/(BLOG_URL)([\w\-]+)(\.php)/', 'BLOG_URL' . trailingslashit( get_site_option( 'rwl_page', 'login' ) ), $value );
|
492 |
|
493 |
+
}
|
494 |
|
495 |
+
public function forbidden_slugs() {
|
496 |
|
497 |
+
$wp = new WP;
|
498 |
|
499 |
+
return array_merge( $wp->public_query_vars, $wp->private_query_vars );
|
500 |
|
501 |
}
|
502 |
|