WonderCMS / wondercms

Fast and small flat file CMS (5 files). Built with PHP, JSON database.
https://wondercms.com
MIT License
642 stars 163 forks source link

It would be nice if the result of loadPlugins() could be re-used #299

Closed joho1968 closed 8 months ago

joho1968 commented 1 year ago

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 :wink:

(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.)

robiso commented 8 months ago

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.

robiso commented 8 months ago

Closing issue, since this was release with 3.4.3 moments ago. :)