Commit 13012857 by pupi1985

Plugins are now sorted by plugin name rather than plugin directory name

parent ead47f13
......@@ -99,24 +99,32 @@
else
$showpluginforms = true;
if (count($pluginfiles)) {
if (!empty($pluginfiles)) {
$metadataUtil = new Q2A_Util_Metadata();
foreach ($pluginfiles as $pluginindex => $pluginfile) {
$plugindirectory = dirname($pluginfile).'/';
$hash = qa_admin_plugin_directory_hash($plugindirectory);
$showthisform = $showpluginforms && (qa_get('show') == $hash);
$metadata = $metadataUtil->fetchFromAddonPath($plugindirectory);
$sortedPluginFiles = array();
foreach ($pluginfiles as $pluginFile) {
$pluginDirectory = dirname($pluginFile) . '/';
$metadata = $metadataUtil->fetchFromAddonPath($pluginDirectory);
if (empty($metadata)) {
// limit plugin parsing to first 8kB
$contents = file_get_contents($pluginfile, false, NULL, -1, 8192);
$contents = file_get_contents($pluginFile, false, NULL, -1, 8192);
$metadata = qa_addon_metadata($contents, 'Plugin');
}
$metadata['name'] = isset($metadata['name']) && !empty($metadata['name'])
? qa_html($metadata['name'])
: qa_lang_html('admin/unnamed_plugin')
;
$sortedPluginFiles[$pluginFile] = $metadata;
}
qa_sort_by($sortedPluginFiles, 'name');
$pluginIndex = -1;
foreach ($sortedPluginFiles as $pluginFile => $metadata) {
$pluginIndex++;
$plugindirectory = dirname($pluginFile . '/');
$hash = qa_admin_plugin_directory_hash($plugindirectory);
$showthisform = $showpluginforms && (qa_get('show') == $hash);
if (isset($metadata['name']) && strlen($metadata['name']))
$namehtml = qa_html($metadata['name']);
else
$namehtml = qa_lang_html('admin/unnamed_plugin');
$namehtml = $metadata['name'];
if (isset($metadata['uri']) && strlen($metadata['uri']))
$namehtml = '<a href="'.qa_html($metadata['uri']).'">'.$namehtml.'</a>';
......@@ -172,7 +180,7 @@
$pluginhtml = '<strike style="color:#999">'.$pluginhtml.'</strike><br><span style="color:#f00">'.
qa_lang_html_sub('admin/requires_php_version', qa_html($metadata['min_php'])).'</span>';
$qa_content['form_plugin_'.$pluginindex] = array(
$qa_content['form_plugin_'.$pluginIndex] = array(
'tags' => 'id="'.qa_html($hash).'"',
'style' => 'tall',
'fields' => array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment