XMB

Implementation of XMB Forum converter.

Defined (1)

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

/includes/admin/converters/XMB.php  
  1. class XMB extends BBP_Converter_Base { 
  2.  
  3. /** 
  4. * Main Constructor 
  5. * @uses XMB::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' => 'fid',  
  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' => 'fup',  
  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' => 'threads',  
  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 (Includes unpublished topics, Stored in postmeta) 
  51. $this->field_map[] = array( 
  52. 'from_tablename' => 'forums',  
  53. 'from_fieldname' => 'threads',  
  54. 'to_type' => 'forum',  
  55. 'to_fieldname' => '_bbp_total_topic_count' 
  56. ); 
  57.  
  58. // Forum total reply count (Includes unpublished replies, 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 conflicts) 
  75. $this->field_map[] = array( 
  76. 'from_tablename' => 'forums',  
  77. 'from_fieldname' => 'name',  
  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' => 'displayorder',  
  96. 'to_type' => 'forum',  
  97. 'to_fieldname' => 'menu_order' 
  98. ); 
  99.  
  100. // Forum type (Category = 'group', Forum = 'forum' or 'sub', Stored in postmeta) 
  101. $this->field_map[] = array( 
  102. 'from_tablename' => 'forums',  
  103. 'from_fieldname' => 'type',  
  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' => 'threads',  
  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' => 'threads',  
  144. 'from_fieldname' => 'replies',  
  145. 'to_type' => 'topic',  
  146. 'to_fieldname' => '_bbp_reply_count',  
  147. 'callback_method' => 'callback_topic_reply_count' 
  148. ); 
  149.  
  150. // Topic total reply count (Includes unpublished replies, Stored in postmeta) 
  151. $this->field_map[] = array( 
  152. 'from_tablename' => 'threads',  
  153. 'from_fieldname' => 'replies',  
  154. 'to_type' => 'topic',  
  155. 'to_fieldname' => '_bbp_total_reply_count',  
  156. 'callback_method' => 'callback_topic_reply_count' 
  157. ); 
  158.  
  159. // Topic parent forum id (If no parent, then 0. Stored in postmeta) 
  160. $this->field_map[] = array( 
  161. 'from_tablename' => 'threads',  
  162. 'from_fieldname' => 'fid',  
  163. 'to_type' => 'topic',  
  164. 'to_fieldname' => '_bbp_forum_id',  
  165. 'callback_method' => 'callback_forumid' 
  166. ); 
  167.  
  168. // Topic author. 
  169. // Note: We join the 'members' table because 'threads' table does not have numerical author id. 
  170. $this->field_map[] = array( 
  171. 'from_tablename' => 'members',  
  172. 'from_fieldname' => 'uid',  
  173. 'join_tablename' => 'threads',  
  174. 'join_type' => 'LEFT',  
  175. 'join_expression' => 'ON threads.author = members.username',  
  176. 'to_type' => 'topic',  
  177. 'to_fieldname' => 'post_author',  
  178. 'callback_method' => 'callback_userid' 
  179. ); 
  180.  
  181. // Topic Author ip (Stored in postmeta) 
  182. // Note: We join the 'posts' table because 'threads' table does not have author ip. 
  183. $this->field_map[] = array( 
  184. 'from_tablename' => 'posts',  
  185. 'from_fieldname' => 'useip',  
  186. 'join_tablename' => 'threads',  
  187. 'join_type' => 'INNER',  
  188. 'join_expression' => 'USING (tid) WHERE posts.subject != ""',  
  189. 'to_type' => 'topic',  
  190. 'to_fieldname' => '_bbp_author_ip' 
  191. ); 
  192.  
  193. // Topic content. 
  194. // Note: We join the 'posts' table because 'threads' table does not have content. 
  195. $this->field_map[] = array( 
  196. 'from_tablename' => 'posts',  
  197. 'from_fieldname' => 'message',  
  198. 'join_tablename' => 'threads',  
  199. 'join_type' => 'INNER',  
  200. 'join_expression' => 'USING (tid) WHERE posts.subject != ""',  
  201. 'to_type' => 'topic',  
  202. 'to_fieldname' => 'post_content',  
  203. 'callback_method' => 'callback_html' 
  204. ); 
  205.  
  206. // Topic title. 
  207. $this->field_map[] = array( 
  208. 'from_tablename' => 'threads',  
  209. 'from_fieldname' => 'subject',  
  210. 'to_type' => 'topic',  
  211. 'to_fieldname' => 'post_title' 
  212. ); 
  213.  
  214. // Topic slug (Clean name to avoid conflicts) 
  215. $this->field_map[] = array( 
  216. 'from_tablename' => 'threads',  
  217. 'from_fieldname' => 'subject',  
  218. 'to_type' => 'topic',  
  219. 'to_fieldname' => 'post_name',  
  220. 'callback_method' => 'callback_slug' 
  221. ); 
  222.  
  223. // Topic parent forum id (If no parent, then 0) 
  224. $this->field_map[] = array( 
  225. 'from_tablename' => 'threads',  
  226. 'from_fieldname' => 'fid',  
  227. 'to_type' => 'topic',  
  228. 'to_fieldname' => 'post_parent',  
  229. 'callback_method' => 'callback_forumid' 
  230. ); 
  231.  
  232. // Topic status (Open or Closed, XMB v1.9.11.13 ''=open & 'yes'=closed) 
  233. $this->field_map[] = array( 
  234. 'from_tablename' => 'threads',  
  235. 'from_fieldname' => 'closed',  
  236. 'to_type' => 'topic',  
  237. 'to_fieldname' => 'post_status',  
  238. 'callback_method' => 'callback_topic_status' 
  239. ); 
  240.  
  241. // Sticky status (Stored in postmeta)) 
  242. $this->field_map[] = array( 
  243. 'from_tablename' => 'threads',  
  244. 'from_fieldname' => 'topped',  
  245. 'to_type' => 'topic',  
  246. 'to_fieldname' => '_bbp_old_sticky_status',  
  247. 'callback_method' => 'callback_sticky_status' 
  248. ); 
  249.  
  250. // Topic dates. 
  251. // Note: We join the 'posts' table because 'threads' table does not include dates. 
  252. $this->field_map[] = array( 
  253. 'from_tablename' => 'posts',  
  254. 'from_fieldname' => 'dateline',  
  255. 'join_tablename' => 'threads',  
  256. 'join_type' => 'INNER',  
  257. 'join_expression' => 'USING (tid) WHERE posts.subject != ""',  
  258. 'to_type' => 'topic',  
  259. 'to_fieldname' => 'post_date',  
  260. 'callback_method' => 'callback_datetime' 
  261. ); 
  262. $this->field_map[] = array( 
  263. 'from_tablename' => 'posts',  
  264. 'from_fieldname' => 'dateline',  
  265. 'join_tablename' => 'threads',  
  266. 'join_type' => 'INNER',  
  267. 'join_expression' => 'USING (tid) WHERE posts.subject != ""',  
  268. 'to_type' => 'topic',  
  269. 'to_fieldname' => 'post_date_gmt',  
  270. 'callback_method' => 'callback_datetime' 
  271. ); 
  272. $this->field_map[] = array( 
  273. 'from_tablename' => 'posts',  
  274. 'from_fieldname' => 'dateline',  
  275. 'join_tablename' => 'threads',  
  276. 'join_type' => 'INNER',  
  277. 'join_expression' => 'USING (tid) WHERE posts.subject != ""',  
  278. 'to_type' => 'topic',  
  279. 'to_fieldname' => 'post_modified',  
  280. 'callback_method' => 'callback_datetime' 
  281. ); 
  282. $this->field_map[] = array( 
  283. 'from_tablename' => 'posts',  
  284. 'from_fieldname' => 'dateline',  
  285. 'join_tablename' => 'threads',  
  286. 'join_type' => 'INNER',  
  287. 'join_expression' => 'USING (tid) WHERE posts.subject != ""',  
  288. 'to_type' => 'topic',  
  289. 'to_fieldname' => 'post_modified_gmt',  
  290. 'callback_method' => 'callback_datetime' 
  291. ); 
  292. $this->field_map[] = array( 
  293. 'from_tablename' => 'posts',  
  294. 'from_fieldname' => 'dateline',  
  295. 'join_tablename' => 'threads',  
  296. 'join_type' => 'INNER',  
  297. 'join_expression' => 'USING (tid) WHERE posts.subject != ""',  
  298. 'to_type' => 'topic',  
  299. 'to_fieldname' => '_bbp_last_active_time',  
  300. 'callback_method' => 'callback_datetime' 
  301. ); 
  302.  
  303. /** Tags Section ******************************************************/ 
  304.  
  305. /** 
  306. * XMB v1.9.11.13 Forums do not support topic tags out of the box 
  307. */ 
  308.  
  309. /** Reply Section *****************************************************/ 
  310.  
  311. // Reply id (Stored in postmeta) 
  312. $this->field_map[] = array( 
  313. 'from_tablename' => 'posts',  
  314. 'from_fieldname' => 'pid',  
  315. 'to_type' => 'reply',  
  316. 'to_fieldname' => '_bbp_post_id' 
  317. ); 
  318.  
  319. // Reply parent forum id (If no parent, then 0. Stored in postmeta) 
  320. $this->field_map[] = array( 
  321. 'from_tablename' => 'posts',  
  322. 'from_fieldname' => 'fid',  
  323. 'to_type' => 'reply',  
  324. 'to_fieldname' => '_bbp_forum_id',  
  325. 'callback_method' => 'callback_topicid_to_forumid' 
  326. ); 
  327.  
  328. // Reply parent topic id (If no parent, then 0. Stored in postmeta) 
  329. $this->field_map[] = array( 
  330. 'from_tablename' => 'posts',  
  331. 'from_fieldname' => 'tid',  
  332. 'to_type' => 'reply',  
  333. 'to_fieldname' => '_bbp_topic_id',  
  334. 'callback_method' => 'callback_topicid' 
  335. ); 
  336.  
  337. // Reply author ip (Stored in postmeta) 
  338. $this->field_map[] = array( 
  339. 'from_tablename' => 'posts',  
  340. 'from_fieldname' => 'useip',  
  341. 'to_type' => 'reply',  
  342. 'to_fieldname' => '_bbp_author_ip' 
  343. ); 
  344.  
  345. // Reply author. 
  346. // Note: We join the 'members' table because 'posts' table does not have numerical author id. 
  347. $this->field_map[] = array( 
  348. 'from_tablename' => 'members',  
  349. 'from_fieldname' => 'uid',  
  350. 'join_tablename' => 'posts',  
  351. 'join_type' => 'LEFT',  
  352. 'join_expression' => 'ON posts.author = members.username',  
  353. 'to_type' => 'reply',  
  354. 'to_fieldname' => 'post_author',  
  355. 'callback_method' => 'callback_userid' 
  356. ); 
  357.  
  358. // Reply title. 
  359. // Note: We join the 'threads' table because 'posts' table does not have topic title. 
  360. $this->field_map[] = array( 
  361. 'from_tablename' => 'threads',  
  362. 'from_fieldname' => 'subject',  
  363. 'join_tablename' => 'posts',  
  364. 'join_type' => 'INNER',  
  365. 'join_expression' => 'USING (tid) WHERE posts.subject = ""',  
  366. 'to_type' => 'reply',  
  367. 'to_fieldname' => 'post_title',  
  368. 'callback_method' => 'callback_reply_title' 
  369. ); 
  370.  
  371. // Reply slug (Clean name to avoid conflicts) 
  372. // Note: We join the 'threads' table because 'posts' table does not have topic title. 
  373. $this->field_map[] = array( 
  374. 'from_tablename' => 'threads',  
  375. 'from_fieldname' => 'subject',  
  376. 'join_tablename' => 'posts',  
  377. 'join_type' => 'INNER',  
  378. 'join_expression' => 'USING (tid) WHERE posts.subject = ""',  
  379. 'to_type' => 'reply',  
  380. 'to_fieldname' => 'post_name',  
  381. 'callback_method' => 'callback_slug' 
  382. ); 
  383.  
  384. // Reply content. 
  385. $this->field_map[] = array( 
  386. 'from_tablename' => 'posts',  
  387. 'from_fieldname' => 'message',  
  388. 'to_type' => 'reply',  
  389. 'to_fieldname' => 'post_content',  
  390. 'callback_method' => 'callback_html' 
  391. ); 
  392.  
  393. // Reply parent topic id (If no parent, then 0) 
  394. $this->field_map[] = array( 
  395. 'from_tablename' => 'posts',  
  396. 'from_fieldname' => 'tid',  
  397. 'to_type' => 'reply',  
  398. 'to_fieldname' => 'post_parent',  
  399. 'callback_method' => 'callback_topicid' 
  400. ); 
  401.  
  402. // Reply dates. 
  403. $this->field_map[] = array( 
  404. 'from_tablename' => 'posts',  
  405. 'from_fieldname' => 'dateline',  
  406. 'to_type' => 'reply',  
  407. 'to_fieldname' => 'post_date',  
  408. 'callback_method' => 'callback_datetime' 
  409. ); 
  410. $this->field_map[] = array( 
  411. 'from_tablename' => 'posts',  
  412. 'from_fieldname' => 'dateline',  
  413. 'to_type' => 'reply',  
  414. 'to_fieldname' => 'post_date_gmt',  
  415. 'callback_method' => 'callback_datetime' 
  416. ); 
  417. $this->field_map[] = array( 
  418. 'from_tablename' => 'posts',  
  419. 'from_fieldname' => 'dateline',  
  420. 'to_type' => 'reply',  
  421. 'to_fieldname' => 'post_modified',  
  422. 'callback_method' => 'callback_datetime' 
  423. ); 
  424. $this->field_map[] = array( 
  425. 'from_tablename' => 'posts',  
  426. 'from_fieldname' => 'dateline',  
  427. 'to_type' => 'reply',  
  428. 'to_fieldname' => 'post_modified_gmt',  
  429. 'callback_method' => 'callback_datetime' 
  430. ); 
  431.  
  432. /** User Section ******************************************************/ 
  433.  
  434. // Store old User id (Stored in usermeta) 
  435. $this->field_map[] = array( 
  436. 'from_tablename' => 'members',  
  437. 'from_fieldname' => 'uid',  
  438. 'to_type' => 'user',  
  439. 'to_fieldname' => '_bbp_user_id' 
  440. ); 
  441.  
  442. // Store old User password (Stored in usermeta serialized with salt) 
  443. $this->field_map[] = array( 
  444. 'from_tablename' => 'members',  
  445. 'from_fieldname' => 'password',  
  446. 'to_type' => 'user',  
  447. 'to_fieldname' => '_bbp_password',  
  448. 'callback_method' => 'callback_savepass' 
  449. ); 
  450.  
  451. // Store old User Salt (This is only used for the SELECT row info for the above password save) 
  452. // $this->field_map[] = array( 
  453. // 'from_tablename' => 'members',  
  454. // 'from_fieldname' => 'salt',  
  455. // 'to_type' => 'user',  
  456. // 'to_fieldname' => '' 
  457. // ); 
  458.  
  459. // User password verify class (Stored in usermeta for verifying password) 
  460. $this->field_map[] = array( 
  461. 'to_type' => 'members',  
  462. 'to_fieldname' => '_bbp_class',  
  463. 'default' => 'XMB' 
  464. ); 
  465.  
  466. // User name. 
  467. $this->field_map[] = array( 
  468. 'from_tablename' => 'members',  
  469. 'from_fieldname' => 'username',  
  470. 'to_type' => 'user',  
  471. 'to_fieldname' => 'user_login' 
  472. ); 
  473.  
  474. // User nice name. 
  475. $this->field_map[] = array( 
  476. 'from_tablename' => 'members',  
  477. 'from_fieldname' => 'username',  
  478. 'to_type' => 'user',  
  479. 'to_fieldname' => 'user_nicename' 
  480. ); 
  481.  
  482. // User email. 
  483. $this->field_map[] = array( 
  484. 'from_tablename' => 'members',  
  485. 'from_fieldname' => 'email',  
  486. 'to_type' => 'user',  
  487. 'to_fieldname' => 'user_email' 
  488. ); 
  489.  
  490. // User homepage. 
  491. $this->field_map[] = array( 
  492. 'from_tablename' => 'members',  
  493. 'from_fieldname' => 'site',  
  494. 'to_type' => 'user',  
  495. 'to_fieldname' => 'user_url' 
  496. ); 
  497.  
  498. // User registered. 
  499. $this->field_map[] = array( 
  500. 'from_tablename' => 'members',  
  501. 'from_fieldname' => 'regdate',  
  502. 'to_type' => 'user',  
  503. 'to_fieldname' => 'user_registered',  
  504. 'callback_method' => 'callback_datetime' 
  505. ); 
  506.  
  507. // User AIM (Stored in usermeta) 
  508. $this->field_map[] = array( 
  509. 'from_tablename' => 'members',  
  510. 'from_fieldname' => 'aim',  
  511. 'to_type' => 'user',  
  512. 'to_fieldname' => 'aim' 
  513. ); 
  514.  
  515. // User Yahoo (Stored in usermeta) 
  516. $this->field_map[] = array( 
  517. 'from_tablename' => 'members',  
  518. 'from_fieldname' => 'yahoo',  
  519. 'to_type' => 'user',  
  520. 'to_fieldname' => 'yim' 
  521. ); 
  522.  
  523. // Store ICQ (Stored in usermeta) 
  524. $this->field_map[] = array( 
  525. 'from_tablename' => 'members',  
  526. 'from_fieldname' => 'icq',  
  527. 'to_type' => 'user',  
  528. 'to_fieldname' => '_bbp_xmb_user_icq' 
  529. ); 
  530.  
  531. // Store MSN (Stored in usermeta) 
  532. $this->field_map[] = array( 
  533. 'from_tablename' => 'members',  
  534. 'from_fieldname' => 'msn',  
  535. 'to_type' => 'user',  
  536. 'to_fieldname' => '_bbp_xmb_user_msn' 
  537. ); 
  538.  
  539. // Store Signature (Stored in usermeta) 
  540. $this->field_map[] = array( 
  541. 'from_tablename' => 'members',  
  542. 'from_fieldname' => 'sig',  
  543. 'to_type' => 'user',  
  544. 'to_fieldname' => '_bbp_xmb_user_sig',  
  545. 'callback_method' => 'callback_html' 
  546. ); 
  547.  
  548. // Store Bio (Stored in usermeta) 
  549. $this->field_map[] = array( 
  550. 'from_tablename' => 'members',  
  551. 'from_fieldname' => 'bio',  
  552. 'to_type' => 'user',  
  553. 'to_fieldname' => '_bbp_xmb_user_bio',  
  554. 'callback_method' => 'callback_html' 
  555. ); 
  556.  
  557. // Store Location (Stored in usermeta) 
  558. $this->field_map[] = array( 
  559. 'from_tablename' => 'members',  
  560. 'from_fieldname' => 'location',  
  561. 'to_type' => 'user',  
  562. 'to_fieldname' => '_bbp_xmb_user_location' 
  563. ); 
  564.  
  565. // Store Avatar (Stored in usermeta) 
  566. $this->field_map[] = array( 
  567. 'from_tablename' => 'members',  
  568. 'from_fieldname' => 'avatar',  
  569. 'to_type' => 'user',  
  570. 'to_fieldname' => '_bbp_xmb_user_avatar' 
  571. ); 
  572.  
  573. // Store Mood (Stored in usermeta) 
  574. $this->field_map[] = array( 
  575. 'from_tablename' => 'members',  
  576. 'from_fieldname' => 'mood',  
  577. 'to_type' => 'user',  
  578. 'to_fieldname' => '_bbp_xmb_user_mood' 
  579. ); 
  580.  
  581.  
  582. /** 
  583. * This method allows us to indicates what is or is not converted for each 
  584. * converter. 
  585. */ 
  586. public function info() 
  587. return ''; 
  588.  
  589. /** 
  590. * This method is to save the salt and password together. That 
  591. * way when we authenticate it we can get it out of the database 
  592. * as one value. Array values are auto sanitized by WordPress. 
  593. */ 
  594. public function callback_savepass( $field, $row ) 
  595. $pass_array = array( 'hash' => $field, 'salt' => $row['salt'] ); 
  596. return $pass_array; 
  597.  
  598. /** 
  599. * This method is to take the pass out of the database and compare 
  600. * to a pass the user has typed in. 
  601. */ 
  602. public function authenticate_pass( $password, $serialized_pass ) 
  603. $pass_array = unserialize( $serialized_pass ); 
  604. return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) ); 
  605.  
  606. /** 
  607. * Translate the forum type from XMB v1.9.11.13 Capitalised case to WordPress's non-capatilise case strings. 
  608. * @param int $status XMB v1.9.11.13 numeric forum type 
  609. * @return string WordPress safe 
  610. */ 
  611. public function callback_forum_type( $status = 1 ) { 
  612. switch ( $status ) { 
  613. case 'group' : 
  614. $status = 'category'; 
  615. break; 
  616.  
  617. case 'sub' : 
  618. $status = 'forum'; 
  619. break; 
  620.  
  621. case 'forum' : 
  622. default : 
  623. $status = 'forum'; 
  624. break; 
  625. return $status; 
  626.  
  627. /** 
  628. * Translate the post status from XMB v1.9.11.13 numeric's to WordPress's strings. 
  629. * @param int $status XMB v1.9.11.13 numeric topic status 
  630. * @return string WordPress safe 
  631. */ 
  632. public function callback_topic_status( $status = '' ) { 
  633. switch ( $status ) { 
  634. case 'yes' : 
  635. $status = 'closed'; 
  636. break; 
  637.  
  638. case '' : 
  639. default : 
  640. $status = 'publish'; 
  641. break; 
  642. return $status; 
  643.  
  644. /** 
  645. * Translate the topic sticky status type from XMB v1.9.11.13 numeric's to WordPress's strings. 
  646. * @param int $status XMB v1.9.11.13 numeric forum type 
  647. * @return string WordPress safe 
  648. */ 
  649. public function callback_sticky_status( $status = 0 ) { 
  650. switch ( $status ) { 
  651. case 1 : 
  652. $status = 'sticky'; // XMB Sticky 'topped = 1' 
  653. break; 
  654.  
  655. case 0 : 
  656. default : 
  657. $status = 'normal'; // XMB Normal Topic 'topped = 0' 
  658. break; 
  659. return $status; 
  660.  
  661. /** 
  662. * Verify the topic/reply count. 
  663. * @param int $count XMB v1.9.11.13 topic/reply counts 
  664. * @return string WordPress safe 
  665. */ 
  666. public function callback_topic_reply_count( $count = 1 ) { 
  667. $count = absint( (int) $count - 1 ); 
  668. return $count; 
  669.  
  670. /** 
  671. * Set the reply title 
  672. * @param string $title XMB v1.9.11.13 topic title of this reply 
  673. * @return string Prefixed topic title, or empty string 
  674. */ 
  675. public function callback_reply_title( $title = '' ) { 
  676. $title = !empty( $title ) ? __( 'Re: ', 'bbpress' ) . html_entity_decode( $title ) : ''; 
  677. return $title; 
  678.