From: Michael Date: Wed, 13 Dec 2017 21:38:14 +0000 (+0000) Subject: The Map class is now done X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5a0260a10fa375d34ceabd32363003f91aca18a4;p=friendica.git The Map class is now done --- diff --git a/src/Util/Map.php b/src/Util/Map.php index e2398b2fd1..6ca0b1b4c0 100644 --- a/src/Util/Map.php +++ b/src/Util/Map.php @@ -1,18 +1,24 @@ trim(substr($coord,0,strpos($coord,' '))), 'lon' => trim(substr($coord,strpos($coord,' ')+1)), 'html' => ''); - call_hooks('generate_map',$arr); - return (($arr['html']) ? $arr['html'] : $coord); -} -function generate_named_map($location) { - $arr = array('location' => $location, 'html' => ''); - call_hooks('generate_named_map',$arr); - return (($arr['html']) ? $arr['html'] : $location); +class Map { + public static function byCoordinates($coord) { + $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); + return ($arr['html']) ? $arr['html'] : $coord; + } + + public static function byLocation($location) { + $arr = array('location' => $location, 'html' => ''); + call_hooks('generate_named_map',$arr); + return ($arr['html']) ? $arr['html'] : $location; + } }