Move Login - Version 2.0.2

Version Description

  • 2015/02/24
  • Same as below... Fingers crossed. >_>
Download this release

Release Info

Developer GregLone
Plugin Icon 128x128 Move Login
Version 2.0.2
Comparing to
See all releases

Version 2.0.2

inc/activate.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( 'Cheatin\' uh?' );
4
+ }
5
+
6
+
7
+ /* !---------------------------------------------------------------------------- */
8
+ /* ! ACTIVATION */
9
+ /* ----------------------------------------------------------------------------- */
10
+
11
+ // Trigger wp_die() on plugin activation if the server configuration does not fit. Or, set a transient for admin notices.
12
+
13
+ function sfml_activate() {
14
+ global $is_apache, $is_iis7;
15
+
16
+ if ( ! function_exists( 'sfml_write_rules' ) ) {
17
+ include( SFML_PLUGIN_DIR . 'inc/rewrite.php' );
18
+ }
19
+
20
+ $is_nginx = sfml_is_nginx();
21
+ $dies = array();
22
+
23
+ // The plugin needs the request uri
24
+ if ( empty( $GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI'] ) && empty( $_SERVER['REQUEST_URI'] ) ) {
25
+ $dies[] = 'error_no_request_uri';
26
+ }
27
+ // IIS7
28
+ if ( $is_iis7 && ! iis7_supports_permalinks() ) {
29
+ $dies[] = 'error_no_mod_rewrite';
30
+ }
31
+ // Apache
32
+ elseif ( $is_apache && ! got_mod_rewrite() ) {
33
+ $dies[] = 'error_no_mod_rewrite';
34
+ }
35
+ // None
36
+ elseif ( ! $is_iis7 && ! $is_apache && ! $is_nginx ) {
37
+ $dies[] = 'error_unknown_server_conf';
38
+ }
39
+
40
+ // die()s: don't activate the plugin.
41
+ if ( ! empty( $dies ) ) {
42
+
43
+ // i18n early loading.
44
+ sfml_lang_init();
45
+
46
+ $dies = array_filter( array_map( 'sfml_notice_message', $dies ) );
47
+ $dies = __( '<strong>Move Login</strong> has not been activated.', 'sf-move-login' ) . '<br/>' . implode( '<br/>', $dies );
48
+
49
+ wp_die( $dies, __( 'Error' ), array( 'back_link' => true ) );
50
+
51
+ }
52
+
53
+ // Perhaps we'll need to display some notices. Add the rewrite rules to the .htaccess/web.config file.
54
+ set_transient( 'sfml_notices-' . get_current_user_id(), '1' ); // 1 means "Update the file".
55
+ }
56
+
57
+ register_activation_hook( SFML_FILE, 'sfml_activate' );
58
+
59
+
60
+ /* !---------------------------------------------------------------------------- */
61
+ /* ! DEACTIVATION */
62
+ /* ----------------------------------------------------------------------------- */
63
+
64
+ // !Remove rewrite rules from the .htaccess/web.config file.
65
+
66
+ function sfml_deactivate() {
67
+ global $is_apache, $is_iis7;
68
+
69
+ if ( ! function_exists( 'sfml_write_rules' ) ) {
70
+ include( SFML_PLUGIN_DIR . 'inc/rewrite.php' );
71
+ }
72
+
73
+ // IIS
74
+ if ( $is_iis7 ) {
75
+ sfml_insert_iis7_rewrite_rules( 'SF Move Login' ); // Empty content
76
+ }
77
+ // Apache
78
+ elseif ( $is_apache ) {
79
+ sfml_insert_apache_rewrite_rules( 'SF Move Login' ); // Empty content
80
+ }
81
+ }
82
+
83
+ register_deactivation_hook( SFML_FILE, 'sfml_deactivate' );
84
+
85
+
86
+ /* !---------------------------------------------------------------------------- */
87
+ /* ! UTILITIES */
88
+ /* ----------------------------------------------------------------------------- */
89
+
90
+ // !Messages used for notices and die()s
91
+
92
+ function sfml_notice_message( $k ) {
93
+ static $messages;
94
+ global $is_iis7;
95
+
96
+ if ( is_null( $messages ) ) {
97
+ $file = $is_iis7 ? '<code>web.config</code>' : '<code>.htaccess</code>';
98
+ $link = '<a href="' . ( is_multisite() ? network_admin_url( 'settings.php?page=move-login' ) : admin_url( 'options-general.php?page=move-login' ) ) . '">Move Login</a>';
99
+
100
+ $messages = array(
101
+ 'error_no_request_uri' => __( 'It seems your server configuration prevent the plugin to work properly. <strong>Move Login</strong> won\'t work.', 'sf-move-login' ),
102
+ 'error_no_mod_rewrite' => __( 'It seems the url rewrite module is not activated on your server. <strong>Move Login</strong> won\'t work.', 'sf-move-login' ),
103
+ 'error_unknown_server_conf' => __( 'It seems your server does not use <i>Apache</i>, <i>Nginx</i>, nor <i>IIS7</i>. <strong>Move Login</strong> won\'t work.', 'sf-move-login' ),
104
+ 'error_file_not_writable' => sprintf( __( '<strong>Move Login</strong> needs access to the %1$s file. Please visit the %2$s settings page and copy/paste the given code into the %1$s file.', 'sf-move-login' ), $file, $link ),
105
+ 'updated_is_nginx' => sprintf( __( 'It seems your server uses a <i>Nginx</i> system. You have to edit the rewrite rules by yourself in the configuration file. Please visit the %s settings page and take a look at the rewrite rules. <strong>Move Login</strong> is running but won\'t work correctly until you deal with those rewrite rules.', 'sf-move-login' ), $link ),
106
+ );
107
+ }
108
+
109
+ return isset( $messages[ $k ] ) ? $messages[ $k ] : '';
110
+ }
111
+
112
+ /**/
inc/admin.php ADDED
@@ -0,0 +1,374 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( 'Cheatin\' uh?' );
4
+ }
5
+
6
+
7
+ /* !---------------------------------------------------------------------------- */
8
+ /* ! UTILITIES */
9
+ /* ----------------------------------------------------------------------------- */
10
+
11
+ if ( ! function_exists( 'get_main_blog_id' ) ) :
12
+ function get_main_blog_id() {
13
+ static $blog_id;
14
+
15
+ if ( ! $blog_id ) {
16
+ $blog_id = 1;
17
+
18
+ if ( ! is_multisite() ) {
19
+ // 1
20
+ }
21
+ elseif ( ! empty( $GLOBALS['current_site']->blog_id ) ) {
22
+ $blog_id = absint( $GLOBALS['current_site']->blog_id );
23
+ }
24
+ elseif ( defined( 'BLOG_ID_CURRENT_SITE' ) ) {
25
+ $blog_id = absint( BLOG_ID_CURRENT_SITE );
26
+ }
27
+ elseif ( defined( 'BLOGID_CURRENT_SITE' ) ) { // deprecated.
28
+ $blog_id = absint( BLOGID_CURRENT_SITE );
29
+ }
30
+ $blog_id = $blog_id ? $blog_id : 1;
31
+ }
32
+
33
+ return $blog_id;
34
+ }
35
+ endif;
36
+
37
+
38
+ if ( ! function_exists( 'sf_maybe_flush_rewrite_rules' ) ) :
39
+ function sf_maybe_flush_rewrite_rules() {
40
+ static $done = false;
41
+
42
+ if ( did_action( 'init' ) ) {
43
+ flush_rewrite_rules();
44
+ }
45
+ elseif ( ! $done ) {
46
+ $done = true;
47
+ add_action( 'init', 'flush_rewrite_rules', PHP_INT_MAX );
48
+ }
49
+ }
50
+ endif;
51
+
52
+
53
+ /* !---------------------------------------------------------------------------- */
54
+ /* ! LINKS IN THE PLUGIN ROW */
55
+ /* ----------------------------------------------------------------------------- */
56
+
57
+ add_filter( 'plugin_action_links_' . SFML_PLUGIN_BASENAME, 'sfml_settings_action_links', 10, 2 );
58
+ add_filter( 'network_admin_plugin_action_links_' . SFML_PLUGIN_BASENAME, 'sfml_settings_action_links', 10, 2 );
59
+
60
+ function sfml_settings_action_links( $links, $file ) {
61
+ $links['settings'] = '<a href="' . ( is_multisite() ? network_admin_url( 'settings.php?page=move-login' ) : admin_url( 'options-general.php?page=move-login' ) ) . '">' . __( 'Settings' ) . '</a>';
62
+ return $links;
63
+ }
64
+
65
+
66
+ // !List everybody, so no one will be jalous. :)
67
+
68
+ add_filter( 'plugin_row_meta', 'sfml_plugin_row_meta', 10, 2 );
69
+
70
+ function sfml_plugin_row_meta( $plugin_meta, $plugin_file ) {
71
+
72
+ if ( SFML_PLUGIN_BASENAME === $plugin_file ) {
73
+ $pos = false;
74
+ $links = array();
75
+ $authors = array(
76
+ array( 'name' => 'Grégory Viguier', 'url' => 'http://www.screenfeed.fr/' ),
77
+ array( 'name' => 'Julio Potier', 'url' => 'http://www.boiteaweb.fr' ),
78
+ array( 'name' => 'SecuPress', 'url' => 'http://blog.secupress.fr' ),
79
+ );
80
+
81
+ if ( ! empty( $plugin_meta ) ) {
82
+ $search = '"http://www.screenfeed.fr/"';
83
+ foreach ( $plugin_meta as $i => $meta ) {
84
+ if ( strpos( $meta, $search ) !== false ) {
85
+ $pos = $i;
86
+ break;
87
+ }
88
+ }
89
+ }
90
+
91
+ foreach( $authors as $author ) {
92
+ $links[] = sprintf( '<a href="%s">%s</a>', $author['url'], $author['name'] );
93
+ }
94
+
95
+ $links = sprintf( __( 'By %s' ), wp_sprintf( '%l', $links ) );
96
+
97
+ if ( $pos !== false ) {
98
+ $plugin_meta[ $pos ] = $links;
99
+ }
100
+ else {
101
+ $plugin_meta[] = $links;
102
+ }
103
+ }
104
+
105
+ return $plugin_meta;
106
+ }
107
+
108
+
109
+ /* !---------------------------------------------------------------------------- */
110
+ /* ! MENU ITEM */
111
+ /* ----------------------------------------------------------------------------- */
112
+
113
+ add_action( ( is_multisite() ? 'network_' : '' ) . 'admin_menu', 'sfml_admin_menu' );
114
+
115
+ function sfml_admin_menu() {
116
+ $page = is_multisite() ? 'settings.php' : 'options-general.php';
117
+ $cap = is_multisite() ? 'manage_network_options' : 'manage_options';
118
+ add_submenu_page( $page, 'Move Login', 'Move Login', $cap, SFML_Options::OPTION_PAGE, 'sfml_settings_page' );
119
+ }
120
+
121
+
122
+ /* !---------------------------------------------------------------------------- */
123
+ /* ! SETTINGS PAGE */
124
+ /* ----------------------------------------------------------------------------- */
125
+
126
+ // !Include the settings page file on... the settings page.
127
+
128
+ add_action( 'load-settings_page_' . SFML_Options::OPTION_PAGE, 'sfml_include_settings_page' );
129
+
130
+ function sfml_include_settings_page() {
131
+ include( SFML_PLUGIN_DIR . 'inc/settings-page.php' );
132
+ }
133
+
134
+
135
+ /* !---------------------------------------------------------------------------- */
136
+ /* ! SAVE SETTINGS ON FORM SUBMIT */
137
+ /* ----------------------------------------------------------------------------- */
138
+
139
+ // !options.php do not handle site options. Let's use admin-post.php for multisite installations.
140
+
141
+ if ( is_multisite() ) :
142
+
143
+ add_action( 'admin_post_update', 'sfml_update_site_option_on_submit' );
144
+
145
+ function sfml_update_site_option_on_submit() {
146
+ $option_group = SFML_Options::OPTION_GROUP;
147
+
148
+ if ( ! isset( $_POST['option_page'] ) || $_POST['option_page'] !== $option_group ) {
149
+ return;
150
+ }
151
+
152
+ $capability = apply_filters( "option_page_capability_{$option_group}", 'manage_network_options' );
153
+
154
+ if ( ! current_user_can( $capability ) ) {
155
+ wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
156
+ }
157
+
158
+ check_admin_referer( $option_group . '-options' );
159
+
160
+ $whitelist_options = apply_filters( 'whitelist_options', array() );
161
+
162
+ if ( ! isset( $whitelist_options[ $option_group ] ) ) {
163
+ wp_die( __( '<strong>ERROR</strong>: options page not found.' ) );
164
+ }
165
+
166
+ $options = $whitelist_options[ $option_group ];
167
+
168
+ if ( $options ) {
169
+
170
+ foreach ( $options as $option ) {
171
+ $option = trim( $option );
172
+ $value = null;
173
+
174
+ if ( isset( $_POST[ $option ] ) ) {
175
+ $value = $_POST[ $option ];
176
+ if ( ! is_array( $value ) ) {
177
+ $value = trim( $value );
178
+ }
179
+ $value = wp_unslash( $value );
180
+ }
181
+
182
+ update_site_option( $option, $value );
183
+ }
184
+
185
+ }
186
+
187
+ /**
188
+ * Handle settings errors and return to options page
189
+ */
190
+ // If no settings errors were registered add a general 'updated' message.
191
+ if ( ! count( get_settings_errors() ) ) {
192
+ add_settings_error( 'general', 'settings_updated', __( 'Settings saved.' ), 'updated' );
193
+ }
194
+ set_transient( 'settings_errors', get_settings_errors(), 30 );
195
+
196
+ /**
197
+ * Redirect back to the settings page that was submitted
198
+ */
199
+ $goback = add_query_arg( 'settings-updated', 'true', wp_get_referer() );
200
+ wp_redirect( $goback );
201
+ exit;
202
+ }
203
+
204
+ endif;
205
+
206
+
207
+ /* !---------------------------------------------------------------------------- */
208
+ /* ! UPGRADE */
209
+ /* ----------------------------------------------------------------------------- */
210
+
211
+ // !Delete previous options.
212
+
213
+ function sfml_delete_noop_options() {
214
+ $option_name = 'sfml';
215
+ $page_name = 'move-login';
216
+ $page_parent_name = 'settings';
217
+
218
+ // Remove the main option and the history option
219
+ delete_option( $option_name );
220
+ delete_option( $option_name . '_history' );
221
+
222
+ // Remove the users metadatas, reguarding the metaboxes placement
223
+ delete_metadata( 'user', 0, 'screen_layout_' . $page_parent_name . '_page_' . $page_name, null, true );
224
+ delete_metadata( 'user', 0, 'metaboxhidden_' . $page_parent_name . '_page_' . $page_name, null, true );
225
+ delete_metadata( 'user', 0, 'meta-box-order_' . $page_parent_name . '_page_' . $page_name, null, true );
226
+ delete_metadata( 'user', 0, 'closedpostboxes_' . $page_parent_name . '_page_' . $page_name, null, true );
227
+
228
+ if ( is_multisite() ) {
229
+ delete_metadata( 'user', 0, 'screen_layout_' . $page_parent_name . '_page_' . $page_name . '-network', null, true );
230
+ delete_metadata( 'user', 0, 'metaboxhidden_' . $page_parent_name . '_page_' . $page_name . '-network', null, true );
231
+ delete_metadata( 'user', 0, 'meta-box-order_' . $page_parent_name . '_page_' . $page_name . '-network', null, true );
232
+ delete_metadata( 'user', 0, 'closedpostboxes_' . $page_parent_name . '_page_' . $page_name . '-network', null, true );
233
+ }
234
+ }
235
+
236
+
237
+ // !Upgrade
238
+
239
+ function sfml_upgrade() {
240
+ $proceed = false;
241
+ $mono_or_multi = 0; // Used to tell if the site changed from monosite to multisite.
242
+ $current_mono_multi = is_multisite() ? 2 : 1; // 1: monosite, 2: multisite.
243
+ $db_version = get_site_option( 'sfml_version' );
244
+ $db_version = is_string( $db_version ) ? explode( '|', $db_version ) : false;
245
+
246
+ if ( $db_version ) {
247
+ $mono_or_multi = isset( $db_version[1] ) ? (int) $db_version[1] : 0;
248
+ $db_version = $db_version[0];
249
+ }
250
+
251
+ // We're right on track.
252
+ if ( $db_version && version_compare( $db_version, SFML_VERSION ) === 0 && $mono_or_multi === $current_mono_multi ) {
253
+ return;
254
+ }
255
+
256
+ // Try to get a version from an older version, but only for multisite because on non-multisites get_site_option() and get_option() are the same.
257
+ if ( ! $db_version && is_multisite() ) {
258
+ $db_version = get_option( 'sfml_version' );
259
+ delete_option( 'sfml_version' );
260
+ }
261
+
262
+ // < 2.0 (old version with Noop)
263
+ if ( ! $mono_or_multi || version_compare( $db_version, '2.0' ) < 0 ) {
264
+
265
+ // < 1.1
266
+ if ( ! $db_version ) {
267
+ sf_maybe_flush_rewrite_rules();
268
+ }
269
+
270
+ if ( is_multisite() && get_main_blog_id() !== get_current_blog_id() ) {
271
+ switch_to_blog( get_main_blog_id() );
272
+ $old_options = get_option( 'sfml' );
273
+ sfml_delete_noop_options();
274
+ restore_current_blog();
275
+ }
276
+ else {
277
+ $old_options = get_option( 'sfml' );
278
+ sfml_delete_noop_options();
279
+ }
280
+
281
+ // Noop stores the options separately, by language, whether you use a multilingual site or not.
282
+ $old_options = is_array( $old_options ) && ! isset( $old_options['slugs.login'] ) ? reset( $old_options ) : $old_options;
283
+ $old_options = is_array( $old_options ) ? $old_options : array();
284
+
285
+ update_site_option( SFML_Options::OPTION_NAME, $old_options );
286
+
287
+ }
288
+ // Switched monosite ==> multisite since the last check.
289
+ elseif ( $mono_or_multi !== $current_mono_multi && $current_mono_multi === 2 ) {
290
+
291
+ $old_options = get_option( 'sfml' );
292
+ $old_options = is_array( $old_options ) ? $old_options : array();
293
+ delete_option( 'sfml' );
294
+
295
+ update_site_option( SFML_Options::OPTION_NAME, $old_options );
296
+
297
+ }
298
+
299
+ // Perhaps we'll need to display some notices. Add the rewrite rules to the .htaccess/web.config file.
300
+ set_transient( 'sfml_notices-' . get_current_user_id(), '2' ); // 2 means "No need to update the file": update_site_option() already did.
301
+
302
+ update_site_option( 'sfml_version', SFML_VERSION . '|' . $current_mono_multi );
303
+ }
304
+
305
+ sfml_upgrade();
306
+
307
+
308
+ /* !---------------------------------------------------------------------------- */
309
+ /* ! ADMIN NOTICES + UPDATE REWRITE RULES */
310
+ /* ----------------------------------------------------------------------------- */
311
+
312
+ // !Admin notices
313
+
314
+ add_action( 'all_admin_notices', 'sfml_notices' );
315
+
316
+ function sfml_notices() {
317
+ global $pagenow, $is_apache, $is_iis7;
318
+
319
+ // Get previous notices
320
+ $user_id = get_current_user_id();
321
+ $proceed = get_transient( 'sfml_notices-' . $user_id ); // 1 means "Update the file". 2 means "No need to update the file".
322
+
323
+ // If the transient exists, it means it's the plugin activation or upgrade.
324
+ if ( ! $proceed ) {
325
+ return;
326
+ }
327
+
328
+ if ( ! function_exists( 'sfml_write_rules' ) ) {
329
+ include( SFML_PLUGIN_DIR . 'inc/rewrite.php' );
330
+ }
331
+
332
+ delete_transient( 'sfml_notices-' . $user_id );
333
+
334
+ $notices = array();
335
+ $is_nginx = sfml_is_nginx();
336
+ $home_path = sfml_get_home_path();
337
+
338
+ // IIS7
339
+ if ( $is_iis7 && iis7_supports_permalinks() && ! ( wp_is_writable( $home_path . 'web.config' ) || ( ! file_exists( $home_path . 'web.config' ) && wp_is_writable( $home_path ) ) ) ) {
340
+ $notices[] = 'error_file_not_writable';
341
+ }
342
+ // Apache
343
+ elseif ( $is_apache && got_mod_rewrite() && ! ( wp_is_writable( $home_path . '.htaccess' ) || ( ! file_exists( $home_path . '.htaccess' ) && wp_is_writable( $home_path ) ) ) ) {
344
+ $notices[] = 'error_file_not_writable';
345
+ }
346
+ // Nginx
347
+ elseif ( $is_nginx ) {
348
+ $notices[] = 'updated_is_nginx';
349
+ }
350
+
351
+ // Display notices
352
+ if ( ! empty( $notices ) ) {
353
+
354
+ $messages = array();
355
+
356
+ foreach ( $notices as $notice ) {
357
+ $messages[ substr( $notice, 0, strpos( $notice, '_' ) ) ][] = sfml_notice_message( $notice );
358
+ }
359
+
360
+ $messages = array_filter( array_map( 'array_filter', $messages ) );
361
+
362
+ foreach ( $messages as $class => $message ) {
363
+ echo '<div class="' . $class . '"><p>' . implode( '<br/>', $message ) . '</p></div>';
364
+ }
365
+
366
+ }
367
+ elseif ( $proceed === '1' ) {
368
+ // Add the rewrite rules to the .htaccess/web.config file.
369
+ sfml_write_rules();
370
+ }
371
+ }
372
+
373
+
374
+ /**/
inc/class-sfml-options.php ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( 'Cheatin\' uh?' );
4
+ }
5
+
6
+
7
+ class SFML_Options {
8
+
9
+ const VERSION = '1.0';
10
+ const OPTION_NAME = 'sfml';
11
+ const OPTION_GROUP = 'sfml_settings';
12
+ const OPTION_PAGE = 'move-login';
13
+
14
+ protected static $options;
15
+ protected static $options_default;
16
+ protected static $slugs;
17
+ protected static $labels;
18
+
19
+
20
+ // !Init
21
+
22
+ public static function init() {
23
+ if ( defined( 'WP_UNINSTALL_PLUGIN' ) ) {
24
+ return;
25
+ }
26
+ // Register option and sanitization method.
27
+ self::register_setting( array( __CLASS__, 'sanitize_options' ) );
28
+ }
29
+
30
+
31
+ // !Get default options
32
+
33
+ public static function get_default_options() {
34
+
35
+ self::maybe_clear_options_cache();
36
+
37
+ if ( ! isset( self::$options_default ) ) {
38
+ // Default slugs.
39
+ self::$options_default = array(
40
+ 'slugs.postpass' => 'postpass',
41
+ 'slugs.logout' => 'logout',
42
+ 'slugs.lostpassword' => 'lostpassword',
43
+ 'slugs.retrievepassword' => 'retrievepassword',
44
+ 'slugs.resetpass' => 'resetpass',
45
+ 'slugs.rp' => 'rp',
46
+ 'slugs.register' => 'register',
47
+ 'slugs.login' => 'login',
48
+ );
49
+
50
+ // Plugins can add their own actions.
51
+ $additional_slugs = apply_filters( 'sfml_additional_slugs', array() );
52
+
53
+ if ( is_array( $additional_slugs ) && ! empty( $additional_slugs ) ) {
54
+
55
+ foreach ( $additional_slugs as $slug_key => $slug_label ) {
56
+ $slug_key = sanitize_title( $slug_key, '', 'display' );
57
+
58
+ if ( ! empty( $slug_key ) && ! isset( self::$options_default[ 'slug.' . $slug_key ] ) ) {
59
+ self::$options_default[ 'slugs.' . $slug_key ] = $slug_key;
60
+ }
61
+ }
62
+
63
+ }
64
+
65
+ // Options
66
+ self::$options_default = array_merge( self::$options_default, array(
67
+ 'deny_wp_login_access' => 1,
68
+ 'deny_admin_access' => 0,
69
+ ) );
70
+
71
+ }
72
+
73
+ return self::$options_default;
74
+ }
75
+
76
+
77
+ // !Get all options
78
+
79
+ public static function get_options() {
80
+
81
+ self::maybe_clear_options_cache();
82
+
83
+ if ( ! isset( self::$options ) ) {
84
+ self::$options = array();
85
+ $old_options = get_site_option( self::OPTION_NAME );
86
+ $defaults = self::get_default_options();
87
+
88
+ if ( is_array( $old_options ) ) {
89
+ $default_slugs = self::get_sub_options( 'slugs', $defaults );
90
+
91
+ // Add and escape slugs
92
+ foreach ( $default_slugs as $slug_key => $default_slug ) {
93
+ self::$options[ 'slugs.' . $slug_key ] = ! empty( $old_options[ 'slugs.' . $slug_key ] ) ? sanitize_title( $old_options[ 'slugs.' . $slug_key ], $default_slug, 'display' ) : $default_slug;
94
+ }
95
+
96
+ // Add and escape other options
97
+ if ( isset( $defaults['deny_wp_login_access'] ) ) {
98
+ self::$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'];
99
+ }
100
+
101
+ if ( isset( $defaults['deny_admin_access'] ) ) {
102
+ self::$options['deny_admin_access'] = isset( $old_options['deny_admin_access'] ) ? min( 3, max( 0, (int) $old_options['deny_admin_access'] ) ) : $defaults['deny_admin_access'];
103
+ }
104
+ }
105
+ else {
106
+ self::$options = $defaults;
107
+ }
108
+
109
+ // Generic filter, change the values.
110
+ $options_tmp = apply_filters( 'sfml_options', self::$options );
111
+ self::$options = array_merge( self::$options, $options_tmp ); // Make sure no keys have been removed.
112
+ }
113
+
114
+ return self::$options;
115
+ }
116
+
117
+
118
+ // !Get the slugs
119
+
120
+ public static function get_slugs() {
121
+
122
+ self::maybe_clear_options_cache();
123
+
124
+ if ( ! isset( self::$slugs ) ) {
125
+ return self::get_sub_options( 'slugs', self::get_options() );
126
+ }
127
+
128
+ return self::$slugs;
129
+ }
130
+
131
+
132
+ // !Sanitize options on save
133
+
134
+ public static function sanitize_options( $options = array() ) {
135
+
136
+ $out = array();
137
+ $errors = array( 'forbidden' => array(), 'duplicates' => array() );
138
+ $old_options = get_site_option( self::OPTION_NAME );
139
+ $defaults = self::get_default_options();
140
+
141
+ // Add and sanitize slugs
142
+ $default_slugs = self::get_sub_options( 'slugs', $defaults );
143
+ $exclude = array_diff_key( $default_slugs, self::slugs_fields_labels() ); // postpass, retrievepassword, rp
144
+
145
+ foreach ( $default_slugs as $slug_key => $default_slug ) {
146
+
147
+ if ( isset( $exclude[ $slug_key ] ) ) {
148
+ $out[ 'slugs.' . $slug_key ] = $exclude[ $slug_key ];
149
+ continue;
150
+ }
151
+
152
+ $out[ 'slugs.' . $slug_key ] = false;
153
+
154
+ if ( ! empty( $options[ 'slugs.' . $slug_key ] ) ) {
155
+ $tmp_slug = sanitize_title( $options[ 'slugs.' . $slug_key ], $default_slug );
156
+
157
+ // postpass, retrievepassword and rp are forbidden.
158
+ if ( in_array( $tmp_slug, $exclude ) ) {
159
+ $errors['forbidden'][] = $tmp_slug;
160
+ }
161
+ // Make sure the slug is not already set for another action.
162
+ elseif ( in_array( $tmp_slug, $out ) ) {
163
+ $errors['duplicates'][] = $tmp_slug;
164
+ }
165
+ // Yay!
166
+ else {
167
+ $out[ 'slugs.' . $slug_key ] = $tmp_slug;
168
+ }
169
+ }
170
+
171
+ // Fallback to old value or default value.
172
+ if ( ! $out[ 'slugs.' . $slug_key ] ) {
173
+ if ( ! isset( $exclude[ $slug_key ] ) && ! empty( $old_options[ 'slugs.' . $slug_key ] ) ) {
174
+ $out[ 'slugs.' . $slug_key ] = sanitize_title( $old_options[ 'slugs.' . $slug_key ], $default_slug );
175
+ }
176
+ else {
177
+ $out[ 'slugs.' . $slug_key ] = $default_slug;
178
+ }
179
+ }
180
+
181
+ }
182
+
183
+ // Add and sanitize other options
184
+ if ( isset( $defaults['deny_wp_login_access'] ) ) {
185
+ if ( isset( $options['deny_wp_login_access'] ) ) {
186
+ $out['deny_wp_login_access'] = min( 3, max( 1, (int) $options['deny_wp_login_access'] ) );
187
+ }
188
+ elseif ( isset( $old_options['deny_wp_login_access'] ) ) {
189
+ $out['deny_wp_login_access'] = min( 3, max( 1, (int) $old_options['deny_wp_login_access'] ) );
190
+ }
191
+ else {
192
+ $out['deny_wp_login_access'] = $defaults['deny_wp_login_access'];
193
+ }
194
+ }
195
+
196
+ if ( isset( $defaults['deny_admin_access'] ) ) {
197
+ if ( isset( $options['deny_admin_access'] ) ) {
198
+ $out['deny_admin_access'] = min( 3, max( 0, (int) $options['deny_admin_access'] ) );
199
+ }
200
+ elseif ( isset( $old_options['deny_admin_access'] ) ) {
201
+ $out['deny_admin_access'] = min( 3, max( 0, (int) $old_options['deny_admin_access'] ) );
202
+ }
203
+ else {
204
+ $out['deny_admin_access'] = $defaults['deny_admin_access'];
205
+ }
206
+ }
207
+
208
+ // Generic filter, change the values.
209
+ $options_tmp = apply_filters( 'sfml_sanitize_options', $out, $options );
210
+ $out = array_merge( $out, $options_tmp ); // Make sure no keys have been removed.
211
+
212
+ // Clear options cache.
213
+ self::maybe_clear_options_cache( true );
214
+
215
+ // Add the rewrite rules to the .htaccess/web.config file.
216
+ $old_slugs = self::get_sub_options( 'slugs', $old_options );
217
+ $new_slugs = self::get_sub_options( 'slugs', $out );
218
+
219
+ if ( $old_slugs !== $new_slugs ) {
220
+ if ( ! function_exists( 'sfml_write_rules' ) ) {
221
+ include( SFML_PLUGIN_DIR . 'inc/rewrite.php' );
222
+ }
223
+
224
+ sfml_write_rules( sfml_rules( $new_slugs ) );
225
+ }
226
+
227
+ // Trigger errors
228
+ if ( is_admin() ) {
229
+ $errors['forbidden'] = array_unique( $errors['forbidden'] );
230
+ $errors['duplicates'] = array_unique( $errors['duplicates'] );
231
+
232
+ if ( $nbr_forbidden = count( $errors['forbidden'] ) ) {
233
+ add_settings_error( 'sfml_settings', 'forbidden-slugs', sprintf( _n( 'The slug %s is forbidden.', 'The slugs %s are forbidden.', $nbr_forbidden, 'sf-move-login' ), wp_sprintf( '<code>%l</code>', $errors['forbidden'] ) ) );
234
+ }
235
+ if ( ! empty( $errors['duplicates'] ) ) {
236
+ add_settings_error( 'sfml_settings', 'duplicates-slugs', __( 'The links can\'t have the same slugs.', 'sf-move-login' ) );
237
+ }
238
+ }
239
+
240
+ return $out;
241
+ }
242
+
243
+
244
+ // !Get sub-options.
245
+
246
+ public static function get_sub_options( $name = false, $options = array() ) {
247
+ if ( empty($options) || !$name ) {
248
+ return array();
249
+ }
250
+ $options = (array) $options;
251
+
252
+ if ( isset($options[ $name ]) ) {
253
+ return $options[ $name ];
254
+ }
255
+
256
+ $group = array();
257
+ $name = rtrim($name, '.').'.';
258
+ foreach ( $options as $k => $v ) {
259
+ if ( strpos($k, $name) === 0 ) {
260
+ $group[ substr($k, strlen($name)) ] = $v;
261
+ }
262
+ }
263
+ return !empty($group) ? $group : null;
264
+ }
265
+
266
+
267
+ // !Fields labels (for the slugs)
268
+
269
+ public static function slugs_fields_labels() {
270
+
271
+ self::maybe_clear_options_cache();
272
+
273
+ if ( ! isset( self::$labels ) ) {
274
+ self::$labels = array(
275
+ 'login' => __( 'Log in' ),
276
+ 'logout' => __( 'Log out' ),
277
+ 'register' => __( 'Register' ),
278
+ 'lostpassword' => __( 'Lost Password' ),
279
+ 'resetpass' => __( 'Password Reset' ),
280
+ );
281
+
282
+ // Plugins can add their own actions.
283
+ $new_slugs = apply_filters( 'sfml_additional_slugs', array() );
284
+
285
+ if ( ! empty( $new_slugs ) ) {
286
+ $new_slugs = array_diff_key( $new_slugs, self::$labels );
287
+ self::$labels = array_merge( self::$labels, $new_slugs );
288
+ }
289
+ }
290
+
291
+ return self::$labels;
292
+ }
293
+
294
+
295
+ // !Clear options cache
296
+
297
+ public static function maybe_clear_options_cache( $force = false ) {
298
+ if ( $force || apply_filters( self::OPTION_NAME . '_clear_options_cache', false ) ) {
299
+ self::$options = null;
300
+ self::$options_default = null;
301
+ self::$slugs = null;
302
+ self::$labels = null;
303
+ remove_all_filters( self::OPTION_NAME . '_clear_options_cache' );
304
+ }
305
+ }
306
+
307
+
308
+ // !register_setting() is not always defined...
309
+
310
+ protected static function register_setting( $sanitize_callback = '' ) {
311
+ global $new_whitelist_options;
312
+
313
+ if ( is_admin() ) {
314
+
315
+ if ( function_exists( 'register_setting' ) ) {
316
+ register_setting( self::OPTION_GROUP, self::OPTION_NAME, $sanitize_callback );
317
+ return;
318
+ }
319
+
320
+ $new_whitelist_options = isset( $new_whitelist_options ) && is_array( $new_whitelist_options ) ? $new_whitelist_options : array();
321
+ $new_whitelist_options[ self::OPTION_GROUP ] = isset( $new_whitelist_options[ self::OPTION_GROUP ] ) && is_array( $new_whitelist_options[ self::OPTION_GROUP ] ) ? $new_whitelist_options[ self::OPTION_GROUP ] : array();
322
+ $new_whitelist_options[ self::OPTION_GROUP ][] = self::OPTION_NAME;
323
+
324
+ }
325
+
326
+ if ( $sanitize_callback != '' ) {
327
+ add_filter( 'sanitize_option_' . self::OPTION_NAME, $sanitize_callback );
328
+ }
329
+ }
330
+
331
+ }
332
+
333
+
334
+ SFML_Options::init();
335
+
336
+ /**/
inc/redirections-and-dies.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( 'Cheatin\' uh?' );
4
+ }
5
+
6
+
7
+ /* !---------------------------------------------------------------------------- */
8
+ /* ! REMOVE DEFAULT WORDPRESS REDIRECTIONS TO LOGIN AND ADMIN AREAS */
9
+ /* ----------------------------------------------------------------------------- */
10
+
11
+ remove_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );
12
+
13
+
14
+ /* !---------------------------------------------------------------------------- */
15
+ /* ! IF THE CURRENT URI IS NOT LISTED IN OUR SLUGS, DENY ACCESS TO THE FORM */
16
+ /* ----------------------------------------------------------------------------- */
17
+
18
+ add_action( 'login_init', 'sfml_login_init', 0 );
19
+
20
+ function sfml_login_init() {
21
+ // If the user is logged in, do nothing, lets WP redirect this user to the administration area.
22
+ if ( is_user_logged_in() ) {
23
+ return;
24
+ }
25
+
26
+ $uri = sf_get_current_url( 'uri' );
27
+ $slugs = sfml_get_slugs();
28
+ $slugs = apply_filters( 'sfml_slugs_not_to_kill', $slugs, $uri );
29
+
30
+ if ( ! in_array( $uri, $slugs ) ) {
31
+ do_action( 'sfml_wp_login_error' );
32
+
33
+ // To make sure something happen.
34
+ if ( false === has_action( 'sfml_wp_login_error' ) ) {
35
+ sfml_wp_login_error();
36
+ }
37
+ }
38
+ }
39
+
40
+
41
+ add_action( 'sfml_wp_login_error', 'sfml_wp_login_error' );
42
+
43
+ function sfml_wp_login_error() {
44
+ $do = sfml_deny_wp_login_access();
45
+
46
+ switch( $do ) {
47
+ case 2:
48
+ $redirect = $GLOBALS['wp_rewrite']->using_permalinks() ? home_url( '404' ) : add_query_arg( 'p', '404', home_url() );
49
+ wp_safe_redirect( esc_url( user_trailingslashit( apply_filters( 'sfml_404_error_page', $redirect ) ) ) );
50
+ exit;
51
+ case 3:
52
+ wp_safe_redirect( esc_url( user_trailingslashit( home_url() ) ) );
53
+ exit;
54
+ default:
55
+ wp_die( __( 'No no no, the login form is not here.', 'sf-move-login' ) );
56
+ }
57
+ }
58
+
59
+
60
+ /* !---------------------------------------------------------------------------- */
61
+ /* ! IF NOT CONNECTED, DO NOT REDIRECT FROM ADMIN AREA TO WP-LOGIN.PHP */
62
+ /* ----------------------------------------------------------------------------- */
63
+
64
+ add_action( 'after_setup_theme', 'sfml_maybe_die_before_admin_redirect', 12 );
65
+
66
+ function sfml_maybe_die_before_admin_redirect() {
67
+ global $pagenow;
68
+ // If it's not the administration area, or if it's an ajax call, no need to go further.
69
+ if ( ! ( is_admin() && ! ( ( defined('DOING_AJAX') && DOING_AJAX ) || ( $pagenow === 'admin-post.php' && ! empty( $_REQUEST['action'] ) ) ) ) ) {
70
+ return;
71
+ }
72
+
73
+ $scheme = is_user_admin() ? 'logged_in' : apply_filters( 'auth_redirect_scheme', '' );
74
+
75
+ if ( ! wp_validate_auth_cookie( '', $scheme ) && sfml_deny_admin_access() ) {
76
+ do_action( 'sfml_wp_admin_error' );
77
+
78
+ // To make sure something happen.
79
+ if ( false === has_action( 'sfml_wp_admin_error' ) ) {
80
+ sfml_wp_admin_error();
81
+ }
82
+ }
83
+ }
84
+
85
+
86
+ add_action( 'sfml_wp_admin_error', 'sfml_wp_admin_error' );
87
+
88
+ function sfml_wp_admin_error() {
89
+ $do = sfml_deny_admin_access();
90
+
91
+ switch( $do ) {
92
+ case 1:
93
+ wp_die( __( 'Cheatin&#8217; uh?' ) );
94
+ case 2:
95
+ $redirect = $GLOBALS['wp_rewrite']->using_permalinks() ? home_url('404') : add_query_arg( 'p', '404', home_url() );
96
+ wp_safe_redirect( esc_url( user_trailingslashit( apply_filters( 'sfml_404_error_page', $redirect ) ) ) );
97
+ exit;
98
+ case 3:
99
+ wp_safe_redirect( esc_url( user_trailingslashit( home_url() ) ) );
100
+ exit;
101
+ }
102
+ }
103
+
104
+ /**/
inc/rewrite.php ADDED
@@ -0,0 +1,388 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( 'Cheatin\' uh?' );
4
+ }
5
+
6
+ /* !---------------------------------------------------------------------------- */
7
+ /* ! INCLUDES */
8
+ /* ----------------------------------------------------------------------------- */
9
+
10
+ require_once( ABSPATH . WPINC . '/functions.php' );
11
+ require_once( ABSPATH . 'wp-admin/includes/misc.php' );
12
+
13
+
14
+ /* !---------------------------------------------------------------------------- */
15
+ /* ! REWRITE RULES */
16
+ /* ----------------------------------------------------------------------------- */
17
+
18
+ // !Return an array of action => url
19
+
20
+ function sfml_rules( $actions = null ) {
21
+ if ( is_null( $actions ) ) {
22
+ if ( ! class_exists( 'SFML_Options' ) ) {
23
+ include( SFML_PLUGIN_DIR . 'inc/class-sfml-options.php' );
24
+ }
25
+ $actions = SFML_Options::get_slugs();
26
+ }
27
+
28
+ $rules = array(
29
+ $actions['login'] => 'wp-login.php',
30
+ );
31
+ unset( $actions['login'] );
32
+
33
+ foreach ( $actions as $action => $slug ) {
34
+ $rules[ $slug ] = 'wp-login.php?action=' . $action;
35
+ }
36
+ return $rules;
37
+ }
38
+
39
+
40
+ // !Write rules in file.
41
+ // @return (bool) false if no rewrite module or not IIS7/Apache
42
+
43
+ function sfml_write_rules( $rules = null ) {
44
+ global $is_apache, $is_iis7;
45
+
46
+ $rules = is_null( $rules ) ? sfml_rules() : $rules;
47
+
48
+ // Nginx
49
+ if ( sfml_is_nginx() ) {
50
+ return true;
51
+ }
52
+
53
+ if ( ! sfml_can_write_file() ) {
54
+ return false;
55
+ }
56
+
57
+ // IIS
58
+ if ( $is_iis7 ) {
59
+ return sfml_insert_iis7_rewrite_rules( 'SF Move Login', sfml_iis7_rewrite_rules( $rules, 'SF Move Login' ) );
60
+ }
61
+ // Apache
62
+ elseif ( $is_apache ) {
63
+ return sfml_insert_apache_rewrite_rules( 'SF Move Login', sfml_apache_rewrite_rules( $rules ) );
64
+ }
65
+
66
+ return false;
67
+ }
68
+
69
+
70
+ // !Is it a nginx server?
71
+
72
+ function sfml_is_nginx() {
73
+ global $is_nginx;
74
+ if ( is_null( $is_nginx ) ) {
75
+ $is_nginx = ! empty( $_SERVER['SERVER_SOFTWARE'] ) && strpos( $_SERVER['SERVER_SOFTWARE'], 'nginx' ) !== false;
76
+ }
77
+ return $is_nginx;
78
+ }
79
+
80
+
81
+ /*
82
+ * !Tell if the .htaccess/web.config file is writable.
83
+ * If the file does not exists (uh?), check if the parent folder is writable.
84
+ */
85
+
86
+ function sfml_can_write_file() {
87
+ global $is_apache, $is_iis7;
88
+
89
+ $home_path = sfml_get_home_path();
90
+
91
+ // IIS7
92
+ if ( $is_iis7 && iis7_supports_permalinks() && ( wp_is_writable( $home_path . 'web.config' ) || ( ! file_exists( $home_path . 'web.config' ) && wp_is_writable( $home_path ) ) ) ) {
93
+ return true;
94
+ }
95
+ // Apache
96
+ elseif ( $is_apache && got_mod_rewrite() && ( wp_is_writable( $home_path . '.htaccess' ) || ( ! file_exists( $home_path . '.htaccess' ) && wp_is_writable( $home_path ) ) ) ) {
97
+ return true;
98
+ }
99
+
100
+ return false;
101
+ }
102
+
103
+
104
+ // !Is WP a MultiSite and a subfolder install?
105
+
106
+ function sfml_is_subfolder_install() {
107
+ global $wpdb;
108
+ static $subfolder_install;
109
+
110
+ if ( ! isset( $subfolder_install ) ) {
111
+ if ( is_multisite() ) {
112
+ $subfolder_install = ! (bool) is_subdomain_install();
113
+ }
114
+ elseif ( ! is_null( $wpdb->sitemeta ) ) {
115
+ $subfolder_install = ! (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
116
+ }
117
+ else {
118
+ $subfolder_install = false;
119
+ }
120
+ }
121
+
122
+ return $subfolder_install;
123
+ }
124
+
125
+
126
+ /* !---------------------------------------------------------------------------- */
127
+ /* ! REWRITE RULES: NGINX */
128
+ /* ----------------------------------------------------------------------------- */
129
+
130
+ // !Return the multisite rewrite rules (as an array).
131
+
132
+ function sfml_nginx_rewrite_rules( $rules = array() ) {
133
+ global $wpdb;
134
+
135
+ if ( ! is_array( $rules ) || empty( $rules ) ) {
136
+ return '';
137
+ }
138
+
139
+ $base = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
140
+ $subdir_match = sfml_is_subfolder_install() ? '([_0-9a-zA-Z-]+/)?' : '(/)?';
141
+ $out = array();
142
+
143
+ foreach ( $rules as $slug => $rule ) {
144
+ $out[] = 'rewrite ^' . $subdir_match . $slug . '/?$ $1' . $rule . ' break';
145
+ }
146
+
147
+ return $out;
148
+ }
149
+
150
+
151
+ /* !---------------------------------------------------------------------------- */
152
+ /* ! REWRITE RULES: APACHE */
153
+ /* ----------------------------------------------------------------------------- */
154
+
155
+ // !Return the multisite rewrite rules (as an array).
156
+
157
+ function sfml_apache_rewrite_rules( $rules = array() ) {
158
+ global $wpdb;
159
+
160
+ if ( ! is_array( $rules ) || empty( $rules ) ) {
161
+ return '';
162
+ }
163
+
164
+ $base = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
165
+ $subdir_match = sfml_is_subfolder_install() ? '([_0-9a-zA-Z-]+/)?' : '';
166
+
167
+ $out = array(
168
+ '<IfModule mod_rewrite.c>',
169
+ 'RewriteEngine On',
170
+ 'RewriteBase ' . $base,
171
+ );
172
+ foreach ( $rules as $slug => $rule ) {
173
+ $out[] = 'RewriteRule ^' . $subdir_match . $slug . '/?$ $1' . $rule . ' [QSA,L]';
174
+ }
175
+ $out[] = '</IfModule>';
176
+
177
+ return $out;
178
+ }
179
+
180
+
181
+ // !Insert content in htaccess file, before the WP block.
182
+ // @param $marker string
183
+ // @param $rules array|string
184
+ // @param $before string
185
+
186
+ function sfml_insert_apache_rewrite_rules( $marker, $rules = '', $before = '# BEGIN WordPress' ) {
187
+ if ( ! $marker ) {
188
+ return false;
189
+ }
190
+
191
+ $home_path = sfml_get_home_path();
192
+ $htaccess_file = $home_path . '.htaccess';
193
+
194
+ $has_htaccess = file_exists( $htaccess_file );
195
+ $htaccess_is_writable = $has_htaccess && is_writeable( $htaccess_file );
196
+ $got_mod_rewrite = got_mod_rewrite();
197
+
198
+ if (
199
+ ( $htaccess_is_writable && !$rules ) || // Remove rules
200
+ ( $htaccess_is_writable && $rules && $got_mod_rewrite ) || // Add rules
201
+ ( !$has_htaccess && is_writeable( $home_path ) && $rules && $got_mod_rewrite ) // Create htaccess + add rules
202
+ ) {
203
+ // Current htaccess content
204
+ $htaccess_content = $has_htaccess ? file_get_contents( $htaccess_file ) : '';
205
+
206
+ // No WordPress rules or no "before tag"?
207
+ if ( ( !$before || false === strpos( $htaccess_content, $before ) ) && $rules ) {
208
+ return insert_with_markers( $htaccess_file, $marker, $rules );
209
+ }
210
+
211
+ // Remove the SF Move Login marker
212
+ $htaccess_content = preg_replace( "/# BEGIN $marker.*# END $marker\n*/is", '', $htaccess_content );
213
+
214
+ // New content
215
+ if ( $before && $rules ) {
216
+ $rules = is_array( $rules ) ? implode( "\n", $rules ) : $rules;
217
+ $rules = trim( $rules, "\r\n " );
218
+ if ( $rules ) {
219
+ // The new content need to be inserted before the WordPress rules
220
+ $rules = "# BEGIN $marker\n$rules\n# END $marker\n\n\n$before";
221
+ $htaccess_content = str_replace( $before, $rules, $htaccess_content );
222
+ }
223
+ }
224
+
225
+ // Update the .htacces file
226
+ return (bool) file_put_contents( $htaccess_file , $htaccess_content );
227
+ }
228
+ return false;
229
+ }
230
+
231
+
232
+ /* !---------------------------------------------------------------------------- */
233
+ /* ! REWRITE RULES: IIS */
234
+ /* ----------------------------------------------------------------------------- */
235
+
236
+ // !Return the multisite rewrite rules for IIS systems (as a part of a xml system).
237
+
238
+ function sfml_iis7_rewrite_rules( $rules = array(), $marker = null ) {
239
+ global $wpdb;
240
+
241
+ if ( ! is_array( $rules ) || empty( $rules ) || empty( $marker ) ) {
242
+ return '';
243
+ }
244
+
245
+ $base = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
246
+ $subfolder_install = sfml_is_subfolder_install();
247
+ $subdir_match = $subfolder_install ? '([_0-9a-zA-Z-]+/)?' : '';
248
+ $iis_subdir_match = ltrim( $base, '/' ) . $subdir_match;
249
+ $iis_subdir_repl = $subfolder_install ? '{R:1}' : '';
250
+
251
+ $rule_i = 1;
252
+ $space = str_repeat( ' ', 16 );
253
+
254
+ $out = array();
255
+ foreach ( $rules as $slug => $rule ) {
256
+ $out[] = $space . '<rule name="' . $marker . ' Rule ' . $rule_i . '" stopProcessing="true">' . "\n"
257
+ . $space . ' <match url="^' . $iis_subdir_match . $slug . '/?$" ignoreCase="false" />' . "\n"
258
+ . $space . ' <action type="Redirect" url="' . $iis_subdir_repl . $rule . '" redirectType="Permanent" />' . "\n"
259
+ . $space . "</rule>\n";
260
+ $rule_i++;
261
+ }
262
+
263
+ return $out;
264
+ }
265
+
266
+
267
+ // !Insert content in web.config file, before the WP block.
268
+ // @var $rules array|string
269
+
270
+ function sfml_insert_iis7_rewrite_rules( $marker, $rules = '', $before = 'wordpress' ) {
271
+ if ( ! $marker || ! class_exists( 'DOMDocument' ) ) {
272
+ return false;
273
+ }
274
+
275
+ $home_path = sfml_get_home_path();
276
+ $web_config_file = $home_path . 'web.config';
277
+
278
+ $has_web_config = file_exists( $web_config_file );
279
+ $web_config_is_writable = $has_web_config && wp_is_writable( $web_config_file );
280
+ $supports_permalinks = iis7_supports_permalinks();
281
+
282
+ // New content
283
+ $rules = is_array( $rules ) ? implode( "\n", $rules ) : $rules;
284
+ $rules = trim( $rules, "\r\n" );
285
+
286
+ if (
287
+ ( $web_config_is_writable && !$rules ) || // Remove rules
288
+ ( $web_config_is_writable && $rules && $supports_permalinks ) || // Add rules
289
+ ( !$has_web_config && wp_is_writable( $home_path ) && $rules && $supports_permalinks ) // Create web.config + add rules
290
+ ) {
291
+ // If configuration file does not exist then we create one.
292
+ if ( ! $has_web_config ) {
293
+ $fp = fopen( $web_config_file, 'w' );
294
+ fwrite( $fp, '<configuration/>' );
295
+ fclose( $fp );
296
+ }
297
+
298
+ $doc = new DOMDocument();
299
+ $doc->preserveWhiteSpace = false;
300
+
301
+ if ( $doc->load( $web_config_file ) === false ) {
302
+ return false;
303
+ }
304
+
305
+ $xpath = new DOMXPath( $doc );
306
+
307
+ // Remove old rules
308
+ $old_rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'' . $marker . '\')]' );
309
+ if ( $old_rules->length > 0 ) {
310
+ $child = $old_rules->item(0);
311
+ $parent = $child->parentNode;
312
+ $parent->removeChild( $child );
313
+ }
314
+
315
+ // No new rules?
316
+ if ( ! $rules ) {
317
+ $doc->formatOutput = true;
318
+ saveDomDocument( $doc, $web_config_file );
319
+ return true;
320
+ }
321
+
322
+ // Check the XPath to the rewrite rule and create XML nodes if they do not exist
323
+ $xmlnodes = $xpath->query( '/configuration/system.webServer/rewrite/rules' );
324
+ if ( $xmlnodes->length > 0 ) {
325
+ $rules_node = $xmlnodes->item(0);
326
+ }
327
+ else {
328
+ $rules_node = $doc->createElement('rules');
329
+
330
+ $xmlnodes = $xpath->query('/configuration/system.webServer/rewrite');
331
+ if ( $xmlnodes->length > 0 ) {
332
+ $rewrite_node = $xmlnodes->item(0);
333
+ $rewrite_node->appendChild( $rules_node );
334
+ }
335
+ else {
336
+ $rewrite_node = $doc->createElement('rewrite');
337
+ $rewrite_node->appendChild( $rules_node );
338
+
339
+ $xmlnodes = $xpath->query( '/configuration/system.webServer' );
340
+ if ( $xmlnodes->length > 0 ) {
341
+ $system_webServer_node = $xmlnodes->item(0);
342
+ $system_webServer_node->appendChild( $rewrite_node );
343
+ }
344
+ else {
345
+ $system_webServer_node = $doc->createElement('system.webServer');
346
+ $system_webServer_node->appendChild( $rewrite_node );
347
+
348
+ $xmlnodes = $xpath->query( '/configuration' );
349
+ if ( $xmlnodes->length > 0 ) {
350
+ $config_node = $xmlnodes->item(0);
351
+ $config_node->appendChild( $system_webServer_node );
352
+ }
353
+ else {
354
+ $config_node = $doc->createElement('configuration');
355
+ $doc->appendChild( $config_node );
356
+ $config_node->appendChild( $system_webServer_node );
357
+ }
358
+ }
359
+ }
360
+ }
361
+
362
+ $rule_fragment = $doc->createDocumentFragment();
363
+ $rule_fragment->appendXML( $rules );
364
+
365
+ // Insert before the WP rules
366
+ if ( $before ) {
367
+ $wordpress_rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'' . $before . '\')]' );
368
+ }
369
+ if ( $before && $wordpress_rules->length > 0 ) {
370
+ $child = $wordpress_rules->item(0);
371
+ $parent = $child->parentNode;
372
+ $parent->insertBefore( $element, $child );
373
+ }
374
+ else {
375
+ $rules_node->appendChild( $rule_fragment );
376
+ }
377
+
378
+ $doc->encoding = 'UTF-8';
379
+ $doc->formatOutput = true;
380
+ saveDomDocument( $doc, $web_config_file );
381
+
382
+ return true;
383
+ }
384
+
385
+ return false;
386
+ }
387
+
388
+ /**/
inc/settings-page.php ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( 'Cheatin\' uh?' );
4
+ }
5
+
6
+ /* !---------------------------------------------------------------------------- */
7
+ /* ! SETTINGS PAGE */
8
+ /* ----------------------------------------------------------------------------- */
9
+
10
+ // !Add settings fields and sections.
11
+
12
+ function sfml_settings_fields() {
13
+ $labels = SFML_Options::slugs_fields_labels();
14
+ $defaults = sfml_get_default_options();
15
+ $options = sfml_get_options();
16
+
17
+ // Sections
18
+ add_settings_section( 'slugs', __( 'Links' ), false, SFML_Options::OPTION_PAGE );
19
+ add_settings_section( 'access', __( 'Access', 'sf-move-login' ), false, SFML_Options::OPTION_PAGE );
20
+
21
+ // Fields
22
+ foreach ( $labels as $slug => $label ) {
23
+ if ( isset( $options[ 'slugs.' . $slug ] ) ) {
24
+ // Slugs
25
+ add_settings_field(
26
+ 'slugs-' . $slug,
27
+ $label,
28
+ 'sfml_text_field',
29
+ SFML_Options::OPTION_PAGE,
30
+ 'slugs',
31
+ array(
32
+ 'label_for' => 'slugs-' . $slug,
33
+ 'name' => 'slugs.' . $slug,
34
+ 'value' => $options[ 'slugs.' . $slug ],
35
+ 'default' => $slug,
36
+ 'attributes' => array(
37
+ 'pattern' => '[0-9a-z_-]*',
38
+ 'title' => __( 'Only lowercase letters, digits, - and _', 'sf-move-login' ),
39
+ ),
40
+ )
41
+ );
42
+ }
43
+ }
44
+
45
+ // Deny access to login form.
46
+ add_settings_field(
47
+ 'deny_wp_login_access',
48
+ '<code>wp-login.php</code>',
49
+ 'sfml_radio_field',
50
+ SFML_Options::OPTION_PAGE,
51
+ 'access',
52
+ array(
53
+ 'label_for' => 'deny_wp_login_access',
54
+ 'value' => $options['deny_wp_login_access'],
55
+ 'default' => $defaults['deny_wp_login_access'],
56
+ 'values' => array(
57
+ 1 => __( 'Display an error message', 'sf-move-login' ),
58
+ 2 => __( 'Redirect to a &laquo;Page not found&raquo; error page', 'sf-move-login' ),
59
+ 3 => __( 'Redirect to the home page', 'sf-move-login' ),
60
+ ),
61
+ 'label' => '<strong>' . __( 'When a not connected user attempts to access the old login page.', 'sf-move-login' ) . '</strong>',
62
+ )
63
+ );
64
+
65
+ // Deny access to admin area.
66
+ add_settings_field(
67
+ 'deny_admin_access',
68
+ __( 'Administration area', 'sf-move-login' ),
69
+ 'sfml_radio_field',
70
+ SFML_Options::OPTION_PAGE,
71
+ 'access',
72
+ array(
73
+ 'label_for' => 'deny_admin_access',
74
+ 'value' => $options['deny_admin_access'],
75
+ 'default' => $defaults['deny_admin_access'],
76
+ 'values' => array(
77
+ 0 => __( 'Do nothing, redirect to the new login page', 'sf-move-login' ),
78
+ 1 => __( 'Display an error message', 'sf-move-login' ),
79
+ 2 => __( 'Redirect to a &laquo;Page not found&raquo; error page', 'sf-move-login' ),
80
+ 3 => __( 'Redirect to the home page', 'sf-move-login' ),
81
+ ),
82
+ 'label' => '<strong>' . __( 'When a not connected user attempts to access the administration area.', 'sf-move-login' ) . '</strong>',
83
+ )
84
+ );
85
+ }
86
+
87
+ sfml_settings_fields();
88
+
89
+
90
+ /*
91
+ * If the parent page is 'options-general.php', WP will automaticaly use settings_errors().
92
+ * But the alerts will be displayed before the page title, and then some JS will move it after the title.
93
+ * Under some circumstances (large page, slow browser), the "swap" won't happen fast enough, and the user will see it.
94
+ * For the settings in the network admin, settings_errors() is not used at all.
95
+ * So I prefer use my own settings_errors(), displayed AFTER the title.
96
+ */
97
+
98
+ add_action( 'all_admin_notices', 'sfml_shunt_options_settings_errors', PHP_INT_MAX );
99
+
100
+ function sfml_shunt_options_settings_errors() {
101
+ global $parent_file;
102
+ $parent_file .= '#sfml'; // Prevent wp-admin/options-head.php to be included.
103
+ }
104
+
105
+
106
+ // !The settings page
107
+
108
+ function sfml_settings_page() { ?>
109
+ <div class="wrap">
110
+ <?php screen_icon( 'tools' ); ?>
111
+ <h2>Move Login</h2>
112
+
113
+ <?php require( ABSPATH . 'wp-admin/options-head.php' ); ?>
114
+
115
+ <form name="<?php echo SFML_Options::OPTION_PAGE ?>" method="post" action="<?php echo is_multisite() ? admin_url( 'admin-post.php' ) : admin_url( 'options.php' ); ?>" id="<?php echo SFML_Options::OPTION_PAGE ?>">
116
+ <?php
117
+ do_settings_sections( SFML_Options::OPTION_PAGE );
118
+ settings_fields( SFML_Options::OPTION_GROUP );
119
+ submit_button();
120
+ ?>
121
+ </form>
122
+
123
+ <?php sfml_rewrite_rules_textarea(); ?>
124
+ </div>
125
+ <?php
126
+ }
127
+
128
+
129
+ /* !---------------------------------------------------------------------------- */
130
+ /* ! SETTINGS FIELDS */
131
+ /* ----------------------------------------------------------------------------- */
132
+
133
+ // !Text field
134
+
135
+ function sfml_text_field( $args ) {
136
+ $name = ! empty( $args['name'] ) ? esc_attr( $args['name'] ) : ( ! empty( $args['label_for'] ) ? esc_attr( $args['label_for'] ) : false );
137
+ $id = ! empty( $args['label_for'] ) ? esc_attr( $args['label_for'] ) : false;
138
+ $value = isset( $args['value'] ) ? esc_attr( $args['value'] ) : '';
139
+ $default = isset( $args['default'] ) ? esc_attr( $args['default'] ) : null;
140
+ $atts = ! empty( $args['attributes'] ) ? build_html_atts( $args['attributes'] ) : '';
141
+
142
+ if ( ! $name ) {
143
+ return;
144
+ }
145
+
146
+ printf(
147
+ '<input type="text" name="%s"%s%s value="%s"/>',
148
+ SFML_Options::OPTION_NAME . '[' . $name . ']',
149
+ $id ? ' id="' . $id . '"' : '',
150
+ $atts,
151
+ $value
152
+ );
153
+
154
+ if ( ! is_null( $default ) ) {
155
+ echo ' <span class="description">' . sprintf( _x( '(default: %s)', 'default value', 'sf-move-login' ), $default ) . '</span>';
156
+ }
157
+ }
158
+
159
+
160
+ // !Radio field
161
+
162
+ function sfml_radio_field( $args ) {
163
+ $name = ! empty( $args['name'] ) ? esc_attr( $args['name'] ) : ( ! empty( $args['label_for'] ) ? esc_attr( $args['label_for'] ) : false );
164
+ $id = ! empty( $args['label_for'] ) ? esc_attr( $args['label_for'] ) : 'radio-' . $name;
165
+ $value = isset( $args['value'] ) ? $args['value'] : '';
166
+ $values = isset( $args['values'] ) ? $args['values'] : false;
167
+ $default = isset( $args['default'] ) ? $args['default'] : null;
168
+ $label = isset( $args['label'] ) ? $args['label'] : '';
169
+
170
+ if ( ! $name || ! $values || ! is_array( $values ) ) {
171
+ return;
172
+ }
173
+
174
+ if ( ! is_null( $default ) && ! isset( $values[ $value ] ) ) {
175
+ $value = $default;
176
+ }
177
+
178
+ $i = 0;
179
+ echo $label ? '<label for="' . $id . '">' . $label . '</label><br/>' : '';
180
+
181
+ foreach( $values as $input_value => $input_label ) {
182
+ printf(
183
+ '<input type="radio" name="%s" id="%s"%s value="%s"/>',
184
+ SFML_Options::OPTION_NAME . '[' . $name . ']',
185
+ $id . ( $i ? '-' . $i : '' ),
186
+ $input_value === $value ? ' checked="checked"' : '',
187
+ esc_attr( $input_value )
188
+ );
189
+ echo '<label for="' . $id . ( $i ? '-' . $i : '' ) . '">' . $input_label . '</label><br/>';
190
+ $i++;
191
+ }
192
+
193
+ if ( ! is_null( $default ) && isset( $values[ $default ] ) ) {
194
+ echo '<span class="description">' . sprintf( _x( '(default: %s)', 'default value', 'sf-move-login' ), $values[ $default ] ) . '</span>';
195
+ }
196
+ }
197
+
198
+
199
+ // !A textarea displaying the rewrite rules. Used with or without Noop.
200
+
201
+ function sfml_rewrite_rules_textarea() {
202
+ global $is_apache, $is_iis7;
203
+
204
+ if ( ! function_exists( 'sfml_write_rules' ) ) {
205
+ include( SFML_PLUGIN_DIR . 'inc/rewrite.php' );
206
+ }
207
+
208
+ $is_nginx = sfml_is_nginx();
209
+ $rules = sfml_rules();
210
+
211
+ // Message
212
+ $base = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
213
+ $document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );
214
+ $abspath_fix = str_replace( '\\', '/', ABSPATH );
215
+ $home_path = 0 === strpos( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : sfml_get_home_path();
216
+
217
+ // IIS
218
+ if ( $is_iis7 ) {
219
+ $file = 'web.config';
220
+ $file_content = implode( "\n", sfml_iis7_rewrite_rules( $rules, 'SF Move Login' ) );
221
+
222
+ $height = 20;
223
+ $content = sprintf(
224
+ __( '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:', 'sf-move-login' ),
225
+ '<code>' . $file . '</code>', '<code>' . $home_path . '</code>', 'SF Move Login', '<code>&lt;rule name="WordPress Rule 1" stopProcessing="true"&gt;</code>'
226
+ );
227
+ }
228
+ // nginx
229
+ elseif ( $is_nginx ) {
230
+ $file = 'nginx.conf';
231
+ $file_content = "\n# BEGIN SF Move Login\n";
232
+ $file_content .= implode( "\n", sfml_nginx_rewrite_rules( $rules ) );
233
+ $file_content .= "\n# END SF Move Login\n";
234
+
235
+ $height = substr_count( $file_content, "\n" );
236
+ $content = sprintf(
237
+ '<span style="color:red">' . __( 'The plugin can\'t add the new rewrite rules to your %s file by itself, you will need to add them manually.', 'sf-move-login' ) . '</span>',
238
+ '<code>' . $file . '</code>'
239
+ );
240
+ }
241
+ // Apache
242
+ elseif ( $is_apache ) {
243
+ $file = '.htaccess';
244
+ $file_content = "\n# BEGIN SF Move Login\n";
245
+ $file_content .= implode( "\n", sfml_apache_rewrite_rules( $rules ) );
246
+ $file_content .= "\n# END SF Move Login\n";
247
+
248
+ $height = substr_count( $file_content, "\n" );
249
+ $content = sprintf(
250
+ __( '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:', 'sf-move-login' ),
251
+ '<code>' . $file . '</code>', '<code>' . $home_path . '</code>', 'SF Move Login', '<code># BEGIN WordPress</code>'
252
+ );
253
+ }
254
+ else {
255
+ return;
256
+ }
257
+
258
+ // Add a warning if the file is not writable.
259
+ if ( ! empty( $home_path ) && ! wp_is_writable( $home_path . $file ) ) {
260
+ $content .= '</p><p style="color:red">' . sprintf(
261
+ __( 'Your %s file is not writable.', 'sf-move-login' ),
262
+ '<code>' . $file . '</code>'
263
+ );
264
+ }
265
+
266
+ // Add a warning if the plugin is bypassed.
267
+ if ( defined( 'SFML_ALLOW_LOGIN_ACCESS' ) && SFML_ALLOW_LOGIN_ACCESS ) {
268
+ $content .= '</p><p class="description">' . __( 'The constant <code>SFML_ALLOW_LOGIN_ACCESS</code> is defined to <code>true</code>, the settings below won\'t take effect.', 'sf-move-login' );
269
+ }
270
+
271
+ $content = '<p>' . $content . "</p>\n";
272
+ $content .= '<textarea class="code readonly" readonly="readonly" cols="120" rows="' . $height . '">' . esc_textarea( $file_content ) . "</textarea>\n";
273
+
274
+ echo $content;
275
+ }
276
+
277
+
278
+ /* !---------------------------------------------------------------------------- */
279
+ /* ! TOOLS */
280
+ /* ----------------------------------------------------------------------------- */
281
+
282
+ // !Build a string for html attributes (means: separated by a space) : array( 'width' => '200', 'height' => '150', 'yolo' => 'foo' ) ==> ' width="200" height="150" yolo="foo"'
283
+
284
+ if ( ! function_exists( 'build_html_atts' ) ) :
285
+ function build_html_atts( $attributes, $quote = '"' ) {
286
+ $out = '';
287
+ if ( ! is_array( $attributes ) || empty( $attributes ) ) {
288
+ return '';
289
+ }
290
+ foreach( $attributes as $att_name => $att_value ) {
291
+ $out .= ' ' . esc_attr( $att_name ) . '=' . $quote . $att_value . $quote;
292
+ }
293
+ return $out;
294
+ }
295
+ endif;
296
+
297
+
298
+ /**/
inc/url-filters.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( 'Cheatin\' uh?' );
4
+ }
5
+
6
+
7
+ /* !---------------------------------------------------------------------------- */
8
+ /* ! FILTER URLS */
9
+ /* ----------------------------------------------------------------------------- */
10
+
11
+ // !Site URL
12
+
13
+ add_filter( 'site_url', 'sfml_site_url', 10, 4 );
14
+
15
+ function sfml_site_url( $url, $path, $scheme, $blog_id = null ) {
16
+ if ( ( $scheme === 'login' || $scheme === 'login_post' ) && ! empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false && strpos( $path, 'wp-login.php' ) !== false ) {
17
+ // Base url
18
+ if ( empty( $blog_id ) || ! is_multisite() ) {
19
+ $url = get_option( 'siteurl' );
20
+ }
21
+ else {
22
+ switch_to_blog( $blog_id );
23
+ $url = get_option( 'siteurl' );
24
+ restore_current_blog();
25
+ }
26
+
27
+ $url = set_url_scheme( $url, $scheme );
28
+ return rtrim( $url, '/' ) . '/' . ltrim( sfml_set_path( $path ), '/' );
29
+ }
30
+ return $url;
31
+ }
32
+
33
+
34
+ // !Network site URL
35
+
36
+ add_filter( 'network_site_url', 'sfml_network_site_url', 10, 3 );
37
+
38
+ function sfml_network_site_url( $url, $path, $scheme ) {
39
+ global $current_site;
40
+
41
+ if ( ( $scheme === 'login' || $scheme === 'login_post' ) && ! empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false && strpos( $path, 'wp-login.php' ) !== false ) {
42
+ $url = set_url_scheme( 'http://' . rtrim( $current_site->domain, '/' ) . '/' . ltrim( $current_site->path, '/' ), $scheme );
43
+ return rtrim( $url, '/' ) . '/' . ltrim( sfml_set_path( $path ), '/' );
44
+ }
45
+
46
+ return $url;
47
+ }
48
+
49
+
50
+ // !Logout url: wp_logout_url() add the action param after using site_url()
51
+
52
+ add_filter( 'logout_url', 'sfml_logout_url' );
53
+
54
+ function sfml_logout_url( $link ) {
55
+ return sfml_login_to_action( $link, 'logout' );
56
+ }
57
+
58
+
59
+ // !Forgot password url: wp_lostpassword_url() add the action param after using site_url()
60
+
61
+ add_filter( 'lostpassword_url', 'sfml_lostpass_url' );
62
+
63
+ function sfml_lostpass_url( $link ) {
64
+ return sfml_login_to_action( $link, 'lostpassword' );
65
+ }
66
+
67
+
68
+ // !Redirections are hard-coded
69
+
70
+ add_filter( 'wp_redirect', 'sfml_redirect', 10, 2 );
71
+
72
+ function sfml_redirect( $location, $status ) {
73
+ if ( site_url( reset( (explode( '?', $location )) ) ) === site_url( 'wp-login.php' ) ) {
74
+ return sfml_site_url( $location, $location, 'login', get_current_blog_id() );
75
+ }
76
+
77
+ return $location;
78
+ }
79
+
80
+ /**/
inc/utilities.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( 'Cheatin\' uh?' );
4
+ }
5
+
6
+
7
+ /* !---------------------------------------------------------------------------- */
8
+ /* ! OPTIONS */
9
+ /* ----------------------------------------------------------------------------- */
10
+
11
+ // !Get all options
12
+
13
+ function sfml_get_options() {
14
+ return SFML_Options::get_options();
15
+ }
16
+
17
+
18
+ // !Get default options
19
+
20
+ function sfml_get_default_options() {
21
+ return SFML_Options::get_default_options();
22
+ }
23
+
24
+
25
+ // !Get the slugs
26
+
27
+ function sfml_get_slugs() {
28
+ return SFML_Options::get_slugs();
29
+ }
30
+
31
+
32
+ // !Access to wp-login.php
33
+
34
+ function sfml_deny_wp_login_access() {
35
+ $options = sfml_get_options();
36
+ return $options['deny_wp_login_access']; // 1: error message, 2: 404, 3: home
37
+ }
38
+
39
+
40
+ // !Access to the administration area
41
+
42
+ function sfml_deny_admin_access() {
43
+ $options = sfml_get_options();
44
+ return $options['deny_admin_access']; // 0: nothing, 1: error message, 2: 404, 3: home
45
+ }
46
+
47
+
48
+ /* !---------------------------------------------------------------------------- */
49
+ /* ! UTILITIES */
50
+ /* ----------------------------------------------------------------------------- */
51
+
52
+ // !Construct the url
53
+
54
+ function sfml_set_path( $path ) {
55
+ $slugs = sfml_get_slugs();
56
+
57
+ // Action
58
+ $parsed_path = parse_url( $path );
59
+ if ( ! empty( $parsed_path['query'] ) ) {
60
+ wp_parse_str( $parsed_path['query'], $params );
61
+ $action = !empty( $params['action'] ) ? $params['action'] : 'login';
62
+
63
+ if ( isset( $params['key'] ) ) {
64
+ $action = 'resetpass';
65
+ }
66
+
67
+ if ( ! isset( $slugs[ $action ] ) && false === has_filter( 'login_form_' . $action ) ) {
68
+ $action = 'login';
69
+ }
70
+ }
71
+ else {
72
+ $action = 'login';
73
+ }
74
+
75
+ // Path
76
+ if ( isset($slugs[$action]) ) {
77
+ $path = str_replace( 'wp-login.php', $slugs[ $action ], $path );
78
+ $path = remove_query_arg( 'action', $path );
79
+ }
80
+ else { // In case of a custom action
81
+ $path = str_replace( 'wp-login.php', $slugs['login'], $path );
82
+ $path = remove_query_arg( 'action', $path );
83
+ $path = add_query_arg( 'action', $action, $path );
84
+ }
85
+
86
+ return '/' . ltrim( $path, '/' );
87
+ }
88
+
89
+
90
+ // !login?action=logout -> /logout
91
+
92
+ function sfml_login_to_action( $link, $action ) {
93
+ $slugs = sfml_get_slugs();
94
+ $need_action_param = false;
95
+
96
+ if ( isset( $slugs[ $action ] ) ) {
97
+ $slug = $slugs[ $action ];
98
+ }
99
+ else { // Shouldn't happen, because this function is not used in this case.
100
+ $slug = $slugs['login'];
101
+
102
+ if ( false === has_filter( 'login_form_' . $action ) ) {
103
+ $action = 'login';
104
+ }
105
+ else { // In case of a custom action
106
+ $need_action_param = true;
107
+ }
108
+ }
109
+
110
+ if ( $link && strpos( $link, '/' . $slug ) === false ) {
111
+ $link = str_replace( array( '/' . $slugs['login'], '&amp;', '?amp;', '&' ), array( '/' . $slug, '&', '?', '&amp;' ), remove_query_arg( 'action', $link ) );
112
+
113
+ if ( $need_action_param ) { // In case of a custom action, shouldn't happen.
114
+ $link = add_query_arg( 'action', $action, $link );
115
+ }
116
+ }
117
+
118
+ return $link;
119
+ }
120
+
121
+
122
+ /* !---------------------------------------------------------------------------- */
123
+ /* ! GENERIC TOOLS */
124
+ /* ----------------------------------------------------------------------------- */
125
+
126
+ // !Get current URL.
127
+
128
+ if ( ! function_exists( 'sf_get_current_url' ) ) :
129
+ function sf_get_current_url( $mode = 'base' ) {
130
+ $url = ! empty( $GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI'] ) ? $GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI'] : ( ! empty( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '' );
131
+ $url = 'http' . ( is_ssl() ? 's' : '' ) . '://' . $_SERVER['HTTP_HOST'] . $url;
132
+ switch( $mode ) :
133
+ case 'raw' :
134
+ return $url;
135
+ break;
136
+ case 'base' :
137
+ $url = reset( (explode( '?', $url )) );
138
+ return reset( (explode( '&', $url )) );
139
+ break;
140
+ case 'uri' :
141
+ $url = reset( (explode( '?', $url )) );
142
+ $url = reset( (explode( '&', $url )) );
143
+ return trim( str_replace( home_url(), '', $url ), '/' );
144
+ endswitch;
145
+ }
146
+ endif;
147
+
148
+
149
+ // !For WP < 3.4
150
+
151
+ if ( ! function_exists( 'set_url_scheme' ) ) :
152
+ function set_url_scheme( $url, $scheme = null ) {
153
+ $orig_scheme = $scheme;
154
+
155
+ if ( ! $scheme ) {
156
+ $scheme = is_ssl() ? 'https' : 'http';
157
+ } elseif ( $scheme === 'admin' || $scheme === 'login' || $scheme === 'login_post' || $scheme === 'rpc' ) {
158
+ $scheme = is_ssl() || force_ssl_admin() ? 'https' : 'http';
159
+ } elseif ( $scheme !== 'http' && $scheme !== 'https' && $scheme !== 'relative' ) {
160
+ $scheme = is_ssl() ? 'https' : 'http';
161
+ }
162
+
163
+ $url = trim( $url );
164
+ if ( substr( $url, 0, 2 ) === '//' )
165
+ $url = 'http:' . $url;
166
+
167
+ if ( 'relative' == $scheme ) {
168
+ $url = ltrim( preg_replace( '#^\w+://[^/]*#', '', $url ) );
169
+ if ( $url !== '' && $url[0] === '/' )
170
+ $url = '/' . ltrim($url , "/ \t\n\r\0\x0B" );
171
+ } else {
172
+ $url = preg_replace( '#^\w+://#', $scheme . '://', $url );
173
+ }
174
+
175
+ /**
176
+ * Filter the resulting URL after setting the scheme.
177
+ *
178
+ * @since 3.4.0
179
+ *
180
+ * @param string $url The complete URL including scheme and path.
181
+ * @param string $scheme Scheme applied to the URL. One of 'http', 'https', or 'relative'.
182
+ * @param string $orig_scheme Scheme requested for the URL. One of 'http', 'https', 'login',
183
+ * 'login_post', 'admin', 'rpc', or 'relative'.
184
+ */
185
+ return apply_filters( 'set_url_scheme', $url, $scheme, $orig_scheme );
186
+ }
187
+ endif;
188
+
189
+
190
+ // !get_home_path() like. But this time we don't "fallback" to the real function if it exists, because of a bug with old versions.
191
+
192
+ function sfml_get_home_path() {
193
+ $home = set_url_scheme( get_option( 'home' ), 'http' );
194
+ $siteurl = set_url_scheme( get_option( 'siteurl' ), 'http' );
195
+
196
+ if ( ! empty( $home ) && 0 !== strcasecmp( $home, $siteurl ) ) {
197
+ $wp_path_rel_to_home = str_ireplace( $home, '', $siteurl ); /* $siteurl - $home */
198
+ $pos = strripos( str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ), trailingslashit( $wp_path_rel_to_home ) );
199
+ $home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos );
200
+ $home_path = trailingslashit( $home_path );
201
+ }
202
+ else {
203
+ $home_path = ABSPATH;
204
+ }
205
+
206
+ return str_replace( '\\', '/', $home_path );
207
+ }
208
+
209
+ /**/
languages/sf-move-login-fr_FR.mo ADDED
Binary file
languages/sf-move-login-fr_FR.po ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LANGUAGE French translation for SF Move Login plugin for WordPress.
2
+ #
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: sf-move-login 2.0\n"
6
+ "Report-msgid -Bugs-To: Grégory Viguier <i18n@screenfeed.fr>\n"
7
+ "POT-Creation-Date: 2013-06-01 00:04+0100\n"
8
+ "PO-Revision-Date: 2015-02-10 03:21+0100\n"
9
+ "Last-Translator: Grégory Viguier <i18n@screenfeed.fr>\n"
10
+ "Language-Team: fr_FR\n"
11
+ "MIME-Version: 1.0\n"
12
+ "Content-Type: text/plain; charset=utf-8\n"
13
+ "Content-Transfer-Encoding: 8bit\n"
14
+ "Plural-Forms: nplurals=2; plural=n>1;\n"
15
+ "X-Poedit-SourceCharset: utf-8\n"
16
+ "X-Poedit-KeywordsList: __;_e;_n\n"
17
+ "Language: fr_FR\n"
18
+ "X-Generator: Poedit 1.7.4\n"
19
+
20
+ msgid "Change your login URL for something like <code>http://example.com/login</code> and stop login brute force attempts."
21
+ msgstr "Changez l&rsquo;url de votre page de connexion pour quelque chose comme <code>http://example.com/login</code> et stoppez les tentatives de connexion par brute force."
22
+
23
+ # ---------------------------------------------------------------------------
24
+ # inc/activate.php
25
+
26
+ msgid "<strong>Move Login</strong> has not been activated."
27
+ msgstr "<strong>Move Login</strong> n&rsquo;a pas été activé."
28
+
29
+ msgid "It seems your server configuration prevent the plugin to work properly. <strong>Move Login</strong> won't work."
30
+ msgstr "Il semble que votre configuration serveur empêche l&rsquo;extension de fonctionner correctement. <strong>Move Login</strong> ne pourra pas fonctionner."
31
+
32
+ msgid "It seems the url rewrite module is not activated on your server. <strong>Move Login</strong> won't work."
33
+ msgstr "Il semble que le module de réécriture d&rsquo;url n&rsquo;est pas activé sur votre serveur. <strong>Move Login</strong> ne pourra pas fonctionner."
34
+
35
+ msgid "It seems your server does not use <i>Apache</i>, <i>Nginx</i>, nor <i>IIS7</i>. <strong>Move Login</strong> won't work."
36
+ msgstr "Il semble que votre serveur n&rsquo;utilise ni <i>Apache</i>, <i>Nginx</i>, ou <i>IIS7</i>. <strong>Move Login</strong> ne pourra pas fonctionner."
37
+
38
+ msgid "<strong>Move Login</strong> needs access to the %1$s file. Please visit the %2$s settings page and copy/paste the given code into the %1$s file."
39
+ msgstr "<strong>Move Login</strong> a besoin d&rsquo;accéder au fichier %1$s. Veuillez vous rendre sur la page de réglages de %2$s et veuillez copier/coller le code fourni dans le fichier %1$s."
40
+
41
+ msgid "It seems your server uses a <i>Nginx</i> system. You have to edit the rewrite rules by yourself in the configuration file. Please visit the %s settings page and take a look at the rewrite rules. <strong>Move Login</strong> is running but won't work correctly until you deal with those rewrite rules."
42
+ msgstr "Il semble que votre serveur utilise un système <i>Nginx</i>. 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 %s et jetez un œil aux règles de réécriture. <strong>Move Login</strong> fonctionne mais ne pourra pas le faire correctement tant que vous ne vous serez pas occupé de ces règles."
43
+
44
+ # ---------------------------------------------------------------------------
45
+ # inc/class-sfml-options.php
46
+
47
+ msgid "The slug %s is forbidden."
48
+ msgid_plural "The slugs %s are forbidden."
49
+ msgstr[0] "L&rsquo;identifiant %s est interdit."
50
+ msgstr[1] "Les identifiants %s sont interdits."
51
+
52
+ msgid "The links can't have the same slugs."
53
+ msgstr "Les liens ne peuvent pas avoir les mêmes identifiants."
54
+
55
+ # ---------------------------------------------------------------------------
56
+ # inc/redirections-and-dies.php
57
+
58
+ msgid "No no no, the login form is not here."
59
+ msgstr "Non non non, le formulaire de connexion ne se trouve pas ici."
60
+
61
+ # ---------------------------------------------------------------------------
62
+ # inc/settings-page.php
63
+
64
+ msgid "Access"
65
+ msgstr "Accès"
66
+
67
+ msgid "Only lowercase letters, digits, - and _"
68
+ msgstr "Seulement des lettres minuscules, chiffres, - et _"
69
+
70
+ msgid "Display an error message"
71
+ msgstr "Afficher un message d'erreur"
72
+
73
+ msgid "Redirect to a &laquo;Page not found&raquo; error page"
74
+ msgstr "Rediriger vers une page d&rsquo;erreur &laquo;&#160;Page non trouvée&#160;&raquo;"
75
+
76
+ msgid "Redirect to the home page"
77
+ msgstr "Rediriger vers la page d&rsquo;accueil"
78
+
79
+ msgid "When a not connected user attempts to access the old login page."
80
+ msgstr "Lorsqu&rsquo;un utilisateur non connecté tente d&rsquo;accéder à l&rsquo;ancienne page de connexion."
81
+
82
+ msgid "Administration area"
83
+ msgstr "Zone d'administration"
84
+
85
+ msgid "Do nothing, redirect to the new login page"
86
+ msgstr "Ne rien faire, rediriger vers la nouvelle page de connexion"
87
+
88
+ msgid "When a not connected user attempts to access the administration area."
89
+ msgstr "Lorsqu&rsquo;un utilisateur non connecté tente d&rsquo;accéder à la zone d&rsquo;administration."
90
+
91
+ msgctxt "default value"
92
+ msgid "(default: %s)"
93
+ msgstr "(défaut&#160;: %s)"
94
+
95
+ 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:"
96
+ msgstr "Si l&rsquo;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;:"
97
+
98
+ msgid "The plugin can't add the new rewrite rules to your %s file by itself, you will need to add them manually."
99
+ msgstr "L&rsquo;extension ne peut ajouter les nouvelles règles de réécriture à votre fichier %s, vous devrez les ajouter vous-même."
100
+
101
+ msgid "Your %s file is not writable."
102
+ msgstr "Votre fichier %s n&rsquo;est pas inscriptible."
103
+
104
+ msgid "The constant <code>SFML_ALLOW_LOGIN_ACCESS</code> is defined to <code>true</code>, the settings below won't take effect."
105
+ msgstr "La constante <code>SFML_ALLOW_LOGIN_ACCESS</code> est définie à <code>true</code>, les réglages ci-dessous ne prendront pas effet."
languages/sf-move-login-he_IL.mo ADDED
Binary file
languages/sf-move-login-he_IL.po ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file was generated by WPML
2
+ # WPML is a WordPress plugin that can turn any WordPress or WordPressMU site into a full featured multilingual content management system.
3
+ # http://wpml.org
4
+ msgid ""
5
+ msgstr ""
6
+ "Content-Type: text/plain; charset=UTF-8\n"
7
+ "Content-Transfer-Encoding: 8bit\n"
8
+ "Project-Id-Version: sf-move-login\n"
9
+ "POT-Creation-Date: \n"
10
+ "PO-Revision-Date: \n"
11
+ "Last-Translator: Ahrale <contact@atar4u.com>\n"
12
+ "Language-Team: Ahrale, Atar4U.com <contact@atar4u.com>\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "Language: he\n"
16
+ "X-Generator: Poedit 1.7.4\n"
17
+ "X-Poedit-SourceCharset: UTF-8\n"
18
+
19
+ # default:
20
+ # wp_die( __('No no no, the login form is not here.', 'sf-move-login') );
21
+ # }
22
+ # wpml-name: f02d96e29528d207eebb1134b60101a7
23
+ msgid "No no no, the login form is not here."
24
+ msgstr "לא לא לא, טופס ההתחברות אינו כאן."
25
+
26
+ # $error_msg = sprintf(
27
+ # __( 'An unexpected error occurred. Something may be wrong with screenfeed.fr or this server&#8217;s configuration. If you continue to have problems, please leave a message on <a href="%s">my blog</a>.', 'dad' ),
28
+ # 'http://www.screenfeed.fr/blog/'
29
+ # wpml-name: 1591a9d9cf0388df3f155337b9287402
30
+ msgid "An unexpected error occurred. Something may be wrong with screenfeed.fr or this server&#8217;s configuration. If you continue to have problems, please leave a message on <a href=\"%s\">my blog</a>."
31
+ msgstr "קרתה שגיאה לא צפויה. משהו השתבש ב screenfeed.fr או בתצורת השרת. אם הבעיה נמשכת, נא להשאיר הודעה ב <a href=\"%s\">אתר שלי</a>."
32
+
33
+ # 'upgrade' => __( 'To enable the real settings page for Move Login, please upgrade the plugin %2$s to the version %3$s (can also be %4$s).', 'sf-move-login' ),
34
+ # 'corrupted' => __( 'It seems the plugin Noop is installed but doesn\'t work properly. To enable the real settings page for Move Login, please reinstall %1$s (can also be %4$s).', 'sf-move-login' ),
35
+ # );
36
+ # wpml-name: 7baecfb459b11eeb9b6c66799c7620ae
37
+ msgid "It seems the plugin Noop is installed but doesn't work properly. To enable the real settings page for Move Login, please reinstall %1$s (can also be %4$s)."
38
+ msgstr "נראה שהתוסף Noop iמותקן אך אינו פועל כיאות. כדי להפעיל את ההגדרות האמתיות של Move Login,נא להתקין מחדש את %1$s (יכול להיות גם %4$s)."
39
+
40
+ # 'inactive' => __( 'To enable the real settings page for Move Login, please activate the plugin %2$s.', 'sf-move-login' ),
41
+ # 'upgrade' => __( 'To enable the real settings page for Move Login, please upgrade the plugin %2$s to the version %3$s (can also be %4$s).', 'sf-move-login' ),
42
+ # 'corrupted' => __( 'It seems the plugin Noop is installed but doesn\'t work properly. To enable the real settings page for Move Login, please reinstall %1$s (can also be %4$s).', 'sf-move-login' ),
43
+ # wpml-name: 36da2bdc510526c20591b7cfd057518e
44
+ msgid "To enable the real settings page for Move Login, please upgrade the plugin %2$s to the version %3$s (can also be %4$s)."
45
+ msgstr "כדי להפעיל את עמוד ההגדרות האמתיות של Move Login, נא לעדכן את התוסף %2$sלגרסה %3$s (יתכן גם %4$s)."
46
+
47
+ # 'required' => __( 'To enable the real settings page for Move Login, please install the plugin %1$s (can also be %4$s).', 'sf-move-login' ),
48
+ # 'inactive' => __( 'To enable the real settings page for Move Login, please activate the plugin %2$s.', 'sf-move-login' ),
49
+ # 'upgrade' => __( 'To enable the real settings page for Move Login, please upgrade the plugin %2$s to the version %3$s (can also be %4$s).', 'sf-move-login' ),
50
+ # wpml-name: e697e7e4931134ccb53a2b8dd3d2a69e
51
+ msgid "To enable the real settings page for Move Login, please activate the plugin %2$s."
52
+ msgstr "כדי להפעיל את ההגדרות האמתיות של התוסף, נא להפעיל את התוסף %2$s."
53
+
54
+ # 'updated_no_noop' => $status,
55
+ # 'updated_is_nginx' => sprintf( __('It seems your server uses a <i>Nginx</i> system, that I don\'t know at all. So I have to let you deal with the rewrite rules by yourself. Please visit the %2$s settings page and take a look at the rewrite rules used for a %1$s file. <strong>Move Login</strong> is running but won\'t work correctly until you deal with the rewrite rules.', 'sf-move-login'), $file, $link ),
56
+ # );
57
+ # wpml-name: c713e6cdc41d878d5fbd500cd38f1173
58
+ msgid "It seems your server uses a <i>Nginx</i> system, that I don't know at all. So I have to let you deal with the rewrite rules by yourself. Please visit the %2$s settings page and take a look at the rewrite rules used for a %1$s file. <strong>Move Login</strong> is running but won't work correctly until you deal with the rewrite rules."
59
+ msgstr "נראה שהשרת שלך משתמש במערכת <i>Nginx</i>, שאני כלל לא מכיר. כך שתצטרך להתעסק עם כללי הכתיבה מחדש בעצמך. נא לבקר בעמוד הגדרות %2$s settings pageותבדוק את כללי הכתיבה מחדש עבור קובץ %1$s. <strong>Move Login</strong> פועל כעת, אך לא יפעל נכון עד שתתקן את כללי הכתיבה מחדש."
60
+
61
+ # 'error_no_mod_rewrite' => __('It seems the url rewrite module is not activated on your server. <strong>Move Login</strong> won\'t work.', 'sf-move-login'),
62
+ # 'error_no_apache_nor_ii7' => __('It seems your server does not use <i>Apache</i>, <i>Nginx</i>, nor <i>IIS7</i>. <strong>Move Login</strong> won\'t work.', 'sf-move-login'),
63
+ # 'updated_no_noop' => $status,
64
+ # wpml-name: 71d17c00ac8e6e3bc6f49c3069c34c19
65
+ msgid "It seems your server does not use <i>Apache</i>, <i>Nginx</i>, nor <i>IIS7</i>. <strong>Move Login</strong> won't work."
66
+ msgstr "נראה שהשרת שלך אינו משתמש ב <i>Apache</i>, <i>Nginx</i>, ולא ב <i>IIS7</i>. התוסף <strong>Move Login</strong> לא יפעל."
67
+
68
+ # 'error_no_request_uri' => __('It seems your server configuration prevent the plugin to work properly. <strong>Move Login</strong> won\'t work.', 'sf-move-login'),
69
+ # 'error_no_mod_rewrite' => __('It seems the url rewrite module is not activated on your server. <strong>Move Login</strong> won\'t work.', 'sf-move-login'),
70
+ # 'error_no_apache_nor_ii7' => __('It seems your server does not use <i>Apache</i>, <i>Nginx</i>, nor <i>IIS7</i>. <strong>Move Login</strong> won\'t work.', 'sf-move-login'),
71
+ # wpml-name: 51ce773a89f2974a90312a44b147e0a9
72
+ msgid "It seems the url rewrite module is not activated on your server. <strong>Move Login</strong> won't work."
73
+ msgstr "נראה ש url rewrite module לא מופעל בשרת. התוסף <strong>Move Login</strong> לא יפעל."
74
+
75
+ # 'error_file_not_writable' => sprintf( __('<strong>Move Login</strong> needs access to the %1$s file. Please visit the %2$s settings page and copy/paste the given code into the %1$s file.', 'sf-move-login'), $file, $link ),
76
+ # 'error_no_request_uri' => __('It seems your server configuration prevent the plugin to work properly. <strong>Move Login</strong> won\'t work.', 'sf-move-login'),
77
+ # 'error_no_mod_rewrite' => __('It seems the url rewrite module is not activated on your server. <strong>Move Login</strong> won\'t work.', 'sf-move-login'),
78
+ # wpml-name: 32917575d178bcce288c40d5fd2b8454
79
+ msgid "It seems your server configuration prevent the plugin to work properly. <strong>Move Login</strong> won't work."
80
+ msgstr "נראה שתצורת השרת שלך מונעת מן התוסף לפעול כראוי. התוסף <strong>Move Login</strong>לא יפעל."
81
+
82
+ # $messages = array(
83
+ # 'error_file_not_writable' => sprintf( __('<strong>Move Login</strong> needs access to the %1$s file. Please visit the %2$s settings page and copy/paste the given code into the %1$s file.', 'sf-move-login'), $file, $link ),
84
+ # 'error_no_request_uri' => __('It seems your server configuration prevent the plugin to work properly. <strong>Move Login</strong> won\'t work.', 'sf-move-login'),
85
+ # wpml-name: 946acde8474d699b5fc41c462305d875
86
+ msgid "<strong>Move Login</strong> needs access to the %1$s file. Please visit the %2$s settings page and copy/paste the given code into the %1$s file."
87
+ msgstr "התוסף <strong>Move Login</strong> צריך גישה לקובץ %1$s. נא לבקר בעמוד הגדרות %2$s והעתק והדבק את הקוד הזה אל קובץ ה %1$s."
88
+
89
+ # $dies = array_filter( array_map( 'sfml_notice_message', $dies ) );
90
+ # $die_msg = __('<strong>Move Login</strong> has not been activated.', 'sf-move-login').'<br/>';
91
+ # wp_die( $die_msg.implode('<br/>', $dies), __('Error'), array('back_link' => true) );
92
+ # wpml-name: b1029496bef7e7be27590701ceb5789b
93
+ msgid "<strong>Move Login</strong> has not been activated."
94
+ msgstr "התוסף <strong>Move Login</strong>לא הופעל."
95
+
96
+ # if ( $error )
97
+ # add_settings_error( 'sfml_settings', 'duplicates-slugs', __("The links can't have the same slugs.", 'sf-move-login') );
98
+ # }
99
+ # wpml-name: 59de4d4caf2239a3a5cbecb307f52544
100
+ msgid "The links can't have the same slugs."
101
+ msgstr "הקישורים לא יכולים להיות עם אותו סלאג."
102
+
103
+ # SFML_NOOP_VERSION,
104
+ # '<a href="' . sfml_noop_download_url() . '">' . __( 'downloaded separately', 'sf-move-login' ) . '</a>'
105
+ # );
106
+ # wpml-name: cd569714490eb4c3a5d3c64cddf5e79c
107
+ msgid "downloaded separately"
108
+ msgstr "הורד בנפרד"
109
+
110
+ # 'ok' => false,
111
+ # 'required' => __( 'To enable the real settings page for Move Login, please install the plugin %1$s (can also be %4$s).', 'sf-move-login' ),
112
+ # 'inactive' => __( 'To enable the real settings page for Move Login, please activate the plugin %2$s.', 'sf-move-login' ),
113
+ # wpml-name: 6c1678e35dc09ebe43f3a4b777753c24
114
+ msgid "To enable the real settings page for Move Login, please install the plugin %1$s (can also be %4$s)."
115
+ msgstr "כדי להפעיל את עמוד ההגדרות האמתיות להעברת החיבור, נא להתקין את התוסף %1$s (אפשר גם את %4$s)."
116
+
117
+ #
118
+ # $content = '<p>' . sprintf( __( 'If the plugin fails to add the new rewrite rules to your %1$s file on activation, 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:', 'sf-move-login' ), $file, '<code>'.$home_path.'</code>', 'SF Move Login', $above ) . "</p>\n";
119
+ # $content .= '<textarea class="code readonly auto-select" readonly="readonly" cols="120" rows="' . $height . '">' . esc_textarea( $htaccess_file ) . "</textarea>\n";
120
+ # wpml-name: adec20e3e5c732af573873eb2f7ad43f
121
+ msgid "If the plugin fails to add the new rewrite rules to your %1$s file on activation, 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:"
122
+ msgstr "אם התוסף נכשל בהוספת הכללים החדשים לקובץ %1$s בעת ההפעלה, הוסף ידנית לקובץ %1$s ב %2$s, להחלפת כללי %3$s אחרים אם הם קיימים, <strong>מעל</strong> לשורה שכתוב בה %4$s:"
123
+
124
+ # <div class='noop-form'>
125
+ # <h3><?php echo Noop_fields::section_icon('tools') . sprintf( __('%s File', 'sf-move-login'), $file ); ?></h3>
126
+ # <?php sfml_rewrite_rules_textarea(); ?>
127
+ # wpml-name: 0d9c8dfe174c5be68d35a4055031de0d
128
+ msgid "%s File"
129
+ msgstr "קובץ %s"
130
+
131
+ # 'next_under' => true,
132
+ # 'label' => '<strong>' . __('When a not connected user attempts to access the administration area.', 'sf-move-login') . '</strong>',
133
+ # )
134
+ # wpml-name: 7cb19ed3790a97a268761e9867e50227
135
+ msgid "When a not connected user attempts to access the administration area."
136
+ msgstr "כאשר משתמש שאינו מחובר מנסה לגשת ללוח הניהול."
137
+
138
+ # 'values' => array(
139
+ # 0 => __('Do nothing, redirect to the new login page', 'sf-move-login'),
140
+ # 1 => __('Display an error message', 'sf-move-login'),
141
+ # wpml-name: 10eb6282c69cde5f22353d887abb9d74
142
+ msgid "Do nothing, redirect to the new login page"
143
+ msgstr "אל תעשה כלום, מפנה מחדש לעמוד הכניסה החדש"
144
+
145
+ # 'deny_admin_access',
146
+ # __('Administration area', 'sf-move-login'),
147
+ # array( $fields, 'radio_field' ),
148
+ # wpml-name: 1bfa5d26f4aa776600904f0d8b979d4a
149
+ msgid "Administration area"
150
+ msgstr "לוח הניהול"
151
+
152
+ # 'next_under' => true,
153
+ # 'label' => '<strong>' . __('When a not connected user attempts to access the old login page.', 'sf-move-login') . '</strong>',
154
+ # )
155
+ # wpml-name: 9dcdd11578bd6149178058eb59b764dc
156
+ msgid "When a not connected user attempts to access the old login page."
157
+ msgstr "אשר משתמש שאינו מחובר מנסה לגשת לדף הכניסה הישן."
158
+
159
+ # 2 => __('Redirect to a &laquo;Page not found&raquo; error page', 'sf-move-login'),
160
+ # 3 => __('Redirect to the home page', 'sf-move-login'),
161
+ # ),
162
+ # wpml-name: 453b6eac755d93fede239ba7a2738c88
163
+ msgid "Redirect to the home page"
164
+ msgstr "הפנה מחדש אל דף הבית"
165
+
166
+ # 1 => __('Display an error message', 'sf-move-login'),
167
+ # 2 => __('Redirect to a &laquo;Page not found&raquo; error page', 'sf-move-login'),
168
+ # 3 => __('Redirect to the home page', 'sf-move-login'),
169
+ # wpml-name: 39681b2b1501410a64e80df46160bec3
170
+ msgid "Redirect to a &laquo;Page not found&raquo; error page"
171
+ msgstr "מפנה מחדש אל «העמוד לא נמצא» עמוד שגיאה"
172
+
173
+ # 0 => __('Do nothing, redirect to the new login page', 'sf-move-login'),
174
+ # 1 => __('Display an error message', 'sf-move-login'),
175
+ # 2 => __('Redirect to a &laquo;Page not found&raquo; error page', 'sf-move-login'),
176
+ # wpml-name: 19d2ee020263e6427da926706edce8d3
177
+ msgid "Display an error message"
178
+ msgstr "הצג הודעת שגיאה"
179
+
180
+ # if ( defined('SFML_ALLOW_LOGIN_ACCESS') && SFML_ALLOW_LOGIN_ACCESS ) {
181
+ # $description = '<span class="description">' . __( 'The constant <code>SFML_ALLOW_LOGIN_ACCESS</code> is defined to <code>true</code>, the settings below won\'t take effect.', 'sf-move-login' ) . '</span>';
182
+ # Noop_fields::add_section_description( 'access', $description );
183
+ # wpml-name: 0b1058f191a430c5a9eca5a76381da3a
184
+ msgid "The constant <code>SFML_ALLOW_LOGIN_ACCESS</code> is defined to <code>true</code>, the settings below won't take effect."
185
+ msgstr "ה <code>SFML_ALLOW_LOGIN_ACCESS</code>הקבוע מוגדר ל <code>פועל</code>, ההגדרות שלהלן לא תשפענה."
186
+
187
+ # Noop_Settings::add_section( 'slugs', Noop_fields::section_icon('links') . __('Links') );
188
+ # Noop_Settings::add_section( 'access', Noop_fields::section_icon($is_new_admin ? 'admin-network' : 'site') . __('Access', 'sf-move-login') );
189
+ #
190
+ # wpml-name: bf733d8a933c1601697f364223fc7ecb
191
+ msgid "Access"
192
+ msgstr "גישה"
languages/sf-move-login-sr_RS.mo ADDED
Binary file
languages/sf-move-login-sr_RS.po ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LANGUAGE Serbo-Croatian translation for SF Move Login plugin for WordPress.
2
+ #
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: sf-move-login 1.1.4\n"
6
+ "Report-msgid -Bugs-To: Grégory Viguier <i18n@screenfeed.fr>\n"
7
+ "POT-Creation-Date: 2013-06-01 00:04+0100\n"
8
+ "PO-Revision-Date: 2014-12-15 22:19+0100\n"
9
+ "Last-Translator: Borisa Djuraskovic <borisad@webhostinghub.com>\n"
10
+ "Language-Team: sr_RS\n"
11
+ "MIME-Version: 1.0\n"
12
+ "Content-Type: text/plain; charset=utf-8\n"
13
+ "Content-Transfer-Encoding: 8bit\n"
14
+ "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
15
+ "X-Poedit-SourceCharset: utf-8\n"
16
+ "X-Poedit-KeywordsList: __;_e;_n\n"
17
+ "Language: sr_RS\n"
18
+ "X-Generator: Poedit 1.7.1\n"
19
+
20
+ # ---------------------------------------------------------------------------
21
+ # sf-move-login.php
22
+ msgid "Change your login url"
23
+ msgstr "Promenite svoj URL za prijavljivanje"
24
+
25
+ msgid "No no no, the login form is not here."
26
+ msgstr "Ne, ne, formular za prijavljivanje nije ovde."
27
+
28
+ # ---------------------------------------------------------------------------
29
+ # inc/noop.inc.php
30
+ msgid "The slug %s is forbidden."
31
+ msgid_plural "The slugs %s are forbidden."
32
+ msgstr[0] "Podloška %s je zabranjena."
33
+ msgstr[1] "Podloška %s je zabranjena."
34
+ msgstr[2] "Podloška %s je zabranjena."
35
+
36
+ msgid "The links can't have the same slugs."
37
+ msgstr "Linkovi ne mogu da imaju iste podloške."
38
+
39
+ # ---------------------------------------------------------------------------
40
+ # inc/admin.inc.php
41
+ msgid "Access"
42
+ msgstr "Pristup"
43
+
44
+ msgid "The constant <code>SFML_ALLOW_LOGIN_ACCESS</code> is defined to <code>true</code>, the settings below won't take effect."
45
+ msgstr "Konstanta <code>SFML_ALLOW_LOGIN_ACCESS</code> definisana je kao <code>istina</code>, podešavanja koja slede neće imati efekta."
46
+
47
+ msgid "Display an error message"
48
+ msgstr "Prikaži poruku da je došlo do greške"
49
+
50
+ msgid "Redirect to a &laquo;Page not found&raquo; error page"
51
+ msgstr "Preusmeri na &laquo;Stranica nije pronađena&raquo; stranica greške"
52
+
53
+ msgid "Redirect to the home page"
54
+ msgstr "Preusmeri na početnu stranicu"
55
+
56
+ msgid "When a not connected user attempts to access the old login page."
57
+ msgstr "Kad nepovezani korisnik pokuša da se prijavi na staru stranicu za prijavljivanje."
58
+
59
+ msgid "Administration area"
60
+ msgstr "Oblast administracije"
61
+
62
+ msgid "Do nothing, redirect to the new login page"
63
+ msgstr "Nemojte raditi ništa, preusmerite se na novu stranicu za prijavljivanje"
64
+
65
+ msgid "When a not connected user attempts to access the administration area."
66
+ msgstr "Kad nepovezani korisnik pokuša da pristupi administrativnoj oblasti."
67
+
68
+ msgid "%s File"
69
+ msgstr "%s datoteka"
70
+
71
+ msgid "If the plugin fails to add the new rewrite rules to your %1$s file on activation, 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:"
72
+ msgstr "Ako plugin ne uspe da doda nova pravila pisanja za vašu %1$s datoteku o aktivaciji, dodajte sledeće pravilo svojoj %1$s datoteci u %2$s zamenjujući druga %3$s pravila, ako postoje, <strong>iznad</strong>linije gde piše %4$s:"
73
+
74
+ # ---------------------------------------------------------------------------
75
+ # inc/plugins-list.inc.php
76
+ msgid "<strong>Move Login</strong> has not been activated."
77
+ msgstr "<strong>Premesti prijavljivanje</strong>nije aktivirano."
78
+
79
+ msgid "<strong>Move Login</strong> needs access to the %1$s file. Please visit the %2$s settings page and copy/paste the given code into the %1$s file."
80
+ msgstr "<strong>Premesti prijavljivanje</strong>zahteva pristup %1$s datoteci. Posetite %2$s stranicu podešavanja, kopirajte i nalepite dati kod u %1$s datoteku."
81
+
82
+ msgid "It seems your server configuration prevent the plugin to work properly. <strong>Move Login</strong> won't work."
83
+ msgstr "Izgleda da konfiguracija vašeg servera sprečava plugin da radi kako treba. <strong>Premesti prijavljivanje</strong> neće da radi."
84
+
85
+ msgid "It seems the url rewrite module is not activated on your server. <strong>Move Login</strong> won't work."
86
+ msgstr "Izgleda da modul za ponovno ispisivanje url-a nije aktiviran na vašem serveru. <strong>Premesti prijavljivanje</strong> neće da radi."
87
+
88
+ msgid "It seems your server does not use <i>Apache</i>, <i>Nginx</i>, nor <i>IIS7</i>. <strong>Move Login</strong> won't work."
89
+ msgstr "Izgleda da vaš server ne koristi <i>Apache</i>, <i>Nginx</i> niti <i>IIS7</i>. <strong>Premesti prijavljivanje</strong> neće da radi."
90
+
91
+ msgid "It seems your server uses a <i>Nginx</i> system, that I don't know at all. So I have to let you deal with the rewrite rules by yourself. Please visit the %2$s settings page and take a look at the rewrite rules used for a %1$s file. <strong>Move Login</strong> is running but won't work correctly until you deal with the rewrite rules."
92
+ msgstr "Izgleda da vaš server koristi <i>Nginx</i> koji uopšte ne poznajem. Moram vas pustiti da se sami izborite sa pravilima ponovnog pisanja. Posetite %2$s stranicu podešavanja i pogledajte pravila ponovnog pisanja koja se koriste za %1$s datoteku. <strong>Premesti prijavljivanje</strong> je pokrenuto, ali neće da radi kako treba dok ne rešite pravila za ponovno pisanje."
93
+
94
+ msgid "To enable the real settings page for Move Login, please install the plugin %1$s."
95
+ msgstr "Da biste aktivirali pravu stranicu podešavanja za ‘Premesti prijavljivanje’, instalirajte plugin %1$s."
96
+
97
+ msgid "To enable the real settings page for Move Login, please activate the plugin %2$s."
98
+ msgstr "Da biste aktivirali pravu stranicu podešavanja za ‘Premesti prijavljivanje’, aktivirajte plugin %2$s."
99
+
100
+ msgid "To enable the real settings page for Move Login, please upgrade the plugin %2$s to the version %3$s."
101
+ msgstr "Da biste aktivirali pravu stranicu podešavanja za ‘Premesti prijavljivanje’, nadogradite plugin %2$s na verziju %3$s."
102
+
103
+ msgid "It seems the plugin Noop is installed but doesn't work properly. To enable the real settings page for Move Login, please reinstall %1$s."
104
+ msgstr "Izgleda da je plugin Noop instaliran, ali ne radi kako treba. Da biste aktivirali pravu stranicu podešavanja za ‘Premesti prijavljivanje’, ponovo instalirajte %1$s."
readme.txt ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Move Login ===
2
+
3
+ Contributors: GregLone, SecuPress, juliobox
4
+ Tags: login, logout, url, security
5
+ Requires at least: 3.1
6
+ Tested up to: 4.1.1
7
+ Stable tag: trunk
8
+ License: GPLv3
9
+ License URI: http://www.screenfeed.fr/gpl-v3.txt
10
+
11
+ Change your login URL for something like <code>http://example.com/login</code> and stop login brute force attempts.
12
+
13
+
14
+ == Description ==
15
+
16
+ This plugin forbids access to **http://example.com/wp-login.php** and creates new urls, like **http://example.com/login** or **http://example.com/logout**.
17
+
18
+ This is a great way to limit bots trying to brute force your login (trying to guess your login and password). Of course, the new urls are easier to remember too.
19
+
20
+ Also remember: the use of this plugin does NOT exempt you to use a strong password. Moreover, never use "admin" as login, this is the first attempt for bots.
21
+
22
+ = Translations =
23
+
24
+ * US English
25
+ * French
26
+ * Serbo-Croatian (partial, thank you Borisa)
27
+ * Hebrew (partial, thank you Ahrale)
28
+
29
+ = Multisite =
30
+
31
+ Yep!
32
+ The plugin must be activated from your network.
33
+
34
+ = Requirements =
35
+
36
+ * See some important informations in the "Installation" tab (I mean it).
37
+ * Should work on IIS7+ servers but not tested (I guess you should probably save a copy of your `web.config` file before the plugin activation).
38
+ * For nginx servers, the rewrite rules are not written automatically of course, but provided as information.
39
+
40
+
41
+ == Installation ==
42
+
43
+ 1. Extract the plugin folder from the downloaded ZIP file.
44
+ 1. Upload the `sf-move-login` folder to your `/wp-content/plugins/` directory.
45
+ 1. If you have another plugin that makes redirections to **http://example.com/wp-login.php** (a short-links plugin for example), disable it or remove the redirection, otherwise they will conflict and you'll be locked out. See the faq in case you're not able to reach the login page (make sure to have a ftp access to your site).
46
+ 1. Activate the plugin from the "Plugins" page.
47
+ 1. If the plugin can't write your `.htaccess` file or `web.config` file, you'll need to edit it yourself with a ftp access, the rules are provided in the plugin settings page.
48
+
49
+
50
+ == Frequently Asked Questions ==
51
+
52
+ = Can I set my own urls? =
53
+
54
+ Since the version 1.1, yes. And since the version 2.0, you don't need any additional plugin for that.
55
+
56
+ = I'm locked out! I can't access the login page! =
57
+
58
+ You're screwed! No, I'm kidding, but you need a ftp access to your site. When logged in with your ftp software, open the file wp-config.php located at the root of your installation. Simply add this in the file: `define( 'SFML_ALLOW_LOGIN_ACCESS', true );` and save the file. This will bypass the plugin and you'll be able to access **http://example.com/wp-login.php**. Another plugin may conflict, you'll need to find which one before removing this new line of code.
59
+
60
+ = Does it really work for Multisite? =
61
+
62
+ Yes. Each blog has its own login page (but the customized slugs are the same for each blog though). The plugin must be activated from the network.
63
+
64
+ Eventually, try the [WordPress support forum](http://wordpress.org/support/plugin/sf-move-login) (best), or check out [my blog](http://www.screenfeed.fr/plugin-wp/move-login/ "Move Login") for more infos, help, or bug reports (sorry guys, it's in French, but feel free to leave a comment in English).
65
+
66
+
67
+ == Screenshots ==
68
+
69
+ 1. The settings page.
70
+
71
+
72
+ == Changelog ==
73
+
74
+ = 2.0.2 =
75
+
76
+ * 2015/02/24
77
+ * Same as below... Fingers crossed. >_>
78
+
79
+ = 2.0.1 =
80
+
81
+ * 2015/02/24
82
+ * Fixes a fatal error for multisites.
83
+
84
+ = 2.0 =
85
+
86
+ * 2015/02/22
87
+ * Most of the plugin has been rewritten.
88
+ * New: you don't need my framework Noop to have a settings page anymore (yes, you can uninstall it if it's not used elsewhere). ᕙ(⇀‸↼‶)ᕗ The bad news is there are no settings import/export/history anymore (and it won't come back). Make sure your settings are ok after upgrading.
89
+ * New: the plugin disable some WordPress native redirections to administration area and login page. For example, **http://example.com/dashboard/** was leading to **http://example.com/wp-admin/**. This should solve a bunch of bugs.
90
+ * New: the rewrite rules for nginx servers are now provided in the plugin settings page as information. Thank you [Milouze](https://wordpress.org/support/topic/for-nginx-server).
91
+ * Improvement: bugfix for IIS servers.
92
+ * Improvement: better French translations.
93
+ * Bugfix: fix double slash in network site url (used for lostpassword).
94
+
95
+ = 1.1.4 =
96
+
97
+ * 2014/04/28
98
+ * Plugins can now add their own action to Move Login more easily with the filter `sfml_additional_slugs`. Even without doing anything, Move Login handle custom actions added by other plugins, but the url can't be customisable. Now, these plugins can add a new input field to let users change this new url, and it's very simple.
99
+ * Side note: I've just released a new version for my framework Noop (1.0.6). Now you can import and export your settings via a file, see the new tab in the "Help" area.
100
+
101
+ = 1.1.3 =
102
+
103
+ * 2014/04/01
104
+ * Bugfix for php 5.4.
105
+
106
+ = 1.1.2 =
107
+
108
+ * 2014/03/29
109
+ * Bugfix: don't block users accessing the script `admin-post.php`.
110
+ * Changed i18n domain.
111
+ * If Noop is not installed, add a link in the "settings" page.
112
+ * Added a direct link to download Noop, some users may not be able to install plugins directly.
113
+ * Code improvements and small bugfixes.
114
+
115
+ = 1.1.1 =
116
+
117
+ * 2013/12/17
118
+ * Bugfix.
119
+
120
+ = 1.1 =
121
+
122
+ * 2013/12/16
123
+ * Code refactoring.
124
+ * Requires WordPress 3.1 at least.
125
+ * New: the URLs can be customized, with a filter or a settings page. The settings page needs another plugin to be installed, it's a framework I made (Noop). See the Move Login row in your plugins list, there's a new link.
126
+ * New: support for custom actions in the login form (added by other plugins).
127
+ * New: choose what to do when someone attempts to access the old login page.
128
+ * New: choose what to do when someone attempts to access the administration area.
129
+ * New: enabling permalinks is not required anymore.
130
+ * Todo: provide rewrite rules for Nginx systems.
131
+
132
+ = 1.0.1 =
133
+
134
+ * 2013/09/30
135
+ * Very minor bug fix: messed the author link -_-'
136
+
137
+ = 1.0 =
138
+
139
+ * 2013/09/20
140
+ * First stable version.
141
+ * New: 1 new action called `sfml_wp_login_error` is now available for the `wp-login.php` error message, you can use your own `wp_die()` or redirect to another error page for example.
142
+
143
+ = 1.0-RC2 =
144
+
145
+ * 2013/09/12
146
+ * Bugfix: activation for multisite with not writable .htaccess file, a wrong message was shown, preventing activation (was I drunk?).
147
+ * tested on multisite with subdomain.
148
+ * SecuPress is joining the project :)
149
+
150
+ = 1.0-RC1 =
151
+
152
+ * 2013/09/11
153
+ * New: Multisite support (must be "network" activated).
154
+ * Enhancement: updated the set_url_scheme() function to the one in WP 3.6.1 (used for WP < 3.4).
155
+ * Enhancement: better rewrite rules.
156
+ * Bugfix: The plugin rewrite rules are now really removed from the .htaccess file on deactivation.
157
+
158
+ = 0.1.1 =
159
+
160
+ * 2013/06/04
161
+ * Bugfix: php notice due to a missing parameter.
162
+ * Bugfix: incorrect network_site_url filter.
163
+
164
+ = 0.1 =
165
+
166
+ * 2013/06/03
167
+ * First public beta release
168
+ * Thanks to juliobox, who's joining the project :)
169
+
170
+
171
+ == Upgrade Notice ==
172
+
173
+ = 2.0 =
174
+ The framework Noop is not needed anymore: settings are included in the plugin. Make sure your settings are ok after upgrading.
175
+
176
+ = 1.0 =
177
+ This is the first stable version of the plugin.
sf-move-login.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Plugin Name: SF Move Login
4
+ * Plugin URI: http://www.screenfeed.fr/plugin-wp/move-login/
5
+ * Description: Change your login url
6
+ * Version: 2.0.2
7
+ * Author: Grégory Viguier
8
+ * Author URI: http://www.screenfeed.fr/
9
+ * License: GPLv3
10
+ * License URI: http://www.screenfeed.fr/gpl-v3.txt
11
+ * Network: true
12
+ * Text Domain: sf-move-login
13
+ * Domain Path: /languages/
14
+ */
15
+
16
+ if ( ! defined( 'ABSPATH' ) ) {
17
+ die( 'Cheatin\' uh?' );
18
+ }
19
+ if ( version_compare( $GLOBALS['wp_version'], '3.1', '<' ) ) {
20
+ return;
21
+ }
22
+
23
+ /* !---------------------------------------------------------------------------- */
24
+ /* ! CONSTANTS */
25
+ /* ----------------------------------------------------------------------------- */
26
+
27
+ define( 'SFML_VERSION', '2.0.2' );
28
+ define( 'SFML_FILE', __FILE__ );
29
+ define( 'SFML_PLUGIN_BASENAME', plugin_basename( SFML_FILE ) );
30
+ define( 'SFML_PLUGIN_DIR', plugin_dir_path( SFML_FILE ) );
31
+
32
+
33
+ /* !---------------------------------------------------------------------------- */
34
+ /* ! PLUGIN ACTIVATION */
35
+ /* ----------------------------------------------------------------------------- */
36
+
37
+ if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
38
+ include( SFML_PLUGIN_DIR . 'inc/activate.php' );
39
+ }
40
+
41
+
42
+ /* !---------------------------------------------------------------------------- */
43
+ /* ! INCLUDES */
44
+ /* ----------------------------------------------------------------------------- */
45
+
46
+ add_action( 'after_setup_theme', 'sfml_init', 11 );
47
+
48
+ function sfml_init() {
49
+ global $pagenow;
50
+
51
+ include( SFML_PLUGIN_DIR . 'inc/utilities.php' );
52
+
53
+ if ( ! class_exists( 'SFML_Options' ) ) {
54
+ include( SFML_PLUGIN_DIR . 'inc/class-sfml-options.php' );
55
+ }
56
+
57
+ // Administration
58
+ if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
59
+ include( SFML_PLUGIN_DIR . 'inc/admin.php' );
60
+ }
61
+
62
+ // !EMERGENCY BYPASS
63
+ if ( ! defined( 'SFML_ALLOW_LOGIN_ACCESS' ) || ! SFML_ALLOW_LOGIN_ACCESS ) {
64
+ include( SFML_PLUGIN_DIR . 'inc/url-filters.php' );
65
+ include( SFML_PLUGIN_DIR . 'inc/redirections-and-dies.php' );
66
+ }
67
+
68
+ }
69
+
70
+
71
+ /* !---------------------------------------------------------------------------- */
72
+ /* ! I18N SUPPORT */
73
+ /* ----------------------------------------------------------------------------- */
74
+
75
+ add_action( 'init', 'sfml_lang_init' );
76
+
77
+ function sfml_lang_init() {
78
+ load_plugin_textdomain( 'sf-move-login', false, basename( dirname( SFML_FILE ) ) . '/languages/' );
79
+ }
80
+
81
+ /**/
uninstall.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
3
+ die();
4
+ }
5
+
6
+
7
+ include( plugin_dir_path( __FILE__ ) . 'inc/class-sfml-options.php' );
8
+
9
+ delete_site_option( 'sfml_version' );
10
+ delete_site_option( SFML_Options::OPTION_NAME );
11
+
12
+ /**/