summaryrefslogtreecommitdiff
path: root/inc/pluginutils.php
diff options
context:
space:
mode:
authorPiyush Mishra <me@piyushmishra.com>2011-08-20 19:11:52 +0530
committerPiyush Mishra <me@piyushmishra.com>2011-08-20 19:11:52 +0530
commitb838050e5828b5cbf32b9e82ce11c9cc54592809 (patch)
tree8407ac84b8dcb098e8e9f36cea67c93cea101353 /inc/pluginutils.php
parentbedfa6abf0ea09be1ea44de0c014d83bd57a7412 (diff)
downloadrpg-b838050e5828b5cbf32b9e82ce11c9cc54592809.tar.gz
rpg-b838050e5828b5cbf32b9e82ce11c9cc54592809.tar.bz2
added new plugins config cascade and added plugin.info.txt
Diffstat (limited to 'inc/pluginutils.php')
-rw-r--r--inc/pluginutils.php33
1 files changed, 32 insertions, 1 deletions
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];
+}