options to nofollow external links in notices

This commit is contained in:
Evan Prodromou
2010-10-18 11:29:52 -04:00
parent 505ac6eba0
commit 7c05b0dafc
6 changed files with 117 additions and 6 deletions

View File

@@ -145,7 +145,6 @@ function common_switch_locale($language=null)
textdomain("statusnet");
}
function common_timezone()
{
if (common_logged_in()) {
@@ -860,7 +859,8 @@ function common_linkify($url) {
$longurl = $url;
}
}
$attrs = array('href' => $canon, 'title' => $longurl, 'rel' => 'external');
$attrs = array('href' => $canon, 'title' => $longurl);
$is_attachment = false;
$attachment_id = null;
@@ -896,6 +896,16 @@ function common_linkify($url) {
$attrs['id'] = "attachment-{$attachment_id}";
}
// Whether to nofollow
$nf = common_config('nofollow', 'external');
if ($nf == 'never') {
$attrs['rel'] = 'external';
} else {
$attrs['rel'] = 'nofollow external';
}
return XMLStringer::estring('a', $attrs, $url);
}