1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 06:07:32 +02:00

Removed the need for pre-registration of core shortcode classes

This commit is contained in:
CaMer0n
2010-02-10 23:11:54 +00:00
parent 50d39fa1a6
commit 316fe99fbb

View File

@@ -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 string $class
* @param boolean $force * @param boolean $force
@@ -267,6 +267,18 @@ class e_shortcode
} }
$path = e_PLUGIN.$key.'/e_shortcode.php'; $path = e_PLUGIN.$key.'/e_shortcode.php';
$classFunc = $key.'_shortcodes'; $classFunc = $key.'_shortcodes';
$this->registerClassMethods($classFunc,$path);
}
}
/**
* Common Auto-Register function for class methods.
*
*/
private function registerClassMethods($classFunc,$path)
{
$this->scClasses[$classFunc] = new $classFunc; $this->scClasses[$classFunc] = new $classFunc;
$tmp = get_class_methods($classFunc); $tmp = get_class_methods($classFunc);
@@ -283,7 +295,7 @@ class e_shortcode
} }
} }
} }
}
/** /**
* Register Core Shortcode Batches. * Register Core Shortcode Batches.
@@ -293,10 +305,15 @@ class e_shortcode
*/ */
function loadCoreShortcodes() function loadCoreShortcodes()
{ {
$coreBatchList = array('admin_shortcodes.php'); $coreBatchList = array('admin_shortcodes');
foreach($coreBatchList as $cb) 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);
}
} }
} }