Completed
Pull Request — master (#31)
by
unknown
1208:26 queued 1173:28
created

v310_m7_update_bbcodes::update_data()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 8
rs 9.4285
cc 1
eloc 4
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
		/* Update order */
40
		'font=' => array(
41
			'bbcode_helpline'	=> 'ABBC3_FONT_HELPLINE',
42
			'bbcode_match'		=> '[font={INTTEXT}]{TEXT}[/font]',
43
			'bbcode_tpl'		=> '<span style="font-family: {INTTEXT};">{TEXT}</span>',
44
			'bbcode_order'		=> '1',
45
		),
46
		/* Update class name added & styles */
47
		'highlight=' => array(
48
			'bbcode_helpline'	=> 'ABBC3_HIGHLIGHT_HELPLINE',
49
			'bbcode_match'		=> '[highlight={COLOR}]{TEXT}[/highlight]',
50
			'bbcode_tpl'		=> '<span class="abbc3_highlight" style="padding: 0 2px; background-color: {COLOR};">{TEXT}</span>',
51
			'bbcode_order'		=> '2',
52
		),
53
		/* Groups separator panel*/
54
		'-end-p1-group-1-' => array(
55
			'bbcode_match'		=> '[-end-p1-group-1-][/-end-p1-group-1-]',
56
			'bbcode_order'		=> '110',
57
		),
58
		/* Update order */
59
		's' => array(
60
			'bbcode_helpline'	=> 'ABBC3_STRIKE_HELPLINE',
61
			'bbcode_match'		=> '[s]{TEXT}[/s]',
62
			'bbcode_tpl'		=> '<span class="abbc3_strike" style="text-decoration: line-through">{TEXT}</span>',
63
			'bbcode_order'		=> '111',
64
		),
65
		/* Update order */
66
		'sup' => array(
67
			'bbcode_helpline'	=> 'ABBC3_SUP_HELPLINE',
68
			'bbcode_match'		=> '[sup]{TEXT}[/sup]',
69
			'bbcode_tpl'		=> '<sup style="vertical-align: super; font-size: smaller;">{TEXT}</sup>',
70
			'bbcode_order'		=> '112',
71
		),
72
		/* Update order */
73
		'sub' => array(
74
			'bbcode_helpline'	=> 'ABBC3_SUB_HELPLINE',
75
			'bbcode_match'		=> '[sub]{TEXT}[/sub]',
76
			'bbcode_tpl'		=> '<sub style="vertical-align: sub; font-size: smaller;">{TEXT}</sub>',
77
			'bbcode_order'		=> '113',
78
		),
79
		/* Groups separator panel*/
80
		'-end-p1-group-2-' => array(
81
			'bbcode_match'		=> '[-end-p1-group-2-][/-end-p1-group-2-]',
82
			'bbcode_order'		=> '120',
83
		),
84
		/* new tag ( old: align=left ) */
85
		'left' => array(
86
			'bbcode_helpline'	=> 'ABBC3_LEFT_HELPLINE',
87
			'bbcode_match'		=> '[left]{TEXT}[/left]',
88
			'bbcode_tpl'		=> '<span style="text-align:left; display:block;">{TEXT}</span>',
89
			'bbcode_order'		=> '121',
90
		),
91
		/* new tag ( old: align=center ) */
92
		'center' => array(
93
			'bbcode_helpline'	=> 'ABBC3_CENTER_HELPLINE',
94
			'bbcode_match'		=> '[center]{TEXT}[/center]',
95
			'bbcode_tpl'		=> '<span style="text-align:center; display:block;">{TEXT}</span>',
96
			'bbcode_order'		=> '122',
97
		),
98
		/* new tag ( old: align=right ) */
99
		'right' => array(
100
			'bbcode_helpline'	=> 'ABBC3_RIGHT_HELPLINE',
101
			'bbcode_match'		=> '[right]{TEXT}[/right]',
102
			'bbcode_tpl'		=> '<span style="text-align:right; display:block;">{TEXT}</span>',
103
			'bbcode_order'		=> '123',
104
		),
105
		/* new tag ( old: align=justify ) */
106
		'justify' => array(
107
			'bbcode_helpline'	=> 'ABBC3_JUSTIFY_HELPLINE',
108
			'bbcode_match'		=> '[justify]{TEXT}[/justify]',
109
			'bbcode_tpl'		=> '<span style="text-align:justify; display:block;">{TEXT}</span>',
110
			'bbcode_order'		=> '124',
111
		),
112
		/* Panel separator */
113
		'--end-panel-1--' => array(
114
			'bbcode_match'		=> '[--end-panel-1--][/--end-panel-1--]',
115
			'bbcode_order'		=> '200',
116
		),
117
		/* Groups separator panel*/
118
		'-end-p2-group-1-' => array(
119
			'bbcode_match'		=> '[-end-p2-group-1-][/-end-p2-group-1-]',
120
			'bbcode_order'		=> '210',
121
		),
122
		/* new tag */
123
		'table' => array(
124
			'bbcode_helpline'	=> 'ABBC3_TABLE_HELPLINE',
125
			'bbcode_match'		=> '[table]{TEXT}[/table]',
126
			'bbcode_tpl'		=> '<table class="abbc3_table">{TEXT}</table>',
127
			'bbcode_order'		=> '211',
128
		),
129
		/* new tag */
130
		'tr' => array(
131
			'bbcode_helpline'	=> 'ABBC3_TR_HELPLINE',
132
			'bbcode_match'		=> '[tr]{TEXT}[/tr]',
133
			'bbcode_tpl'		=> '<tr class="abbc3_tr">{TEXT}</tr>',
134
			'bbcode_order'		=> '212',
135
		),
136
		/* new tag */
137
		'td' => array(
138
			'bbcode_helpline'	=> 'ABBC3_TD_HELPLINE',
139
			'bbcode_match'		=> '[td]{TEXT}[/td]',
140
			'bbcode_tpl'		=> '<td class="abbc3_td">{TEXT}</td>',
141
			'bbcode_order'		=> '213',
142
		),
143
		/* Panel separator */
144
		'--end-panel-2--' => array(
145
			'bbcode_match'		=> '[--end-panel-2--][/--end-panel-2--]',
146
			'bbcode_order'		=> '300',
147
		),
148
		/* Update order */
149
		'BBvideo' => array(
150
			'bbcode_helpline'	=> 'ABBC3_BBVIDEO_HELPLINE',
151
			'bbcode_match'		=> '[BBvideo={NUMBER1},{NUMBER2}]{URL}[/BBvideo]',
152
			'bbcode_tpl'		=> '<a href="{URL}" class="bbvideo" data-bbvideo="{NUMBER1},{NUMBER2}" target="_blank">{URL}</a>',
153
			'bbcode_order'		=> '301',
154
		),
155
		/* class name added */
156
		'soundcloud' => array(
157
			'bbcode_helpline'	=> 'ABBC3_SOUNDCLOUD_HELPLINE',
158
			'bbcode_match'		=> '[soundcloud]{URL}[/soundcloud]',
159
			'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>',
160
			'bbcode_order'		=> '302',
161
		),
162
		/* Groups separator panel*/
163
		'-end-p3-group-1-' => array(
164
			'bbcode_match'		=> '[-end-p3-group-1-][/-end-p3-group-1-]',
165
			'bbcode_order'		=> '310',
166
		),
167
		/* Update order */
168
		'pre' => array(
169
			'bbcode_helpline'	=> 'ABBC3_PREFORMAT_HELPLINE',
170
			'bbcode_match'		=> '[pre]{TEXT}[/pre]',
171
			'bbcode_tpl'		=> '<pre class="abbc3_pre" style="display: block; font-family: monospace; white-space: pre;">{TEXT}</pre>',
172
			'bbcode_order'		=> '311',
173
		),
174
		/* Update order */
175
		'float=' => array(
176
			'bbcode_helpline'	=> 'ABBC3_FLOAT_HELPLINE',
177
			'bbcode_match'		=> '[float={IDENTIFIER}]{TEXT}[/float]',
178
			'bbcode_tpl'		=> '<div style="float:{IDENTIFIER}; padding:0 10px;">{TEXT}</div>',
179
			'bbcode_order'		=> '312',
180
		),
181
		/* PANEL separator */
182
		'--end-panel-3--' => array(
183
			'bbcode_match'		=> '[--end-panel-3--][/--end-panel-3--]',
184
			'bbcode_order'		=> '400',
185
		),
186
		/* tag name changed ( old: hidden ) */
187
		'users' => array(
188
			'bbcode_helpline'	=> 'ABBC3_USERS_HELPLINE',
189
			'bbcode_match'		=> '[users]{TEXT}[/users]',
190
			'bbcode_tpl'		=> '<!-- ABBC3_BBCODE_HIDDEN -->{TEXT}<!-- ABBC3_BBCODE_HIDDEN -->',
191
			'bbcode_order'		=> '401',
192
		),
193
		/* class names updated */
194
		'spoil' => array(
195
			'bbcode_helpline'	=> 'ABBC3_SPOILER_HELPLINE',
196
			'bbcode_match'		=> '[spoil]{TEXT}[/spoil]',
197
			'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>',
198
			'bbcode_order'		=> '402',
199
		),
200
		/* Update order */
201
		'marq=' => array(
202
			'bbcode_helpline'	=> 'ABBC3_MARQUEE_HELPLINE',
203
			'bbcode_match'		=> '[marq={IDENTIFIER}]{TEXT}[/marq]',
204
			'bbcode_tpl'		=> '<marquee class="abbc3_marquee" direction="{IDENTIFIER}" scrolldelay="100" onmouseover="this.scrollDelay=10000000;" onmouseout="this.scrollDelay=100;" style="margin: 10px 0; padding: 5px; display: inline-block;">{TEXT}</marquee>',
205
			'bbcode_order'		=> '403',
206
		),
207
		/* class name updated */
208
		'nfo' => array(
209
			'bbcode_helpline'	=> 'ABBC3_NFO_HELPLINE',
210
			'bbcode_match'		=> '[nfo]{TEXT}[/nfo]',
211
			'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>',
212
			'bbcode_order'		=> '404',
213
		),
214
		/* class names updated */
215
		'mod=' => array(
216
			'bbcode_helpline'	=> 'ABBC3_MOD_HELPLINE',
217
			'bbcode_match'		=> '[mod={TEXT1}]{TEXT2}[/mod]',
218
			'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>',
219
			'bbcode_order'		=> '405',
220
		),
221
		/* class names updated */
222
		'offtopic' => array(
223
			'bbcode_helpline'	=> 'ABBC3_OFFTOPIC_HELPLINE',
224
			'bbcode_match'		=> '[offtopic]{TEXT}[/offtopic]',
225
			'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>',
226
			'bbcode_order'		=> '406',
227
		),
228
		/* class name & styles updated */
229
		'dropshadow=' => array(
230
			'bbcode_helpline'	=> 'ABBC3_DROPSHADOW_HELPLINE',
231
			'bbcode_match'		=> '[dropshadow={COLOR}]{TEXT}[/dropshadow]',
232
			'bbcode_tpl'		=> '<span class="abbc3_dropshadow" style="display: inline; color: {COLOR}; text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.4);">{TEXT}</span>',
233
			'bbcode_order'		=> '407',
234
		),
235
		/* class name & styles updated */
236
		'shadow=' => array(
237
			'bbcode_helpline'	=> 'ABBC3_SHADOW_HELPLINE',
238
			'bbcode_match'		=> '[shadow={COLOR}]{TEXT}[/shadow]',
239
			'bbcode_tpl'		=> '<span class="abbc3_shadow" style="display: inline; color: {COLOR}; text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.4);">{TEXT}</span>',
240
			'bbcode_order'		=> '408',
241
		),
242
		/* class name & styles updated */
243
		'glow=' => array(
244
			'bbcode_helpline'	=> 'ABBC3_GLOW_HELPLINE',
245
			'bbcode_match'		=> '[glow={COLOR}]{TEXT}[/glow]',
246
			'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>',
247
			'bbcode_order'		=> '409',
248
		),
249
		/* class name & styles updated */
250
		'blur=' => array(
251
			'bbcode_helpline'	=> 'ABBC3_BLUR_HELPLINE',
252
			'bbcode_match'		=> '[blur={COLOR}]{TEXT}[/blur]',
253
			'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>',
254
			'bbcode_order'		=> '410',
255
		),
256
		/* class name updated */
257
		'fade' => array(
258
			'bbcode_helpline'	=> 'ABBC3_FADE_HELPLINE',
259
			'bbcode_match'		=> '[fade]{TEXT}[/fade]',
260
			'bbcode_tpl'		=> '<span class="abbc3_fade">{TEXT}</span>',
261
			'bbcode_order'		=> '411',
262
		),
263
		/* Update order */
264
		'dir=ltr' => array(
265
			'bbcode_helpline'	=> 'ABBC3_DIR_HELPLINE',
266
			'bbcode_match'		=> '[dir={IDENTIFIER}]{TEXT}[/dir]',
267
			'bbcode_tpl'		=> '<bdo dir="{IDENTIFIER}">{TEXT}</bdo>',
268
			'bbcode_order'		=> '412',
269
		),
270
		/* Update order (BBcode deprecated. Replaced by BBvideo) */
271
		'youtube' => array(
272
			'bbcode_helpline'	=> 'ABBC3_YOUTUBE_HELPLINE',
273
			'bbcode_match'		=> '[youtube]{URL}[/youtube]',
274
			'bbcode_tpl'		=> '<a href="{URL}" class="bbvideo" data-bbvideo="560,315">{URL}</a>',
275
			'display_on_posting'=> 0,
276
			'bbcode_order'		=> '1000',
277
		),
278
		/* Update order (BBcode deprecated. Replaced by users) */
279
		'hidden' => array(
280
			'bbcode_helpline'	=> 'ABBC3_HIDDEN_HELPLINE',
281
			'bbcode_match'		=> '[hidden]{TEXT}[/hidden]',
282
			'bbcode_tpl'		=> '<!-- ABBC3_BBCODE_HIDDEN -->{TEXT}<!-- ABBC3_BBCODE_HIDDEN -->',
283
			'display_on_posting'=> 0,
284
			'bbcode_order'		=> '1001',
285
		),
286
		/* Update order (BBcode deprecated. Replaced by left,right,center,justify) */
287
		'align=center' => array(
288
			'bbcode_helpline'	=> 'ABBC3_ALIGN_HELPLINE',
289
			'bbcode_match'		=> '[align={IDENTIFIER}]{TEXT}[/align]',
290
			'bbcode_tpl'		=> '<span style="text-align:{IDENTIFIER}; display:block;">{TEXT}</span>',
291
			'display_on_posting'=> 0,
292
			'bbcode_order'		=> '1002',
293
		),
294
	);
295
	
296
	/**
297
	 * Array of ABBC3 MOD BBCodes to remove
298
	 *
299
	 * @return array
300
	 */
301
	public function abbc3_bbcodes()
302
	{
303
		return array(
304
305
			// These are being replaced by new BBCodes
306
			// 'align=',			// replaced by left,right,center,justify
307
			// 'hidden',			// (deprecated) replaced by users
308
309
		);
310
	}
311
}
312