Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
plugin_exists() function?
#1
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
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?
Reply
#2
You can wait for the common hook and then check the plugin array manually.
Problem with a function is it wont return proper results until all plugins are loaded.

I would rather have plugins register their dependancies and ver numbers required and core does the checking and throws hooks back to the user and plugin.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#3
So how does it work? Do you call the common hook within your plugin and then access the plugin array, or wait for the hook to be called in the template? So long as your method provides both the plugin's id and version number for verification, I'm happy.
Reply
#4
Um we'll in a plugin just add action for common hook and in the callback manually check the plugins global array for the plugin in question. You have to make you own function I think to do it.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#5
If your doing it in a template plugins should already be loaded I think.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply




Users browsing this thread: 1 Guest(s)