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:
parent
1acffa9c7a
commit
b77a09fdee
|
@ -304,14 +304,14 @@ class ShownoticeAction extends Action
|
||||||
'href'=>common_local_url(
|
'href'=>common_local_url(
|
||||||
'oembed',
|
'oembed',
|
||||||
array(),
|
array(),
|
||||||
array('format'=>'json','url'=>$this->notice->uri)),
|
array('format'=>'json','url'=>$this->notice->getUrl())),
|
||||||
'title'=>'oEmbed'),null);
|
'title'=>'oEmbed'),null);
|
||||||
$this->element('link',array('rel'=>'alternate',
|
$this->element('link',array('rel'=>'alternate',
|
||||||
'type'=>'text/xml+oembed',
|
'type'=>'text/xml+oembed',
|
||||||
'href'=>common_local_url(
|
'href'=>common_local_url(
|
||||||
'oembed',
|
'oembed',
|
||||||
array(),
|
array(),
|
||||||
array('format'=>'xml','url'=>$this->notice->uri)),
|
array('format'=>'xml','url'=>$this->notice->getUrl())),
|
||||||
'title'=>'oEmbed'),null);
|
'title'=>'oEmbed'),null);
|
||||||
|
|
||||||
// Extras to aid in sharing notices to Facebook
|
// Extras to aid in sharing notices to Facebook
|
||||||
|
|
|
@ -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.
|
// 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.'),
|
$act->content = sprintf(_('%1$s marked notice %2$s as a favorite.'),
|
||||||
$profile->getBestName(),
|
$profile->getBestName(),
|
||||||
$notice->uri);
|
$notice->getUrl());
|
||||||
|
|
||||||
$act->actor = ActivityObject::fromProfile($profile);
|
$act->actor = ActivityObject::fromProfile($profile);
|
||||||
$act->objects[] = ActivityObject::fromNotice($notice);
|
$act->objects[] = ActivityObject::fromNotice($notice);
|
||||||
|
|
|
@ -628,7 +628,7 @@ class Facebookclient
|
||||||
|
|
||||||
// Facebook has a 420-char hardcoded max.
|
// Facebook has a 420-char hardcoded max.
|
||||||
if (mb_strlen($statustxt) > 420) {
|
if (mb_strlen($statustxt) > 420) {
|
||||||
$noticeUrl = common_shorten_url($this->notice->uri);
|
$noticeUrl = common_shorten_url($this->notice->getUrl());
|
||||||
$urlLen = mb_strlen($noticeUrl);
|
$urlLen = mb_strlen($noticeUrl);
|
||||||
$txt = mb_substr($statustxt, 0, 420 - ($urlLen + 3)) . ' … ' . $noticeUrl;
|
$txt = mb_substr($statustxt, 0, 420 - ($urlLen + 3)) . ' … ' . $noticeUrl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ class LinkbackPlugin extends Plugin
|
||||||
$profile->nickname,
|
$profile->nickname,
|
||||||
common_exact_date($this->notice->created)),
|
common_exact_date($this->notice->created)),
|
||||||
'excerpt' => $this->notice->content,
|
'excerpt' => $this->notice->content,
|
||||||
'url' => $this->notice->uri,
|
'url' => $this->notice->getUrl(),
|
||||||
'blog_name' => $profile->nickname);
|
'blog_name' => $profile->nickname);
|
||||||
|
|
||||||
$fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
|
$fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
|
||||||
|
|
|
@ -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.
|
// 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.'),
|
$act->content = sprintf(_m('%1$s no longer likes %2$s.'),
|
||||||
$profile->getBestName(),
|
$profile->getBestName(),
|
||||||
$notice->uri);
|
$notice->getUrl());
|
||||||
|
|
||||||
$act->actor = ActivityObject::fromProfile($profile);
|
$act->actor = ActivityObject::fromProfile($profile);
|
||||||
$act->object = ActivityObject::fromNotice($notice);
|
$act->object = ActivityObject::fromNotice($notice);
|
||||||
|
|
|
@ -465,7 +465,7 @@ class QnAPlugin extends MicroAppPlugin
|
||||||
$ellipsis = _m('…');
|
$ellipsis = _m('…');
|
||||||
$short = mb_substr($content, 0, $max - 1);
|
$short = mb_substr($content, 0, $max - 1);
|
||||||
$short .= sprintf('<a href="%1$s" rel="more" title="%2$s">%3$s</a>',
|
$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.
|
// TRANS: Title for link that is an ellipsis in English.
|
||||||
_m('more...'),
|
_m('more...'),
|
||||||
$ellipsis);
|
$ellipsis);
|
||||||
|
|
|
@ -379,7 +379,7 @@ function format_status($notice)
|
||||||
|
|
||||||
// Twitter still has a 140-char hardcoded max.
|
// Twitter still has a 140-char hardcoded max.
|
||||||
if (mb_strlen($statustxt) > 140) {
|
if (mb_strlen($statustxt) > 140) {
|
||||||
$noticeUrl = common_shorten_url($notice->uri);
|
$noticeUrl = common_shorten_url($notice->getUrl());
|
||||||
$urlLen = mb_strlen($noticeUrl);
|
$urlLen = mb_strlen($noticeUrl);
|
||||||
$statustxt = mb_substr($statustxt, 0, 140 - ($urlLen + 3)) . ' … ' . $noticeUrl;
|
$statustxt = mb_substr($statustxt, 0, 140 - ($urlLen + 3)) . ' … ' . $noticeUrl;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user