Making WordPress.org

Changeset 1760


Ignore:
Timestamp:
07/20/2015 10:57:46 AM (10 years ago)
Author:
ocean90
Message:

Translate: Enable natural sorting for bbPress, plugins and themes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-specifics.php

    r1752 r1760  
    2727    }
    2828
     29    /**
     30     * Natural sorting for sub projects.
     31     */
    2932    function projects( $sub_projects, $parent_id ) {
    30         if ( 1 != $parent_id && 13 != $parent_id ) { // 1 = WordPress, 13 = BuddyPress
    31             return $sub_projects;
     33        if ( in_array( $parent_id, array( 1, 13, 58 ) ) ) { // 1 = WordPress, 13 = BuddyPress, 58 = bbPress
     34            usort( $sub_projects, function( $a, $b ) {
     35                return - strcasecmp( $a->name, $b->name );
     36            } );
    3237        }
    3338
    34         /*
    35          * Natural sorting for sub projects.
    36          *
    37          * 3.0.x
    38          * 4.0.x
    39          * 3.1.x
    40          * 4.1.x
    41          *  =>
    42          * 4.1.x
    43          * 4.0.x
    44          * 3.1.x
    45          * 3.0.x
    46          */
    47         usort( $sub_projects, function( $a, $b ) {
    48             return - strcasecmp( $a->name, $b->name );
    49         });
     39        if ( in_array( $parent_id, array( 17, 523 ) ) ) { // 17 = Plugins, 523 = Themes
     40            usort( $sub_projects, function( $a, $b ) {
     41                return strcasecmp( $a->name, $b->name );
     42            } );
     43        }
    5044
    5145        return $sub_projects;
Note: See TracChangeset for help on using the changeset viewer.