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

git-svn-id: http://svn.automattic.com/wordpress/trunk@4325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2006-10-04 09:36:21 +00:00
parent 3316a65f8e
commit 357cff9ddc
2 changed files with 6 additions and 14 deletions

View File

@ -1705,25 +1705,23 @@ function get_plugins() {
} }
} }
if (!$plugins_dir || !$plugin_files) { if ( !$plugins_dir || !$plugin_files )
return $wp_plugins; return $wp_plugins;
}
sort($plugin_files); foreach ( $plugin_files as $plugin_file ) {
if ( !is_readable("$plugin_root/$plugin_file") )
foreach ($plugin_files as $plugin_file) {
if ( !is_readable("$plugin_root/$plugin_file"))
continue; continue;
$plugin_data = get_plugin_data("$plugin_root/$plugin_file"); $plugin_data = get_plugin_data("$plugin_root/$plugin_file");
if (empty ($plugin_data['Name'])) { if ( empty ($plugin_data['Name']) )
continue; continue;
}
$wp_plugins[plugin_basename($plugin_file)] = $plugin_data; $wp_plugins[plugin_basename($plugin_file)] = $plugin_data;
} }
uasort($wp_plugins, create_function('$a, $b', 'return strnatcasecmp($a["Name"], $b["Name"]);'));
return $wp_plugins; return $wp_plugins;
} }

View File

@ -90,12 +90,6 @@ if (empty($plugins)) {
<?php <?php
$style = ''; $style = '';
function sort_plugins($plug1, $plug2) {
return strnatcasecmp($plug1['Name'], $plug2['Name']);
}
uasort($plugins, 'sort_plugins');
foreach($plugins as $plugin_file => $plugin_data) { foreach($plugins as $plugin_file => $plugin_data) {
$style = ('class="alternate"' == $style|| 'class="alternate active"' == $style) ? '' : 'alternate'; $style = ('class="alternate"' == $style|| 'class="alternate active"' == $style) ? '' : 'alternate';