Completed
Pull Request — master (#31)
by
unknown
06:34
created

v310_m7_update_bbcodes::depends_on()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
*
4
* Advanced BBCode Box
5
*
6
* @copyright (c) 2015 Matt Friedman
7
* @license GNU General Public License, version 2 (GPL-2.0)
8
*
9
*/
10
11
namespace vse\abbc3\migrations;
12
13
class v310_m7_update_bbcodes extends \vse\abbc3\migrations_bbcode_base
14
{
15
	/**
16
	 * {@inheritdoc}
17
	 */
18
	static public function depends_on()
19
	{
20
		return array('\vse\abbc3\migrations\v310_m6_update_bbcodes');
21
	}
22
23
	/**
24
	 * {@inheritdoc}
25
	 */
26
	public function update_data()
27
	{
28
		return array(
29
			// Custom functions
30
			array('custom', array(array($this, 'remove_abbc3_bbcodes'))),
31
			array('custom', array(array($this, 'install_abbc3_bbcodes'))),
32
		);
33
	}
34
35
	/**
36
	 * @var array An array of bbcodes data to install
37
	 */
38
	protected $bbcode_data = array(
39
		/* class name & styles updated */
40
		'blur=' => array(
41
			'bbcode_helpline'	=> 'ABBC3_BLUR_HELPLINE',
42
			'bbcode_match'		=> '[blur={COLOR}]{TEXT}[/blur]',
43
			'bbcode_tpl'		=> '<span class="abbc3_blur" style="display: inline; padding: 0 1px; color: rgba(0, 0, 0, 0.15); text-shadow: 0 0 0.2em {COLOR};">{TEXT}</span>',
44
		),
45
		/* new tag ( old: align=center ) */
46
		'center' => array(
47
			'bbcode_helpline'	=> 'ABBC3_CENTER_HELPLINE',
48
			'bbcode_match'		=> '[center]{TEXT}[/center]',
49
			'bbcode_tpl'		=> '<span style="text-align:center; display:block;">{TEXT}</span>',
50
		),
51
		/* class name & styles updated */
52
		'dropshadow=' => array(
53
			'bbcode_helpline'	=> 'ABBC3_DROPSHADOW_HELPLINE',
54
			'bbcode_match'		=> '[dropshadow={COLOR}]{TEXT}[/dropshadow]',
55
			'bbcode_tpl'		=> '<span class="abbc3_dropshadow" style="display: inline; color: {COLOR}; text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.4);">{TEXT}</span>',
56
		),
57
		/* class name updated */
58
		'fade' => array(
59
			'bbcode_helpline'	=> 'ABBC3_FADE_HELPLINE',
60
			'bbcode_match'		=> '[fade]{TEXT}[/fade]',
61
			'bbcode_tpl'		=> '<span class="abbc3_fade">{TEXT}</span>',
62
		),
63
		/* class name & styles updated */
64
		'glow=' => array(
65
			'bbcode_helpline'	=> 'ABBC3_GLOW_HELPLINE',
66
			'bbcode_match'		=> '[glow={COLOR}]{TEXT}[/glow]',
67
			'bbcode_tpl'		=> '<span class="abbc3_glow" style="display: inline; padding: 0 3px; color: #ffffff; text-shadow: 0 0 0.4em {COLOR}, 0 0 0.5em {COLOR}, 0 0 0.6em {COLOR};">{TEXT}</span>',
68
		),
69
		/* class name added & styles updated */
70
		'highlight=' => array(
71
			'bbcode_helpline'	=> 'ABBC3_HIGHLIGHT_HELPLINE',
72
			'bbcode_match'		=> '[highlight={COLOR}]{TEXT}[/highlight]',
73
			'bbcode_tpl'		=> '<span class="abbc3_highlight" style="padding: 0 2px; background-color: {COLOR};">{TEXT}</span>',
74
		),
75
		/* new tag ( old: align=justify ) */
76
		'justify' => array(
77
			'bbcode_helpline'	=> 'ABBC3_JUSTIFY_HELPLINE',
78
			'bbcode_match'		=> '[justify]{TEXT}[/justify]',
79
			'bbcode_tpl'		=> '<span style="text-align:justify; display:block;">{TEXT}</span>',
80
		),
81
		/* new tag ( old: align=left ) */
82
		'left' => array(
83
			'bbcode_helpline'	=> 'ABBC3_LEFT_HELPLINE',
84
			'bbcode_match'		=> '[left]{TEXT}[/left]',
85
			'bbcode_tpl'		=> '<span style="text-align:left; display:block;">{TEXT}</span>',
86
		),
87
		/* class names updated */
88
		'mod=' => array(
89
			'bbcode_helpline'	=> 'ABBC3_MOD_HELPLINE',
90
			'bbcode_match'		=> '[mod={TEXT1}]{TEXT2}[/mod]',
91
			'bbcode_tpl'		=> '<table class="abbc3_mod" style="background-color:#FFFFFF;border:1px solid #000000;border-collapse:separate;border-spacing:5px;padding:0;width:100%;color:#333333;overflow:hidden;"><tr><td class="abbc3_mod_icon" rowspan="2" style="background-color:#ff6060;font-weight:bold;font-family:\'Times New Roman\',Verdana,sans-serif;font-size:4em;color:#ffffff;vertical-align:middle;text-align:center;width:1%;">&nbsp;!&nbsp;</td><td class="abbc3_mod_user" style="border-bottom:1px solid #000000;font-weight:bold;">{L_MESSAGE} {L_FROM}{L_COLON} {TEXT1}</td></tr><tr><td class="abbc3_mod_text">{TEXT2}</td></tr></table>',
92
		),
93
		/* class name updated */
94
		'nfo' => array(
95
			'bbcode_helpline'	=> 'ABBC3_NFO_HELPLINE',
96
			'bbcode_match'		=> '[nfo]{TEXT}[/nfo]',
97
			'bbcode_tpl'		=> '<pre class="abbc3_nfo" style="color: #000000; font-weight: normal; line-height: normal; font-size: 10pt; font-family: Terminal, monospace; background-color: #ffffff; white-space: pre; padding: 5px;">{TEXT}</pre>',
98
		),
99
		/* class names updated */
100
		'offtopic' => array(
101
			'bbcode_helpline'	=> 'ABBC3_OFFTOPIC_HELPLINE',
102
			'bbcode_match'		=> '[offtopic]{TEXT}[/offtopic]',
103
			'bbcode_tpl'		=> '<div class="abbc3_offtopic" style="position:relative;margin:5px 0;padding:39px 19px 14px;background:#fff;border:1px solid #ddd;border-radius:4px;"><div class="abbc3_offtopic_title" style="position:absolute;top:-1px;left:-1px;font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;font-weight:bold;font-size:12px;color:#9da0a4;background:#f5f5f5;padding:5px 12px;border:1px solid #ddd;border-radius:4px 0 4px 0;">{L_ABBC3_OFFTOPIC}</div><div class="abbc3_offtopic_text" style="padding:5px 10px;color:#333333;">{TEXT}</div></div>',
104
		),
105
		/* new tag ( old: align=right ) */
106
		'right' => array(
107
			'bbcode_helpline'	=> 'ABBC3_RIGHT_HELPLINE',
108
			'bbcode_match'		=> '[right]{TEXT}[/right]',
109
			'bbcode_tpl'		=> '<span style="text-align:right; display:block;">{TEXT}</span>',
110
		),
111
		/* class name & styles updated */
112
		'shadow=' => array(
113
			'bbcode_helpline'	=> 'ABBC3_SHADOW_HELPLINE',
114
			'bbcode_match'		=> '[shadow={COLOR}]{TEXT}[/shadow]',
115
			'bbcode_tpl'		=> '<span class="abbc3_shadow" style="display: inline; color: {COLOR}; text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.4);">{TEXT}</span>',
116
		),
117
		/* class name added */
118
		'soundcloud' => array(
119
			'bbcode_helpline'	=> 'ABBC3_SOUNDCLOUD_HELPLINE',
120
			'bbcode_match'		=> '[soundcloud]{URL}[/soundcloud]',
121
			'bbcode_tpl'		=> '<iframe class="abbc3_soundcloud" width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url={URL}&amp;color=ff5500&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false"></iframe>',
122
		),
123
		/* class names updated */
124
		'spoil' => array(
125
			'bbcode_helpline'	=> 'ABBC3_SPOILER_HELPLINE',
126
			'bbcode_match'		=> '[spoil]{TEXT}[/spoil]',
127
			'bbcode_tpl'		=> '<div class="abbc3_spoil" style="margin:5px 0;font-weight:normal;padding:4px 10px;background-color:#fff;border:1px solid #dbdbdb;border-radius:4px;color:#333333;"><div class="abbc3_spoil_title" style="margin:0;padding:0;width:100%;"><span class="abbc3_spoil_btn" style="margin:2px 5px;text-transform:uppercase;font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;font-size:11px;font-weight:bold;display:block;cursor:pointer;color:#333;" data-show="{L_ABBC3_SPOILER_SHOW}" data-hide="{L_ABBC3_SPOILER_HIDE}">{L_ABBC3_SPOILER_SHOW}</span></div><div class="abbc3_spoil_text" style="color:#333333;display:none;padding:5px;border-top:1px solid #ccc;">{TEXT}</div></div>',
128
		),
129
		/* new tag */
130
		'table' => array(
131
			'bbcode_helpline'	=> 'ABBC3_TABLE_HELPLINE',
132
			'bbcode_match'		=> '[table]{TEXT}[/table]',
133
			'bbcode_tpl'		=> '<table class="abbc3_table">{TEXT}</table>',
134
		),
135
		/* new tag */
136
		'td' => array(
137
			'bbcode_helpline'	=> 'ABBC3_TD_HELPLINE',
138
			'bbcode_match'		=> '[td]{TEXT}[/td]',
139
			'bbcode_tpl'		=> '<td class="abbc3_td">{TEXT}</td>',
140
		),
141
		/* new tag */
142
		'tr' => array(
143
			'bbcode_helpline'	=> 'ABBC3_TR_HELPLINE',
144
			'bbcode_match'		=> '[tr]{TEXT}[/tr]',
145
			'bbcode_tpl'		=> '<tr class="abbc3_tr">{TEXT}</tr>',
146
		),
147
		/* tag name changed ( old: hidden ) */
148
		'users' => array(
149
			'bbcode_helpline'	=> 'ABBC3_USERS_HELPLINE',
150
			'bbcode_match'		=> '[users]{TEXT}[/users]',
151
			'bbcode_tpl'		=> '<!-- ABBC3_BBCODE_HIDDEN -->{TEXT}<!-- ABBC3_BBCODE_HIDDEN -->',
152
		),
153
	);
154
	
155
	/**
156
	 * Array of ABBC3 MOD BBCodes to remove
157
	 *
158
	 * @return array
159
	 */
160
	public function abbc3_bbcodes()
161
	{
162
		return array(
163
164
			// These are being replaced by new BBCodes
165
			'align=',			// replaced by left,right,center,justify
166
			// 'hidden',			// (deprecated) replaced by users
167
168
		);
169
	}
170
}
171