wbb3_1::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * @name      OpenImporter
4
 * @copyright OpenImporter contributors
5
 * @license   BSD https://opensource.org/licenses/BSD-3-Clause
6
 *
7
 * @version 1.0
8
 */
9
10
/**
11
 * Class wbb3_1
12
 */
13
class wbb3_1 extends Importers\AbstractSourceImporter
14
{
15
	protected $setting_file = '/wc/config.inc.php';
16
17
	public function getName()
18
	{
19
		return 'Woltlab Burning Board 3.1';
20
	}
21
22
	public function getVersion()
23
	{
24
		return 'Wedge 0.1';
25
	}
26
27
	public function getPrefix()
28
	{
29
		return '`' . $this->getDbName() . '`.';
30
	}
31
32
	public function getDbName()
33
	{
34
		global $dbName;
35
36
		return $dbName;
37
	}
38
39
	// @todo why $wbb_prefix is not in getPrefix?
40
	public function getTableTest()
41
	{
42
		global $wbb_prefix;
43
44
		return $wbb_prefix . 'user';
45
	}
46
}
47
48
49
// Utility functions
50
51
/**
52
 * Normalize BBC
53
 *
54
 * @param string $message
55
 *
56
 * @return mixed
57
 */
58
function wbb_replace_bbc($message)
59
{
60
	$message = preg_replace(
61
		array(
62
			'~\[size=(.+?)\]~is',
63
			'~\[align=left\](.+?)\[\/align\]~is',
64
			'~\[align=right\](.+?)\[\/align\]~is',
65
			'~\[align=center\](.+?)\[\/align\]~is',
66
			'~\[align=justify\](.+?)\[\/align\]~is',
67
			'~.Geneva, Arial, Helvetica, sans-serif.~is',
68
			'~.Tahoma, Arial, Helvetica, sans-serif.~is',
69
			'~.Arial, Helvetica, sans-serif.~is',
70
			'~.Chicago, Impact, Compacta, sans-serif.~is',
71
			'~.Comic Sans MS, sans-serif.~is',
72
			'~.Courier New, Courier, mono.~is',
73
			'~.Georgia, Times New Roman, Times, serif.~is',
74
			'~.Helvetica, Verdana, sans-serif.~is',
75
			'~.Impact, Compacta, Chicago, sans-serif.~is',
76
			'~.Lucida Sans, Monaco, Geneva, sans-serif.~is',
77
			'~.Times New Roman, Times, Georgia, serif.~is',
78
			'~.Trebuchet MS, Arial, sans-serif.~is',
79
			'~.Verdana, Helvetica, sans-serif.~is',
80
			'~\[list=1\]\[\*\]~is',
81
			'~\[list\]\[\*\]~is',
82
			'~\[\*\]~is',
83
			'~\[\/list\]~is',
84
			'~\[attach\](.+?)\[\/attach\]~is'
85
		),
86
		array(
87
			'[size=$1pt]',
88
			'[left]$1[/left]',
89
			'[right]$1[/right]',
90
			'[center]$1[/center]',
91
			'$1',
92
			'Geneva',
93
			'Tahoma',
94
			'Arial',
95
			'Chicago',
96
			'Comic Sans MS',
97
			'Courier New',
98
			'Georgia',
99
			'Helvetica',
100
			'Impact',
101
			'Lucida Sans',
102
			'Times New Roman',
103
			'Trebuchet MS',
104
			'Verdana',
105
			'[list type=decimal][li]',
106
			'[list][li]',
107
			'[/li][li]',
108
			'[/li][/list]',
109
			'',
110
		),
111
		trim($message)
112
	);
113
114
	return $message;
115
}