diff options
author | friendica <info@friendica.com> | 2014-12-17 14:12:19 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-12-17 14:12:19 -0800 |
commit | cc0df5bc241aa552f0fa42a7b809edad48a48e84 (patch) | |
tree | acaff8563a9e6d4aff52d85b039279df2502280f /include/bbcode.php | |
parent | c293b64d608467ba7bcf34e3d3bd05fe3e6b84c6 (diff) | |
download | volse-hubzilla-cc0df5bc241aa552f0fa42a7b809edad48a48e84.tar.gz volse-hubzilla-cc0df5bc241aa552f0fa42a7b809edad48a48e84.tar.bz2 volse-hubzilla-cc0df5bc241aa552f0fa42a7b809edad48a48e84.zip |
ability to generate arbitrary map with [ map=lat/lon] and also free form location using [ map]somewhere[/map] but the second one currently has no plugins available to generate it.
Diffstat (limited to 'include/bbcode.php')
-rw-r--r-- | include/bbcode.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index 254674172..1037db045 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -278,6 +278,17 @@ function rpost_callback($match) { } } +function bb_map_coords($match) { + // the extra space in the following line is intentional + return str_replace($match[0],'<div class="map" >' . generate_map(str_replace('/',' ',$match[1])) . '</div>', $match[0]); +} + +function bb_map_location($match) { + // the extra space in the following line is intentional + return str_replace($match[0],'<div class="map" >' . generate_named_map($match[1]) . '</div>', $match[0]); +} + + function bb_sanitize_style($input) { //whitelist property limits (0 = no limitation) $w = array( // color properties @@ -496,6 +507,14 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { // leave open the posibility of [map=something] // this is replaced in prepare_body() which has knowledge of the item location + if (strpos($Text,'[/map]') !== false) { + $Text = preg_replace_callback("/\[map\](.*?)\[\/map\]/ism",'bb_map_location',$Text); + } + + if (strpos($Text,'[map=') !== false) { + $Text = preg_replace_callback("/\[map=(.*?)\]/ism",'bb_map_coords',$Text); + } + if (strpos($Text,'[map]') !== false) { $Text = preg_replace("/\[map\]/", '<div class="map"></div>', $Text); } |