mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 07:09:20 +01:00
Add obj creation test with error_report adjust for createobject, make lang handle
array as first value
This commit is contained in:
parent
a55296403b
commit
c19c3f3966
@ -47,18 +47,21 @@
|
|||||||
$p13='_UNDEF_',$p14='_UNDEF_',$p15='_UNDEF_',$p16='_UNDEF_')
|
$p13='_UNDEF_',$p14='_UNDEF_',$p15='_UNDEF_',$p16='_UNDEF_')
|
||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info, $phpgw_domain;
|
global $phpgw, $phpgw_info, $phpgw_domain;
|
||||||
|
|
||||||
|
error_reporting(0);
|
||||||
|
|
||||||
$classpart = explode (".", $classname);
|
$classpart = explode (".", $classname);
|
||||||
$appname = $classpart[0];
|
$appname = $classpart[0];
|
||||||
$classname = $classpart[1];
|
$classname = $classpart[1];
|
||||||
if (!isset($phpgw_info['flags']['included_classes'][$classname])
|
if (!isset($phpgw_info['flags']['included_classes'][$classname]) ||
|
||||||
|| !$phpgw_info['flags']['included_classes'][$classname])
|
!$phpgw_info['flags']['included_classes'][$classname])
|
||||||
{
|
{
|
||||||
$phpgw_info['flags']['included_classes'][$classname] = True;
|
$phpgw_info['flags']['included_classes'][$classname] = True;
|
||||||
include(PHPGW_INCLUDE_ROOT.'/'.$appname.'/inc/class.'.$classname.'.inc.php');
|
include(PHPGW_INCLUDE_ROOT.'/'.$appname.'/inc/class.'.$classname.'.inc.php');
|
||||||
}
|
}
|
||||||
if ($p1 == '_UNDEF_')
|
if ($p1 == '_UNDEF_')
|
||||||
{
|
{
|
||||||
$obj = new $classname;
|
$ret = eval("\$obj = new \$classname; if(is_object(\$obj)) { return True; };");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -77,22 +80,36 @@
|
|||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$code = substr($code,0,-1) . ');';
|
$code = substr($code,0,-1) . "); if(is_object(\$obj)) { return True; };";
|
||||||
eval($code);
|
$ret = eval($code);
|
||||||
|
}
|
||||||
|
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
||||||
|
if($ret)
|
||||||
|
{
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return False;
|
||||||
}
|
}
|
||||||
return $obj;
|
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
@function lang
|
@function lang
|
||||||
@abstract function to deal with multilanguage support
|
@abstract function to handle multilanguage support
|
||||||
*/
|
*/
|
||||||
function lang($key, $m1="", $m2="", $m3="", $m4="", $m5="", $m6="", $m7="", $m8="", $m9="", $m10="" )
|
function lang($key,$m1='',$m2='',$m3='',$m4='',$m5='',$m6='',$m7='',$m8='',$m9='',$m10='')
|
||||||
{
|
{
|
||||||
global $phpgw;
|
global $phpgw;
|
||||||
// # TODO: check if $m1 is of type array.
|
|
||||||
// If so, use it instead of $m2-$mN (Stephan)
|
if(gettype($m1) == 'array')
|
||||||
$vars = array( $m1, $m2, $m3, $m4, $m5, $m6, $m7, $m8, $m9, $m10 );
|
{
|
||||||
$value = $phpgw->translation->translate("$key", $vars );
|
$vars = $m1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$vars = array($m1,$m2,$m3,$m4,$m5,$m6,$m7,$m8,$m9,$m10);
|
||||||
|
}
|
||||||
|
$value = $phpgw->translation->translate("$key",$vars);
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user