diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/bbcode.php | 8 | ||||
-rw-r--r-- | include/text.php | 14 |
2 files changed, 22 insertions, 0 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index 5b7451a6b..254674172 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -492,6 +492,14 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { $Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '<a href="mailto:$1">$1</a>', $Text); $Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.*?)\[\/mail\]/", '<a href="mailto:$1">$2</a>', $Text); } + + // 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("/\[map\]/", '<div class="map"></div>', $Text); + } + // Check for bold text if (strpos($Text,'[b]') !== false) { $Text = preg_replace("(\[b\](.*?)\[\/b\])ism",'<strong>$1</strong>',$Text); 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); |