summaryrefslogtreecommitdiff
path: root/program/include/rcube_string_replacer.php
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2009-06-19 17:06:31 +0000
committerthomascube <thomas@roundcube.net>2009-06-19 17:06:31 +0000
commit3d4ba6280810ce4267809177bdc4a3e462b32e5e (patch)
tree0c62edcf864c203a3aea54fc50506bd1f23d61f2 /program/include/rcube_string_replacer.php
parent3f57a52c27dca044c225d130466d91f8e5ac70a1 (diff)
Fix link text replacements (#1485789)
Diffstat (limited to 'program/include/rcube_string_replacer.php')
-rw-r--r--program/include/rcube_string_replacer.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/program/include/rcube_string_replacer.php b/program/include/rcube_string_replacer.php
index 064a723a2..8539ee55b 100644
--- a/program/include/rcube_string_replacer.php
+++ b/program/include/rcube_string_replacer.php
@@ -74,7 +74,7 @@ class rcube_string_replacer
$i = -1;
$scheme = strtolower($matches[1]);
- if ($scheme == 'http://' || $scheme == 'https://' || $scheme == 'ftp://') {
+ if (preg_match('!^(http||ftp|file)s?://!', $scheme)) {
$url = $matches[1] . $matches[2];
$i = $this->add(html::a(array('href' => $url, 'target' => '_blank'), Q($url)));
}
@@ -83,7 +83,8 @@ class rcube_string_replacer
$i = $this->add($m[1] . html::a(array('href' => 'http://' . $url, 'target' => '_blank'), Q($url)));
}
- return $i >= 0 ? $this->get_replacement($i) : '';
+ // Return valid link for recognized schemes, otherwise, return the unmodified string for unrecognized schemes.
+ return $i >= 0 ? $this->get_replacement($i) : $matches[0];
}
/**