diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2013-07-09 12:13:17 -0400 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2013-07-09 12:13:17 -0400 |
commit | 9892692deefdb06d9e7176c72fc5780ab79e3a7d (patch) | |
tree | 4931f7e48754cbb5d67ae4ab4b62e67dfbd3d6c4 /engine/lib/output.php | |
parent | 0dfe018f16e93aff5f046c08994a102e3f5d35e6 (diff) | |
download | elgg-9892692deefdb06d9e7176c72fc5780ab79e3a7d.tar.gz elgg-9892692deefdb06d9e7176c72fc5780ab79e3a7d.tar.bz2 |
Fixes #5706. Allowing parens in URIs if not last character.
Diffstat (limited to 'engine/lib/output.php')
-rw-r--r-- | engine/lib/output.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/engine/lib/output.php b/engine/lib/output.php index 5adc01053..6172a5c8d 100644 --- a/engine/lib/output.php +++ b/engine/lib/output.php @@ -27,16 +27,16 @@ function parse_urls($text) { // By default htmlawed rewrites tags to this format. // if PHP supported conditional negative lookbehinds we could use this: // $r = preg_replace_callback('/(?<!=)(?<![ ])?(?<!["\'])((ht|f)tps?:\/\/[^\s\r\n\t<>"\'\!\(\),]+)/i', - $r = preg_replace_callback('/(?<![=\/"\'])((ht|f)tps?:\/\/[^\s\r\n\t<>"\'\(\)]+)/i', + $r = preg_replace_callback('/(?<![=\/"\'])((ht|f)tps?:\/\/[^\s\r\n\t<>"\']+)/i', create_function( '$matches', ' $url = $matches[1]; - $punc = \'\'; + $punc = ""; $last = substr($url, -1, 1); - if (in_array($last, array(".", "!", ","))) { + if (in_array($last, array(".", "!", ",", "(", ")"))) { $punc = $last; - $url = rtrim($url, ".!,"); + $url = rtrim($url, ".!,()"); } $urltext = str_replace("/", "/<wbr />", $url); return "<a href=\"$url\" rel=\"nofollow\">$urltext</a>$punc"; |