diff options
Diffstat (limited to 'lib/general.lib.php')
-rw-r--r-- | lib/general.lib.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/general.lib.php b/lib/general.lib.php index 697e0f50..b6c7c3fc 100644 --- a/lib/general.lib.php +++ b/lib/general.lib.php @@ -988,4 +988,42 @@ function get_user_from_username($username) { } // get_user_from_username +/** + * get_plugins + * This returns a list of the plugins and their information + */ +function get_plugins() { + + /* Init our vars */ + $plugins = array(); + + /* Open the dir */ + $handle = opendir(conf('prefix') . '/modules/plugins'); + + if (!is_resource($handle)) { + debug_event('plugins','Error: Unable to read plugins directory','1'); + } + + while ($file = readdir($handle)) { + if (substr($file,-10,10) != 'plugin.php') { continue; } + + /* Make sure it isn't a subdir */ + if (!is_dir($file)) { + + /* Get the Basename */ + $plugin_name = basename($file,'.plugin.php'); + + /* Load it */ + $plugin = new Plugin($plugin_name); + $plugins[$plugin_name] = $plugin; + } // if its not a subdir + + } // end while + + + return $plugins; + +} // get_plugins + + ?> |