X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FMap.php;h=d3ac0216656d608babe25a288c73e772d29477c8;hb=4894e89f036be1f8a82523ac69d56ae36e7685df;hp=6ca0b1b4c0db234283b68b166e2ed13c0b3c7516;hpb=5a0260a10fa375d34ceabd32363003f91aca18a4;p=friendica.git diff --git a/src/Util/Map.php b/src/Util/Map.php index 6ca0b1b4c0..d3ac021665 100644 --- a/src/Util/Map.php +++ b/src/Util/Map.php @@ -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(array(',','/',' '),array(' ',' ',' '),$coord); - $arr = array('lat' => trim(substr($coord,0,strpos($coord,' '))), 'lon' => trim(substr($coord,strpos($coord,' ')+1)), 'html' => ''); - call_hooks('generate_map',$arr); + $coord = str_replace([',','/',' '],[' ',' ',' '],$coord); + $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 = array('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; + } }