Skip to content

Commit

Permalink
[mms] Support display of IDN domains in URLs.
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Dec 20, 2014
1 parent f2d2d97 commit f4f27bb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 6 additions & 1 deletion framework/Text_Filter/lib/Horde/Text/Filter/Linkurls.php
Expand Up @@ -131,10 +131,12 @@ public function callback($match)
if (strpos($match[2], ':') === false) {
$href = 'http://' . $href;
}
$orig_href = $href;

if ($this->_params['callback']) {
$href = call_user_func($this->_params['callback'], $href);
}

$href = htmlspecialchars($href);

$class = $this->_params['class'];
Expand All @@ -147,10 +149,13 @@ public function callback($match)
$target = ' target="' . $target . '"';
}

$idna = new Net_IDNA2(array(
'strict' => false
));
$replacement = '<a href="' . $href . '"' .
($this->_params['nofollow'] ? ' rel="nofollow"' : '') .
$target . $class .
'>' . htmlspecialchars($match[0]) . '</a>';
'>' . htmlspecialchars($idna->decode($orig_href)) . '</a>';

if (!empty($this->_params['noprefetch'])) {
$replacement = '<meta http-equiv="x-dns-prefetch-control" value="off" />' .
Expand Down
11 changes: 9 additions & 2 deletions framework/Text_Filter/package.xml
Expand Up @@ -33,7 +33,7 @@
</stability>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
*
* [mms] Support display of IDN domains in URLs.
</notes>
<contents>
<dir baseinstalldir="/" name="/">
Expand Down Expand Up @@ -380,6 +380,13 @@
<max>3.0.0alpha1</max>
<exclude>3.0.0alpha1</exclude>
</package>
<package>
<name>Net_IDNA2</name>
<channel>pear.php.net</channel>
<min>0.1.1</min>
<max>1.0.0alpha1</max>
<exclude>1.0.0alpha1</exclude>
</package>
</required>
<optional>
<package>
Expand Down Expand Up @@ -1014,7 +1021,7 @@ Initial release as a PEAR package
<date>2014-10-21</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
*
* [mms] Support display of IDN domains in URLs.
</notes>
</release>
</changelog>
Expand Down

0 comments on commit f4f27bb

Please sign in to comment.