From: Mikael Nordfeldth Date: Wed, 30 Apr 2014 18:44:23 +0000 (+0200) Subject: Notice URIs are not necessarily URLs. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b77a09fdee15dcdc8a24fe87afe539d93cf67b51;p=quix0rs-gnu-social.git Notice URIs are not necessarily URLs. Let's use getUrl() for URL retrieval. May throw exceptions, but only if it's a Notice that cannot be linked like that anyway. --- diff --git a/actions/shownotice.php b/actions/shownotice.php index eb9ee17fab..2ee8c51328 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -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 diff --git a/classes/Fave.php b/classes/Fave.php index beeda9aafd..2076143296 100644 --- a/classes/Fave.php +++ b/classes/Fave.php @@ -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); diff --git a/plugins/FacebookBridge/lib/facebookclient.php b/plugins/FacebookBridge/lib/facebookclient.php index be63051179..deb92e9313 100644 --- a/plugins/FacebookBridge/lib/facebookclient.php +++ b/plugins/FacebookBridge/lib/facebookclient.php @@ -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; } diff --git a/plugins/Linkback/LinkbackPlugin.php b/plugins/Linkback/LinkbackPlugin.php index 337cfdedfa..597ac1f446 100644 --- a/plugins/Linkback/LinkbackPlugin.php +++ b/plugins/Linkback/LinkbackPlugin.php @@ -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(); diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index f32b437f86..07abd3908f 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -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); diff --git a/plugins/QnA/QnAPlugin.php b/plugins/QnA/QnAPlugin.php index ee452deab1..d874441d85 100644 --- a/plugins/QnA/QnAPlugin.php +++ b/plugins/QnA/QnAPlugin.php @@ -465,7 +465,7 @@ class QnAPlugin extends MicroAppPlugin $ellipsis = _m('…'); $short = mb_substr($content, 0, $max - 1); $short .= sprintf('%3$s', - $notice->uri, + $notice->getUrl(), // TRANS: Title for link that is an ellipsis in English. _m('more...'), $ellipsis); diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php index 358c3aa86e..4ff1a344a1 100644 --- a/plugins/TwitterBridge/twitter.php +++ b/plugins/TwitterBridge/twitter.php @@ -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; }