2015-05-15 14:41:10 -04:00
|
|
|
<?php
|
2017-12-13 16:38:14 -05:00
|
|
|
/**
|
|
|
|
* @file src/Util/Map.php
|
|
|
|
*/
|
|
|
|
namespace Friendica\Util;
|
2015-05-15 14:41:10 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Leaflet Map related functions
|
|
|
|
*/
|
2017-12-13 16:38:14 -05:00
|
|
|
class Map {
|
|
|
|
public static function byCoordinates($coord) {
|
|
|
|
$coord = trim($coord);
|
2018-01-15 08:05:12 -05:00
|
|
|
$coord = str_replace([',','/',' '],[' ',' ',' '],$coord);
|
|
|
|
$arr = ['lat' => trim(substr($coord,0,strpos($coord,' '))), 'lon' => trim(substr($coord,strpos($coord,' ')+1)), 'html' => ''];
|
2017-12-13 16:38:14 -05:00
|
|
|
call_hooks('generate_map',$arr);
|
|
|
|
return ($arr['html']) ? $arr['html'] : $coord;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function byLocation($location) {
|
2018-01-15 08:05:12 -05:00
|
|
|
$arr = ['location' => $location, 'html' => ''];
|
2017-12-13 16:38:14 -05:00
|
|
|
call_hooks('generate_named_map',$arr);
|
|
|
|
return ($arr['html']) ? $arr['html'] : $location;
|
|
|
|
}
|
2015-05-15 14:41:10 -04:00
|
|
|
}
|