X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FMap.php;h=fdc480b5e39e33afeff148aefda73e2950c411cd;hb=d4a5a8051ad34a7be72238967afb3e6b140afdc8;hp=e736ca719b4d442a4b82a0f62cd73ea47fdd4143;hpb=745bc7cf3f3990a8887fcc806a16d218f82e35db;p=friendica.git diff --git a/src/Util/Map.php b/src/Util/Map.php index e736ca719b..fdc480b5e3 100644 --- a/src/Util/Map.php +++ b/src/Util/Map.php @@ -1,26 +1,49 @@ . + * */ + namespace Friendica\Util; -use Friendica\Core\Addon; +use Friendica\Core\Hook; /** * 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' => '']; - Addon::callHooks('generate_map',$arr); + $arr = ['lat' => trim(substr($coord,0,strpos($coord,' '))), 'lon' => trim(substr($coord,strpos($coord,' ')+1)), 'mode' => $html_mode, 'html' => '']; + Hook::callAll('generate_map',$arr); return ($arr['html']) ? $arr['html'] : $coord; } - public static function byLocation($location) { - $arr = ['location' => $location, 'html' => '']; - Addon::callHooks('generate_named_map',$arr); + public static function byLocation($location, $html_mode = 0) { + $arr = ['location' => $location, 'mode' => $html_mode, 'html' => '']; + Hook::callAll('generate_named_map',$arr); return ($arr['html']) ? $arr['html'] : $location; } + + public static function getCoordinates($location) { + $arr = ['location' => $location, 'lat' => false, 'lon' => false]; + Hook::callAll('Map::getCoordinates', $arr); + return $arr; + } }