Make WordPress Core

Changeset 4325


Ignore:
Timestamp:
10/04/2006 09:36:21 AM (20 years ago)
Author:
markjaquith
Message:

move plugin sorting (by Name) to get_plugins() so that it works for the Edit Plugins page too. fixes: #2412

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-functions.php

    r4274 r4325  
    17061706        }
    17071707
    1708         if (!$plugins_dir || !$plugin_files) {
     1708        if ( !$plugins_dir || !$plugin_files )
    17091709                return $wp_plugins;
    1710         }
    1711 
    1712         sort($plugin_files);
    1713 
    1714         foreach ($plugin_files as $plugin_file) {
    1715                 if ( !is_readable("$plugin_root/$plugin_file"))
     1710
     1711        foreach ( $plugin_files as $plugin_file ) {
     1712                if ( !is_readable("$plugin_root/$plugin_file") )
    17161713                        continue;
    17171714
    17181715                $plugin_data = get_plugin_data("$plugin_root/$plugin_file");
    17191716
    1720                 if (empty ($plugin_data['Name'])) {
     1717                if ( empty ($plugin_data['Name']) )
    17211718                        continue;
    1722                 }
    17231719
    17241720                $wp_plugins[plugin_basename($plugin_file)] = $plugin_data;
    17251721        }
     1722
     1723        uasort($wp_plugins, create_function('$a, $b', 'return strnatcasecmp($a["Name"], $b["Name"]);'));
    17261724
    17271725        return $wp_plugins;
  • trunk/wp-admin/plugins.php

    r4322 r4325  
    9191        $style = '';
    9292
    93         function sort_plugins($plug1, $plug2) {
    94                 return strnatcasecmp($plug1['Name'], $plug2['Name']);
    95         }
    96 
    97         uasort($plugins, 'sort_plugins');
    98 
    9993        foreach($plugins as $plugin_file => $plugin_data) {
    10094                $style = ('class="alternate"' == $style|| 'class="alternate active"' == $style) ? '' : 'alternate';
Note: See TracChangeset for help on using the changeset viewer.