From b838050e5828b5cbf32b9e82ce11c9cc54592809 Mon Sep 17 00:00:00 2001 From: Piyush Mishra Date: Sat, 20 Aug 2011 19:11:52 +0530 Subject: added new plugins config cascade and added plugin.info.txt --- inc/pluginutils.php | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'inc/pluginutils.php') diff --git a/inc/pluginutils.php b/inc/pluginutils.php index 85bcaee1e..897020a6c 100644 --- a/inc/pluginutils.php +++ b/inc/pluginutils.php @@ -16,7 +16,7 @@ function plugin_list($type='',$all=false) { global $plugin_controller; return $plugin_controller->getList($type,$all); } -function &plugin_load($type,$name,$new=false,$disabled=false) { +function plugin_load($type,$name,$new=false,$disabled=false) { global $plugin_controller; return $plugin_controller->load($type,$name,$new,$disabled); } @@ -36,3 +36,34 @@ function plugin_directory($plugin) { global $plugin_controller; return $plugin_controller->get_directory($plugin); } +function plugin_getcascade() { + global $plugin_controller; + return $plugin_controller->getCascade(); +} +/** + * return a list (name & type) of all the component plugins that make up this plugin + * + */ +function get_plugin_components($plugin) { + global $plugin_types; + static $plugins; + if(empty($plugins[$plugin])) { + $components = array(); + $path = DOKU_PLUGIN.plugin_directory($plugin).'/'; + + foreach ($plugin_types as $type) { + if (@file_exists($path.$type.'.php')) { $components[] = array('name'=>$plugin, 'type'=>$type); continue; } + + if ($dh = @opendir($path.$type.'/')) { + while (false !== ($cp = readdir($dh))) { + if ($cp == '.' || $cp == '..' || strtolower(substr($cp,-4)) != '.php') continue; + + $components[] = array('name'=>$plugin.'_'.substr($cp, 0, -4), 'type'=>$type); + } + closedir($dh); + } + } + $plugins[$plugin] = $components; + } + return $plugins[$plugin]; +} -- cgit v1.2.3