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