Suppress showing unsupported addons in the administration.

This commit is contained in:
Michael Vogel 2014-04-29 14:22:37 +02:00
parent 4ca857e110
commit 7b7e372fb0
2 changed files with 37 additions and 25 deletions

View File

@ -222,7 +222,8 @@ function get_plugin_info($plugin){
'name' => $plugin,
'description' => "",
'author' => array(),
'version' => ""
'version' => "",
'status' => ""
);
if (!is_file("addon/$plugin/$plugin.php")) return $info;

View File

@ -1028,13 +1028,24 @@ function admin_page_plugins(&$a){
*/
$plugins = array();
$files = glob("addon/*/");
$files = glob("addon/*/"); /* */
if($files) {
foreach($files as $file) {
if (is_dir($file)){
list($tmp, $id)=array_map("trim", explode("/",$file));
$info = get_plugin_info($id);
$plugins[] = array( $id, (in_array($id, $a->plugins)?"on":"off") , $info);
$show_plugin = true;
// If the addon is unsupported, then only show it, when it is enabled
if ((strtolower($info["status"]) == "unsupported") AND !in_array($id, $a->plugins))
$show_plugin = false;
// Override the above szenario, when the admin really wants to see outdated stuff
if (get_config("system", "show_unsupported_addons"))
$show_plugin = true;
if ($show_plugin)
$plugins[] = array($id, (in_array($id, $a->plugins)?"on":"off") , $info);
}
}
}
@ -1127,16 +1138,16 @@ function admin_page_themes(&$a){
$allowed_themes[] = trim($x);
$themes = array();
$files = glob('view/theme/*');
if($files) {
foreach($files as $file) {
$f = basename($file);
$is_experimental = intval(file_exists($file . '/experimental'));
$files = glob('view/theme/*'); /* */
if($files) {
foreach($files as $file) {
$f = basename($file);
$is_experimental = intval(file_exists($file . '/experimental'));
$is_supported = 1-(intval(file_exists($file . '/unsupported'))); // Is not used yet
$is_allowed = intval(in_array($f,$allowed_themes));
$themes[] = array('name' => $f, 'experimental' => $is_experimental, 'supported' => $is_supported, 'allowed' => $is_allowed);
}
}
}
}
if(! count($themes)) {
notice( t('No themes found.'));