From 9fe268346aba2f020e7ed5b1cc5428c849b66f10 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Sun, 25 Oct 2009 23:44:11 +0000 Subject: [PATCH] getFData() : Added new value access method LSdebug : Changed display method to improve readability --- trunk/includes/functions.php | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/trunk/includes/functions.php b/trunk/includes/functions.php index 6e5aba97..dde6dc06 100644 --- a/trunk/includes/functions.php +++ b/trunk/includes/functions.php @@ -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.='
  • '.print_r($debug,true).'
  • '; } else { - $txt.='
  • '.$debug.'
  • '; + $txt.='
  • '.$debug.'
  • '; } } $txt.='';