* * @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) { $unique=false; if(!is_array($format)) { $format=array($format); $unique=true; } for($i=0;$i $meth(),$format[$i]); } else { $GLOBALS['LSerror'] -> addErrorCode(901,array('meth' => $meth,'obj' => $ch[1])); break; } } } } else { if ($meth==NULL) { while (ereg("%{([A-Za-z0-9]+)}",$format[$i],$ch)) $format[$i]=ereg_replace($ch[0],$data,$format[$i]); } else { while (ereg("%{([A-Za-z0-9]+)}",$format[$i],$ch)) { if (method_exists($data,$meth)) { $format[$i]=ereg_replace($ch[0],$data -> $meth($ch[1]),$format[$i]); } else { $GLOBALS['LSerror'] -> addErrorCode(901,array('meth' => $meth,'obj' => get_class($data))); break; } } } } } if($unique) { return $format[0]; } return $format; } function loadDir($dir,$regexpr='^.*\.php$') { if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if (ereg($regexpr,$file)) { require_once($dir.'/'.$file); } } } else { die(_('Dossier introuvable ('.$dir.').')); } return true; } function valid($obj) { debug('Validation : ok'); return true; } function return_data($data) { return $data; } function debug($data,$get=true) { if ($get) { if (is_array($data)) { $GLOBALS['LSdebug']['fields'][]=$data; } else { $GLOBALS['LSdebug']['fields'][]="[$data]"; } } return true; } function debug_print() { if (( $GLOBALS['LSdebug']['fields'] ) && ( $GLOBALS['LSdebug']['active'] )) { $txt=''; $GLOBALS['Smarty'] -> assign('LSdebug',$txt); } } ?>