summaryrefslogtreecommitdiff
path: root/lib/util.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-10-18 11:29:52 -0400
committerEvan Prodromou <evan@status.net>2010-10-18 11:29:52 -0400
commit7c05b0dafc609e978040e5612f6f6a86b0bb6420 (patch)
treebdf880a247ce8ca86f648a878e3f90cfe160c010 /lib/util.php
parent505ac6eba0e671e8823b5102de3caa0e0040c2cf (diff)
options to nofollow external links in notices
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/util.php b/lib/util.php
index c05fcf15a..5a94182bd 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -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);
}