s/bestUrl/getUrl/ for notices and microapp objects

This commit is contained in:
Mikael Nordfeldth 2014-04-29 19:46:58 +02:00
parent c1d2f2516a
commit 7d191f8062
35 changed files with 65 additions and 76 deletions

View File

@ -1697,17 +1697,6 @@ class Notice extends Managed_DataObject
return $noun->asString('activity:' . $element); return $noun->asString('activity:' . $element);
} }
// FIXME: Replace all bestUrl with getUrl and do exception handling
function bestUrl()
{
try {
return $this->getUrl();
} catch (InvalidUrlException $e) {
return common_local_url('shownotice', array('notice' => $this->id));
}
}
/** /**
* Determine which notice, if any, a new notice is in reply to. * Determine which notice, if any, a new notice is in reply to.
* *

View File

@ -445,7 +445,7 @@ class ActivityObject
$object->title .= $e->profile->nickname; $object->title .= $e->profile->nickname;
} }
$object->content = $notice->rendered; $object->content = $notice->rendered;
$object->link = $notice->bestUrl(); $object->link = $notice->getUrl();
$object->extra[] = array('status_net', array('notice_id' => $notice->id)); $object->extra[] = array('status_net', array('notice_id' => $notice->id));

View File

@ -361,7 +361,7 @@ class NoticeListItem extends Widget
*/ */
function showNoticeLink() function showNoticeLink()
{ {
$noticeurl = $this->notice->bestUrl(); $noticeurl = $this->notice->getUrl();
// above should always return an URL // above should always return an URL

View File

@ -73,18 +73,18 @@ class ActivityPlugin extends Plugin
// TRANS: %1$s is a profile URL, %2$s is a profile name, // TRANS: %1$s is a profile URL, %2$s is a profile name,
// TRANS: %3$s is a profile URL, %4$s is a profile name. // TRANS: %3$s is a profile URL, %4$s is a profile name.
$rendered = sprintf(_m('<a href="%1$s">%2$s</a> started following <a href="%3$s">%4$s</a>.'), $rendered = sprintf(_m('<a href="%1$s">%2$s</a> started following <a href="%3$s">%4$s</a>.'),
$profile->profileurl, $profile->getUrl(),
$profile->getBestName(), $profile->getBestName(),
$other->profileurl, $other->getUrl(),
$other->getBestName()); $other->getBestName());
// TRANS: Text for "started following" item in activity plugin. // TRANS: Text for "started following" item in activity plugin.
// TRANS: %1$s is a profile name, %2$s is a profile URL, // TRANS: %1$s is a profile name, %2$s is a profile URL,
// TRANS: %3$s is a profile name, %4$s is a profile URL. // TRANS: %3$s is a profile name, %4$s is a profile URL.
$content = sprintf(_m('%1$s (%2$s) started following %3$s (%4$s).'), $content = sprintf(_m('%1$s (%2$s) started following %3$s (%4$s).'),
$profile->getBestName(), $profile->getBestName(),
$profile->profileurl, $profile->getUrl(),
$other->getBestName(), $other->getBestName(),
$other->profileurl); $other->getUrl());
$notice = Notice::saveNew($profile->id, $notice = Notice::saveNew($profile->id,
$content, $content,
@ -111,18 +111,18 @@ class ActivityPlugin extends Plugin
// TRANS: %1$s is a profile URL, %2$s is a profile name, // TRANS: %1$s is a profile URL, %2$s is a profile name,
// TRANS: %3$s is a profile URL, %4$s is a profile name. // TRANS: %3$s is a profile URL, %4$s is a profile name.
$rendered = sprintf(_m('<a href="%1$s">%2$s</a> stopped following <a href="%3$s">%4$s</a>.'), $rendered = sprintf(_m('<a href="%1$s">%2$s</a> stopped following <a href="%3$s">%4$s</a>.'),
$profile->profileurl, $profile->getUrl(),
$profile->getBestName(), $profile->getBestName(),
$other->profileurl, $other->getUrl(),
$other->getBestName()); $other->getBestName());
// TRANS: Text for "stopped following" item in activity plugin. // TRANS: Text for "stopped following" item in activity plugin.
// TRANS: %1$s is a profile name, %2$s is a profile URL, // TRANS: %1$s is a profile name, %2$s is a profile URL,
// TRANS: %3$s is a profile name, %4$s is a profile URL. // TRANS: %3$s is a profile name, %4$s is a profile URL.
$content = sprintf(_m('%1$s (%2$s) stopped following %3$s (%4$s).'), $content = sprintf(_m('%1$s (%2$s) stopped following %3$s (%4$s).'),
$profile->getBestName(), $profile->getBestName(),
$profile->profileurl, $profile->getUrl(),
$other->getBestName(), $other->getBestName(),
$other->profileurl); $other->getUrl());
$uri = TagURI::mint('stop-following:%d:%d:%s', $uri = TagURI::mint('stop-following:%d:%d:%s',
$profile->id, $profile->id,
@ -159,18 +159,18 @@ class ActivityPlugin extends Plugin
// TRANS: %1$s is a profile URL, %2$s is a profile name, // TRANS: %1$s is a profile URL, %2$s is a profile name,
// TRANS: %3$s is a notice URL, %4$s is an author name. // TRANS: %3$s is a notice URL, %4$s is an author name.
$rendered = sprintf(_m('<a href="%1$s">%2$s</a> liked <a href="%3$s">%4$s\'s update</a>.'), $rendered = sprintf(_m('<a href="%1$s">%2$s</a> liked <a href="%3$s">%4$s\'s update</a>.'),
$profile->profileurl, $profile->getUrl(),
$profile->getBestName(), $profile->getBestName(),
$notice->bestUrl(), $notice->getUrl(),
$author->getBestName()); $author->getBestName());
// TRANS: Text for "liked" item in activity plugin. // TRANS: Text for "liked" item in activity plugin.
// TRANS: %1$s is a profile name, %2$s is a profile URL, // TRANS: %1$s is a profile name, %2$s is a profile URL,
// TRANS: %3$s is an author name, %4$s is a notice URL. // TRANS: %3$s is an author name, %4$s is a notice URL.
$content = sprintf(_m('%1$s (%2$s) liked %3$s\'s status (%4$s).'), $content = sprintf(_m('%1$s (%2$s) liked %3$s\'s status (%4$s).'),
$profile->getBestName(), $profile->getBestName(),
$profile->profileurl, $profile->getUrl(),
$author->getBestName(), $author->getBestName(),
$notice->bestUrl()); $notice->getUrl());
$notice = Notice::saveNew($profile->id, $notice = Notice::saveNew($profile->id,
$content, $content,
@ -200,18 +200,18 @@ class ActivityPlugin extends Plugin
// TRANS: %1$s is a profile URL, %2$s is a profile name, // TRANS: %1$s is a profile URL, %2$s is a profile name,
// TRANS: %3$s is a notice URL, %4$s is an author name. // TRANS: %3$s is a notice URL, %4$s is an author name.
$rendered = sprintf(_m('<a href="%1$s">%2$s</a> stopped liking <a href="%3$s">%4$s\'s update</a>.'), $rendered = sprintf(_m('<a href="%1$s">%2$s</a> stopped liking <a href="%3$s">%4$s\'s update</a>.'),
$profile->profileurl, $profile->getUrl(),
$profile->getBestName(), $profile->getBestName(),
$notice->bestUrl(), $notice->getUrl(),
$author->getBestName()); $author->getBestName());
// TRANS: Text for "stopped liking" item in activity plugin. // TRANS: Text for "stopped liking" item in activity plugin.
// TRANS: %1$s is a profile name, %2$s is a profile URL, // TRANS: %1$s is a profile name, %2$s is a profile URL,
// TRANS: %3$s is an author name, %4$s is a notice URL. // TRANS: %3$s is an author name, %4$s is a notice URL.
$content = sprintf(_m('%1$s (%2$s) stopped liking %3$s\'s status (%4$s).'), $content = sprintf(_m('%1$s (%2$s) stopped liking %3$s\'s status (%4$s).'),
$profile->getBestName(), $profile->getBestName(),
$profile->profileurl, $profile->getUrl(),
$author->getBestName(), $author->getBestName(),
$notice->bestUrl()); $notice->getUrl());
$uri = TagURI::mint('unlike:%d:%d:%s', $uri = TagURI::mint('unlike:%d:%d:%s',
$profile->id, $profile->id,
@ -245,7 +245,7 @@ class ActivityPlugin extends Plugin
// TRANS: %1$s is a profile URL, %2$s is a profile name, // TRANS: %1$s is a profile URL, %2$s is a profile name,
// TRANS: %3$s is a group URL, %4$s is a group name. // TRANS: %3$s is a group URL, %4$s is a group name.
$rendered = sprintf(_m('<a href="%1$s">%2$s</a> joined the group <a href="%3$s">%4$s</a>.'), $rendered = sprintf(_m('<a href="%1$s">%2$s</a> joined the group <a href="%3$s">%4$s</a>.'),
$profile->profileurl, $profile->getUrl(),
$profile->getBestName(), $profile->getBestName(),
$group->homeUrl(), $group->homeUrl(),
$group->getBestName()); $group->getBestName());
@ -254,7 +254,7 @@ class ActivityPlugin extends Plugin
// TRANS: %3$s is a group name, %4$s is a group URL. // TRANS: %3$s is a group name, %4$s is a group URL.
$content = sprintf(_m('%1$s (%2$s) joined the group %3$s (%4$s).'), $content = sprintf(_m('%1$s (%2$s) joined the group %3$s (%4$s).'),
$profile->getBestName(), $profile->getBestName(),
$profile->profileurl, $profile->getUrl(),
$group->getBestName(), $group->getBestName(),
$group->homeUrl()); $group->homeUrl());
@ -286,7 +286,7 @@ class ActivityPlugin extends Plugin
// TRANS: %1$s is a profile URL, %2$s is a profile name, // TRANS: %1$s is a profile URL, %2$s is a profile name,
// TRANS: %3$s is a group URL, %4$s is a group name. // TRANS: %3$s is a group URL, %4$s is a group name.
$rendered = sprintf(_m('<a href="%1$s">%2$s</a> left the group <a href="%3$s">%4$s</a>.'), $rendered = sprintf(_m('<a href="%1$s">%2$s</a> left the group <a href="%3$s">%4$s</a>.'),
$profile->profileurl, $profile->getUrl(),
$profile->getBestName(), $profile->getBestName(),
$group->homeUrl(), $group->homeUrl(),
$group->getBestName()); $group->getBestName());
@ -295,7 +295,7 @@ class ActivityPlugin extends Plugin
// TRANS: %3$s is a group name, %4$s is a group URL. // TRANS: %3$s is a group name, %4$s is a group URL.
$content = sprintf(_m('%1$s (%2$s) left the group %3$s (%4$s).'), $content = sprintf(_m('%1$s (%2$s) left the group %3$s (%4$s).'),
$profile->getBestName(), $profile->getBestName(),
$profile->profileurl, $profile->getUrl(),
$group->getBestName(), $group->getBestName(),
$group->homeUrl()); $group->homeUrl());

View File

@ -131,7 +131,7 @@ class NewblogentryAction extends Action
$this->elementEnd('body'); $this->elementEnd('body');
$this->endHTML(); $this->endHTML();
} else { } else {
common_redirect($saved->bestUrl(), 303); common_redirect($saved->getUrl(), 303);
} }
} }
} }

View File

@ -68,7 +68,7 @@ class BlogEntryListItem extends NoticeListItemAdapter
} }
$out->elementStart('h4', array('class' => 'blog-entry-title')); $out->elementStart('h4', array('class' => 'blog-entry-title'));
$out->element('a', array('href' => $notice->bestUrl()), $entry->title); $out->element('a', array('href' => $notice->getUrl()), $entry->title);
$out->elementEnd('h4'); $out->elementEnd('h4');
// XXX: kind of a hack // XXX: kind of a hack
@ -91,7 +91,7 @@ class BlogEntryListItem extends NoticeListItemAdapter
$out->elementEnd('div'); $out->elementEnd('div');
} }
$url = ($entry->url) ? $entry->url : $notice->bestUrl(); $url = ($entry->url) ? $entry->url : $notice->getUrl();
$out->element('a', $out->element('a',
array('href' => $url, array('href' => $url,
'class' => 'blog-entry-link'), 'class' => 'blog-entry-link'),

View File

@ -467,7 +467,7 @@ class BookmarkPlugin extends MicroAppPlugin
$object->type = ActivityObject::BOOKMARK; $object->type = ActivityObject::BOOKMARK;
$object->title = $nb->title; $object->title = $nb->title;
$object->summary = $nb->description; $object->summary = $nb->description;
$object->link = $notice->bestUrl(); $object->link = $notice->getUrl();
// Attributes of the URL // Attributes of the URL

View File

@ -178,7 +178,7 @@ class NewbookmarkAction extends Action
$this->elementEnd('body'); $this->elementEnd('body');
$this->endHTML(); $this->endHTML();
} else { } else {
common_redirect($saved->bestUrl(), 303); common_redirect($saved->getUrl(), 303);
} }
} }

