this time I'm working on a new backend-plugin which contains beside other things a "Plugin-Manager".
Disabling plugins could easy integrated by using $cf['plugins']['disabled'].
To hide plugins from the adminmenu I've planned to use JS on client side.
But IMO that's a bad and tricky solution when it comes to a plugin-menu with more than only one column.
So it comes in mind why not having a $cf['plugins']['hidden'] variable beside the disabled-option?
IMO that's useful and a "plugin-manager" must only provide the form to handle the variables (BTW: it's a pleasure to use the new API of 1.6 for this plugin ).
And a user can manipulate the plugins-menu without a additional plugin.
There are more possible ways to include that feature. On a first look, the final cleanup seems to be the easiest:
in function XH_finalCleanUp($html):
replace the line
Code: Select all
$adminMenu = call_user_func($adminMenuFunc, XH_plugins(true));
Code: Select all
global $cf;
$hiddenPlugins = explode(',', $cf['plugins']['hidden']);
$hiddenPlugins = array_map('trim', $hiddenPlugins);
$plugins = array_diff(XH_plugins(false), $hiddenPlugins);
$adminMenu = call_user_func($adminMenuFunc, $plugins);
So maybe the "cleanest" and most reusable way might be changing XH_plugins($admin = false)
to XH_plugins($staus = '').
The function should contain code to switch between the string in $satus:
case 'admin' : only active plugins with admin.php (as XH_plugins(true) now)
case 'visible' : all active plugins with admin.php and not contained in $cf['plugins']['hidden']
case 'all' : all installed plugins, active or not //just to be complete, maybe usefull for future extensions
default : only active plugins (as XH_plugins() now)
So in final_cleanup the code becomes
Code: Select all
$adminMenu = call_user_func($adminMenuFunc, XH_plugins('visible'));
If we decide to change XH_plugins() we should not wait too long, because the changes may cause incompatibilities in future extensions.
By now, I'm not aware about extensions using that function. But that might change soon.
Anyway, I'm fine with the first solution too.
What do you think?