]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/ShareNotice/ShareNoticePlugin.php
Merge branch 'subscribers_as_addressees' into 'nightly'
[quix0rs-gnu-social.git] / plugins / ShareNotice / ShareNoticePlugin.php
index 0cd248e213bc0319de70e1429d172f16819960c1..7a6fd28feee10b5d9776611df46f3c2fc8957543 100644 (file)
@@ -32,7 +32,7 @@ class ShareNoticePlugin extends Plugin
         array('StatusNet', array('baseurl' => 'http://identi.ca'))
     );
 
-    function onEndShowStatusNetStyles($action) {
+    public function onEndShowStylesheets(Action $action) {
         $action->cssLink($this->path('css/sharenotice.css'));
         return true;
     }
@@ -102,15 +102,18 @@ abstract class GenericNoticeShareTarget extends NoticeShareTarget
 
     protected function statusText()
     {
-        // TRANS: Leave this message unchanged.
+        // TRANS: %s is notice content that is shared on Twitter, Facebook or another platform.
         $pattern = _m('"%s"');
-        $url = $this->notice->bestUrl();
+        $url = $this->notice->getUrl();
         $suffix = ' ' . $url;
         $room = $this->maxLength() - mb_strlen($suffix) - (mb_strlen($pattern) - mb_strlen('%s'));
 
         $content = $this->notice->content;
+        // TRANS: Truncation symbol.
+        $truncation_symbol = _m('…');
+        $truncation_symbol_length = mb_strlen($truncation_symbol);
         if (mb_strlen($content) > $room) {
-            $content = mb_substr($content, 0, $room - 1) . '…';
+            $content = mb_substr($content, 0, $room - $truncation_symbol_length) . $truncation_symbol;
         }
 
         return sprintf($pattern, $content) . $suffix;
@@ -189,7 +192,7 @@ class FacebookShareTarget extends NoticeShareTarget
     public function targetUrl()
     {
         $args = array(
-            'u' => $this->notice->bestUrl(),
+            'u' => $this->notice->getUrl(),
             // TRANS: %s is notice content that is shared on Twitter, Facebook or another platform.
             't' => sprintf(_m('"%s"'), $this->notice->content),
         );
@@ -206,12 +209,12 @@ class FacebookShareTarget extends NoticeShareTarget
      *
      * @return boolean hook value
      */
-    function onPluginVersion(&$versions)
+    function onPluginVersion(array &$versions)
     {
         $url = 'http://status.net/wiki/Plugin:ShareNotice';
 
         $versions[] = array('name' => 'ShareNotice',
-            'version' => STATUSNET_VERSION,
+            'version' => GNUSOCIAL_VERSION,
             'author' => 'Brion Vibber',
             'homepage' => $url,
             'rawdescription' =>