diff options
author | Adrian Lang <lang@cosmocode.de> | 2011-06-06 16:20:29 +0200 |
---|---|---|
committer | Adrian Lang <lang@cosmocode.de> | 2011-06-06 16:21:38 +0200 |
commit | d54ac87747635038aaaf9b4c7a2df7a8a0cd450d (patch) | |
tree | e6bb5b3182a8fadef62d743cf63bbf6beeae7f2e /inc/plugincontroller.class.php | |
parent | 1b595a184f93048f862a231951436b3c3f3d1951 (diff) | |
download | rpg-d54ac87747635038aaaf9b4c7a2df7a8a0cd450d.tar.gz rpg-d54ac87747635038aaaf9b4c7a2df7a8a0cd450d.tar.bz2 |
Use autoloading for plugin classes
Diffstat (limited to 'inc/plugincontroller.class.php')
-rw-r--r-- | inc/plugincontroller.class.php | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/inc/plugincontroller.class.php b/inc/plugincontroller.class.php index cec5c73a9..ea5725d47 100644 --- a/inc/plugincontroller.class.php +++ b/inc/plugincontroller.class.php @@ -72,32 +72,21 @@ class Doku_Plugin_Controller { return null; } + $class = $type.'_plugin_'.$name; + //plugin already loaded? if(!empty($DOKU_PLUGINS[$type][$name])){ if ($new || !$DOKU_PLUGINS[$type][$name]->isSingleton()) { - $class = $type.'_plugin_'.$name; - return class_exists($class) ? new $class : null; + return class_exists($class, true) ? new $class : null; } else { return $DOKU_PLUGINS[$type][$name]; } } - //try to load the wanted plugin file - $dir = $this->get_directory($plugin); - $file = $component ? "$type/$component.php" : "$type.php"; - - if(!is_file(DOKU_PLUGIN."$dir/$file")){ - return null; - } - - if (!include_once(DOKU_PLUGIN."$dir/$file")) { - return null; - } - //construct class and instantiate - $class = $type.'_plugin_'.$name; - if (!class_exists($class)){ + if (!class_exists($class, true)) { # the plugin might be in the wrong directory + $dir = $this->get_directory($plugin); $inf = confToHash(DOKU_PLUGIN."$dir/plugin.info.txt"); if($inf['base'] && $inf['base'] != $plugin){ msg("Plugin installed incorrectly. Rename plugin directory '". |