summaryrefslogtreecommitdiff
path: root/inc/functions.php
diff options
context:
space:
mode:
authorMichael Save <savetheinternet@tinyboard.org>2012-01-27 03:58:38 +1100
committerMichael Save <savetheinternet@tinyboard.org>2012-01-27 03:58:38 +1100
commit5510be3dedf4c3f18801e4af1556ab92112d2bfb (patch)
treeca2b019a6f077e06ccabbaa1b14127a7214c49b0 /inc/functions.php
parentf6b665d061f4b6031c900129f2f478e1e57998ef (diff)
allow more punctuation after URLs
Diffstat (limited to 'inc/functions.php')
-rw-r--r--inc/functions.php11
1 files changed, 4 insertions, 7 deletions
diff --git a/inc/functions.php b/inc/functions.php
index 15bddb84..0902c764 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -1306,15 +1306,12 @@
}
function markup_url($matches) {
- $strip_from_end = Array('.', ',', ')');
-
$url = $matches[0];
$after = '';
- $last = $url[strlen($url)-1];
- if(in_array($last, $strip_from_end)) {
- $after = $last;
- $url = substr($url, 0, -1);
+ if(preg_match('/([)\]][.,!;]?|[.,!;][)\]]?)$/', $url, $match)) {
+ $url = substr($url, 0, 0 - strlen($match[1]));
+ $after = $match[1];
}
return '<a target="_blank" rel="nofollow" href="' . $url . '">' . $url . '</a>' . $after;
@@ -1336,7 +1333,7 @@
$body = preg_replace_callback($config['url_regex'], 'markup_url', $body, -1, $num_links);
if($num_links > $config['max_links'])
error($config['error']['toomanylinks']);
- }
+ }//exit;
if($config['auto_unicode']) {
$body = str_replace('...', '&hellip;', $body);