Version Description
- 2017/05/25
- New: a new option is available. Instead of redirecting to the a "WordPress" 404 error page, you can choose to directly trigger the 404 error. Pro: the user is not directed, the URL doesn't change. Con: the user sees the browser error page, it probably is ugly (but do we really care?).
- Fixed the blank page that was displaying instead of redirecting the user to the new login URL.
- Dev stuff: in case the plugin has trouble determining your server technology, take a look at
sfml_is_apache()
,sfml_is_iis7()
, andsfml_is_nginx()
: returned values can be filtered with a MU plugin.
Download this release
Release Info
Developer | GregLone |
Plugin | Move Login |
Version | 2.5.2 |
Comparing to | |
See all releases |
Code changes from version 2.5.1 to 2.5.2
- inc/activate.php +22 -24
- inc/admin.php +4 -7
- inc/classes/class-sfml-options.php +245 -160
- inc/functions/compat.php +83 -0
- inc/functions/rewrite.php +5 -8
- inc/functions/settings-page.php +9 -20
- inc/functions/utilities.php +84 -7
- inc/redirections-and-dies.php +64 -23
- languages/sf-move-login-fr_FR.mo +0 -0
- languages/sf-move-login-fr_FR.po +89 -138
- languages/sf-move-login.pot +183 -0
- readme.txt +9 -1
- sf-move-login.php +4 -3
inc/activate.php
CHANGED
@@ -12,10 +12,7 @@ register_activation_hook( SFML_FILE, 'sfml_activate' );
|
|
12 |
* Trigger `wp_die()` on plugin activation if the server configuration does not fit. Or, set a transient for admin notices.
|
13 |
*/
|
14 |
function sfml_activate() {
|
15 |
-
|
16 |
-
|
17 |
-
$is_nginx = sfml_is_nginx();
|
18 |
-
$dies = array();
|
19 |
|
20 |
// The plugin needs the request URI.
|
21 |
if ( empty( $GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI'] ) && empty( $_SERVER['REQUEST_URI'] ) ) {
|
@@ -23,7 +20,7 @@ function sfml_activate() {
|
|
23 |
}
|
24 |
|
25 |
// Apache.
|
26 |
-
if (
|
27 |
require_once( ABSPATH . WPINC . '/functions.php' );
|
28 |
|
29 |
if ( ! got_mod_rewrite() ) {
|
@@ -31,7 +28,7 @@ function sfml_activate() {
|
|
31 |
}
|
32 |
}
|
33 |
// IIS7.
|
34 |
-
elseif (
|
35 |
require_once( ABSPATH . 'wp-admin/includes/misc.php' );
|
36 |
|
37 |
if ( ! iis7_supports_permalinks() ) {
|
@@ -39,7 +36,7 @@ function sfml_activate() {
|
|
39 |
}
|
40 |
}
|
41 |
// None.
|
42 |
-
elseif ( !
|
43 |
$dies[] = 'error_unknown_server_conf';
|
44 |
}
|
45 |
|
@@ -104,26 +101,27 @@ function sfml_deactivate() {
|
|
104 |
* @return (string|array) A message if `$message_id` is a valid ID. An array otherwize.
|
105 |
*/
|
106 |
function sfml_notice_message( $message_id ) {
|
107 |
-
global $is_iis7;
|
108 |
static $messages;
|
109 |
|
110 |
-
if (
|
111 |
-
|
112 |
-
$link = '<a href="' . esc_url( is_multisite() ? network_admin_url( 'settings.php?page=move-login' ) : admin_url( 'options-general.php?page=move-login' ) ) . '">Move Login</a>';
|
113 |
-
|
114 |
-
$messages = array(
|
115 |
-
/** Translators: 1 is the plugin name. */
|
116 |
-
'error_no_request_uri' => sprintf( __( 'It seems your server configuration prevents the plugin to work properly. %s won\'t work.', 'sf-move-login' ), '<strong>Move Login</strong>' ),
|
117 |
-
/** Translators: 1 is the plugin name. */
|
118 |
-
'error_no_mod_rewrite' => sprintf( __( 'It seems the url rewrite module is not activated on your server. %s won\'t work.', 'sf-move-login' ), '<strong>Move Login</strong>' ),
|
119 |
-
/** Translators: 1, 2, and 3 are server technologies (Apache, Nginx, IIS7), 4 is the plugin name. */
|
120 |
-
'error_unknown_server_conf' => sprintf( __( 'It seems your server does not use %1$s, %2$s, nor %3$s. %4$s won\'t work.', 'sf-move-login' ), '<i>Apache</i>', '<i>Nginx</i>', '<i>IIS7</i>', '<strong>Move Login</strong>' ),
|
121 |
-
/** Translators: 1 is the plugin name, 2 is a file name, 3 is a "Move Login" link. */
|
122 |
-
'error_file_not_writable' => sprintf( __( '%1$s needs access to the %2$s file. Please visit the %3$s settings page and copy/paste the given code into the %2$s file.', 'sf-move-login' ), '<strong>Move Login</strong>', $file, $link ),
|
123 |
-
/** Translators: 1 is a server technology (Nginx), 2 is a "Move Login" link, 3 is the plugin name. */
|
124 |
-
'updated_is_nginx' => sprintf( __( 'It seems your server uses a %1$ system. You have to edit the rewrite rules by yourself in the configuration file. Please visit the %2$s settings page and take a look at the rewrite rules. %3$s is running but won\'t work correctly until you deal with those rewrite rules.', 'sf-move-login' ), '<i>Nginx</i>', $link, '<strong>Move Login</strong>' ),
|
125 |
-
);
|
126 |
}
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
return isset( $messages[ $message_id ] ) ? $messages[ $message_id ] : '';
|
129 |
}
|
12 |
* Trigger `wp_die()` on plugin activation if the server configuration does not fit. Or, set a transient for admin notices.
|
13 |
*/
|
14 |
function sfml_activate() {
|
15 |
+
$dies = array();
|
|
|
|
|
|
|
16 |
|
17 |
// The plugin needs the request URI.
|
18 |
if ( empty( $GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI'] ) && empty( $_SERVER['REQUEST_URI'] ) ) {
|
20 |
}
|
21 |
|
22 |
// Apache.
|
23 |
+
if ( sfml_is_apache() ) {
|
24 |
require_once( ABSPATH . WPINC . '/functions.php' );
|
25 |
|
26 |
if ( ! got_mod_rewrite() ) {
|
28 |
}
|
29 |
}
|
30 |
// IIS7.
|
31 |
+
elseif ( sfml_is_iis7() ) {
|
32 |
require_once( ABSPATH . 'wp-admin/includes/misc.php' );
|
33 |
|
34 |
if ( ! iis7_supports_permalinks() ) {
|
36 |
}
|
37 |
}
|
38 |
// None.
|
39 |
+
elseif ( ! sfml_is_iis7() && ! sfml_is_apache() && ! sfml_is_nginx() ) {
|
40 |
$dies[] = 'error_unknown_server_conf';
|
41 |
}
|
42 |
|
101 |
* @return (string|array) A message if `$message_id` is a valid ID. An array otherwize.
|
102 |
*/
|
103 |
function sfml_notice_message( $message_id ) {
|
|
|
104 |
static $messages;
|
105 |
|
106 |
+
if ( isset( $messages ) ) {
|
107 |
+
return isset( $messages[ $message_id ] ) ? $messages[ $message_id ] : '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
}
|
109 |
|
110 |
+
$file = sfml_is_iis7() ? '<code>web.config</code>' : '<code>.htaccess</code>';
|
111 |
+
$link = '<a href="' . esc_url( is_multisite() ? network_admin_url( 'settings.php?page=move-login' ) : admin_url( 'options-general.php?page=move-login' ) ) . '">Move Login</a>';
|
112 |
+
|
113 |
+
$messages = array(
|
114 |
+
/** Translators: 1 is the plugin name. */
|
115 |
+
'error_no_request_uri' => sprintf( __( 'It seems your server configuration prevents the plugin to work properly. %s won\'t work.', 'sf-move-login' ), '<strong>Move Login</strong>' ),
|
116 |
+
/** Translators: 1 is the plugin name. */
|
117 |
+
'error_no_mod_rewrite' => sprintf( __( 'It seems the url rewrite module is not activated on your server. %s won\'t work.', 'sf-move-login' ), '<strong>Move Login</strong>' ),
|
118 |
+
/** Translators: 1, 2, and 3 are server technologies (Apache, Nginx, IIS7), 4 is the plugin name. */
|
119 |
+
'error_unknown_server_conf' => sprintf( __( 'It seems your server does not use %1$s, %2$s, nor %3$s. %4$s won\'t work.', 'sf-move-login' ), '<i>Apache</i>', '<i>Nginx</i>', '<i>IIS7</i>', '<strong>Move Login</strong>' ),
|
120 |
+
/** Translators: 1 is the plugin name, 2 is a file name, 3 is a "Move Login" link. */
|
121 |
+
'error_file_not_writable' => sprintf( __( '%1$s needs access to the %2$s file. Please visit the %3$s settings page and copy/paste the given code into the %2$s file.', 'sf-move-login' ), '<strong>Move Login</strong>', $file, $link ),
|
122 |
+
/** Translators: 1 is a server technology (Nginx), 2 is a "Move Login" link, 3 is the plugin name. */
|
123 |
+
'updated_is_nginx' => sprintf( __( 'It seems your server uses a %1$ system. You have to edit the rewrite rules by yourself in the configuration file. Please visit the %2$s settings page and take a look at the rewrite rules. %3$s is running but won\'t work correctly until you deal with those rewrite rules.', 'sf-move-login' ), '<i>Nginx</i>', $link, '<strong>Move Login</strong>' ),
|
124 |
+
);
|
125 |
+
|
126 |
return isset( $messages[ $message_id ] ) ? $messages[ $message_id ] : '';
|
127 |
}
|
inc/admin.php
CHANGED
@@ -326,8 +326,6 @@ add_action( 'all_admin_notices', 'sfml_notices' );
|
|
326 |
* Admin notices or write initial rules.
|
327 |
*/
|
328 |
function sfml_notices() {
|
329 |
-
global $is_apache, $is_iis7;
|
330 |
-
|
331 |
// Get previous notices.
|
332 |
$user_id = get_current_user_id();
|
333 |
// 1 means "Update the file". 2 means "No need to update the file".
|
@@ -340,19 +338,18 @@ function sfml_notices() {
|
|
340 |
|
341 |
delete_transient( 'sfml_activation-' . $user_id );
|
342 |
|
343 |
-
$notices
|
344 |
-
$is_nginx = sfml_is_nginx();
|
345 |
|
346 |
// IIS7.
|
347 |
-
if (
|
348 |
$notices[] = 'error_file_not_writable';
|
349 |
}
|
350 |
// Apache.
|
351 |
-
elseif (
|
352 |
$notices[] = 'error_file_not_writable';
|
353 |
}
|
354 |
// Nginx.
|
355 |
-
elseif (
|
356 |
$notices[] = 'updated_is_nginx';
|
357 |
}
|
358 |
|
326 |
* Admin notices or write initial rules.
|
327 |
*/
|
328 |
function sfml_notices() {
|
|
|
|
|
329 |
// Get previous notices.
|
330 |
$user_id = get_current_user_id();
|
331 |
// 1 means "Update the file". 2 means "No need to update the file".
|
338 |
|
339 |
delete_transient( 'sfml_activation-' . $user_id );
|
340 |
|
341 |
+
$notices = array();
|
|
|
342 |
|
343 |
// IIS7.
|
344 |
+
if ( sfml_is_iis7() && ! sfml_can_write_file() ) {
|
345 |
$notices[] = 'error_file_not_writable';
|
346 |
}
|
347 |
// Apache.
|
348 |
+
elseif ( sfml_is_apache() && ! sfml_can_write_file() ) {
|
349 |
$notices[] = 'error_file_not_writable';
|
350 |
}
|
351 |
// Nginx.
|
352 |
+
elseif ( sfml_is_nginx() ) {
|
353 |
$notices[] = 'updated_is_nginx';
|
354 |
}
|
355 |
|
inc/classes/class-sfml-options.php
CHANGED
@@ -10,20 +10,20 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
10 |
*/
|
11 |
class SFML_Options extends SFML_Singleton {
|
12 |
|
13 |
-
const VERSION = '1.
|
14 |
const OPTION_NAME = 'sfml';
|
15 |
const OPTION_GROUP = 'sfml_settings';
|
16 |
const OPTION_PAGE = 'move-login';
|
17 |
|
18 |
/**
|
19 |
-
*
|
20 |
*
|
21 |
* @var (array)
|
22 |
*/
|
23 |
protected $options;
|
24 |
|
25 |
/**
|
26 |
-
*
|
27 |
*
|
28 |
* @var (array)
|
29 |
*/
|
@@ -37,11 +37,12 @@ class SFML_Options extends SFML_Singleton {
|
|
37 |
protected $slugs;
|
38 |
|
39 |
/**
|
40 |
-
*
|
41 |
*
|
42 |
* @var (array)
|
|
|
43 |
*/
|
44 |
-
protected $
|
45 |
|
46 |
|
47 |
/**
|
@@ -57,6 +58,41 @@ class SFML_Options extends SFML_Singleton {
|
|
57 |
}
|
58 |
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
/**
|
61 |
* Get default options.
|
62 |
*
|
@@ -92,16 +128,32 @@ class SFML_Options extends SFML_Singleton {
|
|
92 |
}
|
93 |
}
|
94 |
|
95 |
-
//
|
96 |
-
$this->options_default = array_merge( $this->options_default,
|
97 |
-
'deny_wp_login_access' => 1,
|
98 |
-
'deny_admin_access' => 0,
|
99 |
-
) );
|
100 |
|
101 |
return $this->options_default;
|
102 |
}
|
103 |
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
/**
|
106 |
* Get all options.
|
107 |
*
|
@@ -114,34 +166,49 @@ class SFML_Options extends SFML_Singleton {
|
|
114 |
return $this->options;
|
115 |
}
|
116 |
|
117 |
-
$this->options
|
118 |
-
$
|
119 |
-
$
|
120 |
-
|
121 |
-
if ( is_array( $old_options ) ) {
|
122 |
-
$default_slugs = static::get_sub_options( 'slugs', $defaults );
|
123 |
|
|
|
124 |
// Add and escape slugs.
|
|
|
|
|
125 |
foreach ( $default_slugs as $slug_key => $default_slug ) {
|
126 |
-
$this->options[ 'slugs.' . $slug_key ] = ! empty( $
|
127 |
}
|
128 |
|
129 |
// Add and escape other options.
|
130 |
-
|
131 |
-
$this->options['deny_wp_login_access'] = isset( $old_options['deny_wp_login_access'] ) ? min( 3, max( 1, (int) $old_options['deny_wp_login_access'] ) ) : $defaults['deny_wp_login_access'];
|
132 |
-
}
|
133 |
|
134 |
-
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
}
|
137 |
} else {
|
138 |
-
$this->options = $
|
139 |
}
|
140 |
|
141 |
-
|
142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
// Make sure no keys have been added or removed.
|
144 |
-
$this->options
|
145 |
|
146 |
return $this->options;
|
147 |
}
|
@@ -178,6 +245,96 @@ class SFML_Options extends SFML_Singleton {
|
|
178 |
}
|
179 |
|
180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
/**
|
182 |
* Setting field labels for the slugs.
|
183 |
*
|
@@ -186,11 +343,11 @@ class SFML_Options extends SFML_Singleton {
|
|
186 |
public function get_slug_field_labels() {
|
187 |
$this->maybe_clear_options_cache();
|
188 |
|
189 |
-
if ( isset( $this->
|
190 |
-
return $this->
|
191 |
}
|
192 |
|
193 |
-
$this->
|
194 |
'login' => __( 'Log in' ),
|
195 |
'logout' => __( 'Log out' ),
|
196 |
'register' => __( 'Register' ),
|
@@ -201,79 +358,35 @@ class SFML_Options extends SFML_Singleton {
|
|
201 |
$new_actions = static::get_additional_labels();
|
202 |
|
203 |
if ( $new_actions ) {
|
204 |
-
$new_actions
|
205 |
-
$this->
|
206 |
}
|
207 |
|
208 |
-
return $this->
|
209 |
}
|
210 |
|
211 |
|
212 |
/**
|
213 |
-
*
|
214 |
*
|
215 |
-
* @
|
216 |
-
*/
|
217 |
-
public function get_other_actions() {
|
218 |
-
return array_diff_key( array(
|
219 |
-
'retrievepassword' => 'retrievepassword',
|
220 |
-
'rp' => 'rp',
|
221 |
-
), $this->get_slug_field_labels() );
|
222 |
-
}
|
223 |
-
|
224 |
-
|
225 |
-
/**
|
226 |
-
* Clear options cache.
|
227 |
*
|
228 |
-
* @
|
229 |
*/
|
230 |
-
public function
|
231 |
-
$
|
232 |
/**
|
233 |
-
*
|
234 |
*
|
235 |
-
* @param (
|
236 |
*/
|
237 |
-
|
238 |
-
$this->options = null;
|
239 |
-
$this->options_default = null;
|
240 |
-
$this->slugs = null;
|
241 |
-
$this->labels = null;
|
242 |
-
remove_all_filters( static::OPTION_NAME . '_clear_options_cache' );
|
243 |
-
}
|
244 |
}
|
245 |
|
246 |
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
protected function register_setting() {
|
251 |
-
global $new_whitelist_options;
|
252 |
-
|
253 |
-
$sanitize_callback = array( $this, 'sanitize_options' );
|
254 |
-
|
255 |
-
if ( ! is_multisite() ) {
|
256 |
-
if ( function_exists( 'register_setting' ) ) {
|
257 |
-
register_setting( static::OPTION_GROUP, static::OPTION_NAME, $sanitize_callback );
|
258 |
-
return;
|
259 |
-
}
|
260 |
-
|
261 |
-
$new_whitelist_options = isset( $new_whitelist_options ) && is_array( $new_whitelist_options ) ? $new_whitelist_options : array(); // WPCS: override ok.
|
262 |
-
$new_whitelist_options[ static::OPTION_GROUP ] = isset( $new_whitelist_options[ static::OPTION_GROUP ] ) && is_array( $new_whitelist_options[ static::OPTION_GROUP ] ) ? $new_whitelist_options[ static::OPTION_GROUP ] : array();
|
263 |
-
$new_whitelist_options[ static::OPTION_GROUP ][] = static::OPTION_NAME;
|
264 |
-
} elseif ( is_admin() ) {
|
265 |
-
$whitelist = sfml_cache_data( 'new_whitelist_network_options' );
|
266 |
-
$whitelist = is_array( $whitelist ) ? $whitelist : array();
|
267 |
-
$whitelist[ static::OPTION_GROUP ] = isset( $whitelist[ static::OPTION_GROUP ] ) ? $whitelist[ static::OPTION_GROUP ] : array();
|
268 |
-
$whitelist[ static::OPTION_GROUP ][] = static::OPTION_NAME;
|
269 |
-
sfml_cache_data( 'new_whitelist_network_options', $whitelist );
|
270 |
-
}
|
271 |
-
|
272 |
-
if ( $sanitize_callback ) {
|
273 |
-
add_filter( 'sanitize_option_' . static::OPTION_NAME, $sanitize_callback );
|
274 |
-
}
|
275 |
-
}
|
276 |
-
|
277 |
|
278 |
/**
|
279 |
* Sanitize options on save.
|
@@ -283,13 +396,13 @@ class SFML_Options extends SFML_Singleton {
|
|
283 |
* @return (array)
|
284 |
*/
|
285 |
public function sanitize_options( $options = array() ) {
|
286 |
-
$errors = array( 'forbidden' => array(), 'duplicates' => array() );
|
287 |
-
$old_options = get_site_option( static::OPTION_NAME );
|
288 |
-
$default_options = $this->get_default_options();
|
289 |
$sanitized_options = array();
|
|
|
|
|
290 |
|
291 |
// Add and sanitize slugs.
|
292 |
-
$default_slugs =
|
|
|
293 |
$exclude = $this->get_other_actions();
|
294 |
|
295 |
foreach ( $default_slugs as $slug_key => $default_slug ) {
|
@@ -329,43 +442,38 @@ class SFML_Options extends SFML_Singleton {
|
|
329 |
}
|
330 |
|
331 |
// Add and sanitize other options.
|
332 |
-
|
333 |
-
if ( isset( $options['deny_wp_login_access'] ) ) {
|
334 |
-
|
335 |
-
$sanitized_options['deny_wp_login_access'] = min( 3, max( 1, (int) $options['deny_wp_login_access'] ) );
|
336 |
-
|
337 |
-
} elseif ( isset( $old_options['deny_wp_login_access'] ) ) {
|
338 |
|
339 |
-
|
340 |
|
|
|
|
|
|
|
|
|
341 |
} else {
|
342 |
-
$sanitized_options[
|
|
|
343 |
}
|
344 |
-
}
|
345 |
-
|
346 |
-
if ( isset( $default_options['deny_admin_access'] ) ) {
|
347 |
-
if ( isset( $options['deny_admin_access'] ) ) {
|
348 |
-
|
349 |
-
$sanitized_options['deny_admin_access'] = min( 3, max( 0, (int) $options['deny_admin_access'] ) );
|
350 |
|
351 |
-
|
352 |
|
353 |
-
|
354 |
-
|
355 |
-
} else {
|
356 |
-
$sanitized_options['deny_admin_access'] = $default_options['deny_admin_access'];
|
357 |
}
|
358 |
}
|
359 |
|
|
|
|
|
360 |
/**
|
361 |
* Filter the options after being sanitized.
|
362 |
*
|
363 |
-
* @param (array) $
|
364 |
-
* @param (array) $options
|
365 |
*/
|
366 |
-
$
|
|
|
367 |
// Make sure no keys have been removed.
|
368 |
-
$sanitized_options = array_merge( $sanitized_options, $
|
369 |
|
370 |
// Clear options cache.
|
371 |
$this->maybe_clear_options_cache( true );
|
@@ -397,64 +505,41 @@ class SFML_Options extends SFML_Singleton {
|
|
397 |
}
|
398 |
|
399 |
|
|
|
|
|
|
|
|
|
400 |
/**
|
401 |
-
*
|
402 |
-
*
|
403 |
-
* For example:
|
404 |
-
* static::get_sub_options( 'foo', array(
|
405 |
-
* 'option1' => 'value1',
|
406 |
-
* 'foo.option2' => 'value2',
|
407 |
-
* 'foo.option3' => 'value3',
|
408 |
-
* ) );
|
409 |
-
* Will return:
|
410 |
-
* array(
|
411 |
-
* 'option2' => 'value2',
|
412 |
-
* 'option3' => 'value3',
|
413 |
-
* )
|
414 |
-
*
|
415 |
-
* @param (string) $name The sub-option name.
|
416 |
-
* @param (array) $options Array of options.
|
417 |
*
|
418 |
* @return (array)
|
419 |
*/
|
420 |
-
public
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
$options = (array) $options;
|
426 |
-
|
427 |
-
if ( isset( $options[ $name ] ) ) {
|
428 |
-
return $options[ $name ];
|
429 |
-
}
|
430 |
-
|
431 |
-
$group = array();
|
432 |
-
$name = rtrim( $name, '.' ) . '.';
|
433 |
-
|
434 |
-
foreach ( $options as $k => $v ) {
|
435 |
-
if ( 0 === strpos( $k, $name ) ) {
|
436 |
-
$group[ substr( $k, strlen( $name ) ) ] = $v;
|
437 |
-
}
|
438 |
-
}
|
439 |
-
|
440 |
-
return ! empty( $group ) ? $group : null;
|
441 |
}
|
442 |
|
443 |
|
444 |
/**
|
445 |
-
*
|
446 |
-
*
|
447 |
-
* @since 2.4
|
448 |
*
|
449 |
-
* @
|
450 |
*/
|
451 |
-
public
|
452 |
-
$
|
453 |
/**
|
454 |
-
*
|
455 |
*
|
456 |
-
* @param (
|
457 |
*/
|
458 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
459 |
}
|
460 |
}
|
10 |
*/
|
11 |
class SFML_Options extends SFML_Singleton {
|
12 |
|
13 |
+
const VERSION = '1.3';
|
14 |
const OPTION_NAME = 'sfml';
|
15 |
const OPTION_GROUP = 'sfml_settings';
|
16 |
const OPTION_PAGE = 'move-login';
|
17 |
|
18 |
/**
|
19 |
+
* All options.
|
20 |
*
|
21 |
* @var (array)
|
22 |
*/
|
23 |
protected $options;
|
24 |
|
25 |
/**
|
26 |
+
* All default options.
|
27 |
*
|
28 |
* @var (array)
|
29 |
*/
|
37 |
protected $slugs;
|
38 |
|
39 |
/**
|
40 |
+
* Slug setting labels.
|
41 |
*
|
42 |
* @var (array)
|
43 |
+
* @since 2.5.2 Renamed from $labels to $slug_labels.
|
44 |
*/
|
45 |
+
protected $slug_labels;
|
46 |
|
47 |
|
48 |
/**
|
58 |
}
|
59 |
|
60 |
|
61 |
+
/**
|
62 |
+
* An improved version of `register_setting()`, that always exists and that works for network options.
|
63 |
+
*/
|
64 |
+
protected function register_setting() {
|
65 |
+
global $new_whitelist_options;
|
66 |
+
|
67 |
+
$sanitize_callback = array( $this, 'sanitize_options' );
|
68 |
+
|
69 |
+
if ( ! is_multisite() ) {
|
70 |
+
if ( function_exists( 'register_setting' ) ) {
|
71 |
+
register_setting( static::OPTION_GROUP, static::OPTION_NAME, $sanitize_callback );
|
72 |
+
return;
|
73 |
+
}
|
74 |
+
|
75 |
+
$new_whitelist_options = isset( $new_whitelist_options ) && is_array( $new_whitelist_options ) ? $new_whitelist_options : array(); // WPCS: override ok.
|
76 |
+
$new_whitelist_options[ static::OPTION_GROUP ] = isset( $new_whitelist_options[ static::OPTION_GROUP ] ) && is_array( $new_whitelist_options[ static::OPTION_GROUP ] ) ? $new_whitelist_options[ static::OPTION_GROUP ] : array();
|
77 |
+
$new_whitelist_options[ static::OPTION_GROUP ][] = static::OPTION_NAME;
|
78 |
+
} elseif ( is_admin() ) {
|
79 |
+
$whitelist = sfml_cache_data( 'new_whitelist_network_options' );
|
80 |
+
$whitelist = is_array( $whitelist ) ? $whitelist : array();
|
81 |
+
$whitelist[ static::OPTION_GROUP ] = isset( $whitelist[ static::OPTION_GROUP ] ) ? $whitelist[ static::OPTION_GROUP ] : array();
|
82 |
+
$whitelist[ static::OPTION_GROUP ][] = static::OPTION_NAME;
|
83 |
+
sfml_cache_data( 'new_whitelist_network_options', $whitelist );
|
84 |
+
}
|
85 |
+
|
86 |
+
if ( $sanitize_callback ) {
|
87 |
+
add_filter( 'sanitize_option_' . static::OPTION_NAME, $sanitize_callback );
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
|
92 |
+
/*--------------------------------------------------------------------------------------------*/
|
93 |
+
/* !DEFAULT OPTIONS ========================================================================= */
|
94 |
+
/*--------------------------------------------------------------------------------------------*/
|
95 |
+
|
96 |
/**
|
97 |
* Get default options.
|
98 |
*
|
128 |
}
|
129 |
}
|
130 |
|
131 |
+
// Other options.
|
132 |
+
$this->options_default = array_merge( $this->options_default, $this->get_other_default_options() );
|
|
|
|
|
|
|
133 |
|
134 |
return $this->options_default;
|
135 |
}
|
136 |
|
137 |
|
138 |
+
/**
|
139 |
+
* Get "other" default options (the radio groups).
|
140 |
+
*
|
141 |
+
* @since 2.5.2
|
142 |
+
*
|
143 |
+
* @return (array)
|
144 |
+
*/
|
145 |
+
public function get_other_default_options() {
|
146 |
+
return array(
|
147 |
+
'deny_wp_login_access' => 1,
|
148 |
+
'deny_admin_access' => 0,
|
149 |
+
);
|
150 |
+
}
|
151 |
+
|
152 |
+
|
153 |
+
/*--------------------------------------------------------------------------------------------*/
|
154 |
+
/* !GET OPTIONS ============================================================================= */
|
155 |
+
/*--------------------------------------------------------------------------------------------*/
|
156 |
+
|
157 |
/**
|
158 |
* Get all options.
|
159 |
*
|
166 |
return $this->options;
|
167 |
}
|
168 |
|
169 |
+
$this->options = array();
|
170 |
+
$raw_options = get_site_option( static::OPTION_NAME );
|
171 |
+
$default_options = $this->get_default_options();
|
|
|
|
|
|
|
172 |
|
173 |
+
if ( is_array( $raw_options ) ) {
|
174 |
// Add and escape slugs.
|
175 |
+
$default_slugs = static::get_sub_options( 'slugs', $default_options );
|
176 |
+
|
177 |
foreach ( $default_slugs as $slug_key => $default_slug ) {
|
178 |
+
$this->options[ 'slugs.' . $slug_key ] = ! empty( $raw_options[ 'slugs.' . $slug_key ] ) ? sanitize_title( $raw_options[ 'slugs.' . $slug_key ], $default_slug, 'display' ) : $default_slug;
|
179 |
}
|
180 |
|
181 |
// Add and escape other options.
|
182 |
+
$default_options = $this->get_other_default_options();
|
|
|
|
|
183 |
|
184 |
+
foreach ( $default_options as $option_name => $default_value ) {
|
185 |
+
if ( ! isset( $raw_options[ $option_name ] ) ) {
|
186 |
+
$this->options[ $option_name ] = $default_value;
|
187 |
+
continue;
|
188 |
+
}
|
189 |
+
|
190 |
+
$choices = $this->get_field_labels( $option_name );
|
191 |
+
$this->options[ $option_name ] = (int) $raw_options[ $option_name ];
|
192 |
+
|
193 |
+
if ( ! isset( $choices[ $this->options[ $option_name ] ] ) ) {
|
194 |
+
$this->options[ $option_name ] = $default_value;
|
195 |
+
}
|
196 |
}
|
197 |
} else {
|
198 |
+
$this->options = $default_options;
|
199 |
}
|
200 |
|
201 |
+
$filtered_options = $this->options;
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Filter the plugin options before retrieving them.
|
205 |
+
*
|
206 |
+
* @param (array) $filtered_options The plugin options.
|
207 |
+
*/
|
208 |
+
$filtered_options = apply_filters( 'sfml_options', $filtered_options );
|
209 |
+
|
210 |
// Make sure no keys have been added or removed.
|
211 |
+
$this->options = array_intersect_key( array_merge( $this->options, $filtered_options ), $this->options );
|
212 |
|
213 |
return $this->options;
|
214 |
}
|
245 |
}
|
246 |
|
247 |
|
248 |
+
/**
|
249 |
+
* Get sub-options.
|
250 |
+
*
|
251 |
+
* For example:
|
252 |
+
* static::get_sub_options( 'foo', array(
|
253 |
+
* 'option1' => 'value1',
|
254 |
+
* 'foo.option2' => 'value2',
|
255 |
+
* 'foo.option3' => 'value3',
|
256 |
+
* ) );
|
257 |
+
* Will return:
|
258 |
+
* array(
|
259 |
+
* 'option2' => 'value2',
|
260 |
+
* 'option3' => 'value3',
|
261 |
+
* )
|
262 |
+
*
|
263 |
+
* @param (string) $name The sub-option name.
|
264 |
+
* @param (array) $options Array of options.
|
265 |
+
*
|
266 |
+
* @return (array)
|
267 |
+
*/
|
268 |
+
public static function get_sub_options( $name, $options ) {
|
269 |
+
if ( ! $options || ! $name ) {
|
270 |
+
return array();
|
271 |
+
}
|
272 |
+
|
273 |
+
$options = (array) $options;
|
274 |
+
|
275 |
+
if ( isset( $options[ $name ] ) ) {
|
276 |
+
return $options[ $name ];
|
277 |
+
}
|
278 |
+
|
279 |
+
$group = array();
|
280 |
+
$name = rtrim( $name, '.' ) . '.';
|
281 |
+
|
282 |
+
foreach ( $options as $k => $v ) {
|
283 |
+
if ( 0 === strpos( $k, $name ) ) {
|
284 |
+
$group[ substr( $k, strlen( $name ) ) ] = $v;
|
285 |
+
}
|
286 |
+
}
|
287 |
+
|
288 |
+
return ! empty( $group ) ? $group : null;
|
289 |
+
}
|
290 |
+
|
291 |
+
|
292 |
+
/*--------------------------------------------------------------------------------------------*/
|
293 |
+
/* !FIELD LABELS ==========+++=============================================================== */
|
294 |
+
/*--------------------------------------------------------------------------------------------*/
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Get the possible choices for a specific option.
|
298 |
+
*
|
299 |
+
* @since 1.5.2
|
300 |
+
*
|
301 |
+
* @param (string) $option The option name.
|
302 |
+
*
|
303 |
+
* @return (array)
|
304 |
+
*/
|
305 |
+
public function get_field_labels( $option ) {
|
306 |
+
if ( 'slugs' === $option ) {
|
307 |
+
return $this->get_slug_field_labels();
|
308 |
+
}
|
309 |
+
|
310 |
+
$choices = array(
|
311 |
+
'deny_wp_login_access' => array(
|
312 |
+
1 => __( 'Display an error message', 'sf-move-login' ),
|
313 |
+
4 => __( 'Trigger a «Page not found» error', 'sf-move-login' ),
|
314 |
+
2 => __( 'Redirect to a "WordPress" «Page not found» error page', 'sf-move-login' ),
|
315 |
+
3 => __( 'Redirect to the home page', 'sf-move-login' ),
|
316 |
+
),
|
317 |
+
'deny_admin_access' => array(
|
318 |
+
0 => __( 'Do nothing, redirect to the new login page (not recommended)', 'sf-move-login' ),
|
319 |
+
1 => __( 'Display an error message', 'sf-move-login' ),
|
320 |
+
4 => __( 'Trigger a «Page not found» error', 'sf-move-login' ),
|
321 |
+
2 => __( 'Redirect to a "WordPress" «Page not found» error page', 'sf-move-login' ),
|
322 |
+
3 => __( 'Redirect to the home page', 'sf-move-login' ),
|
323 |
+
),
|
324 |
+
);
|
325 |
+
|
326 |
+
$choices = isset( $choices[ $option ] ) ? $choices[ $option ] : array();
|
327 |
+
|
328 |
+
/**
|
329 |
+
* Filter the possible choices for a specific option.
|
330 |
+
*
|
331 |
+
* @param (array) $choices The possible choices.
|
332 |
+
* @param (string) $option The option name.
|
333 |
+
*/
|
334 |
+
return apply_filters( 'sfml_option_choices', $choices, $option );
|
335 |
+
}
|
336 |
+
|
337 |
+
|
338 |
/**
|
339 |
* Setting field labels for the slugs.
|
340 |
*
|
343 |
public function get_slug_field_labels() {
|
344 |
$this->maybe_clear_options_cache();
|
345 |
|
346 |
+
if ( isset( $this->slug_labels ) ) {
|
347 |
+
return $this->slug_labels;
|
348 |
}
|
349 |
|
350 |
+
$this->slug_labels = array(
|
351 |
'login' => __( 'Log in' ),
|
352 |
'logout' => __( 'Log out' ),
|
353 |
'register' => __( 'Register' ),
|
358 |
$new_actions = static::get_additional_labels();
|
359 |
|
360 |
if ( $new_actions ) {
|
361 |
+
$new_actions = array_diff_key( $new_actions, $this->slug_labels );
|
362 |
+
$this->slug_labels = array_merge( $this->slug_labels, $new_actions );
|
363 |
}
|
364 |
|
365 |
+
return $this->slug_labels;
|
366 |
}
|
367 |
|
368 |
|
369 |
/**
|
370 |
+
* Get custom labels (added by other plugins).
|
371 |
*
|
372 |
+
* @since 2.4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
373 |
*
|
374 |
+
* @return (array)
|
375 |
*/
|
376 |
+
public static function get_additional_labels() {
|
377 |
+
$new_actions = array();
|
378 |
/**
|
379 |
+
* Plugins can add their own actions.
|
380 |
*
|
381 |
+
* @param (array) $new_actions Custom actions.
|
382 |
*/
|
383 |
+
return apply_filters( 'sfml_additional_slugs', $new_actions );
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
}
|
385 |
|
386 |
|
387 |
+
/*--------------------------------------------------------------------------------------------*/
|
388 |
+
/* !SANITIZATION ============================================================================ */
|
389 |
+
/*--------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
|
391 |
/**
|
392 |
* Sanitize options on save.
|
396 |
* @return (array)
|
397 |
*/
|
398 |
public function sanitize_options( $options = array() ) {
|
|
|
|
|
|
|
399 |
$sanitized_options = array();
|
400 |
+
$old_options = get_site_option( static::OPTION_NAME );
|
401 |
+
$errors = array( 'forbidden' => array(), 'duplicates' => array() );
|
402 |
|
403 |
// Add and sanitize slugs.
|
404 |
+
$default_slugs = $this->get_default_options();
|
405 |
+
$default_slugs = static::get_sub_options( 'slugs', $default_slugs );
|
406 |
$exclude = $this->get_other_actions();
|
407 |
|
408 |
foreach ( $default_slugs as $slug_key => $default_slug ) {
|
442 |
}
|
443 |
|
444 |
// Add and sanitize other options.
|
445 |
+
$default_options = $this->get_other_default_options();
|
|
|
|
|
|
|
|
|
|
|
446 |
|
447 |
+
foreach ( $default_options as $option_name => $default_value ) {
|
448 |
|
449 |
+
if ( isset( $options[ $option_name ] ) ) {
|
450 |
+
$sanitized_options[ $option_name ] = (int) $options[ $option_name ];
|
451 |
+
} elseif ( isset( $old_options[ $option_name ] ) ) {
|
452 |
+
$sanitized_options[ $option_name ] = (int) $old_options[ $option_name ];
|
453 |
} else {
|
454 |
+
$sanitized_options[ $option_name ] = $default_value;
|
455 |
+
continue;
|
456 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
457 |
|
458 |
+
$choices = $this->get_field_labels( $option_name );
|
459 |
|
460 |
+
if ( ! isset( $choices[ $sanitized_options[ $option_name ] ] ) ) {
|
461 |
+
$sanitized_options[ $option_name ] = $default_value;
|
|
|
|
|
462 |
}
|
463 |
}
|
464 |
|
465 |
+
$filtered_options = $sanitized_options;
|
466 |
+
|
467 |
/**
|
468 |
* Filter the options after being sanitized.
|
469 |
*
|
470 |
+
* @param (array) $filtered_options The new options, sanitized.
|
471 |
+
* @param (array) $options The submitted options.
|
472 |
*/
|
473 |
+
$filtered_options = apply_filters( 'sfml_sanitize_options', $filtered_options, $options );
|
474 |
+
|
475 |
// Make sure no keys have been removed.
|
476 |
+
$sanitized_options = array_merge( $sanitized_options, $filtered_options );
|
477 |
|
478 |
// Clear options cache.
|
479 |
$this->maybe_clear_options_cache( true );
|
505 |
}
|
506 |
|
507 |
|
508 |
+
/*--------------------------------------------------------------------------------------------*/
|
509 |
+
/* !VARIOUS ================================================================================= */
|
510 |
+
/*--------------------------------------------------------------------------------------------*/
|
511 |
+
|
512 |
/**
|
513 |
+
* Return the "other" original login actions: not the ones listed in our settings.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
514 |
*
|
515 |
* @return (array)
|
516 |
*/
|
517 |
+
public function get_other_actions() {
|
518 |
+
return array_diff_key( array(
|
519 |
+
'retrievepassword' => 'retrievepassword',
|
520 |
+
'rp' => 'rp',
|
521 |
+
), $this->get_slug_field_labels() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
522 |
}
|
523 |
|
524 |
|
525 |
/**
|
526 |
+
* Clear options cache.
|
|
|
|
|
527 |
*
|
528 |
+
* @param (bool) $force Clear the cache manually.
|
529 |
*/
|
530 |
+
public function maybe_clear_options_cache( $force = false ) {
|
531 |
+
$clear = false;
|
532 |
/**
|
533 |
+
* Clear options cache.
|
534 |
*
|
535 |
+
* @param (bool) $clear Return true if you want to clear the cache.
|
536 |
*/
|
537 |
+
if ( $force || apply_filters( static::OPTION_NAME . '_clear_options_cache', $clear ) ) {
|
538 |
+
$this->options = null;
|
539 |
+
$this->options_default = null;
|
540 |
+
$this->slugs = null;
|
541 |
+
$this->slug_labels = null;
|
542 |
+
remove_all_filters( static::OPTION_NAME . '_clear_options_cache' );
|
543 |
+
}
|
544 |
}
|
545 |
}
|
inc/functions/compat.php
CHANGED
@@ -207,3 +207,86 @@ if ( ! function_exists( '_wp_translate_php_url_constant_to_key' ) ) :
|
|
207 |
}
|
208 |
}
|
209 |
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
}
|
208 |
}
|
209 |
endif;
|
210 |
+
|
211 |
+
|
212 |
+
if ( ! function_exists( 'do_action_deprecated' ) ) :
|
213 |
+
/**
|
214 |
+
* Fires functions attached to a deprecated action hook.
|
215 |
+
*
|
216 |
+
* When an action hook is deprecated, the do_action() call is replaced with do_action_deprecated(), which triggers a deprecation notice and then fires the original hook.
|
217 |
+
*
|
218 |
+
* @since 2.5.2
|
219 |
+
* @since WP 4.6.0
|
220 |
+
*
|
221 |
+
* @see _deprecated_hook()
|
222 |
+
*
|
223 |
+
* @param (string) $tag The name of the action hook.
|
224 |
+
* @param (array) $args Array of additional function arguments to be passed to do_action().
|
225 |
+
* @param (string) $version The version of WordPress that deprecated the hook.
|
226 |
+
* @param (string) $replacement Optional. The hook that should have been used.
|
227 |
+
* @param (string) $message Optional. A message regarding the change.
|
228 |
+
*/
|
229 |
+
function do_action_deprecated( $tag, $args, $version, $replacement = false, $message = null ) {
|
230 |
+
if ( ! has_action( $tag ) ) {
|
231 |
+
return;
|
232 |
+
}
|
233 |
+
|
234 |
+
_deprecated_hook( $tag, $version, $replacement, $message );
|
235 |
+
|
236 |
+
do_action_ref_array( $tag, $args );
|
237 |
+
}
|
238 |
+
endif;
|
239 |
+
|
240 |
+
|
241 |
+
if ( ! function_exists( '_deprecated_hook' ) ) :
|
242 |
+
/**
|
243 |
+
* Marks a deprecated action or filter hook as deprecated and throws a notice.
|
244 |
+
*
|
245 |
+
* Use the {@see 'deprecated_hook_run'} action to get the backtrace describing where the deprecated hook was called.
|
246 |
+
*
|
247 |
+
* Default behavior is to trigger a user error if `WP_DEBUG` is true.
|
248 |
+
*
|
249 |
+
* This function is called by the do_action_deprecated() and apply_filters_deprecated() functions, and so generally does not need to be called directly.
|
250 |
+
*
|
251 |
+
* @since 2.5.2
|
252 |
+
* @since WP 4.6.0
|
253 |
+
*
|
254 |
+
* @param (string) $hook The hook that was used.
|
255 |
+
* @param (string) $version The version of WordPress that deprecated the hook.
|
256 |
+
* @param (string) $replacement Optional. The hook that should have been used.
|
257 |
+
* @param (string) $message Optional. A message regarding the change.
|
258 |
+
*/
|
259 |
+
function _deprecated_hook( $hook, $version, $replacement = null, $message = null ) {
|
260 |
+
/**
|
261 |
+
* Fires when a deprecated hook is called.
|
262 |
+
*
|
263 |
+
* @since 2.5.2
|
264 |
+
* @since WP 4.6.0
|
265 |
+
*
|
266 |
+
* @param (string) $hook The hook that was called.
|
267 |
+
* @param (string) $replacement The hook that should be used as a replacement.
|
268 |
+
* @param (string) $version The version of WordPress that deprecated the argument used.
|
269 |
+
* @param (string) $message A message regarding the change.
|
270 |
+
*/
|
271 |
+
do_action( 'deprecated_hook_run', $hook, $replacement, $version, $message );
|
272 |
+
|
273 |
+
/**
|
274 |
+
* Filters whether to trigger deprecated hook errors.
|
275 |
+
*
|
276 |
+
* @since 2.5.2
|
277 |
+
* @since WP 4.6.0
|
278 |
+
*
|
279 |
+
* @param (bool) $trigger Whether to trigger deprecated hook errors. Requires `WP_DEBUG` to be defined true.
|
280 |
+
*/
|
281 |
+
if ( WP_DEBUG && apply_filters( 'deprecated_hook_trigger_error', true ) ) {
|
282 |
+
$message = empty( $message ) ? '' : ' ' . $message;
|
283 |
+
if ( ! is_null( $replacement ) ) {
|
284 |
+
/* Translators: 1: WordPress hook name, 2: version number, 3: alternative hook name. */
|
285 |
+
trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', 'sf-move-login' ), $hook, $version, $replacement ) . $message );
|
286 |
+
} else {
|
287 |
+
/* Translators: 1: WordPress hook name, 2: version number. */
|
288 |
+
trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', 'sf-move-login' ), $hook, $version ) . $message );
|
289 |
+
}
|
290 |
+
}
|
291 |
+
}
|
292 |
+
endif;
|
inc/functions/rewrite.php
CHANGED
@@ -45,8 +45,6 @@ function sfml_rules( $actions = null ) {
|
|
45 |
* @return (bool) True on success, false if the file is not writable or upon failure.
|
46 |
*/
|
47 |
function sfml_write_rules( $rules = null ) {
|
48 |
-
global $is_apache, $is_iis7;
|
49 |
-
|
50 |
$rules = isset( $rules ) ? $rules : sfml_rules();
|
51 |
|
52 |
// Nginx.
|
@@ -58,11 +56,11 @@ function sfml_write_rules( $rules = null ) {
|
|
58 |
$success = false;
|
59 |
}
|
60 |
// Apache.
|
61 |
-
elseif (
|
62 |
$success = sfml_insert_apache_rewrite_rules( $rules );
|
63 |
}
|
64 |
// IIS.
|
65 |
-
elseif (
|
66 |
$success = sfml_insert_iis7_rewrite_rules( $rules );
|
67 |
}
|
68 |
// Souldn't happen.
|
@@ -98,7 +96,6 @@ function sfml_write_rules( $rules = null ) {
|
|
98 |
* 'home_to' => First part of the rewrited address (home URL).
|
99 |
*/
|
100 |
function sfml_get_rewrite_bases() {
|
101 |
-
global $is_apache, $is_nginx, $is_iis7;
|
102 |
static $bases;
|
103 |
|
104 |
if ( isset( $bases ) ) {
|
@@ -118,7 +115,7 @@ function sfml_get_rewrite_bases() {
|
|
118 |
);
|
119 |
|
120 |
// Apache.
|
121 |
-
if (
|
122 |
/**
|
123 |
* In the `*_from` fields, we don't add `$base` because we use `RewriteBase $base` in the rewrite rules.
|
124 |
* In the `*_to` fields, `$base` is optional, but WP adds it so we do the same for concistancy.
|
@@ -144,7 +141,7 @@ function sfml_get_rewrite_bases() {
|
|
144 |
}
|
145 |
|
146 |
// Nginx.
|
147 |
-
if (
|
148 |
if ( $is_sub ) {
|
149 |
// MultiSite by sub-folders.
|
150 |
return ( $bases = array_merge( $bases, array(
|
@@ -166,7 +163,7 @@ function sfml_get_rewrite_bases() {
|
|
166 |
}
|
167 |
|
168 |
// IIS7.
|
169 |
-
if (
|
170 |
$base = ltrim( $base, '/' ); // No heading slash for IIS: '' or 'sub-dir/'.
|
171 |
$site_dir = ltrim( $site_dir, '/' ); // No heading slash for IIS: '', 'wp-dir/', 'sub-dir/', or 'sub-dir/wp-dir/'.
|
172 |
|
45 |
* @return (bool) True on success, false if the file is not writable or upon failure.
|
46 |
*/
|
47 |
function sfml_write_rules( $rules = null ) {
|
|
|
|
|
48 |
$rules = isset( $rules ) ? $rules : sfml_rules();
|
49 |
|
50 |
// Nginx.
|
56 |
$success = false;
|
57 |
}
|
58 |
// Apache.
|
59 |
+
elseif ( sfml_is_apache() ) {
|
60 |
$success = sfml_insert_apache_rewrite_rules( $rules );
|
61 |
}
|
62 |
// IIS.
|
63 |
+
elseif ( sfml_is_iis7() ) {
|
64 |
$success = sfml_insert_iis7_rewrite_rules( $rules );
|
65 |
}
|
66 |
// Souldn't happen.
|
96 |
* 'home_to' => First part of the rewrited address (home URL).
|
97 |
*/
|
98 |
function sfml_get_rewrite_bases() {
|
|
|
99 |
static $bases;
|
100 |
|
101 |
if ( isset( $bases ) ) {
|
115 |
);
|
116 |
|
117 |
// Apache.
|
118 |
+
if ( sfml_is_apache() ) {
|
119 |
/**
|
120 |
* In the `*_from` fields, we don't add `$base` because we use `RewriteBase $base` in the rewrite rules.
|
121 |
* In the `*_to` fields, `$base` is optional, but WP adds it so we do the same for concistancy.
|
141 |
}
|
142 |
|
143 |
// Nginx.
|
144 |
+
if ( sfml_is_nginx() ) {
|
145 |
if ( $is_sub ) {
|
146 |
// MultiSite by sub-folders.
|
147 |
return ( $bases = array_merge( $bases, array(
|
163 |
}
|
164 |
|
165 |
// IIS7.
|
166 |
+
if ( sfml_is_iis7() ) {
|
167 |
$base = ltrim( $base, '/' ); // No heading slash for IIS: '' or 'sub-dir/'.
|
168 |
$site_dir = ltrim( $site_dir, '/' ); // No heading slash for IIS: '', 'wp-dir/', 'sub-dir/', or 'sub-dir/wp-dir/'.
|
169 |
|
inc/functions/settings-page.php
CHANGED
@@ -11,7 +11,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
11 |
* Add settings fields and sections.
|
12 |
*/
|
13 |
function sfml_settings_fields() {
|
14 |
-
$
|
|
|
15 |
$defaults = sfml_get_default_options();
|
16 |
$options = sfml_get_options();
|
17 |
|
@@ -56,11 +57,7 @@ function sfml_settings_fields() {
|
|
56 |
'label_for' => 'deny_wp_login_access',
|
57 |
'value' => $options['deny_wp_login_access'],
|
58 |
'default' => $defaults['deny_wp_login_access'],
|
59 |
-
'values' =>
|
60 |
-
1 => __( 'Display an error message', 'sf-move-login' ),
|
61 |
-
2 => __( 'Redirect to a «Page not found» error page', 'sf-move-login' ),
|
62 |
-
3 => __( 'Redirect to the home page', 'sf-move-login' ),
|
63 |
-
),
|
64 |
'label' => '<strong>' . __( 'When a logged out user attempts to access the old login page.', 'sf-move-login' ) . '</strong>',
|
65 |
)
|
66 |
);
|
@@ -76,12 +73,7 @@ function sfml_settings_fields() {
|
|
76 |
'label_for' => 'deny_admin_access',
|
77 |
'value' => $options['deny_admin_access'],
|
78 |
'default' => $defaults['deny_admin_access'],
|
79 |
-
'values' =>
|
80 |
-
0 => __( 'Do nothing, redirect to the new login page (not recommended)', 'sf-move-login' ),
|
81 |
-
1 => __( 'Display an error message', 'sf-move-login' ),
|
82 |
-
2 => __( 'Redirect to a «Page not found» error page', 'sf-move-login' ),
|
83 |
-
3 => __( 'Redirect to the home page', 'sf-move-login' ),
|
84 |
-
),
|
85 |
'label' => '<strong>' . __( 'Instead of redirecting a logged out user to the new login page:', 'sf-move-login' ) . '</strong>',
|
86 |
)
|
87 |
);
|
@@ -103,7 +95,7 @@ function sfml_shunt_options_settings_errors() {
|
|
103 |
|
104 |
|
105 |
/**
|
106 |
-
* The settings page
|
107 |
*/
|
108 |
function sfml_settings_page() {
|
109 |
global $wp_version;
|
@@ -216,12 +208,9 @@ function sfml_radio_field( $args ) {
|
|
216 |
* A textarea displaying the rewrite rules.
|
217 |
*/
|
218 |
function sfml_rewrite_rules_textarea() {
|
219 |
-
global $is_apache, $is_iis7;
|
220 |
-
|
221 |
sfml_include_rewrite_file();
|
222 |
|
223 |
-
$
|
224 |
-
$rules = sfml_rules();
|
225 |
|
226 |
// Message.
|
227 |
$base = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
|
@@ -230,7 +219,7 @@ function sfml_rewrite_rules_textarea() {
|
|
230 |
$home_path = strpos( $abspath_fix, $document_root_fix ) === 0 ? $document_root_fix . $base : sfml_get_home_path();
|
231 |
|
232 |
// IIS.
|
233 |
-
if (
|
234 |
$file = 'web.config';
|
235 |
$file_content = implode( "\n", sfml_iis7_rewrite_rules( $rules ) );
|
236 |
|
@@ -245,7 +234,7 @@ function sfml_rewrite_rules_textarea() {
|
|
245 |
);
|
246 |
}
|
247 |
// Nginx.
|
248 |
-
elseif (
|
249 |
$file = 'nginx.conf';
|
250 |
$file_content = implode( "\n", sfml_nginx_rewrite_rules( $rules ) );
|
251 |
|
@@ -260,7 +249,7 @@ function sfml_rewrite_rules_textarea() {
|
|
260 |
$file = false;
|
261 |
}
|
262 |
// Apache.
|
263 |
-
elseif (
|
264 |
$file = '.htaccess';
|
265 |
$file_content = "\n# BEGIN SF Move Login\n";
|
266 |
$file_content .= implode( "\n", sfml_apache_rewrite_rules( $rules ) );
|
11 |
* Add settings fields and sections.
|
12 |
*/
|
13 |
function sfml_settings_fields() {
|
14 |
+
$instance = SFML_Options::get_instance();
|
15 |
+
$labels = $instance->get_field_labels( 'slugs' );
|
16 |
$defaults = sfml_get_default_options();
|
17 |
$options = sfml_get_options();
|
18 |
|
57 |
'label_for' => 'deny_wp_login_access',
|
58 |
'value' => $options['deny_wp_login_access'],
|
59 |
'default' => $defaults['deny_wp_login_access'],
|
60 |
+
'values' => $instance->get_field_labels( 'deny_wp_login_access' ),
|
|
|
|
|
|
|
|
|
61 |
'label' => '<strong>' . __( 'When a logged out user attempts to access the old login page.', 'sf-move-login' ) . '</strong>',
|
62 |
)
|
63 |
);
|
73 |
'label_for' => 'deny_admin_access',
|
74 |
'value' => $options['deny_admin_access'],
|
75 |
'default' => $defaults['deny_admin_access'],
|
76 |
+
'values' => $instance->get_field_labels( 'deny_admin_access' ),
|
|
|
|
|
|
|
|
|
|
|
77 |
'label' => '<strong>' . __( 'Instead of redirecting a logged out user to the new login page:', 'sf-move-login' ) . '</strong>',
|
78 |
)
|
79 |
);
|
95 |
|
96 |
|
97 |
/**
|
98 |
+
* The settings page.
|
99 |
*/
|
100 |
function sfml_settings_page() {
|
101 |
global $wp_version;
|
208 |
* A textarea displaying the rewrite rules.
|
209 |
*/
|
210 |
function sfml_rewrite_rules_textarea() {
|
|
|
|
|
211 |
sfml_include_rewrite_file();
|
212 |
|
213 |
+
$rules = sfml_rules();
|
|
|
214 |
|
215 |
// Message.
|
216 |
$base = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
|
219 |
$home_path = strpos( $abspath_fix, $document_root_fix ) === 0 ? $document_root_fix . $base : sfml_get_home_path();
|
220 |
|
221 |
// IIS.
|
222 |
+
if ( sfml_is_iis7() ) {
|
223 |
$file = 'web.config';
|
224 |
$file_content = implode( "\n", sfml_iis7_rewrite_rules( $rules ) );
|
225 |
|
234 |
);
|
235 |
}
|
236 |
// Nginx.
|
237 |
+
elseif ( sfml_is_nginx() ) {
|
238 |
$file = 'nginx.conf';
|
239 |
$file_content = implode( "\n", sfml_nginx_rewrite_rules( $rules ) );
|
240 |
|
249 |
$file = false;
|
250 |
}
|
251 |
// Apache.
|
252 |
+
elseif ( sfml_is_apache() ) {
|
253 |
$file = '.htaccess';
|
254 |
$file_content = "\n# BEGIN SF Move Login\n";
|
255 |
$file_content .= implode( "\n", sfml_apache_rewrite_rules( $rules ) );
|
inc/functions/utilities.php
CHANGED
@@ -88,6 +88,71 @@ function sfml_cache_data( $key ) {
|
|
88 |
}
|
89 |
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
/**
|
92 |
* Tell if the server runs Nginx.
|
93 |
*
|
@@ -95,12 +160,26 @@ function sfml_cache_data( $key ) {
|
|
95 |
*/
|
96 |
function sfml_is_nginx() {
|
97 |
global $is_nginx;
|
|
|
98 |
|
99 |
-
if (
|
100 |
-
|
101 |
}
|
102 |
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
}
|
105 |
|
106 |
|
@@ -341,12 +420,10 @@ function sfml_include_rewrite_file() {
|
|
341 |
* @return (bool) True if the file is writable. False otherwize.
|
342 |
*/
|
343 |
function sfml_can_write_file() {
|
344 |
-
global $is_apache, $is_iis7;
|
345 |
-
|
346 |
$home_path = sfml_get_home_path();
|
347 |
|
348 |
// Apache.
|
349 |
-
if (
|
350 |
if ( ! got_mod_rewrite() ) {
|
351 |
return false;
|
352 |
}
|
@@ -357,7 +434,7 @@ function sfml_can_write_file() {
|
|
357 |
}
|
358 |
|
359 |
// IIS7.
|
360 |
-
if (
|
361 |
if ( ! iis7_supports_permalinks() ) {
|
362 |
return false;
|
363 |
}
|
88 |
}
|
89 |
|
90 |
|
91 |
+
/**
|
92 |
+
* Tell if the server runs Apache.
|
93 |
+
*
|
94 |
+
* @since 2.5.2
|
95 |
+
*
|
96 |
+
* @return (bool) True if the server runs Apache. False otherwize.
|
97 |
+
*/
|
98 |
+
function sfml_is_apache() {
|
99 |
+
global $is_apache;
|
100 |
+
static $is;
|
101 |
+
|
102 |
+
if ( isset( $is ) ) {
|
103 |
+
return $is;
|
104 |
+
}
|
105 |
+
|
106 |
+
if ( isset( $is_apache ) ) {
|
107 |
+
$is = (bool) $is_apache;
|
108 |
+
} else {
|
109 |
+
$is = ! empty( $_SERVER['SERVER_SOFTWARE'] ) && ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== false || strpos( $_SERVER['SERVER_SOFTWARE'], 'LiteSpeed' ) !== false );
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Filters the value returned by `sfml_is_apache()`.
|
114 |
+
*
|
115 |
+
* @since 2.5.2
|
116 |
+
*
|
117 |
+
* @param (bool) $is True if the server runs Apache. False otherwize.
|
118 |
+
*/
|
119 |
+
return apply_filters( 'sfml_is_apache', $is );
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Tell if the server runs IIS7.
|
125 |
+
*
|
126 |
+
* @since 2.5.2
|
127 |
+
*
|
128 |
+
* @return (bool) True if the server runs IIS7. False otherwize.
|
129 |
+
*/
|
130 |
+
function sfml_is_iis7() {
|
131 |
+
global $is_iis7;
|
132 |
+
static $is;
|
133 |
+
|
134 |
+
if ( isset( $is ) ) {
|
135 |
+
return $is;
|
136 |
+
}
|
137 |
+
|
138 |
+
if ( isset( $is_iis7 ) ) {
|
139 |
+
$is = (bool) $is_iis7;
|
140 |
+
} else {
|
141 |
+
$is = ! sfml_is_apache() && ! empty( $_SERVER['SERVER_SOFTWARE'] ) && ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) !== false || strpos( $_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer' ) !== false );
|
142 |
+
$is = $is && intval( substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/' ) + 14 ) ) >= 7;
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Filters the value returned by `sfml_is_iis7()`.
|
147 |
+
*
|
148 |
+
* @since 2.5.2
|
149 |
+
*
|
150 |
+
* @param (bool) $is True if the server runs IIS7. False otherwize.
|
151 |
+
*/
|
152 |
+
return apply_filters( 'sfml_is_iis7', $is );
|
153 |
+
}
|
154 |
+
|
155 |
+
|
156 |
/**
|
157 |
* Tell if the server runs Nginx.
|
158 |
*
|
160 |
*/
|
161 |
function sfml_is_nginx() {
|
162 |
global $is_nginx;
|
163 |
+
static $is;
|
164 |
|
165 |
+
if ( isset( $is ) ) {
|
166 |
+
return $is;
|
167 |
}
|
168 |
|
169 |
+
if ( isset( $is_nginx ) ) {
|
170 |
+
$is = (bool) $is_nginx;
|
171 |
+
} else {
|
172 |
+
$is = ! empty( $_SERVER['SERVER_SOFTWARE'] ) && strpos( $_SERVER['SERVER_SOFTWARE'], 'nginx' ) !== false;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Filters the value returned by `sfml_is_nginx()`.
|
177 |
+
*
|
178 |
+
* @since 2.5.2
|
179 |
+
*
|
180 |
+
* @param (bool) $is True if the server runs Nginx. False otherwize.
|
181 |
+
*/
|
182 |
+
return apply_filters( 'sfml_is_nginx', $is );
|
183 |
}
|
184 |
|
185 |
|
420 |
* @return (bool) True if the file is writable. False otherwize.
|
421 |
*/
|
422 |
function sfml_can_write_file() {
|
|
|
|
|
423 |
$home_path = sfml_get_home_path();
|
424 |
|
425 |
// Apache.
|
426 |
+
if ( sfml_is_apache() ) {
|
427 |
if ( ! got_mod_rewrite() ) {
|
428 |
return false;
|
429 |
}
|
434 |
}
|
435 |
|
436 |
// IIS7.
|
437 |
+
if ( sfml_is_iis7() ) {
|
438 |
if ( ! iis7_supports_permalinks() ) {
|
439 |
return false;
|
440 |
}
|
inc/redirections-and-dies.php
CHANGED
@@ -98,18 +98,16 @@ function sfml_deny_login_access() {
|
|
98 |
|
99 |
switch ( $do ) {
|
100 |
case 2:
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Filter the 404 page URL.
|
104 |
-
*
|
105 |
-
* @param (string) $redirect An URL that leads to a 404 response.
|
106 |
-
*/
|
107 |
-
$redirect = apply_filters( 'sfml_404_error_page', $redirect );
|
108 |
-
wp_redirect( esc_url_raw( user_trailingslashit( $redirect ) ) );
|
109 |
exit;
|
110 |
case 3:
|
111 |
wp_redirect( esc_url_raw( user_trailingslashit( home_url() ) ) );
|
112 |
exit;
|
|
|
|
|
|
|
|
|
|
|
113 |
default:
|
114 |
wp_die( __( 'No no no, the login form is not here.', 'sf-move-login' ), __( 'Nope :)', 'sf-move-login' ), array( 'response' => 403 ) );
|
115 |
}
|
@@ -161,7 +159,8 @@ function sfml_maybe_deny_login_redirect( $location ) {
|
|
161 |
|
162 |
$redirect = false;
|
163 |
/**
|
164 |
-
*
|
|
|
165 |
*
|
166 |
* @since 2.5
|
167 |
*
|
@@ -173,28 +172,70 @@ function sfml_maybe_deny_login_redirect( $location ) {
|
|
173 |
return esc_url_raw( $redirect );
|
174 |
}
|
175 |
|
176 |
-
|
177 |
-
do_action_deprecated( 'sfml_wp_admin_error', array(), '2.5', 'sfml_login_redirect_location' );
|
178 |
-
} else {
|
179 |
-
/**
|
180 |
-
* If you want to trigger a custom action (redirect, message, die...), add it here.
|
181 |
-
* Don't forget to exit/die.
|
182 |
-
*/
|
183 |
-
do_action( 'sfml_wp_admin_error' );
|
184 |
-
}
|
185 |
|
186 |
$do = sfml_get_deny_admin_access();
|
187 |
|
188 |
switch ( $do ) {
|
189 |
case 1:
|
190 |
-
sfml_lang_init();
|
191 |
wp_die( __( 'Cheatin’ uh?', 'sf-move-login' ), __( 'Nope :)', 'sf-move-login' ), array( 'response' => 403 ) );
|
192 |
case 2:
|
193 |
-
|
194 |
-
/** This filter is documented in inc/redirections-and-dies.php */
|
195 |
-
$redirect = apply_filters( 'sfml_404_error_page', $redirect );
|
196 |
-
return esc_url_raw( user_trailingslashit( $redirect ) );
|
197 |
case 3:
|
198 |
return esc_url_raw( user_trailingslashit( home_url() ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
}
|
98 |
|
99 |
switch ( $do ) {
|
100 |
case 2:
|
101 |
+
wp_redirect( esc_url_raw( sfml_get_404_error_url() ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
exit;
|
103 |
case 3:
|
104 |
wp_redirect( esc_url_raw( user_trailingslashit( home_url() ) ) );
|
105 |
exit;
|
106 |
+
case 4:
|
107 |
+
sfml_maybe_trigger_404_error();
|
108 |
+
// Fallback in case headers were already sent.
|
109 |
+
wp_redirect( esc_url_raw( sfml_get_404_error_url() ) );
|
110 |
+
exit;
|
111 |
default:
|
112 |
wp_die( __( 'No no no, the login form is not here.', 'sf-move-login' ), __( 'Nope :)', 'sf-move-login' ), array( 'response' => 403 ) );
|
113 |
}
|
159 |
|
160 |
$redirect = false;
|
161 |
/**
|
162 |
+
* Filters the redirection location.
|
163 |
+
* You can also trigger a custom action, like a `wp_die()` with a custom message.
|
164 |
*
|
165 |
* @since 2.5
|
166 |
*
|
172 |
return esc_url_raw( $redirect );
|
173 |
}
|
174 |
|
175 |
+
do_action_deprecated( 'sfml_wp_admin_error', array(), '2.5', 'sfml_login_redirect_location' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
|
177 |
$do = sfml_get_deny_admin_access();
|
178 |
|
179 |
switch ( $do ) {
|
180 |
case 1:
|
|
|
181 |
wp_die( __( 'Cheatin’ uh?', 'sf-move-login' ), __( 'Nope :)', 'sf-move-login' ), array( 'response' => 403 ) );
|
182 |
case 2:
|
183 |
+
return esc_url_raw( sfml_get_404_error_url() );
|
|
|
|
|
|
|
184 |
case 3:
|
185 |
return esc_url_raw( user_trailingslashit( home_url() ) );
|
186 |
+
case 4:
|
187 |
+
sfml_maybe_trigger_404_error();
|
188 |
+
// Fallback in case headers were already sent.
|
189 |
+
return esc_url_raw( sfml_get_404_error_url() );
|
190 |
+
default:
|
191 |
+
return $location;
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Trigger a 404 error if headers have not been sent yet.
|
198 |
+
* Be aware that if the headers have been sent, the request won't be killed: provide a fallback!
|
199 |
+
*
|
200 |
+
* @since 2.5.2
|
201 |
+
*/
|
202 |
+
function sfml_maybe_trigger_404_error() {
|
203 |
+
if ( headers_sent() ) {
|
204 |
+
return;
|
205 |
}
|
206 |
+
|
207 |
+
status_header( 404 );
|
208 |
+
|
209 |
+
$headers = wp_get_nocache_headers();
|
210 |
+
$headers['Content-Type'] = get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' );
|
211 |
+
|
212 |
+
foreach ( $headers as $name => $field_value ) {
|
213 |
+
@header( "{$name}: {$field_value}" );
|
214 |
+
}
|
215 |
+
|
216 |
+
exit;
|
217 |
+
}
|
218 |
+
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Get the URL of the "WordPress" 404 error page we'll redirect to.
|
222 |
+
*
|
223 |
+
* @since 2.5.2
|
224 |
+
*
|
225 |
+
* @return (string) A URL.
|
226 |
+
*/
|
227 |
+
function sfml_get_404_error_url() {
|
228 |
+
global $wp_rewrite;
|
229 |
+
|
230 |
+
if ( $wp_rewrite && $wp_rewrite->using_permalinks() ) {
|
231 |
+
$redirect = user_trailingslashit( home_url( '404' ) );
|
232 |
+
} else {
|
233 |
+
$redirect = add_query_arg( 'p', '404', user_trailingslashit( home_url() ) );
|
234 |
+
}
|
235 |
+
/**
|
236 |
+
* Filter the 404 page URL.
|
237 |
+
*
|
238 |
+
* @param (string) $redirect An URL that leads to a 404 response.
|
239 |
+
*/
|
240 |
+
return apply_filters( 'sfml_404_error_page', $redirect );
|
241 |
}
|
languages/sf-move-login-fr_FR.mo
CHANGED
Binary file
|
languages/sf-move-login-fr_FR.po
CHANGED
@@ -2,235 +2,186 @@
|
|
2 |
#
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Move Login
|
6 |
"Report-Msgid-Bugs-To: Grégory Viguier <i18n@screenfeed.fr>\n"
|
7 |
-
"POT-Creation-Date: 2017-05-
|
8 |
-
"PO-Revision-Date: 2017-05-
|
9 |
-
"Last-Translator:
|
10 |
-
"Language-Team:
|
11 |
"Language: fr_FR\n"
|
12 |
"MIME-Version: 1.0\n"
|
13 |
-
"Content-Type: text/plain; charset=
|
14 |
"Content-Transfer-Encoding: 8bit\n"
|
15 |
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
16 |
"X-Generator: Poedit 1.8.12\n"
|
17 |
"X-Poedit-Basepath: ..\n"
|
18 |
-
"X-Poedit-KeywordsList: _x:1,2c;
|
19 |
-
"esc_html_e;_n_noop:1,2\n"
|
20 |
"X-Poedit-SourceCharset: UTF-8\n"
|
21 |
"X-Textdomain-Support: yes\n"
|
|
|
22 |
"X-Poedit-SearchPath-0: .\n"
|
|
|
23 |
|
24 |
#. Translators: 1 is the plugin name.
|
25 |
-
#: inc/activate.php:
|
26 |
#, php-format
|
27 |
msgid "%s has not been activated."
|
28 |
msgstr "%s n’a pas été activé."
|
29 |
|
30 |
-
#: inc/activate.php:
|
31 |
msgid "Error"
|
32 |
msgstr "Erreur"
|
33 |
|
34 |
#. Translators: 1 is the plugin name.
|
35 |
-
#: inc/activate.php:
|
36 |
#, php-format
|
37 |
-
msgid ""
|
38 |
-
"
|
39 |
-
"won't work."
|
40 |
-
msgstr ""
|
41 |
-
"Il semble que votre configuration serveur empêche l’extension de "
|
42 |
-
"fonctionner correctement. %s ne pourra pas fonctionner."
|
43 |
|
44 |
#. Translators: 1 is the plugin name.
|
45 |
-
#: inc/activate.php:
|
46 |
#, php-format
|
47 |
-
msgid ""
|
48 |
-
"
|
49 |
-
"work."
|
50 |
-
msgstr ""
|
51 |
-
"Il semble que le module de réécriture d’url n’est pas activé sur "
|
52 |
-
"votre serveur. %s ne pourra pas fonctionner."
|
53 |
|
54 |
#. Translators: 1, 2, and 3 are server technologies (Apache, Nginx, IIS7), 4 is the plugin name.
|
55 |
-
#: inc/activate.php:
|
56 |
#, php-format
|
57 |
-
msgid ""
|
58 |
-
"
|
59 |
-
msgstr ""
|
60 |
-
"Il semble que votre serveur n’utilise ni %1$s, %2$s, ou %3$s. %4$s ne "
|
61 |
-
"pourra pas fonctionner."
|
62 |
|
63 |
#. Translators: 1 is the plugin name, 2 is a file name, 3 is a "Move Login" link.
|
64 |
-
#: inc/activate.php:
|
65 |
#, php-format
|
66 |
-
msgid ""
|
67 |
-
"%1$s
|
68 |
-
"copy/paste the given code into the %2$s file."
|
69 |
-
msgstr ""
|
70 |
-
"%1$s a besoin d’accéder au fichier %2$s. Veuillez vous rendre sur la "
|
71 |
-
"page de réglages de %3$s et veuillez copier/coller le code fourni dans le "
|
72 |
-
"fichier %2$s."
|
73 |
|
74 |
#. Translators: 1 is a server technology (Nginx), 2 is a "Move Login" link, 3 is the plugin name.
|
75 |
-
#: inc/activate.php:
|
76 |
#, php-format
|
77 |
-
msgid ""
|
78 |
-
"
|
79 |
-
"by yourself in the configuration file. Please visit the %2$s settings page "
|
80 |
-
"and take a look at the rewrite rules. %3$s is running but won't work "
|
81 |
-
"correctly until you deal with those rewrite rules."
|
82 |
-
msgstr ""
|
83 |
-
"Il semble que votre serveur utilise un système %1$s. Vous devez éditer les "
|
84 |
-
"règles de réécriture par vous-même dans le fichier de configuration. "
|
85 |
-
"Veuillez vous rendre sur la page de réglages de %2$s et jetez un œil aux "
|
86 |
-
"règles de réécriture. %3$s fonctionne mais ne pourra pas le faire "
|
87 |
-
"correctement tant que vous ne vous serez pas occupé de ces règles."
|
88 |
|
89 |
#: inc/admin.php:152 inc/functions/deprecated.php:87
|
90 |
-
#: inc/redirections-and-dies.php:
|
91 |
msgid "Cheatin’ uh?"
|
92 |
msgstr "Alors, on triche ?"
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
#. Translators: %s is an URL slug name.
|
95 |
-
#: inc/classes/class-sfml-options.php:
|
96 |
#, php-format
|
97 |
msgid "The slug %s is forbidden."
|
98 |
msgid_plural "The slugs %s are forbidden."
|
99 |
msgstr[0] "L’identifiant %s est interdit."
|
100 |
msgstr[1] "Les identifiants %s sont interdits."
|
101 |
|
102 |
-
#: inc/classes/class-sfml-options.php:
|
103 |
msgid "The links can't have the same slugs."
|
104 |
msgstr "Les liens ne peuvent pas avoir les mêmes identifiants."
|
105 |
|
106 |
-
|
107 |
-
#: inc/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
msgid "Nope :)"
|
109 |
msgstr "Raté :)"
|
110 |
|
111 |
-
#: inc/functions/settings-page.php:
|
112 |
msgid "Choose your new URLs"
|
113 |
msgstr "Choisissez vos nouvelles adresses"
|
114 |
|
115 |
-
#: inc/functions/settings-page.php:
|
116 |
msgid "Access"
|
117 |
msgstr "Accès"
|
118 |
|
119 |
-
#: inc/functions/settings-page.php:
|
120 |
msgid "Only lowercase letters, digits, - and _"
|
121 |
msgstr "Seulement des lettres minuscules, chiffres, - et _"
|
122 |
|
123 |
-
#: inc/functions/settings-page.php:
|
124 |
-
msgid "Display an error message"
|
125 |
-
msgstr "Afficher un message d'erreur"
|
126 |
-
|
127 |
-
#: inc/functions/settings-page.php:61 inc/functions/settings-page.php:82
|
128 |
-
msgid "Redirect to a «Page not found» error page"
|
129 |
-
msgstr ""
|
130 |
-
"Rediriger vers une page d’erreur « Page non trouvée "
|
131 |
-
"»"
|
132 |
-
|
133 |
-
#: inc/functions/settings-page.php:62 inc/functions/settings-page.php:83
|
134 |
-
msgid "Redirect to the home page"
|
135 |
-
msgstr "Rediriger vers la page d’accueil"
|
136 |
-
|
137 |
-
#: inc/functions/settings-page.php:64
|
138 |
msgid "When a logged out user attempts to access the old login page."
|
139 |
-
msgstr ""
|
140 |
-
"Quand un utilisateur non connecté tente d'accéder à l'ancienne page de "
|
141 |
-
"connexion."
|
142 |
|
143 |
-
#: inc/functions/settings-page.php:
|
144 |
msgctxt "noun"
|
145 |
msgid "Redirects"
|
146 |
msgstr "Redirections"
|
147 |
|
148 |
-
#: inc/functions/settings-page.php:
|
149 |
-
msgid "Do nothing, redirect to the new login page (not recommended)"
|
150 |
-
msgstr ""
|
151 |
-
"Ne rien faire, rediriger vers la nouvelle page de connexion (non recommandé)"
|
152 |
-
|
153 |
-
#: inc/functions/settings-page.php:85
|
154 |
msgid "Instead of redirecting a logged out user to the new login page:"
|
155 |
-
msgstr ""
|
156 |
-
"Plutôt que de rediriger un utilisateur non connecté vers la nouvelle page de "
|
157 |
-
"connexion :"
|
158 |
|
159 |
#. Translators: %s is an option value.
|
160 |
-
#: inc/functions/settings-page.php:
|
161 |
#, php-format
|
162 |
msgctxt "default value"
|
163 |
msgid "(default: %s)"
|
164 |
msgstr "(défaut : %s)"
|
165 |
|
166 |
#. Translators: 1 is a file name, 2 is a file path, 3 and 4 are small parts of code.
|
167 |
-
#: inc/functions/settings-page.php:
|
168 |
#, php-format
|
169 |
-
msgid ""
|
170 |
-
"
|
171 |
-
"following to your %1$s file in %2$s, replacing other %3$s rules if they "
|
172 |
-
"exist, <strong>above</strong> the line reading %4$s:"
|
173 |
-
msgstr ""
|
174 |
-
"Si l’extension ne peut ajouter les nouvelles règles de réécriture à "
|
175 |
-
"votre fichier %1$s, ajoutez les lignes suivantes à votre fichier %1$s dans "
|
176 |
-
"%2$s, en remplacement des autres règles liées à %3$s si elles existent, "
|
177 |
-
"<strong>au-dessus</strong> de la ligne %4$s :"
|
178 |
|
179 |
#. Translators: 1 is a file name, 2 is a small part of code.
|
180 |
-
#: inc/functions/settings-page.php:
|
181 |
#, php-format
|
182 |
-
msgid ""
|
183 |
-
"
|
184 |
-
"will need to add them manually inside the %2$s block."
|
185 |
-
msgstr ""
|
186 |
-
"L’extension ne peut ajouter les nouvelles règles de réécriture à votre "
|
187 |
-
"fichier %1$s, vous devrez les ajouter manuellement à l’intérieur du "
|
188 |
-
"bloc %2$s."
|
189 |
|
190 |
#. Translators: %s is a file name.
|
191 |
-
#: inc/functions/settings-page.php:
|
192 |
#, php-format
|
193 |
msgid "Your %s file is not writable."
|
194 |
msgstr "Votre fichier %s n’est pas inscriptible."
|
195 |
|
196 |
#. Translators: 1 is a constant name, 2 is a constant value.
|
197 |
-
#: inc/functions/settings-page.php:
|
198 |
#, php-format
|
199 |
-
msgid ""
|
200 |
-
"
|
201 |
-
msgstr ""
|
202 |
-
"La constante %1$s est définie à %2$s, les réglages ci-dessous ne prendront "
|
203 |
-
"pas effet."
|
204 |
|
205 |
-
#: inc/redirections-and-dies.php:
|
206 |
msgid "No no no, the login form is not here."
|
207 |
msgstr "Non non non, le formulaire de connexion ne se trouve pas ici."
|
208 |
|
209 |
#. Translators: Description of the plugin/theme
|
210 |
-
|
|
|
211 |
msgid "Change your login URL."
|
212 |
msgstr "Changez l’url de votre page de connexion."
|
213 |
-
|
214 |
-
#~ msgid "Administration area"
|
215 |
-
#~ msgstr "Zone d'administration"
|
216 |
-
|
217 |
-
#~ msgid ""
|
218 |
-
#~ "When a not connected user attempts to access the administration area."
|
219 |
-
#~ msgstr ""
|
220 |
-
#~ "Lorsqu’un utilisateur non connecté tente d’accéder à la zone "
|
221 |
-
#~ "d’administration."
|
222 |
-
|
223 |
-
#~ msgid ""
|
224 |
-
#~ "It seems your server does not use <i>Apache</i>, <i>Nginx</i>, nor "
|
225 |
-
#~ "<i>IIS7</i>. <strong>Move Login</strong> won't work."
|
226 |
-
#~ msgstr ""
|
227 |
-
#~ "Il semble que votre serveur n’utilise ni <i>Apache</i>, <i>Nginx</"
|
228 |
-
#~ "i>, ou <i>IIS7</i>. <strong>Move Login</strong> ne pourra pas fonctionner."
|
229 |
-
|
230 |
-
#~ msgid ""
|
231 |
-
#~ "Change your login URL for something like <code>http://example.com/login</"
|
232 |
-
#~ "code> and stop login brute force attempts."
|
233 |
-
#~ msgstr ""
|
234 |
-
#~ "Changez l’url de votre page de connexion pour quelque chose comme "
|
235 |
-
#~ "<code>http://example.com/login</code> et stoppez les tentatives de "
|
236 |
-
#~ "connexion par brute force."
|
2 |
#
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: SF Move Login\n"
|
6 |
"Report-Msgid-Bugs-To: Grégory Viguier <i18n@screenfeed.fr>\n"
|
7 |
+
"POT-Creation-Date: 2017-05-25 15:27+0200\n"
|
8 |
+
"PO-Revision-Date: 2017-05-25 16:09+0200\n"
|
9 |
+
"Last-Translator: Grégory Viguier <i18n@screenfeed.fr>\n"
|
10 |
+
"Language-Team: Grégory Viguier <i18n@screenfeed.fr>\n"
|
11 |
"Language: fr_FR\n"
|
12 |
"MIME-Version: 1.0\n"
|
13 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
14 |
"Content-Transfer-Encoding: 8bit\n"
|
15 |
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
16 |
"X-Generator: Poedit 1.8.12\n"
|
17 |
"X-Poedit-Basepath: ..\n"
|
18 |
+
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
|
|
19 |
"X-Poedit-SourceCharset: UTF-8\n"
|
20 |
"X-Textdomain-Support: yes\n"
|
21 |
+
"X-Poedit-WPHeader: sf-move-login.php\n"
|
22 |
"X-Poedit-SearchPath-0: .\n"
|
23 |
+
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
24 |
|
25 |
#. Translators: 1 is the plugin name.
|
26 |
+
#: inc/activate.php:50
|
27 |
#, php-format
|
28 |
msgid "%s has not been activated."
|
29 |
msgstr "%s n’a pas été activé."
|
30 |
|
31 |
+
#: inc/activate.php:52
|
32 |
msgid "Error"
|
33 |
msgstr "Erreur"
|
34 |
|
35 |
#. Translators: 1 is the plugin name.
|
36 |
+
#: inc/activate.php:115
|
37 |
#, php-format
|
38 |
+
msgid "It seems your server configuration prevents the plugin to work properly. %s won't work."
|
39 |
+
msgstr "Il semble que votre configuration serveur empêche l’extension de fonctionner correctement. %s ne pourra pas fonctionner."
|
|
|
|
|
|
|
|
|
40 |
|
41 |
#. Translators: 1 is the plugin name.
|
42 |
+
#: inc/activate.php:117
|
43 |
#, php-format
|
44 |
+
msgid "It seems the url rewrite module is not activated on your server. %s won't work."
|
45 |
+
msgstr "Il semble que le module de réécriture d’url n’est pas activé sur votre serveur. %s ne pourra pas fonctionner."
|
|
|
|
|
|
|
|
|
46 |
|
47 |
#. Translators: 1, 2, and 3 are server technologies (Apache, Nginx, IIS7), 4 is the plugin name.
|
48 |
+
#: inc/activate.php:119
|
49 |
#, php-format
|
50 |
+
msgid "It seems your server does not use %1$s, %2$s, nor %3$s. %4$s won't work."
|
51 |
+
msgstr "Il semble que votre serveur n’utilise ni %1$s, %2$s, ou %3$s. %4$s ne pourra pas fonctionner."
|
|
|
|
|
|
|
52 |
|
53 |
#. Translators: 1 is the plugin name, 2 is a file name, 3 is a "Move Login" link.
|
54 |
+
#: inc/activate.php:121
|
55 |
#, php-format
|
56 |
+
msgid "%1$s needs access to the %2$s file. Please visit the %3$s settings page and copy/paste the given code into the %2$s file."
|
57 |
+
msgstr "%1$s a besoin d’accéder au fichier %2$s. Veuillez vous rendre sur la page de réglages de %3$s et veuillez copier/coller le code fourni dans le fichier %2$s."
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
#. Translators: 1 is a server technology (Nginx), 2 is a "Move Login" link, 3 is the plugin name.
|
60 |
+
#: inc/activate.php:123
|
61 |
#, php-format
|
62 |
+
msgid "It seems your server uses a %1$ system. You have to edit the rewrite rules by yourself in the configuration file. Please visit the %2$s settings page and take a look at the rewrite rules. %3$s is running but won't work correctly until you deal with those rewrite rules."
|
63 |
+
msgstr "Il semble que votre serveur utilise un système %1$s. Vous devez éditer les règles de réécriture par vous-même dans le fichier de configuration. Veuillez vous rendre sur la page de réglages de %2$s et jetez un œil aux règles de réécriture. %3$s fonctionne mais ne pourra pas le faire correctement tant que vous ne vous serez pas occupé de ces règles."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
#: inc/admin.php:152 inc/functions/deprecated.php:87
|
66 |
+
#: inc/redirections-and-dies.php:181
|
67 |
msgid "Cheatin’ uh?"
|
68 |
msgstr "Alors, on triche ?"
|
69 |
|
70 |
+
#: inc/classes/class-sfml-options.php:312
|
71 |
+
#: inc/classes/class-sfml-options.php:319
|
72 |
+
msgid "Display an error message"
|
73 |
+
msgstr "Afficher un message d'erreur"
|
74 |
+
|
75 |
+
#: inc/classes/class-sfml-options.php:313
|
76 |
+
#: inc/classes/class-sfml-options.php:320
|
77 |
+
msgid "Trigger a «Page not found» error"
|
78 |
+
msgstr "Déclencher une erreur « Page non trouvée »"
|
79 |
+
|
80 |
+
#: inc/classes/class-sfml-options.php:314
|
81 |
+
#: inc/classes/class-sfml-options.php:321
|
82 |
+
msgid "Redirect to a \"WordPress\" «Page not found» error page"
|
83 |
+
msgstr "Rediriger vers une page d’erreur « Page non trouvée » de WordPress"
|
84 |
+
|
85 |
+
#: inc/classes/class-sfml-options.php:315
|
86 |
+
#: inc/classes/class-sfml-options.php:322
|
87 |
+
msgid "Redirect to the home page"
|
88 |
+
msgstr "Rediriger vers la page d’accueil"
|
89 |
+
|
90 |
+
#: inc/classes/class-sfml-options.php:318
|
91 |
+
msgid "Do nothing, redirect to the new login page (not recommended)"
|
92 |
+
msgstr "Ne rien faire, rediriger vers la nouvelle page de connexion (non recommandé)"
|
93 |
+
|
94 |
#. Translators: %s is an URL slug name.
|
95 |
+
#: inc/classes/class-sfml-options.php:497
|
96 |
#, php-format
|
97 |
msgid "The slug %s is forbidden."
|
98 |
msgid_plural "The slugs %s are forbidden."
|
99 |
msgstr[0] "L’identifiant %s est interdit."
|
100 |
msgstr[1] "Les identifiants %s sont interdits."
|
101 |
|
102 |
+
#: inc/classes/class-sfml-options.php:500
|
103 |
msgid "The links can't have the same slugs."
|
104 |
msgstr "Les liens ne peuvent pas avoir les mêmes identifiants."
|
105 |
|
106 |
+
#. Translators: 1: WordPress hook name, 2: version number, 3: alternative hook name.
|
107 |
+
#: inc/functions/compat.php:285
|
108 |
+
#, php-format
|
109 |
+
msgid "%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead."
|
110 |
+
msgstr "%1$s est <strong>déprécié</strong> depuis la version %2$s ! Utilisez %3$s à la place."
|
111 |
+
|
112 |
+
#. Translators: 1: WordPress hook name, 2: version number.
|
113 |
+
#: inc/functions/compat.php:288
|
114 |
+
#, php-format
|
115 |
+
msgid "%1$s is <strong>deprecated</strong> since version %2$s with no alternative available."
|
116 |
+
msgstr "%1$s est <strong>déprécié</strong> depuis la version %2$s, aucune alternative n’est disponible."
|
117 |
+
|
118 |
+
#: inc/functions/deprecated.php:87 inc/redirections-and-dies.php:112
|
119 |
+
#: inc/redirections-and-dies.php:181
|
120 |
msgid "Nope :)"
|
121 |
msgstr "Raté :)"
|
122 |
|
123 |
+
#: inc/functions/settings-page.php:20
|
124 |
msgid "Choose your new URLs"
|
125 |
msgstr "Choisissez vos nouvelles adresses"
|
126 |
|
127 |
+
#: inc/functions/settings-page.php:21
|
128 |
msgid "Access"
|
129 |
msgstr "Accès"
|
130 |
|
131 |
+
#: inc/functions/settings-page.php:43
|
132 |
msgid "Only lowercase letters, digits, - and _"
|
133 |
msgstr "Seulement des lettres minuscules, chiffres, - et _"
|
134 |
|
135 |
+
#: inc/functions/settings-page.php:61
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
msgid "When a logged out user attempts to access the old login page."
|
137 |
+
msgstr "Quand un utilisateur non connecté tente d'accéder à l'ancienne page de connexion."
|
|
|
|
|
138 |
|
139 |
+
#: inc/functions/settings-page.php:68
|
140 |
msgctxt "noun"
|
141 |
msgid "Redirects"
|
142 |
msgstr "Redirections"
|
143 |
|
144 |
+
#: inc/functions/settings-page.php:77
|
|
|
|
|
|
|
|
|
|
|
145 |
msgid "Instead of redirecting a logged out user to the new login page:"
|
146 |
+
msgstr "Plutôt que de rediriger un utilisateur non connecté vers la nouvelle page de connexion :"
|
|
|
|
|
147 |
|
148 |
#. Translators: %s is an option value.
|
149 |
+
#: inc/functions/settings-page.php:159 inc/functions/settings-page.php:202
|
150 |
#, php-format
|
151 |
msgctxt "default value"
|
152 |
msgid "(default: %s)"
|
153 |
msgstr "(défaut : %s)"
|
154 |
|
155 |
#. Translators: 1 is a file name, 2 is a file path, 3 and 4 are small parts of code.
|
156 |
+
#: inc/functions/settings-page.php:229 inc/functions/settings-page.php:261
|
157 |
#, php-format
|
158 |
+
msgid "If the plugin fails to add the new rewrite rules to your %1$s file, add the following to your %1$s file in %2$s, replacing other %3$s rules if they exist, <strong>above</strong> the line reading %4$s:"
|
159 |
+
msgstr "Si l’extension ne peut ajouter les nouvelles règles de réécriture à votre fichier %1$s, ajoutez les lignes suivantes à votre fichier %1$s dans %2$s, en remplacement des autres règles liées à %3$s si elles existent, <strong>au-dessus</strong> de la ligne %4$s :"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
#. Translators: 1 is a file name, 2 is a small part of code.
|
162 |
+
#: inc/functions/settings-page.php:244
|
163 |
#, php-format
|
164 |
+
msgid "The plugin can't add the new rewrite rules to your %1$s file by itself, you will need to add them manually inside the %2$s block."
|
165 |
+
msgstr "L’extension ne peut ajouter les nouvelles règles de réécriture à votre fichier %1$s, vous devrez les ajouter manuellement à l’intérieur du bloc %2$s."
|
|
|
|
|
|
|
|
|
|
|
166 |
|
167 |
#. Translators: %s is a file name.
|
168 |
+
#: inc/functions/settings-page.php:277
|
169 |
#, php-format
|
170 |
msgid "Your %s file is not writable."
|
171 |
msgstr "Votre fichier %s n’est pas inscriptible."
|
172 |
|
173 |
#. Translators: 1 is a constant name, 2 is a constant value.
|
174 |
+
#: inc/functions/settings-page.php:285
|
175 |
#, php-format
|
176 |
+
msgid "The constant %1$s is defined to %2$s, the settings below won't take effect."
|
177 |
+
msgstr "La constante %1$s est définie à %2$s, les réglages ci-dessous ne prendront pas effet."
|
|
|
|
|
|
|
178 |
|
179 |
+
#: inc/redirections-and-dies.php:112
|
180 |
msgid "No no no, the login form is not here."
|
181 |
msgstr "Non non non, le formulaire de connexion ne se trouve pas ici."
|
182 |
|
183 |
#. Translators: Description of the plugin/theme
|
184 |
+
#. Description of the plugin/theme
|
185 |
+
#: sf-move-login.php:93
|
186 |
msgid "Change your login URL."
|
187 |
msgstr "Changez l’url de votre page de connexion."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages/sf-move-login.pot
ADDED
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#, fuzzy
|
2 |
+
msgid ""
|
3 |
+
msgstr ""
|
4 |
+
"Project-Id-Version: SF Move Login\n"
|
5 |
+
"POT-Creation-Date: 2017-05-25 15:27+0200\n"
|
6 |
+
"PO-Revision-Date: 2017-05-25 15:27+0200\n"
|
7 |
+
"Last-Translator: Grégory Viguier <i18n@screenfeed.fr>\n"
|
8 |
+
"Language-Team: Grégory Viguier <i18n@screenfeed.fr>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
13 |
+
"X-Generator: Poedit 1.8.12\n"
|
14 |
+
"X-Poedit-Basepath: ..\n"
|
15 |
+
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
16 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
+
"X-Poedit-WPHeader: sf-move-login.php\n"
|
18 |
+
"X-Poedit-SearchPath-0: .\n"
|
19 |
+
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
20 |
+
|
21 |
+
#. Translators: 1 is the plugin name.
|
22 |
+
#: inc/activate.php:50
|
23 |
+
#, php-format
|
24 |
+
msgid "%s has not been activated."
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: inc/activate.php:52
|
28 |
+
msgid "Error"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#. Translators: 1 is the plugin name.
|
32 |
+
#: inc/activate.php:115
|
33 |
+
#, php-format
|
34 |
+
msgid "It seems your server configuration prevents the plugin to work properly. %s won't work."
|
35 |
+
msgstr ""
|
36 |
+
|
37 |
+
#. Translators: 1 is the plugin name.
|
38 |
+
#: inc/activate.php:117
|
39 |
+
#, php-format
|
40 |
+
msgid "It seems the url rewrite module is not activated on your server. %s won't work."
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#. Translators: 1, 2, and 3 are server technologies (Apache, Nginx, IIS7), 4 is the plugin name.
|
44 |
+
#: inc/activate.php:119
|
45 |
+
#, php-format
|
46 |
+
msgid "It seems your server does not use %1$s, %2$s, nor %3$s. %4$s won't work."
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#. Translators: 1 is the plugin name, 2 is a file name, 3 is a "Move Login" link.
|
50 |
+
#: inc/activate.php:121
|
51 |
+
#, php-format
|
52 |
+
msgid "%1$s needs access to the %2$s file. Please visit the %3$s settings page and copy/paste the given code into the %2$s file."
|
53 |
+
msgstr ""
|
54 |
+
|
55 |
+
#. Translators: 1 is a server technology (Nginx), 2 is a "Move Login" link, 3 is the plugin name.
|
56 |
+
#: inc/activate.php:123
|
57 |
+
#, php-format
|
58 |
+
msgid "It seems your server uses a %1$ system. You have to edit the rewrite rules by yourself in the configuration file. Please visit the %2$s settings page and take a look at the rewrite rules. %3$s is running but won't work correctly until you deal with those rewrite rules."
|
59 |
+
msgstr ""
|
60 |
+
|
61 |
+
#: inc/admin.php:152 inc/functions/deprecated.php:87
|
62 |
+
#: inc/redirections-and-dies.php:181
|
63 |
+
msgid "Cheatin’ uh?"
|
64 |
+
msgstr ""
|
65 |
+
|
66 |
+
#: inc/classes/class-sfml-options.php:312
|
67 |
+
#: inc/classes/class-sfml-options.php:319
|
68 |
+
msgid "Display an error message"
|
69 |
+
msgstr ""
|
70 |
+
|
71 |
+
#: inc/classes/class-sfml-options.php:313
|
72 |
+
#: inc/classes/class-sfml-options.php:320
|
73 |
+
msgid "Trigger a «Page not found» error"
|
74 |
+
msgstr ""
|
75 |
+
|
76 |
+
#: inc/classes/class-sfml-options.php:314
|
77 |
+
#: inc/classes/class-sfml-options.php:321
|
78 |
+
msgid "Redirect to a \"WordPress\" «Page not found» error page"
|
79 |
+
msgstr ""
|
80 |
+
|
81 |
+
#: inc/classes/class-sfml-options.php:315
|
82 |
+
#: inc/classes/class-sfml-options.php:322
|
83 |
+
msgid "Redirect to the home page"
|
84 |
+
msgstr ""
|
85 |
+
|
86 |
+
#: inc/classes/class-sfml-options.php:318
|
87 |
+
msgid "Do nothing, redirect to the new login page (not recommended)"
|
88 |
+
msgstr ""
|
89 |
+
|
90 |
+
#. Translators: %s is an URL slug name.
|
91 |
+
#: inc/classes/class-sfml-options.php:497
|
92 |
+
#, php-format
|
93 |
+
msgid "The slug %s is forbidden."
|
94 |
+
msgid_plural "The slugs %s are forbidden."
|
95 |
+
msgstr[0] ""
|
96 |
+
msgstr[1] ""
|
97 |
+
|
98 |
+
#: inc/classes/class-sfml-options.php:500
|
99 |
+
msgid "The links can't have the same slugs."
|
100 |
+
msgstr ""
|
101 |
+
|
102 |
+
#. Translators: 1: WordPress hook name, 2: version number, 3: alternative hook name.
|
103 |
+
#: inc/functions/compat.php:285
|
104 |
+
#, php-format
|
105 |
+
msgid "%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead."
|
106 |
+
msgstr ""
|
107 |
+
|
108 |
+
#. Translators: 1: WordPress hook name, 2: version number.
|
109 |
+
#: inc/functions/compat.php:288
|
110 |
+
#, php-format
|
111 |
+
msgid "%1$s is <strong>deprecated</strong> since version %2$s with no alternative available."
|
112 |
+
msgstr ""
|
113 |
+
|
114 |
+
#: inc/functions/deprecated.php:87 inc/redirections-and-dies.php:112
|
115 |
+
#: inc/redirections-and-dies.php:181
|
116 |
+
msgid "Nope :)"
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#: inc/functions/settings-page.php:20
|
120 |
+
msgid "Choose your new URLs"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#: inc/functions/settings-page.php:21
|
124 |
+
msgid "Access"
|
125 |
+
msgstr ""
|
126 |
+
|
127 |
+
#: inc/functions/settings-page.php:43
|
128 |
+
msgid "Only lowercase letters, digits, - and _"
|
129 |
+
msgstr ""
|
130 |
+
|
131 |
+
#: inc/functions/settings-page.php:61
|
132 |
+
msgid "When a logged out user attempts to access the old login page."
|
133 |
+
msgstr ""
|
134 |
+
|
135 |
+
#: inc/functions/settings-page.php:68
|
136 |
+
msgctxt "noun"
|
137 |
+
msgid "Redirects"
|
138 |
+
msgstr ""
|
139 |
+
|
140 |
+
#: inc/functions/settings-page.php:77
|
141 |
+
msgid "Instead of redirecting a logged out user to the new login page:"
|
142 |
+
msgstr ""
|
143 |
+
|
144 |
+
#. Translators: %s is an option value.
|
145 |
+
#: inc/functions/settings-page.php:159 inc/functions/settings-page.php:202
|
146 |
+
#, php-format
|
147 |
+
msgctxt "default value"
|
148 |
+
msgid "(default: %s)"
|
149 |
+
msgstr ""
|
150 |
+
|
151 |
+
#. Translators: 1 is a file name, 2 is a file path, 3 and 4 are small parts of code.
|
152 |
+
#: inc/functions/settings-page.php:229 inc/functions/settings-page.php:261
|
153 |
+
#, php-format
|
154 |
+
msgid "If the plugin fails to add the new rewrite rules to your %1$s file, add the following to your %1$s file in %2$s, replacing other %3$s rules if they exist, <strong>above</strong> the line reading %4$s:"
|
155 |
+
msgstr ""
|
156 |
+
|
157 |
+
#. Translators: 1 is a file name, 2 is a small part of code.
|
158 |
+
#: inc/functions/settings-page.php:244
|
159 |
+
#, php-format
|
160 |
+
msgid "The plugin can't add the new rewrite rules to your %1$s file by itself, you will need to add them manually inside the %2$s block."
|
161 |
+
msgstr ""
|
162 |
+
|
163 |
+
#. Translators: %s is a file name.
|
164 |
+
#: inc/functions/settings-page.php:277
|
165 |
+
#, php-format
|
166 |
+
msgid "Your %s file is not writable."
|
167 |
+
msgstr ""
|
168 |
+
|
169 |
+
#. Translators: 1 is a constant name, 2 is a constant value.
|
170 |
+
#: inc/functions/settings-page.php:285
|
171 |
+
#, php-format
|
172 |
+
msgid "The constant %1$s is defined to %2$s, the settings below won't take effect."
|
173 |
+
msgstr ""
|
174 |
+
|
175 |
+
#: inc/redirections-and-dies.php:112
|
176 |
+
msgid "No no no, the login form is not here."
|
177 |
+
msgstr ""
|
178 |
+
|
179 |
+
#. Translators: Description of the plugin/theme
|
180 |
+
#. Description of the plugin/theme
|
181 |
+
#: sf-move-login.php:93
|
182 |
+
msgid "Change your login URL."
|
183 |
+
msgstr ""
|
readme.txt
CHANGED
@@ -67,6 +67,13 @@ Eventually, try the [WordPress support forum](https://wordpress.org/support/plug
|
|
67 |
|
68 |
== Changelog ==
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
= 2.5.1 =
|
71 |
|
72 |
* 2017/05/14
|
@@ -75,7 +82,8 @@ Eventually, try the [WordPress support forum](https://wordpress.org/support/plug
|
|
75 |
= 2.5 =
|
76 |
|
77 |
* 2017/05/09
|
78 |
-
*
|
|
|
79 |
|
80 |
= 2.4.3 =
|
81 |
|
67 |
|
68 |
== Changelog ==
|
69 |
|
70 |
+
= 2.5.2 =
|
71 |
+
|
72 |
+
* 2017/05/25
|
73 |
+
* New: a new option is available. Instead of redirecting to the a "WordPress" 404 error page, you can choose to directly trigger the 404 error. Pro: the user is not directed, the URL doesn't change. Con: the user sees the browser error page, it probably is ugly (but do we really care?).
|
74 |
+
* Fixed the blank page that was displaying instead of redirecting the user to the new login URL.
|
75 |
+
* Dev stuff: in case the plugin has trouble determining your server technology, take a look at `sfml_is_apache()`, `sfml_is_iis7()`, and `sfml_is_nginx()`: returned values can be filtered with a MU plugin.
|
76 |
+
|
77 |
= 2.5.1 =
|
78 |
|
79 |
* 2017/05/14
|
82 |
= 2.5 =
|
83 |
|
84 |
* 2017/05/09
|
85 |
+
* New: some files from WordPress core were still able to redirect a logged out user to the new login URL. Now Move Login filters every redirection to prevent it.
|
86 |
+
* Dev stuff: the hook `sfml_wp_admin_error` is now deprecated. Please use the filter `sfml_login_redirect_location` instead.
|
87 |
|
88 |
= 2.4.3 =
|
89 |
|
sf-move-login.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: SF Move Login
|
4 |
* Plugin URI: https://www.screenfeed.fr/plugin-wp/move-login/
|
5 |
* Description: Change your login URL.
|
6 |
-
* Version: 2.5.
|
7 |
* Author: Grégory Viguier
|
8 |
* Author URI: https://www.screenfeed.fr/
|
9 |
* License: GPLv3
|
@@ -25,7 +25,7 @@ if ( empty( $GLOBALS['wp_version'] ) || version_compare( $GLOBALS['wp_version'],
|
|
25 |
/* !CONSTANTS =================================================================================== */
|
26 |
/*------------------------------------------------------------------------------------------------*/
|
27 |
|
28 |
-
define( 'SFML_VERSION', '2.5.
|
29 |
define( 'SFML_FILE', __FILE__ );
|
30 |
define( 'SFML_PLUGIN_BASENAME', plugin_basename( SFML_FILE ) );
|
31 |
define( 'SFML_PLUGIN_DIR', plugin_dir_path( SFML_FILE ) );
|
@@ -50,6 +50,8 @@ add_action( 'plugins_loaded', 'sfml_init', 20 );
|
|
50 |
* Plugin init: include files.
|
51 |
*/
|
52 |
function sfml_init() {
|
|
|
|
|
53 |
SFML_Options::get_instance();
|
54 |
|
55 |
// Administration.
|
@@ -72,7 +74,6 @@ function sfml_init() {
|
|
72 |
/* !I18N SUPPORT ================================================================================ */
|
73 |
/*------------------------------------------------------------------------------------------------*/
|
74 |
|
75 |
-
add_action( 'init', 'sfml_lang_init' );
|
76 |
/**
|
77 |
* Load translations.
|
78 |
*/
|
3 |
* Plugin Name: SF Move Login
|
4 |
* Plugin URI: https://www.screenfeed.fr/plugin-wp/move-login/
|
5 |
* Description: Change your login URL.
|
6 |
+
* Version: 2.5.2
|
7 |
* Author: Grégory Viguier
|
8 |
* Author URI: https://www.screenfeed.fr/
|
9 |
* License: GPLv3
|
25 |
/* !CONSTANTS =================================================================================== */
|
26 |
/*------------------------------------------------------------------------------------------------*/
|
27 |
|
28 |
+
define( 'SFML_VERSION', '2.5.2' );
|
29 |
define( 'SFML_FILE', __FILE__ );
|
30 |
define( 'SFML_PLUGIN_BASENAME', plugin_basename( SFML_FILE ) );
|
31 |
define( 'SFML_PLUGIN_DIR', plugin_dir_path( SFML_FILE ) );
|
50 |
* Plugin init: include files.
|
51 |
*/
|
52 |
function sfml_init() {
|
53 |
+
sfml_lang_init();
|
54 |
+
|
55 |
SFML_Options::get_instance();
|
56 |
|
57 |
// Administration.
|
74 |
/* !I18N SUPPORT ================================================================================ */
|
75 |
/*------------------------------------------------------------------------------------------------*/
|
76 |
|
|
|
77 |
/**
|
78 |
* Load translations.
|
79 |
*/
|