View File

@ -195,7 +195,7 @@ ENDOFSCRIPT;
$profile = Profile::getKV('id', $noticeListItem->notice->profile_id); $profile = Profile::getKV('id', $noticeListItem->notice->profile_id);
if ($this->isAllowedRichEdit($profile)) { if ($this->isAllowedRichEdit($profile)) {
$noticeUrl = $noticeListItem->notice->bestUrl(); $noticeUrl = $noticeListItem->notice->getUrl();
$noticeUrl .= '#disqus_thread'; $noticeUrl .= '#disqus_thread';
$noticeListItem->out->element( $noticeListItem->out->element(

View File

@ -173,7 +173,7 @@ class UserEmailSummaryHandler extends QueueHandler
$out->text(' '); $out->text(' ');
$out->raw($notice->rendered); $out->raw($notice->rendered);
$out->elementStart('div', array('style' => 'font-size: 0.8em; padding-top: 4px;')); $out->elementStart('div', array('style' => 'font-size: 0.8em; padding-top: 4px;'));
$noticeurl = $notice->bestUrl(); $noticeurl = $notice->getUrl();
// above should always return an URL // above should always return an URL
assert(!empty($noticeurl)); assert(!empty($noticeurl));
$out->elementStart('a', array('rel' => 'bookmark', $out->elementStart('a', array('rel' => 'bookmark',

View File

@ -216,7 +216,7 @@ class EventPlugin extends MicroappPlugin
$obj->type = Happening::OBJECT_TYPE; $obj->type = Happening::OBJECT_TYPE;
$obj->title = $happening->title; $obj->title = $happening->title;
$obj->summary = $happening->description; $obj->summary = $happening->description;
$obj->link = $notice->bestUrl(); $obj->link = $notice->getUrl();
// XXX: how to get this stuff into JSON?! // XXX: how to get this stuff into JSON?!

View File

@ -254,7 +254,7 @@ class NeweventAction extends Action
$this->elementEnd('body'); $this->elementEnd('body');
$this->endHTML(); $this->endHTML();
} else { } else {
common_redirect($saved->bestUrl(), 303); common_redirect($saved->getUrl(), 303);
} }
} }

View File

@ -166,7 +166,7 @@ class NewrsvpAction extends Action
$this->elementEnd('body'); $this->elementEnd('body');
$this->endHTML(); $this->endHTML();
} else { } else {
common_redirect($saved->bestUrl(), 303); common_redirect($saved->getUrl(), 303);
} }
} }

