]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
s/bestUrl/getUrl/ for notices and microapp objects
authorMikael Nordfeldth <mmn@hethane.se>
Tue, 29 Apr 2014 17:46:58 +0000 (19:46 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Tue, 29 Apr 2014 17:46:58 +0000 (19:46 +0200)
35 files changed:
classes/Notice.php
lib/activityobject.php
lib/noticelistitem.php
plugins/Activity/ActivityPlugin.php
plugins/Blog/actions/newblogentry.php
plugins/Blog/lib/blogentrylistitem.php
plugins/Bookmark/BookmarkPlugin.php
plugins/Bookmark/actions/newbookmark.php
plugins/Disqus/DisqusPlugin.php
plugins/EmailSummary/lib/useremailsummaryhandler.php
plugins/Event/EventPlugin.php
plugins/Event/actions/newevent.php
plugins/Event/actions/newrsvp.php
plugins/Event/classes/RSVP.php
plugins/GNUsocialPhoto/GNUsocialPhotoPlugin.php
plugins/GNUsocialVideo/GNUsocialVideoPlugin.php
plugins/Mapstraction/actions/map.php
plugins/NoticeTitle/NoticeTitlePlugin.php
plugins/Poll/PollPlugin.php
plugins/Poll/actions/newpoll.php
plugins/Poll/actions/respondpoll.php
plugins/Poll/classes/Poll.php
plugins/Poll/classes/Poll_response.php
plugins/QnA/QnAPlugin.php
plugins/QnA/actions/qnaclosequestion.php
plugins/QnA/actions/qnanewanswer.php
plugins/QnA/actions/qnanewquestion.php
plugins/QnA/actions/qnareviseanswer.php
plugins/QnA/actions/qnavote.php
plugins/QnA/classes/QnA_Answer.php
plugins/QnA/classes/QnA_Question.php
plugins/Realtime/RealtimePlugin.php
plugins/ShareNotice/ShareNoticePlugin.php
plugins/SubMirror/classes/SubMirror.php
tests/ActivityGenerationTests.php

index a72e04746c5bdc1ab77c9e9d1fcc780f58b1c79a..78d8b9035046c526581e463b572671f3e75bdca0 100644 (file)
@@ -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.
      *
index d43680323245877455c6f28fcc42d7a5356574d7..c506b17e857a64596bfc1300a35df40c1e886cf6 100644 (file)
@@ -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));
 
index e82331afede239e22d3b686aa8c99265a55700a3..ad6f02ef115221eb026ef55f5cea407d1ee5fe2d 100644 (file)
@@ -361,7 +361,7 @@ class NoticeListItem extends Widget
      */
     function showNoticeLink()
     {
-        $noticeurl = $this->notice->bestUrl();
+        $noticeurl = $this->notice->getUrl();
 
         // above should always return an URL
 
index ec8d6d69119c0ea8034ed3eb929996668b7f4140..1b36e11fd4c8419f1ccc12738846a4c3da0c2e42 100644 (file)
@@ -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());
 
index 99fc89f2fb136fe71319f6e2e01d395857d15a53..52f95ebd8b835e9e65017ee33b0aa3a0a8de0bc2 100644 (file)
@@ -131,7 +131,7 @@ class NewblogentryAction extends Action
             $this->elementEnd('body');
             $this->endHTML();
         } else {
-            common_redirect($saved->bestUrl(), 303);
+            common_redirect($saved->getUrl(), 303);
         }
     }
 }
index a89a562b77d003d9d3feaec831c2371ff08bd7c3..9bf3d6d5df70eabd27658da40e887c9959ce7e26 100644 (file)
@@ -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'),
index befc4f22910990f5d5583c14470f5111ecf3df21..fc2aeb6a43f0483123e980af74b8e75255753223 100644 (file)
@@ -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
 
index 1c7dd5bc62f6d6444f102bff1368e5d30ab6aeb3..168a6e07b69d1383cf23301097f6d806f362cb16 100644 (file)
@@ -178,7 +178,7 @@ class NewbookmarkAction extends Action
             $this->elementEnd('body');
             $this->endHTML();
         } else {
-            common_redirect($saved->bestUrl(), 303);
+            common_redirect($saved->getUrl(), 303);
         }
     }
 
index 28e0d80e9b952442785e8353e0b5220790d9f5f3..42bb1dafbabd07508363576f40656ead39c74685 100644 (file)
@@ -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(
index e35fdf796804a2a0bf2684fd7d3e299d5d23342e..15c1c85e80070cfb2470ced6037426984bb4e269 100644 (file)
@@ -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',
index 07394d30c35099c3d989fb615f0dc7762899fffa..965eef7744f006df74fe6e75411523496ebdc4e6 100644 (file)
@@ -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?!
 
index cd2649060251825152a2e18b721cd2ad210c1e44..d05b5af8d3a5bd0ad4690267d266a925b1eac62e 100644 (file)
@@ -254,7 +254,7 @@ class NeweventAction extends Action
             $this->elementEnd('body');
             $this->endHTML();
         } else {
-            common_redirect($saved->bestUrl(), 303);
+            common_redirect($saved->getUrl(), 303);
         }
     }
 
