diff options
author | Mario Vavti <mario@mariovavti.com> | 2019-06-04 10:19:04 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2019-06-04 10:19:04 +0200 |
commit | e4ca3609d90bb437061e4b8db95ed0424b25eb76 (patch) | |
tree | aa070e40ab01cb1354cbf879a0fb8b2f570631d5 /include/bbcode.php | |
parent | 071fba2f7121aeb9690a21398935a53deac09af8 (diff) | |
parent | bc092d8d7815195d62299c0ea54caa4759e6f2e7 (diff) | |
download | volse-hubzilla-4.2.tar.gz volse-hubzilla-4.2.tar.bz2 volse-hubzilla-4.2.zip |
Merge branch '4.2RC'4.2
Diffstat (limited to 'include/bbcode.php')
-rw-r--r-- | include/bbcode.php | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index 36f943e46..485a1f5b2 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -87,12 +87,11 @@ function nakedoembed($match) { $strip_url = strip_escaped_zids($url); - $o = oembed_fetch_url($strip_url); - - if ($o['type'] == 'error') - return str_replace($url,$strip_url,$match[0]); - - return '[embed]' . $strip_url . '[/embed]'; + // this function no longer performs oembed on naked links + // because they author may have created naked links intentionally. + // Now it just strips zids on naked links. + + return str_replace($url,$strip_url,$match[0]); } function tryzrlaudio($match) { @@ -986,17 +985,22 @@ function bbcode($Text, $options = []) { // 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 ($cache) { + $Text = str_replace([ '[map]','[/map]' ], [ '','' ], $Text); + $Text = preg_replace('/\[map=(.*?)\]/ism','$1',$Text); } - if (strpos($Text,'[map]') !== false) { - $Text = preg_replace("/\[map\]/", '<div class="map"></div>', $Text); + else { + 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); |