View File

@ -347,7 +347,7 @@ class RSVP extends Managed_DataObject
$eventTitle = _m('an unknown event'); $eventTitle = _m('an unknown event');
} else { } else {
$notice = $event->getNotice(); $notice = $event->getNotice();
$eventUrl = $notice->bestUrl(); $eventUrl = $notice->getUrl();
$eventTitle = $event->title; $eventTitle = $event->title;
} }

View File

@ -107,7 +107,7 @@ class GNUsocialPhotoPlugin extends MicroAppPlugin
$object->type = Photo::OBJECT_TYPE; $object->type = Photo::OBJECT_TYPE;
$object->title = $photo->title; $object->title = $photo->title;
$object->summary = $notice->content; $object->summary = $notice->content;
$object->link = $notice->bestUrl(); $object->link = $notice->getUrl();
$object->largerImage = $photo->photo_uri; $object->largerImage = $photo->photo_uri;
$object->thumbnail = $photo->thumb_uri; $object->thumbnail = $photo->thumb_uri;

View File

@ -98,7 +98,7 @@ class GNUsocialVideoPlugin extends MicroAppPlugin
$object->type = Video::OBJECT_TYPE; $object->type = Video::OBJECT_TYPE;
$object->title = $notice->content; $object->title = $notice->content;
$object->summary = $notice->content; $object->summary = $notice->content;
$object->link = $notice->bestUrl(); $object->link = $notice->getUrl();
$vid = Video::getByNotice($notice); $vid = Video::getByNotice($notice);

View File

@ -143,14 +143,14 @@ class MapAction extends Action
$act = new ApiAction('/dev/null'); $act = new ApiAction('/dev/null');
$arr = $act->twitterStatusArray($notice, true); $arr = $act->twitterStatusArray($notice, true);
$arr['url'] = $notice->bestUrl(); $arr['url'] = $notice->getUrl();
$arr['html'] = $notice->rendered; $arr['html'] = $notice->rendered;
$arr['source'] = $arr['source']; $arr['source'] = $arr['source'];
if (!empty($notice->reply_to)) { if (!empty($notice->reply_to)) {
$reply_to = Notice::getKV('id', $notice->reply_to); $reply_to = Notice::getKV('id', $notice->reply_to);
if (!empty($reply_to)) { if (!empty($reply_to)) {
$arr['in_reply_to_status_url'] = $reply_to->bestUrl(); $arr['in_reply_to_status_url'] = $reply_to->getUrl();
} }
$reply_to = null; $reply_to = null;
} }

View File

@ -187,7 +187,7 @@ class NoticeTitlePlugin extends Plugin
if (!empty($title)) { if (!empty($title)) {
$nli->out->elementStart('h4', array('class' => 'notice_title')); $nli->out->elementStart('h4', array('class' => 'notice_title'));
$nli->out->element('a', array('href' => $nli->notice->bestUrl()), $title); $nli->out->element('a', array('href' => $nli->notice->getUrl()), $title);
$nli->out->elementEnd('h4'); $nli->out->elementEnd('h4');
} }

View File

@ -242,7 +242,7 @@ class PollPlugin extends MicroAppPlugin
$object->type = self::POLL_RESPONSE_OBJECT; $object->type = self::POLL_RESPONSE_OBJECT;
$object->title = $notice->content; $object->title = $notice->content;
$object->summary = $notice->content; $object->summary = $notice->content;
$object->link = $notice->bestUrl(); $object->link = $notice->getUrl();
$response = Poll_response::getByNotice($notice); $response = Poll_response::getByNotice($notice);
if ($response) { if ($response) {
@ -265,7 +265,7 @@ class PollPlugin extends MicroAppPlugin
$object->type = self::POLL_OBJECT; $object->type = self::POLL_OBJECT;
$object->title = $notice->content; $object->title = $notice->content;
$object->summary = $notice->content; $object->summary = $notice->content;
$object->link = $notice->bestUrl(); $object->link = $notice->getUrl();
$poll = Poll::getByNotice($notice); $poll = Poll::getByNotice($notice);
if ($poll) { if ($poll) {

View File

@ -168,7 +168,7 @@ class NewPollAction extends Action
$this->elementEnd('body'); $this->elementEnd('body');
$this->endHTML(); $this->endHTML();
} else { } else {
common_redirect($saved->bestUrl(), 303); common_redirect($saved->getUrl(), 303);
} }
} }

View File

@ -155,7 +155,7 @@ class RespondPollAction extends Action
$this->elementEnd('body'); $this->elementEnd('body');
$this->endHTML(); $this->endHTML();
} else { } else {
common_redirect($this->poll->bestUrl(), 303); common_redirect($this->poll->getUrl(), 303);
} }
} }

View File

