]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OMB/OMBPlugin.php
retaining compatibility with previous TwitterBridge getMediatype
[quix0rs-gnu-social.git] / plugins / OMB / OMBPlugin.php
index f5fed6007998411f07e47503fd333d9d426479b7..de0088cc8e60789b35ec055db76ec6b06f5d91ae 100644 (file)
@@ -228,16 +228,14 @@ class OMBPlugin extends Plugin
         $omb01 = Remote_profile::staticGet('id', $other_id);
 
         if (!empty($omb01)) {
-            // TRANS: Client error displayed trying to subscribe to an OMB 0.1 remote profile.
             throw new ClientException(
-                _m(
-                    'You cannot subscribe to an OMB 0.1 '
+                // TRANS: Client error displayed trying to subscribe to an OMB 0.1 remote profile.
+                _m('You cannot subscribe to an OMB 0.1 '
                     . 'remote profile with this action.'
                 )
             );
             return false;
         }
-
     }
 
     /**
@@ -257,10 +255,9 @@ class OMBPlugin extends Plugin
         $omb01 = Remote_profile::staticGet('id', $tagged_profile->id);
 
         if (!empty($omb01)) {
-            // TRANS: Client error displayed when trying to add an OMB 0.1 remote profile to a list.
             $this->clientError(
-                _m(
-                    'You cannot list an OMB 0.1 '
+                // TRANS: Client error displayed when trying to add an OMB 0.1 remote profile to a list.
+                _m('You cannot list an OMB 0.1 '
                    .'remote profile with this action.')
             );
         }
@@ -282,10 +279,9 @@ class OMBPlugin extends Plugin
         $omb01 = Remote_profile::staticGet('id', $ptag->tagged);
 
         if (!empty($omb01)) {
-            // TRANS: Client error displayed when trying to (un)list an OMB 0.1 remote profile.
             $this->clientError(
-                _m(
-                    'You cannot (un)list an OMB 0.1 '
+                // TRANS: Client error displayed when trying to (un)list an OMB 0.1 remote profile.
+                _m('You cannot (un)list an OMB 0.1 '
                     . 'remote profile with this action.')
             );
             return false;
@@ -317,8 +313,8 @@ class OMBPlugin extends Plugin
 
                 if (!$result) {
                     common_log_db_error($token, 'DELETE', __FILE__);
-                    // TRANS: Exception thrown when the OMB token for a subscription could not deleted on the server.
                     throw new Exception(
+                        // TRANS: Exception thrown when the OMB token for a subscription could not deleted on the server.
                         _m('Could not delete subscription OMB token.')
                     );
                 }
@@ -369,6 +365,32 @@ class OMBPlugin extends Plugin
         return true;
     }
 
+    /**
+     * Broadcast a profile over OMB
+     *
+     * @param Profile $profile to broadcast
+     * @return false
+     */
+    function onBroadcastProfile($profile) {
+        $qm = QueueManager::get();
+        $qm->enqueue($profile, "profile");
+        return true;
+    }
+
+    function onStartProfileRemoteSubscribe($out, $profile)
+    {
+        $out->elementStart('li', 'entity_subscribe');
+        $url = common_local_url('remotesubscribe',
+                                array('nickname' => $this->profile->nickname));
+        $out->element('a', array('href' => $url,
+                                  'class' => 'entity_remote_subscribe'),
+                       // TRANS: Link text for link that will subscribe to a remote profile.
+                       _m('BUTTON','Subscribe'));
+        $out->elementEnd('li');
+
+        return false;
+    }
+
     /**
      * Plugin version info
      *
@@ -382,12 +404,10 @@ class OMBPlugin extends Plugin
             'version'        => STATUSNET_VERSION,
             'author'         => 'Zach Copley',
             'homepage'       => 'http://status.net/wiki/Plugin:Sample',
-            'rawdescription' =>
             // TRANS: Plugin description.
-            _m('A sample plugin to show basics of development for new hackers.')
+            'rawdescription' => _m('A sample plugin to show basics of development for new hackers.')
         );
 
         return true;
     }
 }
-