* * @param[in] $format string Format de la chaine * @param[in] $data mixed Les données pour composés la chaine * Ce paramètre peut être un tableau de string, une string, * une tableau d'objet ou un objet. * @param[in] $meth string Le nom de la methode de/des objet(s) à appeler pour * obtenir la valeur de remplacement dans la chaine formatée. * * @retval string La chaine formatée */ function getFData($format,$data,$meth=NULL) { if(is_array($data)) { if ($meth==NULL) { while (ereg("%{([A-Za-z0-9]+)}",$format,$ch)) { $format=ereg_replace($ch[0],$data[$ch[1]],$format); } } else { while (ereg("%{([A-Za-z0-9]+)}",$format,$ch)) { if (method_exists($data[$ch[1]],$meth)) { $format=ereg_replace($ch[0],$data[$ch[1]] -> $meth(),$format); } else { $GLOBALS['LSerror'] -> addErrorCode(901,array('meth' => $meth,'obj' => $ch[1])); break; } } } } else { if ($meth==NULL) { while (ereg("%{([A-Za-z0-9]+)}",$format,$ch)) $format=ereg_replace($ch[0],$data,$format); } else { while (ereg("%{([A-Za-z0-9]+)}",$format,$ch)) { if (method_exists($data,$meth)) { $format=ereg_replace($ch[0],$data -> $meth($ch[1]),$format); } else { $GLOBALS['LSerror'] -> addErrorCode(901,array('meth' => $meth,'obj' => get_class($data))); break; } } } } return $format; } function valid($obj) { echo 'ok'; return true; } function return_data($data) { return $data; } ?>