vBulletin_4::getVersion()   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 vBulletin_4
12
 * vBulletin 4
13
 */
14
class vBulletin_4 extends Importers\AbstractSourceImporter
15
{
16
	protected $setting_file = '/includes/config.php';
17
18
	public function getName()
19
	{
20
		return 'vBulletin 4';
21
	}
22
23
	public function getVersion()
24
	{
25
		return 'ElkArte 1.0';
26
	}
27
28
	public function getPrefix()
29
	{
30
		global $config;
31
32
		return '`' . $this->getDbName() . '`.' . $config['Database']['tableprefix'];
33
	}
34
35
	public function getDbName()
36
	{
37
		global $config;
38
39
		return $config['Database']['dbname'];
40
	}
41
42
	public function getTableTest()
43
	{
44
		return 'user';
45
	}
46
}
47
48
// Utility functions specific to vBulletin
49
50
/**
51
 * Normalize BBC
52
 *
53
 * @param string $content
54
 *
55
 * @return mixed|string
56
 */
57
function vb4_replace_bbc($content)
58
{
59
	$content = preg_replace(
60
		array(
61
			'~\[(quote)=([^\]]+)\]~i',
62
			'~\[(.+?)=&quot;(.+?)&quot;\]~is',
63
			'~\[INDENT\]~is',
64
			'~\[/INDENT\]~is',
65
			'~\[LIST=1\]~is',
66
		),
67
		array(
68
			'[$1=&quot;$2&quot;]',
69
			'[$1=$2]',
70
			'	',
71
			'',
72
			'[list type=decimal]',
73
		), strtr($content, array('"' => '&quot;')));
74
75
	// Fixing Code tags
76
	$replace = array();
77
78
	preg_match('~\[code\](.+?)\[/code\]~is', $content, $matches);
79
	foreach ($matches as $temp)
80
	{
81
		$replace[$temp] = htmlspecialchars($temp);
82
	}
83
84
	return substr(strtr($content, $replace), 0, 65534);
85
}
86