X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FGeoURL%2FGeoURLPlugin.php;h=a8e2546c4f846b05b1eb22b97f98c1a0fab7cee9;hb=c10a4cf6d2ea3f45622674a555898229ea99962c;hp=d548de925adec7d2674f07ea94460d9cdbcbb838;hpb=f110fc5c9a61ac666d88714b170b12f99d911b11;p=quix0rs-gnu-social.git diff --git a/plugins/GeoURL/GeoURLPlugin.php b/plugins/GeoURL/GeoURLPlugin.php index d548de925a..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,7 +116,7 @@ class GeoURLPlugin extends Plugin return true; } - function onPluginVersion(&$versions) + function onPluginVersion(array &$versions) { $versions[] = array('name' => 'GeoURL', 'version' => GNUSOCIAL_VERSION,