Commit 13012857 by pupi1985

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

parent ead47f13
...@@ -99,24 +99,32 @@ ...@@ -99,24 +99,32 @@
else else
$showpluginforms = true; $showpluginforms = true;
if (count($pluginfiles)) { if (!empty($pluginfiles)) {
$metadataUtil = new Q2A_Util_Metadata(); $metadataUtil = new Q2A_Util_Metadata();
foreach ($pluginfiles as $pluginindex => $pluginfile) { $sortedPluginFiles = array();
$plugindirectory = dirname($pluginfile).'/'; foreach ($pluginfiles as $pluginFile) {
$hash = qa_admin_plugin_directory_hash($plugindirectory); $pluginDirectory = dirname($pluginFile) . '/';
$showthisform = $showpluginforms && (qa_get('show') == $hash); $metadata = $metadataUtil->fetchFromAddonPath($pluginDirectory);
$metadata = $metadataUtil->fetchFromAddonPath($plugindirectory);
if (empty($metadata)) { if (empty($metadata)) {
// limit plugin parsing to first 8kB // 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 = 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 = $metadata['name'];
$namehtml = qa_html($metadata['name']);
else
$namehtml = qa_lang_html('admin/unnamed_plugin');
if (isset($metadata['uri']) && strlen($metadata['uri'])) if (isset($metadata['uri']) && strlen($metadata['uri']))
$namehtml = '<a href="'.qa_html($metadata['uri']).'">'.$namehtml.'</a>'; $namehtml = '<a href="'.qa_html($metadata['uri']).'">'.$namehtml.'</a>';
...@@ -172,7 +180,7 @@ ...@@ -172,7 +180,7 @@
$pluginhtml = '<strike style="color:#999">'.$pluginhtml.'</strike><br><span style="color:#f00">'. $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_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).'"', 'tags' => 'id="'.qa_html($hash).'"',
'style' => 'tall', 'style' => 'tall',
'fields' => array( '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