From 316fe99fbb8534944287de142fd63096e1a7f650 Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Wed, 10 Feb 2010 23:11:54 +0000 Subject: [PATCH] Removed the need for pre-registration of core shortcode classes --- e107_handlers/shortcode_handler.php | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/e107_handlers/shortcode_handler.php b/e107_handlers/shortcode_handler.php index ef5144204..ab94c6a0e 100644 --- a/e107_handlers/shortcode_handler.php +++ b/e107_handlers/shortcode_handler.php @@ -125,7 +125,7 @@ function callScFunc($className, $scFuncName, $param= '') } /** - * Create shortcode object + * Create shortcode object - DEPRECATED. use e_shortcode.php or * * @param string $class * @param boolean $force @@ -267,6 +267,18 @@ class e_shortcode } $path = e_PLUGIN.$key.'/e_shortcode.php'; $classFunc = $key.'_shortcodes'; + + $this->registerClassMethods($classFunc,$path); + } + } + + /** + * Common Auto-Register function for class methods. + * + */ + private function registerClassMethods($classFunc,$path) + { + $this->scClasses[$classFunc] = new $classFunc; $tmp = get_class_methods($classFunc); @@ -282,9 +294,9 @@ class e_shortcode } } } - } } + /** * Register Core Shortcode Batches. * FIXME - currently loaded all the time (even on front-end) @@ -293,10 +305,15 @@ class e_shortcode */ function loadCoreShortcodes() { - $coreBatchList = array('admin_shortcodes.php'); + $coreBatchList = array('admin_shortcodes'); + foreach($coreBatchList as $cb) { - include_once(e_CORE.'shortcodes/batch/'.$cb); + $path = e_CORE.'shortcodes/batch/'.$cb.".php"; + if(include_once($path)) + { + $this->registerClassMethods($cb,$path); + } } }