-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmapbbcode.php
More file actions
56 lines (49 loc) · 1.98 KB
/
Copy pathmapbbcode.php
File metadata and controls
56 lines (49 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php namespace zverik\mapbbcode\includes;
/**
* @package mapbbcode
* @copyright (c) 2016 Ilya Zverev
* @license GNU GPL 2.0 <https://www.gnu.org/licenses/gpl-2.0.txt>
*/
class mapbbcode {
use singletontrait;
use bbcodestrait;
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/** @var string */
protected $table_prefix;
protected function init() {
global $db, $table_prefix;
$this->db = $db;
$this->table_prefix = $table_prefix;
}
/**
* BBCodes
* @return array
*/
public function get_bbcodes() {
return [
'map' => [
'bbcode_tag' => 'map',
'bbcode_helpline' => 'BBCODE_MAP_HELP',
'display_on_posting' => 0,
'bbcode_match' => '[map]{TEXT}[/map]',
'bbcode_tpl' => '<div id="map{DIVID}">[map]{TEXT}[/map]</div><script language="javascript">showMapBBCode(\'map{DIVID}\');</script>',
'first_pass_match' => '!\[map(=[0-9,.]+)?\](.*?)\[/map\]!is',
'first_pass_replace' => '[map:$uid${1}]${2}[/map:$uid]',
'second_pass_match' => '!\[map:($uid)(=[0-9,.]+)?\](.*?)\[/map:$uid\]!s',
'second_pass_replace' => '<div id="map${1}">[map${2}]${3}[/map]</div><script language="javascript">showMapBBCode(\'map${1}\');</script>',
],
'mapid' => [
'bbcode_tag' => 'mapid',
'bbcode_helpline' => '',
'display_on_posting' => 0,
'bbcode_match' => '[mapid]{TEXT}[/mapid]',
'bbcode_tpl' => '<div id="map{DIVID}"></div><script language="javascript">showMapBBCode(\'map{DIVID}\', \'{MAPID}\');</script>',
'first_pass_match' => '!\[mapid\]([a-z]+)\[/mapid\]!i',
'first_pass_replace' => '[mapid:$uid]${1}[/mapid:$uid]',
'second_pass_match' => '!\[mapid:($uid)\]([a-z]+)\[/mapid:$uid\]!i',
'second_pass_replace' => '<div id="map${1}${2}"></div><script language="javascript">showMapBBCode(\'map${1}${2}\', \'${2}\');</script>',
]
];
}
}