// +----------------------------------------------------------------------
//
+/**registers a class to be loaded automatically*/
+function wob_autoclass($cname,$fname)
+{
+ global $WOB_AUTOCLASSREG;
+ if(is_string($cname) && is_string($fname)){
+ $WOB_AUTOCLASSREG[$cname]=$fname;
+ return true;
+ }else
+ return false;
+}
+
$d=dirname(__FILE__);
-$AUTOCLASS["DbEngine"]=$d.'/db.php';
-$AUTOCLASS["MysqlEngine"]=$d.'/db_mysql.php';
-$AUTOCLASS["PGsqlEngine"]=$d.'/db_pgsql.php';
-$AUTOCLASS["WobTable"]= $d."/table.php";
-$AUTOCLASS["WobSchemaBase"]=$d."/schema.php";
-$AUTOCLASS["WobTransactionBase"]=$d."/transaction.php";
-$AUTOCLASS["WobXmlException"]=$d."/exception.php";
-$AUTOCLASS["WobTransactionError"]=$d."/exception.php";
-$AUTOCLASS["WObject"]=$d."/object.php";
+wob_autoclass("DbEngine",$d.'/db.php');
+wob_autoclass("MysqlEngine",$d.'/db_mysql.php');
+wob_autoclass("PGsqlEngine",$d.'/db_pgsql.php');
+wob_autoclass("WobTable", $d."/table.php");
+wob_autoclass("WobSchemaBase",$d."/schema.php");
+wob_autoclass("WobTransactionBase",$d."/transaction.php");
+wob_autoclass("WobXmlException",$d."/exception.php");
+wob_autoclass("WobTransactionError",$d."/exception.php");
+wob_autoclass("WObject",$d."/object.php");
//load the linguist dummies, since we use them quite often
include_once($d."/tr.php");
unset($d);
-function __autoload($cname)
+function wob_autoload($cname)
{
- global $AUTOCLASS;
- if(isset($AUTOCLASS[$cname]))
- require_once $AUTOCLASS[$cname];
+ global $WOB_AUTOCLASSREG;
+ if(isset($WOB_AUTOCLASSREG[$cname])){
+ require_once $WOB_AUTOCLASSREG[$cname];
+ return true;
+ }else{
+ return false;
+ }
}
+spl_autoload_register('wob_autoload');
?>