Move Login - Version 1.1.4

Version Description

  • 2014/04/28
  • 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.
  • Side note: I've just released a new version for my framework Noop (1.0.7). Now you can import and export your settings via a file, see the new tab in the "Help" area.
Download this release

Release Info

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

Version 1.1.4

inc/admin.inc.php ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( !defined( 'ABSPATH' ) )
3
+ die( 'Cheatin\' uh?' );
4
+
5
+ include( SFML_PLUGIN_DIR . 'inc/rewrite.inc.php' );
6
+
7
+
8
+ /* !---------------------------------------------------------------------------- */
9
+ /* ! PLUGIN SETTINGS PAGE WITH NOOP */
10
+ /* ----------------------------------------------------------------------------- */
11
+
12
+ // !Add fields
13
+
14
+ add_action( 'sfml_settings-sfml_add_fields', 'sfml_settings_fields', 10, 2 );
15
+
16
+ function sfml_settings_fields( $fields_args, $args ) {
17
+ // Sections
18
+ $is_new_admin = version_compare( $GLOBALS['wp_version'], '3.8', '>=' );
19
+ Noop_Settings::add_section( 'slugs', Noop_fields::section_icon('links') . __('Links') );
20
+ Noop_Settings::add_section( 'access', Noop_fields::section_icon($is_new_admin ? 'admin-network' : 'site') . __('Access', 'sf-move-login') );
21
+
22
+ // Fields
23
+ $fields = Noop_fields::get_instance( sfml_noop_params() );
24
+ $labels = sfml_slugs_fields_labels();
25
+
26
+ // Add a warning if the plugin is bypassed
27
+ if ( defined('SFML_ALLOW_LOGIN_ACCESS') && SFML_ALLOW_LOGIN_ACCESS ) {
28
+ $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>';
29
+ Noop_fields::add_section_description( 'access', $description );
30
+ }
31
+
32
+ foreach ( $labels as $action => $label ) {
33
+ Noop_Settings::add_field(
34
+ 'slugs.'.$action,
35
+ $label,
36
+ array( $fields, 'text_field' ),
37
+ 'slugs',
38
+ array(
39
+ 'label_for' => 'slugs.'.$action,
40
+ 'attributes' => array( 'pattern' => '[0-9a-z_-]*' ),
41
+ )
42
+ );
43
+ }
44
+
45
+ Noop_Settings::add_field(
46
+ 'deny_wp_login_access',
47
+ '<code>wp-login.php</code>',
48
+ array( $fields, 'radio_field' ),
49
+ 'access',
50
+ array(
51
+ 'label_for' => 'deny_wp_login_access',
52
+ 'values' => array(
53
+ 1 => __('Display an error message', 'sf-move-login'),
54
+ 2 => __('Redirect to a &laquo;Page not found&raquo; error page', 'sf-move-login'),
55
+ 3 => __('Redirect to the home page', 'sf-move-login'),
56
+ ),
57
+ 'next_under' => true,
58
+ 'label' => '<strong>' . __('When a not connected user attempts to access the old login page.', 'sf-move-login') . '</strong>',
59
+ )
60
+ );
61
+
62
+ Noop_Settings::add_field(
63
+ 'deny_admin_access',
64
+ __('Administration area', 'sf-move-login'),
65
+ array( $fields, 'radio_field' ),
66
+ 'access',
67
+ array(
68
+ 'label_for' => 'deny_admin_access',
69
+ 'values' => array(
70
+ 0 => __('Do nothing, redirect to the new login page', 'sf-move-login'),
71
+ 1 => __('Display an error message', 'sf-move-login'),
72
+ 2 => __('Redirect to a &laquo;Page not found&raquo; error page', 'sf-move-login'),
73
+ 3 => __('Redirect to the home page', 'sf-move-login'),
74
+ ),
75
+ 'next_under' => true,
76
+ 'label' => '<strong>' . __('When a not connected user attempts to access the administration area.', 'sf-move-login') . '</strong>',
77
+ )
78
+ );
79
+
80
+ // Credits tab in help
81
+ add_filter( 'move-login_contextual_credits_tab_title', '__return_false' );
82
+ add_filter( 'move-login_contextual_credits_tab_content', 'sfml_credits' );
83
+ }
84
+
85
+
86
+ // !Add the rewrite rules in a textarea
87
+
88
+ add_action( 'move-login_after_form', 'sfml_after_form' );
89
+
90
+ function sfml_after_form( $current_tab ) {
91
+ if ( $current_tab == 'sfml' ) {
92
+ global $is_iis7;
93
+ $file = $is_iis7 ? '<code>web.config</code>' : '<code>.htaccess</code>';
94
+ ?>
95
+ <div class='noop-form'>
96
+ <h3><?php echo Noop_fields::section_icon('tools') . sprintf( __('%s File', 'sf-move-login'), $file ); ?></h3>
97
+ <?php sfml_rewrite_rules_textarea(); ?>
98
+ </div>
99
+ <?php
100
+ }
101
+ }
102
+
103
+
104
+ // !A textarea displaying the rewrite rules. Used with or without Noop.
105
+
106
+ function sfml_rewrite_rules_textarea( $echo = true ) {
107
+ global $is_apache, $is_iis7, $is_nginx;
108
+ $is_nginx = is_null($is_nginx) ? (strpos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) : $is_nginx;
109
+ $rules = sfml_rules();
110
+
111
+ // IIS
112
+ if ( $is_iis7 ) {
113
+ $htaccess_file = implode( "\n", sf_iis7_rewrite_rules( $rules, 'SF Move Login' ) );
114
+ $height = 20;
115
+ $file = '<code>web.config</code>';
116
+ $above = '<code>&lt;rule name="WordPress Rule 1" stopProcessing="true"&gt;</code>';
117
+ }
118
+ // Apache
119
+ elseif( $is_apache || $is_nginx ) { // I don't know how nginx works, so at least, display some "wrong" infos.
120
+ $htaccess_file = "\n# BEGIN SF Move Login\n";
121
+ $htaccess_file .= implode( "\n", sf_htaccess_rewrite_rules( $rules ) );
122
+ $htaccess_file .= "\n# END SF Move Login\n";
123
+ $height = substr_count( $htaccess_file, "\n" );
124
+ $file = '<code>.htaccess</code>';
125
+ $above = '<code># BEGIN WordPress</code>';
126
+ }
127
+ else
128
+ return '';
129
+
130
+ // Message
131
+ $base = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
132
+ $document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );
133
+ $abspath_fix = str_replace( '\\', '/', ABSPATH );
134
+ $home_path = 0 === strpos( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : get_home_path();
135
+
136
+ $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";
137
+ $content .= '<textarea class="code readonly auto-select" readonly="readonly" cols="120" rows="' . $height . '">' . esc_textarea( $htaccess_file ) . "</textarea>\n";
138
+
139
+ wp_enqueue_script( 'noop-settings' );
140
+
141
+ // Get out
142
+ if ( !$echo )
143
+ return $content;
144
+ echo $content;
145
+ }
146
+
147
+
148
+ // !Credits
149
+
150
+ function sfml_credits( $credits ) {
151
+ $credits = array();
152
+ $credits[] = array( 'author' => 'Grégory Viguier (Screenfeed)', 'author_uri' => 'http://www.screenfeed.fr/' );
153
+ $credits[] = array( 'author' => 'Julio Potier (BoiteAWeb)', 'author_uri' => 'http://www.boiteaweb.fr/' );
154
+ $credits[] = array( 'author' => 'SecuPress', 'author_uri' => 'http://www.secupress.fr/' );
155
+ return $credits;
156
+ }
157
+
158
+
159
+ // !No debug metaboxes
160
+
161
+ add_filter( 'move-login_show_debug_metaboxes', '__return_false' );
162
+
163
+
164
+ /* !---------------------------------------------------------------------------- */
165
+ /* ! PLUGIN "SETTINGS" PAGE WITHOUT NOOP */
166
+ /* ----------------------------------------------------------------------------- */
167
+
168
+ add_action( 'init', 'sfml_handle_admin_menu' );
169
+
170
+ function sfml_handle_admin_menu() {
171
+ if ( sf_can_use_noop( SFML_NOOP_VERSION ) )
172
+ return;
173
+
174
+ $prefix = is_multisite() ? 'network_' : '';
175
+ add_action( $prefix . 'admin_menu', 'sfml_admin_menu' );
176
+ }
177
+
178
+
179
+ function sfml_admin_menu() {
180
+ $page = is_multisite() ? 'settings.php' : 'options-general.php';
181
+ $cap = is_multisite() ? 'manage_network_options' : 'manage_options';
182
+ add_submenu_page( $page, 'Move Login', 'Move Login', $cap, 'move-login', 'sfml_settings_page' );
183
+ }
184
+
185
+
186
+ function sfml_settings_page() {
187
+ global $title, $wpdb; ?>
188
+ <div class="wrap">
189
+ <?php screen_icon('tools'); ?>
190
+ <h2><?php echo esc_html( $title ); ?></h2>
191
+
192
+ <?php
193
+ sfml_rewrite_rules_textarea();
194
+
195
+ if ( !file_exists( path_join(WP_PLUGIN_DIR, 'noop/noop.php') ) ) {
196
+
197
+ if ( !function_exists('sf_pull_noop_info') ) {
198
+ include( SFML_PLUGIN_DIR . 'inc/noop-infos.inc.php' );
199
+ }
200
+
201
+ echo '<p>' . sprintf(
202
+ __( 'To enable the real settings page for Move Login, please install the plugin %1$s (can also be %4$s).', 'sf-move-login' ),
203
+ sf_plugin_install_link( 'noop', 'Noop', is_multisite() ? 'multi' : 'mono' ),
204
+ null,
205
+ null,
206
+ '<a href="' . sfml_noop_download_url() . '">' . __( 'downloaded separately', 'sf-move-login' ) . '</a>'
207
+ ) . "</p>\n";
208
+ }
209
+ ?>
210
+ </div>
211
+ <?php
212
+ }
213
+
214
+
215
+ /* --------------------------------------------------------------------------------- */
216
+ /* ! TOOLS */
217
+ /* --------------------------------------------------------------------------------- */
218
+
219
+ /*
220
+ * Return a plugin installation link.
221
+ * @param (string) $plugin_slug: "my-plugin" (from the dirname).
222
+ * @param (string) $plugin_name: "My Plugin".
223
+ * @param (string) $activation_type: "multi" to force network activation, "mono" to force monosite activation. Default to false: automatic, depending on the context.
224
+ * @return (string) The link tag.
225
+ */
226
+ if ( !function_exists('sf_plugin_install_link') ):
227
+ function sf_plugin_install_link( $plugin_slug, $plugin_name, $activation_type = false ) {
228
+ $url = 'update.php?action=install-plugin&plugin=' . $plugin_slug;
229
+
230
+ if ( $activation_type !== 'multi' && $activation_type !== 'mono' ) {
231
+ $activation_type = is_network_admin() ? 'multi' : 'mono';
232
+ }
233
+ if ( $activation_type === 'multi' && current_user_can('manage_network_plugins') ) {
234
+ $url = network_admin_url( $url );
235
+ }
236
+ elseif ( $activation_type === 'mono' && current_user_can('install_plugins') ) {
237
+ $url = admin_url( $url );
238
+ }
239
+ else {
240
+ return '<strong>' . $plugin_name . '</strong>';
241
+ }
242
+
243
+ $url = wp_nonce_url( $url, 'install-plugin_' . $plugin_slug );
244
+
245
+ return '<a href="' . $url . '" title="' . sprintf( esc_attr__('Install %s'), $plugin_name ) . '" class="install-now">' . $plugin_name . '</a>';
246
+ }
247
+ endif;
248
+
249
+
250
+ /*
251
+ * Return a plugin activation link.
252
+ * @param (string) $plugin_path: "my-plugin/my-plugin-file.php".
253
+ * @param (string) $plugin_name: "My Plugin".
254
+ * @param (string) $activation_type: "multi" to force network activation, "mono" to force monosite activation. Default to false: automatic, depending on the context.
255
+ * @return (string) The link tag.
256
+ */
257
+ if ( !function_exists('sf_plugin_activation_link') ):
258
+ function sf_plugin_activation_link( $plugin_path, $plugin_name, $activation_type = false ) {
259
+ if ( $activation_type !== 'multi' && $activation_type !== 'mono' ) {
260
+ $activation_type = is_network_admin() ? 'multi' : 'mono';
261
+ }
262
+ if ( $activation_type === 'multi' && current_user_can('manage_network_plugins') ) {
263
+ $title_tag = esc_attr__('Activate this plugin for all sites in this network');
264
+ }
265
+ elseif ( $activation_type === 'mono' && current_user_can('activate_plugins') ) {
266
+ $title_tag = esc_attr__('Activate this plugin');
267
+ }
268
+ else {
269
+ return '<strong>' . $plugin_name . '</strong>';
270
+ }
271
+
272
+ $plugin_path = trim( $plugin_path, '/' );
273
+ $url = 'plugins.php?action=activate&plugin=' . $plugin_path;
274
+ $url = $activation_type === 'multi' ? network_admin_url( $url ) : admin_url( $url );
275
+ $url = wp_nonce_url( $url, 'activate-plugin_' . $plugin_path );
276
+
277
+ return '<a href="' . $url . '" title="' . $title_tag . '" class="edit">' . $plugin_name . '</a>';
278
+ }
279
+ endif;
280
+
281
+
282
+ function sfml_noop_download_url() {
283
+ static $url;
284
+ if ( empty( $url ) ) {
285
+ $url = 'http://www.screenfeed.fr/downloads/noop/?ver=' . time();
286
+ }
287
+ return $url;
288
+ }
289
+ /**/
inc/noop-infos.inc.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( !defined( 'ABSPATH' ) )
3
+ die( 'Cheatin\' uh?' );
4
+
5
+ /*
6
+ * To include this file, tou can use this:
7
+ * if ( is_admin() && ( $pagenow == 'plugins.php' || $pagenow == 'update-core.php' || $pagenow == 'update.php' || $pagenow == 'plugin-install.php' ) ) {
8
+ * include( 'path/to/noop-infos.inc.php' );
9
+ * }
10
+ */
11
+
12
+ /* !---------------------------------------------------------------------------- */
13
+ /* ! HACK THE RETURNED OBJECT */
14
+ /* ----------------------------------------------------------------------------- */
15
+
16
+ if ( !function_exists('sf_pull_noop_info') ):
17
+ add_filter( 'plugins_api', 'sf_pull_noop_info', 10, 3 );
18
+
19
+ function sf_pull_noop_info( $res, $action, $args ) {
20
+ if ( $action == 'plugin_information' && $args->slug == 'noop' ) {
21
+ return sf_remote_retrieve_body( sf_remote_plugin_infos( $args ) );
22
+ }
23
+ return $res;
24
+ }
25
+ endif;
26
+
27
+
28
+ /* !---------------------------------------------------------------------------- */
29
+ /* ! UTILITIES */
30
+ /* ----------------------------------------------------------------------------- */
31
+
32
+ // !Call home
33
+
34
+ if ( !function_exists('sf_remote_plugin_infos') ) :
35
+ function sf_remote_plugin_infos( $request ) {
36
+ return wp_remote_post(
37
+ 'http://www.screenfeed.fr/downloads/',
38
+ array( 'timeout' => 30, 'body' => array( 'action' => 'plugin_information', 'request' => serialize( (array) $request ) ) )
39
+ );
40
+ }
41
+ endif;
42
+
43
+
44
+ // !Deal with sf_remote_plugin_infos() result
45
+
46
+ if ( !function_exists('sf_remote_retrieve_body') ) :
47
+ function sf_remote_retrieve_body( $response ) {
48
+ $error_msg = sprintf(
49
+ __( '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' ),
50
+ 'http://www.screenfeed.fr/blog/'
51
+ );
52
+
53
+ if ( is_wp_error( $response ) ) {
54
+ return new WP_Error(
55
+ 'plugins_api_failed',
56
+ $error_msg,
57
+ $response->get_error_message()
58
+ );
59
+ }
60
+
61
+ $response = wp_unslash( wp_remote_retrieve_body( $response ) );
62
+ if ( is_serialized( $response ) )
63
+ return (object) @unserialize( $response );
64
+
65
+ return new WP_Error( 'plugins_api_failed', $error_msg, $response );
66
+ }
67
+ endif;
68
+
69
+
70
+ // For WP < 3.6
71
+ if ( !function_exists('wp_unslash') ) :
72
+ function wp_unslash( $value ) {
73
+ return stripslashes_deep( $value );
74
+ }
75
+ endif;
76
+ /**/
inc/noop.inc.php ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( !defined( 'ABSPATH' ) )
3
+ die( 'Cheatin\' uh?' );
4
+
5
+ /* !---------------------------------------------------------------------------- */
6
+ /* ! NOOP PARAMS */
7
+ /* ----------------------------------------------------------------------------- */
8
+
9
+ // !Return all settings for Noop.
10
+
11
+ function sfml_noop_params() {
12
+ $sets = array(
13
+ 'option_name' => 'sfml',
14
+ 'option_group' => 'sfml_settings',
15
+
16
+ 'page_name' => 'move-login',
17
+ 'page_parent_name' => 'settings',
18
+ 'page_parent' => 'options-general.php',
19
+ 'capability' => 'manage_options',
20
+
21
+ 'plugin_page_title' => 'Move Login',
22
+ 'plugin_menu_name' => 'Move Login',
23
+ 'plugin_file' => SFML_FILE,
24
+ 'plugin_logo_url' => SFML_PLUGIN_URL . 'res/icon.png',
25
+
26
+ 'support_image' => SFML_PLUGIN_URL . 'res/support.jpg',
27
+ 'support_url' => 'https://wordpress.org/support/plugin/sf-move-login',
28
+ );
29
+
30
+ if ( is_multisite() ) {
31
+ $sets['page_parent'] = 'settings.php';
32
+ $sets['capability'] = 'manage_network_options';
33
+ $sets['network_menu'] = true;
34
+ }
35
+
36
+ return $sets;
37
+ }
38
+
39
+
40
+ /* !---------------------------------------------------------------------------- */
41
+ /* ! PLUGIN OPTIONS */
42
+ /* ----------------------------------------------------------------------------- */
43
+
44
+ // !Default options
45
+
46
+ add_filter( 'sfml_default_options', 'sfml_default_options' );
47
+
48
+ function sfml_default_options( $options = array() ) {
49
+ $options = array_merge( $options, array(
50
+ 'slugs.postpass' => 'postpass',
51
+ 'slugs.logout' => 'logout',
52
+ 'slugs.lostpassword' => 'lostpassword',
53
+ 'slugs.retrievepassword' => 'retrievepassword',
54
+ 'slugs.resetpass' => 'resetpass',
55
+ 'slugs.rp' => 'rp',
56
+ 'slugs.register' => 'register',
57
+ 'slugs.login' => 'login',
58
+ 'deny_wp_login_access' => 1,
59
+ 'deny_admin_access' => 0,
60
+ ) );
61
+
62
+ // Plugins can add their own action
63
+ $additional_slugs = apply_filters( 'sfml_additional_slugs', array() );
64
+ if ( !empty( $additional_slugs ) ) {
65
+ foreach ( $additional_slugs as $slug => $label ) {
66
+ if ( empty( $options['slugs.' . $slug] ) ) {
67
+ $options['slugs.' . $slug] = $slug;
68
+ }
69
+ }
70
+ }
71
+ return $options;
72
+ }
73
+
74
+
75
+ // !Escape functions (display)
76
+
77
+ add_filter( 'sfml_escape_functions', 'sfml_escape_functions' );
78
+
79
+ function sfml_escape_functions( $functions = array() ) {
80
+ $func_sanitize_title = array( 'function' => 'sanitize_title', 'params' => array( '', 'display' ) );
81
+ $func_intval = array( 'function' => 'intval' );
82
+
83
+ $functions = array_merge( $functions, array(
84
+ 'slugs.postpass' => $func_sanitize_title,
85
+ 'slugs.logout' => $func_sanitize_title,
86
+ 'slugs.lostpassword' => $func_sanitize_title,
87
+ 'slugs.retrievepassword' => $func_sanitize_title,
88
+ 'slugs.resetpass' => $func_sanitize_title,
89
+ 'slugs.rp' => $func_sanitize_title,
90
+ 'slugs.register' => $func_sanitize_title,
91
+ 'slugs.login' => $func_sanitize_title,
92
+ 'deny_wp_login_access' => $func_intval,
93
+ 'deny_admin_access' => $func_intval,
94
+ ) );
95
+
96
+ // Plugins can add their own action
97
+ $additional_slugs = apply_filters( 'sfml_additional_slugs', array() );
98
+ if ( !empty( $additional_slugs ) ) {
99
+ foreach ( $additional_slugs as $slug => $label ) {
100
+ if ( empty( $functions['slugs.' . $slug] ) ) {
101
+ $functions['slugs.' . $slug] = $func_sanitize_title;
102
+ }
103
+ }
104
+ }
105
+ return $functions;
106
+ }
107
+
108
+
109
+ // !Sanitization functions (save)
110
+
111
+ add_filter( 'sfml_sanitization_functions', 'sfml_sanitization_functions' );
112
+
113
+ function sfml_sanitization_functions( $functions = array() ) {
114
+ $func_sanitize_title = array( 'function' => 'sanitize_title' );
115
+ $func_intval = array( 'function' => 'intval' );
116
+
117
+ $functions = array_merge( $functions, array(
118
+ 'slugs.postpass' => $func_sanitize_title,
119
+ 'slugs.logout' => $func_sanitize_title,
120
+ 'slugs.lostpassword' => $func_sanitize_title,
121
+ 'slugs.retrievepassword' => $func_sanitize_title,
122
+ 'slugs.resetpass' => $func_sanitize_title,
123
+ 'slugs.rp' => $func_sanitize_title,
124
+ 'slugs.register' => $func_sanitize_title,
125
+ 'slugs.login' => $func_sanitize_title,
126
+ 'deny_wp_login_access' => $func_intval,
127
+ 'deny_admin_access' => $func_intval,
128
+ ) );
129
+
130
+ // Plugins can add their own action
131
+ $additional_slugs = apply_filters( 'sfml_additional_slugs', array() );
132
+ if ( !empty( $additional_slugs ) ) {
133
+ foreach ( $additional_slugs as $slug => $label ) {
134
+ if ( empty( $functions['slugs.' . $slug] ) ) {
135
+ $functions['slugs.' . $slug] = $func_sanitize_title;
136
+ }
137
+ }
138
+ }
139
+ return $functions;
140
+ }
141
+
142
+
143
+ // !Validate Settings on update
144
+
145
+ add_filter( 'sfml_validate_settings', 'sfml_validate_settings', 10, 3 );
146
+
147
+ function sfml_validate_settings( $opts, $default_options, $context ) {
148
+ if ( strpos($context, 'save-') === 0 ) {
149
+ $slugs = Noop_Options::get_sub_options( 'slugs', $opts );
150
+ if ( count( $slugs ) ) {
151
+ $error = false;
152
+ $singles = array();
153
+ $forbidden = array();
154
+ $exclude = array_diff_key( $slugs, sfml_slugs_fields_labels() ); // postpass, retrievepassword, rp
155
+
156
+ foreach ( $slugs as $action => $slug ) {
157
+ if ( isset($exclude[$action]) )
158
+ continue;
159
+ // Forbidden slugs
160
+ if ( isset($exclude[$slug]) ) {
161
+ $opts['slugs.'.$action] = $default_options['slugs.'.$action];
162
+ $forbidden[] = $slug;
163
+ continue;
164
+ }
165
+ // Duplicate slugs
166
+ if ( isset($singles[$slug]) ) {
167
+ $opts['slugs.'.$action] = $default_options['slugs.'.$action];
168
+ $error = true;
169
+ } else
170
+ $singles[$slug] = 1;
171
+ }
172
+
173
+ // Trigger errors
174
+ if ( $context == 'save-form' ) {
175
+ if ( $nbr_forbidden = count($forbidden) )
176
+ 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>', $forbidden) ) );
177
+ if ( $error )
178
+ add_settings_error( 'sfml_settings', 'duplicates-slugs', __("The links can't have the same slugs.", 'sf-move-login') );
179
+ }
180
+
181
+ // Write the new rules (they're not saved in the db yet)
182
+ if ( !function_exists('sfml_write_rules') )
183
+ include( SFML_PLUGIN_DIR . 'inc/rewrite.inc.php' );
184
+
185
+ sfml_write_rules( sfml_rules( Noop_Options::get_sub_options( 'slugs', $opts ) ) );
186
+ }
187
+ }
188
+ return $opts;
189
+ }
190
+
191
+
192
+ /* !---------------------------------------------------------------------------- */
193
+ /* ! UTILITIES */
194
+ /* ----------------------------------------------------------------------------- */
195
+
196
+ // !Fields labels (for the slugs)
197
+
198
+ function sfml_slugs_fields_labels() {
199
+ $labels = array(
200
+ 'login' => __('Log in'),
201
+ 'logout' => __('Log out'),
202
+ 'register' => __('Register'),
203
+ 'lostpassword' => __('Lost Password'),
204
+ 'resetpass' => __('Password Reset'),
205
+ );
206
+
207
+ // Plugins can add their own action
208
+ $additional_slugs = apply_filters( 'sfml_additional_slugs', array() );
209
+ if ( !empty( $additional_slugs ) ) {
210
+ $additional_slugs = array_diff_key( $additional_slugs, $labels );
211
+ $labels = array_merge( $labels, $additional_slugs );
212
+ }
213
+ return $labels;
214
+ }
215
+
216
+
217
+ /* !---------------------------------------------------------------------------- */
218
+ /* ! NOOP INIT */
219
+ /* ----------------------------------------------------------------------------- */
220
+
221
+ if ( !function_exists('noop_includes') )
222
+ include( NOOP_DIR . 'includes.php' );
223
+
224
+
225
+ noop_includes( sfml_noop_params() );
226
+ /**/
inc/plugins-list.inc.php ADDED
@@ -0,0 +1,357 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( !defined( 'ABSPATH' ) )
3
+ die( 'Cheatin\' uh?' );
4
+
5
+ /* !---------------------------------------------------------------------------- */
6
+ /* ! ACTIVATION */
7
+ /* ----------------------------------------------------------------------------- */
8
+
9
+ // !Activate
10
+
11
+ // Trigger wp_die() on plugin activation, set a transient for admin notices
12
+ function sfml_activate() {
13
+ global $is_apache, $is_iis7, $is_nginx;
14
+ $is_nginx = is_null($is_nginx) ? (strpos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) : $is_nginx;
15
+ $dies = array();
16
+ $notices = array();
17
+
18
+ // The plugin needs the request uri
19
+ if ( empty($GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI']) && empty($_SERVER['REQUEST_URI']) )
20
+ $dies[] = 'error_no_request_uri';
21
+
22
+ // IIS7
23
+ if ( $is_iis7 && !iis7_supports_permalinks() )
24
+ $dies[] = 'error_no_mod_rewrite';
25
+
26
+ // Apache
27
+ elseif ( $is_apache && !got_mod_rewrite() )
28
+ $dies[] = 'error_no_mod_rewrite';
29
+
30
+ // None
31
+ elseif ( !$is_iis7 && !$is_apache && !$is_nginx )
32
+ $dies[] = 'error_no_apache_nor_ii7';
33
+
34
+ // Do not trigger the die()s if it isn't the plugin activation (also triggered for Noop activation/deactivation and the plugin upgrade)
35
+ if ( strpos( current_filter(), 'activate_'.SFML_PLUGIN_BASENAME ) === false ) {
36
+ $notices = array_merge($notices, $dies);
37
+ $dies = array();
38
+ }
39
+
40
+ // die()s
41
+ if ( count( $dies ) ) {
42
+
43
+ load_plugin_textdomain( 'sf-move-login', false, SFML_PLUGIN_BASEDIR . '/languages/' );
44
+
45
+ $dies = array_filter( array_map( 'sfml_notice_message', $dies ) );
46
+ $die_msg = __('<strong>Move Login</strong> has not been activated.', 'sf-move-login').'<br/>';
47
+ wp_die( $die_msg.implode('<br/>', $dies), __('Error'), array('back_link' => true) );
48
+
49
+ }
50
+ // Notices + rewrite rules
51
+ // The new notices and the rules rewriting are way easier to deal with after redirection. See sfml_notices().
52
+ else {
53
+
54
+ set_transient('sfml_notices-'.get_current_user_id(), $notices);
55
+
56
+ }
57
+ }
58
+
59
+ register_activation_hook( SFML_FILE, 'sfml_activate' );
60
+
61
+
62
+ // !Update rewrite rules on Noop activation/deactivation
63
+
64
+ function sfml_noop_activate() {
65
+ if ( sf_can_use_noop( SFML_NOOP_VERSION ) )
66
+ sfml_activate();
67
+ }
68
+
69
+ register_activation_hook( dirname(SFML_PLUGIN_DIR).'/noop/noop.php', 'sfml_noop_activate' );
70
+ register_deactivation_hook( dirname(SFML_PLUGIN_DIR).'/noop/noop.php', 'sfml_noop_activate' );
71
+
72
+
73
+ /* !---------------------------------------------------------------------------- */
74
+ /* ! DEACTIVATION */
75
+ /* ----------------------------------------------------------------------------- */
76
+
77
+ function sfml_deactivate() {
78
+ global $is_apache, $is_iis7;
79
+ // IIS
80
+ if ( $is_iis7 )
81
+ sf_insert_iis7_rewrite_rules( 'SF Move Login' ); // Empty content
82
+ // Apache
83
+ elseif ( $is_apache )
84
+ sf_insert_htaccess_rewrite_rules( 'SF Move Login' ); // Empty content
85
+ }
86
+
87
+ register_deactivation_hook( SFML_FILE, 'sfml_deactivate' );
88
+
89
+
90
+ /* !---------------------------------------------------------------------------- */
91
+ /* ! UNINSTALL */
92
+ /* ----------------------------------------------------------------------------- */
93
+
94
+ function sfml_uninstall() {
95
+ if ( sf_can_use_noop( SFML_NOOP_VERSION ) ) {
96
+ if ( !class_exists('Noop_Options') )
97
+ include( NOOP_DIR . 'libs/class-noop-options.php' );
98
+
99
+ // Delete options and users preferences
100
+ Noop_Options::uninstall( 'sfml', 'settings', 'move-login' );
101
+ }
102
+ delete_option( 'sfml_version' );
103
+ }
104
+
105
+ register_uninstall_hook( SFML_FILE, 'sfml_uninstall' );
106
+
107
+
108
+ /* !---------------------------------------------------------------------------- */
109
+ /* ! UPGRADE */
110
+ /* ----------------------------------------------------------------------------- */
111
+
112
+ add_action( 'load-plugins.php', 'sfml_upgrade' );
113
+
114
+ function sfml_upgrade() {
115
+
116
+ $db_version = get_option( 'sfml_version' );
117
+ if ( $db_version && !version_compare( $db_version, SFML_VERSION ) )
118
+ return;
119
+
120
+ sfml_activate();
121
+
122
+ // Old version compat (1.0.1)
123
+ if ( !$db_version )
124
+ flush_rewrite_rules();
125
+
126
+ update_option( 'sfml_version', SFML_VERSION );
127
+ }
128
+
129
+
130
+ /* !---------------------------------------------------------------------------- */
131
+ /* ! ADMIN NOTICES + UPDATE REWRITE RULES */
132
+ /* ----------------------------------------------------------------------------- */
133
+
134
+ // !Admin notices
135
+
136
+ add_action( 'all_admin_notices', 'sfml_notices' );
137
+
138
+ function sfml_notices() {
139
+ global $pagenow;
140
+ if ( $pagenow != 'plugins.php' )
141
+ return;
142
+
143
+ // Get previous notices
144
+ $user_id = get_current_user_id();
145
+ $notices = get_transient('sfml_notices-'.$user_id);
146
+
147
+ // If it's an array (even empty), that means it's a Move Login activation or a Noop (de)activation
148
+ if ( is_array($notices) ) {
149
+ global $is_apache, $is_iis7, $is_nginx;
150
+ $is_nginx = is_null($is_nginx) ? (strpos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) : $is_nginx;
151
+ $home_path = get_home_path();
152
+
153
+ // IIS7
154
+ if ( $is_iis7 && iis7_supports_permalinks() && !( ( !file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') ) )
155
+ $notices[] = 'error_file_not_writable';
156
+
157
+ // Apache
158
+ elseif ( $is_apache && got_mod_rewrite() && !( ( !file_exists($home_path . '.htaccess') && is_writable($home_path) ) || is_writable($home_path . '.htaccess') ) )
159
+ $notices[] = 'error_file_not_writable';
160
+
161
+ // Nginx
162
+ elseif ( $is_nginx )
163
+ $notices[] = 'updated_is_nginx';
164
+
165
+ // Noop
166
+ if ( get_noop_status( SFML_NOOP_VERSION ) != 'ok' )
167
+ $notices[] = 'updated_no_noop';
168
+
169
+ // Display notices
170
+ if ( count($notices) ) {
171
+
172
+ $messages = array();
173
+ foreach ( $notices as $notice ) {
174
+ $messages[substr($notice, 0, strpos($notice, '_'))][] = sfml_notice_message( $notice );
175
+ }
176
+
177
+ $messages = array_map( 'array_filter', $messages );
178
+ $messages = array_filter( $messages );
179
+ foreach ( $messages as $class => $message ) {
180
+ if ( !empty($message) )
181
+ echo '<div class="'.$class.'"><p>'.implode('<br/>', $message).'</p></div>';
182
+ }
183
+
184
+ }
185
+ delete_transient('sfml_notices-'.$user_id);
186
+
187
+ // Update rewrite rules. Will instanciate Noop too.
188
+ sfml_write_rules();
189
+ }
190
+ }
191
+
192
+
193
+ // !Messages used for notices and die()s
194
+
195
+ function sfml_notice_message( $k ) {
196
+ static $messages;
197
+
198
+ if ( is_null( $messages ) ) {
199
+ global $is_iis7;
200
+ $file = $is_iis7 ? '<code>web.config</code>' : '<code>.htaccess</code>';
201
+ $link = '<a href="' . ( is_multisite() ? network_admin_url( 'settings.php?page=move-login' ) : admin_url( 'options-general.php?page=move-login' ) ) . '">Move Login</a>';
202
+ $status = sfml_get_noop_status_text(); // Message if Noop is not running
203
+
204
+ $messages = array(
205
+ '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 ),
206
+ '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'),
207
+ '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'),
208
+ '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'),
209
+ 'updated_no_noop' => $status,
210
+ '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 ),
211
+ );
212
+ }
213
+
214
+ return isset( $messages[$k] ) ? $messages[$k] : '';
215
+ }
216
+
217
+
218
+ /* !---------------------------------------------------------------------------- */
219
+ /* ! LINK IN THE PLUGINS LIST PAGE + INSTALL NOOP */
220
+ /* ----------------------------------------------------------------------------- */
221
+
222
+ // !Link to the plugin "settings" page if Noop is not installed
223
+
224
+ add_filter( 'plugin_action_links_'.SFML_PLUGIN_BASENAME, 'sfml_settings_action_links', 10, 2 );
225
+ add_filter( 'network_admin_plugin_action_links_'.SFML_PLUGIN_BASENAME, 'sfml_settings_action_links', 10, 2 );
226
+
227
+ function sfml_settings_action_links( $links, $file ) {
228
+ if ( !sf_can_use_noop( SFML_NOOP_VERSION ) )
229
+ $links['settings'] = '<a href="' . ( is_multisite() ? network_admin_url( 'settings.php?page=move-login' ) : admin_url( 'options-general.php?page=move-login' ) ) . '">' . __("Settings") . '</a>';
230
+ return $links;
231
+ }
232
+
233
+
234
+ // !Link to download Noop if not installed
235
+
236
+ add_filter( 'plugin_row_meta', 'sfml_plugin_row_meta', PHP_INT_MAX, 4 );
237
+
238
+ function sfml_plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data = false, $status = false ) {
239
+ if ( $plugin_file === SFML_PLUGIN_BASENAME ) {
240
+
241
+ if ( $status_text = sfml_get_noop_status_text() ) {
242
+ $plugin_meta[] = $status_text;
243
+ }
244
+
245
+ }
246
+ return $plugin_meta;
247
+ }
248
+
249
+
250
+ // !The link for Noop will need the Noop infos
251
+
252
+ add_action( 'setup_theme', 'sfml_noop_infos' );
253
+
254
+ function sfml_noop_infos() {
255
+ if ( function_exists('sf_pull_noop_info') ) {
256
+ return;
257
+ }
258
+
259
+ $status = get_noop_status( SFML_NOOP_VERSION );
260
+ if ( $status == 'required' || $status == 'corrupted' ) {
261
+ include( SFML_PLUGIN_DIR . 'inc/noop-infos.inc.php' );
262
+ }
263
+ }
264
+
265
+
266
+ /* !---------------------------------------------------------------------------- */
267
+ /* ! SHOW EVERY AUTHORS ON THE PLUGIN PAGE */
268
+ /* ----------------------------------------------------------------------------- */
269
+
270
+ add_filter( 'plugin_row_meta', 'sfml_authors_plugin_row_meta', 10, 2 );
271
+
272
+ function sfml_authors_plugin_row_meta( $plugin_meta, $plugin_file ) {
273
+ if ( SFML_PLUGIN_BASENAME !== $plugin_file )
274
+ return $plugin_meta;
275
+
276
+ $links = '<a href="http://www.screenfeed.fr/greg/" title="' . esc_attr__( 'Visit author homepage' ) . '">Grégory Viguier</a>';
277
+ $link_pos = array_search( sprintf( __( 'By %s' ), $links ), $plugin_meta );
278
+ if ( $link_pos === false )
279
+ return $plugin_meta;
280
+
281
+ $links = (array) $links;
282
+ $authors = array(
283
+ array( 'name' => 'Julio Potier', 'url' => 'http://www.boiteaweb.fr' ),
284
+ array( 'name' => 'SecuPress', 'url' => 'http://blog.secupress.fr' ),
285
+ );
286
+
287
+ foreach( $authors as $author ) {
288
+ $links[] = '<a href="' . $author['url'] . '" title="' . esc_attr__( 'Visit author homepage' ) . '">' . $author['name'] . '</a>';
289
+ }
290
+
291
+ $links = sprintf( __( 'By %s' ), wp_sprintf( '%l', $links ) );
292
+ $plugin_meta[$link_pos] = $links;
293
+
294
+ return $plugin_meta;
295
+ }
296
+
297
+
298
+ /* !---------------------------------------------------------------------------- */
299
+ /* ! UTILITIES */
300
+ /* ----------------------------------------------------------------------------- */
301
+
302
+ // !Get Noop status (installed, inactive, etc)
303
+
304
+ if ( !function_exists('get_noop_status') ) :
305
+ function get_noop_status( $required_version ) {
306
+ if ( !defined('NOOP_DIR') ) {
307
+ global $plugins;
308
+
309
+ // Noop is installed and active, there's a problem
310
+ if ( isset($plugins['active']['noop/noop.php']) || isset($plugins['mustuse']['noop.php']) )
311
+ return 'corrupted';
312
+ // Noop is inactive
313
+ elseif ( isset($plugins['inactive']['noop/noop.php']) )
314
+ return 'inactive';
315
+ // Noop is not installed
316
+ else
317
+ return 'required';
318
+ }
319
+ // Check Noop version
320
+ elseif ( !defined('NOOP_VERSION') || version_compare( NOOP_VERSION, $required_version, '<' ) )
321
+ return 'upgrade';
322
+
323
+ return 'ok';
324
+ }
325
+ endif;
326
+
327
+
328
+ function sfml_get_noop_status_text() {
329
+ $status_text = '';
330
+ $noop_status = get_noop_status( SFML_NOOP_VERSION );
331
+ $messages = array(
332
+ 'ok' => false,
333
+ 'required' => __( 'To enable the real settings page for Move Login, please install the plugin %1$s (can also be %4$s).', 'sf-move-login' ),
334
+ 'inactive' => __( 'To enable the real settings page for Move Login, please activate the plugin %2$s.', 'sf-move-login' ),
335
+ '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' ),
336
+ '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' ),
337
+ );
338
+
339
+ // Add the message
340
+ if ( !empty($messages[$noop_status]) ) {
341
+
342
+ $multi = is_multisite() ? 'multi' : 'mono'; // On multisite, Noop must be "network activated" because SF Move Login is. Since the link can be displayed anywhere, we have to force it to "network".
343
+ $link = sf_plugin_install_link( 'noop', 'Noop', $multi );
344
+ $noop_link = sf_plugin_activation_link( 'noop/noop.php', 'Noop', $multi );
345
+
346
+ $status_text = sprintf(
347
+ $messages[$noop_status],
348
+ $link,
349
+ $noop_link,
350
+ SFML_NOOP_VERSION,
351
+ '<a href="' . sfml_noop_download_url() . '">' . __( 'downloaded separately', 'sf-move-login' ) . '</a>'
352
+ );
353
+ }
354
+
355
+ return $status_text;
356
+ }
357
+ /**/
inc/rewrite.inc.php ADDED
@@ -0,0 +1,312 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( !defined( 'ABSPATH' ) )
3
+ die( 'Cheatin\' uh?' );
4
+
5
+ /* !---------------------------------------------------------------------------- */
6
+ /* ! REWRITE RULES */
7
+ /* ----------------------------------------------------------------------------- */
8
+
9
+ // !Return an array of action => url
10
+
11
+ if ( !function_exists('sfml_rules') ):
12
+ function sfml_rules( $actions = null ) {
13
+ $actions = is_null($actions) ? sfml_get_slugs() : $actions;
14
+ $rules = array(
15
+ $actions['login'] => 'wp-login.php',
16
+ );
17
+ unset($actions['login']);
18
+
19
+ foreach ( $actions as $action => $slug ) {
20
+ $rules[$slug] = 'wp-login.php?action='.$action;
21
+ }
22
+ return $rules;
23
+ }
24
+ endif;
25
+
26
+
27
+ // !Write rules in file.
28
+ // @return (bool) false if no rewrite module or not IIS7/Apache
29
+
30
+ if ( !function_exists('sfml_write_rules') ):
31
+ function sfml_write_rules( $rules = null ) {
32
+ global $is_apache, $is_iis7, $is_nginx;
33
+ $is_nginx = is_null($is_nginx) ? (strpos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) : $is_nginx;
34
+ $rules = is_null($rules) ? sfml_rules() : $rules;
35
+
36
+ // Noop
37
+ if ( sf_can_use_noop( SFML_NOOP_VERSION ) ) {
38
+ // Make sure we have the filters for Noop
39
+ if ( !function_exists('sfml_noop_params') )
40
+ include( SFML_PLUGIN_DIR . 'inc/noop.inc.php' );
41
+ // Make sure we have Noop
42
+ if ( !function_exists('noop_includes') )
43
+ include( NOOP_DIR . 'includes.php' );
44
+ // Make sure Noop is instanciated
45
+ $a = noop_includes( sfml_noop_params() );
46
+ }
47
+
48
+ // IIS
49
+ if ( $is_iis7 && iis7_supports_permalinks() )
50
+ return sf_insert_iis7_rewrite_rules( 'SF Move Login', sf_iis7_rewrite_rules( $rules, 'SF Move Login' ) );
51
+ // Apache
52
+ elseif ( $is_apache && got_mod_rewrite() )
53
+ return sf_insert_htaccess_rewrite_rules( 'SF Move Login', sf_htaccess_rewrite_rules( $rules ) );
54
+ // Nginx
55
+ elseif ( $is_nginx )
56
+ return true;
57
+
58
+ return false;
59
+ }
60
+ endif;
61
+
62
+
63
+ // !Is WP a MultiSite and a subfolder install?
64
+
65
+ if ( !function_exists('sf_is_subfolder_install') ):
66
+ function sf_is_subfolder_install() {
67
+ static $subfolder_install;
68
+ if ( is_null($subfolder_install) ) {
69
+ global $wpdb;
70
+ if ( is_multisite() )
71
+ $subfolder_install = ! (bool) is_subdomain_install();
72
+ elseif ( !is_null($wpdb->sitemeta) )
73
+ $subfolder_install = ! (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
74
+ else
75
+ $subfolder_install = false;
76
+ }
77
+ return $subfolder_install;
78
+ }
79
+ endif;
80
+
81
+
82
+ /* !---------------------------------------------------------------------------- */
83
+ /* ! REWRITE RULES: APACHE */
84
+ /* ----------------------------------------------------------------------------- */
85
+
86
+ // !Return the multisite rewrite rules (as an array)
87
+
88
+ if ( !function_exists('sf_htaccess_rewrite_rules') ):
89
+ function sf_htaccess_rewrite_rules( $rules = array() ) {
90
+ if ( !is_array($rules) || empty($rules) )
91
+ return '';
92
+
93
+ global $wpdb;
94
+ $base = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
95
+ $subfolder_install = sf_is_subfolder_install();
96
+ $subdir_match = $subfolder_install ? '([_0-9a-zA-Z-]+/)?' : '';
97
+
98
+ $out = array(
99
+ '<IfModule mod_rewrite.c>',
100
+ 'RewriteEngine On',
101
+ 'RewriteBase '.$base,
102
+ );
103
+ foreach ( $rules as $slug => $rule ) {
104
+ $out[] = 'RewriteRule ^'.$subdir_match.$slug.'/?$ $1'.$rule.' [QSA,L]';
105
+ }
106
+ $out[] = '</IfModule>';
107
+
108
+ return $out;
109
+ }
110
+ endif;
111
+
112
+
113
+ // !Insert content in htaccess file, before the WP block
114
+ // @param $marker string
115
+ // @param $rules array|string
116
+ // @param $before string
117
+
118
+ if ( !function_exists('sf_insert_htaccess_rewrite_rules') ):
119
+ function sf_insert_htaccess_rewrite_rules( $marker, $rules = '', $before = '# BEGIN WordPress' ) {
120
+ if ( !$marker )
121
+ return false;
122
+
123
+ $home_path = get_home_path();
124
+ $htaccess_file = $home_path.'.htaccess';
125
+
126
+ $has_htaccess = file_exists( $htaccess_file );
127
+ $htaccess_is_writable = $has_htaccess && is_writeable( $htaccess_file );
128
+ $got_mod_rewrite = got_mod_rewrite();
129
+
130
+ if (
131
+ ( $htaccess_is_writable && !$rules ) || // Remove rules
132
+ ( $htaccess_is_writable && $rules && $got_mod_rewrite ) || // Add rules
133
+ ( !$has_htaccess && is_writeable( $home_path ) && $rules && $got_mod_rewrite ) // Create htaccess + add rules
134
+ ) {
135
+ // Current htaccess content
136
+ $htaccess_content = $has_htaccess ? file_get_contents( $htaccess_file ) : '';
137
+
138
+ // No WordPress rules or no "before tag"?
139
+ if ( ( !$before || false === strpos($htaccess_content, $before) ) && $rules )
140
+ return insert_with_markers( $htaccess_file, $marker, $rules );
141
+
142
+ // Remove the SF Move Login marker
143
+ $htaccess_content = preg_replace( "/# BEGIN $marker.*# END $marker\n*/is", '', $htaccess_content );
144
+
145
+ // New content
146
+ if ( $before && $rules ) {
147
+ $rules = is_array($rules) ? implode("\n", $rules) : $rules;
148
+ $rules = trim($rules, "\r\n ");
149
+ if ( $rules ) {
150
+ // The new content need to be inserted before the WordPress rules
151
+ $rules = "# BEGIN $marker\n".$rules."\n# END $marker\n\n\n$before";
152
+ $htaccess_content = str_replace($before, $rules, $htaccess_content);
153
+ }
154
+ }
155
+
156
+ // Update the .htacces file
157
+ return (bool) file_put_contents( $htaccess_file , $htaccess_content );
158
+ }
159
+ return false;
160
+ }
161
+ endif;
162
+
163
+
164
+ /* !---------------------------------------------------------------------------- */
165
+ /* ! REWRITE RULES: IIS */
166
+ /* ----------------------------------------------------------------------------- */
167
+
168
+ // !Return the multisite rewrite rules for IIS systems (as a part of a xml system)
169
+
170
+ if ( !function_exists('sf_iis7_rewrite_rules') ):
171
+ function sf_iis7_rewrite_rules( $rules = array(), $marker = null ) {
172
+ if ( !is_array($rules) || empty($rules) || empty($marker) )
173
+ return '';
174
+
175
+ global $wpdb;
176
+ $base = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
177
+ $subfolder_install = sf_is_subfolder_install();
178
+ $subdir_match = $subfolder_install ? '([_0-9a-zA-Z-]+/)?' : '';
179
+ $iis_subdir_match = ltrim( $base, '/' ) . $subdir_match;
180
+ $iis_subdir_replacement = $subfolder_install ? '{R:1}' : '';
181
+
182
+ $rule_i = 1;
183
+ $space = str_repeat(' ', 16);
184
+ $out = array();
185
+ foreach ( $rules as $slug => $rule ) {
186
+ $out[] = $space . '<rule name="' . $marker . ' Rule ' . $rule_i . '" stopProcessing="true">'."\n"
187
+ . $space . ' <match url="^' . $iis_subdir_match . $slug . '/?$" ignoreCase="false" />'."\n"
188
+ . $space . ' <action type="Redirect" url="' . $iis_subdir_replacement . $rule . '" redirectType="Permanent" />'."\n"
189
+ . $space . '</rule>'."\n";
190
+ $rule_i++;
191
+ }
192
+
193
+ return $out;
194
+ }
195
+ endif;
196
+
197
+
198
+ // !Insert content in web.config file, before the WP block
199
+ // @var $rules array|string
200
+
201
+ if ( !function_exists('sf_insert_iis7_rewrite_rules') ):
202
+ function sf_insert_iis7_rewrite_rules( $marker, $rules = '', $before = 'wordpress' ) {
203
+ if ( !$marker || !class_exists('DOMDocument') )
204
+ return false;
205
+
206
+ $home_path = get_home_path();
207
+ $web_config_file = $home_path.'web.config';
208
+
209
+ $has_web_config = file_exists( $web_config_file );
210
+ $web_config_is_writable = $has_web_config && win_is_writeable( $web_config_file );
211
+ $supports_permalinks = iis7_supports_permalinks();
212
+
213
+ // New content
214
+ $rules = is_array($rules) ? implode("\n", $rules) : $rules;
215
+ $rules = trim($rules, "\r\n");
216
+
217
+ if (
218
+ ( $web_config_is_writable && !$rules ) || // Remove rules
219
+ ( $web_config_is_writable && $rules && $supports_permalinks ) || // Add rules
220
+ ( !$has_web_config && win_is_writeable( $home_path ) && $rules && $supports_permalinks ) // Create web.config + add rules
221
+ ) {
222
+ // If configuration file does not exist then we create one.
223
+ if ( !$has_web_config ) {
224
+ $fp = fopen( $web_config_file, 'w');
225
+ fwrite($fp, '<configuration/>');
226
+ fclose($fp);
227
+ }
228
+
229
+ $doc = new DOMDocument();
230
+ $doc->preserveWhiteSpace = false;
231
+
232
+ if ( $doc->load($web_config_file) === false )
233
+ return false;
234
+
235
+ $xpath = new DOMXPath($doc);
236
+
237
+ // Remove old rules
238
+ $old_rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\''.$marker.'\')]');
239
+ if ( $old_rules->length > 0 ) {
240
+ $child = $old_rules->item(0);
241
+ $parent = $child->parentNode;
242
+ $parent->removeChild($child);
243
+ }
244
+
245
+ // No new rules?
246
+ if ( !$rules ) {
247
+ $doc->formatOutput = true;
248
+ saveDomDocument($doc, $web_config_file);
249
+ return true;
250
+ }
251
+
252
+ // Check the XPath to the rewrite rule and create XML nodes if they do not exist
253
+ $xmlnodes = $xpath->query('/configuration/system.webServer/rewrite/rules');
254
+ if ( $xmlnodes->length > 0 ) {
255
+ $rules_node = $xmlnodes->item(0);
256
+ } else {
257
+ $rules_node = $doc->createElement('rules');
258
+
259
+ $xmlnodes = $xpath->query('/configuration/system.webServer/rewrite');
260
+ if ( $xmlnodes->length > 0 ) {
261
+ $rewrite_node = $xmlnodes->item(0);
262
+ $rewrite_node->appendChild($rules_node);
263
+ } else {
264
+ $rewrite_node = $doc->createElement('rewrite');
265
+ $rewrite_node->appendChild($rules_node);
266
+
267
+ $xmlnodes = $xpath->query('/configuration/system.webServer');
268
+ if ( $xmlnodes->length > 0 ) {
269
+ $system_webServer_node = $xmlnodes->item(0);
270
+ $system_webServer_node->appendChild($rewrite_node);
271
+ } else {
272
+ $system_webServer_node = $doc->createElement('system.webServer');
273
+ $system_webServer_node->appendChild($rewrite_node);
274
+
275
+ $xmlnodes = $xpath->query('/configuration');
276
+ if ( $xmlnodes->length > 0 ) {
277
+ $config_node = $xmlnodes->item(0);
278
+ $config_node->appendChild($system_webServer_node);
279
+ } else {
280
+ $config_node = $doc->createElement('configuration');
281
+ $doc->appendChild($config_node);
282
+ $config_node->appendChild($system_webServer_node);
283
+ }
284
+ }
285
+ }
286
+ }
287
+
288
+ $rule_fragment = $doc->createDocumentFragment();
289
+ $rule_fragment->appendXML($rules);
290
+
291
+ // Insert before the WP rules
292
+ if ( $before )
293
+ $wordpress_rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\''.$before.'\')]');
294
+ if ( $before && $wordpress_rules->length > 0 ) {
295
+ $child = $wordpress_rules->item(0);
296
+ $parent = $child->parentNode;
297
+ $parent->insertBefore($element, $child);
298
+ }
299
+ else {
300
+ $rules_node->appendChild($rule_fragment);
301
+ }
302
+
303
+ $doc->encoding = "UTF-8";
304
+ $doc->formatOutput = true;
305
+ saveDomDocument($doc, $web_config_file);
306
+
307
+ return true;
308
+ }
309
+ return false;
310
+ }
311
+ endif;
312
+ /**/
languages/sf-move-login-fr_FR.mo ADDED
Binary file
languages/sf-move-login-fr_FR.po ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LANGUAGE French translation for SF Move Login plugin for WordPress.
2
+ # Copyright (C) 2013 Grégory Viguier
3
+ # Grégory Viguier.
4
+ #
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: sf-move-login 1.1.4\n"
8
+ "Report-msgid -Bugs-To: Grégory Viguier <i18n@screenfeed.fr>\n"
9
+ "POT-Creation-Date: 2013-06-01 00:04+0100\n"
10
+ "PO-Revision-Date: 2013-10-13 00:04+0100\n"
11
+ "Last-Translator: Grégory Viguier <i18n@screenfeed.fr>\n"
12
+ "Language-Team: fr_FR\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=utf-8\n"
15
+ "Content-Transfer-Encoding: 8bit\n"
16
+ "Plural-Forms: nplurals=2; plural=n>1;\n"
17
+ "X-Poedit-SourceCharset: utf-8\n"
18
+ "X-Poedit-KeywordsList: __;_e;_n\n"
19
+ "Language: fr_FR\n"
20
+ "X-Generator: Poedit 1.5.7\n"
21
+
22
+ # ---------------------------------------------------------------------------
23
+ # sf-move-login.php
24
+
25
+ msgid "Change your login url"
26
+ msgstr "Changez l'url de votre page de connexion"
27
+
28
+ msgid "No no no, the login form is not here."
29
+ msgstr "Non non non, le formulaire de connexion ne se trouve pas ici."
30
+
31
+ # ---------------------------------------------------------------------------
32
+ # inc/noop.inc.php
33
+
34
+ msgid "The slug %s is forbidden."
35
+ msgid_plural "The slugs %s are forbidden."
36
+ msgstr[0] "L'identifiant %s est interdit."
37
+ msgstr[1] "Les identifiants %s sont interdits."
38
+
39
+ msgid "The links can't have the same slugs."
40
+ msgstr "Les liens ne peuvent pas avoir les mêmes identifiants."
41
+
42
+ # ---------------------------------------------------------------------------
43
+ # inc/admin.inc.php
44
+
45
+ msgid "Access"
46
+ msgstr "Accès"
47
+
48
+ msgid "The constant <code>SFML_ALLOW_LOGIN_ACCESS</code> is defined to <code>true</code>, the settings below won't take effect."
49
+ msgstr "La constante <code>SFML_ALLOW_LOGIN_ACCESS</code> est définie à <code>true</code>, les réglages ci-dessous ne prendront pas effet."
50
+
51
+ msgid "Display an error message"
52
+ msgstr "Afficher un message d'erreur"
53
+
54
+ msgid "Redirect to a &laquo;Page not found&raquo; error page"
55
+ msgstr "Rediriger vers une page d'erreur &laquo;Page non trouvée&raquo;"
56
+
57
+ msgid "Redirect to the home page"
58
+ msgstr "Rediriger vers la page d'accueil"
59
+
60
+ msgid "When a not connected user attempts to access the old login page."
61
+ msgstr "Lorsqu'un utilisateur non connecté tente d'accéder à l'ancienne page de connexion."
62
+
63
+ msgid "Administration area"
64
+ msgstr "Zone d'administration"
65
+
66
+ msgid "Do nothing, redirect to the new login page"
67
+ msgstr "Ne rien faire, rediriger vers la nouvelle page de connexion"
68
+
69
+ msgid "When a not connected user attempts to access the administration area."
70
+ msgstr "Lorsqu'un utilisateur non connecté tente d'accéder à la zone d'administration."
71
+
72
+ msgid "%s File"
73
+ msgstr "Fichier %s"
74
+
75
+ 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:"
76
+ msgstr "Si l'extension ne peut ajouter les nouvelles règles de réécriture à votre fichier %1$s à son activation, 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;:"
77
+
78
+ # ---------------------------------------------------------------------------
79
+ # inc/plugins-list.inc.php
80
+
81
+ msgid "<strong>Move Login</strong> has not been activated."
82
+ msgstr "<strong>Move Login</strong> n'a pas été activé."
83
+
84
+ 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."
85
+ msgstr "<strong>Move Login</strong> a besoin d'accéder au fichier %1$s. Veuillez vous rendre sur la page de réglages de %2$s et de copier/coller le code fourni dans le fichier %1$s."
86
+
87
+ msgid "It seems your server configuration prevent the plugin to work properly. <strong>Move Login</strong> won't work."
88
+ msgstr "Il semble que votre configuration serveur empêche l'extension de fonctionner correctement. <strong>Move Login</strong> ne pourra pas fonctionner."
89
+
90
+ msgid "It seems the url rewrite module is not activated on your server. <strong>Move Login</strong> won't work."
91
+ msgstr "Il semble que le module de réécriture d'url n'est pas activé sur votre serveur. <strong>Move Login</strong> ne pourra pas fonctionner."
92
+
93
+ 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."
94
+ msgstr "Il semble que votre serveur n'utilise pas <i>Apache</i>, <i>Nginx</i>, ou <i>IIS7</i>. <strong>Move Login</strong> ne pourra pas fonctionner."
95
+
96
+ 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."
97
+ msgstr "Il semble que votre serveur utilise un système <i>Nginx</i>, que je ne connais pas du tout. Je dois donc vous laisser gérer ça par vous-même. Veuillez vous rendre sur la page de réglages de %2$s et jetez un œil aux règles de réécriture utilisées pour un fichier %1$s. <strong>Move Login</strong> fonctionne mais ne pourra pas le faire correctement tant que vous ne vous serez pas occupé de ces règles."
98
+
99
+ msgid "To enable the real settings page for Move Login, please install the plugin %1$s."
100
+ msgstr "Pour activer la vrai page de réglages pour Move Login, veuillez installer l'extension %1$s."
101
+
102
+ msgid "To enable the real settings page for Move Login, please activate the plugin %2$s."
103
+ msgstr "Pour activer la vrai page de réglages pour Move Login, veuillez activer l'extension %2$s."
104
+
105
+ msgid "To enable the real settings page for Move Login, please upgrade the plugin %2$s to the version %3$s."
106
+ msgstr "Pour activer la vrai page de réglages pour Move Login, veuillez mettre à jour l'extension %2$s vers la version %3$s."
107
+
108
+ 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."
109
+ msgstr "Il semblerait que l'extension Noop soit installée mais ne fonctionne pas correctement. Pour activer la vrai page de réglages pour Move Login, veuillez réinstaller %1$s."
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,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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 http://example.com/login 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
+ By default, the new URLs become: *example.com/login*, *example.com/register*, *example.com/lostpassword*, *example.com/resetpass* and *example.com/logout*.
19
+
20
+ 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.
21
+ The plugin is small, fast, and does not create new security vulnerabilities like some other plugins I've seen.
22
+
23
+ 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.
24
+
25
+ = Translations =
26
+
27
+ * English
28
+ * French
29
+ * Serbo-Croatian (thank you Borisa)
30
+ * Hebrew (thank you Ahrale)
31
+
32
+ = Multisite =
33
+
34
+ Yep!
35
+ The plugin must be activated from your network.
36
+
37
+ = Requirements =
38
+
39
+ * See some important informations in the "Installation" tab.
40
+ * Should work on IIS7+ servers but not tested.
41
+ * If you need the settings page, you'll have to install my framework "Noop" (the link will be provided).
42
+
43
+
44
+ == Installation ==
45
+
46
+ 1. Extract the plugin folder from the downloaded ZIP file.
47
+ 1. Upload the `sf-move-login` folder to your `/wp-content/plugins/` directory.
48
+ 1. If you have another plugin that redirects **http://example.com/login** 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).
49
+ 1. Activate the plugin from the "Plugins" page.
50
+ 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.
51
+
52
+
53
+ == Frequently Asked Questions ==
54
+
55
+ = Can I set my own URLs? =
56
+
57
+ Since the version 1.1, yes. You have 2 ways to do that:
58
+
59
+ 1. Install another plugin, called Noop, to enable a new settings page. Noop is a framework I developed, to easily create settings pages, and to handle options. After you install Move Login, it will provide to you a link to download Noop.
60
+ 1. Use the filter `sfml_slugs` and return an array containing your custom slugs.
61
+ For example, put this in your `functions.php` theme file:
62
+ `add_filter( 'sfml_slugs', 'my_custom_slugs' );
63
+
64
+ function my_custom_slugs( $slugs ) {
65
+ return array_merge( $slugs, array(
66
+ 'logout' => 'byebye',
67
+ 'lostpassword' => 'im-lost',
68
+ 'resetpass' => 'reset',
69
+ 'register' => 'hello',
70
+ 'login' => 'welcome-back',
71
+ ) );
72
+ }`
73
+ After saving your `functions.php` file, go to "Settings" => "Permalinks": the rewrite rules will be flushed by visiting this page. Make sure new lines have been added to your `.htaccess` file.
74
+
75
+ = I'm locked out! I can't access the login page! =
76
+
77
+ 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.
78
+
79
+ = Does it really work for Multisite? =
80
+
81
+ Yes. Each blog has its own login page. The plugin must be activated from the network. In case the plugin fails to add the rewrite rules, there's a new "settings" page in your network admin area: "Settings" -> "SF Move Login". You'll be able to copy/paste the needed lines to your `.htaccess` file or `web.config` file, you'll need to edit it yourself with a ftp access.
82
+
83
+ 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).
84
+
85
+
86
+ == Screenshots ==
87
+
88
+ 1. The settings page.
89
+
90
+
91
+ == Changelog ==
92
+
93
+ = 1.1.4 =
94
+
95
+ * 2014/04/28
96
+ * 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.
97
+ * Side note: I've just released a new version for my framework Noop (1.0.7). Now you can import and export your settings via a file, see the new tab in the "Help" area.
98
+
99
+ = 1.1.3 =
100
+
101
+ * 2014/04/01
102
+ * Bugfix for php 5.4.
103
+
104
+ = 1.1.2 =
105
+
106
+ * 2014/03/29
107
+ * Bugfix: don't block users accessing the script `admin-post.php`.
108
+ * Changed i18n domain.
109
+ * If Noop is not installed, add a link in the "settings" page.
110
+ * Added a direct link to download Noop, some users may not be able to install plugins directly.
111
+ * Code improvements and small bugfixes.
112
+
113
+ = 1.1.1 =
114
+
115
+ * 2013/12/17
116
+ * Bugfix.
117
+
118
+ = 1.1 =
119
+
120
+ * 2013/12/16
121
+ * Code refactoring.
122
+ * Requires WordPress 3.1 at least.
123
+ * 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.
124
+ * New: support for custom actions in the login form (added by other plugins).
125
+ * New: choose what to do when someone attempts to access the old login page.
126
+ * New: choose what to do when someone attempts to access the administration area.
127
+ * New: enabling permalinks is not required anymore.
128
+ * Todo: provide rewrite rules for Nginx systems.
129
+
130
+ = 1.0.1 =
131
+
132
+ * 2013/09/30
133
+ * Very minor bug fix: messed the author link -_-'
134
+
135
+ = 1.0 =
136
+
137
+ * 2013/09/20
138
+ * First stable version.
139
+ * 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.
140
+
141
+ = 1.0-RC2 =
142
+
143
+ * 2013/09/12
144
+ * Bugfix: activation for multisite with not writable .htaccess file, a wrong message was shown, preventing activation (was I drunk?).
145
+ * tested on multisite with subdomain.
146
+ * SecuPress is joining the project :)
147
+
148
+ = 1.0-RC1 =
149
+
150
+ * 2013/09/11
151
+ * New: Multisite support (must be "network" activated).
152
+ * Enhancement: updated the set_url_scheme() function to the one in WP 3.6.1 (used for WP < 3.4).
153
+ * Enhancement: better rewrite rules.
154
+ * Bugfix: The plugin rewrite rules are now really removed from the .htaccess file on deactivation.
155
+
156
+ = 0.1.1 =
157
+
158
+ * 2013/06/04
159
+ * Bugfix: php notice due to a missing parameter.
160
+ * Bugfix: incorrect network_site_url filter.
161
+
162
+ = 0.1 =
163
+
164
+ * 2013/06/03
165
+ * First public beta release
166
+ * Thanks to juliobox, who's joining the project :)
167
+
168
+
169
+ == Upgrade Notice ==
170
+
171
+ = 1.0 =
172
+ This is the first stable version of the plugin.
res/icon.png ADDED
Binary file
res/support.jpg ADDED
Binary file
sf-move-login.php ADDED
@@ -0,0 +1,406 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Plugin Name: SF Move Login
4
+ * Plugin URI: http://www.screenfeed.fr/caravan-1-1/
5
+ * Description: Change your login url
6
+ * Version: 1.1.4
7
+ * Author: Grégory Viguier
8
+ * Author URI: http://www.screenfeed.fr/greg/
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
+ /* ! INIT */
25
+ /* ----------------------------------------------------------------------------- */
26
+
27
+ define( 'SFML_VERSION', '1.1.4' );
28
+ define( 'SFML_NOOP_VERSION', '1.0' );
29
+ define( 'SFML_FILE', __FILE__ );
30
+ define( 'SFML_PLUGIN_BASEDIR', basename( dirname( SFML_FILE ) ) );
31
+ define( 'SFML_PLUGIN_BASENAME', plugin_basename( SFML_FILE ) );
32
+ define( 'SFML_PLUGIN_URL', plugin_dir_url( SFML_FILE ) );
33
+ define( 'SFML_PLUGIN_DIR', plugin_dir_path( SFML_FILE ) );
34
+
35
+
36
+ /* !---------------------------------------------------------------------------- */
37
+ /* ! INCLUDES */
38
+ /* ----------------------------------------------------------------------------- */
39
+
40
+ add_action( 'plugins_loaded', 'sfml_init' );
41
+
42
+ function sfml_init() {
43
+ // Stuff for Noop
44
+ if ( sf_can_use_noop( SFML_NOOP_VERSION ) && !function_exists('sfml_noop_params') )
45
+ include( SFML_PLUGIN_DIR . 'inc/noop.inc.php' );
46
+
47
+ // Administration
48
+ if ( sfml_is_admin() && !function_exists('sfml_write_rules') )
49
+ include( SFML_PLUGIN_DIR . 'inc/admin.inc.php' );
50
+
51
+ // Plugins List: activation, deactivation, uninstall, admin notices, plugin/Noop links, Noop download and infos.
52
+ global $pagenow;
53
+ if ( is_admin() && ( $pagenow == 'plugins.php' || $pagenow == 'update-core.php' || $pagenow == 'update.php' || $pagenow == 'plugin-install.php' ) )
54
+ include( SFML_PLUGIN_DIR . 'inc/plugins-list.inc.php' );
55
+ }
56
+
57
+
58
+ /* !---------------------------------------------------------------------------- */
59
+ /* ! I18N SUPPORT */
60
+ /* ----------------------------------------------------------------------------- */
61
+
62
+ add_action( 'init', 'sfml_lang_init' );
63
+
64
+ function sfml_lang_init() {
65
+ load_plugin_textdomain( 'sf-move-login', false, SFML_PLUGIN_BASEDIR . '/languages/' );
66
+ }
67
+
68
+
69
+ /* !---------------------------------------------------------------------------- */
70
+ /* ! OPTIONS */
71
+ /* ----------------------------------------------------------------------------- */
72
+
73
+ // !Get the slugs
74
+
75
+ function sfml_get_slugs() {
76
+ if ( function_exists('sfml_noop_params') && class_exists('Noop_Options') )
77
+ return Noop_Options::get_instance( sfml_noop_params() )->get_option( 'slugs' );
78
+ else {
79
+ static $slugs = array(); // Keep the same slugs all along.
80
+ if ( empty($slugs) ) {
81
+ $slugs = array(
82
+ 'postpass' => 'postpass',
83
+ 'logout' => 'logout',
84
+ 'lostpassword' => 'lostpassword',
85
+ 'retrievepassword' => 'retrievepassword',
86
+ 'resetpass' => 'resetpass',
87
+ 'rp' => 'rp',
88
+ 'register' => 'register',
89
+ 'login' => 'login',
90
+ );
91
+
92
+ // Plugins can add their own action
93
+ $additional_slugs = apply_filters( 'sfml_additional_slugs', array() );
94
+ if ( !empty( $additional_slugs ) ) {
95
+ $additional_slugs = array_keys( $additional_slugs );
96
+ $additional_slugs = array_combine( $additional_slugs, $additional_slugs );
97
+ $additional_slugs = array_diff_key( $additional_slugs, $slugs ); // Don't screw the default ones
98
+ $slugs = array_merge( $slugs, $additional_slugs );
99
+ }
100
+
101
+ // Generic filter, change the values
102
+ $slugs = apply_filters( 'sfml_slugs', $slugs );
103
+ }
104
+ return $slugs;
105
+ }
106
+ }
107
+
108
+
109
+ // !Access to wp-login.php
110
+
111
+ function sfml_deny_wp_login_access() {
112
+ if ( function_exists('sfml_noop_params') && class_exists('Noop_Options') )
113
+ return Noop_Options::get_instance( sfml_noop_params() )->get_option( 'deny_wp_login_access' );
114
+ else
115
+ return apply_filters( 'sfml_deny_wp_login_access', 1 ); // 1: error message, 2: 404, 3: home
116
+ }
117
+
118
+
119
+ // !Access to the administration area
120
+
121
+ function sfml_deny_admin_access() {
122
+ if ( function_exists('sfml_noop_params') && class_exists('Noop_Options') )
123
+ return Noop_Options::get_instance( sfml_noop_params() )->get_option( 'deny_admin_access' );
124
+ else
125
+ return apply_filters( 'sfml_deny_admin_access', 0 ); // 0: nothing, 1: error message, 2: 404, 3: home
126
+ }
127
+
128
+
129
+ /* --------------------------------------------------------------------------------- */
130
+ /* !TOOLS */
131
+ /* --------------------------------------------------------------------------------- */
132
+
133
+ function sfml_is_admin() {
134
+ global $pagenow;
135
+ return is_admin() && !( (defined('DOING_AJAX') && DOING_AJAX) || ($pagenow == 'admin-post.php' && !empty($_REQUEST['action'])) );
136
+ }
137
+
138
+
139
+ if ( !function_exists('sf_can_use_noop') ):
140
+ function sf_can_use_noop( $version = '100' ) {
141
+ return defined('NOOP_DIR') && defined('NOOP_VERSION') && version_compare(NOOP_VERSION, $version, '>=');
142
+ }
143
+ endif;
144
+
145
+
146
+ /* !---------------------------------------------------------------------------- */
147
+ /* ! EMERGENCY BYPASS */
148
+ /* ----------------------------------------------------------------------------- */
149
+
150
+ if ( defined('SFML_ALLOW_LOGIN_ACCESS') && SFML_ALLOW_LOGIN_ACCESS )
151
+ return;
152
+
153
+
154
+ /* !---------------------------------------------------------------------------- */
155
+ /* ! FILTER URLS */
156
+ /* ----------------------------------------------------------------------------- */
157
+
158
+ // !Site URL
159
+
160
+ add_filter( 'site_url', 'sfml_site_url', 10, 4);
161
+
162
+ function sfml_site_url( $url, $path, $scheme, $blog_id = null ) {
163
+ if ( ($scheme === 'login' || $scheme === 'login_post') && !empty($path) && is_string($path) && strpos($path, '..') === false && strpos($path, 'wp-login.php') !== false ) {
164
+ // Base url
165
+ if ( empty( $blog_id ) || !is_multisite() ) {
166
+ $url = get_option( 'siteurl' );
167
+ } else {
168
+ switch_to_blog( $blog_id );
169
+ $url = get_option( 'siteurl' );
170
+ restore_current_blog();
171
+ }
172
+
173
+ $url = set_url_scheme( $url, $scheme );
174
+ return $url . sfml_set_path( $path );
175
+ }
176
+ return $url;
177
+ }
178
+
179
+
180
+ // !Network site URL
181
+
182
+ add_filter( 'network_site_url', 'sfml_network_site_url', 10, 3);
183
+
184
+ function sfml_network_site_url( $url, $path, $scheme ) {
185
+ if ( ($scheme === 'login' || $scheme === 'login_post') && !empty($path) && is_string($path) && strpos($path, '..') === false && strpos($path, 'wp-login.php') !== false ) {
186
+ global $current_site;
187
+
188
+ $url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );
189
+ return $url . sfml_set_path( $path );
190
+ }
191
+ return $url;
192
+ }
193
+
194
+
195
+ // !Logout url: wp_logout_url() add the action param after using site_url()
196
+
197
+ add_filter( 'logout_url', 'sfml_logout_url' );
198
+
199
+ function sfml_logout_url( $link ) {
200
+ return sfml_login_to_action( $link, 'logout' );
201
+ }
202
+
203
+
204
+ // !Forgot password url: lostpassword_url() add the action param after using site_url()
205
+
206
+ add_filter( 'lostpassword_url', 'sfml_lostpass_url' );
207
+
208
+ function sfml_lostpass_url( $link ) {
209
+ return sfml_login_to_action( $link, 'lostpassword' );
210
+ }
211
+
212
+
213
+ // !Redirections are hard-coded
214
+
215
+ add_filter('wp_redirect', 'sfml_redirect', 10, 2);
216
+
217
+ function sfml_redirect( $location, $status ) {
218
+ if ( site_url( reset( (explode( '?', $location )) ) ) == site_url( 'wp-login.php' ) )
219
+ return sfml_site_url( $location, $location, 'login', get_current_blog_id() );
220
+
221
+ return $location;
222
+ }
223
+
224
+
225
+ /* !---------------------------------------------------------------------------- */
226
+ /* ! IF NOT CONNECTED, DENY ACCESS TO WP-LOGIN.PHP */
227
+ /* ----------------------------------------------------------------------------- */
228
+
229
+ add_action( 'login_init', 'sfml_login_init', 0 );
230
+
231
+ function sfml_login_init() {
232
+ // If the user is logged in, do nothing, lets WP redirect this user to the administration area.
233
+ if ( is_user_logged_in() )
234
+ return;
235
+
236
+ $uri = !empty($GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI']) ? $GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI'] : (!empty($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '');
237
+ $uri = parse_url( $uri );
238
+ $uri = !empty($uri['path']) ? str_replace( '/', '', basename($uri['path']) ) : '';
239
+
240
+ if ( $uri === 'wp-login.php' ) {
241
+ do_action( 'sfml_wp_login_error' );
242
+
243
+ // To make sure something happen.
244
+ if ( false === has_action( 'sfml_wp_login_error' ) ) {
245
+ sfml_wp_login_error();
246
+ }
247
+ }
248
+ }
249
+
250
+
251
+ add_action( 'sfml_wp_login_error', 'sfml_wp_login_error' );
252
+
253
+ function sfml_wp_login_error() {
254
+ $do = sfml_deny_wp_login_access();
255
+ switch( $do ) {
256
+ case 2:
257
+ $redirect = $GLOBALS['wp_rewrite']->using_permalinks() ? home_url('404') : add_query_arg( 'p', '404', home_url() );
258
+ wp_safe_redirect( esc_url( apply_filters( 'sfml_404_error_page', $redirect ) ) );
259
+ exit;
260
+ case 3:
261
+ wp_safe_redirect( home_url() );
262
+ exit;
263
+ default:
264
+ wp_die( __('No no no, the login form is not here.', 'sf-move-login') );
265
+ }
266
+ }
267
+
268
+
269
+ /* !---------------------------------------------------------------------------- */
270
+ /* ! IF NOT CONNECTED, DO NOT REDIRECT FROM ADMIN AREA TO WP-LOGIN.PHP */
271
+ /* ----------------------------------------------------------------------------- */
272
+
273
+ add_action( 'after_setup_theme', 'sfml_maybe_die_before_admin_redirect' );
274
+
275
+ function sfml_maybe_die_before_admin_redirect() {
276
+ // If it's not the administration area, or if it's an ajax call, no need to go further.
277
+ if ( !sfml_is_admin() )
278
+ return;
279
+
280
+ $scheme = is_user_admin() ? 'logged_in' : apply_filters( 'auth_redirect_scheme', '' );
281
+
282
+ if ( !wp_validate_auth_cookie( '', $scheme) && sfml_deny_admin_access() ) {
283
+ do_action( 'sfml_wp_admin_error' );
284
+
285
+ // To make sure something happen.
286
+ if ( false === has_action( 'sfml_wp_admin_error' ) ) {
287
+ sfml_wp_admin_error();
288
+ }
289
+ }
290
+ }
291
+
292
+
293
+ add_action( 'sfml_wp_admin_error', 'sfml_wp_admin_error' );
294
+
295
+ function sfml_wp_admin_error() {
296
+ $do = sfml_deny_admin_access();
297
+ switch( $do ) {
298
+ case 1:
299
+ wp_die( __('Cheatin&#8217; uh?') );
300
+ case 2:
301
+ $redirect = $GLOBALS['wp_rewrite']->using_permalinks() ? home_url('404') : add_query_arg( 'p', '404', home_url() );
302
+ wp_safe_redirect( esc_url( apply_filters( 'sfml_404_error_page', $redirect ) ) );
303
+ exit;
304
+ case 3:
305
+ wp_safe_redirect( home_url() );
306
+ exit;
307
+ }
308
+ }
309
+
310
+
311
+ /* !---------------------------------------------------------------------------- */
312
+ /* ! UTILITIES */
313
+ /* ----------------------------------------------------------------------------- */
314
+
315
+ // !Construct the url
316
+
317
+ function sfml_set_path( $path ) {
318
+ $slugs = sfml_get_slugs();
319
+ // Action
320
+ $parsed_path = parse_url( $path );
321
+ if ( !empty( $parsed_path['query'] ) ) {
322
+ wp_parse_str( $parsed_path['query'], $params );
323
+ $action = !empty( $params['action'] ) ? $params['action'] : 'login';
324
+
325
+ if ( isset( $params['key'] ) )
326
+ $action = 'resetpass';
327
+
328
+ if ( !isset($slugs[$action]) && false === has_filter( 'login_form_' . $action ) )
329
+ $action = 'login';
330
+ } else
331
+ $action = 'login';
332
+
333
+ // Path
334
+ if ( isset($slugs[$action]) ) {
335
+ $path = str_replace('wp-login.php', $slugs[$action], $path);
336
+ $path = remove_query_arg('action', $path);
337
+ }
338
+ else { // In case of a custom action
339
+ $path = str_replace('wp-login.php', $slugs['login'], $path);
340
+ $path = remove_query_arg('action', $path);
341
+ $path = add_query_arg('action', $action, $path);
342
+ }
343
+
344
+ return '/' . ltrim( $path, '/' );
345
+ }
346
+
347
+
348
+ // !login?action=logout -> /logout
349
+
350
+ function sfml_login_to_action( $link, $action ) {
351
+ $slugs = sfml_get_slugs();
352
+ $need_action_param = false;
353
+
354
+ if ( isset($slugs[$action]) ) {
355
+ $slug = $slugs[$action];
356
+ }
357
+ else { // Shouldn't happen, because this function is not used in this case.
358
+ $slug = $slugs['login'];
359
+
360
+ if ( false === has_filter( 'login_form_' . $action ) )
361
+ $action = 'login';
362
+ else // In case of a custom action
363
+ $need_action_param = true;
364
+ }
365
+
366
+ if ( $link && strpos($link, '/'.$slug) === false ) {
367
+ $link = str_replace(array('/'.$slugs['login'], '&amp;', '?amp;', '&'), array('/'.$slug, '&', '?', '&amp;'), remove_query_arg('action', $link));
368
+ if ( $need_action_param ) // In case of a custom action, shouldn't happen.
369
+ $link = add_query_arg('action', $action, $link);
370
+ }
371
+ return $link;
372
+ }
373
+
374
+
375
+ // !For WP < 3.4
376
+
377
+ if ( !function_exists('set_url_scheme') ):
378
+ function set_url_scheme( $url, $scheme = null ) {
379
+ $orig_scheme = $scheme;
380
+ if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) {
381
+ if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) )
382
+ $scheme = 'https';
383
+ elseif ( ( 'login' == $scheme ) && force_ssl_admin() )
384
+ $scheme = 'https';
385
+ elseif ( ( 'admin' == $scheme ) && force_ssl_admin() )
386
+ $scheme = 'https';
387
+ else
388
+ $scheme = ( is_ssl() ? 'https' : 'http' );
389
+ }
390
+
391
+ $url = trim( $url );
392
+ if ( substr( $url, 0, 2 ) === '//' )
393
+ $url = 'http:' . $url;
394
+
395
+ if ( 'relative' == $scheme ) {
396
+ $url = ltrim( preg_replace( '#^\w+://[^/]*#', '', $url ) );
397
+ if ( $url !== '' && $url[0] === '/' )
398
+ $url = '/' . ltrim($url , "/ \t\n\r\0\x0B" );
399
+ } else {
400
+ $url = preg_replace( '#^\w+://#', $scheme . '://', $url );
401
+ }
402
+
403
+ return apply_filters( 'set_url_scheme', $url, $scheme, $orig_scheme );
404
+ }
405
+ endif;
406
+ /**/