]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Notice URIs are not necessarily URLs.
authorMikael Nordfeldth <mmn@hethane.se>
Wed, 30 Apr 2014 18:44:23 +0000 (20:44 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Wed, 30 Apr 2014 18:44:23 +0000 (20:44 +0200)
Let's use getUrl() for URL retrieval. May throw exceptions, but
only if it's a Notice that cannot be linked like that anyway.

actions/shownotice.php
classes/Fave.php
plugins/FacebookBridge/lib/facebookclient.php
plugins/Linkback/LinkbackPlugin.php
plugins/OStatus/OStatusPlugin.php
plugins/QnA/QnAPlugin.php
plugins/TwitterBridge/twitter.php

index eb9ee17fabc41a3b3c98607224fa1f991eb76646..2ee8c5132881a4a1cc942513ed2762c4cf27565f 100644 (file)
@@ -304,14 +304,14 @@ class ShownoticeAction extends Action
             'href'=>common_local_url(
                 'oembed',
                 array(),
-                array('format'=>'json','url'=>$this->notice->uri)),
+                array('format'=>'json','url'=>$this->notice->getUrl())),
             'title'=>'oEmbed'),null);
         $this->element('link',array('rel'=>'alternate',
             'type'=>'text/xml+oembed',
             'href'=>common_local_url(
                 'oembed',
                 array(),
-                array('format'=>'xml','url'=>$this->notice->uri)),
+                array('format'=>'xml','url'=>$this->notice->getUrl())),
             'title'=>'oEmbed'),null);
 
         // Extras to aid in sharing notices to Facebook
index beeda9aafd314795414ad8c51712de94c2f03a46..207614329681e3da8ebca87047f474087ca9b1bd 100644 (file)
@@ -142,7 +142,7 @@ class Fave extends Managed_DataObject
         // TRANS: %1$s is a user nickname or full name, %2$s is a notice URI.
         $act->content = sprintf(_('%1$s marked notice %2$s as a favorite.'),
                                $profile->getBestName(),
-                               $notice->uri);
+                               $notice->getUrl());
 
         $act->actor     = ActivityObject::fromProfile($profile);
         $act->objects[] = ActivityObject::fromNotice($notice);
index be63051179b007929d0d1d295fcb0307c0f9d628..deb92e93131a57041e47223cfea0cc9824eea769 100644 (file)
@@ -628,7 +628,7 @@ class Facebookclient
 
         // Facebook has a 420-char hardcoded max.
         if (mb_strlen($statustxt) > 420) {
-            $noticeUrl = common_shorten_url($this->notice->uri);
+            $noticeUrl = common_shorten_url($this->notice->getUrl());
             $urlLen = mb_strlen($noticeUrl);
             $txt = mb_substr($statustxt, 0, 420 - ($urlLen + 3)) . ' … ' . $noticeUrl;
         }
index 337cfdedfa5b70dcee2f01d59ec1baaa90f85e0d..597ac1f4469f8948e88f328408ee60d3f1894b0a 100644 (file)
@@ -207,7 +207,7 @@ class LinkbackPlugin extends Plugin
                                          $profile->nickname,
                                          common_exact_date($this->notice->created)),
                       'excerpt' => $this->notice->content,
-                      'url' => $this->notice->uri,
+                      'url' => $this->notice->getUrl(),
                       'blog_name' => $profile->nickname);
 
         $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
index f32b437f866ec8bf8bef0a8df87b68efe42fd2a9..07abd3908f0aa8e5a96aeb502083d45127787f7b 100644 (file)
@@ -1075,7 +1075,7 @@ class OStatusPlugin extends Plugin
         // TRANS: %1$s is the unfavoring user's name, %2$s is URI to the no longer favored notice.
         $act->content = sprintf(_m('%1$s no longer likes %2$s.'),
                                $profile->getBestName(),
-                               $notice->uri);
+                               $notice->getUrl());
 
         $act->actor   = ActivityObject::fromProfile($profile);
         $act->object  = ActivityObject::fromNotice($notice);
index ee452deab194e6def64ffd6ea82acdc1dcb34369..d874441d85a691f87aa13a2ce00bcc112564117b 100644 (file)
@@ -465,7 +465,7 @@ class QnAPlugin extends MicroAppPlugin
             $ellipsis = _m('…');
             $short = mb_substr($content, 0, $max - 1);
             $short .= sprintf('<a href="%1$s" rel="more" title="%2$s">%3$s</a>',
-                              $notice->uri,
+                              $notice->getUrl(),
                               // TRANS: Title for link that is an ellipsis in English.
                               _m('more...'),
                               $ellipsis);
index 358c3aa86e036c7a1f83ecdb01f0265780c57adc..4ff1a344a124532ec3c2d063ce661a7e5bd0aaef 100644 (file)
@@ -379,7 +379,7 @@ function format_status($notice)
 
     // Twitter still has a 140-char hardcoded max.
     if (mb_strlen($statustxt) > 140) {
-        $noticeUrl = common_shorten_url($notice->uri);
+        $noticeUrl = common_shorten_url($notice->getUrl());
         $urlLen = mb_strlen($noticeUrl);
         $statustxt = mb_substr($statustxt, 0, 140 - ($urlLen + 3)) . ' … ' . $noticeUrl;
     }