From 789e025eab00a8feeba9644b7541119daea6b078 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 16 Dec 2014 15:50:20 -0800 Subject: Add [ map ] element to bbcode, no closing tag. Requires a map generator plugin (like openstreetmap which was just updated) and also requires that the author has browser location enabled. --- include/text.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 3a7c02362..404d34dcb 100644 --- a/include/text.php +++ b/include/text.php @@ -1306,6 +1306,13 @@ function format_filer(&$item) { } +function generate_map($coord) { + $arr = array('lat' => substr($coord,0,strpos($coord,' ')), 'lon' => substr($coord,strpos($coord,' ')+1), 'html' => ''); + call_hooks('generate_map',$arr); + return $arr['html']; +} + + function prepare_body(&$item,$attach = false) { @@ -1323,6 +1330,13 @@ function prepare_body(&$item,$attach = false) { return $s; } + if(strpos($s,'
') !== false && $item['coord']) { + $x = generate_map(trim($item['coord'])); + if($x) { + $s = preg_replace('/\
/','$0' . $x,$s); + } + } + $s .= theme_attachments($item); $writeable = ((get_observer_hash() == $item['owner_xchan']) ? true : false); -- cgit v1.2.3