]> git.mxchange.org Git - friendica.git/blob - src/Util/Map.php
Merge pull request #4243 from MrPetovan/task/switch-to-array-new-style
[friendica.git] / src / Util / Map.php
1 <?php
2 /**
3  * @file src/Util/Map.php
4  */
5 namespace Friendica\Util;
6
7 /**
8  * Leaflet Map related functions
9  */
10 class Map {
11         public static function byCoordinates($coord) {
12                 $coord = trim($coord);
13                 $coord = str_replace([',','/','  '],[' ',' ',' '],$coord);
14                 $arr = ['lat' => trim(substr($coord,0,strpos($coord,' '))), 'lon' => trim(substr($coord,strpos($coord,' ')+1)), 'html' => ''];
15                 call_hooks('generate_map',$arr);
16                 return ($arr['html']) ? $arr['html'] : $coord;
17         }
18
19         public static function byLocation($location) {
20                 $arr = ['location' => $location, 'html' => ''];
21                 call_hooks('generate_named_map',$arr);
22                 return ($arr['html']) ? $arr['html'] : $location;
23         }
24 }