aboutsummaryrefslogtreecommitdiffstats
path: root/include/bbcode.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/bbcode.php')
-rw-r--r--include/bbcode.php36
1 files changed, 29 insertions, 7 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 5b7451a6b..ab56bda61 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -22,7 +22,7 @@ function tryzrlaudio($match) {
$zrl = is_matrix_url($link);
if($zrl)
$link = zid($link);
- return '<audio src="' . $link . '" controls="controls" ><a href="' . $link . '">' . $link . '</a></audio>';
+ return '<audio src="' . str_replace(' ','%20',$link) . '" controls="controls" ><a href="' . str_replace(' ','%20',$link) . '">' . $link . '</a></audio>';
}
function tryzrlvideo($match) {
@@ -30,7 +30,7 @@ function tryzrlvideo($match) {
$zrl = is_matrix_url($link);
if($zrl)
$link = zid($link);
- return '<video controls="controls" src="' . $link . '" style="width:100%; max-width:' . get_app()->videowidth . 'px"><a href="' . $link . '">' . $link . '</a></video>';
+ return '<video controls="controls" src="' . str_replace(' ','%20',$link) . '" style="width:100%; max-width:' . get_app()->videowidth . 'px"><a href="' . str_replace(' ','%20',$link) . '">' . $link . '</a></video>';
}
@@ -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
@@ -357,11 +368,6 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
$Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_spacefy',$Text);
}
-// Not yet implemented - thinking this should display a map or perhaps be a map directive
-// if (strpos($Text,'[location]') !== false) {
-// $Text = preg_replace_callback("/\[location\](.*?)\[\/location\]/ism", 'bb_location',$Text);
-// }
-
// If we find any event code, turn it into an event.
@@ -492,6 +498,22 @@ 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_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);
+ }
+
// Check for bold text
if (strpos($Text,'[b]') !== false) {
$Text = preg_replace("(\[b\](.*?)\[\/b\])ism",'<strong>$1</strong>',$Text);