]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/GeoURL/GeoURLPlugin.php
Merge branch 'beautify_profile_list' into 'nightly'
[quix0rs-gnu-social.git] / plugins / GeoURL / GeoURLPlugin.php
index 9f2670eb822f40ce438ae11cf842aa6f3c565f95..0e779a4fe8b33ade89ab1619013cba7e837ed7c6 100644 (file)
@@ -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',
@@ -94,7 +96,7 @@ class GeoURLPlugin extends Plugin
      */
     function onHandleQueuedNotice(&$notice)
     {
-        if ($notice->is_local == 1) {
+        if (intval($notice->is_local) === Notice::LOCAL_PUBLIC) {
 
             $request = HTTPClient::start();
 
@@ -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' =>