make_clickable() trailing punctuation fixes from neodude. fixes #5081
git-svn-id: http://svn.automattic.com/wordpress/trunk@7452 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d0f6f37841
commit
fb1ad3901f
|
@ -631,21 +631,32 @@ function antispambot($emailaddy, $mailto=0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _make_url_clickable_cb($matches) {
|
function _make_url_clickable_cb($matches) {
|
||||||
|
$ret = '';
|
||||||
$url = $matches[2];
|
$url = $matches[2];
|
||||||
$url = clean_url($url);
|
$url = clean_url($url);
|
||||||
if ( empty($url) )
|
if ( empty($url) )
|
||||||
return $matches[0];
|
return $matches[0];
|
||||||
return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>";
|
// removed trailing [.,;:] from URL
|
||||||
|
if ( in_array(substr($url, -1), array('.', ',', ';', ':')) === true ) {
|
||||||
|
$ret = substr($url, -1);
|
||||||
|
$url = substr($url, 0, strlen($url)-1);
|
||||||
|
}
|
||||||
|
return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _make_web_ftp_clickable_cb($matches) {
|
function _make_web_ftp_clickable_cb($matches) {
|
||||||
|
$ret = '';
|
||||||
$dest = $matches[2];
|
$dest = $matches[2];
|
||||||
$dest = 'http://' . $dest;
|
$dest = 'http://' . $dest;
|
||||||
$dest = clean_url($dest);
|
$dest = clean_url($dest);
|
||||||
if ( empty($dest) )
|
if ( empty($dest) )
|
||||||
return $matches[0];
|
return $matches[0];
|
||||||
|
// removed trailing [,;:] from URL
|
||||||
return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>";
|
if ( in_array(substr($dest, -1), array('.', ',', ';', ':')) === true ) {
|
||||||
|
$ret = substr($dest, -1);
|
||||||
|
$dest = substr($dest, 0, strlen($dest)-1);
|
||||||
|
}
|
||||||
|
return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>" . $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _make_email_clickable_cb($matches) {
|
function _make_email_clickable_cb($matches) {
|
||||||
|
|
Loading…
Reference in New Issue