mirror of
https://github.com/friendica/friendica
synced 2025-04-25 19:50:12 +00:00
map bbcode tag from Red
This commit is contained in:
parent
cbbb5da321
commit
6258a21434
5 changed files with 150 additions and 18 deletions
|
@ -1,6 +1,17 @@
|
|||
<?php
|
||||
require_once("include/oembed.php");
|
||||
require_once('include/event.php');
|
||||
require_once('include/map.php');
|
||||
|
||||
|
||||
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_attachment($Text, $plaintext = false, $tryoembed = true) {
|
||||
$Text = preg_replace_callback("/(.*?)\[attachment(.*?)\](.*?)\[\/attachment\]/ism",
|
||||
|
@ -932,7 +943,20 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
// Perform MAIL Search
|
||||
$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 headers
|
||||
$Text = preg_replace("(\[h1\](.*?)\[\/h1\])ism",'<h1>$1</h1>',$Text);
|
||||
$Text = preg_replace("(\[h2\](.*?)\[\/h2\])ism",'<h2>$1</h2>',$Text);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue