| @@ -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 (r2464) |
| @@ -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 | /** Functions *************************************************************/ |
| @@ -29,9 +29,9 @@ | ||
| 29 | 29 | |
| 30 | 30 | /** Functions *************************************************************/ |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * The main bbPress topics admin loader. | |
| 33 | + * The main bbPress topics admin loader | |
| 34 | 34 | * |
| 35 | 35 | * @since 2.0.0 bbPress (r2515) |
| 36 | 36 | */ |
| 37 | 37 | public function __construct() { |
| @@ -39,9 +39,9 @@ | ||
| 39 | 39 | $this->setup_actions(); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | - * Setup the admin hooks, actions and filters. | |
| 43 | + * Setup the admin hooks, actions and filters | |
| 44 | 44 | * |
| 45 | 45 | * @since 2.0.0 bbPress (r2646) |
| 46 | 46 | * @since 2.6.0 bbPress (r6101) Added bulk actions |
| 47 | 47 | * |
| @@ -90,17 +90,12 @@ | ||
| 90 | 90 | // Contextual Help |
| 91 | 91 | add_action( 'load-edit.php', array( $this, 'edit_help' ) ); |
| 92 | 92 | add_action( 'load-post.php', array( $this, 'new_help' ) ); |
| 93 | 93 | add_action( 'load-post-new.php', array( $this, 'new_help' ) ); |
| 94 | - | |
| 95 | - /** Dependencies ******************************************************/ | |
| 96 | - | |
| 97 | - // Allow plugins to modify these actions | |
| 98 | - do_action_ref_array( 'bbp_admin_topics_loaded', array( &$this ) ); | |
| 99 | 94 | } |
| 100 | 95 | |
| 101 | 96 | /** |
| 102 | - * Admin globals. | |
| 97 | + * Admin globals | |
| 103 | 98 | * |
| 104 | 99 | * @since 2.0.0 bbPress (r2646) |
| 105 | 100 | * |
| 106 | 101 | * @access private |
| @@ -111,9 +106,9 @@ | ||
| 111 | 106 | |
| 112 | 107 | /** Contextual Help *******************************************************/ |
| 113 | 108 | |
| 114 | 109 | /** |
| 115 | - * Contextual help for bbPress topic edit page. | |
| 110 | + * Contextual help for bbPress topic edit page | |
| 116 | 111 | * |
| 117 | 112 | * @since 2.0.0 bbPress (r3119) |
| 118 | 113 | */ |
| 119 | 114 | public function edit_help() { |
| @@ -183,9 +178,9 @@ | ||
| 183 | 178 | ); |
| 184 | 179 | } |
| 185 | 180 | |
| 186 | 181 | /** |
| 187 | - * Contextual help for bbPress topic edit page. | |
| 182 | + * Contextual help for bbPress topic edit page | |
| 188 | 183 | * |
| 189 | 184 | * @since 2.0.0 bbPress (r3119) |
| 190 | 185 | */ |
| 191 | 186 | public function new_help() { |
| @@ -296,9 +291,9 @@ | ||
| 296 | 291 | */ |
| 297 | 292 | public function handle_bulk_actions( $sendback, $doaction, $post_ids ) { |
| 298 | 293 | |
| 299 | 294 | $sendback = remove_query_arg( array( 'spam', 'unspam' ), $sendback ); |
| 300 | - $updated = $locked = 0; | |
| 295 | + $updated = $locked = 0; | |
| 301 | 296 | |
| 302 | 297 | if ( 'spam' === $doaction ) { |
| 303 | 298 | |
| 304 | 299 | foreach ( (array) $post_ids as $post_id ) { |
| @@ -306,9 +301,9 @@ | ||
| 306 | 301 | wp_die( esc_html__( 'Sorry, you are not allowed to spam this item.', 'bbpress' ) ); |
| 307 | 302 | } |
| 308 | 303 | |
| 309 | 304 | if ( wp_check_post_lock( $post_id ) ) { |
| 310 | - ++$locked; | |
| 305 | + $locked++; | |
| 311 | 306 | continue; |
| 312 | 307 | } |
| 313 | 308 | |
| 314 | 309 | if ( ! bbp_spam_topic( $post_id ) ) { |
| @@ -334,9 +329,9 @@ | ||
| 334 | 329 | wp_die( esc_html__( 'Sorry, you are not allowed to unspam this topic.', 'bbpress' ) ); |
| 335 | 330 | } |
| 336 | 331 | |
| 337 | 332 | if ( wp_check_post_lock( $post_id ) ) { |
| 338 | - ++$locked; | |
| 333 | + $locked++; | |
| 339 | 334 | continue; |
| 340 | 335 | } |
| 341 | 336 | |
| 342 | 337 | if ( ! bbp_unspam_topic( $post_id ) ) { |
| @@ -359,9 +354,9 @@ | ||
| 359 | 354 | return $sendback; |
| 360 | 355 | } |
| 361 | 356 | |
| 362 | 357 | /** |
| 363 | - * Add the topic attributes meta-box. | |
| 358 | + * Add the topic attributes meta-box | |
| 364 | 359 | * |
| 365 | 360 | * @since 2.0.0 bbPress (r2744) |
| 366 | 361 | */ |
| 367 | 362 | public function attributes_metabox() { |
| @@ -366,9 +361,9 @@ | ||
| 366 | 361 | */ |
| 367 | 362 | public function attributes_metabox() { |
| 368 | 363 | add_meta_box( |
| 369 | 364 | 'bbp_topic_attributes', |
| 370 | - esc_html__( 'Attributes', 'bbpress' ), | |
| 365 | + esc_html__( 'Topic Attributes', 'bbpress' ), | |
| 371 | 366 | 'bbp_topic_metabox', |
| 372 | 367 | $this->post_type, |
| 373 | 368 | 'side', |
| 374 | 369 | 'high' |
| @@ -375,9 +370,9 @@ | ||
| 375 | 370 | ); |
| 376 | 371 | } |
| 377 | 372 | |
| 378 | 373 | /** |
| 379 | - * Add the author info meta-box. | |
| 374 | + * Add the author info meta-box | |
| 380 | 375 | * |
| 381 | 376 | * @since 2.0.0 bbPress (r2828) |
| 382 | 377 | */ |
| 383 | 378 | public function author_metabox() { |
| @@ -389,9 +384,9 @@ | ||
| 389 | 384 | |
| 390 | 385 | // Add the meta-box |
| 391 | 386 | add_meta_box( |
| 392 | 387 | 'bbp_author_metabox', |
| 393 | - esc_html__( 'Author', 'bbpress' ), | |
| 388 | + esc_html__( 'Author Information', 'bbpress' ), | |
| 394 | 389 | 'bbp_author_metabox', |
| 395 | 390 | $this->post_type, |
| 396 | 391 | 'side', |
| 397 | 392 | 'high' |
| @@ -398,9 +393,9 @@ | ||
| 398 | 393 | ); |
| 399 | 394 | } |
| 400 | 395 | |
| 401 | 396 | /** |
| 402 | - * Add the replies meta-box. | |
| 397 | + * Add the replies meta-box | |
| 403 | 398 | * |
| 404 | 399 | * Allows viewing & moderating of replies to a topic, based on the way |
| 405 | 400 | * comments are visible on a blog post. |
| 406 | 401 | * |
| @@ -424,9 +419,9 @@ | ||
| 424 | 419 | ); |
| 425 | 420 | } |
| 426 | 421 | |
| 427 | 422 | /** |
| 428 | - * Add the engagements meta-box. | |
| 423 | + * Add the engagements meta-box | |
| 429 | 424 | * |
| 430 | 425 | * Allows viewing of users who have engaged in a topic. |
| 431 | 426 | * |
| 432 | 427 | * @since 2.6.0 bbPress (r6333) |
| @@ -454,9 +449,9 @@ | ||
| 454 | 449 | ); |
| 455 | 450 | } |
| 456 | 451 | |
| 457 | 452 | /** |
| 458 | - * Add the favorites meta-box. | |
| 453 | + * Add the favorites meta-box | |
| 459 | 454 | * |
| 460 | 455 | * Allows viewing of users who have favorited a topic. |
| 461 | 456 | * |
| 462 | 457 | * @since 2.6.0 bbPress (r6197) |
| @@ -484,9 +479,9 @@ | ||
| 484 | 479 | ); |
| 485 | 480 | } |
| 486 | 481 | |
| 487 | 482 | /** |
| 488 | - * Add the subscriptions meta-box. | |
| 483 | + * Add the subscriptions meta-box | |
| 489 | 484 | * |
| 490 | 485 | * Allows viewing of users who have subscribed to a topic. |
| 491 | 486 | * |
| 492 | 487 | * @since 2.6.0 bbPress (r6197) |
| @@ -514,9 +509,9 @@ | ||
| 514 | 509 | ); |
| 515 | 510 | } |
| 516 | 511 | |
| 517 | 512 | /** |
| 518 | - * Remove comments & discussion meta-boxes if comments are not supported. | |
| 513 | + * Remove comments & discussion meta-boxes if comments are not supported | |
| 519 | 514 | * |
| 520 | 515 | * @since 2.6.0 bbPress (r6186) |
| 521 | 516 | */ |
| 522 | 517 | public function comments_metabox() { |
| @@ -526,14 +521,14 @@ | ||
| 526 | 521 | } |
| 527 | 522 | } |
| 528 | 523 | |
| 529 | 524 | /** |
| 530 | - * Pass the topic attributes for processing. | |
| 525 | + * Pass the topic attributes for processing | |
| 531 | 526 | * |
| 532 | 527 | * @since 2.0.0 bbPress (r2746) |
| 533 | 528 | * |
| 534 | - * @param int $topic_id Topic id. | |
| 535 | - * @return int Parent id. | |
| 529 | + * @param int $topic_id Topic id | |
| 530 | + * @return int Parent id | |
| 536 | 531 | */ |
| 537 | 532 | public function save_meta_boxes( $topic_id ) { |
| 538 | 533 | |
| 539 | 534 | // Bail if doing an autosave |
| @@ -579,12 +574,12 @@ | ||
| 579 | 574 | return $topic_id; |
| 580 | 575 | } |
| 581 | 576 | |
| 582 | 577 | /** |
| 583 | - * Toggle topic. | |
| 578 | + * Toggle topic | |
| 584 | 579 | * |
| 585 | 580 | * Handles the admin-side opening/closing, sticking/unsticking and |
| 586 | - * spamming/unspamming of topics. | |
| 581 | + * spamming/unspamming of topics | |
| 587 | 582 | * |
| 588 | 583 | * @since 2.0.0 bbPress (r2727) |
| 589 | 584 | */ |
| 590 | 585 | public function toggle_topic() { |
| @@ -698,9 +693,9 @@ | ||
| 698 | 693 | bbp_redirect( $redirect ); |
| 699 | 694 | } |
| 700 | 695 | |
| 701 | 696 | /** |
| 702 | - * Toggle topic notices. | |
| 697 | + * Toggle topic notices | |
| 703 | 698 | * |
| 704 | 699 | * Display the success/error notices from |
| 705 | 700 | * {@link BBP_Admin::toggle_topic()} |
| 706 | 701 | * |
| @@ -820,9 +815,9 @@ | ||
| 820 | 815 | bbp_admin()->add_notice( $message, $class, true ); |
| 821 | 816 | } |
| 822 | 817 | |
| 823 | 818 | /** |
| 824 | - * Returns an array of keys used to sort row actions. | |
| 819 | + * Returns an array of keys used to sort row actions | |
| 825 | 820 | * |
| 826 | 821 | * @since 2.6.0 bbPress (r6771) |
| 827 | 822 | * |
| 828 | 823 | * @return array |
| @@ -848,9 +843,9 @@ | ||
| 848 | 843 | ); |
| 849 | 844 | } |
| 850 | 845 | |
| 851 | 846 | /** |
| 852 | - * Returns an array of notice toggles. | |
| 847 | + * Returns an array of notice toggles | |
| 853 | 848 | * |
| 854 | 849 | * @since 2.6.0 bbPress (r6396) |
| 855 | 850 | * |
| 856 | 851 | * @return array |
| @@ -874,9 +869,9 @@ | ||
| 874 | 869 | ); |
| 875 | 870 | } |
| 876 | 871 | |
| 877 | 872 | /** |
| 878 | - * Returns an array of notice toggles. | |
| 873 | + * Returns an array of notice toggles | |
| 879 | 874 | * |
| 880 | 875 | * @since 2.6.0 bbPress (r6396) |
| 881 | 876 | * |
| 882 | 877 | * @return array |
| @@ -895,15 +890,15 @@ | ||
| 895 | 890 | ); |
| 896 | 891 | } |
| 897 | 892 | |
| 898 | 893 | /** |
| 899 | - * Manage the column headers for the topics page. | |
| 894 | + * Manage the column headers for the topics page | |
| 900 | 895 | * |
| 901 | 896 | * @since 2.0.0 bbPress (r2485) |
| 902 | 897 | * |
| 903 | - * @param array $columns The columns. | |
| 898 | + * @param array $columns The columns | |
| 904 | 899 | * |
| 905 | - * @return array $columns bbPress topic columns. | |
| 900 | + * @return array $columns bbPress topic columns | |
| 906 | 901 | */ |
| 907 | 902 | public function column_headers( $columns ) { |
| 908 | 903 | $columns = array( |
| 909 | 904 | 'cb' => '<input type="checkbox" />', |
| @@ -920,14 +915,14 @@ | ||
| 920 | 915 | return (array) apply_filters( 'bbp_admin_topics_column_headers', $columns ); |
| 921 | 916 | } |
| 922 | 917 | |
| 923 | 918 | /** |
| 924 | - * Print extra columns for the topics page. | |
| 919 | + * Print extra columns for the topics page | |
| 925 | 920 | * |
| 926 | 921 | * @since 2.0.0 bbPress (r2485) |
| 927 | 922 | * |
| 928 | - * @param string $column Column. | |
| 929 | - * @param int $topic_id Topic id. | |
| 923 | + * @param string $column Column | |
| 924 | + * @param int $topic_id Topic id | |
| 930 | 925 | */ |
| 931 | 926 | public function column_data( $column, $topic_id ) { |
| 932 | 927 | |
| 933 | 928 | // Get topic forum ID |
| @@ -1000,19 +995,19 @@ | ||
| 1000 | 995 | } |
| 1001 | 996 | } |
| 1002 | 997 | |
| 1003 | 998 | /** |
| 1004 | - * Topic Row actions. | |
| 999 | + * Topic Row actions | |
| 1005 | 1000 | * |
| 1006 | 1001 | * Remove the quick-edit action link under the topic title and add the |
| 1007 | - * content and close/stick/spam links. | |
| 1002 | + * content and close/stick/spam links | |
| 1008 | 1003 | * |
| 1009 | 1004 | * @since 2.0.0 bbPress (r2485) |
| 1010 | 1005 | * |
| 1011 | - * @param array $actions Actions. | |
| 1012 | - * @param object $topic Topic object. | |
| 1006 | + * @param array $actions Actions | |
| 1007 | + * @param object $topic Topic object | |
| 1013 | 1008 | * |
| 1014 | - * @return array $actions Actions. | |
| 1009 | + * @return array $actions Actions | |
| 1015 | 1010 | */ |
| 1016 | 1011 | public function row_actions( $actions = array(), $topic = false ) { |
| 1017 | 1012 | |
| 1018 | 1013 | // Disable quick edit (too much to do here) |
| @@ -1125,9 +1120,9 @@ | ||
| 1125 | 1120 | return $this->sort_row_actions( $actions ); |
| 1126 | 1121 | } |
| 1127 | 1122 | |
| 1128 | 1123 | /** |
| 1129 | - * Sort row actions by key. | |
| 1124 | + * Sort row actions by key | |
| 1130 | 1125 | * |
| 1131 | 1126 | * @since 2.6.0 |
| 1132 | 1127 | * |
| 1133 | 1128 | * @param array $actions |
| @@ -1154,13 +1149,13 @@ | ||
| 1154 | 1149 | return $retval + $actions; |
| 1155 | 1150 | } |
| 1156 | 1151 | |
| 1157 | 1152 | /** |
| 1158 | - * Add forum dropdown to topic and reply list table filters. | |
| 1153 | + * Add forum dropdown to topic and reply list table filters | |
| 1159 | 1154 | * |
| 1160 | 1155 | * @since 2.0.0 bbPress (r2991) |
| 1161 | 1156 | * |
| 1162 | - * @return bool False. If post type is not topic or reply. | |
| 1157 | + * @return bool False. If post type is not topic or reply | |
| 1163 | 1158 | */ |
| 1164 | 1159 | public function filter_dropdown() { |
| 1165 | 1160 | |
| 1166 | 1161 | // Get which forum is selected |
| @@ -1177,9 +1172,9 @@ | ||
| 1177 | 1172 | ); |
| 1178 | 1173 | } |
| 1179 | 1174 | |
| 1180 | 1175 | /** |
| 1181 | - * Add "Empty Spam" button for moderators. | |
| 1176 | + * Add "Empty Spam" button for moderators | |
| 1182 | 1177 | * |
| 1183 | 1178 | * @since 2.6.0 bbPress (r6791) |
| 1184 | 1179 | */ |
| 1185 | 1180 | public function filter_empty_spam() { |
| @@ -1184,17 +1179,9 @@ | ||
| 1184 | 1179 | */ |
| 1185 | 1180 | public function filter_empty_spam() { |
| 1186 | 1181 | |
| 1187 | 1182 | // Bail if not viewing spam |
| 1188 | - if ( | |
| 1189 | - empty( $_GET['post_status'] ) | |
| 1190 | - || | |
| 1191 | - ( | |
| 1192 | - ( bbp_get_spam_status_id() !== $_GET['post_status'] ) | |
| 1193 | - && | |
| 1194 | - current_user_can( 'moderate' ) | |
| 1195 | - ) | |
| 1196 | - ) { | |
| 1183 | + if ( empty( $_GET['post_status'] ) || ( bbp_get_spam_status_id() !== $_GET['post_status'] ) && current_user_can( 'moderate' ) ) { | |
| 1197 | 1184 | return; |
| 1198 | 1185 | } |
| 1199 | 1186 | |
| 1200 | 1187 | ?> |
| @@ -1213,14 +1200,14 @@ | ||
| 1213 | 1200 | ?></div><?php |
| 1214 | 1201 | } |
| 1215 | 1202 | |
| 1216 | 1203 | /** |
| 1217 | - * Adjust the request query and include the forum id. | |
| 1204 | + * Adjust the request query and include the forum id | |
| 1218 | 1205 | * |
| 1219 | 1206 | * @since 2.0.0 bbPress (r2991) |
| 1220 | 1207 | * |
| 1221 | - * @param array $query_vars Query variables from {@link WP_Query}. | |
| 1222 | - * @return array Processed Query Vars. | |
| 1208 | + * @param array $query_vars Query variables from {@link WP_Query} | |
| 1209 | + * @return array Processed Query Vars | |
| 1223 | 1210 | */ |
| 1224 | 1211 | public function filter_post_rows( $query_vars ) { |
| 1225 | 1212 | |
| 1226 | 1213 | // Add post_parent query_var if one is present |
| @@ -1234,9 +1221,9 @@ | ||
| 1234 | 1221 | return $query_vars; |
| 1235 | 1222 | } |
| 1236 | 1223 | |
| 1237 | 1224 | /** |
| 1238 | - * Custom user feedback messages for topic post type. | |
| 1225 | + * Custom user feedback messages for topic post type | |
| 1239 | 1226 | * |
| 1240 | 1227 | * @since 2.0.0 bbPress (r3080) |
| 1241 | 1228 | * |
| 1242 | 1229 | * @global int $post_ID |
| @@ -1327,9 +1314,9 @@ | ||
| 1327 | 1314 | } |
| 1328 | 1315 | endif; // class_exists check |
| 1329 | 1316 | |
| 1330 | 1317 | /** |
| 1331 | - * Setup bbPress Topics Admin. | |
| 1318 | + * Setup bbPress Topics Admin | |
| 1332 | 1319 | * |
| 1333 | 1320 | * This is currently here to make hooking and unhooking of the admin UI easy. |
| 1334 | 1321 | * It could use dependency injection in the future, but for now this is easier. |
| 1335 | 1322 | * |
| @@ -1334,9 +1321,9 @@ | ||
| 1334 | 1321 | * It could use dependency injection in the future, but for now this is easier. |
| 1335 | 1322 | * |
| 1336 | 1323 | * @since 2.0.0 bbPress (r2596) |
| 1337 | 1324 | * |
| 1338 | - * @param WP_Screen $current_screen Current screen object. | |
| 1325 | + * @param WP_Screen $current_screen Current screen object | |
| 1339 | 1326 | */ |
| 1340 | 1327 | function bbp_admin_topics( $current_screen ) { |
| 1341 | 1328 | |
| 1342 | 1329 | // Bail if not a forum screen |