]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Linkback/LinkbackPlugin.php
Merge branch 'repost-of-uf2' into 'master'
[quix0rs-gnu-social.git] / plugins / Linkback / LinkbackPlugin.php
index 4e49de670f7d9ffd1333f322c350b16356cad37f..3c051e88a4a2cba9bf2ce5e9f6e112e9bcc03808 100644 (file)
@@ -60,14 +60,19 @@ class LinkbackPlugin extends Plugin
 
     function onHandleQueuedNotice($notice)
     {
-        if ($notice->is_local == 1) {
+        if (intval($notice->is_local) === Notice::LOCAL_PUBLIC) {
             // Try to avoid actually mucking with the
             // 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);
@@ -76,6 +81,11 @@ class LinkbackPlugin extends Plugin
                 $parent = $notice->getParent();
                 $this->linkbackUrl($parent->getUrl());
             }
+
+            $replyProfiles = Profile::multiGet('id', $notice->getReplies());
+            foreach($replyProfiles->fetchAll('profileurl') as $profileurl) {
+                $this->linkbackUrl($profileurl);
+            }
         }
         return true;
     }
@@ -315,4 +325,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;
+    }
 }