]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Map.php
Merge pull request #6098 from annando/worker-speed
[friendica.git] / src / Util / Map.php
index 9aabb9db9847bb16406adb1fd72cdf72c3c3e378..d3ac0216656d608babe25a288c73e772d29477c8 100644 (file)
@@ -4,21 +4,29 @@
  */
 namespace Friendica\Util;
 
+use Friendica\Core\Addon;
+
 /**
  * Leaflet Map related functions
  */
 class Map {
-       public static function byCoordinates($coord) {
+       public static function byCoordinates($coord, $html_mode = 0) {
                $coord = trim($coord);
                $coord = str_replace([',','/','  '],[' ',' ',' '],$coord);
-               $arr = ['lat' => trim(substr($coord,0,strpos($coord,' '))), 'lon' => trim(substr($coord,strpos($coord,' ')+1)), 'html' => ''];
-               call_hooks('generate_map',$arr);
+               $arr = ['lat' => trim(substr($coord,0,strpos($coord,' '))), 'lon' => trim(substr($coord,strpos($coord,' ')+1)), 'mode' => $html_mode, 'html' => ''];
+               Addon::callHooks('generate_map',$arr);
                return ($arr['html']) ? $arr['html'] : $coord;
        }
 
-       public static function byLocation($location) {
-               $arr = ['location' => $location, 'html' => ''];
-               call_hooks('generate_named_map',$arr);
+       public static function byLocation($location, $html_mode = 0) {
+               $arr = ['location' => $location, 'mode' => $html_mode, 'html' => ''];
+               Addon::callHooks('generate_named_map',$arr);
                return ($arr['html']) ? $arr['html'] : $location;
        }
+
+       public static function getCoordinates($location) {
+               $arr = ['location' => $location, 'lat' => false, 'lon' => false];
+               Addon::callHooks('Map::getCoordinates', $arr);
+               return $arr;
+       }
 }