From: Mikael Nordfeldth Date: Sat, 19 Apr 2014 20:24:40 +0000 (+0200) Subject: deprecate Notice::bestUrl() in favor of getUrl() X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=72707ddc26868597cadf8889da3d4ee556c9753e;p=quix0rs-gnu-social.git deprecate Notice::bestUrl() in favor of getUrl() --- diff --git a/classes/Notice.php b/classes/Notice.php index e46ed227a1..0264c62275 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -1697,15 +1697,13 @@ class Notice extends Managed_DataObject return $noun->asString('activity:' . $element); } + // FIXME: Replace all bestUrl with getUrl and do exception handling function bestUrl() { - if (!empty($this->url)) { - return $this->url; - } else if (!empty($this->uri) && preg_match('/^https?:/', $this->uri)) { - return $this->uri; - } else { - return common_local_url('shownotice', - array('notice' => $this->id)); + try { + return $this->getUrl(); + } catch (InvalidUrlException $e) { + return common_local_url('shownotice', array('notice' => $this->id)); } }