PluginProbe
bbPress / 2.6.17
bbPress v2.6.17
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 2.2 2.2.1 All 72 releases
bbpress / includes / admin / converters / PunBB.php

PunBB.php in bbPress 2.6.17, at includes/admin/converters/PunBB.php

760 lines 21.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * bbPress PunBB Converter
5 *
6 * @package bbPress
7 * @subpackage Converters
8 */
9
10 /**
11 * Implementation of PunBB v1.4.2 Forum converter.
12 *
13 * @since 2.5.0 bbPress (r5153)
14 *
15 * @link Codex Docs https://codex.bbpress.org/import-forums/punbb
16 */
17 class PunBB 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 /** Forum Section *****************************************************/
33
34 // Old forum id (Stored in postmeta)
35 $this->field_map[] = array(
36 'from_tablename' => 'forums',
37 'from_fieldname' => 'id',
38 'to_type' => 'forum',
39 'to_fieldname' => '_bbp_old_forum_id'
40 );
41
42 // Forum topic count (Stored in postmeta)
43 $this->field_map[] = array(
44 'from_tablename' => 'forums',
45 'from_fieldname' => 'num_topics',
46 'to_type' => 'forum',
47 'to_fieldname' => '_bbp_topic_count'
48 );
49
50 // Forum reply count (Stored in postmeta)
51 $this->field_map[] = array(
52 'from_tablename' => 'forums',
53 'from_fieldname' => 'num_posts',
54 'to_type' => 'forum',
55 'to_fieldname' => '_bbp_reply_count'
56 );
57
58 // Forum total topic count (Includes unpublished topics, Stored in postmeta)
59 $this->field_map[] = array(
60 'from_tablename' => 'forums',
61 'from_fieldname' => 'num_topics',
62 'to_type' => 'forum',
63 'to_fieldname' => '_bbp_total_topic_count'
64 );
65
66 // Forum total reply count (Includes unpublished replies, Stored in postmeta)
67 $this->field_map[] = array(
68 'from_tablename' => 'forums',
69 'from_fieldname' => 'num_posts',
70 'to_type' => 'forum',
71 'to_fieldname' => '_bbp_total_reply_count'
72 );
73
74 // Forum title.
75 $this->field_map[] = array(
76 'from_tablename' => 'forums',
77 'from_fieldname' => 'forum_name',
78 'to_type' => 'forum',
79 'to_fieldname' => 'post_title'
80 );
81
82 // Forum slug (Clean name to avoid conflicts)
83 $this->field_map[] = array(
84 'from_tablename' => 'forums',
85 'from_fieldname' => 'forum_name',
86 'to_type' => 'forum',
87 'to_fieldname' => 'post_name',
88 'callback_method' => 'callback_slug'
89 );
90
91 // Forum description.
92 $this->field_map[] = array(
93 'from_tablename' => 'forums',
94 'from_fieldname' => 'forum_desc',
95 'to_type' => 'forum',
96 'to_fieldname' => 'post_content',
97 'callback_method' => 'callback_null'
98 );
99
100 // Forum display order (Starts from 1)
101 $this->field_map[] = array(
102 'from_tablename' => 'forums',
103 'from_fieldname' => 'disp_position',
104 'to_type' => 'forum',
105 'to_fieldname' => 'menu_order'
106 );
107
108 // Forum type (Set a default value 'forum', Stored in postmeta)
109 $this->field_map[] = array(
110 'to_type' => 'forum',
111 'to_fieldname' => '_bbp_forum_type',
112 'default' => 'forum'
113 );
114
115 // Forum status (Set a default value 'open', Stored in postmeta)
116 $this->field_map[] = array(
117 'to_type' => 'forum',
118 'to_fieldname' => '_bbp_status',
119 'default' => 'open'
120 );
121
122 // Forum dates.
123 $this->field_map[] = array(
124 'to_type' => 'forum',
125 'to_fieldname' => 'post_date',
126 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
127 );
128 $this->field_map[] = array(
129 'to_type' => 'forum',
130 'to_fieldname' => 'post_date_gmt',
131 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
132 );
133 $this->field_map[] = array(
134 'to_type' => 'forum',
135 'to_fieldname' => 'post_modified',
136 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
137 );
138 $this->field_map[] = array(
139 'to_type' => 'forum',
140 'to_fieldname' => 'post_modified_gmt',
141 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
142 );
143
144 /** Forum Subscriptions Section ***************************************/
145
146 // Subscribed forum ID (Stored in usermeta)
147 $this->field_map[] = array(
148 'from_tablename' => 'forum_subscriptions',
149 'from_fieldname' => 'forum_id',
150 'to_type' => 'forum_subscriptions',
151 'to_fieldname' => '_bbp_forum_subscriptions'
152 );
153
154 // Subscribed user ID (Stored in usermeta)
155 $this->field_map[] = array(
156 'from_tablename' => 'forum_subscriptions',
157 'from_fieldname' => 'user_id',
158 'to_type' => 'forum_subscriptions',
159 'to_fieldname' => 'user_id',
160 'callback_method' => 'callback_userid'
161 );
162
163 /** Topic Section *****************************************************/
164
165 // Old topic id (Stored in postmeta)
166 $this->field_map[] = array(
167 'from_tablename' => 'topics',
168 'from_fieldname' => 'id',
169 'to_type' => 'topic',
170 'to_fieldname' => '_bbp_old_topic_id'
171 );
172
173 // Topic reply count (Stored in postmeta)
174 $this->field_map[] = array(
175 'from_tablename' => 'topics',
176 'from_fieldname' => 'num_replies',
177 'to_type' => 'topic',
178 'to_fieldname' => '_bbp_reply_count',
179 'callback_method' => 'callback_topic_reply_count'
180 );
181
182 // Topic total reply count (Includes unpublished replies, Stored in postmeta)
183 $this->field_map[] = array(
184 'from_tablename' => 'topics',
185 'from_fieldname' => 'num_replies',
186 'to_type' => 'topic',
187 'to_fieldname' => '_bbp_total_reply_count',
188 'callback_method' => 'callback_topic_reply_count'
189 );
190
191 // Topic parent forum id (If no parent, then 0. Stored in postmeta)
192 $this->field_map[] = array(
193 'from_tablename' => 'topics',
194 'from_fieldname' => 'forum_id',
195 'to_type' => 'topic',
196 'to_fieldname' => '_bbp_forum_id',
197 'callback_method' => 'callback_forumid'
198 );
199
200 // Topic author.
201 // Note: We join the 'posts' table because 'topics' table does not have user id's.
202 $this->field_map[] = array(
203 'from_tablename' => 'posts',
204 'from_fieldname' => 'poster_id',
205 'join_tablename' => 'topics',
206 'join_type' => 'LEFT',
207 'join_expression' => 'ON topics.first_post_id = posts.id',
208 'to_type' => 'topic',
209 'to_fieldname' => 'post_author',
210 'callback_method' => 'callback_userid'
211 );
212
213 // Topic author name (Stored in postmeta as _bbp_anonymous_name)
214 $this->field_map[] = array(
215 'from_tablename' => 'topics',
216 'from_fieldname' => 'poster',
217 'to_type' => 'topic',
218 'to_fieldname' => '_bbp_old_topic_author_name_id'
219 );
220
221 // Is the topic anonymous (Stored in postmeta)
222 $this->field_map[] = array(
223 'from_tablename' => 'posts',
224 'from_fieldname' => 'poster_id',
225 'join_tablename' => 'topics',
226 'join_type' => 'LEFT',
227 'join_expression' => 'ON topics.first_post_id = posts.id',
228 'to_type' => 'topic',
229 'to_fieldname' => '_bbp_old_is_topic_anonymous_id',
230 'callback_method' => 'callback_check_anonymous'
231 );
232
233 // Topic Author ip (Stored in postmeta)
234 // Note: We join the 'posts' table because 'topics' table does not have author ip.
235 $this->field_map[] = array(
236 'from_tablename' => 'posts',
237 'from_fieldname' => 'poster_ip',
238 'join_tablename' => 'topics',
239 'join_type' => 'LEFT',
240 'join_expression' => 'ON topics.first_post_id = posts.id',
241 'to_type' => 'topic',
242 'to_fieldname' => '_bbp_author_ip'
243 );
244
245 // Topic content.
246 // Note: We join the 'posts' table because 'topics' table does not have content.
247 $this->field_map[] = array(
248 'from_tablename' => 'posts',
249 'from_fieldname' => 'message',
250 'join_tablename' => 'topics',
251 'join_type' => 'LEFT',
252 'join_expression' => 'ON topics.first_post_id = posts.id',
253 'to_type' => 'topic',
254 'to_fieldname' => 'post_content',
255 'callback_method' => 'callback_html'
256 );
257
258 // Topic title.
259 $this->field_map[] = array(
260 'from_tablename' => 'topics',
261 'from_fieldname' => 'subject',
262 'to_type' => 'topic',
263 'to_fieldname' => 'post_title'
264 );
265
266 // Topic slug (Clean name to avoid conflicts)
267 $this->field_map[] = array(
268 'from_tablename' => 'topics',
269 'from_fieldname' => 'subject',
270 'to_type' => 'topic',
271 'to_fieldname' => 'post_name',
272 'callback_method' => 'callback_slug'
273 );
274
275 // Topic parent forum id (If no parent, then 0)
276 $this->field_map[] = array(
277 'from_tablename' => 'topics',
278 'from_fieldname' => 'forum_id',
279 'to_type' => 'topic',
280 'to_fieldname' => 'post_parent',
281 'callback_method' => 'callback_forumid'
282 );
283
284 // Topic status (Open or Closed, PunBB v1.4.2 0=open & 1=closed)
285 $this->field_map[] = array(
286 'from_tablename' => 'topics',
287 'from_fieldname' => 'closed',
288 'to_type' => 'topic',
289 'to_fieldname' => '_bbp_old_closed_status_id',
290 'callback_method' => 'callback_topic_status'
291 );
292
293 // Sticky status (Stored in postmeta)
294 $this->field_map[] = array(
295 'from_tablename' => 'topics',
296 'from_fieldname' => 'sticky',
297 'to_type' => 'topic',
298 'to_fieldname' => '_bbp_old_sticky_status_id',
299 'callback_method' => 'callback_sticky_status'
300 );
301 // Topic dates.
302 $this->field_map[] = array(
303 'from_tablename' => 'topics',
304 'from_fieldname' => 'posted',
305 'to_type' => 'topic',
306 'to_fieldname' => 'post_date',
307 'callback_method' => 'callback_datetime'
308 );
309 $this->field_map[] = array(
310 'from_tablename' => 'topics',
311 'from_fieldname' => 'posted',
312 'to_type' => 'topic',
313 'to_fieldname' => 'post_date_gmt',
314 'callback_method' => 'callback_datetime'
315 );
316 $this->field_map[] = array(
317 'from_tablename' => 'topics',
318 'from_fieldname' => 'last_post',
319 'to_type' => 'topic',
320 'to_fieldname' => 'post_modified',
321 'callback_method' => 'callback_datetime'
322 );
323 $this->field_map[] = array(
324 'from_tablename' => 'topics',
325 'from_fieldname' => 'last_post',
326 'to_type' => 'topic',
327 'to_fieldname' => 'post_modified_gmt',
328 'callback_method' => 'callback_datetime'
329 );
330 $this->field_map[] = array(
331 'from_tablename' => 'topics',
332 'from_fieldname' => 'last_post',
333 'to_type' => 'topic',
334 'to_fieldname' => '_bbp_last_active_time',
335 'callback_method' => 'callback_datetime'
336 );
337
338 /** Tags Section ******************************************************/
339
340 /**
341 * PunBB v1.4.2 Forums do not support topic tags out of the box
342 */
343
344 /** Topic Subscriptions Section ***************************************/
345
346 // Subscribed topic ID (Stored in usermeta)
347 $this->field_map[] = array(
348 'from_tablename' => 'subscriptions',
349 'from_fieldname' => 'topic_id',
350 'to_type' => 'topic_subscriptions',
351 'to_fieldname' => '_bbp_subscriptions'
352 );
353
354 // Subscribed user ID (Stored in usermeta)
355 $this->field_map[] = array(
356 'from_tablename' => 'subscriptions',
357 'from_fieldname' => 'user_id',
358 'to_type' => 'topic_subscriptions',
359 'to_fieldname' => 'user_id',
360 'callback_method' => 'callback_userid'
361 );
362
363 /** Reply Section *****************************************************/
364
365 // Old reply id (Stored in postmeta)
366 $this->field_map[] = array(
367 'from_tablename' => 'posts',
368 'from_fieldname' => 'id',
369 'to_type' => 'reply',
370 'to_fieldname' => '_bbp_old_reply_id'
371 );
372
373 // Reply parent forum id (If no parent, then 0. Stored in postmeta)
374 // Note: We join the 'topics' table because 'posts' table does not have parent forum id's.
375 $this->field_map[] = array(
376 'from_tablename' => 'topics',
377 'from_fieldname' => 'forum_id',
378 'join_tablename' => 'posts',
379 'join_type' => 'LEFT',
380 'join_expression' => 'ON topics.id = posts.topic_id WHERE topics.first_post_id != posts.id',
381 'to_type' => 'reply',
382 'to_fieldname' => '_bbp_forum_id',
383 'callback_method' => 'callback_topicid_to_forumid'
384 );
385
386 // Reply parent topic id (If no parent, then 0. Stored in postmeta)
387 $this->field_map[] = array(
388 'from_tablename' => 'posts',
389 'from_fieldname' => 'topic_id',
390 'to_type' => 'reply',
391 'to_fieldname' => '_bbp_topic_id',
392 'callback_method' => 'callback_topicid'
393 );
394
395 // Reply author ip (Stored in postmeta)
396 $this->field_map[] = array(
397 'from_tablename' => 'posts',
398 'from_fieldname' => 'poster_ip',
399 'to_type' => 'reply',
400 'to_fieldname' => '_bbp_author_ip'
401 );
402
403 // Reply author.
404 $this->field_map[] = array(
405 'from_tablename' => 'posts',
406 'from_fieldname' => 'poster_id',
407 'to_type' => 'reply',
408 'to_fieldname' => 'post_author',
409 'callback_method' => 'callback_userid'
410 );
411
412 // Reply author name (Stored in postmeta as _bbp_anonymous_name)
413 $this->field_map[] = array(
414 'from_tablename' => 'posts',
415 'from_fieldname' => 'poster',
416 'to_type' => 'reply',
417 'to_fieldname' => '_bbp_old_reply_author_name_id'
418 );
419
420 // Is the reply anonymous (Stored in postmeta)
421 $this->field_map[] = array(
422 'from_tablename' => 'posts',
423 'from_fieldname' => 'poster_id',
424 'to_type' => 'reply',
425 'to_fieldname' => '_bbp_old_is_reply_anonymous_id',
426 'callback_method' => 'callback_check_anonymous'
427 );
428
429 // Reply content.
430 $this->field_map[] = array(
431 'from_tablename' => 'posts',
432 'from_fieldname' => 'message',
433 'to_type' => 'reply',
434 'to_fieldname' => 'post_content',
435 'callback_method' => 'callback_html'
436 );
437
438 // Reply parent topic id (If no parent, then 0)
439 $this->field_map[] = array(
440 'from_tablename' => 'posts',
441 'from_fieldname' => 'topic_id',
442 'to_type' => 'reply',
443 'to_fieldname' => 'post_parent',
444 'callback_method' => 'callback_topicid'
445 );
446
447 // Reply dates.
448 $this->field_map[] = array(
449 'from_tablename' => 'posts',
450 'from_fieldname' => 'posted',
451 'to_type' => 'reply',
452 'to_fieldname' => 'post_date',
453 'callback_method' => 'callback_datetime'
454 );
455 $this->field_map[] = array(
456 'from_tablename' => 'posts',
457 'from_fieldname' => 'posted',
458 'to_type' => 'reply',
459 'to_fieldname' => 'post_date_gmt',
460 'callback_method' => 'callback_datetime'
461 );
462 $this->field_map[] = array(
463 'from_tablename' => 'posts',
464 'from_fieldname' => 'edited',
465 'to_type' => 'reply',
466 'to_fieldname' => 'post_modified',
467 'callback_method' => 'callback_datetime'
468 );
469 $this->field_map[] = array(
470 'from_tablename' => 'posts',
471 'from_fieldname' => 'edited',
472 'to_type' => 'reply',
473 'to_fieldname' => 'post_modified_gmt',
474 'callback_method' => 'callback_datetime'
475 );
476
477 /** User Section ******************************************************/
478
479 // Store old user id (Stored in usermeta)
480 // Don't import user id 1, this is PunBB's guest user
481 $this->field_map[] = array(
482 'from_tablename' => 'users',
483 'from_fieldname' => 'id',
484 'from_expression' => 'WHERE id != 1',
485 'to_type' => 'user',
486 'to_fieldname' => '_bbp_old_user_id'
487 );
488
489 // Store old user password (Stored in usermeta serialized with salt)
490 $this->field_map[] = array(
491 'from_tablename' => 'users',
492 'from_fieldname' => 'password',
493 'to_type' => 'user',
494 'to_fieldname' => '_bbp_password',
495 'callback_method' => 'callback_savepass'
496 );
497
498 // Store old user salt (This is only used for the SELECT row info for the above password save)
499 $this->field_map[] = array(
500 'from_tablename' => 'users',
501 'from_fieldname' => 'salt',
502 'to_type' => 'user',
503 'to_fieldname' => ''
504 );
505
506 // User password verify class (Stored in usermeta for verifying password)
507 $this->field_map[] = array(
508 'to_type' => 'users',
509 'to_fieldname' => '_bbp_class',
510 'default' => 'PunBB'
511 );
512
513 // User name.
514 $this->field_map[] = array(
515 'from_tablename' => 'users',
516 'from_fieldname' => 'username',
517 'to_type' => 'user',
518 'to_fieldname' => 'user_login'
519 );
520
521 // User nice name.
522 $this->field_map[] = array(
523 'from_tablename' => 'users',
524 'from_fieldname' => 'username',
525 'to_type' => 'user',
526 'to_fieldname' => 'user_nicename'
527 );
528
529 // User email.
530 $this->field_map[] = array(
531 'from_tablename' => 'users',
532 'from_fieldname' => 'email',
533 'to_type' => 'user',
534 'to_fieldname' => 'user_email'
535 );
536
537 // User homepage.
538 $this->field_map[] = array(
539 'from_tablename' => 'users',
540 'from_fieldname' => 'url',
541 'to_type' => 'user',
542 'to_fieldname' => 'user_url'
543 );
544
545 // User registered.
546 $this->field_map[] = array(
547 'from_tablename' => 'users',
548 'from_fieldname' => 'registered',
549 'to_type' => 'user',
550 'to_fieldname' => 'user_registered',
551 'callback_method' => 'callback_datetime'
552 );
553
554 // User display name.
555 $this->field_map[] = array(
556 'from_tablename' => 'users',
557 'from_fieldname' => 'realname',
558 'to_type' => 'user',
559 'to_fieldname' => 'display_name'
560 );
561
562 // User AIM (Stored in usermeta)
563 $this->field_map[] = array(
564 'from_tablename' => 'users',
565 'from_fieldname' => 'aim',
566 'to_type' => 'user',
567 'to_fieldname' => '_bbp_punbb_user_aim'
568 );
569
570 // User Yahoo (Stored in usermeta)
571 $this->field_map[] = array(
572 'from_tablename' => 'users',
573 'from_fieldname' => 'yahoo',
574 'to_type' => 'user',
575 'to_fieldname' => '_bbp_punbb_user_yim'
576 );
577
578 // Store Jabber
579 $this->field_map[] = array(
580 'from_tablename' => 'users',
581 'from_fieldname' => 'jabber',
582 'to_type' => 'user',
583 'to_fieldname' => '_bbp_punbb_user_jabber'
584 );
585
586 // Store ICQ (Stored in usermeta)
587 $this->field_map[] = array(
588 'from_tablename' => 'users',
589 'from_fieldname' => 'icq',
590 'to_type' => 'user',
591 'to_fieldname' => '_bbp_punbb_user_icq'
592 );
593
594 // Store MSN (Stored in usermeta)
595 $this->field_map[] = array(
596 'from_tablename' => 'users',
597 'from_fieldname' => 'msn',
598 'to_type' => 'user',
599 'to_fieldname' => '_bbp_punbb_user_msn'
600 );
601
602 // Store Facebook (Stored in usermeta)
603 $this->field_map[] = array(
604 'from_tablename' => 'users',
605 'from_fieldname' => 'facebook',
606 'to_type' => 'user',
607 'to_fieldname' => '_bbp_punbb_user_facebook'
608 );
609
610 // Store Twitter (Stored in usermeta)
611 $this->field_map[] = array(
612 'from_tablename' => 'users',
613 'from_fieldname' => 'twitter',
614 'to_type' => 'user',
615 'to_fieldname' => '_bbp_punbb_user_twitter'
616 );
617
618 // Store LinkedIn (Stored in usermeta)
619 $this->field_map[] = array(
620 'from_tablename' => 'users',
621 'from_fieldname' => 'linkedin',
622 'to_type' => 'user',
623 'to_fieldname' => '_bbp_punbb_user_linkedin'
624 );
625
626 // Store Skype (Stored in usermeta)
627 $this->field_map[] = array(
628 'from_tablename' => 'users',
629 'from_fieldname' => 'skype',
630 'to_type' => 'user',
631 'to_fieldname' => '_bbp_punbb_user_skype'
632 );
633
634 // Store Signature (Stored in usermeta)
635 $this->field_map[] = array(
636 'from_tablename' => 'users',
637 'from_fieldname' => 'signature',
638 'to_type' => 'user',
639 'to_fieldname' => '_bbp_punbb_user_sig',
640 'callback_method' => 'callback_html'
641 );
642
643 // Store Location (Stored in usermeta)
644 $this->field_map[] = array(
645 'from_tablename' => 'users',
646 'from_fieldname' => 'location',
647 'to_type' => 'user',
648 'to_fieldname' => '_bbp_punbb_user_from'
649 );
650
651 // Store Admin Note (Stored in usermeta)
652 $this->field_map[] = array(
653 'from_tablename' => 'users',
654 'from_fieldname' => 'admin_note',
655 'to_type' => 'user',
656 'to_fieldname' => '_bbp_punbb_user_admin_note'
657 );
658 }
659
660 /**
661 * This method allows us to indicates what is or is not converted for each
662 * converter.
663 */
664 public function info() {
665 return '';
666 }
667
668 /**
669 * This method is to save the salt and password together. That
670 * way when we authenticate it we can get it out of the database
671 * as one value. Array values are auto sanitized by WordPress.
672 */
673 public function callback_savepass( $field, $row ) {
674 $pass_array = array(
675 'hash' => $field,
676 'salt' => $row['salt']
677 );
678
679 return $pass_array;
680 }
681
682 /**
683 * This method is to take the pass out of the database and compare
684 * to a pass the user has typed in.
685 */
686 public function authenticate_pass( $password, $serialized_pass ) {
687
688 // Unserialize the password, with safeguards
689 $pass_array = unserialize(
690 $serialized_pass,
691 array(
692 'allowed_classes' => false,
693 'max_depth' => 1
694 )
695 );
696
697 // Bail if missing values
698 if ( ! is_array( $pass_array ) || ! isset( $pass_array['hash'], $pass_array['salt'] ) ) {
699 return false;
700 }
701
702 // Return comparison
703 return hash_equals(
704 $pass_array['hash'],
705 md5( md5( $password ) . $pass_array['salt'] )
706 );
707 }
708
709 /**
710 * Translate the post status from PunBB v1.4.2 numerics to WordPress's strings.
711 *
712 * @param int $status PunBB v1.4.2 numeric topic status
713 * @return string WordPress safe
714 */
715 public function callback_topic_status( $status = 0 ) {
716 switch ( $status ) {
717 case 1 :
718 $status = 'closed';
719 break;
720
721 case 0 :
722 default :
723 $status = 'publish';
724 break;
725 }
726 return $status;
727 }
728
729 /**
730 * Translate the topic sticky status type from PunBB v1.4.2 numerics to WordPress's strings.
731 *
732 * @param int $status PunBB v1.4.2 numeric forum type
733 * @return string WordPress safe
734 */
735 public function callback_sticky_status( $status = 0 ) {
736 switch ( $status ) {
737 case 1 :
738 $status = 'sticky'; // PunBB Sticky 'topic_sticky = 1'
739 break;
740
741 case 0 :
742 default :
743 $status = 'normal'; // PunBB Normal Topic 'topic_sticky = 0'
744 break;
745 }
746 return $status;
747 }
748
749 /**
750 * Verify the topic/reply count.
751 *
752 * @param int $count PunBB v1.4.2 topic/reply counts
753 * @return string WordPress safe
754 */
755 public function callback_topic_reply_count( $count = 1 ) {
756 $count = absint( (int) $count - 1 );
757 return $count;
758 }
759 }
760