diff options
author | friendica <info@friendica.com> | 2014-02-07 15:41:31 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-02-07 15:41:31 -0800 |
commit | ae6bd7dc1e87805447e765e08d7a31ae5ac03f32 (patch) | |
tree | a6bb61cafa82058ad7d6ef317c64eccc52e6d9fd /mod | |
parent | 1ec7ffc774a8ffd202b0ef522ba37b4d9311f564 (diff) | |
download | volse-hubzilla-ae6bd7dc1e87805447e765e08d7a31ae5ac03f32.tar.gz volse-hubzilla-ae6bd7dc1e87805447e765e08d7a31ae5ac03f32.tar.bz2 volse-hubzilla-ae6bd7dc1e87805447e765e08d7a31ae5ac03f32.zip |
fix issue with double linkify in the git feed
Diffstat (limited to 'mod')
-rw-r--r-- | mod/item.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mod/item.php b/mod/item.php index 47a3f1961..e8a58fe76 100644 --- a/mod/item.php +++ b/mod/item.php @@ -422,9 +422,15 @@ function item_post(&$a) { /** * fix naked links by passing through a callback to see if this is a red site - * (already known to us) which will get a zrl, otherwise link with url + * (already known to us) which will get a zrl, otherwise link with url, add bookmark tag to both. + * First wrap any url which is part of link anchor text already in quotes so we don't double link it. + * e.g. [url=http://foobar.com]something with http://elsewhere.com in it[/url] + * becomes [url=http://foobar.com]something with "http://elsewhere.com" in it[/url] + * otherwise http://elsewhere.com becomes #^[url=http://elsewhere.com]http://elsewhere.com[/url] */ + $body = preg_replace('/\[([uz])rl(.*?)\](.*?)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\+\,]+)(.*?)\[\/([uz])rl\]/ism','[$1rl$2]$3"$4"$5[/$6rl]',$body); + $body = preg_replace_callback("/([^\^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\+\,]+)/ism", 'red_zrl_callback', $body); /** |