2013-08-03, 03:55:09
Plugin developers haven't needed this so much because most plugins work well independently, but if new plugins are made that use existing ones as dependencies, it would be nice to have a function that verifies whether or not a certain plugin exists, and what version it currently is.
How it would work
You call the function and give the file name of the plugin (e.g. i18n_base.php, external_comments.php, etc...). It checks to see if the file exists in /plugins and if the plugin has been enabled from the admin panel. Then, if you've set the $version parameter, it checks to see if the registered version is at least as current as the parameter. If both check out, return TRUE, otherwise return FALSE.
This way, plugins that have multiple dependencies have a uniform method of checking for those dependencies, rather than just going on the built in function_exists function and not having a means of verifying the version.
Thoughts?
How it would work
PHP Code:
plugin_exists($filename, $version=null)
You call the function and give the file name of the plugin (e.g. i18n_base.php, external_comments.php, etc...). It checks to see if the file exists in /plugins and if the plugin has been enabled from the admin panel. Then, if you've set the $version parameter, it checks to see if the registered version is at least as current as the parameter. If both check out, return TRUE, otherwise return FALSE.
This way, plugins that have multiple dependencies have a uniform method of checking for those dependencies, rather than just going on the built in function_exists function and not having a means of verifying the version.
Thoughts?