[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.25,1.2
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.25,1.26 class.uietemplate.inc.php,1.35,1.36 |
Date: |
Thu, 03 Oct 2002 19:47:17 -0400 |
Update of /cvsroot/phpgroupware/etemplate/inc
In directory subversions:/tmp/cvs-serv18732
Modified Files:
class.boetemplate.inc.php class.uietemplate.inc.php
Log Message:
removed all eval to get a slight better performance
Index: class.boetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.boetemplate.inc.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** class.boetemplate.inc.php 2 Oct 2002 00:44:33 -0000 1.25
--- class.boetemplate.inc.php 3 Oct 2002 23:47:14 -0000 1.26
***************
*** 55,59 ****
$this->public_functions += array(
'disable_cells' => True,
! 'set_cell_attribute' => True
);
$this->soetemplate();
--- 55,63 ----
$this->public_functions += array(
'disable_cells' => True,
! 'set_cell_attribute' => True,
! 'get_cell_attribute' => True,
! 'get_array' => True,
! 'set_array' => True,
! 'unset_array' => True
);
$this->soetemplate();
***************
*** 402,445 ****
}
! function set_array(&$arr,$idx,$val,$set=True)
{
! if (ereg('^([^[]*)(\\[.*\\])$',$idx,$regs)) // idx
contains array-index
{
! $arr_idx = '['.$regs[1].']'.$regs[2];
}
! else
{
! $arr_idx = "[$idx]";
}
! if ($set)
{
! $code = '$arr'.$arr_idx.' = $val;';
}
! else
{
! $code = 'unset($arr'.$arr_idx.');';
}
! eval($code =
str_replace(']',"']",str_replace('[',"['",$code)));
!
! //echo "set_array: $code = '$val'<br>\n";
}
function unset_array(&$arr,$idx)
{
! $this->set_array($arr,$idx,0,False);
! }
!
! function &get_array(&$arr,$idx)
! {
! if (ereg('^([^[]*)(\\[.*\\])$',$idx,$regs)) // idx
contains array-index
{
! eval($code =
str_replace(']',"']",str_replace('[',"['",'$val =
&$arr['.$regs[1].']'.$regs[2].';')));
! //echo "get_array: $code = '$val'<br>\n";
}
! else
{
! $val = &$arr[$idx];
}
! return $val;
}
--- 406,452 ----
}
! function set_array(&$arr,$idx,$val)
{
! if (!is_array($arr))
{
! die('set_array() $arr is no array');
}
! $idxs = explode('[',str_replace(']','',$idx));
! $pos = &$arr;
! while (list($n,$idx) = each($idxs))
{
! $pos = &$pos[$idx];
}
! $pos = $val;
! }
!
! function &get_array(&$arr,$idx)
! {
! if (!is_array($arr))
{
! die('set_array() $arr is no array');
}
! $idxs = explode('[',str_replace(']','',$idx));
! $pos = &$arr;
! while (list($n,$idx) = each($idxs))
{
! $pos = &$pos[$idx];
}
! return $pos;
}
function unset_array(&$arr,$idx)
{
! if (!is_array($arr))
{
! die('set_array() $arr is no array');
}
! $idxs = explode('[',str_replace(']','',$idx));
! $pos = &$arr;
! while ((list($n,$idx) = each($idxs)) && $n <
count($idxs)-1)
{
! $pos = &$pos[$idx];
}
! unset($pos[$idx]);
}
Index: class.uietemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.uietemplate.inc.php,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** class.uietemplate.inc.php 3 Oct 2002 16:52:42 -0000 1.35
--- class.uietemplate.inc.php 3 Oct 2002 23:47:14 -0000 1.36
***************
*** 341,356 ****
$name =
$this->expand_name($cell['name'],$show_c,$show_row,$content['.c'],$content['.row'],$content);
! if (ereg('^([^[]*)(\\[.*\\])$',$name,$regs)) // name
contains array-index
{
! $form_name = $cname == '' ? $name :
$cname.'['.$regs[1].']'.$regs[2];
!
eval(str_replace(']',"']",str_replace('[',"['",'$value =
$content['.$regs[1].']'.$regs[2].';')));
! $org_name = substr($regs[2],1,-1);
}
! else
{
! $form_name = $cname == '' ? $name :
$cname.'['.$name.']';
! $value = $content[$name];
! $org_name = $name;
}
if ($readonly = $cell['readonly'] || $readonlys[$name]
|| $readonlys['__ALL__'])
{
--- 341,356 ----
$name =
$this->expand_name($cell['name'],$show_c,$show_row,$content['.c'],$content['.row'],$content);
! $name_parts = explode('[',str_replace(']','',$name));
! if (!empty($cname))
{
! array_unshift($name_parts,$cname);
}
! $form_name = array_shift($name_parts);
! if (count($name_parts))
{
! $form_name .= '['.implode('][',$name_parts).']';
}
+ $value = $this->get_array($content,$name);
+
if ($readonly = $cell['readonly'] || $readonlys[$name]
|| $readonlys['__ALL__'])
{
***************
*** 373,384 ****
$extra_label =
$this->extensionPreProcess($ext_type,$form_name,$value,$cell,$readonlys[$name]);
! if (!$regs)
! {
! $content[$name] = $value; // set
result for template
! }
! else
! {
!
eval(str_replace(']',"']",str_replace('[',"['",'$content['.$regs[1].']'.$regs[2].'
= $value;')));
! }
}
$label = $cell['label'];
--- 373,377 ----
$extra_label =
$this->extensionPreProcess($ext_type,$form_name,$value,$cell,$readonlys[$name]);
! $this->set_array($content,$name,$value);
}
$label = $cell['label'];
***************
*** 593,599 ****
$sels += $sel_options[$name];
}
! elseif (isset($sel_options[$org_name]))
{
! $sels +=
$sel_options[$org_name];
}
if (isset($content["options-$name"]))
--- 586,600 ----
$sels += $sel_options[$name];
}
! elseif (count($name_parts))
{
! $org_name =
array_shift($name_parts);
! if (count($name_parts))
! {
! $org_name .=
'['.implode('][',$name_parts).']';
! }
! if
(isset($sel_options[$org_name]))
! {
! $sels +=
$sel_options[$org_name];
! }
}
if (isset($content["options-$name"]))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.25,1.26 class.uietemplate.inc.php,1.35,1.36,
Ralf Becker <address@hidden> <=