deprecate Notice::bestUrl() in favor of getUrl()

This commit is contained in:
Mikael Nordfeldth 2014-04-19 22:24:40 +02:00
parent 7ca6597c7f
commit 72707ddc26

View File

@ -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));
}
}