Making WordPress.org

Changeset 2554


Ignore:
Timestamp:
02/23/2016 01:40:44 AM (8 years ago)
Author:
dd32
Message:

Plugins Directory: Create the tab/section links correctly (no double slashes, no multiple endpoints in one url) and add support for the Screenshots & Other Notes tabs/sections.
See #1584

File:
1 edited

Legend:

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

    r2501 r2554  
    5858        $raw_sections = array_unique( array_merge( $raw_sections, array(
    5959            'description',
     60            'screenshots',
    6061            'stats',
    6162            'support',
     
    6465        ) ) );
    6566
    66         $sections = array();
    67         $title    = '';
    68         $url      = get_permalink();
     67        $sections  = array();
     68        $title     = '';
     69        $permalink = get_permalink();
    6970
    7071        foreach ( $raw_sections as $section_slug ) {
     
    7374                case 'description':
    7475                    $title = _x( 'Description', 'plugin tab title', 'wporg-plugins' );
     76                    $url   = $permalink;
    7577                    break;
    7678
    7779                case 'installation':
    7880                    $title = _x( 'Installation', 'plugin tab title', 'wporg-plugins' );
    79                     $url   = trailingslashit( $url ) . '/' . $section_slug . '/';
     81                    $url   = trailingslashit( $permalink ) . $section_slug . '/';
    8082                    break;
    8183
    8284                case 'faq':
    8385                    $title = _x( 'FAQ', 'plugin tab title', 'wporg-plugins' );
    84                     $url   = trailingslashit( $url ) . '/' . $section_slug . '/';
     86                    $url   = trailingslashit( $permalink ) . $section_slug . '/';
    8587                    break;
    8688
    8789                case 'screenshots':
    8890                    $title = _x( 'Screenshots', 'plugin tab title', 'wporg-plugins' );
    89                     $url   = trailingslashit( $url ) . '/' . $section_slug . '/';
     91                    $url   = trailingslashit( $permalink ) . $section_slug . '/';
    9092                    break;
    9193
    9294                case 'changelog':
    9395                    $title = _x( 'Changelog', 'plugin tab title', 'wporg-plugins' );
    94                     $url   = trailingslashit( $url ) . '/' . $section_slug . '/';
     96                    $url   = trailingslashit( $permalink ) . $section_slug . '/';
    9597                    break;
    9698
    9799                case 'stats':
    98100                    $title = _x( 'Stats', 'plugin tab title', 'wporg-plugins' );
    99                     $url   = trailingslashit( $url ) . '/' . $section_slug . '/';
     101                    $url   = trailingslashit( $permalink ) . $section_slug . '/';
    100102                    break;
    101103
     
    112114                case 'developers':
    113115                    $title = _x( 'Developers', 'plugin tab title', 'wporg-plugins' );
    114                     $url   = trailingslashit( $url ) . '/' . $section_slug . '/';
     116                    $url   = trailingslashit( $permalink ) . '/' . $section_slug . '/';
    115117                    break;
     118
     119                case 'other_notes':
     120                    $title = _x( 'Other Notes', 'plugin tab title', 'wporg-plugins' );
     121                    $url   = trailingslashit( $permalink ) . '/' . $section_slug . '/';
     122                    break;
     123
     124                default:
     125                    continue;
    116126            }
    117127
Note: See TracChangeset for help on using the changeset viewer.