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/replies.php +56 -87 trunk → 2.6.19 View file →
@@ -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 (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_topic_moves = array();
@@ -31,9 +31,9 @@
31 31
32 32 /** Functions *************************************************************/
33 33
34 34 /**
35 - * The main bbPress admin loader.
35 + * The main bbPress 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 *
@@ -89,17 +89,12 @@
89 89 // Contextual Help
90 90 add_action( 'load-edit.php', array( $this, 'edit_help' ) );
91 91 add_action( 'load-post.php', array( $this, 'new_help' ) );
92 92 add_action( 'load-post-new.php', array( $this, 'new_help' ) );
93 -
94 - /** Dependencies ******************************************************/
95 -
96 - // Allow plugins to modify these actions
97 - do_action_ref_array( 'bbp_admin_replies_loaded', array( &$this ) );
98 93 }
99 94
100 95 /**
101 - * Admin globals.
96 + * Admin globals
102 97 *
103 98 * @since 2.0.0 bbPress (r3376)
104 99 *
105 100 * @access private
@@ -110,9 +105,9 @@
110 105
111 106 /** Contextual Help *******************************************************/
112 107
113 108 /**
114 - * Contextual help for bbPress reply edit page.
109 + * Contextual help for bbPress reply edit page
115 110 *
116 111 * @since 2.1.0 bbPress (r3686)
117 112 */
118 113 public function edit_help() {
@@ -180,9 +175,9 @@
180 175 );
181 176 }
182 177
183 178 /**
184 - * Contextual help for bbPress reply edit page.
179 + * Contextual help for bbPress reply edit page
185 180 *
186 181 * @since 2.1.0 bbPress (r3686)
187 182 */
188 183 public function new_help() {
@@ -294,9 +289,9 @@
294 289 */
295 290 public function handle_bulk_actions( $sendback, $doaction, $post_ids ) {
296 291
297 292 $sendback = remove_query_arg( array( 'spam', 'unspam' ), $sendback );
298 - $updated = $locked = 0;
293 + $updated = $locked = 0;
299 294
300 295 if ( 'spam' === $doaction ) {
301 296
302 297 foreach ( (array) $post_ids as $post_id ) {
@@ -304,9 +299,9 @@
304 299 wp_die( esc_html__( 'Sorry, you are not allowed to spam this item.', 'bbpress' ) );
305 300 }
306 301
307 302 if ( wp_check_post_lock( $post_id ) ) {
308 - ++$locked;
303 + $locked++;
309 304 continue;
310 305 }
311 306
312 307 if ( ! bbp_spam_reply( $post_id ) ) {
@@ -332,9 +327,9 @@
332 327 wp_die( esc_html__( 'Sorry, you are not allowed to unspam this reply.', 'bbpress' ) );
333 328 }
334 329
335 330 if ( wp_check_post_lock( $post_id ) ) {
336 - ++$locked;
331 + $locked++;
337 332 continue;
338 333 }
339 334
340 335 if ( ! bbp_unspam_reply( $post_id ) ) {
@@ -357,9 +352,9 @@
357 352 return $sendback;
358 353 }
359 354
360 355 /**
361 - * Add the reply attributes meta-box.
356 + * Add the reply attributes meta-box
362 357 *
363 358 * @since 2.4.0 bbPress (r4991)
364 359 */
365 360 public function attributes_metabox() {
@@ -364,9 +359,9 @@
364 359 */
365 360 public function attributes_metabox() {
366 361 add_meta_box(
367 362 'bbp_reply_attributes',
368 - esc_html__( 'Attributes', 'bbpress' ),
363 + esc_html__( 'Reply Attributes', 'bbpress' ),
369 364 'bbp_reply_metabox',
370 365 $this->post_type,
371 366 'side',
372 367 'high'
@@ -373,11 +368,11 @@
373 368 );
374 369 }
375 370
376 371 /**
377 - * Add the author info meta-box.
372 + * Add the author info meta-box
378 373 *
379 - * Allows editing of information about an author.
374 + * Allows editing of information about an author
380 375 *
381 376 * @since 2.0.0 bbPress (r3120)
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 - * Remove comments & discussion meta-boxes if comments are not supported.
397 + * Remove comments & discussion meta-boxes if comments are not supported
403 398 *
404 399 * @since 2.6.0 bbPress (r6186)
405 400 */
406 401 public function comments_metabox() {
@@ -410,14 +405,14 @@
410 405 }
411 406 }
412 407
413 408 /**
414 - * Pass the reply attributes for processing.
409 + * Pass the reply attributes for processing
415 410 *
416 411 * @since 2.6.0 bbPress (r6056)
417 412 *
418 - * @param int $reply_id Reply id.
419 - * @return int Parent id.
413 + * @param int $reply_id Reply id
414 + * @return int Parent id
420 415 */
421 416 public function save_meta_boxes( $reply_id ) {
422 417 $accepted_move = isset( $this->accepted_topic_moves[ $reply_id ] )
423 418 ? $this->accepted_topic_moves[ $reply_id ]
@@ -485,9 +480,9 @@
485 480
486 481 /**
487 482 * Keep admin reply moves within topics the current user may moderate.
488 483 *
489 - * @since 2.6.19 bbPress (r7687)
484 + * @since 2.6.19 bbPress (r7688)
490 485 *
491 486 * @param array $data Sanitized post data.
492 487 * @param array $postarr Unprocessed post data.
493 488 * @return array Filtered post data.
@@ -552,11 +547,11 @@
552 547 return $data;
553 548 }
554 549
555 550 /**
556 - * Toggle reply.
551 + * Toggle reply
557 552 *
558 - * Handles the admin-side spamming/unspamming of replies.
553 + * Handles the admin-side spamming/unspamming of replies
559 554 *
560 555 * @since 2.0.0 bbPress (r3095)
561 556 */
562 557 public function toggle_reply() {
@@ -638,9 +633,9 @@
638 633 bbp_redirect( $redirect );
639 634 }
640 635
641 636 /**
642 - * Toggle reply notices.
637 + * Toggle reply notices
643 638 *
644 639 * Display the success/error notices from
645 640 * {@link BBP_Admin::toggle_reply()}
646 641 *
@@ -719,9 +714,9 @@
719 714 bbp_admin()->add_notice( $message, $class, true );
720 715 }
721 716
722 717 /**
723 - * Returns an array of keys used to sort row actions.
718 + * Returns an array of keys used to sort row actions
724 719 *
725 720 * @since 2.6.0 bbPress (r6772)
726 721 *
727 722 * @return array
@@ -751,9 +746,9 @@
751 746 );
752 747 }
753 748
754 749 /**
755 - * Returns an array of notice toggles.
750 + * Returns an array of notice toggles
756 751 *
757 752 * @since 2.6.0 bbPress (r6397)
758 753 *
759 754 * @return array
@@ -759,16 +754,10 @@
759 754 * @return array
760 755 */
761 756 private function get_allowed_notice_toggles() {
762 757
763 - /**
764 - * Filters the allowed notice toggles for replies.
765 - *
766 - * @since 2.6.0 bbPress (r6397)
767 - *
768 - * @param array $toggles The default notice toggles.
769 - */
770 - return (array) apply_filters(
758 + // Filter & return
759 + return apply_filters(
771 760 'bbp_admin_replies_allowed_notice_toggles',
772 761 array(
773 762 'spammed',
774 763 'unspammed',
@@ -778,9 +767,9 @@
778 767 );
779 768 }
780 769
781 770 /**
782 - * Returns an array of notice toggles.
771 + * Returns an array of notice toggles
783 772 *
784 773 * @since 2.6.0 bbPress (r6397)
785 774 *
786 775 * @return array
@@ -786,16 +775,10 @@
786 775 * @return array
787 776 */
788 777 private function get_allowed_action_toggles() {
789 778
790 - /**
791 - * Filters the allowed action toggles for replies.
792 - *
793 - * @since 2.6.0 bbPress (r6397)
794 - *
795 - * @param array $toggles The default action toggles.
796 - */
797 - return (array) apply_filters(
779 + // Filter & return
780 + return apply_filters(
798 781 'bbp_admin_replies_allowed_action_toggles',
799 782 array(
800 783 'bbp_toggle_reply_spam',
801 784 'bbp_toggle_reply_approve'
@@ -803,15 +786,15 @@
803 786 );
804 787 }
805 788
806 789 /**
807 - * Manage the column headers for the replies page.
790 + * Manage the column headers for the replies page
808 791 *
809 792 * @since 2.4.0 bbPress (r4991)
810 793 *
811 - * @param array $columns The columns.
794 + * @param array $columns The columns
812 795 *
813 - * @return array $columns bbPress reply columns.
796 + * @return array $columns bbPress reply columns
814 797 */
815 798 public function column_headers( $columns ) {
816 799 $columns = array(
817 800 'cb' => '<input type="checkbox" />',
@@ -821,25 +804,19 @@
821 804 'bbp_reply_author' => esc_html__( 'Author', 'bbpress' ),
822 805 'bbp_reply_created' => esc_html__( 'Created', 'bbpress' ),
823 806 );
824 807
825 - /**
826 - * Filters the column headers for the replies page.
827 - *
828 - * @since 2.0.0 bbPress (r2754)
829 - *
830 - * @param array $columns The column headers.
831 - */
832 - return (array) apply_filters( 'bbp_admin_replies_column_headers', $columns );
808 + // Filter & return
809 + return apply_filters( 'bbp_admin_replies_column_headers', $columns );
833 810 }
834 811
835 812 /**
836 - * Print extra columns for the replies page.
813 + * Print extra columns for the replies page
837 814 *
838 815 * @since 2.4.0 bbPress (r4991)
839 816 *
840 - * @param string $column Column.
841 - * @param int $reply_id Reply id.
817 + * @param string $column Column
818 + * @param int $reply_id reply id
842 819 */
843 820 public function column_data( $column, $reply_id ) {
844 821
845 822 // Get topic ID
@@ -926,19 +903,19 @@
926 903 }
927 904 }
928 905
929 906 /**
930 - * Reply Row actions.
907 + * Reply Row actions
931 908 *
932 909 * Remove the quick-edit action link under the reply title and add the
933 - * content and spam link.
910 + * content and spam link
934 911 *
935 912 * @since 2.4.0 bbPress (r4991)
936 913 *
937 - * @param array $actions Actions.
938 - * @param object $reply Reply object.
914 + * @param array $actions Actions
915 + * @param object $reply Reply object
939 916 *
940 - * @return array $actions Actions.
917 + * @return array $actions Actions
941 918 */
942 919 public function row_actions( $actions = array(), $reply = false ) {
943 920
944 921 // Disable quick edit (too much to do here)
@@ -1021,9 +998,9 @@
1021 998 return $this->sort_row_actions( $actions );
1022 999 }
1023 1000
1024 1001 /**
1025 - * Sort row actions by key.
1002 + * Sort row actions by key
1026 1003 *
1027 1004 * @since 2.6.0 bbPress (r6772)
1028 1005 *
1029 1006 * @param array $actions
@@ -1050,13 +1027,13 @@
1050 1027 return $retval + $actions;
1051 1028 }
1052 1029
1053 1030 /**
1054 - * Add forum dropdown to topic and reply list table filters.
1031 + * Add forum dropdown to topic and reply list table filters
1055 1032 *
1056 1033 * @since 2.0.0 bbPress (r3095)
1057 1034 *
1058 - * @return bool False. If post type is not topic or reply.
1035 + * @return bool False. If post type is not topic or reply
1059 1036 */
1060 1037 public function filter_dropdown() {
1061 1038
1062 1039 // Get which forum is selected
@@ -1073,9 +1050,9 @@
1073 1050 );
1074 1051 }
1075 1052
1076 1053 /**
1077 - * Add "Empty Spam" button for moderators.
1054 + * Add "Empty Spam" button for moderators
1078 1055 *
1079 1056 * @since 2.6.0 bbPress (r6791)
1080 1057 */
1081 1058 public function filter_empty_spam() {
@@ -1080,17 +1057,9 @@
1080 1057 */
1081 1058 public function filter_empty_spam() {
1082 1059
1083 1060 // Bail if not viewing spam
1084 - if (
1085 - empty( $_GET['post_status'] )
1086 - ||
1087 - (
1088 - ( bbp_get_spam_status_id() !== $_GET['post_status'] )
1089 - &&
1090 - current_user_can( 'moderate' )
1091 - )
1092 - ) {
1061 + if ( empty( $_GET['post_status'] ) || ( bbp_get_spam_status_id() !== $_GET['post_status'] ) && current_user_can( 'moderate' ) ) {
1093 1062 return;
1094 1063 }
1095 1064
1096 1065 ?>
@@ -1109,14 +1078,14 @@
1109 1078 ?></div><?php
1110 1079 }
1111 1080
1112 1081 /**
1113 - * Adjust the request query and include the forum id.
1082 + * Adjust the request query and include the forum id
1114 1083 *
1115 1084 * @since 2.0.0 bbPress (r3095)
1116 1085 *
1117 - * @param array $query_vars Query variables from {@link WP_Query}.
1118 - * @return array Processed Query Vars.
1086 + * @param array $query_vars Query variables from {@link WP_Query}
1087 + * @return array Processed Query Vars
1119 1088 */
1120 1089 public function filter_post_rows( $query_vars ) {
1121 1090
1122 1091 // Add post_parent query_var if one is present
@@ -1130,13 +1099,13 @@
1130 1099 return $query_vars;
1131 1100 }
1132 1101
1133 1102 /**
1134 - * Custom user feedback messages for reply post type.
1103 + * Custom user feedback messages for reply post type
1135 1104 *
1136 1105 * @since 2.0.0 bbPress (r3097)
1137 1106 *
1138 - * @global int $post_ID.
1107 + * @global int $post_ID
1139 1108 *
1140 1109 * @param array $messages
1141 1110 *
1142 1111 * @return array
@@ -1223,9 +1192,9 @@
1223 1192 }
1224 1193 endif; // class_exists check
1225 1194
1226 1195 /**
1227 - * Setup bbPress Replies Admin.
1196 + * Setup bbPress Replies Admin
1228 1197 *
1229 1198 * This is currently here to make hooking and unhooking of the admin UI easy.
1230 1199 * It could use dependency injection in the future, but for now this is easier.
1231 1200 *
@@ -1230,9 +1199,9 @@
1230 1199 * It could use dependency injection in the future, but for now this is easier.
1231 1200 *
1232 1201 * @since 2.0.0 bbPress (r3343)
1233 1202 *
1234 - * @param WP_Screen $current_screen Current screen object.
1203 + * @param WP_Screen $current_screen Current screen object
1235 1204 */
1236 1205 function bbp_admin_replies( $current_screen ) {
1237 1206
1238 1207 // Bail if not in site admin