1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

__autoload handles core handlers now

This commit is contained in:
secretr 2009-10-20 16:00:38 +00:00
parent 20bdd8a7bd
commit df36ed2f6c
2 changed files with 41 additions and 22 deletions

View File

@ -9,8 +9,8 @@
* General purpose file
*
* $Source: /cvs_backup/e107_0.8/class2.php,v $
* $Revision: 1.149 $
* $Date: 2009-10-01 15:05:41 $
* $Revision: 1.150 $
* $Date: 2009-10-20 16:00:38 $
* $Author: secretr $
*
*/
@ -879,7 +879,7 @@ if (!function_exists('checkvalidtheme'))
$sql->db_Mark_Time('Start: Misc Setup');
//------------------------------------------------------------------------------------------------------------------------------------//
if (!class_exists('e107table'))
if (!class_exists('e107table', false))
{
class e107table
{
@ -1248,11 +1248,11 @@ else
define('e_REFERER_SELF', FALSE);
}
//BC, DEPRECATED - use e107::getDateConvert()
if (!class_exists('convert'))
//BC, DEPRECATED - use e107::getDateConvert(), catched by __autoload as well
/*if (!class_exists('convert'))
{
require_once(e_HANDLER.'date_handler.php');
}
}*/
//@require_once(e_HANDLER."IPB_int.php");
//@require_once(e_HANDLER."debug_handler.php");
@ -2099,18 +2099,38 @@ function plugInstalled($plugname)
return isset($pref['plug_installed'][$plugname]);*/
}
function __autoload($className) {
$tmp = explode('_', $className);
//TODO: Make it support core classes in e107_handlers
if('plugin' !== $tmp[0]) { return; }
if('plugin' == $tmp[0])
/**
* Magic autoload
* TODO - move to spl_autoload[_*] some day (PHP5 > 5.1.2)
* @param string $className
* @return void
*/
function __autoload($className)
{
//Security...
if (strpos($className, '/') !== false)
{
return;
}
$tmp = explode('_', $className);
switch($tmp[0])
{
case 'plugin':
case 'eplug_':
array_shift($tmp);
$filename = e_PLUGIN.implode('/', $tmp).'.php';
//TODO add debug screen Auto-loaded classes - ['plugin: '.$filename.' - '.$className];
break;
default: //core libraries
$filename = e107::getHandlerPath($className, true);
//TODO add debug screen Auto-loaded classes - ['core: '.$filename.' - '.$className];
break;
}
else
if($filename)
{
$filename = e_HANDLER.implode('/', $tmp).'.php';
include($filename);
}
require_once($filename);
} // end __autoload
}

View File

@ -9,8 +9,8 @@
* e107 Shortcode handler
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $
* $Revision: 1.33 $
* $Date: 2009-09-25 20:15:19 $
* $Revision: 1.34 $
* $Date: 2009-10-20 16:00:37 $
* $Author: secretr $
*/
@ -216,8 +216,6 @@ class e_shortcode
}
}
/**
* Register Plugin Shortcode Batch files (e_shortcode.php) for use site-wide.
* Equivalent to multiple .sc files in the plugin's folder.
@ -260,6 +258,7 @@ class e_shortcode
/**
* Register Core Shortcode Batches.
* FIXME - currently loaded all the time (even on front-end)
* @return
*/
function loadCoreShortcodes()
@ -392,7 +391,7 @@ class e_shortcode
$_method = 'sc_'.strtolower($code);
if(!isset($this->scClasses[$_class]))
{
if(!class_exists($_class) && $this->registered_codes[$code]['path'])
if(!class_exists($_class, false) && $this->registered_codes[$code]['path'])
{
include_once($this->registered_codes[$code]['path']);
}