3 * @file src/Util/Map.php
5 namespace Friendica\Util;
7 use Friendica\Core\Addon;
10 * Leaflet Map related functions
13 public static function byCoordinates($coord, $html_mode = 0) {
14 $coord = trim($coord);
15 $coord = str_replace([',','/',' '],[' ',' ',' '],$coord);
16 $arr = ['lat' => trim(substr($coord,0,strpos($coord,' '))), 'lon' => trim(substr($coord,strpos($coord,' ')+1)), 'mode' => $html_mode, 'html' => ''];
17 Addon::callHooks('generate_map',$arr);
18 return ($arr['html']) ? $arr['html'] : $coord;
21 public static function byLocation($location, $html_mode = 0) {
22 $arr = ['location' => $location, 'mode' => $html_mode, 'html' => ''];
23 Addon::callHooks('generate_named_map',$arr);
24 return ($arr['html']) ? $arr['html'] : $location;
27 public static function getCoordinates($location) {
28 $arr = ['location' => $location, 'lat' => false, 'lon' => false];
29 Addon::callHooks('Map::getCoordinates', $arr);