Allow users to opt out of sending linkbacks

This commit is contained in:
Stephen Paul Weber
2015-10-18 21:28:55 +00:00
parent c7e08195e4
commit 677f0ac479
2 changed files with 118 additions and 3 deletions

View File

@@ -65,9 +65,14 @@ class LinkbackPlugin extends Plugin
// notice content
$c = $notice->content;
$this->notice = $notice;
// Ignoring results
common_replace_urls_callback($c,
array($this, 'linkbackUrl'));
if(!$notice->getProfile()->
getPref("linkbackplugin", "disable_linkbacks")
) {
// Ignoring results
common_replace_urls_callback($c,
array($this, 'linkbackUrl'));
}
if($notice->isRepeat()) {
$repeat = Notice::getByID($notice->repeat_of);
@@ -315,4 +320,23 @@ class LinkbackPlugin extends Plugin
'or <a href="http://www.movabletype.org/docs/mttrackback.html">Trackback</a> protocols.'));
return true;
}
public function onStartInitializeRouter(URLMapper $m)
{
$m->connect('settings/linkback', array('action' => 'linkbacksettings'));
return true;
}
function onEndAccountSettingsNav($action)
{
$action_name = $action->trimmed('action');
$action->menuItem(common_local_url('linkbacksettings'),
// TRANS: OpenID plugin menu item on user settings page.
_m('MENU', 'Send Linkbacks'),
// TRANS: OpenID plugin tooltip for user settings menu item.
_m('Opt-out of sending linkbacks.'),
$action_name === 'linkbacksettings');
return true;
}
}