X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FGeoURL%2FGeoURLPlugin.php;h=a8e2546c4f846b05b1eb22b97f98c1a0fab7cee9;hb=c10a4cf6d2ea3f45622674a555898229ea99962c;hp=9f2670eb822f40ce438ae11cf842aa6f3c565f95;hpb=59043dca7fb6f974b11797c4d0f20e5b78b0611d;p=quix0rs-gnu-social.git diff --git a/plugins/GeoURL/GeoURLPlugin.php b/plugins/GeoURL/GeoURLPlugin.php index 9f2670eb82..a8e2546c4f 100644 --- a/plugins/GeoURL/GeoURLPlugin.php +++ b/plugins/GeoURL/GeoURLPlugin.php @@ -57,25 +57,27 @@ class GeoURLPlugin extends Plugin * * @return boolean event handler flag */ - function onEndShowHeadElements($action) + function onEndShowHeadElements(Action $action) { $name = $action->trimmed('action'); $location = null; - if ($name == 'showstream') { - $profile = $action->profile; - if (!empty($profile) && !empty($profile->lat) && !empty($profile->lon)) { + if ($action instanceof ShowstreamAction) { + $profile = $action->getTarget(); + if (!empty($profile->lat) && !empty($profile->lon)) { $location = $profile->lat . ', ' . $profile->lon; } - } else if ($name == 'shownotice') { - $notice = $action->profile; - if (!empty($notice) && !empty($notice->lat) && !empty($notice->lon)) { + } elseif ($action instanceof ShownoticeAction) { + // FIXME: getNotice in ShownoticeAction will do a new lookup, we should fix those classes + // so they can reliably just get a pre-stored notice object which was fetched in Shownotice prepare()... + $notice = $action->notice; + if ($notice instanceof Notice && !empty($notice->lat) && !empty($notice->lon)) { $location = $notice->lat . ', ' . $notice->lon; } } - if (!empty($location)) { + if (!is_null($location)) { $action->element('meta', array('name' => 'ICBM', 'content' => $location)); $action->element('meta', array('name' => 'DC.title', @@ -114,10 +116,10 @@ class GeoURLPlugin extends Plugin return true; } - function onPluginVersion(&$versions) + function onPluginVersion(array &$versions) { $versions[] = array('name' => 'GeoURL', - 'version' => STATUSNET_VERSION, + 'version' => GNUSOCIAL_VERSION, 'author' => 'Evan Prodromou', 'homepage' => 'http://status.net/wiki/Plugin:GeoURL', 'rawdescription' =>