PluginProbe
bbPress / 2.6.19
bbPress v2.6.19
2.6.19 2.6.18 2.6.17 trunk 2.0 2.0-beta-1 2.0-beta-2b 2.0-beta-3 2.0-beta-3b 2.0-rc-2 2.0-rc-3 2.0-rc-4 2.0-rc-5 2.0.1 2.0.2 2.0.3 2.1 2.1-beta-1 2.1-rc1 2.1-rc2 2.1-rc3 2.1-rc4 2.1.1 2.1.2 2.1.3 All 74 releases
bbpress / includes / admin / converters / Invision.php

Invision.php in bbPress 2.6.19, at includes/admin/converters/Invision.php

686 lines 21.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * bbPress Invision Converter
5 *
6 * @package bbPress
7 * @subpackage Converters
8 */
9
10 /**
11 * Implementation of Invision Power Board v3.1-3.4 converter.
12 *
13 * @since 2.1.0 bbPress (r3816)
14 *
15 * @link Codex Docs https://codex.bbpress.org/import-forums/invision
16 */
17 class Invision extends BBP_Converter_Base {
18
19 /**
20 * Main Constructor
21 *
22 */
23 public function __construct() {
24 parent::__construct();
25 }
26
27 /**
28 * Sets up the field mappings
29 */
30 public function setup_globals() {
31
32 // Setup smiley URL & path
33 $this->bbcode_parser_properties = array(
34 'smiley_url' => false,
35 'smiley_dir' => false
36 );
37
38 /** Forum Section *****************************************************/
39
40 // Old forum id (Stored in postmeta)
41 $this->field_map[] = array(
42 'from_tablename' => 'forums',
43 'from_fieldname' => 'id',
44 'to_type' => 'forum',
45 'to_fieldname' => '_bbp_old_forum_id'
46 );
47
48 // Forum parent id (If no parent, then 0, Stored in postmeta)
49 $this->field_map[] = array(
50 'from_tablename' => 'forums',
51 'from_fieldname' => 'parent_id',
52 'to_type' => 'forum',
53 'to_fieldname' => '_bbp_old_forum_parent_id'
54 );
55
56 // Forum topic count (Stored in postmeta)
57 $this->field_map[] = array(
58 'from_tablename' => 'forums',
59 'from_fieldname' => 'topics',
60 'to_type' => 'forum',
61 'to_fieldname' => '_bbp_topic_count'
62 );
63
64 // Forum reply count (Stored in postmeta)
65 $this->field_map[] = array(
66 'from_tablename' => 'forums',
67 'from_fieldname' => 'posts',
68 'to_type' => 'forum',
69 'to_fieldname' => '_bbp_reply_count'
70 );
71
72 // Forum total topic count (Stored in postmeta)
73 $this->field_map[] = array(
74 'from_tablename' => 'forums',
75 'from_fieldname' => 'topics',
76 'to_type' => 'forum',
77 'to_fieldname' => '_bbp_total_topic_count'
78 );
79
80 // Forum total reply count (Stored in postmeta)
81 $this->field_map[] = array(
82 'from_tablename' => 'forums',
83 'from_fieldname' => 'posts',
84 'to_type' => 'forum',
85 'to_fieldname' => '_bbp_total_reply_count'
86 );
87
88 // Forum title.
89 $this->field_map[] = array(
90 'from_tablename' => 'forums',
91 'from_fieldname' => 'name',
92 'to_type' => 'forum',
93 'to_fieldname' => 'post_title'
94 );
95
96 // Forum slug (Clean name to avoid confilcts)
97 $this->field_map[] = array(
98 'from_tablename' => 'forums',
99 'from_fieldname' => 'name_seo',
100 'to_type' => 'forum',
101 'to_fieldname' => 'post_name',
102 'callback_method' => 'callback_slug'
103 );
104
105 // Forum description.
106 $this->field_map[] = array(
107 'from_tablename' => 'forums',
108 'from_fieldname' => 'description',
109 'to_type' => 'forum',
110 'to_fieldname' => 'post_content',
111 'callback_method' => 'callback_null'
112 );
113
114 // Forum display order (Starts from 1)
115 $this->field_map[] = array(
116 'from_tablename' => 'forums',
117 'from_fieldname' => 'position',
118 'to_type' => 'forum',
119 'to_fieldname' => 'menu_order'
120 );
121
122 // Forum type (Forum = 0 or Category = -1, Stored in postmeta)
123 $this->field_map[] = array(
124 'from_tablename' => 'forums',
125 'from_fieldname' => 'parent_id',
126 'to_type' => 'forum',
127 'to_fieldname' => '_bbp_forum_type',
128 'callback_method' => 'callback_forum_type'
129 );
130
131 // Forum status (Set a default value 'open', Stored in postmeta)
132 $this->field_map[] = array(
133 'to_type' => 'forum',
134 'to_fieldname' => '_bbp_status',
135 'default' => 'open'
136 );
137
138 // Forum dates.
139 $this->field_map[] = array(
140 'to_type' => 'forum',
141 'to_fieldname' => 'post_date',
142 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
143 );
144 $this->field_map[] = array(
145 'to_type' => 'forum',
146 'to_fieldname' => 'post_date_gmt',
147 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
148 );
149 $this->field_map[] = array(
150 'to_type' => 'forum',
151 'to_fieldname' => 'post_modified',
152 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
153 );
154 $this->field_map[] = array(
155 'to_type' => 'forum',
156 'to_fieldname' => 'post_modified_gmt',
157 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
158 );
159
160 /** Topic Section *****************************************************/
161
162 // Old topic id (Stored in postmeta)
163 $this->field_map[] = array(
164 'from_tablename' => 'topics',
165 'from_fieldname' => 'tid',
166 'to_type' => 'topic',
167 'to_fieldname' => '_bbp_old_topic_id'
168 );
169
170 // Topic reply count (Stored in postmeta)
171 $this->field_map[] = array(
172 'from_tablename' => 'topics',
173 'from_fieldname' => 'posts',
174 'to_type' => 'topic',
175 'to_fieldname' => '_bbp_reply_count',
176 'callback_method' => 'callback_topic_reply_count'
177 );
178
179 // Topic parent forum id (If no parent, then 0. Stored in postmeta)
180 $this->field_map[] = array(
181 'from_tablename' => 'topics',
182 'from_fieldname' => 'forum_id',
183 'to_type' => 'topic',
184 'to_fieldname' => '_bbp_forum_id',
185 'callback_method' => 'callback_forumid'
186 );
187
188 // Topic author.
189 $this->field_map[] = array(
190 'from_tablename' => 'topics',
191 'from_fieldname' => 'starter_id',
192 'to_type' => 'topic',
193 'to_fieldname' => 'post_author',
194 'callback_method' => 'callback_userid'
195 );
196
197 // Topic content.
198 // Note: We join the posts table because topics do not have content.
199 $this->field_map[] = array(
200 'from_tablename' => 'posts',
201 'from_fieldname' => 'post',
202 'join_tablename' => 'topics',
203 'join_type' => 'INNER',
204 'join_expression' => 'ON(topics.tid = posts.topic_id) WHERE posts.new_topic = 1',
205 'to_type' => 'topic',
206 'to_fieldname' => 'post_content',
207 'callback_method' => 'callback_html'
208 );
209
210 // Topic title.
211 $this->field_map[] = array(
212 'from_tablename' => 'topics',
213 'from_fieldname' => 'title',
214 'to_type' => 'topic',
215 'to_fieldname' => 'post_title'
216 );
217
218 // Topic slug (Clean name to avoid conflicts)
219 $this->field_map[] = array(
220 'from_tablename' => 'topics',
221 'from_fieldname' => 'title',
222 'to_type' => 'topic',
223 'to_fieldname' => 'post_name',
224 'callback_method' => 'callback_slug'
225 );
226
227 // Topic parent forum id (If no parent, then 0)
228 $this->field_map[] = array(
229 'from_tablename' => 'topics',
230 'from_fieldname' => 'forum_id',
231 'to_type' => 'topic',
232 'to_fieldname' => 'post_parent',
233 'callback_method' => 'callback_forumid'
234 );
235
236 // Sticky status (Stored in postmeta)
237 $this->field_map[] = array(
238 'from_tablename' => 'topics',
239 'from_fieldname' => 'pinned',
240 'to_type' => 'topic',
241 'to_fieldname' => '_bbp_old_sticky_status_id',
242 'callback_method' => 'callback_sticky_status'
243 );
244
245 // Topic dates.
246 $this->field_map[] = array(
247 'from_tablename' => 'topics',
248 'from_fieldname' => 'start_date',
249 'to_type' => 'topic',
250 'to_fieldname' => 'post_date',
251 'callback_method' => 'callback_datetime'
252 );
253 $this->field_map[] = array(
254 'from_tablename' => 'topics',
255 'from_fieldname' => 'start_date',
256 'to_type' => 'topic',
257 'to_fieldname' => 'post_date_gmt',
258 'callback_method' => 'callback_datetime'
259 );
260 $this->field_map[] = array(
261 'from_tablename' => 'topics',
262 'from_fieldname' => 'last_post',
263 'to_type' => 'topic',
264 'to_fieldname' => 'post_modified',
265 'callback_method' => 'callback_datetime'
266 );
267 $this->field_map[] = array(
268 'from_tablename' => 'topics',
269 'from_fieldname' => 'last_post',
270 'to_type' => 'topic',
271 'to_fieldname' => 'post_modified_gmt',
272 'callback_method' => 'callback_datetime'
273 );
274 $this->field_map[] = array(
275 'from_tablename' => 'topics',
276 'from_fieldname' => 'last_post',
277 'to_type' => 'topic',
278 'to_fieldname' => '_bbp_last_active_time',
279 'callback_method' => 'callback_datetime'
280 );
281
282 /** Tags Section ******************************************************/
283
284 // Topic id.
285 $this->field_map[] = array(
286 'from_tablename' => 'core_tags',
287 'from_fieldname' => 'tag_meta_id',
288 'to_type' => 'tags',
289 'to_fieldname' => 'objectid',
290 'callback_method' => 'callback_topicid'
291 );
292
293 // Term text.
294 $this->field_map[] = array(
295 'from_tablename' => 'core_tags',
296 'from_fieldname' => 'tag_text',
297 'to_type' => 'tags',
298 'to_fieldname' => 'name'
299 );
300
301 /** Reply Section *****************************************************/
302
303 // Old reply id (Stored in postmeta)
304 $this->field_map[] = array(
305 'from_tablename' => 'posts',
306 'from_fieldname' => 'pid',
307 'to_type' => 'reply',
308 'to_fieldname' => '_bbp_old_reply_id'
309 );
310
311 // Reply parent forum id (If no parent, then 0. Stored in postmeta)
312 $this->field_map[] = array(
313 'from_tablename' => 'posts',
314 'from_fieldname' => 'topic_id',
315 'to_type' => 'reply',
316 'to_fieldname' => '_bbp_forum_id',
317 'callback_method' => 'callback_topicid_to_forumid'
318 );
319
320 // Reply parent topic id (If no parent, then 0. Stored in postmeta)
321 $this->field_map[] = array(
322 'from_tablename' => 'posts',
323 'from_fieldname' => 'topic_id',
324 'to_type' => 'reply',
325 'to_fieldname' => '_bbp_topic_id',
326 'callback_method' => 'callback_topicid'
327 );
328
329 // Reply author ip (Stored in postmeta)
330 $this->field_map[] = array(
331 'from_tablename' => 'posts',
332 'from_fieldname' => 'ip_address',
333 'to_type' => 'reply',
334 'to_fieldname' => '_bbp_author_ip'
335 );
336
337 // Reply author.
338 $this->field_map[] = array(
339 'from_tablename' => 'posts',
340 'from_fieldname' => 'author_id',
341 'to_type' => 'reply',
342 'to_fieldname' => 'post_author',
343 'callback_method' => 'callback_userid'
344 );
345
346 // Reply content.
347 $this->field_map[] = array(
348 'from_tablename' => 'posts',
349 'from_fieldname' => 'post',
350 'to_type' => 'reply',
351 'to_fieldname' => 'post_content',
352 'callback_method' => 'callback_html'
353 );
354
355 // Reply parent topic id (If no parent, then 0)
356 $this->field_map[] = array(
357 'from_tablename' => 'posts',
358 'from_fieldname' => 'topic_id',
359 'to_type' => 'reply',
360 'to_fieldname' => 'post_parent',
361 'callback_method' => 'callback_topicid'
362 );
363
364 // Reply dates.
365 $this->field_map[] = array(
366 'from_tablename' => 'posts',
367 'from_fieldname' => 'post_date',
368 'to_type' => 'reply',
369 'to_fieldname' => 'post_date',
370 'callback_method' => 'callback_datetime'
371 );
372 $this->field_map[] = array(
373 'from_tablename' => 'posts',
374 'from_fieldname' => 'post_date',
375 'to_type' => 'reply',
376 'to_fieldname' => 'post_date_gmt',
377 'callback_method' => 'callback_datetime'
378 );
379 $this->field_map[] = array(
380 'from_tablename' => 'posts',
381 'from_fieldname' => 'edit_time',
382 'to_type' => 'reply',
383 'to_fieldname' => 'post_modified',
384 'callback_method' => 'callback_datetime'
385 );
386 $this->field_map[] = array(
387 'from_tablename' => 'posts',
388 'from_fieldname' => 'edit_time',
389 'to_type' => 'reply',
390 'to_fieldname' => 'post_modified_gmt',
391 'callback_method' => 'callback_datetime'
392 );
393
394 /** User Section ******************************************************/
395
396 // Store old user id (Stored in usermeta)
397 $this->field_map[] = array(
398 'from_tablename' => 'members',
399 'from_fieldname' => 'member_id',
400 'to_type' => 'user',
401 'to_fieldname' => '_bbp_old_user_id'
402 );
403
404 // Store old user password (Stored in usermeta serialized with salt)
405 $this->field_map[] = array(
406 'from_tablename' => 'members',
407 'from_fieldname' => 'members_pass_hash',
408 'to_type' => 'user',
409 'to_fieldname' => '_bbp_password',
410 'callback_method' => 'callback_savepass'
411 );
412
413 // Store old user salt (This is only used for the SELECT row info for the above password save)
414 $this->field_map[] = array(
415 'from_tablename' => 'members',
416 'from_fieldname' => 'members_pass_salt',
417 'to_type' => 'user',
418 'to_fieldname' => ''
419 );
420
421 // User password verify class (Stored in usermeta for verifying password)
422 $this->field_map[] = array(
423 'to_type' => 'user',
424 'to_fieldname' => '_bbp_class',
425 'default' => 'Invision'
426 );
427
428 // User name.
429 $this->field_map[] = array(
430 'from_tablename' => 'members',
431 'from_fieldname' => 'name',
432 'to_type' => 'user',
433 'to_fieldname' => 'user_login'
434 );
435
436 // User nice name.
437 $this->field_map[] = array(
438 'from_tablename' => 'members',
439 'from_fieldname' => 'name',
440 'to_type' => 'user',
441 'to_fieldname' => 'user_nicename'
442 );
443
444 // User email.
445 $this->field_map[] = array(
446 'from_tablename' => 'members',
447 'from_fieldname' => 'email',
448 'to_type' => 'user',
449 'to_fieldname' => 'user_email'
450 );
451
452 // User registered.
453 $this->field_map[] = array(
454 'from_tablename' => 'members',
455 'from_fieldname' => 'joined',
456 'to_type' => 'user',
457 'to_fieldname' => 'user_registered',
458 'callback_method' => 'callback_datetime'
459 );
460
461 // User display name.
462 $this->field_map[] = array(
463 'from_tablename' => 'members',
464 'from_fieldname' => 'members_display_name',
465 'to_type' => 'user',
466 'to_fieldname' => 'display_name'
467 );
468 }
469
470 /**
471 * This method allows us to indicates what is or is not converted for each
472 * converter.
473 */
474 public function info() {
475 return '';
476 }
477
478 /**
479 * Translate the forum type from Invision numerics to WordPress's strings.
480 *
481 * @param int $status Invision numeric forum type
482 * @return string WordPress safe
483 */
484 public function callback_forum_type( $status = 0 ) {
485 if ( -1 === (int) $status ) {
486 $status = 'category';
487 } else {
488 $status = 'forum';
489 }
490 return $status;
491 }
492
493 /**
494 * Translate the topic sticky status type from Invision numerics to WordPress's strings.
495 *
496 * @param int $status Invision numeric forum type
497 * @return string WordPress safe
498 */
499 public function callback_sticky_status( $status = 0 ) {
500 switch ( $status ) {
501 case 1 :
502 $status = 'sticky'; // Invision Pinned Topic 'pinned = 1'
503 break;
504
505 case 0 :
506 default :
507 $status = 'normal'; // Invision Normal Topic 'pinned = 0'
508 break;
509 }
510 return $status;
511 }
512
513 /**
514 * Verify the topic reply count.
515 *
516 * @param int $count Invision reply count
517 * @return string WordPress safe
518 */
519 public function callback_topic_reply_count( $count = 1 ) {
520 $count = absint( (int) $count - 1 );
521 return $count;
522 }
523
524 /**
525 * Save the salt and password together. Pre-slash the salt because WordPress
526 * removes one layer of slashes when storing user metadata.
527 */
528 public function callback_savepass( $field, $row ) {
529 return array(
530 'hash' => $field,
531 'salt' => isset( $row['members_pass_salt'] ) ? wp_slash( (string) $row['members_pass_salt'] ) : ''
532 );
533 }
534
535 /**
536 * This method is to take the pass out of the database and compare
537 * to a pass the user has typed in.
538 */
539 public function authenticate_pass( $password, $serialized_pass ) {
540
541 // Unserialize the password, with safeguards
542 $pass_array = $this->unserialize_pass( $serialized_pass );
543
544 // Bail if missing or invalid values
545 if ( ! is_string( $password ) || ! is_array( $pass_array ) || ! isset( $pass_array['hash'], $pass_array['salt'] ) || ! is_string( $pass_array['hash'] ) || ! is_string( $pass_array['salt'] ) ) {
546 return false;
547 }
548
549 $salt_hash = md5( $pass_array['salt'] );
550 $hash = md5( $salt_hash . md5( $this->clean_password( $password ) ) );
551 $old_hash = md5( $salt_hash . md5( $this->to_char( $password ) ) );
552
553 // Retain support for metadata compatible with the historical verifier
554 $hash_matches = hash_equals( $pass_array['hash'], $hash );
555 $old_hash_matches = hash_equals( $pass_array['hash'], $old_hash );
556
557 return $hash_matches || $old_hash_matches;
558 }
559
560 /**
561 * Apply IP.Board 3's password input cleaning.
562 *
563 * @param string $password Password in plain text.
564 * @return string Cleaned password.
565 */
566 private function clean_password( $password ) {
567 $password = str_replace( '&#032;', ' ', $password );
568 $password = str_replace( array( "\r\n", "\n\r", "\r" ), "\n", $password );
569 $password = str_replace( '&', '&amp;', $password );
570 $password = str_replace( '<!--', '&#60;&#33;--', $password );
571 $password = str_replace( '-->', '--&#62;', $password );
572 $password = str_ireplace( '<script', '&#60;script', $password );
573 $password = str_replace( '>', '&gt;', $password );
574 $password = str_replace( '<', '&lt;', $password );
575 $password = str_replace( '"', '&quot;', $password );
576 $password = str_replace( "\n", '<br />', $password );
577 $password = str_replace( '$', '&#036;', $password );
578 $password = str_replace( '!', '&#33;', $password );
579
580 return str_replace( "'", '&#39;', $password );
581 }
582
583 /**
584 * Apply the historical bbPress Invision password transformation.
585 *
586 * @param string $input Password in plain text.
587 * @return string Transformed password.
588 */
589 private function to_char( $input ) {
590 $output = '';
591 $length = strlen( $input );
592 for ( $i = 0; $i < $length; $i++ ) {
593 $j = ord( $input[ $i ] );
594 if ( ( $j >= 65 && $j <= 90 )
595 || ( $j >= 97 && $j <= 122 )
596 || ( $j >= 48 && $j <= 57 ) ) {
597 $output .= $input[ $i ];
598 } else {
599 $output .= '&#' . ord( $input[ $i ] ) . ';';
600 }
601 }
602 return $output;
603 }
604
605 /**
606 * This callback processes any custom BBCodes with parser.php
607 */
608 protected function callback_html( $field ) {
609
610 // Strips Invision custom HTML first from $field before parsing $field to parser.php
611 $invision_markup = $field;
612 $invision_markup = html_entity_decode( $invision_markup );
613
614 // Replace '[html]' with '<pre><code>'
615 $invision_markup = preg_replace( '/\[html\]/', '<pre><code>', $invision_markup );
616 // Replace '[/html]' with '</code></pre>'
617 $invision_markup = preg_replace( '/\[\/html\]/', '</code></pre>', $invision_markup );
618 // Replace '[sql]' with '<pre><code>'
619 $invision_markup = preg_replace( '/\[sql\]/', '<pre><code>', $invision_markup );
620 // Replace '[/sql]' with '</code></pre>'
621 $invision_markup = preg_replace( '/\[\/sql\]/', '</code></pre>', $invision_markup );
622 // Replace '[php]' with '<pre><code>'
623 $invision_markup = preg_replace( '/\[php\]/', '<pre><code>', $invision_markup );
624 // Replace '[/php]' with '</code></pre>'
625 $invision_markup = preg_replace( '/\[\/php\]/', '</code></pre>', $invision_markup );
626 // Replace '[xml]' with '<pre><code>'
627 $invision_markup = preg_replace( '/\[xml\]/', '<pre><code>', $invision_markup );
628 // Replace '[/xml]' with '</code></pre>'
629 $invision_markup = preg_replace( '/\[\/xml\]/', '</code></pre>', $invision_markup );
630 // Replace '[CODE]' with '<pre><code>'
631 $invision_markup = preg_replace( '/\[CODE\]/', '<pre><code>', $invision_markup );
632 // Replace '[/CODE]' with '</code></pre>'
633 $invision_markup = preg_replace( '/\[\/CODE\]/', '</code></pre>', $invision_markup );
634
635 // Replace '[quote:XXXXXXX]' with '<blockquote>'
636 $invision_markup = preg_replace( '/\[quote:(.*?)\]/', '<blockquote>', $invision_markup );
637 // Replace '[quote="$1"]' with '<em>@$1 wrote:</em><blockquote>'
638 $invision_markup = preg_replace( '/\[quote="(.*?)":(.*?)\]/', '<em>@$1 wrote:</em><blockquote>', $invision_markup );
639 // Replace '[/quote:XXXXXXX]' with '</blockquote>'
640 $invision_markup = preg_replace( '/\[\/quote:(.*?)\]/', '</blockquote>', $invision_markup );
641
642 // Replace '[twitter]$1[/twitter]' with '<a href="https://twitter.com/$1">@$1</a>"
643 $invision_markup = preg_replace( '/\[twitter\](.*?)\[\/twitter\]/', '<a href="https://twitter.com/$1">@$1</a>', $invision_markup );
644
645 // Replace '[member='username']' with '@username"
646 $invision_markup = preg_replace( '/\[member=\'(.*?)\'\]/', '@$1 ', $invision_markup );
647
648 // Replace '[media]' with ''
649 $invision_markup = preg_replace( '/\[media\]/', '', $invision_markup );
650 // Replace '[/media]' with ''
651 $invision_markup = preg_replace( '/\[\/media\]/', '', $invision_markup );
652
653 // Replace '[list:XXXXXXX]' with '<ul>'
654 $invision_markup = preg_replace( '/\[list\]/', '<ul>', $invision_markup );
655 // Replace '[list=1:XXXXXXX]' with '<ul>'
656 $invision_markup = preg_replace( '/\[list=1\]/', '<ul>', $invision_markup );
657 // Replace '[*:XXXXXXX]' with '<li>'
658 $invision_markup = preg_replace( '/\[\*\](.*?)\<br \/\>/', '<li>$1</li>', $invision_markup );
659 // Replace '[/list:u:XXXXXXX]' with '</ul>'
660 $invision_markup = preg_replace( '/\[\/list\]/', '</ul>', $invision_markup );
661
662 // Replace '[hr]' with '<hr>"
663 $invision_markup = preg_replace( '/\[hr\]/', '<hr>', $invision_markup );
664
665 // Replace '[font=XXXXXXX]' with ''
666 $invision_markup = preg_replace( '/\[font=(.*?)\]/', '', $invision_markup );
667 // Replace '[/font]' with ''
668 $invision_markup = preg_replace( '/\[\/font\]/', '', $invision_markup );
669
670 // Replace any Invision smilies from path '/sp-resources/forum-smileys/sf-smily.gif' with the equivelant WordPress Smilie
671 $invision_markup = preg_replace( '/\<img src=(.*?)EMO\_DIR(.*?)bbc_emoticon(.*?)alt=\'(.*?)\' \/\>/', '$4', $invision_markup );
672 $invision_markup = preg_replace( '/\:angry\:/', ':mad:', $invision_markup );
673 $invision_markup = preg_replace( '/\:mellow\:/', ':neutral:', $invision_markup );
674 $invision_markup = preg_replace( '/\:blink\:/', ':eek:', $invision_markup );
675 $invision_markup = preg_replace( '/B\)/', ':cool:', $invision_markup );
676 $invision_markup = preg_replace( '/\:rolleyes\:/', ':roll:', $invision_markup );
677 $invision_markup = preg_replace( '/\:unsure\:/', ':???:', $invision_markup );
678
679 // Now that Invision custom HTML has been stripped put the cleaned HTML back in $field
680 $field = $invision_markup;
681
682 // Parse out any bbCodes in $field with the BBCode 'parser.php'
683 return parent::callback_html( $field );
684 }
685 }
686