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
← All changes | includes/admin/topics.php +52 -65 trunk → 2.6.19 View file →
@@ -1,8 +1,8 @@
1 1 <?php
2 2
3 3 /**
4 - * bbPress Topics Admin Class.
4 + * bbPress Topics Admin Class
5 5 *
6 6 * @package bbPress
7 7 * @subpackage Administration
8 8 */
@@ -11,9 +11,9 @@
11 11 defined( 'ABSPATH' ) || exit;
12 12
13 13 if ( ! class_exists( 'BBP_Topics_Admin' ) ) :
14 14 /**
15 - * Loads bbPress topics admin area.
15 + * Loads bbPress topics admin area
16 16 *
17 17 * @package bbPress
18 18 * @subpackage Administration
19 19 * @since 2.0.0 bbPress (r3095)
@@ -22,9 +22,9 @@
22 22
23 23 /** Variables *************************************************************/
24 24
25 25 /**
26 - * @var The post type of this admin component.
26 + * @var The post type of this admin component
27 27 */
28 28 private $post_type = '';
29 29
30 30 private $accepted_forum_moves = array();
@@ -31,9 +31,9 @@
31 31
32 32 /** Functions *************************************************************/
33 33
34 34 /**
35 - * The main bbPress topics admin loader.
35 + * The main bbPress topics admin loader
36 36 *
37 37 * @since 2.0.0 bbPress (r3095)
38 38 */
39 39 public function __construct() {
@@ -41,9 +41,9 @@
41 41 $this->setup_actions();
42 42 }
43 43
44 44 /**
45 - * Setup the admin hooks, actions and filters.
45 + * Setup the admin hooks, actions and filters
46 46 *
47 47 * @since 2.0.0 bbPress (r3376)
48 48 * @since 2.6.0 bbPress (r6101) Added bulk actions
49 49 *
@@ -93,17 +93,12 @@
93 93 // Contextual Help
94 94 add_action( 'load-edit.php', array( $this, 'edit_help' ) );
95 95 add_action( 'load-post.php', array( $this, 'new_help' ) );
96 96 add_action( 'load-post-new.php', array( $this, 'new_help' ) );
97 -
98 - /** Dependencies ******************************************************/
99 -
100 - // Allow plugins to modify these actions
101 - do_action_ref_array( 'bbp_admin_topics_loaded', array( &$this ) );
102 97 }
103 98
104 99 /**
105 - * Admin globals.
100 + * Admin globals
106 101 *
107 102 * @since 2.0.0 bbPress (r3376)
108 103 *
109 104 * @access private
@@ -114,9 +109,9 @@
114 109
115 110 /** Contextual Help *******************************************************/
116 111
117 112 /**
118 - * Contextual help for bbPress topic edit page.
113 + * Contextual help for bbPress topic edit page
119 114 *
120 115 * @since 2.1.0 bbPress (r3686)
121 116 */
122 117 public function edit_help() {
@@ -186,9 +181,9 @@
186 181 );
187 182 }
188 183
189 184 /**
190 - * Contextual help for bbPress topic edit page.
185 + * Contextual help for bbPress topic edit page
191 186 *
192 187 * @since 2.1.0 bbPress (r3686)
193 188 */
194 189 public function new_help() {
@@ -299,9 +294,9 @@
299 294 */
300 295 public function handle_bulk_actions( $sendback, $doaction, $post_ids ) {
301 296
302 297 $sendback = remove_query_arg( array( 'spam', 'unspam' ), $sendback );
303 - $updated = $locked = 0;
298 + $updated = $locked = 0;
304 299
305 300 if ( 'spam' === $doaction ) {
306 301
307 302 foreach ( (array) $post_ids as $post_id ) {
@@ -309,9 +304,9 @@
309 304 wp_die( esc_html__( 'Sorry, you are not allowed to spam this item.', 'bbpress' ) );
310 305 }
311 306
312 307 if ( wp_check_post_lock( $post_id ) ) {
313 - ++$locked;
308 + $locked++;
314 309 continue;
315 310 }
316 311
317 312 if ( ! bbp_spam_topic( $post_id ) ) {
@@ -337,9 +332,9 @@
337 332 wp_die( esc_html__( 'Sorry, you are not allowed to unspam this topic.', 'bbpress' ) );
338 333 }
339 334
340 335 if ( wp_check_post_lock( $post_id ) ) {
341 - ++$locked;
336 + $locked++;
342 337 continue;
343 338 }
344 339
345 340 if ( ! bbp_unspam_topic( $post_id ) ) {
@@ -362,9 +357,9 @@
362 357 return $sendback;
363 358 }
364 359
365 360 /**
366 - * Add the topic attributes meta-box.
361 + * Add the topic attributes meta-box
367 362 *
368 363 * @since 2.1.0 bbPress (r3749)
369 364 */
370 365 public function attributes_metabox() {
@@ -369,9 +364,9 @@
369 364 */
370 365 public function attributes_metabox() {
371 366 add_meta_box(
372 367 'bbp_topic_attributes',
373 - esc_html__( 'Attributes', 'bbpress' ),
368 + esc_html__( 'Topic Attributes', 'bbpress' ),
374 369 'bbp_topic_metabox',
375 370 $this->post_type,
376 371 'side',
377 372 'high'
@@ -378,9 +373,9 @@
378 373 );
379 374 }
380 375
381 376 /**
382 - * Add the author info meta-box.
377 + * Add the author info meta-box
383 378 *
384 379 * @since 2.0.0 bbPress (r3120)
385 380 */
386 381 public function author_metabox() {
@@ -392,9 +387,9 @@
392 387
393 388 // Add the meta-box
394 389 add_meta_box(
395 390 'bbp_author_metabox',
396 - esc_html__( 'Author', 'bbpress' ),
391 + esc_html__( 'Author Information', 'bbpress' ),
397 392 'bbp_author_metabox',
398 393 $this->post_type,
399 394 'side',
400 395 'high'
@@ -401,9 +396,9 @@
401 396 );
402 397 }
403 398
404 399 /**
405 - * Add the replies meta-box.
400 + * Add the replies meta-box
406 401 *
407 402 * Allows viewing & moderating of replies to a topic, based on the way
408 403 * comments are visible on a blog post.
409 404 *
@@ -427,9 +422,9 @@
427 422 );
428 423 }
429 424
430 425 /**
431 - * Add the engagements meta-box.
426 + * Add the engagements meta-box
432 427 *
433 428 * Allows viewing of users who have engaged in a topic.
434 429 *
435 430 * @since 2.6.0 bbPress (r6334)
@@ -457,9 +452,9 @@
457 452 );
458 453 }
459 454
460 455 /**
461 - * Add the favorites meta-box.
456 + * Add the favorites meta-box
462 457 *
463 458 * Allows viewing of users who have favorited a topic.
464 459 *
465 460 * @since 2.6.0 bbPress (r6197)
@@ -487,9 +482,9 @@
487 482 );
488 483 }
489 484
490 485 /**
491 - * Add the subscriptions meta-box.
486 + * Add the subscriptions meta-box
492 487 *
493 488 * Allows viewing of users who have subscribed to a topic.
494 489 *
495 490 * @since 2.6.0 bbPress (r6197)
@@ -517,9 +512,9 @@
517 512 );
518 513 }
519 514
520 515 /**
521 - * Remove comments & discussion meta-boxes if comments are not supported.
516 + * Remove comments & discussion meta-boxes if comments are not supported
522 517 *
523 518 * @since 2.6.0 bbPress (r6186)
524 519 */
525 520 public function comments_metabox() {
@@ -529,14 +524,14 @@
529 524 }
530 525 }
531 526
532 527 /**
533 - * Pass the topic attributes for processing.
528 + * Pass the topic attributes for processing
534 529 *
535 530 * @since 2.6.0 bbPress (r6056)
536 531 *
537 - * @param int $topic_id Topic id.
538 - * @return int Parent id.
532 + * @param int $topic_id Topic id
533 + * @return int Parent id
539 534 */
540 535 public function save_meta_boxes( $topic_id ) {
541 536 $accepted_move = isset( $this->accepted_forum_moves[ $topic_id ] )
542 537 ? $this->accepted_forum_moves[ $topic_id ]
@@ -598,9 +593,9 @@
598 593
599 594 /**
600 595 * Keep admin topic moves within forums the current user may use.
601 596 *
602 - * @since 2.6.19 bbPress (r7687)
597 + * @since 2.6.19 bbPress (r7688)
603 598 *
604 599 * @param array $data Sanitized post data.
605 600 * @param array $postarr Unprocessed post data.
606 601 * @return array Filtered post data.
@@ -663,12 +658,12 @@
663 658 return $data;
664 659 }
665 660
666 661 /**
667 - * Toggle topic.
662 + * Toggle topic
668 663 *
669 664 * Handles the admin-side opening/closing, sticking/unsticking and
670 - * spamming/unspamming of topics.
665 + * spamming/unspamming of topics
671 666 *
672 667 * @since 2.0.0 bbPress (r3095)
673 668 */
674 669 public function toggle_topic() {
@@ -787,9 +782,9 @@
787 782 bbp_redirect( $redirect );
788 783 }
789 784
790 785 /**
791 - * Toggle topic notices.
786 + * Toggle topic notices
792 787 *
793 788 * Display the success/error notices from
794 789 * {@link BBP_Admin::toggle_topic()}
795 790 *
@@ -909,9 +904,9 @@
909 904 bbp_admin()->add_notice( $message, $class, true );
910 905 }
911 906
912 907 /**
913 - * Returns an array of keys used to sort row actions.
908 + * Returns an array of keys used to sort row actions
914 909 *
915 910 * @since 2.6.0 bbPress (r6772)
916 911 *
917 912 * @return array
@@ -937,9 +932,9 @@
937 932 );
938 933 }
939 934
940 935 /**
941 - * Returns an array of notice toggles.
936 + * Returns an array of notice toggles
942 937 *
943 938 * @since 2.6.0 bbPress (r6397)
944 939 *
945 940 * @return array
@@ -963,9 +958,9 @@
963 958 );
964 959 }
965 960
966 961 /**
967 - * Returns an array of notice toggles.
962 + * Returns an array of notice toggles
968 963 *
969 964 * @since 2.6.0 bbPress (r6397)
970 965 *
971 966 * @return array
@@ -984,15 +979,15 @@
984 979 );
985 980 }
986 981
987 982 /**
988 - * Manage the column headers for the topics page.
983 + * Manage the column headers for the topics page
989 984 *
990 985 * @since 2.4.0 bbPress (r4991)
991 986 *
992 - * @param array $columns The columns.
987 + * @param array $columns The columns
993 988 *
994 - * @return array $columns bbPress topic columns.
989 + * @return array $columns bbPress topic columns
995 990 */
996 991 public function column_headers( $columns ) {
997 992 $columns = array(
998 993 'cb' => '<input type="checkbox" />',
@@ -1009,14 +1004,14 @@
1009 1004 return (array) apply_filters( 'bbp_admin_topics_column_headers', $columns );
1010 1005 }
1011 1006
1012 1007 /**
1013 - * Print extra columns for the topics page.
1008 + * Print extra columns for the topics page
1014 1009 *
1015 1010 * @since 2.4.0 bbPress (r4991)
1016 1011 *
1017 - * @param string $column Column.
1018 - * @param int $topic_id Topic id.
1012 + * @param string $column Column
1013 + * @param int $topic_id Topic id
1019 1014 */
1020 1015 public function column_data( $column, $topic_id ) {
1021 1016
1022 1017 // Get topic forum ID
@@ -1089,19 +1084,19 @@
1089 1084 }
1090 1085 }
1091 1086
1092 1087 /**
1093 - * Topic Row actions.
1088 + * Topic Row actions
1094 1089 *
1095 1090 * Remove the quick-edit action link under the topic title and add the
1096 - * content and close/stick/spam links.
1091 + * content and close/stick/spam links
1097 1092 *
1098 1093 * @since 2.4.0 bbPress (r4991)
1099 1094 *
1100 - * @param array $actions Actions.
1101 - * @param object $topic Topic object.
1095 + * @param array $actions Actions
1096 + * @param object $topic Topic object
1102 1097 *
1103 - * @return array $actions Actions.
1098 + * @return array $actions Actions
1104 1099 */
1105 1100 public function row_actions( $actions = array(), $topic = false ) {
1106 1101
1107 1102 // Disable quick edit (too much to do here)
@@ -1217,9 +1212,9 @@
1217 1212 return $this->sort_row_actions( $actions );
1218 1213 }
1219 1214
1220 1215 /**
1221 - * Sort row actions by key.
1216 + * Sort row actions by key
1222 1217 *
1223 1218 * @since 2.6.0 bbPress (r6772)
1224 1219 *
1225 1220 * @param array $actions
@@ -1246,13 +1241,13 @@
1246 1241 return $retval + $actions;
1247 1242 }
1248 1243
1249 1244 /**
1250 - * Add forum dropdown to topic and reply list table filters.
1245 + * Add forum dropdown to topic and reply list table filters
1251 1246 *
1252 1247 * @since 2.0.0 bbPress (r3095)
1253 1248 *
1254 - * @return bool False. If post type is not topic or reply.
1249 + * @return bool False. If post type is not topic or reply
1255 1250 */
1256 1251 public function filter_dropdown() {
1257 1252
1258 1253 // Get which forum is selected
@@ -1269,9 +1264,9 @@
1269 1264 );
1270 1265 }
1271 1266
1272 1267 /**
1273 - * Add "Empty Spam" button for moderators.
1268 + * Add "Empty Spam" button for moderators
1274 1269 *
1275 1270 * @since 2.6.0 bbPress (r6791)
1276 1271 */
1277 1272 public function filter_empty_spam() {
@@ -1276,17 +1271,9 @@
1276 1271 */
1277 1272 public function filter_empty_spam() {
1278 1273
1279 1274 // Bail if not viewing spam
1280 - if (
1281 - empty( $_GET['post_status'] )
1282 - ||
1283 - (
1284 - ( bbp_get_spam_status_id() !== $_GET['post_status'] )
1285 - &&
1286 - current_user_can( 'moderate' )
1287 - )
1288 - ) {
1275 + if ( empty( $_GET['post_status'] ) || ( bbp_get_spam_status_id() !== $_GET['post_status'] ) && current_user_can( 'moderate' ) ) {
1289 1276 return;
1290 1277 }
1291 1278
1292 1279 ?>
@@ -1305,14 +1292,14 @@
1305 1292 ?></div><?php
1306 1293 }
1307 1294
1308 1295 /**
1309 - * Adjust the request query and include the forum id.
1296 + * Adjust the request query and include the forum id
1310 1297 *
1311 1298 * @since 2.0.0 bbPress (r3095)
1312 1299 *
1313 - * @param array $query_vars Query variables from {@link WP_Query}.
1314 - * @return array Processed Query Vars.
1300 + * @param array $query_vars Query variables from {@link WP_Query}
1301 + * @return array Processed Query Vars
1315 1302 */
1316 1303 public function filter_post_rows( $query_vars ) {
1317 1304
1318 1305 // Add post_parent query_var if one is present
@@ -1326,9 +1313,9 @@
1326 1313 return $query_vars;
1327 1314 }
1328 1315
1329 1316 /**
1330 - * Custom user feedback messages for topic post type.
1317 + * Custom user feedback messages for topic post type
1331 1318 *
1332 1319 * @since 2.0.0 bbPress (r3097)
1333 1320 *
1334 1321 * @global int $post_ID
@@ -1419,9 +1406,9 @@
1419 1406 }
1420 1407 endif; // class_exists check
1421 1408
1422 1409 /**
1423 - * Setup bbPress Topics Admin.
1410 + * Setup bbPress Topics Admin
1424 1411 *
1425 1412 * This is currently here to make hooking and unhooking of the admin UI easy.
1426 1413 * It could use dependency injection in the future, but for now this is easier.
1427 1414 *
@@ -1426,9 +1413,9 @@
1426 1413 * It could use dependency injection in the future, but for now this is easier.
1427 1414 *
1428 1415 * @since 2.0.0 bbPress (r3343)
1429 1416 *
1430 - * @param WP_Screen $current_screen Current screen object.
1417 + * @param WP_Screen $current_screen Current screen object
1431 1418 */
1432 1419 function bbp_admin_topics( $current_screen ) {
1433 1420
1434 1421 // Bail if not in site admin