Passed
Pull Request — master (#117)
by Spuds
07:11
created

PHPBoost3   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A getDbName() 0 5 1
A getTableTest() 0 3 1
A getVersion() 0 3 1
A getPrefix() 0 5 1
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
class PHPBoost3 extends Importers\AbstractSourceImporter
11
{
12
	public function getName()
13
	{
14
		return 'PHPBoost3';
15
	}
16
17
	public function getVersion()
18
	{
19
		return 'ElkArte 1.0';
20
	}
21
22
	public function getPrefix()
23
	{
24
		global $boost_prefix;
25
26
		return '`' . $this->getDbName() . '`.' . $boost_prefix;
27
	}
28
29
	public function getDbName()
30
	{
31
		global $boost_database;
32
33
		return $boost_database;
34
	}
35
36
	public function getTableTest()
37
	{
38
		return 'member';
39
	}
40
}
41
42
/**
43
 * Utility functions
44
 */
45
function boost_replace_bbc($content)
46
{
47
	$content = preg_replace(
48
		array(
49
			'~<strong>~is',
50
			'~</strong>~is',
51
			'~<em>~is',
52
			'~</em>~is',
53
			'~<strike>~is',
54
			'~</strike>~is',
55
			'~\<h3(.+?)\>~is',
56
			'~</h3>~is',
57
			'~\<span stype="text-decoration: underline;">(.+?)</span>~is',
58
			'~\<div class="bb_block">(.+?)<\/div>~is',
59
			'~\[style=(.+?)\](.+?)\[\/style\]~is',
60
		),
61
		array(
62
			'[b]',
63
			'[/b]',
64
			'[i]',
65
			'[/i]',
66
			'[s]',
67
			'[/s]',
68
			'',
69
			'',
70
			'[u]%1[/u]',
71
			'%1',
72
			'%1',
73
		),
74
		trim($content)
75
	);
76
77
	return $content;
78
}
79