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.
This commit is contained in:
Mikael Nordfeldth 2014-04-30 20:44:23 +02:00
parent 1acffa9c7a
commit b77a09fdee
7 changed files with 8 additions and 8 deletions

View 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

View 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);

View 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;
}

View 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();

View 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);

View 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);

View 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;
}