Invision

Implementation of Invision Power Board v3.x converter.

Defined (1)

The class is defined in the following location(s).

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