Plugin Directory

Changeset 1671125


Ignore:
Timestamp:
06/05/2017 03:52:15 PM (9 years ago)
Author:
GregLone
Message:

Move Login 2.5.3.

Location:
sf-move-login/trunk
Files:
5 added
18 edited

Legend:

Unmodified
Added
Removed
  • sf-move-login/trunk

    • Property svn:ignore
      •  

        old new  
         1node_modules
         2.jshintrc
         3gruntfile.js
         4package.json
        15phpcs.xml
  • sf-move-login/trunk/inc/activate.php

    r1664767 r1671125  
    11<?php
    2 if ( ! defined( 'ABSPATH' ) ) {
    3     die( 'Cheatin\' uh?' );
    4 }
     2defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
    53
    64/*------------------------------------------------------------------------------------------------*/
     
    4745
    4846        $dies = array_filter( array_map( 'sfml_notice_message', $dies ) );
    49         /** Translators: 1 is the plugin name. */
     47        /* translators: 1 is the plugin name. */
    5048        $dies = sprintf( __( '%s has not been activated.', 'sf-move-login' ), '<strong>Move Login</strong>' ) . '<br/>' . implode( '<br/>', $dies );
    5149
     
    112110
    113111    $messages = array(
    114         /** Translators: 1 is the plugin name. */
     112        /* translators: 1 is the plugin name. */
    115113        '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. */
     114        /* translators: 1 is the plugin name. */
    117115        '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. */
     116        /* translators: 1, 2, and 3 are server technologies (Apache, Nginx, IIS7), 4 is the plugin name. */
    119117        '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. */
     118        /* translators: 1 is the plugin name, 2 is a file name, 3 is a "Move Login" link. */
    121119        '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. */
     120        /* translators: 1 is a server technology (Nginx), 2 is a "Move Login" link, 3 is the plugin name. */
    123121        '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>' ),
    124122    );
  • sf-move-login/trunk/inc/admin.php

    r1664767 r1671125  
    11<?php
    2 if ( ! defined( 'ABSPATH' ) ) {
    3     die( 'Cheatin\' uh?' );
    4 }
     2defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
    53
    64/*------------------------------------------------------------------------------------------------*/
     
    6361    }
    6462
     63    /* translators: %s is a person name. But you don't care, you don't have to translate it. */
    6564    $links = sprintf( __( 'By %s' ), wp_sprintf( '%l', $links ) );
    6665
  • sf-move-login/trunk/inc/classes/class-sfml-options.php

    r1664767 r1671125  
    11<?php
    2 if ( ! defined( 'ABSPATH' ) ) {
    3     die( 'Cheatin\' uh?' );
    4 }
     2defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
    53
    64/**
     
    7472
    7573            $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;
     74            $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(); // WPCS: override ok.
     75            $new_whitelist_options[ static::OPTION_GROUP ][] = static::OPTION_NAME; // WPCS: override ok.
    7876        } elseif ( is_admin() ) {
    7977            $whitelist = sfml_cache_data( 'new_whitelist_network_options' );
     
    108106        // Default slugs.
    109107        $this->options_default = array(
    110             'slugs.postpass'     => 'postpass',
    111108            'slugs.logout'       => 'logout',
    112109            'slugs.lostpassword' => 'lostpassword',
     
    231228
    232229    /**
    233      * Get the slugs.
     230     * Get the slugs that will be rewritten.
    234231     *
    235232     * @return (array)
     
    238235        $this->maybe_clear_options_cache();
    239236
    240         if ( ! isset( $this->slugs ) ) {
    241             $this->slugs = static::get_sub_options( 'slugs', $this->get_options() );
    242         }
     237        if ( isset( $this->slugs ) ) {
     238            return $this->slugs;
     239        }
     240
     241        $this->slugs = array_merge(
     242            $this->get_non_customizable_actions(),
     243            static::get_sub_options( 'slugs', $this->get_options() )
     244        );
    243245
    244246        return $this->slugs;
     
    246248
    247249
    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 ==========+++=============================================================== */
     250    /*--------------------------------------------------------------------------------------------*/
     251    /* !FIELD LABELS ============================================================================ */
    294252    /*--------------------------------------------------------------------------------------------*/
    295253
     
    297255     * Get the possible choices for a specific option.
    298256     *
    299      * @since 1.5.2
     257     * @since 2.5.2
    300258     *
    301259     * @param (string) $option  The option name.
     
    397355     */
    398356    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() );
     357        $old_options = get_site_option( static::OPTION_NAME );
    402358
    403359        // 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         }
     360        $sanitized_options = $this->sanitize_slugs( $options );
     361        $errors            = $sanitized_options['errors'];
     362        $sanitized_options = $sanitized_options['slugs'];
    443363
    444364        // Add and sanitize other options.
     
    446366
    447367        foreach ( $default_options as $option_name => $default_value ) {
    448 
    449368            if ( isset( $options[ $option_name ] ) ) {
     369                // Yay!
    450370                $sanitized_options[ $option_name ] = (int) $options[ $option_name ];
    451371            } elseif ( isset( $old_options[ $option_name ] ) ) {
     372                // Old value.
    452373                $sanitized_options[ $option_name ] = (int) $old_options[ $option_name ];
    453374            } else {
     375                // Default value.
    454376                $sanitized_options[ $option_name ] = $default_value;
    455377                continue;
     
    459381
    460382            if ( ! isset( $choices[ $sanitized_options[ $option_name ] ] ) ) {
     383                // Oh no.
    461384                $sanitized_options[ $option_name ] = $default_value;
    462385            }
     
    494417
    495418            if ( $nbr_forbidden = count( $errors['forbidden'] ) ) {
    496                 /** Translators: %s is an URL slug name. */
     419                /* translators: %s is an URL slug name. */
    497420                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'] ) ) );
    498421            }
     
    506429
    507430
     431    /**
     432     * Sanitize slugs.
     433     *
     434     * @param (array) $raw_slugs Slugs to sanitize.
     435     *
     436     * @return (array) An array containing the sanitized slugs and possible errors.
     437     */
     438    public function sanitize_slugs( $raw_slugs = array() ) {
     439        $default_slugs = static::get_sub_options( 'slugs', $this->get_default_options() );
     440        $old_slugs     = get_site_option( static::OPTION_NAME );
     441        $old_slugs     = is_array( $old_slugs ) && $old_slugs ? static::get_sub_options( 'slugs', $old_slugs ) : array();
     442        $old_slugs     = array_merge( $default_slugs, $old_slugs );
     443        $exclude       = $this->get_other_actions();
     444        $raw_slugs     = $raw_slugs && is_array( $raw_slugs ) ? array_map( 'trim', $raw_slugs ) : array();
     445        $output        = array(
     446            'slugs'  => array(),
     447            'errors' => array(
     448                'forbidden'  => array(),
     449                'duplicates' => array(),
     450            ),
     451        );
     452
     453        // First, sanitize the old slugs.
     454        foreach ( $old_slugs as $action => $old_slug ) {
     455            $old_slug             = sanitize_title( $old_slug );
     456            $old_slugs[ $action ] = $old_slug ? $old_slug : $default_slugs[ $action ];
     457        }
     458
     459        // Then, make sure there are no duplicates within the old slugs.
     460        $slugs_count        = count( $old_slugs );
     461        $unique_slugs_count = count( array_unique( $old_slugs ) );
     462
     463        while ( $unique_slugs_count < $slugs_count ) {
     464            $tmp_old_slugs = $old_slugs;
     465
     466            foreach ( $old_slugs as $action => $old_slug ) {
     467                $other_slugs = $old_slugs;
     468                unset( $other_slugs[ $action ] );
     469
     470                if ( ! in_array( $slug, $other_slugs, true ) ) {
     471                    // Not a duplicate.
     472                    $tmp_old_slugs[ $action ] = $old_slug;
     473                } else {
     474                    // Use the default slug (we know it is unique within the default slugs).
     475                    $tmp_old_slugs[ $action ] = $default_slugs[ $action ];
     476                }
     477            }
     478
     479            $old_slugs          = $tmp_old_slugs;
     480            $slugs_count        = count( $old_slugs );
     481            $unique_slugs_count = count( array_unique( $old_slugs ) );
     482        }
     483
     484        // Sanitize the new slugs and make sure they are not forbidden.
     485        foreach ( $default_slugs as $action => $default_slug ) {
     486            $input_name = 'slugs.' . $action;
     487
     488            // First, determinate a fallback.
     489            if ( empty( $raw_slugs[ $input_name ] ) ) {
     490                // If the field was left empty, fallback to the default slug.
     491                $fallback = $default_slug;
     492            } else {
     493                // Use the previous slug (or the default one).
     494                $fallback = $old_slugs[ $action ];
     495            }
     496
     497            $new_slug = sanitize_title( $raw_slugs[ 'slugs.' . $action ], $fallback );
     498
     499            $output['slugs'][ 'slugs.' . $action ] = $new_slug ? $new_slug : $fallback;
     500
     501            // 'postpass', 'retrievepassword' and 'rp' are forbidden by default.
     502            if ( isset( $exclude[ $new_slug ] ) ) {
     503                $output['errors']['forbidden'][ $action ] = $new_slug;
     504                $output['slugs'][ 'slugs.' . $action ]    = $fallback;
     505            }
     506        }
     507
     508        // Look for duplicates.
     509        $slugs_count        = count( $output['slugs'] );
     510        $unique_slugs_count = count( array_unique( $output['slugs'] ) );
     511
     512        while ( $unique_slugs_count < $slugs_count ) {
     513            $new_slugs = $output['slugs'];
     514
     515            foreach ( $output['slugs'] as $input_name => $slug ) {
     516                $other_slugs = $output['slugs'];
     517                unset( $other_slugs[ $input_name ] );
     518
     519                if ( ! in_array( $slug, $other_slugs, true ) ) {
     520                    // Not a duplicate.
     521                    $new_slugs[ $input_name ] = $slug;
     522                    continue;
     523                }
     524
     525                $action = str_replace( 'slugs.', '', $input_name );
     526
     527                // Use the previous slug (we know it is unique within the old slugs).
     528                $new_slugs[ $input_name ]                  = $old_slugs[ $action ];
     529                $output['errors']['duplicates'][ $action ] = $old_slugs[ $action ];
     530            }
     531
     532            $output['slugs']    = $new_slugs;
     533            $slugs_count        = count( $output['slugs'] );
     534            $unique_slugs_count = count( array_unique( $output['slugs'] ) );
     535        }
     536
     537        return $output;
     538    }
     539
     540
    508541    /*--------------------------------------------------------------------------------------------*/
    509542    /* !VARIOUS ================================================================================= */
     
    511544
    512545    /**
    513      * Return the "other" original login actions: not the ones listed in our settings.
     546     * Get the original login actions that are not listed in the settings page.
     547     * Plugins can add them to the settings page though.
    514548     *
    515549     * @return (array)
     
    517551    public function get_other_actions() {
    518552        return array_diff_key( array(
    519             'retrievepassword' => 'retrievepassword',
    520             'rp'               => 'rp',
     553            'postpass'         => 'postpass',         // Not customizable.
     554            'retrievepassword' => 'retrievepassword', // Alias for lostpassword, not used by WP.
     555            'rp'               => 'rp',               // Alias for resetpass, not used by WP.
     556        ), $this->get_slug_field_labels() );
     557    }
     558
     559
     560    /**
     561     * Get the original login actions that will be rewritten but are not listed in the settings page.
     562     * Those actions don't redirect to other login actions (and the visitors don't see them), so there's no need to bother the user with a useless setting.
     563     * Plugins can add them to the settings page though.
     564     *
     565     * @since 2.5.3
     566     *
     567     * @return (array)
     568     */
     569    public function get_non_customizable_actions() {
     570        return array_diff_key( array(
     571            'postpass' => 'postpass',
    521572        ), $this->get_slug_field_labels() );
    522573    }
     
    543594        }
    544595    }
     596
     597
     598    /**
     599     * Get sub-options.
     600     *
     601     * For example:
     602     * static::get_sub_options( 'foo', array(
     603     *     'option1'     => 'value1',
     604     *     'foo.option2' => 'value2',
     605     *     'foo.option3' => 'value3',
     606     * ) );
     607     * Will return:
     608     * array(
     609     *     'option2' => 'value2',
     610     *     'option3' => 'value3',
     611     * )
     612     *
     613     * @param (string) $name    The sub-option name.
     614     * @param (array)  $options Array of options.
     615     *
     616     * @return (array)
     617     */
     618    public static function get_sub_options( $name, $options ) {
     619        if ( ! $options || ! $name ) {
     620            return array();
     621        }
     622
     623        $options = (array) $options;
     624
     625        if ( isset( $options[ $name ] ) ) {
     626            return $options[ $name ];
     627        }
     628
     629        $group = array();
     630        $name  = rtrim( $name, '.' ) . '.';
     631
     632        foreach ( $options as $k => $v ) {
     633            if ( 0 === strpos( $k, $name ) ) {
     634                $group[ substr( $k, strlen( $name ) ) ] = $v;
     635            }
     636        }
     637
     638        return ! empty( $group ) ? $group : null;
     639    }
    545640}
  • sf-move-login/trunk/inc/classes/class-sfml-singleton.php

    r1566761 r1671125  
    11<?php
    2 defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
     2defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
    33
    44/**
  • sf-move-login/trunk/inc/functions/compat.php

    r1664767 r1671125  
    11<?php
    2 if ( ! defined( 'ABSPATH' ) ) {
    3     die( 'Cheatin\' uh?' );
    4 }
     2defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
    53
    64if ( ! function_exists( 'set_url_scheme' ) ) :
     
    7573            return win_is_writable( $path );
    7674        }
    77         return @is_writable( $path );
     75        return @call_user_func( 'is_writable', $path );
    7876    }
    7977endif;
     
    124122        }
    125123
    126         $parts = @parse_url( $url );
     124        $parts = @call_user_func( 'parse_url', $url );
    127125
    128126        if ( false === $parts ) {
  • sf-move-login/trunk/inc/functions/deprecated.php

    r1653817 r1671125  
    11<?php
    2 if ( ! defined( 'ABSPATH' ) ) {
    3     die( 'Cheatin\' uh?' );
    4 }
     2defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
    53
    64
     
    1816
    1917    // If it's not the administration area, or if it's an ajax call, no need to go further.
    20     if ( ! ( is_admin() && ! ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || ( 'admin-post.php' === $pagenow && ! empty( $_REQUEST['action'] ) ) ) ) ) {
     18    if ( ! ( is_admin() && ! ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || ( 'admin-post.php' === $pagenow && ! empty( $_REQUEST['action'] ) ) ) ) ) { // WPCS: CSRF ok.
    2119        return;
    2220    }
  • sf-move-login/trunk/inc/functions/rewrite.php

    r1664767 r1671125  
    11<?php
    2 if ( ! defined( 'ABSPATH' ) ) {
    3     die( 'Cheatin\' uh?' );
    4 }
     2defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
    53
    64/*------------------------------------------------------------------------------------------------*/
     
    2624    if ( ! $actions || ! is_array( $actions ) ) {
    2725        $actions = sfml_get_slugs();
     26    } else {
     27        $actions = array_merge( SFML_Options::get_instance()->get_non_customizable_actions(), $actions );
    2828    }
    2929
     
    103103    }
    104104
    105     $base     = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
     105    $base     = wp_parse_url( trailingslashit( get_option( 'home' ) ) );
     106    $base     = $base['path'];
    106107    $wp_dir   = sfml_get_wp_directory();     // WP in its own directory.
    107108    $is_sub   = sfml_is_subfolder_install(); // MultiSite by sub-folders.
     
    109110
    110111    $bases = array(
    111         'base'     => $base,     // '/' or '/sub-dir/'.
    112         'wp_dir'   => $wp_dir,   // '' or '/wp-dir/'.
    113         'site_dir' => $site_dir, // '/', '/wp-dir/', '/sub-dir/', or '/sub-dir/wp-dir/'.
    114         'is_sub'   => $is_sub,   // True or false.
     112        'base'     => $base,     // Possible values: '/' or '/sub-dir/'.
     113        'wp_dir'   => $wp_dir,   // Possible values: '' or '/wp-dir/'.
     114        'site_dir' => $site_dir, // Possible values: '/', '/wp-dir/', '/sub-dir/', or '/sub-dir/wp-dir/'.
     115        'is_sub'   => $is_sub,   // Possible values: true or false.
    115116    );
    116117
     
    303304    }
    304305
     306    $filesystem    = sfml_get_filesystem();
    305307    $htaccess_file = sfml_get_home_path() . '.htaccess';
    306     $has_htaccess  = file_exists( $htaccess_file );
     308    $has_htaccess  = $filesystem->exists( $htaccess_file );
    307309
    308310    if ( ! $rules ) {
     
    327329    $marker  = 'SF Move Login';
    328330    // Current htaccess content.
    329     $content = $has_htaccess ? file_get_contents( $htaccess_file ) : '';
     331    $content = $has_htaccess ? $filesystem->get_contents( $htaccess_file ) : '';
    330332    // Remove the SF Move Login marker.
    331333    $content = preg_replace( "/# BEGIN $marker.*# END $marker\n*/is", '', $content );
     
    337339
    338340    // Update the `.htaccess` file.
    339     $filesystem = sfml_get_filesystem();
    340341    return (bool) $filesystem->put_contents( $htaccess_file , $content );
    341342}
     
    364365
    365366    foreach ( $rules as $slug => $rule ) {
    366         $out[] = $space . '<rule name="SF Move Login Rule ' . $rule_i . '" stopProcessing="true">' . "\n"
    367                . $space . '  <match url="^' . $bases['site_from'] . $slug . '/?$" ignoreCase="false" />' . "\n"
    368                . $space . '  <action type="Redirect" url="' . $bases['site_dir'] . $rule . '" redirectType="Permanent" />' . "\n"
    369                . $space . '</rule>';
     367        $full_rule  = $space . '<rule name="SF Move Login Rule ' . $rule_i . '" stopProcessing="true">' . "\n";
     368        $full_rule .= $space . '  <match url="^' . $bases['site_from'] . $slug . '/?$" ignoreCase="false" />' . "\n";
     369        $full_rule .= $space . '  <action type="Redirect" url="' . $bases['site_dir'] . $rule . '" redirectType="Permanent" />' . "\n";
     370        $full_rule .= $space . '</rule>';
     371
     372        $out[] = $full_rule;
    370373        $rule_i++;
    371374    }
  • sf-move-login/trunk/inc/functions/settings-page.php

    r1664767 r1671125  
    11<?php
    2 if ( ! defined( 'ABSPATH' ) ) {
    3     die( 'Cheatin\' uh?' );
    4 }
     2defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
     3
     4/*------------------------------------------------------------------------------------------------*/
     5/* !ASSETS ====================================================================================== */
     6/*------------------------------------------------------------------------------------------------*/
     7
     8add_action( 'admin_enqueue_scripts', 'sfml_enqueue_settings_assets' );
     9/**
     10 * Enqueue assets for the settings page.
     11 *
     12 * @since 2.5.3
     13 */
     14function sfml_enqueue_settings_assets() {
     15    $suffix  = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
     16    $version = $suffix ? SFML_VERSION : time();
     17
     18    wp_enqueue_script( 'move-login-settings',  plugin_dir_url( SFML_FILE ) . 'assets/js/settings' . $suffix . '.js', array( 'jquery' ), $version, true );
     19
     20    wp_localize_script( 'move-login-settings', 'sfml', array(
     21        'nonce'       => wp_create_nonce( 'sfml_sanitize_slug' ),
     22        'error'       => __( 'Error', 'sf-move-login' ),
     23        'errorReload' => __( 'Error. Please reload the page.', 'sf-move-login' ),
     24        /* translators: %s is an URL slug name. */
     25        'forbidden'   => _n( 'The slug %s is forbidden.', 'The slugs %s are forbidden.', 1, 'sf-move-login' ),
     26        'duplicate'   => _x( 'Duplicate.', 'adjective', 'sf-move-login' ),
     27    ) );
     28}
     29
     30
     31add_action( 'admin_print_scripts-settings_page_move-login', 'sfml_print_settings_css' );
     32/**
     33 * Print some CSS on the settings page.
     34 *
     35 * @since 2.5.3
     36 */
     37function sfml_print_settings_css() {
     38    echo '<style>.dynamic-login-url-slug-error, .sfml-warning { color: red; }</style>';
     39}
     40
    541
    642/*------------------------------------------------------------------------------------------------*/
     
    1248 */
    1349function sfml_settings_fields() {
    14     $instance = SFML_Options::get_instance();
    15     $labels   = $instance->get_field_labels( 'slugs' );
    16     $defaults = sfml_get_default_options();
    17     $options  = sfml_get_options();
     50    $instance  = SFML_Options::get_instance();
     51    $labels    = $instance->get_field_labels( 'slugs' );
     52    $defaults  = sfml_get_default_options();
     53    $options   = sfml_get_options();
     54    $login_url = site_url( '%%slug%%', 'login' );
    1855
    1956    // Sections.
     
    3572            'slugs',
    3673            array(
    37                 'label_for'  => 'slugs-' . $slug,
    38                 'name'       => 'slugs.' . $slug,
    39                 'value'      => $options[ 'slugs.' . $slug ],
    40                 'default'    => $slug,
    41                 'attributes' => array(
    42                     'pattern' => '[0-9a-z_-]*',
    43                     'title'   => __( 'Only lowercase letters, digits, - and _', 'sf-move-login' ),
     74                'label_for'      => 'slugs-' . $slug,
     75                'name'           => 'slugs.' . $slug,
     76                'value'          => $options[ 'slugs.' . $slug ],
     77                'default'        => $slug,
     78                'default_hidden' => true,
     79                'after'          => "&#160;\n" . '<em class="hide-if-no-js">' . str_replace( '%%slug%%', '<strong id="dynamic-login-url-slug-' . $slug . '" class="dynamic-login-url-slug">' . $options[ 'slugs.' . $slug ] . '</strong>', $login_url ) . '</em> <span id="dynamic-login-url-slug-error-' . $slug . '" class="dynamic-login-url-slug-error"></span>',
     80                'attributes'     => array(
     81                    'class'       => 'slug-field',
     82                    'title'       => __( 'Only lowercase letters, digits, - and _', 'sf-move-login' ),
     83                    'placeholder' => $slug,
    4484                ),
    4585            )
     
    91131    global $parent_file;
    92132    // Prevent wp-admin/options-head.php to be included.
    93     $parent_file .= '#sfml';
     133    $parent_file .= '#sfml'; // WPCS: override ok.
    94134}
    95135
     
    107147            echo '<h1>Move Login</h1>';
    108148        } else {
    109             screen_icon( 'tools' );
     149            call_user_func( 'screen_icon', 'tools' );
    110150            echo '<h2>Move Login</h2>';
    111151        }
     
    137177 */
    138178function sfml_text_field( $args ) {
    139     $name    = ! empty( $args['name'] )       ? esc_attr( $args['name'] )                   : ( ! empty( $args['label_for'] ) ? esc_attr( $args['label_for'] ) : false );
    140179    $id      = ! empty( $args['label_for'] )  ? esc_attr( $args['label_for'] )              : false;
     180    $name    = ! empty( $args['name'] )       ? esc_attr( $args['name'] )                   : $id;
    141181    $value   = isset( $args['value'] )        ? esc_attr( $args['value'] )                  : '';
    142182    $default = isset( $args['default'] )      ? esc_attr( $args['default'] )                : null;
    143183    $atts    = ! empty( $args['attributes'] ) ? sfml_build_html_atts( $args['attributes'] ) : '';
     184    $after   = ! empty( $args['after'] )      ? $args['after']                              : '';
    144185
    145186    if ( ! $name ) {
     
    156197
    157198    if ( isset( $default ) ) {
    158         /** Translators: %s is an option value. */
    159         echo ' <span class="description">' . sprintf( _x( '(default: %s)', 'default value', 'sf-move-login' ), $default ) . '</span>';
    160     }
     199        $class = ! empty( $args['default_hidden'] ) ? 'screen-reader-text' : 'description';
     200        /* translators: %s is a default option value. */
     201        echo ' <span class="' . $class . '">' . sprintf( _x( '(default: %s)', 'default value', 'sf-move-login' ), $default ) . '</span>';
     202    }
     203
     204    echo $after;
    161205}
    162206
     
    168212 */
    169213function sfml_radio_field( $args ) {
    170     $name    = ! empty( $args['name'] )      ? esc_attr( $args['name'] )      : ( ! empty( $args['label_for'] ) ? esc_attr( $args['label_for'] ) : false );
    171     $id      = ! empty( $args['label_for'] ) ? esc_attr( $args['label_for'] ) : 'radio-' . $name;
    172     $value   = isset( $args['value'] )       ? $args['value']                 : '';
    173     $values  = isset( $args['values'] )      ? $args['values']                : false;
    174     $default = isset( $args['default'] )     ? $args['default']               : null;
    175     $label   = isset( $args['label'] )       ? $args['label']                 : '';
     214    $label_for = ! empty( $args['label_for'] ) ? esc_attr( $args['label_for'] ) : false;
     215    $name      = ! empty( $args['name'] )      ? esc_attr( $args['name'] )      : $label_for;
     216    $id        = $label_for                    ? $label_for                     : 'radio-' . $name;
     217    $value     = isset( $args['value'] )       ? $args['value']                 : '';
     218    $values    = isset( $args['values'] )      ? $args['values']                : false;
     219    $default   = isset( $args['default'] )     ? $args['default']               : null;
     220    $label     = isset( $args['label'] )       ? $args['label']                 : '';
    176221
    177222    if ( ! $name || ! $values || ! is_array( $values ) ) {
     
    199244
    200245    if ( isset( $default ) && isset( $values[ $default ] ) ) {
    201         /** Translators: %s is an option value. */
    202         echo '<span class="description">' . sprintf( _x( '(default: %s)', 'default value', 'sf-move-login' ), $values[ $default ] ) . '</span>';
     246        $class = ! empty( $args['default_hidden'] ) ? 'screen-reader-text' : 'description';
     247        /* translators: %s is a default option value. */
     248        echo ' <span class="' . $class . '">' . sprintf( _x( '(default: %s)', 'default value', 'sf-move-login' ), $values[ $default ] ) . '</span>';
    203249    }
    204250}
     
    214260
    215261    // Message.
    216     $base              = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
     262    $base              = wp_parse_url( trailingslashit( get_option( 'home' ) ) );
     263    $base              = $base['path'];
    217264    $document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );
    218265    $abspath_fix       = str_replace( '\\', '/', ABSPATH );
     
    226273        $height        = 20;
    227274        $content       = sprintf(
    228             /** Translators: 1 is a file name, 2 is a file path, 3 and 4 are small parts of code. */
     275            /* translators: 1 is a file name, 2 is a file path, 3 and 4 are small parts of code. */
    229276            __( 'If the plugin fails to add the new rewrite rules to your %1$s file, add the following to your %1$s file in %2$s, replacing other %3$s rules if they exist, <strong>above</strong> the line reading %4$s:', 'sf-move-login' ),
    230277            "<code>$file</code>",
     
    240287
    241288        $height        = substr_count( $file_content, "\n" );
    242         $content       = '<span style="color:red">' . sprintf(
    243             /** Translators: 1 is a file name, 2 is a small part of code. */
     289        $content       = '<span class="sfml-warning">' . sprintf(
     290            /* translators: 1 is a file name, 2 is a small part of code. */
    244291            __( '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.', 'sf-move-login' ),
    245292            "<code>$file</code>",
     
    258305        $height        = substr_count( $file_content, "\n" );
    259306        $content       = sprintf(
    260             /** Translators: 1 is a file name, 2 is a file path, 3 and 4 are small parts of code. */
     307            /* translators: 1 is a file name, 2 is a file path, 3 and 4 are small parts of code. */
    261308            __( 'If the plugin fails to add the new rewrite rules to your %1$s file, add the following to your %1$s file in %2$s, replacing other %3$s rules if they exist, <strong>above</strong> the line reading %4$s:', 'sf-move-login' ),
    262309            "<code>$file</code>",
     
    273320    // Add a warning if the file is not writable.
    274321    if ( $home_path && $file && ! wp_is_writable( $home_path . $file ) ) {
    275         $content .= '</p><p style="color:red">' . sprintf(
    276             /** Translators: %s is a file name. */
     322        $content .= '</p><p class="sfml-warning">' . sprintf(
     323            /* translators: %s is a file name. */
    277324            __( 'Your %s file is not writable.', 'sf-move-login' ),
    278325            "<code>$file</code>"
     
    282329    // Add a warning if the plugin is bypassed.
    283330    if ( defined( 'SFML_ALLOW_LOGIN_ACCESS' ) && SFML_ALLOW_LOGIN_ACCESS ) {
    284         /** Translators: 1 is a constant name, 2 is a constant value. */
     331        /* translators: 1 is a constant name, 2 is a constant value. */
    285332        $content .= '</p><p class="description">' . sprintf( __( 'The constant %1$s is defined to %2$s, the settings below won\'t take effect.', 'sf-move-login' ), '<code>SFML_ALLOW_LOGIN_ACCESS</code>', '<code>true</code>' );
    286333    }
  • sf-move-login/trunk/inc/functions/utilities.php

    r1664767 r1671125  
    11<?php
    2 if ( ! defined( 'ABSPATH' ) ) {
    3     die( 'Cheatin\' uh?' );
    4 }
     2defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
    53
    64/*------------------------------------------------------------------------------------------------*/
     
    117115     * @param (bool) $is True if the server runs Apache. False otherwize.
    118116     */
    119     return apply_filters( 'sfml_is_apache', $is );
     117    $is = apply_filters( 'sfml_is_apache', $is );
     118
     119    // `$is` must be set before being returned (aka don't return the filter result directly or the static var won't keep the right value).
     120    return $is;
    120121}
    121122
     
    150151     * @param (bool) $is True if the server runs IIS7. False otherwize.
    151152     */
    152     return apply_filters( 'sfml_is_iis7', $is );
     153    $is = apply_filters( 'sfml_is_iis7', $is );
     154
     155    // `$is` must be set before being returned (aka don't return the filter result directly or the static var won't keep the right value).
     156    return $is;
    153157}
    154158
     
    180184     * @param (bool) $is True if the server runs Nginx. False otherwize.
    181185     */
    182     return apply_filters( 'sfml_is_nginx', $is );
     186    $is = apply_filters( 'sfml_is_nginx', $is );
     187
     188    // `$is` must be set before being returned (aka don't return the filter result directly or the static var won't keep the right value).
     189    return $is;
    183190}
    184191
     
    235242            $url  = str_replace( $home, '', $url );
    236243            return trim( $url, '/' );
    237         default :
     244        default:
    238245            $url  = explode( '?', $url, 2 );
    239246            return reset( $url );
  • sf-move-login/trunk/inc/redirections-and-dies.php

    r1664767 r1671125  
    11<?php
    2 if ( ! defined( 'ABSPATH' ) ) {
    3     die( 'Cheatin\' uh?' );
    4 }
     2defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
    53
    64/*------------------------------------------------------------------------------------------------*/
     
    132130 */
    133131function sfml_maybe_deny_login_redirect( $location ) {
     132    global $pagenow;
     133
     134    if ( 'wp-login.php' === $pagenow ) {
     135        return $location;
     136    }
     137
    134138    if ( is_user_logged_in() ) {
     139        return $location;
     140    }
     141
     142    if ( wp_get_referer() === $location ) {
     143        return $location;
     144    }
     145
     146    if ( sfml_cache_data( 'allow_redirection' ) ) {
     147        // This can be used by 3rd party plugins.
     148        sfml_cache_data( 'allow_redirection', null );
    135149        return $location;
    136150    }
     
    194208
    195209
     210
     211
     212/*------------------------------------------------------------------------------------------------*/
     213/* !TOOLS ======================================================================================= */
     214/*------------------------------------------------------------------------------------------------*/
     215
    196216/**
    197217 * Trigger a 404 error if headers have not been sent yet.
  • sf-move-login/trunk/inc/url-filters.php

    r1566761 r1671125  
    11<?php
    2 if ( ! defined( 'ABSPATH' ) ) {
    3     die( 'Cheatin\' uh?' );
    4 }
     2defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
    53
    64/*------------------------------------------------------------------------------------------------*/
     
    154152
    155153    // Get the action.
    156     $parsed_path = parse_url( $path );
     154    $parsed_path = wp_parse_url( $path );
    157155
    158156    if ( ! empty( $parsed_path['query'] ) ) {
  • sf-move-login/trunk/languages/sf-move-login-fr_FR.po

    r1664767 r1671125  
    55"Project-Id-Version: SF Move Login\n"
    66"Report-Msgid-Bugs-To: Grégory Viguier <i18n@screenfeed.fr>\n"
    7 "POT-Creation-Date: 2017-05-25 15:27+0200\n"
    8 "PO-Revision-Date: 2017-05-25 16:09+0200\n"
     7"POT-Creation-Date: 2017-06-05 17:13+0200\n"
     8"PO-Revision-Date: 2017-06-05 17:24+0200\n"
    99"Last-Translator: Grégory Viguier <i18n@screenfeed.fr>\n"
    1010"Language-Team: Grégory Viguier <i18n@screenfeed.fr>\n"
     
    2323"X-Poedit-SearchPathExcluded-0: *.js\n"
    2424
    25 #. Translators: 1 is the plugin name.
    26 #: inc/activate.php:50
     25#. translators: 1 is the plugin name.
     26#: inc/activate.php:48
    2727#, php-format
    2828msgid "%s has not been activated."
    2929msgstr "%s n&rsquo;a pas été activé."
    3030
    31 #: inc/activate.php:52
     31#: inc/activate.php:50 inc/functions/settings-page.php:22
    3232msgid "Error"
    3333msgstr "Erreur"
    3434
    35 #. Translators: 1 is the plugin name.
    36 #: inc/activate.php:115
     35#. translators: 1 is the plugin name.
     36#: inc/activate.php:113
    3737#, php-format
    3838msgid "It seems your server configuration prevents the plugin to work properly. %s won't work."
    3939msgstr "Il semble que votre configuration serveur empêche l&rsquo;extension de fonctionner correctement. %s ne pourra pas fonctionner."
    4040
    41 #. Translators: 1 is the plugin name.
    42 #: inc/activate.php:117
     41#. translators: 1 is the plugin name.
     42#: inc/activate.php:115
    4343#, php-format
    4444msgid "It seems the url rewrite module is not activated on your server. %s won't work."
    4545msgstr "Il semble que le module de réécriture d&rsquo;url n&rsquo;est pas activé sur votre serveur. %s ne pourra pas fonctionner."
    4646
    47 #. Translators: 1, 2, and 3 are server technologies (Apache, Nginx, IIS7), 4 is the plugin name.
    48 #: inc/activate.php:119
     47#. translators: 1, 2, and 3 are server technologies (Apache, Nginx, IIS7), 4 is the plugin name.
     48#: inc/activate.php:117
    4949#, php-format
    5050msgid "It seems your server does not use %1$s, %2$s, nor %3$s. %4$s won't work."
    5151msgstr "Il semble que votre serveur n&rsquo;utilise ni %1$s, %2$s, ou %3$s. %4$s ne pourra pas fonctionner."
    5252
    53 #. Translators: 1 is the plugin name, 2 is a file name, 3 is a "Move Login" link.
    54 #: inc/activate.php:121
     53#. translators: 1 is the plugin name, 2 is a file name, 3 is a "Move Login" link.
     54#: inc/activate.php:119
    5555#, php-format
    5656msgid "%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."
    5757msgstr "%1$s a besoin d&rsquo;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."
    5858
    59 #. Translators: 1 is a server technology (Nginx), 2 is a "Move Login" link, 3 is the plugin name.
    60 #: inc/activate.php:123
     59#. translators: 1 is a server technology (Nginx), 2 is a "Move Login" link, 3 is the plugin name.
     60#: inc/activate.php:121
    6161#, php-format
    6262msgid "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."
    6363msgstr "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."
    6464
    65 #: inc/admin.php:152 inc/functions/deprecated.php:87
    66 #: inc/redirections-and-dies.php:181
     65#: inc/admin.php:151 inc/functions/deprecated.php:85
     66#: inc/redirections-and-dies.php:195
    6767msgid "Cheatin&#8217; uh?"
    6868msgstr "Alors, on triche&nbsp;?"
    6969
    70 #: inc/classes/class-sfml-options.php:312
    71 #: inc/classes/class-sfml-options.php:319
     70#: inc/classes/class-sfml-options.php:270
     71#: inc/classes/class-sfml-options.php:277
    7272msgid "Display an error message"
    7373msgstr "Afficher un message d'erreur"
    7474
    75 #: inc/classes/class-sfml-options.php:313
    76 #: inc/classes/class-sfml-options.php:320
     75#: inc/classes/class-sfml-options.php:271
     76#: inc/classes/class-sfml-options.php:278
    7777msgid "Trigger a &laquo;Page not found&raquo; error"
    7878msgstr "Déclencher une erreur &laquo;&#160;Page non trouvée&#160;&raquo;"
    7979
    80 #: inc/classes/class-sfml-options.php:314
    81 #: inc/classes/class-sfml-options.php:321
     80#: inc/classes/class-sfml-options.php:272
     81#: inc/classes/class-sfml-options.php:279
    8282msgid "Redirect to a \"WordPress\" &laquo;Page not found&raquo; error page"
    8383msgstr "Rediriger vers une page d&rsquo;erreur &laquo;&#160;Page non trouvée&#160;&raquo; de WordPress"
    8484
    85 #: inc/classes/class-sfml-options.php:315
    86 #: inc/classes/class-sfml-options.php:322
     85#: inc/classes/class-sfml-options.php:273
     86#: inc/classes/class-sfml-options.php:280
    8787msgid "Redirect to the home page"
    8888msgstr "Rediriger vers la page d&rsquo;accueil"
    8989
    90 #: inc/classes/class-sfml-options.php:318
     90#: inc/classes/class-sfml-options.php:276
    9191msgid "Do nothing, redirect to the new login page (not recommended)"
    9292msgstr "Ne rien faire, rediriger vers la nouvelle page de connexion (non recommandé)"
    9393
    94 #. Translators: %s is an URL slug name.
    95 #: inc/classes/class-sfml-options.php:497
     94#. translators: %s is an URL slug name.
     95#: inc/classes/class-sfml-options.php:420 inc/functions/settings-page.php:25
    9696#, php-format
    9797msgid "The slug %s is forbidden."
     
    100100msgstr[1] "Les identifiants %s sont interdits."
    101101
    102 #: inc/classes/class-sfml-options.php:500
     102#: inc/classes/class-sfml-options.php:423
    103103msgid "The links can't have the same slugs."
    104104msgstr "Les liens ne peuvent pas avoir les mêmes identifiants."
    105105
    106 #. Translators: 1: WordPress hook name, 2: version number, 3: alternative hook name.
    107 #: inc/functions/compat.php:285
     106#: inc/functions/compat.php:283
    108107#, php-format
    109108msgid "%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead."
    110109msgstr "%1$s est <strong>déprécié</strong> depuis la version %2$s ! Utilisez %3$s à la place."
    111110
    112 #. Translators: 1: WordPress hook name, 2: version number.
    113 #: inc/functions/compat.php:288
     111#: inc/functions/compat.php:286
    114112#, php-format
    115113msgid "%1$s is <strong>deprecated</strong> since version %2$s with no alternative available."
    116114msgstr "%1$s est <strong>déprécié</strong> depuis la version %2$s, aucune alternative n&rsquo;est disponible."
    117115
    118 #: inc/functions/deprecated.php:87 inc/redirections-and-dies.php:112
    119 #: inc/redirections-and-dies.php:181
     116#: inc/functions/deprecated.php:85 inc/redirections-and-dies.php:110
     117#: inc/redirections-and-dies.php:195
    120118msgid "Nope :)"
    121119msgstr "Raté :)"
    122120
    123 #: inc/functions/settings-page.php:20
     121#: inc/functions/settings-page.php:23
     122msgid "Error. Please reload the page."
     123msgstr "Erreur. Veuillez recharger la page."
     124
     125#: inc/functions/settings-page.php:26
     126msgctxt "adjective"
     127msgid "Duplicate."
     128msgstr "Doublon."
     129
     130#: inc/functions/settings-page.php:57
    124131msgid "Choose your new URLs"
    125132msgstr "Choisissez vos nouvelles adresses"
    126133
    127 #: inc/functions/settings-page.php:21
     134#: inc/functions/settings-page.php:58
    128135msgid "Access"
    129136msgstr "Accès"
    130137
    131 #: inc/functions/settings-page.php:43
     138#: inc/functions/settings-page.php:82
    132139msgid "Only lowercase letters, digits, - and _"
    133140msgstr "Seulement des lettres minuscules, chiffres, - et _"
    134141
    135 #: inc/functions/settings-page.php:61
     142#: inc/functions/settings-page.php:101
    136143msgid "When a logged out user attempts to access the old login page."
    137144msgstr "Quand un utilisateur non connecté tente d'accéder à l'ancienne page de connexion."
    138145
    139 #: inc/functions/settings-page.php:68
     146#: inc/functions/settings-page.php:108
    140147msgctxt "noun"
    141148msgid "Redirects"
    142149msgstr "Redirections"
    143150
    144 #: inc/functions/settings-page.php:77
     151#: inc/functions/settings-page.php:117
    145152msgid "Instead of redirecting a logged out user to the new login page:"
    146153msgstr "Plutôt que de rediriger un utilisateur non connecté vers la nouvelle page de connexion&nbsp;:"
    147154
    148 #. Translators: %s is an option value.
    149 #: inc/functions/settings-page.php:159 inc/functions/settings-page.php:202
     155#. translators: %s is a default option value.
     156#: inc/functions/settings-page.php:201 inc/functions/settings-page.php:248
    150157#, php-format
    151158msgctxt "default value"
     
    153160msgstr "(défaut&#160;: %s)"
    154161
    155 #. Translators: 1 is a file name, 2 is a file path, 3 and 4 are small parts of code.
    156 #: inc/functions/settings-page.php:229 inc/functions/settings-page.php:261
     162#. translators: 1 is a file name, 2 is a file path, 3 and 4 are small parts of code.
     163#: inc/functions/settings-page.php:276 inc/functions/settings-page.php:308
    157164#, php-format
    158165msgid "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:"
    159166msgstr "Si l&rsquo;extension ne peut ajouter les nouvelles règles de réécriture à votre fichier %1$s, ajoutez les lignes suivantes à votre fichier %1$s dans %2$s, en remplacement des autres règles liées à %3$s si elles existent, <strong>au-dessus</strong> de la ligne %4$s&#160;:"
    160167
    161 #. Translators: 1 is a file name, 2 is a small part of code.
    162 #: inc/functions/settings-page.php:244
     168#. translators: 1 is a file name, 2 is a small part of code.
     169#: inc/functions/settings-page.php:291
    163170#, php-format
    164171msgid "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."
    165172msgstr "L&rsquo;extension ne peut ajouter les nouvelles règles de réécriture à votre fichier %1$s, vous devrez les ajouter manuellement à l&rsquo;intérieur du bloc %2$s."
    166173
    167 #. Translators: %s is a file name.
    168 #: inc/functions/settings-page.php:277
     174#. translators: %s is a file name.
     175#: inc/functions/settings-page.php:324
    169176#, php-format
    170177msgid "Your %s file is not writable."
    171178msgstr "Votre fichier %s n&rsquo;est pas inscriptible."
    172179
    173 #. Translators: 1 is a constant name, 2 is a constant value.
    174 #: inc/functions/settings-page.php:285
     180#. translators: 1 is a constant name, 2 is a constant value.
     181#: inc/functions/settings-page.php:332
    175182#, php-format
    176183msgid "The constant %1$s is defined to %2$s, the settings below won't take effect."
    177184msgstr "La constante %1$s est définie à %2$s, les réglages ci-dessous ne prendront pas effet."
    178185
    179 #: inc/redirections-and-dies.php:112
     186#: inc/redirections-and-dies.php:110
    180187msgid "No no no, the login form is not here."
    181188msgstr "Non non non, le formulaire de connexion ne se trouve pas ici."
    182189
    183 #. Translators: Description of the plugin/theme
    184190#. Description of the plugin/theme
    185 #: sf-move-login.php:93
    186191msgid "Change your login URL."
    187192msgstr "Changez l&rsquo;url de votre page de connexion."
  • sf-move-login/trunk/languages/sf-move-login.pot

    r1664767 r1671125  
    33msgstr ""
    44"Project-Id-Version: SF Move Login\n"
    5 "POT-Creation-Date: 2017-05-25 15:27+0200\n"
     5"POT-Creation-Date: 2017-06-05 17:17+0200\n"
    66"PO-Revision-Date: 2017-05-25 15:27+0200\n"
    77"Last-Translator: Grégory Viguier <i18n@screenfeed.fr>\n"
     
    1515"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"
    1616"X-Poedit-SourceCharset: UTF-8\n"
     17"X-Textdomain-Support: yes\n"
    1718"X-Poedit-WPHeader: sf-move-login.php\n"
    1819"X-Poedit-SearchPath-0: .\n"
    1920"X-Poedit-SearchPathExcluded-0: *.js\n"
    2021
    21 #. Translators: 1 is the plugin name.
    22 #: inc/activate.php:50
     22#. translators: 1 is the plugin name.
     23#: inc/activate.php:48
    2324#, php-format
    2425msgid "%s has not been activated."
    2526msgstr ""
    2627
    27 #: inc/activate.php:52
     28#: inc/activate.php:50 inc/functions/settings-page.php:22
    2829msgid "Error"
    2930msgstr ""
    3031
    31 #. Translators: 1 is the plugin name.
    32 #: inc/activate.php:115
     32#. translators: 1 is the plugin name.
     33#: inc/activate.php:113
    3334#, php-format
    3435msgid "It seems your server configuration prevents the plugin to work properly. %s won't work."
    3536msgstr ""
    3637
    37 #. Translators: 1 is the plugin name.
    38 #: inc/activate.php:117
     38#. translators: 1 is the plugin name.
     39#: inc/activate.php:115
    3940#, php-format
    4041msgid "It seems the url rewrite module is not activated on your server. %s won't work."
    4142msgstr ""
    4243
    43 #. Translators: 1, 2, and 3 are server technologies (Apache, Nginx, IIS7), 4 is the plugin name.
    44 #: inc/activate.php:119
     44#. translators: 1, 2, and 3 are server technologies (Apache, Nginx, IIS7), 4 is the plugin name.
     45#: inc/activate.php:117
    4546#, php-format
    4647msgid "It seems your server does not use %1$s, %2$s, nor %3$s. %4$s won't work."
    4748msgstr ""
    4849
    49 #. Translators: 1 is the plugin name, 2 is a file name, 3 is a "Move Login" link.
    50 #: inc/activate.php:121
     50#. translators: 1 is the plugin name, 2 is a file name, 3 is a "Move Login" link.
     51#: inc/activate.php:119
    5152#, php-format
    5253msgid "%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."
    5354msgstr ""
    5455
    55 #. Translators: 1 is a server technology (Nginx), 2 is a "Move Login" link, 3 is the plugin name.
    56 #: inc/activate.php:123
     56#. translators: 1 is a server technology (Nginx), 2 is a "Move Login" link, 3 is the plugin name.
     57#: inc/activate.php:121
    5758#, php-format
    5859msgid "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."
    5960msgstr ""
    6061
    61 #: inc/admin.php:152 inc/functions/deprecated.php:87
    62 #: inc/redirections-and-dies.php:181
     62#: inc/admin.php:151 inc/functions/deprecated.php:85
     63#: inc/redirections-and-dies.php:195
    6364msgid "Cheatin&#8217; uh?"
    6465msgstr ""
    6566
    66 #: inc/classes/class-sfml-options.php:312
    67 #: inc/classes/class-sfml-options.php:319
     67#: inc/classes/class-sfml-options.php:270
     68#: inc/classes/class-sfml-options.php:277
    6869msgid "Display an error message"
    6970msgstr ""
    7071
    71 #: inc/classes/class-sfml-options.php:313
    72 #: inc/classes/class-sfml-options.php:320
     72#: inc/classes/class-sfml-options.php:271
     73#: inc/classes/class-sfml-options.php:278
    7374msgid "Trigger a &laquo;Page not found&raquo; error"
    7475msgstr ""
    7576
    76 #: inc/classes/class-sfml-options.php:314
    77 #: inc/classes/class-sfml-options.php:321
     77#: inc/classes/class-sfml-options.php:272
     78#: inc/classes/class-sfml-options.php:279
    7879msgid "Redirect to a \"WordPress\" &laquo;Page not found&raquo; error page"
    7980msgstr ""
    8081
    81 #: inc/classes/class-sfml-options.php:315
    82 #: inc/classes/class-sfml-options.php:322
     82#: inc/classes/class-sfml-options.php:273
     83#: inc/classes/class-sfml-options.php:280
    8384msgid "Redirect to the home page"
    8485msgstr ""
    8586
    86 #: inc/classes/class-sfml-options.php:318
     87#: inc/classes/class-sfml-options.php:276
    8788msgid "Do nothing, redirect to the new login page (not recommended)"
    8889msgstr ""
    8990
    90 #. Translators: %s is an URL slug name.
    91 #: inc/classes/class-sfml-options.php:497
     91#. translators: %s is an URL slug name.
     92#: inc/classes/class-sfml-options.php:420 inc/functions/settings-page.php:25
    9293#, php-format
    9394msgid "The slug %s is forbidden."
     
    9697msgstr[1] ""
    9798
    98 #: inc/classes/class-sfml-options.php:500
     99#: inc/classes/class-sfml-options.php:423
    99100msgid "The links can't have the same slugs."
    100101msgstr ""
    101102
    102 #. Translators: 1: WordPress hook name, 2: version number, 3: alternative hook name.
    103 #: inc/functions/compat.php:285
     103#: inc/functions/compat.php:283
    104104#, php-format
    105105msgid "%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead."
    106106msgstr ""
    107107
    108 #. Translators: 1: WordPress hook name, 2: version number.
    109 #: inc/functions/compat.php:288
     108#: inc/functions/compat.php:286
    110109#, php-format
    111110msgid "%1$s is <strong>deprecated</strong> since version %2$s with no alternative available."
    112111msgstr ""
    113112
    114 #: inc/functions/deprecated.php:87 inc/redirections-and-dies.php:112
    115 #: inc/redirections-and-dies.php:181
     113#: inc/functions/deprecated.php:85 inc/redirections-and-dies.php:110
     114#: inc/redirections-and-dies.php:195
    116115msgid "Nope :)"
    117116msgstr ""
    118117
    119 #: inc/functions/settings-page.php:20
     118#: inc/functions/settings-page.php:23
     119msgid "Error. Please reload the page."
     120msgstr ""
     121
     122#: inc/functions/settings-page.php:26
     123msgctxt "adjective"
     124msgid "Duplicate."
     125msgstr ""
     126
     127#: inc/functions/settings-page.php:57
    120128msgid "Choose your new URLs"
    121129msgstr ""
    122130
    123 #: inc/functions/settings-page.php:21
     131#: inc/functions/settings-page.php:58
    124132msgid "Access"
    125133msgstr ""
    126134
    127 #: inc/functions/settings-page.php:43
     135#: inc/functions/settings-page.php:82
    128136msgid "Only lowercase letters, digits, - and _"
    129137msgstr ""
    130138
    131 #: inc/functions/settings-page.php:61
     139#: inc/functions/settings-page.php:101
    132140msgid "When a logged out user attempts to access the old login page."
    133141msgstr ""
    134142
    135 #: inc/functions/settings-page.php:68
     143#: inc/functions/settings-page.php:108
    136144msgctxt "noun"
    137145msgid "Redirects"
    138146msgstr ""
    139147
    140 #: inc/functions/settings-page.php:77
     148#: inc/functions/settings-page.php:117
    141149msgid "Instead of redirecting a logged out user to the new login page:"
    142150msgstr ""
    143151
    144 #. Translators: %s is an option value.
    145 #: inc/functions/settings-page.php:159 inc/functions/settings-page.php:202
     152#. translators: %s is a default option value.
     153#: inc/functions/settings-page.php:201 inc/functions/settings-page.php:248
    146154#, php-format
    147155msgctxt "default value"
     
    149157msgstr ""
    150158
    151 #. Translators: 1 is a file name, 2 is a file path, 3 and 4 are small parts of code.
    152 #: inc/functions/settings-page.php:229 inc/functions/settings-page.php:261
     159#. translators: 1 is a file name, 2 is a file path, 3 and 4 are small parts of code.
     160#: inc/functions/settings-page.php:276 inc/functions/settings-page.php:308
    153161#, php-format
    154162msgid "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:"
    155163msgstr ""
    156164
    157 #. Translators: 1 is a file name, 2 is a small part of code.
    158 #: inc/functions/settings-page.php:244
     165#. translators: 1 is a file name, 2 is a small part of code.
     166#: inc/functions/settings-page.php:291
    159167#, php-format
    160168msgid "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."
    161169msgstr ""
    162170
    163 #. Translators: %s is a file name.
    164 #: inc/functions/settings-page.php:277
     171#. translators: %s is a file name.
     172#: inc/functions/settings-page.php:324
    165173#, php-format
    166174msgid "Your %s file is not writable."
    167175msgstr ""
    168176
    169 #. Translators: 1 is a constant name, 2 is a constant value.
    170 #: inc/functions/settings-page.php:285
     177#. translators: 1 is a constant name, 2 is a constant value.
     178#: inc/functions/settings-page.php:332
    171179#, php-format
    172180msgid "The constant %1$s is defined to %2$s, the settings below won't take effect."
    173181msgstr ""
    174182
    175 #: inc/redirections-and-dies.php:112
     183#: inc/redirections-and-dies.php:110
    176184msgid "No no no, the login form is not here."
    177185msgstr ""
    178186
    179 #. Translators: Description of the plugin/theme
    180187#. Description of the plugin/theme
    181 #: sf-move-login.php:93
    182188msgid "Change your login URL."
    183189msgstr ""
  • sf-move-login/trunk/readme.txt

    r1664767 r1671125  
    44Tags: login, logout, url, security
    55Requires at least: 3.1
    6 Tested up to: 4.7.4
     6Tested up to: 4.7.5
    77Stable tag: trunk
    88License: GPLv3
     
    6868== Changelog ==
    6969
     70= 2.5.3 =
     71
     72* 2017/06/05
     73* New: preview your URLs while typing.
     74* New: you can leave a field empty to set its default value.
     75* Improved URL duplicates detection.
     76* Fixed the "Lost Password" redirection (and others).
     77* Dev stuff: fixed the filters in `sfml_is_apache()`, `sfml_is_iis7()`, and `sfml_is_nginx()`.
     78* Nerd stuff: improved the whole plugin code quality by updating the Coding Standard rules and applying new ones. Changed a few things in the class `SFML_Options`.
     79
    7080= 2.5.2 =
    7181
    7282* 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?).
     83* 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 a simple white page (but do we really care?).
    7484* 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.
     85* Dev stuff: you can now add custom options to the two existing radio groups.
     86* Nerd 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.
    7687
    7788= 2.5.1 =
  • sf-move-login/trunk/sf-move-login.php

    r1664767 r1671125  
    44 * Plugin URI: https://www.screenfeed.fr/plugin-wp/move-login/
    55 * Description: Change your login URL.
    6  * Version: 2.5.2
     6 * Version: 2.5.3
    77 * Author: Grégory Viguier
    88 * Author URI: https://www.screenfeed.fr/
     
    1414 */
    1515
    16 if ( ! defined( 'ABSPATH' ) ) {
    17     die( 'Cheatin\' uh?' );
    18 }
     16defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
    1917
    2018if ( empty( $GLOBALS['wp_version'] ) || version_compare( $GLOBALS['wp_version'], '3.1' ) < 0 || version_compare( phpversion(), '5.3' ) < 0 ) {
     
    2624/*------------------------------------------------------------------------------------------------*/
    2725
    28 define( 'SFML_VERSION',         '2.5.2' );
     26define( 'SFML_VERSION',         '2.5.3' );
    2927define( 'SFML_FILE',            __FILE__ );
    3028define( 'SFML_PLUGIN_BASENAME', plugin_basename( SFML_FILE ) );
     
    5654
    5755    // Administration.
    58     if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
    59         include_once( SFML_PLUGIN_DIR . 'inc/admin.php' );
     56    if ( is_admin() ) {
     57        if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
     58            include_once( SFML_PLUGIN_DIR . 'inc/ajax.php' );
     59        } else {
     60            include_once( SFML_PLUGIN_DIR . 'inc/admin.php' );
     61        }
    6062    }
    6163
     
    8890
    8991    load_plugin_textdomain( 'sf-move-login', false, dirname( plugin_basename( SFML_FILE ) ) . '/languages' );
    90 
    91     // Make sure Poedit keeps our plugin headers.
    92     /** Translators: Description of the plugin/theme */
    93     __( 'Change your login URL.', 'sf-move-login' );
    9492}
  • sf-move-login/trunk/uninstall.php

    r1622279 r1671125  
    11<?php
    2 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
    3     die();
    4 }
     2defined( 'WP_UNINSTALL_PLUGIN' ) || die( 'Cheatin\' uh?' );
    53
    64
Note: See TracChangeset for help on using the changeset viewer.