From 62203c83efc8e1f996a068743a27de62d792259d Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Mon, 20 Feb 2012 23:59:50 +0000 Subject: improved the regular expression to find URLs --- h-source/Application/Include/myFunctions.php | 12 ------------ h-source/Application/Include/wikiFormatting.php | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) (limited to 'h-source/Application/Include') diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php index e90a163..2f2a88a 100644 --- a/h-source/Application/Include/myFunctions.php +++ b/h-source/Application/Include/myFunctions.php @@ -81,18 +81,6 @@ function smartDate($uglyDate = null, $lang = 'en') { return date('H:i, j ',strtotime($uglyDate)).gtext(date('F',strtotime($uglyDate))).date(' Y',strtotime($uglyDate)); } -// switch ($lang) -// { -// case 'en': -// $smDate = date('H:i, d F Y',strtotime($uglyDate)); -// break; -// case 'it': -// $smDate = date('H:i, d F Y',strtotime($uglyDate)); -// break; -// default: -// $smDate = date('H:i, d F Y',strtotime($uglyDate)).date(' F ',strtotime($uglyDate)).date('Y',strtotime($uglyDate)); -// } -// return $smDate; } function pubDateFormat($uglyDate = null) diff --git a/h-source/Application/Include/wikiFormatting.php b/h-source/Application/Include/wikiFormatting.php index 0bcc932..06a734c 100644 --- a/h-source/Application/Include/wikiFormatting.php +++ b/h-source/Application/Include/wikiFormatting.php @@ -133,7 +133,7 @@ class Tabs function checkUrl($url) { - $match = '/^http(s)?\:\/\/(www\.)?[a-zA-Z0-9\-\_]+(\.[a-zA-Z0-9\-\_]+)*\.(com|net|it|info|org|eu|uk|ca|us|cl)((\/[a-zA-Z0-9\_\.\-\:\+]+)*(\/([a-zA-Z0-9\_\:\-\.\+]+\.(php|html|htm|asp|aspx|jsp|cgi))?)?)?(\?([a-zA-Z0-9\_\-\+\s]+\=[a-zA-Z0-9\_\-\s\+\&]+)+)?(#[a-zA-Z0-9\_\-\+\s]+)?([\s]*)?$/'; + $match = '/^http(s)?\:\/\/(www\.)?[a-zA-Z0-9\-\_]+(\.[a-zA-Z0-9\-\_]+)*\.([a-z]{2,3})((\/[a-zA-Z0-9\_\.\-\:\+]+)*(\/([a-zA-Z0-9\_\:\-\.\+]+\.(php|html|htm|asp|aspx|jsp|cgi))?)?)?(\?([a-zA-Z0-9\_\-\+\s]+\=[a-zA-Z0-9\_\-\s\+\&]+)+)?(#[a-zA-Z0-9\_\-\+\s]+)?([\s]*)?$/'; if (preg_match($match,$url)) { -- cgit v1.2.3