From b5b4ba275d0998e58b7982ccfc18fffba1a86b88 Mon Sep 17 00:00:00 2001 From: web Date: Mon, 1 Jan 2007 14:47:28 +0000 Subject: [PATCH] ; is part of urls too. Mad git-svn-id: svn+ssh://murphy/home/svn/platal/branches/platal-0.9.12@1321 839d8a87-29fc-0310-9880-83ba4fa771e5 --- include/url_catcher.inc.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/include/url_catcher.inc.php b/include/url_catcher.inc.php index b1dd3f8..91db03c 100644 --- a/include/url_catcher.inc.php +++ b/include/url_catcher.inc.php @@ -3,22 +3,22 @@ // renvoie un texte html à partir d'un texte classique // en remplacant les url par des liens (éventuellement les mails) function url_catcher($texte, $mails = true) { - $patterns = array(); - $replacement = array(); - - // url commencant par http, https ou ftp - $patterns[] = '/((?:https?|ftp):\/\/(?:\.*,*[a-z@0-9~%$£µ&i#\-+=_\/\?])*)/i'; - $replacement[] = '\\0'; - - // url commencant par www. - $patterns[] = '/(\s|^)www\.((?:\.*,*[a-z@0-9~%$£µ&i#\-+=_\/\?])*)/i'; - $replacement[] = '\\1www.\\2'; - - if ($mails) { + $patterns = array(); + $replacement = array(); + + // url commencant par http, https ou ftp + $patterns[] = '/((?:https?|ftp):\/\/(?:\.*,*[a-z@0-9~%$£µ&i#\-+=_\/\?;])*)/i'; + $replacement[] = '\\0'; + + // url commencant par www. + $patterns[] = '/(\s|^)www\.((?:\.*,*[a-z@0-9~%$£µ&i#\-+=_\/\?;])*)/i'; + $replacement[] = '\\1www.\\2'; + + if ($mails) { $patterns[] = '/(?:mailto:)?([a-z0-9.\-+_]+@([\-.+_]?[a-z0-9])+)/i'; $replacement[] = '\\0'; - } - + } + return preg_replace($patterns, $replacement, $texte); } ?> -- 2.1.4