index cbe67ae1733cac3456e21e6db6f6896b7e03df4f..7a87d359e07c77a9b81a094ec30fd7d9b80b2973 100644 (file)
@@ -166,7 +166,7 @@ class NewrsvpAction extends Action
             $this->elementEnd('body');
             $this->endHTML();
         } else {
-            common_redirect($saved->bestUrl(), 303);
+            common_redirect($saved->getUrl(), 303);
         }
     }
 
index 521e8110366735886fa678644510dbb55deb535e..926f6b7d0843e828c1d06e3d78c4f1e57ea70306 100644 (file)
@@ -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;
         }
 
index cb6ee97e8970a6bbfb78f5e8c6b463ea9e2f7666..0dd348330eed71c05fa8327abadf66250806280d 100644 (file)
@@ -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;
index 7d1b98a63f33fb84543ff58724774891298fe133..df157c40161e316e7403dafc0a779f2751866a7e 100644 (file)
@@ -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);
 
index c03e6119d88993465f60ec2b72960afca97fb64c..9834e97f9d1c53d09bc064087f382c7e426ae141 100644 (file)
@@ -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;
         }
index c97acfe7b28c54c548452367838e3463ef518d91..f0ea19d39ccabf5bd3c84d03e691ba3792ee01ba 100644 (file)
@@ -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');
         }
 
index a6292032c51b7cdc41205ff31bec7cd7c10d1bae..c6b4099756c16b55556ac57ceb7c6f2831c656de 100644 (file)
@@ -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) {
index ed73140e2f680767955fff2e0c0a242ee66b3f3f..8a1155ba857646cb9e9f51fc931380ddd57a71e1 100644 (file)
@@ -168,7 +168,7 @@ class NewPollAction extends Action
             $this->elementEnd('body');
             $this->endHTML();
         } else {
-            common_redirect($saved->bestUrl(), 303);
+            common_redirect($saved->getUrl(), 303);
         }
     }
 
index 8de929241741f342226570d5d3c0cedabc1cfc1e..13d3abf683702a8742d24ead105ef3553b4552ad 100644 (file)
@@ -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);
         }
     }
 
index 213bab492479f85bfae2dea18e733ab2371ebc3b..fe51c667d510f8415af47b0f31cd7877a96b2125 100644 (file)
@@ -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();
     }
 
     /**
index 21b390db803febdfc8ebef6e506a7ba2ad71322c..20b7700147bc1006c2a89200b0c2488ed71f5e40 100644 (file)
@@ -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();
     }
 
     /**
index 8712c549037ebd0e225cb733d77fbb2e7065ea1b..ee452deab194e6def64ffd6ea82acdc1dcb34369 100644 (file)
@@ -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
 
index 9a72b218093d6894139d92aebffb0ba355130b65..b8fed19480263d6e5da5dad09cc4ef3d16b22372 100644 (file)
@@ -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);
         }
     }
 
index 49ba5baa697e8036fc4e270b5ed274f3dd4b4912..15f32e4bc5844ebed382d72c0ea09f637c2b85c1 100644 (file)
@@ -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);
         }
     }
 
index 9fc05e7818836ae643f6d6a3bce4fd94aeb056a1..ab3c9db136d76ec22ad89de334be5af620de1c69 100644 (file)
@@ -158,7 +158,7 @@ class QnanewquestionAction extends Action
             $this->elementEnd('body');
             $this->endHTML();
         } else {
-            common_redirect($saved->bestUrl(), 303);
+            common_redirect($saved->getUrl(), 303);
         }
     }
 
index c08edb2cc3a7429a9e02ab4404fb9e780a90cfce..e2e76a787356b768bceea32094c81f507c1cfc21 100644 (file)
@@ -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);
         }
     }
 
index 5e227a69ceada7edf48c6efec8576336bd0b4e59..6cda1ff827fef15e8d008a04411f793424a029e9 100644 (file)
@@ -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);
         }
     }
 
index 7f0ba82ac323acceae32667bf531b42e7afc1a34..9db52985adfa604f8741b225cff0c7050f47b0a8 100644 (file)
@@ -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();
     }
 
     /**
index 481f27cce4b8340cb88c06130b7f7f87225ac37a..b421b0aed19a952c98ea5a69ff2762e84afe944d 100644 (file)
@@ -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()
index 32dfbcf7d4fe4417216b6916307f91d976ddd67b..8087edd9df1e0f0748166f35d22d0959f9edda54 100644 (file)
@@ -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;
index fa1323d6f1b9f7c0caa8684e4dc7606a3112fa57..bb09b94605dd853f28eeea8e18f2c2c7b8bea33a 100644 (file)
@@ -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),
         );
index 0920856192f1487f1516b94d700b19c1e0f2793d..7c3e6af3ec1e8db3992db17d79d011e180cfa1a3 100644 (file)
@@ -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,
index c9f27cbde0ebe88f18032393a5ef28451cf90836..8e89024ac01447fb4f14302a27d83f7f019b6821 100644 (file)
@@ -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()