pour les utiliser ailleur...
- Code: Tout sélectionner
function replaceLinks($text) {
$text2 = ereg_replace('[a-zA-Z]+://(([.]?[a-zA-Z0-9_/-])*)', '<a href="\\0" target=\"_blank\">liens</a>',$text);
$text3 = ereg_replace('(^| )(www([-]*[.]?[a-zA-Z0-9_/-?&%])*)', '<a href="http://\\2" target=\"_blank\">liens</a>',$text2);
// preg_match_all("/(<([\w]+)[^>]*>)(.*)(<\/\\2>)/", $text3, $out, PREG_PATTERN_ORDER);
preg_match_all("/(<([\w]+)[^>]*>)(.*)(<\/\\2>)/", $text3, $out, PREG_SET_ORDER);
$textR = "Liens photos: ";
foreach($out as $val){
$textR .= $val[0] ." - ";
}
$textR .= "<br>";
return $textR;
}

News de Forum d'assistance informatique - LM2I