getFData() : Added new value access method

LSdebug : Changed display method to improve readability
This commit is contained in:
Benjamin Renard 2009-10-25 23:44:11 +00:00
parent 3205bd4435
commit 9fe268346a

View file

@ -95,9 +95,13 @@ function getFData($format,$data,$meth=NULL) {
}
}
}
else {
elseif (is_object($data)) {
if ($meth==NULL) {
while (ereg($expr,$format[$i],$ch)) {
$value = $data -> $ch[1];
if (is_array($value)) {
$value = $value[0];
}
if($ch[3]) {
if ($ch[5]) {
$s=$ch[3];
@ -107,12 +111,9 @@ function getFData($format,$data,$meth=NULL) {
$s=0;
$l=$ch[3];
}
$val=substr((string)$data,$s,$l);
$value=substr((string)$value,$s,$l);
}
else {
$val=$data;
}
$format[$i]=ereg_replace($ch[0],$val,$format[$i]);
$format[$i]=ereg_replace($ch[0],$value,$format[$i]);
}
}
else {
@ -142,6 +143,25 @@ function getFData($format,$data,$meth=NULL) {
}
}
}
else {
while (ereg($expr,$format[$i],$ch)) {
if($ch[3]) {
if ($ch[5]) {
$s=$ch[3];
$l=$ch[5];
}
else {
$s=0;
$l=$ch[3];
}
$val=substr((string)$data,$s,$l);
}
else {
$val=$data;
}
$format[$i]=ereg_replace($ch[0],$val,$format[$i]);
}
}
}
if($unique) {
return $format[0];
@ -215,7 +235,7 @@ function LSdebug_print($return=false) {
$txt.='<li><pre>'.print_r($debug,true).'</pre></li>';
}
else {
$txt.='<li>'.$debug.'</li>';
$txt.='<li><pre>'.$debug.'</pre></li>';
}
}
$txt.='</ul>';