| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * bbPress Replies Admin Class. | |
| 4 | + * bbPress Replies 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_Replies_Admin' ) ) : |
| 14 | 14 | /** |
| 15 | - * Loads bbPress replies admin area. | |
| 15 | + * Loads bbPress replies 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 admin loader. | |
| 33 | + * The main bbPress 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 | * |
| @@ -86,17 +86,12 @@ | ||
| 86 | 86 | // Contextual Help |
| 87 | 87 | add_action( 'load-edit.php', array( $this, 'edit_help' ) ); |
| 88 | 88 | add_action( 'load-post.php', array( $this, 'new_help' ) ); |
| 89 | 89 | add_action( 'load-post-new.php', array( $this, 'new_help' ) ); |
| 90 | - | |
| 91 | - /** Dependencies ******************************************************/ | |
| 92 | - | |
| 93 | - // Allow plugins to modify these actions | |
| 94 | - do_action_ref_array( 'bbp_admin_replies_loaded', array( &$this ) ); | |
| 95 | 90 | } |
| 96 | 91 | |
| 97 | 92 | /** |
| 98 | - * Admin globals. | |
| 93 | + * Admin globals | |
| 99 | 94 | * |
| 100 | 95 | * @since 2.0.0 bbPress (r2646) |
| 101 | 96 | * |
| 102 | 97 | * @access private |
| @@ -107,9 +102,9 @@ | ||
| 107 | 102 | |
| 108 | 103 | /** Contextual Help *******************************************************/ |
| 109 | 104 | |
| 110 | 105 | /** |
| 111 | - * Contextual help for bbPress reply edit page. | |
| 106 | + * Contextual help for bbPress reply edit page | |
| 112 | 107 | * |
| 113 | 108 | * @since 2.0.0 bbPress (r3119) |
| 114 | 109 | */ |
| 115 | 110 | public function edit_help() { |
| @@ -177,9 +172,9 @@ | ||
| 177 | 172 | ); |
| 178 | 173 | } |
| 179 | 174 | |
| 180 | 175 | /** |
| 181 | - * Contextual help for bbPress reply edit page. | |
| 176 | + * Contextual help for bbPress reply edit page | |
| 182 | 177 | * |
| 183 | 178 | * @since 2.0.0 bbPress (r3119) |
| 184 | 179 | */ |
| 185 | 180 | public function new_help() { |
| @@ -291,9 +286,9 @@ | ||
| 291 | 286 | */ |
| 292 | 287 | public function handle_bulk_actions( $sendback, $doaction, $post_ids ) { |
| 293 | 288 | |
| 294 | 289 | $sendback = remove_query_arg( array( 'spam', 'unspam' ), $sendback ); |
| 295 | - $updated = $locked = 0; | |
| 290 | + $updated = $locked = 0; | |
| 296 | 291 | |
| 297 | 292 | if ( 'spam' === $doaction ) { |
| 298 | 293 | |
| 299 | 294 | foreach ( (array) $post_ids as $post_id ) { |
| @@ -301,9 +296,9 @@ | ||
| 301 | 296 | wp_die( esc_html__( 'Sorry, you are not allowed to spam this item.', 'bbpress' ) ); |
| 302 | 297 | } |
| 303 | 298 | |
| 304 | 299 | if ( wp_check_post_lock( $post_id ) ) { |
| 305 | - ++$locked; | |
| 300 | + $locked++; | |
| 306 | 301 | continue; |
| 307 | 302 | } |
| 308 | 303 | |
| 309 | 304 | if ( ! bbp_spam_reply( $post_id ) ) { |
| @@ -329,9 +324,9 @@ | ||
| 329 | 324 | wp_die( esc_html__( 'Sorry, you are not allowed to unspam this reply.', 'bbpress' ) ); |
| 330 | 325 | } |
| 331 | 326 | |
| 332 | 327 | if ( wp_check_post_lock( $post_id ) ) { |
| 333 | - ++$locked; | |
| 328 | + $locked++; | |
| 334 | 329 | continue; |
| 335 | 330 | } |
| 336 | 331 | |
| 337 | 332 | if ( ! bbp_unspam_reply( $post_id ) ) { |
| @@ -354,9 +349,9 @@ | ||
| 354 | 349 | return $sendback; |
| 355 | 350 | } |
| 356 | 351 | |
| 357 | 352 | /** |
| 358 | - * Add the reply attributes meta-box. | |
| 353 | + * Add the reply attributes meta-box | |
| 359 | 354 | * |
| 360 | 355 | * @since 2.0.0 bbPress (r2746) |
| 361 | 356 | */ |
| 362 | 357 | public function attributes_metabox() { |
| @@ -361,9 +356,9 @@ | ||
| 361 | 356 | */ |
| 362 | 357 | public function attributes_metabox() { |
| 363 | 358 | add_meta_box( |
| 364 | 359 | 'bbp_reply_attributes', |
| 365 | - esc_html__( 'Attributes', 'bbpress' ), | |
| 360 | + esc_html__( 'Reply Attributes', 'bbpress' ), | |
| 366 | 361 | 'bbp_reply_metabox', |
| 367 | 362 | $this->post_type, |
| 368 | 363 | 'side', |
| 369 | 364 | 'high' |
| @@ -370,11 +365,11 @@ | ||
| 370 | 365 | ); |
| 371 | 366 | } |
| 372 | 367 | |
| 373 | 368 | /** |
| 374 | - * Add the author info meta-box. | |
| 369 | + * Add the author info meta-box | |
| 375 | 370 | * |
| 376 | - * Allows editing of information about an author. | |
| 371 | + * Allows editing of information about an author | |
| 377 | 372 | * |
| 378 | 373 | * @since 2.0.0 bbPress (r2828) |
| 379 | 374 | */ |
| 380 | 375 | public function author_metabox() { |
| @@ -386,9 +381,9 @@ | ||
| 386 | 381 | |
| 387 | 382 | // Add the meta-box |
| 388 | 383 | add_meta_box( |
| 389 | 384 | 'bbp_author_metabox', |
| 390 | - esc_html__( 'Author', 'bbpress' ), | |
| 385 | + esc_html__( 'Author Information', 'bbpress' ), | |
| 391 | 386 | 'bbp_author_metabox', |
| 392 | 387 | $this->post_type, |
| 393 | 388 | 'side', |
| 394 | 389 | 'high' |
| @@ -395,9 +390,9 @@ | ||
| 395 | 390 | ); |
| 396 | 391 | } |
| 397 | 392 | |
| 398 | 393 | /** |
| 399 | - * Remove comments & discussion meta-boxes if comments are not supported. | |
| 394 | + * Remove comments & discussion meta-boxes if comments are not supported | |
| 400 | 395 | * |
| 401 | 396 | * @since 2.6.0 bbPress (r6186) |
| 402 | 397 | */ |
| 403 | 398 | public function comments_metabox() { |
| @@ -407,14 +402,14 @@ | ||
| 407 | 402 | } |
| 408 | 403 | } |
| 409 | 404 | |
| 410 | 405 | /** |
| 411 | - * Pass the reply attributes for processing. | |
| 406 | + * Pass the reply attributes for processing | |
| 412 | 407 | * |
| 413 | 408 | * @since 2.0.0 bbPress (r2746) |
| 414 | 409 | * |
| 415 | - * @param int $reply_id Reply id. | |
| 416 | - * @return int Parent id. | |
| 410 | + * @param int $reply_id Reply id | |
| 411 | + * @return int Parent id | |
| 417 | 412 | */ |
| 418 | 413 | public function save_meta_boxes( $reply_id ) { |
| 419 | 414 | |
| 420 | 415 | // Bail if doing an autosave |
| @@ -462,11 +457,11 @@ | ||
| 462 | 457 | return $reply_id; |
| 463 | 458 | } |
| 464 | 459 | |
| 465 | 460 | /** |
| 466 | - * Toggle reply. | |
| 461 | + * Toggle reply | |
| 467 | 462 | * |
| 468 | - * Handles the admin-side spamming/unspamming of replies. | |
| 463 | + * Handles the admin-side spamming/unspamming of replies | |
| 469 | 464 | * |
| 470 | 465 | * @since 2.0.0 bbPress (r2740) |
| 471 | 466 | */ |
| 472 | 467 | public function toggle_reply() { |
| @@ -548,9 +543,9 @@ | ||
| 548 | 543 | bbp_redirect( $redirect ); |
| 549 | 544 | } |
| 550 | 545 | |
| 551 | 546 | /** |
| 552 | - * Toggle reply notices. | |
| 547 | + * Toggle reply notices | |
| 553 | 548 | * |
| 554 | 549 | * Display the success/error notices from |
| 555 | 550 | * {@link BBP_Admin::toggle_reply()} |
| 556 | 551 | * |
| @@ -629,9 +624,9 @@ | ||
| 629 | 624 | bbp_admin()->add_notice( $message, $class, true ); |
| 630 | 625 | } |
| 631 | 626 | |
| 632 | 627 | /** |
| 633 | - * Returns an array of keys used to sort row actions. | |
| 628 | + * Returns an array of keys used to sort row actions | |
| 634 | 629 | * |
| 635 | 630 | * @since 2.6.0 bbPress (r6771) |
| 636 | 631 | * |
| 637 | 632 | * @return array |
| @@ -661,9 +656,9 @@ | ||
| 661 | 656 | ); |
| 662 | 657 | } |
| 663 | 658 | |
| 664 | 659 | /** |
| 665 | - * Returns an array of notice toggles. | |
| 660 | + * Returns an array of notice toggles | |
| 666 | 661 | * |
| 667 | 662 | * @since 2.6.0 bbPress (r6396) |
| 668 | 663 | * |
| 669 | 664 | * @return array |
| @@ -669,16 +664,10 @@ | ||
| 669 | 664 | * @return array |
| 670 | 665 | */ |
| 671 | 666 | private function get_allowed_notice_toggles() { |
| 672 | 667 | |
| 673 | - /** | |
| 674 | - * Filters the allowed notice toggles for replies. | |
| 675 | - * | |
| 676 | - * @since 2.6.0 bbPress (r6396) | |
| 677 | - * | |
| 678 | - * @param array $toggles The default notice toggles. | |
| 679 | - */ | |
| 680 | - return (array) apply_filters( | |
| 668 | + // Filter & return | |
| 669 | + return apply_filters( | |
| 681 | 670 | 'bbp_admin_replies_allowed_notice_toggles', |
| 682 | 671 | array( |
| 683 | 672 | 'spammed', |
| 684 | 673 | 'unspammed', |
| @@ -688,9 +677,9 @@ | ||
| 688 | 677 | ); |
| 689 | 678 | } |
| 690 | 679 | |
| 691 | 680 | /** |
| 692 | - * Returns an array of notice toggles. | |
| 681 | + * Returns an array of notice toggles | |
| 693 | 682 | * |
| 694 | 683 | * @since 2.6.0 bbPress (r6396) |
| 695 | 684 | * |
| 696 | 685 | * @return array |
| @@ -696,16 +685,10 @@ | ||
| 696 | 685 | * @return array |
| 697 | 686 | */ |
| 698 | 687 | private function get_allowed_action_toggles() { |
| 699 | 688 | |
| 700 | - /** | |
| 701 | - * Filters the allowed action toggles for replies. | |
| 702 | - * | |
| 703 | - * @since 2.6.0 bbPress (r6396) | |
| 704 | - * | |
| 705 | - * @param array $toggles The default action toggles. | |
| 706 | - */ | |
| 707 | - return (array) apply_filters( | |
| 689 | + // Filter & return | |
| 690 | + return apply_filters( | |
| 708 | 691 | 'bbp_admin_replies_allowed_action_toggles', |
| 709 | 692 | array( |
| 710 | 693 | 'bbp_toggle_reply_spam', |
| 711 | 694 | 'bbp_toggle_reply_approve' |
| @@ -713,15 +696,15 @@ | ||
| 713 | 696 | ); |
| 714 | 697 | } |
| 715 | 698 | |
| 716 | 699 | /** |
| 717 | - * Manage the column headers for the replies page. | |
| 700 | + * Manage the column headers for the replies page | |
| 718 | 701 | * |
| 719 | 702 | * @since 2.0.0 bbPress (r2577) |
| 720 | 703 | * |
| 721 | - * @param array $columns The columns. | |
| 704 | + * @param array $columns The columns | |
| 722 | 705 | * |
| 723 | - * @return array $columns bbPress reply columns. | |
| 706 | + * @return array $columns bbPress reply columns | |
| 724 | 707 | */ |
| 725 | 708 | public function column_headers( $columns ) { |
| 726 | 709 | $columns = array( |
| 727 | 710 | 'cb' => '<input type="checkbox" />', |
| @@ -731,25 +714,19 @@ | ||
| 731 | 714 | 'bbp_reply_author' => esc_html__( 'Author', 'bbpress' ), |
| 732 | 715 | 'bbp_reply_created' => esc_html__( 'Created', 'bbpress' ), |
| 733 | 716 | ); |
| 734 | 717 | |
| 735 | - /** | |
| 736 | - * Filters the column headers for the replies page. | |
| 737 | - * | |
| 738 | - * @since 2.0.0 bbPress (r2577) | |
| 739 | - * | |
| 740 | - * @param array $columns The column headers. | |
| 741 | - */ | |
| 742 | - return (array) apply_filters( 'bbp_admin_replies_column_headers', $columns ); | |
| 718 | + // Filter & return | |
| 719 | + return apply_filters( 'bbp_admin_replies_column_headers', $columns ); | |
| 743 | 720 | } |
| 744 | 721 | |
| 745 | 722 | /** |
| 746 | - * Print extra columns for the replies page. | |
| 723 | + * Print extra columns for the replies page | |
| 747 | 724 | * |
| 748 | 725 | * @since 2.0.0 bbPress (r2577) |
| 749 | 726 | * |
| 750 | - * @param string $column Column. | |
| 751 | - * @param int $reply_id Reply id. | |
| 727 | + * @param string $column Column | |
| 728 | + * @param int $reply_id reply id | |
| 752 | 729 | */ |
| 753 | 730 | public function column_data( $column, $reply_id ) { |
| 754 | 731 | |
| 755 | 732 | // Get topic ID |
| @@ -836,19 +813,19 @@ | ||
| 836 | 813 | } |
| 837 | 814 | } |
| 838 | 815 | |
| 839 | 816 | /** |
| 840 | - * Reply Row actions. | |
| 817 | + * Reply Row actions | |
| 841 | 818 | * |
| 842 | 819 | * Remove the quick-edit action link under the reply title and add the |
| 843 | - * content and spam link. | |
| 820 | + * content and spam link | |
| 844 | 821 | * |
| 845 | 822 | * @since 2.0.0 bbPress (r2577) |
| 846 | 823 | * |
| 847 | - * @param array $actions Actions. | |
| 848 | - * @param object $reply Reply object. | |
| 824 | + * @param array $actions Actions | |
| 825 | + * @param object $reply Reply object | |
| 849 | 826 | * |
| 850 | - * @return array $actions Actions. | |
| 827 | + * @return array $actions Actions | |
| 851 | 828 | */ |
| 852 | 829 | public function row_actions( $actions = array(), $reply = false ) { |
| 853 | 830 | |
| 854 | 831 | // Disable quick edit (too much to do here) |
| @@ -931,9 +908,9 @@ | ||
| 931 | 908 | return $this->sort_row_actions( $actions ); |
| 932 | 909 | } |
| 933 | 910 | |
| 934 | 911 | /** |
| 935 | - * Sort row actions by key. | |
| 912 | + * Sort row actions by key | |
| 936 | 913 | * |
| 937 | 914 | * @since 2.6.0 |
| 938 | 915 | * |
| 939 | 916 | * @param array $actions |
| @@ -960,13 +937,13 @@ | ||
| 960 | 937 | return $retval + $actions; |
| 961 | 938 | } |
| 962 | 939 | |
| 963 | 940 | /** |
| 964 | - * Add forum dropdown to topic and reply list table filters. | |
| 941 | + * Add forum dropdown to topic and reply list table filters | |
| 965 | 942 | * |
| 966 | 943 | * @since 2.0.0 bbPress (r2991) |
| 967 | 944 | * |
| 968 | - * @return bool False. If post type is not topic or reply. | |
| 945 | + * @return bool False. If post type is not topic or reply | |
| 969 | 946 | */ |
| 970 | 947 | public function filter_dropdown() { |
| 971 | 948 | |
| 972 | 949 | // Get which forum is selected |
| @@ -983,9 +960,9 @@ | ||
| 983 | 960 | ); |
| 984 | 961 | } |
| 985 | 962 | |
| 986 | 963 | /** |
| 987 | - * Add "Empty Spam" button for moderators. | |
| 964 | + * Add "Empty Spam" button for moderators | |
| 988 | 965 | * |
| 989 | 966 | * @since 2.6.0 bbPress (r6791) |
| 990 | 967 | */ |
| 991 | 968 | public function filter_empty_spam() { |
| @@ -990,17 +967,9 @@ | ||
| 990 | 967 | */ |
| 991 | 968 | public function filter_empty_spam() { |
| 992 | 969 | |
| 993 | 970 | // Bail if not viewing spam |
| 994 | - if ( | |
| 995 | - empty( $_GET['post_status'] ) | |
| 996 | - || | |
| 997 | - ( | |
| 998 | - ( bbp_get_spam_status_id() !== $_GET['post_status'] ) | |
| 999 | - && | |
| 1000 | - current_user_can( 'moderate' ) | |
| 1001 | - ) | |
| 1002 | - ) { | |
| 971 | + if ( empty( $_GET['post_status'] ) || ( bbp_get_spam_status_id() !== $_GET['post_status'] ) && current_user_can( 'moderate' ) ) { | |
| 1003 | 972 | return; |
| 1004 | 973 | } |
| 1005 | 974 | |
| 1006 | 975 | ?> |
| @@ -1019,14 +988,14 @@ | ||
| 1019 | 988 | ?></div><?php |
| 1020 | 989 | } |
| 1021 | 990 | |
| 1022 | 991 | /** |
| 1023 | - * Adjust the request query and include the forum id. | |
| 992 | + * Adjust the request query and include the forum id | |
| 1024 | 993 | * |
| 1025 | 994 | * @since 2.0.0 bbPress (r2991) |
| 1026 | 995 | * |
| 1027 | - * @param array $query_vars Query variables from {@link WP_Query}. | |
| 1028 | - * @return array Processed Query Vars. | |
| 996 | + * @param array $query_vars Query variables from {@link WP_Query} | |
| 997 | + * @return array Processed Query Vars | |
| 1029 | 998 | */ |
| 1030 | 999 | public function filter_post_rows( $query_vars ) { |
| 1031 | 1000 | |
| 1032 | 1001 | // Add post_parent query_var if one is present |
| @@ -1040,13 +1009,13 @@ | ||
| 1040 | 1009 | return $query_vars; |
| 1041 | 1010 | } |
| 1042 | 1011 | |
| 1043 | 1012 | /** |
| 1044 | - * Custom user feedback messages for reply post type. | |
| 1013 | + * Custom user feedback messages for reply post type | |
| 1045 | 1014 | * |
| 1046 | 1015 | * @since 2.0.0 bbPress (r3080) |
| 1047 | 1016 | * |
| 1048 | - * @global int $post_ID. | |
| 1017 | + * @global int $post_ID | |
| 1049 | 1018 | * |
| 1050 | 1019 | * @param array $messages |
| 1051 | 1020 | * |
| 1052 | 1021 | * @return array |
| @@ -1133,9 +1102,9 @@ | ||
| 1133 | 1102 | } |
| 1134 | 1103 | endif; // class_exists check |
| 1135 | 1104 | |
| 1136 | 1105 | /** |
| 1137 | - * Setup bbPress Replies Admin. | |
| 1106 | + * Setup bbPress Replies Admin | |
| 1138 | 1107 | * |
| 1139 | 1108 | * This is currently here to make hooking and unhooking of the admin UI easy. |
| 1140 | 1109 | * It could use dependency injection in the future, but for now this is easier. |
| 1141 | 1110 | * |
| @@ -1140,9 +1109,9 @@ | ||
| 1140 | 1109 | * It could use dependency injection in the future, but for now this is easier. |
| 1141 | 1110 | * |
| 1142 | 1111 | * @since 2.0.0 bbPress (r2596) |
| 1143 | 1112 | * |
| 1144 | - * @param WP_Screen $current_screen Current screen object. | |
| 1113 | + * @param WP_Screen $current_screen Current screen object | |
| 1145 | 1114 | */ |
| 1146 | 1115 | function bbp_admin_replies( $current_screen ) { |
| 1147 | 1116 | |
| 1148 | 1117 | // Bail if not a forum screen |