From 42d66874bed88753cbcf08a060c89f789f41a3ae Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 1 Dec 2010 21:13:09 -0800 Subject: [PATCH] improved linkification of naked text urls --- boot.php | 8 +++++++- include/bbcode.php | 3 +-- view/en/profile.php | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/boot.php b/boot.php index d1e570d3bc..66236f39d6 100644 --- a/boot.php +++ b/boot.php @@ -1567,4 +1567,10 @@ function aes_encrypt($val,$ky) $enc=MCRYPT_RIJNDAEL_128; $val=str_pad($val, (16*(floor(strlen($val) / 16)+(strlen($val) % 16==0?2:1))), chr(16-(strlen($val) % 16))); return mcrypt_encrypt($enc, $key, $val, $mode, mcrypt_create_iv( mcrypt_get_iv_size($enc, $mode), MCRYPT_DEV_URANDOM)); -}} \ No newline at end of file +}} + +if(! function_exists('linkify')) { +function linkify($s) { + $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%]*)/", ' $1', $s); + return($s); +}} \ No newline at end of file diff --git a/include/bbcode.php b/include/bbcode.php index 52ca86bc1f..fbae7bc327 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -18,8 +18,7 @@ function bbcode($Text) { // Perform URL Search - $Text = preg_replace("/[^\]\=](http\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%]*)/", ' $1', $Text); - $Text = preg_replace("/[^\]\=](https\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%]*)/", ' $1', $Text); + $Text = preg_replace("/[^\]\=](https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%]*)/", ' $1', $Text); $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/", '$1', $Text); $Text = preg_replace("(\[url\=([$URLSearchString]*)\](.+?)\[/url\])", '$2', $Text); diff --git a/view/en/profile.php b/view/en/profile.php index b59a12b715..190a3e2974 100644 --- a/view/en/profile.php +++ b/view/en/profile.php @@ -56,7 +56,7 @@
Status:
-
Homepage:
+
Homepage: