From: Mikael Nordfeldth <mmn@hethane.se>
Date: Tue, 29 Apr 2014 17:46:58 +0000 (+0200)
Subject: s/bestUrl/getUrl/ for notices and microapp objects
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7d191f8062e5d117ac234737bc7ab838859dc4d6;p=quix0rs-gnu-social.git

s/bestUrl/getUrl/ for notices and microapp objects
---

diff --git a/classes/Notice.php b/classes/Notice.php
index a72e04746c..78d8b90350 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -1697,17 +1697,6 @@ class Notice extends Managed_DataObject
         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.
      *
diff --git a/lib/activityobject.php b/lib/activityobject.php
index d436803232..c506b17e85 100644
--- a/lib/activityobject.php
+++ b/lib/activityobject.php
@@ -445,7 +445,7 @@ class ActivityObject
                 $object->title .= $e->profile->nickname;
             }
             $object->content = $notice->rendered;
-            $object->link    = $notice->bestUrl();
+            $object->link    = $notice->getUrl();
 
             $object->extra[] = array('status_net', array('notice_id' => $notice->id));
 
diff --git a/lib/noticelistitem.php b/lib/noticelistitem.php
index e82331afed..ad6f02ef11 100644
--- a/lib/noticelistitem.php
+++ b/lib/noticelistitem.php
@@ -361,7 +361,7 @@ class NoticeListItem extends Widget
      */
     function showNoticeLink()
     {
-        $noticeurl = $this->notice->bestUrl();
+        $noticeurl = $this->notice->getUrl();
 
         // above should always return an URL
 
diff --git a/plugins/Activity/ActivityPlugin.php b/plugins/Activity/ActivityPlugin.php
index ec8d6d6911..1b36e11fd4 100644
--- a/plugins/Activity/ActivityPlugin.php
+++ b/plugins/Activity/ActivityPlugin.php
@@ -73,18 +73,18 @@ class ActivityPlugin extends Plugin
         // 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.
         $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(),
-                            $other->profileurl,
+                            $other->getUrl(),
                             $other->getBestName());
         // TRANS: Text for "started following" item in activity plugin.
         // 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.
         $content  = sprintf(_m('%1$s (%2$s) started following %3$s (%4$s).'),
                             $profile->getBestName(),
-                            $profile->profileurl,
+                            $profile->getUrl(),
                             $other->getBestName(),
-                            $other->profileurl);
+                            $other->getUrl());
 
         $notice = Notice::saveNew($profile->id,
                                   $content,
@@ -111,18 +111,18 @@ class ActivityPlugin extends Plugin
         // 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.
         $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(),
-                            $other->profileurl,
+                            $other->getUrl(),
                             $other->getBestName());
         // TRANS: Text for "stopped following" item in activity plugin.
         // 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.
         $content  = sprintf(_m('%1$s (%2$s) stopped following %3$s (%4$s).'),
                             $profile->getBestName(),
-                            $profile->profileurl,
+                            $profile->getUrl(),
                             $other->getBestName(),
-                            $other->profileurl);
+                            $other->getUrl());
 
         $uri = TagURI::mint('stop-following:%d:%d:%s',
                             $profile->id,
@@ -159,18 +159,18 @@ class ActivityPlugin extends Plugin
         // 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.
         $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(),
-                            $notice->bestUrl(),
+                            $notice->getUrl(),
                             $author->getBestName());
         // TRANS: Text for "liked" item in activity plugin.
         // 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.
         $content  = sprintf(_m('%1$s (%2$s) liked %3$s\'s status (%4$s).'),
                             $profile->getBestName(),
-                            $profile->profileurl,
+                            $profile->getUrl(),
                             $author->getBestName(),
-                            $notice->bestUrl());
+                            $notice->getUrl());
 
         $notice = Notice::saveNew($profile->id,
                                   $content,
@@ -200,18 +200,18 @@ class ActivityPlugin extends Plugin
         // 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.
         $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(),
-                            $notice->bestUrl(),
+                            $notice->getUrl(),
                             $author->getBestName());
         // TRANS: Text for "stopped liking" item in activity plugin.
         // 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.
         $content  = sprintf(_m('%1$s (%2$s) stopped liking %3$s\'s status (%4$s).'),
                             $profile->getBestName(),
-                            $profile->profileurl,
+                            $profile->getUrl(),
                             $author->getBestName(),
-                            $notice->bestUrl());
+                            $notice->getUrl());
 
         $uri = TagURI::mint('unlike:%d:%d:%s',
                             $profile->id,
@@ -245,7 +245,7 @@ class ActivityPlugin extends Plugin
         // 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.
         $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(),
                             $group->homeUrl(),
                             $group->getBestName());
@@ -254,7 +254,7 @@ class ActivityPlugin extends Plugin
         // 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).'),
                             $profile->getBestName(),
-                            $profile->profileurl,
+                            $profile->getUrl(),
                             $group->getBestName(),
                             $group->homeUrl());
 
@@ -286,7 +286,7 @@ class ActivityPlugin extends Plugin
         // 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.
         $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(),
                             $group->homeUrl(),
                             $group->getBestName());
@@ -295,7 +295,7 @@ class ActivityPlugin extends Plugin
         // 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).'),
                             $profile->getBestName(),
-                            $profile->profileurl,
+                            $profile->getUrl(),
                             $group->getBestName(),
                             $group->homeUrl());
 
diff --git a/plugins/Blog/actions/newblogentry.php b/plugins/Blog/actions/newblogentry.php
index 99fc89f2fb..52f95ebd8b 100644
--- a/plugins/Blog/actions/newblogentry.php
+++ b/plugins/Blog/actions/newblogentry.php
@@ -131,7 +131,7 @@ class NewblogentryAction extends Action
             $this->elementEnd('body');
             $this->endHTML();
         } else {
-            common_redirect($saved->bestUrl(), 303);
+            common_redirect($saved->getUrl(), 303);
         }
     }
 }
diff --git a/plugins/Blog/lib/blogentrylistitem.php b/plugins/Blog/lib/blogentrylistitem.php
index a89a562b77..9bf3d6d5df 100644
--- a/plugins/Blog/lib/blogentrylistitem.php
+++ b/plugins/Blog/lib/blogentrylistitem.php
@@ -68,7 +68,7 @@ class BlogEntryListItem extends NoticeListItemAdapter
         }
 
         $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');
 
         // XXX: kind of a hack
@@ -91,7 +91,7 @@ class BlogEntryListItem extends NoticeListItemAdapter
                 $out->elementEnd('div');
             }
 
-            $url = ($entry->url) ? $entry->url : $notice->bestUrl();
+            $url = ($entry->url) ? $entry->url : $notice->getUrl();
             $out->element('a',
                           array('href' => $url,
                                 'class' => 'blog-entry-link'),
diff --git a/plugins/Bookmark/BookmarkPlugin.php b/plugins/Bookmark/BookmarkPlugin.php
index befc4f2291..fc2aeb6a43 100644
--- a/plugins/Bookmark/BookmarkPlugin.php
+++ b/plugins/Bookmark/BookmarkPlugin.php
@@ -467,7 +467,7 @@ class BookmarkPlugin extends MicroAppPlugin
         $object->type    = ActivityObject::BOOKMARK;
         $object->title   = $nb->title;
         $object->summary = $nb->description;
-        $object->link    = $notice->bestUrl();
+        $object->link    = $notice->getUrl();
 
         // Attributes of the URL
 
diff --git a/plugins/Bookmark/actions/newbookmark.php b/plugins/Bookmark/actions/newbookmark.php
index 1c7dd5bc62..168a6e07b6 100644
--- a/plugins/Bookmark/actions/newbookmark.php
+++ b/plugins/Bookmark/actions/newbookmark.php
@@ -178,7 +178,7 @@ class NewbookmarkAction extends Action
             $this->elementEnd('body');
             $this->endHTML();
         } else {
-            common_redirect($saved->bestUrl(), 303);
+            common_redirect($saved->getUrl(), 303);
         }
     }
 
diff --git a/plugins/Disqus/DisqusPlugin.php b/plugins/Disqus/DisqusPlugin.php
index 28e0d80e9b..42bb1dafba 100644
--- a/plugins/Disqus/DisqusPlugin.php
+++ b/plugins/Disqus/DisqusPlugin.php
@@ -195,7 +195,7 @@ ENDOFSCRIPT;
         $profile = Profile::getKV('id', $noticeListItem->notice->profile_id);
 
         if ($this->isAllowedRichEdit($profile)) {
-            $noticeUrl = $noticeListItem->notice->bestUrl();
+            $noticeUrl = $noticeListItem->notice->getUrl();
             $noticeUrl .= '#disqus_thread';
 
             $noticeListItem->out->element(
diff --git a/plugins/EmailSummary/lib/useremailsummaryhandler.php b/plugins/EmailSummary/lib/useremailsummaryhandler.php
index e35fdf7968..15c1c85e80 100644
--- a/plugins/EmailSummary/lib/useremailsummaryhandler.php
+++ b/plugins/EmailSummary/lib/useremailsummaryhandler.php
@@ -173,7 +173,7 @@ class UserEmailSummaryHandler extends QueueHandler
             $out->text(' ');
             $out->raw($notice->rendered);
             $out->elementStart('div', array('style' => 'font-size: 0.8em; padding-top: 4px;'));
-            $noticeurl = $notice->bestUrl();
+            $noticeurl = $notice->getUrl();
             // above should always return an URL
             assert(!empty($noticeurl));
             $out->elementStart('a', array('rel' => 'bookmark',
diff --git a/plugins/Event/EventPlugin.php b/plugins/Event/EventPlugin.php
index 07394d30c3..965eef7744 100644
--- a/plugins/Event/EventPlugin.php
+++ b/plugins/Event/EventPlugin.php
@@ -216,7 +216,7 @@ class EventPlugin extends MicroappPlugin
         $obj->type    = Happening::OBJECT_TYPE;
         $obj->title   = $happening->title;
         $obj->summary = $happening->description;
-        $obj->link    = $notice->bestUrl();
+        $obj->link    = $notice->getUrl();
 
         // XXX: how to get this stuff into JSON?!
 
diff --git a/plugins/Event/actions/newevent.php b/plugins/Event/actions/newevent.php
index cd26490602..d05b5af8d3 100644
--- a/plugins/Event/actions/newevent.php
+++ b/plugins/Event/actions/newevent.php
@@ -254,7 +254,7 @@ class NeweventAction extends Action
             $this->elementEnd('body');
             $this->endHTML();
         } else {
-            common_redirect($saved->bestUrl(), 303);
+            common_redirect($saved->getUrl(), 303);
         }
     }
 
diff --git a/plugins/Event/actions/newrsvp.php b/plugins/Event/actions/newrsvp.php
index cbe67ae173..7a87d359e0 100644
--- a/plugins/Event/actions/newrsvp.php
+++ b/plugins/Event/actions/newrsvp.php
@@ -166,7 +166,7 @@ class NewrsvpAction extends Action
             $this->elementEnd('body');
             $this->endHTML();
         } else {
-            common_redirect($saved->bestUrl(), 303);
+            common_redirect($saved->getUrl(), 303);
         }
     }
 
diff --git a/plugins/Event/classes/RSVP.php b/plugins/Event/classes/RSVP.php
index 521e811036..926f6b7d08 100644
--- a/plugins/Event/classes/RSVP.php
+++ b/plugins/Event/classes/RSVP.php
@@ -347,7 +347,7 @@ class RSVP extends Managed_DataObject
             $eventTitle = _m('an unknown event');
         } else {
             $notice = $event->getNotice();
-            $eventUrl = $notice->bestUrl();
+            $eventUrl = $notice->getUrl();
             $eventTitle = $event->title;
         }
 
diff --git a/plugins/GNUsocialPhoto/GNUsocialPhotoPlugin.php b/plugins/GNUsocialPhoto/GNUsocialPhotoPlugin.php
index cb6ee97e89..0dd348330e 100644
--- a/plugins/GNUsocialPhoto/GNUsocialPhotoPlugin.php
+++ b/plugins/GNUsocialPhoto/GNUsocialPhotoPlugin.php
@@ -107,7 +107,7 @@ class GNUsocialPhotoPlugin extends MicroAppPlugin
         $object->type = Photo::OBJECT_TYPE;
         $object->title = $photo->title;
         $object->summary = $notice->content;
-        $object->link = $notice->bestUrl();
+        $object->link = $notice->getUrl();
 
         $object->largerImage = $photo->photo_uri;
         $object->thumbnail = $photo->thumb_uri;
diff --git a/plugins/GNUsocialVideo/GNUsocialVideoPlugin.php b/plugins/GNUsocialVideo/GNUsocialVideoPlugin.php
index 7d1b98a63f..df157c4016 100644
--- a/plugins/GNUsocialVideo/GNUsocialVideoPlugin.php
+++ b/plugins/GNUsocialVideo/GNUsocialVideoPlugin.php
@@ -98,7 +98,7 @@ class GNUsocialVideoPlugin extends MicroAppPlugin
         $object->type = Video::OBJECT_TYPE;
         $object->title = $notice->content;
         $object->summary = $notice->content;
-        $object->link = $notice->bestUrl();
+        $object->link = $notice->getUrl();
 
         $vid = Video::getByNotice($notice);
 
diff --git a/plugins/Mapstraction/actions/map.php b/plugins/Mapstraction/actions/map.php
index c03e6119d8..9834e97f9d 100644
--- a/plugins/Mapstraction/actions/map.php
+++ b/plugins/Mapstraction/actions/map.php
@@ -143,14 +143,14 @@ class MapAction extends Action
         $act = new ApiAction('/dev/null');
 
         $arr = $act->twitterStatusArray($notice, true);
-        $arr['url'] = $notice->bestUrl();
+        $arr['url'] = $notice->getUrl();
         $arr['html'] = $notice->rendered;
         $arr['source'] = $arr['source'];
 
         if (!empty($notice->reply_to)) {
             $reply_to = Notice::getKV('id', $notice->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;
         }
diff --git a/plugins/NoticeTitle/NoticeTitlePlugin.php b/plugins/NoticeTitle/NoticeTitlePlugin.php
index c97acfe7b2..f0ea19d39c 100644
--- a/plugins/NoticeTitle/NoticeTitlePlugin.php
+++ b/plugins/NoticeTitle/NoticeTitlePlugin.php
@@ -187,7 +187,7 @@ class NoticeTitlePlugin extends Plugin
 
         if (!empty($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');
         }
 
diff --git a/plugins/Poll/PollPlugin.php b/plugins/Poll/PollPlugin.php
index a6292032c5..c6b4099756 100644
--- a/plugins/Poll/PollPlugin.php
+++ b/plugins/Poll/PollPlugin.php
@@ -242,7 +242,7 @@ class PollPlugin extends MicroAppPlugin
         $object->type    = self::POLL_RESPONSE_OBJECT;
         $object->title   = $notice->content;
         $object->summary = $notice->content;
-        $object->link    = $notice->bestUrl();
+        $object->link    = $notice->getUrl();
 
         $response = Poll_response::getByNotice($notice);
         if ($response) {
@@ -265,7 +265,7 @@ class PollPlugin extends MicroAppPlugin
         $object->type    = self::POLL_OBJECT;
         $object->title   = $notice->content;
         $object->summary = $notice->content;
-        $object->link    = $notice->bestUrl();
+        $object->link    = $notice->getUrl();
 
         $poll = Poll::getByNotice($notice);
         if ($poll) {
diff --git a/plugins/Poll/actions/newpoll.php b/plugins/Poll/actions/newpoll.php
index ed73140e2f..8a1155ba85 100644
--- a/plugins/Poll/actions/newpoll.php
+++ b/plugins/Poll/actions/newpoll.php
@@ -168,7 +168,7 @@ class NewPollAction extends Action
             $this->elementEnd('body');
             $this->endHTML();
         } else {
-            common_redirect($saved->bestUrl(), 303);
+            common_redirect($saved->getUrl(), 303);
         }
     }
 
diff --git a/plugins/Poll/actions/respondpoll.php b/plugins/Poll/actions/respondpoll.php
index 8de9292417..13d3abf683 100644
--- a/plugins/Poll/actions/respondpoll.php
+++ b/plugins/Poll/actions/respondpoll.php
@@ -155,7 +155,7 @@ class RespondPollAction extends Action
             $this->elementEnd('body');
             $this->endHTML();
         } else {
-            common_redirect($this->poll->bestUrl(), 303);
+            common_redirect($this->poll->getUrl(), 303);
         }
     }
 
diff --git a/plugins/Poll/classes/Poll.php b/plugins/Poll/classes/Poll.php
index 213bab4924..fe51c667d5 100644
--- a/plugins/Poll/classes/Poll.php
+++ b/plugins/Poll/classes/Poll.php
@@ -114,9 +114,9 @@ class Poll extends Managed_DataObject
         return Notice::getKV('uri', $this->uri);
     }
 
-    function bestUrl()
+    function getUrl()
     {
-        return $this->getNotice()->bestUrl();
+        return $this->getNotice()->getUrl();
     }
 
     /**
diff --git a/plugins/Poll/classes/Poll_response.php b/plugins/Poll/classes/Poll_response.php
index 21b390db80..20b7700147 100644
--- a/plugins/Poll/classes/Poll_response.php
+++ b/plugins/Poll/classes/Poll_response.php
@@ -100,9 +100,9 @@ class Poll_response extends Managed_DataObject
         return Notice::getKV('uri', $this->uri);
     }
 
-    function bestUrl()
+    function getUrl()
     {
-        return $this->getNotice()->bestUrl();
+        return $this->getNotice()->getUrl();
     }
 
     /**
diff --git a/plugins/QnA/QnAPlugin.php b/plugins/QnA/QnAPlugin.php
index 8712c54903..ee452deab1 100644
--- a/plugins/QnA/QnAPlugin.php
+++ b/plugins/QnA/QnAPlugin.php
@@ -242,7 +242,7 @@ class QnAPlugin extends MicroAppPlugin
         $obj->id      = $question->uri;
         $obj->type    = QnA_Question::OBJECT_TYPE;
         $obj->title   = $question->title;
-        $obj->link    = $notice->bestUrl();
+        $obj->link    = $notice->getUrl();
 
         // XXX: probably need other stuff here
 
diff --git a/plugins/QnA/actions/qnaclosequestion.php b/plugins/QnA/actions/qnaclosequestion.php
index 9a72b21809..b8fed19480 100644
--- a/plugins/QnA/actions/qnaclosequestion.php
+++ b/plugins/QnA/actions/qnaclosequestion.php
@@ -158,7 +158,7 @@ class QnaclosequestionAction extends Action
             $this->elementEnd('body');
             $this->endHTML();
         } else {
-            common_redirect($this->question->bestUrl(), 303);
+            common_redirect($this->question->getUrl(), 303);
         }
     }
 
diff --git a/plugins/QnA/actions/qnanewanswer.php b/plugins/QnA/actions/qnanewanswer.php
index 49ba5baa69..15f32e4bc5 100644
--- a/plugins/QnA/actions/qnanewanswer.php
+++ b/plugins/QnA/actions/qnanewanswer.php
@@ -167,7 +167,7 @@ class QnanewanswerAction extends Action
             $this->endHTML();
         } else {
             common_debug("not ajax");
-            common_redirect($this->question->bestUrl(), 303);
+            common_redirect($this->question->getUrl(), 303);
         }
     }
 
diff --git a/plugins/QnA/actions/qnanewquestion.php b/plugins/QnA/actions/qnanewquestion.php
index 9fc05e7818..ab3c9db136 100644
--- a/plugins/QnA/actions/qnanewquestion.php
+++ b/plugins/QnA/actions/qnanewquestion.php
@@ -158,7 +158,7 @@ class QnanewquestionAction extends Action
             $this->elementEnd('body');
             $this->endHTML();
         } else {
-            common_redirect($saved->bestUrl(), 303);
+            common_redirect($saved->getUrl(), 303);
         }
     }
 
diff --git a/plugins/QnA/actions/qnareviseanswer.php b/plugins/QnA/actions/qnareviseanswer.php
index c08edb2cc3..e2e76a7873 100644
--- a/plugins/QnA/actions/qnareviseanswer.php
+++ b/plugins/QnA/actions/qnareviseanswer.php
@@ -166,7 +166,7 @@ class QnareviseanswerAction extends Action
             $this->elementEnd('body');
             $this->endHTML();
         } 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->endHTML();
         } else {
-            common_redirect($this->answer->bestUrl(), 303);
+            common_redirect($this->answer->getUrl(), 303);
         }
     }
 
diff --git a/plugins/QnA/actions/qnavote.php b/plugins/QnA/actions/qnavote.php
index 5e227a69ce..6cda1ff827 100644
--- a/plugins/QnA/actions/qnavote.php
+++ b/plugins/QnA/actions/qnavote.php
@@ -153,7 +153,7 @@ class Qnavote extends Action
             $this->elementEnd('body');
             $this->endHTML();
         } else {
-            common_redirect($this->question->bestUrl(), 303);
+            common_redirect($this->question->getUrl(), 303);
         }
     }
 
diff --git a/plugins/QnA/classes/QnA_Answer.php b/plugins/QnA/classes/QnA_Answer.php
index 7f0ba82ac3..9db52985ad 100644
--- a/plugins/QnA/classes/QnA_Answer.php
+++ b/plugins/QnA/classes/QnA_Answer.php
@@ -127,9 +127,9 @@ class QnA_Answer extends Managed_DataObject
         return QnA_Answer::getKV('uri', $notice->uri);
     }
 
-    function bestUrl()
+    function getUrl()
     {
-        return $this->getNotice()->bestUrl();
+        return $this->getNotice()->getUrl();
     }
 
     /**
diff --git a/plugins/QnA/classes/QnA_Question.php b/plugins/QnA/classes/QnA_Question.php
index 481f27cce4..b421b0aed1 100644
--- a/plugins/QnA/classes/QnA_Question.php
+++ b/plugins/QnA/classes/QnA_Question.php
@@ -107,9 +107,9 @@ class QnA_Question extends Managed_DataObject
         return Notice::getKV('uri', $this->uri);
     }
 
-    function bestUrl()
+    function getUrl()
     {
-        return $this->getNotice()->bestUrl();
+        return $this->getNotice()->getUrl();
     }
 
     function getProfile()
diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php
index 32dfbcf7d4..8087edd9df 100644
--- a/plugins/Realtime/RealtimePlugin.php
+++ b/plugins/Realtime/RealtimePlugin.php
@@ -318,7 +318,7 @@ class RealtimePlugin extends Plugin
         $act = new ApiAction('/dev/null');
 
         $arr = $act->twitterStatusArray($notice, true);
-        $arr['url'] = $notice->bestUrl();
+        $arr['url'] = $notice->getUrl();
         $arr['html'] = htmlspecialchars($notice->rendered);
         $arr['source'] = htmlspecialchars($arr['source']);
         $arr['conversation_url'] = $this->getConversationUrl($notice);
@@ -330,15 +330,15 @@ class RealtimePlugin extends Plugin
 
         if (!empty($notice->repeat_of)) {
             $original = Notice::getKV('id', $notice->repeat_of);
-            if (!empty($original)) {
-                $arr['retweeted_status']['url'] = $original->bestUrl();
+            if ($original instanceof Notice) {
+                $arr['retweeted_status']['url'] = $original->getUrl();
                 $arr['retweeted_status']['html'] = htmlspecialchars($original->rendered);
                 $arr['retweeted_status']['source'] = htmlspecialchars($original->source);
                 $originalProfile = $original->getProfile();
                 $arr['retweeted_status']['user']['profile_url'] = $originalProfile->profileurl;
                 $arr['retweeted_status']['conversation_url'] = $this->getConversationUrl($original);
             }
-            $original = null;
+            unset($original);
         }
 
         return $arr;
diff --git a/plugins/ShareNotice/ShareNoticePlugin.php b/plugins/ShareNotice/ShareNoticePlugin.php
index fa1323d6f1..bb09b94605 100644
--- a/plugins/ShareNotice/ShareNoticePlugin.php
+++ b/plugins/ShareNotice/ShareNoticePlugin.php
@@ -104,7 +104,7 @@ abstract class GenericNoticeShareTarget extends NoticeShareTarget
     {
         // TRANS: %s is notice content that is shared on Twitter, Facebook or another platform.
         $pattern = _m('"%s"');
-        $url = $this->notice->bestUrl();
+        $url = $this->notice->getUrl();
         $suffix = ' ' . $url;
         $room = $this->maxLength() - mb_strlen($suffix) - (mb_strlen($pattern) - mb_strlen('%s'));
 
@@ -192,7 +192,7 @@ class FacebookShareTarget extends NoticeShareTarget
     public function targetUrl()
     {
         $args = array(
-            'u' => $this->notice->bestUrl(),
+            'u' => $this->notice->getUrl(),
             // TRANS: %s is notice content that is shared on Twitter, Facebook or another platform.
             't' => sprintf(_m('"%s"'), $this->notice->content),
         );
diff --git a/plugins/SubMirror/classes/SubMirror.php b/plugins/SubMirror/classes/SubMirror.php
index 0920856192..7c3e6af3ec 100644
--- a/plugins/SubMirror/classes/SubMirror.php
+++ b/plugins/SubMirror/classes/SubMirror.php
@@ -194,7 +194,7 @@ class SubMirror extends Managed_DataObject
     protected function copyNotice($profile, $notice)
     {
         $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);
 
         $saved = Notice::saveNew($profile->id,
diff --git a/tests/ActivityGenerationTests.php b/tests/ActivityGenerationTests.php
index c9f27cbde0..8e89024ac0 100644
--- a/tests/ActivityGenerationTests.php
+++ b/tests/ActivityGenerationTests.php
@@ -372,7 +372,7 @@ class ActivityGenerationTests extends PHPUnit_Framework_TestCase
 
         $this->assertNotNull($forward);
         $this->assertEquals($notice->getUri(), $forward->getAttribute('ref'));
-        $this->assertEquals($notice->bestUrl(), $forward->getAttribute('href'));
+        $this->assertEquals($notice->getUrl(), $forward->getAttribute('href'));
     }
 
     public function testTag()