mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 01:35:12 +00:00
generate maps for naked geo: urls
This commit is contained in:
parent
da33c88f0f
commit
e7ade6df3a
1 changed files with 16 additions and 0 deletions
|
@ -756,6 +756,15 @@ function rpost_callback($match)
|
|||
}
|
||||
}
|
||||
|
||||
fun($match)
|
||||
{
|
||||
return str_replace($match[0], '<div class="map">'
|
||||
. generate_map(floatval($match[1]),floatval($match[2]))
|
||||
. '</div>',
|
||||
$match[0]);
|
||||
}
|
||||
|
||||
|
||||
function bb_map_coords($match)
|
||||
{
|
||||
$x = str_replace(['/', ','], [' ', ' '], $match[1]);
|
||||
|
@ -1846,8 +1855,15 @@ function bbcode($Text, $options = [])
|
|||
$Text = preg_replace("/\[map\/\]/", '<div class="map"></div>', $Text);
|
||||
$Text = preg_replace("/\[map\]/", '<div class="map"></div>', $Text);
|
||||
}
|
||||
|
||||
// provide a map for naked geo: links
|
||||
$Text = preg_replace_callback(
|
||||
'/geo:([-+]?(?:[1-8]?\d(?:\.\d+)?|90(?:\.0+)?)),\s*([-+]?(?:180(?:\.0+)?|(?:(?:1[0-7]\d)|(?:[1-9]?\d))(?:\.\d+)?))(?!\d)/',
|
||||
'bb_map_latlon', $Text);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Check for bold text
|
||||
if (str_contains($Text, '[b]')) {
|
||||
$Text = preg_replace("(\[b\](.*?)\[\/b\])ism", '<strong>$1</strong>', $Text);
|
||||
|
|
Loading…
Reference in a new issue