diff options
| author | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-06-19 17:06:31 +0000 |
|---|---|---|
| committer | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-06-19 17:06:31 +0000 |
| commit | 66c3325e00b7a8c2439ed39c79f236c77b6bd12f (patch) | |
| tree | 575494d47275df2449797a3bd2cf7aa4265432c9 /roundcubemail/program/include | |
| parent | 7f23e20517a8e4ae9795f18132562098571763a8 (diff) | |
Fix link text replacements (#1485789)
git-svn-id: https://svn.roundcube.net/trunk@2658 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include')
| -rw-r--r-- | roundcubemail/program/include/rcube_string_replacer.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/roundcubemail/program/include/rcube_string_replacer.php b/roundcubemail/program/include/rcube_string_replacer.php index 064a723a2..8539ee55b 100644 --- a/roundcubemail/program/include/rcube_string_replacer.php +++ b/roundcubemail/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]; } /** |
