Making WordPress.org

Changeset 5178


Ignore:
Timestamp:
03/28/2017 05:02:15 AM (8 years ago)
Author:
dd32
Message:

Plugin Directory: Handle the redirects for $plugin/changelog/ slightly different to validate the slugs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r5147 r5178  
    443443
    444444        // Handle the old plugin tabs URLs.
    445         add_rewrite_rule( '^([^/]+)/(installation|faq|screenshots|changelog|stats|developers|other_notes)/?$', 'index.php?redirect_plugin_tab=$matches[1]/#$matches[2]', 'top' );
     445        add_rewrite_rule( '^([^/]+)/(installation|faq|screenshots|changelog|stats|developers|other_notes)/?$', 'index.php?redirect_plugin=$matches[1]&redirect_plugin_tab=$matches[2]', 'top' );
    446446
    447447        // If changing capabilities around, uncomment this.
     
    950950    public function filter_query_vars( $vars ) {
    951951        $vars[] = 'favorites_user';
     952        $vars[] = 'redirect_plugin';
    952953        $vars[] = 'redirect_plugin_tab';
    953954        $vars[] = 'plugin_admin';
     
    10071008    function custom_redirects() {
    10081009        // Handle a redirect for /$plugin/$tab_name/ to /$plugin/#$tab_name.
    1009         if ( get_query_var( 'redirect_plugin_tab' ) ) {
    1010             wp_safe_redirect( site_url( get_query_var( 'redirect_plugin_tab' ) ) );
     1010        if ( get_query_var( 'redirect_plugin' ) && get_query_var( 'redirect_plugin_tab' ) ) {
     1011            wp_safe_redirect( site_url( get_query_var( 'redirect_plugin' ) . '/#' . get_query_var( 'redirect_plugin_tab' ) ) );
    10111012            die();
    10121013        }
Note: See TracChangeset for help on using the changeset viewer.