It would be nice if the result of loadPlugins() could be re-used
joho1968 opened this issue · 2 comments
Since the loadPlugins()
function already scans the plugins/
directory, it'd be nice if it, while doing so, could add the name of the plugin to an array that was either public, or getable via a function call. This make a very minor difference in memory consumption, but avoids having to perform similar actions in themes/plugins to check for a specific plugin.
And I guess it'd be nice with a $currentTheme
variable too 😉
(The use case here is that if the Simple Blog plugin is active, and I'm actually on a blog/-like URL, the theme can't/shouldn't show certain fields.)
In the upcoming version of WonderCMS, you can call $Wcms->installedPlugins, which will return the list of all installed plugins (directories).
With plugins do note, if the plugin is installed, it's already active (in contrary to themes, which can be installed, but not active).
For the current theme being active, you could check via the database $this->get('config', 'theme') (which returns the current active theme.
Closing issue, since this was release with 3.4.3 moments ago. :)