aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-12-16 15:50:20 -0800
committerfriendica <info@friendica.com>2014-12-16 15:50:20 -0800
commit789e025eab00a8feeba9644b7541119daea6b078 (patch)
tree5cb0e788cffd2bd01b514940e8bf4d49677381ac /include/text.php
parent4d5f28f07a4405e468851413e56057dc2acfb585 (diff)
downloadvolse-hubzilla-789e025eab00a8feeba9644b7541119daea6b078.tar.gz
volse-hubzilla-789e025eab00a8feeba9644b7541119daea6b078.tar.bz2
volse-hubzilla-789e025eab00a8feeba9644b7541119daea6b078.zip
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.
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php14
1 files changed, 14 insertions, 0 deletions
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,'<div class="map">') !== false && $item['coord']) {
+ $x = generate_map(trim($item['coord']));
+ if($x) {
+ $s = preg_replace('/\<div class\=\"map\"\>/','$0' . $x,$s);
+ }
+ }
+
$s .= theme_attachments($item);
$writeable = ((get_observer_hash() == $item['owner_xchan']) ? true : false);