@ -114,9 +114,9 @@ class Poll extends Managed_DataObject
return Notice::getKV('uri', $this->uri); return Notice::getKV('uri', $this->uri);
} }
function bestUrl() function getUrl()
{ {
return $this->getNotice()->bestUrl(); return $this->getNotice()->getUrl();
} }
/** /**

View File

@ -100,9 +100,9 @@ class Poll_response extends Managed_DataObject
return Notice::getKV('uri', $this->uri); return Notice::getKV('uri', $this->uri);
} }
function bestUrl() function getUrl()
{ {
return $this->getNotice()->bestUrl(); return $this->getNotice()->getUrl();
} }
/** /**

View File

@ -242,7 +242,7 @@ class QnAPlugin extends MicroAppPlugin
$obj->id = $question->uri; $obj->id = $question->uri;
$obj->type = QnA_Question::OBJECT_TYPE; $obj->type = QnA_Question::OBJECT_TYPE;
$obj->title = $question->title; $obj->title = $question->title;
$obj->link = $notice->bestUrl(); $obj->link = $notice->getUrl();
// XXX: probably need other stuff here // XXX: probably need other stuff here

View File

@ -158,7 +158,7 @@ class QnaclosequestionAction extends Action
$this->elementEnd('body'); $this->elementEnd('body');
$this->endHTML(); $this->endHTML();
} else { } else {
common_redirect($this->question->bestUrl(), 303); common_redirect($this->question->getUrl(), 303);
} }
} }

View File

@ -167,7 +167,7 @@ class QnanewanswerAction extends Action
$this->endHTML(); $this->endHTML();
} else { } else {
common_debug("not ajax"); common_debug("not ajax");
common_redirect($this->question->bestUrl(), 303); common_redirect($this->question->getUrl(), 303);
} }
} }

View File

@ -158,7 +158,7 @@ class QnanewquestionAction extends Action
$this->elementEnd('body'); $this->elementEnd('body');
$this->endHTML(); $this->endHTML();
} else { } else {
common_redirect($saved->bestUrl(), 303); common_redirect($saved->getUrl(), 303);
} }
} }

View File

@ -166,7 +166,7 @@ class QnareviseanswerAction extends Action
$this->elementEnd('body'); $this->elementEnd('body');
$this->endHTML(); $this->endHTML();
} else { } else {
common_redirect($this->answer->bestUrl(), 303); common_redirect($this->answer->getUrl(), 303);
} }
} }
@ -208,7 +208,7 @@ class QnareviseanswerAction extends Action
$this->elementEnd('body'); $this->elementEnd('body');
$this->endHTML(); $this->endHTML();
} else { } else {
common_redirect($this->answer->bestUrl(), 303); common_redirect($this->answer->getUrl(), 303);
} }
} }

View File

@ -153,7 +153,7 @@ class Qnavote extends Action
$this->elementEnd('body'); $this->elementEnd('body');
$this->endHTML(); $this->endHTML();
} else { } else {
common_redirect($this->question->bestUrl(), 303); common_redirect($this->question->getUrl(), 303);
} }
} }

View File

@ -127,9 +127,9 @@ class QnA_Answer extends Managed_DataObject
return QnA_Answer::getKV('uri', $notice->uri); return QnA_Answer::getKV('uri', $notice->uri);
} }
function bestUrl() function getUrl()
{ {
return $this->getNotice()->bestUrl(); return $this->getNotice()->getUrl();
} }
/** /**

View File

@ -107,9 +107,9 @@ class QnA_Question extends Managed_DataObject
return Notice::getKV('uri', $this->uri); return Notice::getKV('uri', $this->uri);
} }
function bestUrl() function getUrl()
{ {
return $this->getNotice()->bestUrl(); return $this->getNotice()->getUrl();
} }
function getProfile() function getProfile()

View File

@ -318,7 +318,7 @@ class RealtimePlugin extends Plugin
$act = new ApiAction('/dev/null'); $act = new ApiAction('/dev/null');
$arr = $act->twitterStatusArray($notice, true); $arr = $act->twitterStatusArray($notice, true);
$arr['url'] = $notice->bestUrl(); $arr['url'] = $notice->getUrl();
$arr['html'] = htmlspecialchars($notice->rendered); $arr['html'] = htmlspecialchars($notice->rendered);
$arr['source'] = htmlspecialchars($arr['source']); $arr['source'] = htmlspecialchars($arr['source']);
$arr['conversation_url'] = $this->getConversationUrl($notice); $arr['conversation_url'] = $this->getConversationUrl($notice);
@ -330,15 +330,15 @@ class RealtimePlugin extends Plugin
if (!empty($notice->repeat_of)) { if (!empty($notice->repeat_of)) {
$original = Notice::getKV('id', $notice->repeat_of); $original = Notice::getKV('id', $notice->repeat_of);
if (!empty($original)) { if ($original instanceof Notice) {
$arr['retweeted_status']['url'] = $original->bestUrl(); $arr['retweeted_status']['url'] = $original->getUrl();
$arr['retweeted_status']['html'] = htmlspecialchars($original->rendered); $arr['retweeted_status']['html'] = htmlspecialchars($original->rendered);
$arr['retweeted_status']['source'] = htmlspecialchars($original->source); $arr['retweeted_status']['source'] = htmlspecialchars($original->source);
$originalProfile = $original->getProfile(); $originalProfile = $original->getProfile();
$arr['retweeted_status']['user']['profile_url'] = $originalProfile->profileurl; $arr['retweeted_status']['user']['profile_url'] = $originalProfile->profileurl;
$arr['retweeted_status']['conversation_url'] = $this->getConversationUrl($original); $arr['retweeted_status']['conversation_url'] = $this->getConversationUrl($original);
} }
$original = null; unset($original);
} }
return $arr; return $arr;

View File

@ -104,7 +104,7 @@ abstract class GenericNoticeShareTarget extends NoticeShareTarget
{ {
// TRANS: %s is notice content that is shared on Twitter, Facebook or another platform. // TRANS: %s is notice content that is shared on Twitter, Facebook or another platform.
$pattern = _m('"%s"'); $pattern = _m('"%s"');
$url = $this->notice->bestUrl(); $url = $this->notice->getUrl();
$suffix = ' ' . $url; $suffix = ' ' . $url;
$room = $this->maxLength() - mb_strlen($suffix) - (mb_strlen($pattern) - mb_strlen('%s')); $room = $this->maxLength() - mb_strlen($suffix) - (mb_strlen($pattern) - mb_strlen('%s'));
@ -192,7 +192,7 @@ class FacebookShareTarget extends NoticeShareTarget
public function targetUrl() public function targetUrl()
{ {
$args = array( $args = array(
'u' => $this->notice->bestUrl(), 'u' => $this->notice->getUrl(),
// TRANS: %s is notice content that is shared on Twitter, Facebook or another platform. // TRANS: %s is notice content that is shared on Twitter, Facebook or another platform.
't' => sprintf(_m('"%s"'), $this->notice->content), 't' => sprintf(_m('"%s"'), $this->notice->content),
); );

View File

@ -194,7 +194,7 @@ class SubMirror extends Managed_DataObject
protected function copyNotice($profile, $notice) protected function copyNotice($profile, $notice)
{ {
$options = array('is_local' => Notice::LOCAL_PUBLIC, $options = array('is_local' => Notice::LOCAL_PUBLIC,
'url' => $notice->bestUrl(), // pass through the foreign link... 'url' => $notice->getUrl(), // pass through the foreign link...
'rendered' => $notice->rendered); 'rendered' => $notice->rendered);
$saved = Notice::saveNew($profile->id, $saved = Notice::saveNew($profile->id,

View File

@ -372,7 +372,7 @@ class ActivityGenerationTests extends PHPUnit_Framework_TestCase
$this->assertNotNull($forward); $this->assertNotNull($forward);
$this->assertEquals($notice->getUri(), $forward->getAttribute('ref')); $this->assertEquals($notice->getUri(), $forward->getAttribute('ref'));
$this->assertEquals($notice->bestUrl(), $forward->getAttribute('href')); $this->assertEquals($notice->getUrl(), $forward->getAttribute('href'));
} }
public function testTag() public function testTag()