/**
* Steuert Klassen ohne Instanzverlust an
*
* @param mixed $class
* @param string[optional] $function
* @param mixed[optional] $wert
*
* @staticvar $objekt
*
* @return mixed
*/
function &oop($class,$function=NULL,$wert=NULL) {
static $objekt;
$return = NULL;
$class = explode(",",$class);
if (!is_array($wert))
$wert = array($wert);
foreach($class as $load)
if (!isset($objekt[$load])) {
eval ("\$objekt[\$load] = new \$load('".((is_null($function) && !is_null($wert)) ? implode("','",$wert) : '')."');");
global $$load;
$$load = $objekt[$load];
}
if (!is_null($function) && preg_match("%^[-_a-zA-Z]+$%",$function))
if (!preg_match('%^[-_a-zA-Z]+$%',$function))
trigger_error(__FUNCTION__.':001');
else {
$implode = array();
foreach($wert as $value)
$implode[] = (is_array($value)) ? 'array(\''.implode('\',\'',$value).'\')' : '\''.$value.'\'';
## WalkAround: Zur Sicherstellung einmaliger Funktionen trotz Vererbung
$function = $class[0].'_'.$function;
eval ("\$return = \$objekt[\$class[0]]->".$function."(".implode(',',$implode).");");
}
return $return;
}