PluginProbe
bbPress / 2.6.15
bbPress v2.6.15
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 2.2.2 All 71 releases
← All changes | includes/admin/forums.php +144 -213 trunk2.6.15 View file →
@@ -1,8 +1,8 @@
1 1 <?php
2 2
3 3 /**
4 - * bbPress Forum Admin Class.
4 + * bbPress Forum 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_Forums_Admin' ) ) :
14 14 /**
15 - * Loads bbPress forums admin area.
15 + * Loads bbPress forums 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 string The post type of this admin component.
26 + * @var string 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 forums admin loader.
33 + * The main bbPress forums 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 *
47 47 * @access private
@@ -72,17 +72,12 @@
72 72 // Contextual Help
73 73 add_action( 'load-edit.php', array( $this, 'edit_help' ) );
74 74 add_action( 'load-post.php', array( $this, 'new_help' ) );
75 75 add_action( 'load-post-new.php', array( $this, 'new_help' ) );
76 -
77 - /** Dependencies ******************************************************/
78 -
79 - // Allow plugins to modify these actions
80 - do_action_ref_array( 'bbp_admin_forums_loaded', array( &$this ) );
81 76 }
82 77
83 78 /**
84 - * Admin globals.
79 + * Admin globals
85 80 *
86 81 * @since 2.0.0 bbPress (r2646)
87 82 *
88 83 * @access private
@@ -93,9 +88,9 @@
93 88
94 89 /** Contextual Help *******************************************************/
95 90
96 91 /**
97 - * Contextual help for bbPress forum edit page.
92 + * Contextual help for bbPress forum edit page
98 93 *
99 94 * @since 2.0.0 bbPress (r3119)
100 95 */
101 96 public function edit_help() {
@@ -100,58 +95,50 @@
100 95 */
101 96 public function edit_help() {
102 97
103 98 // Overview
104 - get_current_screen()->add_help_tab(
105 - array(
106 - 'id' => 'overview',
107 - 'title' => __( 'Overview', 'bbpress' ),
108 - 'content' =>
109 - '<p>' . __( 'This screen displays the individual forums on your site. You can customize the display of this screen to suit your workflow.', 'bbpress' ) . '</p>'
110 - )
111 - );
99 + get_current_screen()->add_help_tab( array(
100 + 'id' => 'overview',
101 + 'title' => __( 'Overview', 'bbpress' ),
102 + 'content' =>
103 + '<p>' . __( 'This screen displays the individual forums on your site. You can customize the display of this screen to suit your workflow.', 'bbpress' ) . '</p>'
104 + ) );
112 105
113 106 // Screen Content
114 - get_current_screen()->add_help_tab(
115 - array(
116 - 'id' => 'screen-content',
117 - 'title' => __( 'Screen Content', 'bbpress' ),
118 - 'content' =>
119 - '<p>' . __( 'You can customize the display of this screen&#8217;s contents in a number of ways:', 'bbpress' ) . '</p>' .
120 - '<ul>' .
121 - '<li>' . __( 'You can hide/display columns based on your needs and decide how many forums to list per screen using the Screen Options tab.', 'bbpress' ) . '</li>' .
122 - '<li>' . __( 'You can filter the list of forums by forum status using the text links in the upper left to show All, Published, or Trashed forums. The default view is to show all forums.', 'bbpress' ) . '</li>' .
123 - '<li>' . __( 'You can refine the list to show only forums from a specific month by using the dropdown menus above the forums list. Click the Filter button after making your selection. You also can refine the list by clicking on the forum creator in the forums list.', 'bbpress' ) . '</li>' .
124 - '</ul>'
125 - )
126 - );
107 + get_current_screen()->add_help_tab( array(
108 + 'id' => 'screen-content',
109 + 'title' => __( 'Screen Content', 'bbpress' ),
110 + 'content' =>
111 + '<p>' . __( 'You can customize the display of this screen&#8217;s contents in a number of ways:', 'bbpress' ) . '</p>' .
112 + '<ul>' .
113 + '<li>' . __( 'You can hide/display columns based on your needs and decide how many forums to list per screen using the Screen Options tab.', 'bbpress' ) . '</li>' .
114 + '<li>' . __( 'You can filter the list of forums by forum status using the text links in the upper left to show All, Published, or Trashed forums. The default view is to show all forums.', 'bbpress' ) . '</li>' .
115 + '<li>' . __( 'You can refine the list to show only forums from a specific month by using the dropdown menus above the forums list. Click the Filter button after making your selection. You also can refine the list by clicking on the forum creator in the forums list.', 'bbpress' ) . '</li>' .
116 + '</ul>'
117 + ) );
127 118
128 119 // Available Actions
129 - get_current_screen()->add_help_tab(
130 - array(
131 - 'id' => 'action-links',
132 - 'title' => __( 'Available Actions', 'bbpress' ),
133 - 'content' =>
134 - '<p>' . __( 'Hovering over a row in the forums list will display action links that allow you to manage your forum. You can perform the following actions:', 'bbpress' ) . '</p>' .
135 - '<ul>' .
136 - '<li>' . __( '<strong>Edit</strong> takes you to the editing screen for that forum. You can also reach that screen by clicking on the forum title.', 'bbpress' ) . '</li>' .
137 - '<li>' . __( '<strong>Close</strong> will mark the selected forum as &#8217;closed&#8217; and disable the ability to post new topics and replies in it.', 'bbpress' ) . '</li>' .
138 - '<li>' . __( '<strong>Trash</strong> removes your forum from this list and places it in the trash, from which you can permanently delete it.', 'bbpress' ) . '</li>' .
139 - '<li>' . __( '<strong>View</strong> will either show you what your draft forum will look like if you publish it, or take you to your live site to view it. Which link depends on your forum&#8217;s status.', 'bbpress' ) . '</li>' .
140 - '</ul>'
141 - )
142 - );
120 + get_current_screen()->add_help_tab( array(
121 + 'id' => 'action-links',
122 + 'title' => __( 'Available Actions', 'bbpress' ),
123 + 'content' =>
124 + '<p>' . __( 'Hovering over a row in the forums list will display action links that allow you to manage your forum. You can perform the following actions:', 'bbpress' ) . '</p>' .
125 + '<ul>' .
126 + '<li>' . __( '<strong>Edit</strong> takes you to the editing screen for that forum. You can also reach that screen by clicking on the forum title.', 'bbpress' ) . '</li>' .
127 + '<li>' . __( '<strong>Close</strong> will mark the selected forum as &#8217;closed&#8217; and disable the ability to post new topics and replies in it.', 'bbpress' ) . '</li>' .
128 + '<li>' . __( '<strong>Trash</strong> removes your forum from this list and places it in the trash, from which you can permanently delete it.', 'bbpress' ) . '</li>' .
129 + '<li>' . __( '<strong>View</strong> will either show you what your draft forum will look like if you publish it, or take you to your live site to view it. Which link depends on your forum&#8217;s status.', 'bbpress' ) . '</li>' .
130 + '</ul>'
131 + ) );
143 132
144 133 // Bulk Actions
145 - get_current_screen()->add_help_tab(
146 - array(
147 - 'id' => 'bulk-actions',
148 - 'title' => __( 'Bulk Actions', 'bbpress' ),
149 - 'content' =>
150 - '<p>' . __( 'You can also edit or move multiple forums to the trash at once. Select the forums you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply.', 'bbpress' ) . '</p>' .
151 - '<p>' . __( 'When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected forums at once. To remove a forum from the grouping, just click the x next to its name in the Bulk Edit area that appears.', 'bbpress' ) . '</p>'
152 - )
153 - );
134 + get_current_screen()->add_help_tab( array(
135 + 'id' => 'bulk-actions',
136 + 'title' => __( 'Bulk Actions', 'bbpress' ),
137 + 'content' =>
138 + '<p>' . __( 'You can also edit or move multiple forums to the trash at once. Select the forums you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply.', 'bbpress' ) . '</p>' .
139 + '<p>' . __( 'When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected forums at once. To remove a forum from the grouping, just click the x next to its name in the Bulk Edit area that appears.', 'bbpress' ) . '</p>'
140 + ) );
154 141
155 142 // Help Sidebar
156 143 get_current_screen()->set_help_sidebar(
157 144 '<p><strong>' . __( 'For more information:', 'bbpress' ) . '</strong></p>' .
@@ -160,9 +147,9 @@
160 147 );
161 148 }
162 149
163 150 /**
164 - * Contextual help for bbPress forum edit page.
151 + * Contextual help for bbPress forum edit page
165 152 *
166 153 * @since 2.0.0 bbPress (r3119)
167 154 */
168 155 public function new_help() {
@@ -168,25 +155,21 @@
168 155 public function new_help() {
169 156
170 157 $customize_display = '<p>' . __( 'The title field and the big forum editing Area are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.', 'bbpress' ) . '</p>';
171 158
172 - get_current_screen()->add_help_tab(
173 - array(
174 - 'id' => 'customize-display',
175 - 'title' => __( 'Customizing This Display', 'bbpress' ),
176 - 'content' => $customize_display,
177 - )
178 - );
159 + get_current_screen()->add_help_tab( array(
160 + 'id' => 'customize-display',
161 + 'title' => __( 'Customizing This Display', 'bbpress' ),
162 + 'content' => $customize_display,
163 + ) );
179 164
180 - get_current_screen()->add_help_tab(
181 - array(
182 - 'id' => 'title-forum-editor',
183 - 'title' => __( 'Title and Forum Editor', 'bbpress' ),
184 - 'content' =>
185 - '<p>' . __( '<strong>Title</strong> - Enter a title for your forum. After you enter a title, you&#8217;ll see the permalink below, which you can edit.', 'bbpress' ) . '</p>' .
186 - '<p>' . __( '<strong>Forum Editor</strong> - Enter the text for your forum. There are two modes of editing: Visual and HTML. Choose the mode by clicking on the appropriate tab. Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. The HTML mode allows you to enter raw HTML along with your forum text. You can insert media files by clicking the icons above the forum editor and following the directions. You can go to the distraction-free writing screen via the Fullscreen icon in Visual mode (second to last in the top row) or the Fullscreen button in HTML mode (last in the row). Once there, you can make buttons visible by hovering over the top area. Exit Fullscreen back to the regular forum editor.', 'bbpress' ) . '</p>'
187 - )
188 - );
165 + get_current_screen()->add_help_tab( array(
166 + 'id' => 'title-forum-editor',
167 + 'title' => __( 'Title and Forum Editor', 'bbpress' ),
168 + 'content' =>
169 + '<p>' . __( '<strong>Title</strong> - Enter a title for your forum. After you enter a title, you&#8217;ll see the permalink below, which you can edit.', 'bbpress' ) . '</p>' .
170 + '<p>' . __( '<strong>Forum Editor</strong> - Enter the text for your forum. There are two modes of editing: Visual and HTML. Choose the mode by clicking on the appropriate tab. Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. The HTML mode allows you to enter raw HTML along with your forum text. You can insert media files by clicking the icons above the forum editor and following the directions. You can go to the distraction-free writing screen via the Fullscreen icon in Visual mode (second to last in the top row) or the Fullscreen button in HTML mode (last in the row). Once there, you can make buttons visible by hovering over the top area. Exit Fullscreen back to the regular forum editor.', 'bbpress' ) . '</p>'
171 + ) );
189 172
190 173 $publish_box = '<p>' . __( '<strong>Publish</strong> - You can set the terms of publishing your forum in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a forum or making it stay at the top of your blog indefinitely (sticky). Publish (immediately) allows you to set a future or past date and time, so you can schedule a forum to be published in the future or backdate a forum.', 'bbpress' ) . '</p>';
191 174
192 175 if ( current_theme_supports( 'forum-thumbnails' ) && post_type_supports( 'forum', 'thumbnail' ) ) {
@@ -192,31 +175,27 @@
192 175 if ( current_theme_supports( 'forum-thumbnails' ) && post_type_supports( 'forum', 'thumbnail' ) ) {
193 176 $publish_box .= '<p>' . __( '<strong>Featured Image</strong> - This allows you to associate an image with your forum without inserting it. This is usually useful only if your theme makes use of the featured image as a forum thumbnail on the home page, a custom header, etc.', 'bbpress' ) . '</p>';
194 177 }
195 178
196 - get_current_screen()->add_help_tab(
197 - array(
198 - 'id' => 'forum-attributes',
199 - 'title' => __( 'Forum Attributes', 'bbpress' ),
200 - 'content' =>
201 - '<p>' . __( 'Select the attributes that your forum should have:', 'bbpress' ) . '</p>' .
202 - '<ul>' .
203 - '<li>' . __( '<strong>Type</strong> indicates if the forum is a category or forum. Categories generally contain other forums.', 'bbpress' ) . '</li>' .
204 - '<li>' . __( '<strong>Status</strong> allows you to close a forum to new topics and forums.', 'bbpress' ) . '</li>' .
205 - '<li>' . __( '<strong>Visibility</strong> lets you pick the scope of each forum and what users are allowed to access it.', 'bbpress' ) . '</li>' .
206 - '<li>' . __( '<strong>Parent</strong> dropdown determines the parent forum. Select the forum or category from the dropdown, or leave the default "No parent" to create the forum at the root of your forums.', 'bbpress' ) . '</li>' .
207 - '<li>' . __( '<strong>Order</strong> allows you to order your forums numerically.', 'bbpress' ) . '</li>' .
208 - '</ul>'
209 - )
210 - );
179 + get_current_screen()->add_help_tab( array(
180 + 'id' => 'forum-attributes',
181 + 'title' => __( 'Forum Attributes', 'bbpress' ),
182 + 'content' =>
183 + '<p>' . __( 'Select the attributes that your forum should have:', 'bbpress' ) . '</p>' .
184 + '<ul>' .
185 + '<li>' . __( '<strong>Type</strong> indicates if the forum is a category or forum. Categories generally contain other forums.', 'bbpress' ) . '</li>' .
186 + '<li>' . __( '<strong>Status</strong> allows you to close a forum to new topics and forums.', 'bbpress' ) . '</li>' .
187 + '<li>' . __( '<strong>Visibility</strong> lets you pick the scope of each forum and what users are allowed to access it.', 'bbpress' ) . '</li>' .
188 + '<li>' . __( '<strong>Parent</strong> dropdown determines the parent forum. Select the forum or category from the dropdown, or leave the default "No parent" to create the forum at the root of your forums.', 'bbpress' ) . '</li>' .
189 + '<li>' . __( '<strong>Order</strong> allows you to order your forums numerically.', 'bbpress' ) . '</li>' .
190 + '</ul>'
191 + ) );
211 192
212 - get_current_screen()->add_help_tab(
213 - array(
214 - 'id' => 'publish-box',
215 - 'title' => __( 'Publish Box', 'bbpress' ),
216 - 'content' => $publish_box,
217 - )
218 - );
193 + get_current_screen()->add_help_tab( array(
194 + 'id' => 'publish-box',
195 + 'title' => __( 'Publish Box', 'bbpress' ),
196 + 'content' => $publish_box,
197 + ) );
219 198
220 199 get_current_screen()->set_help_sidebar(
221 200 '<p><strong>' . __( 'For more information:', 'bbpress' ) . '</strong></p>' .
222 201 '<p>' . __( '<a href="https://codex.bbpress.org" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' .
@@ -224,9 +203,9 @@
224 203 );
225 204 }
226 205
227 206 /**
228 - * Add the forum attributes meta-box.
207 + * Add the forum attributes meta-box
229 208 *
230 209 * @since 2.0.0 bbPress (r2746)
231 210 */
232 211 public function attributes_metabox() {
@@ -231,9 +210,9 @@
231 210 */
232 211 public function attributes_metabox() {
233 212 add_meta_box(
234 213 'bbp_forum_attributes',
235 - esc_html__( 'Attributes', 'bbpress' ),
214 + esc_html__( 'Forum Attributes', 'bbpress' ),
236 215 'bbp_forum_metabox',
237 216 $this->post_type,
238 217 'side',
239 218 'high'
@@ -240,9 +219,9 @@
240 219 );
241 220 }
242 221
243 222 /**
244 - * Add the forum moderators meta-box.
223 + * Add the forum moderators meta-box
245 224 *
246 225 * @since 2.6.0 bbPress
247 226 */
248 227 public function moderators_metabox() {
@@ -254,9 +233,9 @@
254 233
255 234 // Moderators
256 235 add_meta_box(
257 236 'bbp_moderator_assignment_metabox',
258 - esc_html__( 'Moderators', 'bbpress' ),
237 + esc_html__( 'Forum Moderators', 'bbpress' ),
259 238 'bbp_moderator_assignment_metabox',
260 239 $this->post_type,
261 240 'side',
262 241 'high'
@@ -263,9 +242,9 @@
263 242 );
264 243 }
265 244
266 245 /**
267 - * Add the subscriptions meta-box.
246 + * Add the subscriptions meta-box
268 247 *
269 248 * Allows viewing of users who have subscribed to a forum.
270 249 *
271 250 * @since 2.6.0 bbPress (r6197)
@@ -293,9 +272,9 @@
293 272 );
294 273 }
295 274
296 275 /**
297 - * Remove comments & discussion meta-boxes if comments are not supported.
276 + * Remove comments & discussion meta-boxes if comments are not supported
298 277 *
299 278 * @since 2.6.0 bbPress (r6186)
300 279 */
301 280 public function comments_metabox() {
@@ -305,14 +284,14 @@
305 284 }
306 285 }
307 286
308 287 /**
309 - * Pass the forum attributes for processing.
288 + * Pass the forum attributes for processing
310 289 *
311 290 * @since 2.0.0 bbPress (r2746)
312 291 *
313 - * @param int $forum_id Forum id.
314 - * @return int Forum id.
292 + * @param int $forum_id Forum id
293 + * @return int Forum id
315 294 */
316 295 public function save_meta_boxes( $forum_id ) {
317 296
318 297 // Bail if doing an autosave
@@ -345,14 +324,12 @@
345 324 ? (int) $_POST['parent_id']
346 325 : 0;
347 326
348 327 // Update the forum meta bidness
349 - bbp_update_forum(
350 - array(
351 - 'forum_id' => $forum_id,
352 - 'post_parent' => $parent_id
353 - )
354 - );
328 + bbp_update_forum( array(
329 + 'forum_id' => $forum_id,
330 + 'post_parent' => $parent_id
331 + ) );
355 332
356 333 do_action( 'bbp_forum_attributes_metabox_save', $forum_id );
357 334
358 335 return $forum_id;
@@ -358,11 +335,11 @@
358 335 return $forum_id;
359 336 }
360 337
361 338 /**
362 - * Toggle forum.
339 + * Toggle forum
363 340 *
364 - * Handles the admin-side opening/closing of forums.
341 + * Handles the admin-side opening/closing of forums
365 342 *
366 343 * @since 2.6.0 bbPress (r5254)
367 344 */
368 345 public function toggle_forum() {
@@ -431,9 +408,9 @@
431 408 bbp_redirect( $redirect );
432 409 }
433 410
434 411 /**
435 - * Toggle forum notices.
412 + * Toggle forum notices
436 413 *
437 414 * Display the success/error notices from
438 415 * {@link BBP_Admin::toggle_forum()}
439 416 *
@@ -469,20 +446,16 @@
469 446 $message = '';
470 447
471 448 switch ( $notice ) {
472 449 case 'opened' :
473 - $message = ( true === $is_failure )
474 - /* translators: %1$s: Forum title */
450 + $message = ( $is_failure === true )
475 451 ? sprintf( esc_html__( 'There was a problem opening the forum "%1$s".', 'bbpress' ), $forum_title )
476 - /* translators: %1$s: Forum title */
477 452 : sprintf( esc_html__( 'Forum "%1$s" successfully opened.', 'bbpress' ), $forum_title );
478 453 break;
479 454
480 455 case 'closed' :
481 - $message = ( true === $is_failure )
482 - /* translators: %1$s: Forum title */
456 + $message = ( $is_failure === true )
483 457 ? sprintf( esc_html__( 'There was a problem closing the forum "%1$s".', 'bbpress' ), $forum_title )
484 - /* translators: %1$s: Forum title */
485 458 : sprintf( esc_html__( 'Forum "%1$s" successfully closed.', 'bbpress' ), $forum_title );
486 459 break;
487 460 }
488 461
@@ -487,9 +460,9 @@
487 460 }
488 461
489 462 // Do additional forum toggle notice filters (admin side)
490 463 $message = apply_filters( 'bbp_toggle_forum_notice_admin', $message, $forum_id, $notice, $is_failure );
491 - $class = ( true === $is_failure )
464 + $class = ( $is_failure === true )
492 465 ? 'error'
493 466 : 'updated';
494 467
495 468 // Add the notice
@@ -496,9 +469,9 @@
496 469 bbp_admin()->add_notice( $message, $class, true );
497 470 }
498 471
499 472 /**
500 - * Returns an array of keys used to sort row actions.
473 + * Returns an array of keys used to sort row actions
501 474 *
502 475 * @since 2.6.0 bbPress (r6771)
503 476 *
504 477 * @return array
@@ -504,30 +477,21 @@
504 477 * @return array
505 478 */
506 479 private function get_row_action_sort_order() {
507 480
508 - /**
509 - * Filters the row action sort order.
510 - *
511 - * @since 2.6.0 bbPress (r6771)
512 - *
513 - * @param array $order The default sort order.
514 - */
515 - return (array) apply_filters(
516 - 'bbp_admin_forum_row_action_sort_order',
517 - array(
518 - 'edit',
519 - 'closed',
520 - 'trash',
521 - 'untrash',
522 - 'delete',
523 - 'view'
524 - )
525 - );
481 + // Filter & return
482 + return (array) apply_filters( 'bbp_admin_forum_row_action_sort_order', array(
483 + 'edit',
484 + 'closed',
485 + 'trash',
486 + 'untrash',
487 + 'delete',
488 + 'view'
489 + ) );
526 490 }
527 491
528 492 /**
529 - * Returns an array of notice toggles.
493 + * Returns an array of notice toggles
530 494 *
531 495 * @since 2.6.0 bbPress (r6396)
532 496 *
533 497 * @return array
@@ -533,26 +497,17 @@
533 497 * @return array
534 498 */
535 499 private function get_allowed_notice_toggles() {
536 500
537 - /**
538 - * Filters the allowed notice toggles.
539 - *
540 - * @since 2.6.0 bbPress (r6396)
541 - *
542 - * @param array $toggles The default notice toggles.
543 - */
544 - return (array) apply_filters(
545 - 'bbp_admin_forums_allowed_notice_toggles',
546 - array(
547 - 'opened',
548 - 'closed'
549 - )
550 - );
501 + // Filter & return
502 + return apply_filters( 'bbp_admin_forums_allowed_notice_toggles', array(
503 + 'opened',
504 + 'closed'
505 + ) );
551 506 }
552 507
553 508 /**
554 - * Returns an array of notice toggles.
509 + * Returns an array of notice toggles
555 510 *
556 511 * @since 2.6.0 bbPress (r6396)
557 512 *
558 513 * @return array
@@ -558,31 +513,22 @@
558 513 * @return array
559 514 */
560 515 private function get_allowed_action_toggles() {
561 516
562 - /**
563 - * Filters the allowed action toggles.
564 - *
565 - * @since 2.6.0 bbPress (r6396)
566 - *
567 - * @param array $toggles The default action toggles.
568 - */
569 - return apply_filters(
570 - 'bbp_admin_forums_allowed_action_toggles',
571 - array(
572 - 'bbp_toggle_forum_close'
573 - )
574 - );
517 + // Filter & return
518 + return apply_filters( 'bbp_admin_forums_allowed_action_toggles', array(
519 + 'bbp_toggle_forum_close'
520 + ) );
575 521 }
576 522
577 523 /**
578 - * Manage the column headers for the forums page.
524 + * Manage the column headers for the forums page
579 525 *
580 526 * @since 2.0.0 bbPress (r2485)
581 527 *
582 - * @param array $columns The columns.
528 + * @param array $columns The columns
583 529 *
584 - * @return array $columns bbPress forum columns.
530 + * @return array $columns bbPress forum columns
585 531 */
586 532 public function column_headers( $columns ) {
587 533
588 534 // Set list table column headers
@@ -592,9 +538,9 @@
592 538 'bbp_forum_topic_count' => esc_html__( 'Topics', 'bbpress' ),
593 539 'bbp_forum_reply_count' => esc_html__( 'Replies', 'bbpress' ),
594 540 'bbp_forum_mods' => esc_html__( 'Moderators', 'bbpress' ),
595 541 'author' => esc_html__( 'Creator', 'bbpress' ),
596 - 'bbp_forum_created' => esc_html__( 'Created', 'bbpress' ),
542 + 'bbp_forum_created' => esc_html__( 'Created' , 'bbpress' ),
597 543 'bbp_forum_freshness' => esc_html__( 'Last Post', 'bbpress' )
598 544 );
599 545
600 546 // Remove forum mods column if not enabled
@@ -601,25 +547,19 @@
601 547 if ( ! bbp_allow_forum_mods() ) {
602 548 unset( $columns['bbp_forum_mods'] );
603 549 }
604 550
605 - /**
606 - * Filters the column headers for the forums page.
607 - *
608 - * @since 2.0.0 bbPress (r2485)
609 - *
610 - * @param array $columns The column headers.
611 - */
612 - return (array) apply_filters( 'bbp_admin_forums_column_headers', $columns );
551 + // Filter & return
552 + return apply_filters( 'bbp_admin_forums_column_headers', $columns );
613 553 }
614 554
615 555 /**
616 - * Print extra columns for the forums page.
556 + * Print extra columns for the forums page
617 557 *
618 558 * @since 2.0.0 bbPress (r2485)
619 559 *
620 - * @param string $column Column.
621 - * @param int $forum_id Forum id.
560 + * @param string $column Column
561 + * @param int $forum_id Forum id
622 562 */
623 563 public function column_data( $column, $forum_id ) {
624 564
625 565 switch ( $column ) {
@@ -631,21 +571,17 @@
631 571 bbp_forum_reply_count( $forum_id );
632 572 break;
633 573
634 574 case 'bbp_forum_mods' :
635 - bbp_moderator_list(
636 - $forum_id,
637 - array(
638 - 'before' => '',
639 - 'after' => '',
640 - 'none' => esc_html__( '&mdash;', 'bbpress' )
641 - )
642 - );
575 + bbp_moderator_list( $forum_id, array(
576 + 'before' => '',
577 + 'after' => '',
578 + 'none' => esc_html__( '&mdash;', 'bbpress' )
579 + ) );
643 580 break;
644 581
645 582 case 'bbp_forum_created':
646 - printf(
647 - '%1$s <br /> %2$s',
583 + printf( '%1$s <br /> %2$s',
648 584 get_the_date(),
649 585 esc_attr( get_the_time() )
650 586 );
651 587
@@ -667,19 +603,19 @@
667 603 }
668 604 }
669 605
670 606 /**
671 - * Forum Row actions.
607 + * Forum Row actions
672 608 *
673 609 * Remove the quick-edit action link and display the description under
674 - * the forum title and add the open/close links.
610 + * the forum title and add the open/close links
675 611 *
676 612 * @since 2.0.0 bbPress (r2577)
677 613 *
678 - * @param array $actions Actions.
679 - * @param object $forum Forum object.
614 + * @param array $actions Actions
615 + * @param object $forum Forum object
680 616 *
681 - * @return array $actions Actions.
617 + * @return array $actions Actions
682 618 */
683 619 public function row_actions( $actions = array(), $forum = false ) {
684 620
685 621 // Disable quick edit (too much to do here)
@@ -689,13 +625,9 @@
689 625 if ( current_user_can( 'edit_forum', $forum->ID ) ) {
690 626
691 627 // Show the 'close' and 'open' link on published, private, hidden and closed posts only
692 628 if ( in_array( $forum->post_status, array( bbp_get_public_status_id(), bbp_get_private_status_id(), bbp_get_hidden_status_id(), bbp_get_closed_status_id() ), true ) ) {
693 - $args = array(
694 - 'forum_id' => $forum->ID,
695 - 'action' => 'bbp_toggle_forum_close'
696 - );
697 - $close_uri = wp_nonce_url( add_query_arg( $args, remove_query_arg( array( 'bbp_forum_toggle_notice', 'forum_id', 'failed', 'super' ) ) ), 'close-forum_' . $forum->ID );
629 + $close_uri = wp_nonce_url( add_query_arg( array( 'forum_id' => $forum->ID, 'action' => 'bbp_toggle_forum_close' ), remove_query_arg( array( 'bbp_forum_toggle_notice', 'forum_id', 'failed', 'super' ) ) ), 'close-forum_' . $forum->ID );
698 630 if ( bbp_is_forum_open( $forum->ID ) ) {
699 631 $actions['closed'] = '<a href="' . esc_url( $close_uri ) . '" title="' . esc_attr__( 'Close this forum', 'bbpress' ) . '">' . _x( 'Close', 'Close a Forum', 'bbpress' ) . '</a>';
700 632 } else {
701 633 $actions['closed'] = '<a href="' . esc_url( $close_uri ) . '" title="' . esc_attr__( 'Open this forum', 'bbpress' ) . '">' . _x( 'Open', 'Open a Forum', 'bbpress' ) . '</a>';
@@ -719,13 +651,13 @@
719 651 return $this->sort_row_actions( $actions );
720 652 }
721 653
722 654 /**
723 - * Sort row actions by key.
655 + * Sort row actions by key
724 656 *
725 657 * @since 2.6.0
726 658 *
727 - * @param array $actions.
659 + * @param array $actions
728 660 *
729 661 * @return array
730 662 */
731 663 private function sort_row_actions( $actions = array() ) {
@@ -748,9 +680,9 @@
748 680 return $retval + $actions;
749 681 }
750 682
751 683 /**
752 - * Custom user feedback messages for forum post type.
684 + * Custom user feedback messages for forum post type
753 685 *
754 686 * @since 2.0.0 bbPress (r3080)
755 687 *
756 688 * @global int $post_ID
@@ -769,12 +701,12 @@
769 701 $post_date = bbp_get_global_post_field( 'post_date', 'raw' );
770 702
771 703 // Messages array
772 704 $messages[ $this->post_type ] = array(
773 - 0 => '', // Left empty on purpose
705 + 0 => '', // Left empty on purpose
774 706
775 707 // Updated
776 - 1 => sprintf(
708 + 1 => sprintf(
777 709 '%1$s <a href="%2$s">%3$s</a>',
778 710 esc_html__( 'Forum updated.', 'bbpress' ),
779 711 $forum_url,
780 712 esc_html__( 'View forum', 'bbpress' )
@@ -789,11 +721,10 @@
789 721 // Forum updated
790 722 4 => esc_html__( 'Forum updated.', 'bbpress' ),
791 723
792 724 // Restored from revision
793 - /* translators: %s: date and time of the revision */
725 + // translators: %s: date and time of the revision
794 726 5 => isset( $_GET['revision'] )
795 - /* translators: %s: Date and time of the revision */
796 727 ? sprintf( esc_html__( 'Forum restored to revision from %s', 'bbpress' ), wp_post_revision_title( (int) $_GET['revision'], false ) )
797 728 : false,
798 729
799 730 // Forum created
@@ -818,10 +749,10 @@
818 749 // Forum scheduled
819 750 9 => sprintf(
820 751 '%1$s <a target="_blank" href="%2$s">%3$s</a>',
821 752 sprintf(
822 - /* translators: %s: Publish box date format, see http://php.net/date */
823 753 esc_html__( 'Forum scheduled for: %s.', 'bbpress' ),
754 + // translators: Publish box date format, see http://php.net/date
824 755 '<strong>' . date_i18n( __( 'M j, Y @ G:i', 'bbpress' ), strtotime( $post_date ) ) . '</strong>'
825 756 ),
826 757 $forum_url,
827 758 __( 'Preview forum', 'bbpress' )
@@ -841,9 +772,9 @@
841 772 }
842 773 endif; // class_exists check
843 774
844 775 /**
845 - * Setup bbPress Forums Admin.
776 + * Setup bbPress Forums Admin
846 777 *
847 778 * This is currently here to make hooking and unhooking of the admin UI easy.
848 779 * It could use dependency injection in the future, but for now this is easier.
849 780 *
@@ -848,9 +779,9 @@
848 779 * It could use dependency injection in the future, but for now this is easier.
849 780 *
850 781 * @since 2.0.0 bbPress (r2596)
851 782 *
852 - * @param WP_Screen $current_screen Current screen object.
783 + * @param WP_Screen $current_screen Current screen object
853 784 */
854 785 function bbp_admin_forums( $current_screen ) {
855 786
856 787 // Bail if not a forum screen