aboutsummaryrefslogtreecommitdiffstats
path: root/include/zid.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/zid.php')
-rw-r--r--include/zid.php35
1 files changed, 20 insertions, 15 deletions
diff --git a/include/zid.php b/include/zid.php
index ed79de76a..3b3dd8554 100644
--- a/include/zid.php
+++ b/include/zid.php
@@ -13,7 +13,7 @@ function is_matrix_url($url) {
if(array_key_exists($m['host'],$remembered))
return $remembered[$m['host']];
- $r = q("select hubloc_url from hubloc where hubloc_host = '%s' and hubloc_network = 'zot' limit 1",
+ $r = q("select hubloc_url from hubloc where hubloc_host = '%s' and hubloc_network in ('zot', 'zot6') limit 1",
dbesc($m['host'])
);
if($r) {
@@ -205,20 +205,25 @@ function zidify_text($s) {
*/
function red_zrl_callback($matches) {
- $zrl = is_matrix_url($matches[2]);
-
- $t = strip_zids($matches[2]);
- if($t !== $matches[2]) {
- $zrl = true;
- $matches[2] = $t;
- }
-
- if($matches[1] === '#^')
- $matches[1] = '';
- if($zrl)
- return $matches[1] . '#^[zrl=' . $matches[2] . ']' . $matches[2] . '[/zrl]';
-
- return $matches[1] . '#^[url=' . $matches[2] . ']' . $matches[2] . '[/url]';
+ // Catch and exclude trailing punctuation
+ preg_match("/[.,;:!?)]*$/i", $matches[2], $pts);
+ $matches[2] = substr($matches[2], 0, strlen($matches[2])-strlen($pts[0]));
+
+ $zrl = is_matrix_url($matches[2]);
+
+ $t = strip_zids($matches[2]);
+ if($t !== $matches[2]) {
+ $zrl = true;
+ $matches[2] = $t;
+ }
+
+ if($matches[1] === '#^')
+ $matches[1] = '';
+
+ if($zrl)
+ return $matches[1] . '#^[zrl=' . $matches[2] . ']' . $matches[2] . '[/zrl]' . $pts[0];
+
+ return $matches[1] . '#^[url=' . $matches[2] . ']' . $matches[2] . '[/url]' . $pts[0];
}
/**