]> git.mxchange.org Git - friendica-addons.git/blobdiff - googlemaps/googlemaps.php
Merge pull request 'Bluesky/Tumblr: Set "received" to "created" if fetched after...
[friendica-addons.git] / googlemaps / googlemaps.php
index 09a566e8b46b2071027cc85fe0cd678ac783b459..356ce68ca5f8b24b009ff98e5495ae68cb60eadc 100644 (file)
@@ -6,6 +6,8 @@
  * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
  *
  */
+
+use Friendica\App;
 use Friendica\Core\Hook;
 use Friendica\Core\Logger;
 
@@ -13,34 +15,26 @@ function googlemaps_install()
 {
        Hook::register('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
 
-       Logger::log("installed googlemaps");
-}
-
-function googlemaps_uninstall()
-{
-       Hook::unregister('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
-
-       Logger::log("removed googlemaps");
+       Logger::notice('installed googlemaps');
 }
 
-function googlemaps_location($a, &$item)
+function googlemaps_location(&$item)
 {
-
-       if(! (strlen($item['location']) || strlen($item['coord']))) {
+       if (!(strlen($item['location']) || strlen($item['coord']))) {
                return;
        }
 
-       if ($item['coord'] != ""){ 
-               $target = "http://maps.google.com/?q=".urlencode($item['coord']);
+       if ($item['coord'] != '') {
+               $target = 'http://maps.google.com/?q=' . urlencode($item['coord']);
        } else {
-               $target = "http://maps.google.com/?q=".urlencode($item['location']);
+               $target = 'http://maps.google.com/?q=' . urlencode($item['location']);
        }
 
-       if ($item['location'] != "") {
+       if ($item['location'] != '') {
                $title = $item['location'];
        } else {
                $title = $item['coord'];
        }
 
-       $item['html'] = '<a target="map" title="'.$title.'" href= "'.$target.'">'.$title.'</a>';
+       $item['html'] = '<a target="map" title="' . $title . '" href= "' . $target . '">' . $title . '</a>';
 }