renamed ExecObject() to ExecMethod()

This commit is contained in:
seek3r 2001-08-07 16:02:55 +00:00
parent 149888c36d
commit c85008c270

View File

@ -92,18 +92,18 @@
and if the class file has not been included it will do so. <br> and if the class file has not been included it will do so. <br>
Syntax: ExecObject('app.class', 'constructor_params'); <br> Syntax: ExecObject('app.class', 'constructor_params'); <br>
Example1: ExecObject('phpgwapi.acl.read'); Example1: ExecObject('phpgwapi.acl.read');
@param $object to execute @param $method to execute
@param $functionparams function param should be an array @param $functionparams function param should be an array
@param $loglevel developers choice of logging level @param $loglevel developers choice of logging level
@param $classparams params to be sent to the contructor @param $classparams params to be sent to the contructor
*/ */
function ExecObject($object, $functionparams = '_UNDEF_', $loglevel = 3, $classparams = '_UNDEF_') function ExecMethod($method, $functionparams = '_UNDEF_', $loglevel = 3, $classparams = '_UNDEF_')
{ {
/* Need to make sure this is working against a single dimensional object */ /* Need to make sure this is working against a single dimensional object */
$partscount = substr_count($object, '.'); $partscount = substr_count($method, '.');
if ($partscount == 2) if ($partscount == 2)
{ {
list($appname,$classname,$functionname) = explode(".", $object); list($appname,$classname,$functionname) = explode(".", $method);
if (!is_object($GLOBALS[$classname])) if (!is_object($GLOBALS[$classname]))
{ {
if ($classparams != '_UNDEF_' && $classparams != True) if ($classparams != '_UNDEF_' && $classparams != True)
@ -125,22 +125,22 @@ function ExecObject($object, $functionparams = '_UNDEF_', $loglevel = 3, $classp
return $GLOBALS[$classname]->$functionname(); return $GLOBALS[$classname]->$functionname();
} }
} }
/* if the $object includes a parent class (multi-dimensional) then we have to work from it */ /* if the $method includes a parent class (multi-dimensional) then we have to work from it */
elseif ($partscount >= 3) elseif ($partscount >= 3)
{ {
$GLOBALS['objectparts'] = explode(".", $object); $GLOBALS['methodparts'] = explode(".", $method);
$classpartnum = $partscount - 1; $classpartnum = $partscount - 1;
$appname = $GLOBALS['objectparts'][0]; $appname = $GLOBALS['methodparts'][0];
$classname = $GLOBALS['objectparts'][$classpartnum]; $classname = $GLOBALS['methodparts'][$classpartnum];
$functionname = $GLOBALS['objectparts'][$partscount]; $functionname = $GLOBALS['methodparts'][$partscount];
/* Now I clear these out of the array so that I can do a proper */ /* Now I clear these out of the array so that I can do a proper */
/* loop and build the $parentobject */ /* loop and build the $parentobject */
unset ($GLOBALS['objectparts'][0]); unset ($GLOBALS['methodparts'][0]);
unset ($GLOBALS['objectparts'][$classpartnum]); unset ($GLOBALS['methodparts'][$classpartnum]);
unset ($GLOBALS['objectparts'][$partscount]); unset ($GLOBALS['methodparts'][$partscount]);
reset ($GLOBALS['objectparts']); reset ($GLOBALS['methodparts']);
$firstparent = 'True'; $firstparent = 'True';
while (list ($key, $val) = each ($GLOBALS['objectparts'])) while (list ($key, $val) = each ($GLOBALS['methodparts']))
{ {
if ($firstparent == 'True') if ($firstparent == 'True')
{ {
@ -152,7 +152,7 @@ function ExecObject($object, $functionparams = '_UNDEF_', $loglevel = 3, $classp
$parentobject .= '->'.$val; $parentobject .= '->'.$val;
} }
} }
unset($GLOBALS['objectparts']); unset($GLOBALS['methodparts']);
eval ('$isobject = is_object('.$parentobject.'->'.$classname.');'); eval ('$isobject = is_object('.$parentobject.'->'.$classname.');');
if (!$isobject) if (!$isobject)
{ {