]> git.mxchange.org Git - friendica-addons.git/blobdiff - googlemaps/googlemaps.php
audon/C/messages.po gelöscht
[friendica-addons.git] / googlemaps / googlemaps.php
index 0b031f4da215b6ce10a1a07f43d4d4be94d34970..356ce68ca5f8b24b009ff98e5495ae68cb60eadc 100644 (file)
@@ -7,35 +7,34 @@
  *
  */
 
-require_once('include/cache.php');
+use Friendica\App;
+use Friendica\Core\Hook;
+use Friendica\Core\Logger;
 
+function googlemaps_install()
+{
+       Hook::register('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
 
-function googlemaps_install() {
-       register_hook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
-
-       logger("installed googlemaps");
+       Logger::notice('installed googlemaps');
 }
 
-function googlemaps_uninstall() {
-       unregister_hook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
-
-       logger("removed googlemaps");
-}
-
-function googlemaps_location($a, &$item) {
-
-       if(! (strlen($item['location']) || strlen($item['coord'])))
+function googlemaps_location(&$item)
+{
+       if (!(strlen($item['location']) || strlen($item['coord']))) {
                return;
+       }
 
-       if ($item['coord'] != "")
-               $target = "http://maps.google.com/?q=".urlencode($item['coord']);
-       else
-               $target = "http://maps.google.com/?q=".urlencode($item['location']);
+       if ($item['coord'] != '') {
+               $target = 'http://maps.google.com/?q=' . urlencode($item['coord']);
+       } else {
+               $target = 'http://maps.google.com/?q=' . urlencode($item['location']);
+       }
 
-       if ($item['location'] != "")
+       if ($item['location'] != '') {
                $title = $item['location'];
-       else
+       } 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>';
 }