| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * bbPress Classes. | |
| 4 | + * bbPress Classes | |
| 5 | 5 | * |
| 6 | 6 | * @package bbPress |
| 7 | 7 | * @subpackage Classes |
| 8 | 8 | */ |
| @@ -11,9 +11,9 @@ | ||
| 11 | 11 | defined( 'ABSPATH' ) || exit; |
| 12 | 12 | |
| 13 | 13 | if ( ! class_exists( 'BBP_Component' ) ) : |
| 14 | 14 | /** |
| 15 | - * bbPress Component Class. | |
| 15 | + * bbPress Component Class | |
| 16 | 16 | * |
| 17 | 17 | * The bbPress component class is responsible for simplifying the creation |
| 18 | 18 | * of components that share similar behaviors and routines. It is used |
| 19 | 19 | * internally by bbPress to create forums, topics and replies, but can be |
| @@ -26,38 +26,38 @@ | ||
| 26 | 26 | */ |
| 27 | 27 | class BBP_Component { |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | - * @var string Unique name (for internal identification). | |
| 30 | + * @var string Unique name (for internal identification) | |
| 31 | 31 | * @internal |
| 32 | 32 | */ |
| 33 | - public $name; | |
| 33 | + var $name; | |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | - * @var Unique ID (normally for custom post type). | |
| 36 | + * @var Unique ID (normally for custom post type) | |
| 37 | 37 | */ |
| 38 | - public $id; | |
| 38 | + var $id; | |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | - * @var string Unique slug (used in query string and permalinks). | |
| 41 | + * @var string Unique slug (used in query string and permalinks) | |
| 42 | 42 | */ |
| 43 | - public $slug; | |
| 43 | + var $slug; | |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | - * @var WP_Query The loop for this component. | |
| 46 | + * @var WP_Query The loop for this component | |
| 47 | 47 | */ |
| 48 | - public $query; | |
| 48 | + var $query; | |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | - * @var string The current ID of the queried object. | |
| 51 | + * @var string The current ID of the queried object | |
| 52 | 52 | */ |
| 53 | - public $current_id; | |
| 53 | + var $current_id; | |
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | /** Methods ***************************************************************/ |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | - * bbPress Component loader. | |
| 59 | + * bbPress Component loader | |
| 60 | 60 | * |
| 61 | 61 | * @since 2.0.0 bbPress (r2700) |
| 62 | 62 | * |
| 63 | 63 | * @param array $args Required. Supports these args: |
| @@ -77,9 +77,9 @@ | ||
| 77 | 77 | $this->setup_actions(); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | - * Component global variables. | |
| 81 | + * Component global variables | |
| 82 | 82 | * |
| 83 | 83 | * @since 2.0.0 bbPress (r2700) |
| 84 | 84 | * |
| 85 | 85 | * @access private |
| @@ -90,9 +90,9 @@ | ||
| 90 | 90 | $this->slug = apply_filters( 'bbp_' . $this->name . '_slug', $args['slug'] ); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | - * Include required files. | |
| 94 | + * Include required files | |
| 95 | 95 | * |
| 96 | 96 | * @since 2.0.0 bbPress (r2700) |
| 97 | 97 | * |
| 98 | 98 | * @access private |
| @@ -101,9 +101,9 @@ | ||
| 101 | 101 | do_action( 'bbp_' . $this->name . 'includes' ); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | - * Setup the actions. | |
| 105 | + * Setup the actions | |
| 106 | 106 | * |
| 107 | 107 | * @since 2.0.0 bbPress (r2700) |
| 108 | 108 | * |
| 109 | 109 | * @access private |
| @@ -118,9 +118,9 @@ | ||
| 118 | 118 | do_action( 'bbp_' . $this->name . 'setup_actions' ); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | - * Setup the component post types. | |
| 122 | + * Setup the component post types | |
| 123 | 123 | * |
| 124 | 124 | * @since 2.0.0 bbPress (r2700) |
| 125 | 125 | */ |
| 126 | 126 | public function register_post_types() { |
| @@ -127,9 +127,9 @@ | ||
| 127 | 127 | do_action( 'bbp_' . $this->name . '_register_post_types' ); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | - * Register component specific taxonomies. | |
| 131 | + * Register component specific taxonomies | |
| 132 | 132 | * |
| 133 | 133 | * @since 2.0.0 bbPress (r2700) |
| 134 | 134 | */ |
| 135 | 135 | public function register_taxonomies() { |
| @@ -136,9 +136,9 @@ | ||
| 136 | 136 | do_action( 'bbp_' . $this->name . '_register_taxonomies' ); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | - * Add any additional rewrite tags. | |
| 140 | + * Add any additional rewrite tags | |
| 141 | 141 | * |
| 142 | 142 | * @since 2.0.0 bbPress (r2700) |
| 143 | 143 | */ |
| 144 | 144 | public function add_rewrite_tags() { |
| @@ -145,9 +145,9 @@ | ||
| 145 | 145 | do_action( 'bbp_' . $this->name . '_add_rewrite_tags' ); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
| 149 | - * Generate any additional rewrite rules. | |
| 149 | + * Generate any additional rewrite rules | |
| 150 | 150 | * |
| 151 | 151 | * @since 2.0.0 bbPress (r2700) |
| 152 | 152 | */ |
| 153 | 153 | public function generate_rewrite_rules( $wp_rewrite ) { |
| @@ -190,9 +190,9 @@ | ||
| 190 | 190 | |
| 191 | 191 | /** Methods ***************************************************************/ |
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | - * Set the tree_type. | |
| 194 | + * Set the tree_type | |
| 195 | 195 | * |
| 196 | 196 | * @since 2.0.0 bbPress (r2746) |
| 197 | 197 | */ |
| 198 | 198 | public function __construct() { |
| @@ -221,9 +221,9 @@ | ||
| 221 | 221 | // - we're told to do so |
| 222 | 222 | // - the post type is a forum |
| 223 | 223 | // - the forum is a category |
| 224 | 224 | // - forum is closed |
| 225 | - if ( ( true === $args['disable_categories'] ) | |
| 225 | + if ( ( true === $args['disable_categories'] ) | |
| 226 | 226 | && ( bbp_get_forum_post_type() === $object->post_type ) |
| 227 | 227 | && ( bbp_is_forum_category( $object->ID ) |
| 228 | 228 | || ( ! current_user_can( 'edit_forum', $object->ID ) && bbp_is_forum_closed( $object->ID ) |
| 229 | 229 | ) |
| @@ -271,9 +271,9 @@ | ||
| 271 | 271 | 'id' => 'ID' |
| 272 | 272 | ); |
| 273 | 273 | |
| 274 | 274 | /** |
| 275 | - * Confirm the tree_type. | |
| 275 | + * Confirm the tree_type | |
| 276 | 276 | * |
| 277 | 277 | * @since 2.6.0 bbPress (r5389) |
| 278 | 278 | */ |
| 279 | 279 | public function __construct() { |
| @@ -284,11 +284,11 @@ | ||
| 284 | 284 | * @see Walker::start_lvl() |
| 285 | 285 | * |
| 286 | 286 | * @since 2.4.0 bbPress (r4944) |
| 287 | 287 | * |
| 288 | - * @param string $output Passed by reference. Used to append additional content. | |
| 289 | - * @param int $depth Depth of reply. | |
| 290 | - * @param array $args Uses 'style' argument for type of HTML list. | |
| 288 | + * @param string $output Passed by reference. Used to append additional content | |
| 289 | + * @param int $depth Depth of reply | |
| 290 | + * @param array $args Uses 'style' argument for type of HTML list | |
| 291 | 291 | */ |
| 292 | 292 | public function start_lvl( &$output = '', $depth = 0, $args = array() ) { |
| 293 | 293 | bbpress()->reply_query->reply_depth = (int) $depth + 1; |
| 294 | 294 | |
| @@ -309,11 +309,11 @@ | ||
| 309 | 309 | * @see Walker::end_lvl() |
| 310 | 310 | * |
| 311 | 311 | * @since 2.4.0 bbPress (r4944) |
| 312 | 312 | * |
| 313 | - * @param string $output Passed by reference. Used to append additional content. | |
| 314 | - * @param int $depth Depth of reply. | |
| 315 | - * @param array $args Will only append content if style argument value is 'ol' or 'ul'. | |
| 313 | + * @param string $output Passed by reference. Used to append additional content | |
| 314 | + * @param int $depth Depth of reply | |
| 315 | + * @param array $args Will only append content if style argument value is 'ol' or 'ul' | |
| 316 | 316 | */ |
| 317 | 317 | public function end_lvl( &$output = '', $depth = 0, $args = array() ) { |
| 318 | 318 | bbpress()->reply_query->reply_depth = (int) $depth + 1; |
| 319 | 319 | |
| @@ -363,9 +363,9 @@ | ||
| 363 | 363 | */ |
| 364 | 364 | public function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) { |
| 365 | 365 | |
| 366 | 366 | // Set up reply |
| 367 | - ++$depth; | |
| 367 | + $depth++; | |
| 368 | 368 | bbpress()->reply_query->reply_depth = (int) $depth; |
| 369 | 369 | bbpress()->reply_query->post = $object; |
| 370 | 370 | bbpress()->current_reply_id = $object->ID; |
| 371 | 371 | |
| @@ -442,9 +442,9 @@ | ||
| 442 | 442 | |
| 443 | 443 | /** Methods ***************************************************************/ |
| 444 | 444 | |
| 445 | 445 | /** |
| 446 | - * Confirm the tree_type. | |
| 446 | + * Confirm the tree_type | |
| 447 | 447 | * |
| 448 | 448 | * @since 2.6.0 bbPress (r5389) |
| 449 | 449 | */ |
| 450 | 450 | public function __construct() { |
| @@ -466,14 +466,14 @@ | ||
| 466 | 466 | * |
| 467 | 467 | * @param array $args Uses 'selected' argument for selected post to set |
| 468 | 468 | * selected HTML attribute for option element. |
| 469 | 469 | * |
| 470 | - * @param int $current_object_id Not Used. | |
| 470 | + * @param int $current_object_id Not Used | |
| 471 | 471 | */ |
| 472 | 472 | public function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) { |
| 473 | 473 | |
| 474 | 474 | // Set up reply |
| 475 | - ++$depth; | |
| 475 | + $depth++; | |
| 476 | 476 | |
| 477 | 477 | // Get the reply ID |
| 478 | 478 | if ( isset( $args['exclude'][0] ) ) { |
| 479 | 479 | $reply_id = (int) $args['exclude'][0]; |
| @@ -489,9 +489,8 @@ | ||
| 489 | 489 | $pad = str_repeat( ' ', (int) $depth * 3 ); |
| 490 | 490 | |
| 491 | 491 | // Determine reply title (either post_title, or excerpt of post_content) |
| 492 | 492 | $title = ! empty( $object->post_title ) ? $object->post_title : wp_html_excerpt( $object->post_content, 10 ); |
| 493 | - /* translators: 1: Reply ID, 2: Reply title */ | |
| 494 | 493 | $title = sprintf( esc_html__( '%1$s - %2$s', 'bbpress' ), (int) $object->ID, $title ); |
| 495 | 494 | $title = apply_filters( 'bbp_walker_dropdown_post_title', $title, $output, $object, $depth, $args ); |
| 496 | 495 | |
| 497 | 496 | // Attributes |
| @@ -500,9 +499,9 @@ | ||
| 500 | 499 | |
| 501 | 500 | // Start an output buffer to make late escaping easier |
| 502 | 501 | ob_start(); ?> |
| 503 | 502 | |
| 504 | - <option class="<?php echo esc_attr( $class ); ?>" value="<?php echo esc_attr( $value ); ?>"<?php selected( $args['selected'], $object->ID ); ?> <?php disabled( in_array( $reply_id, $ancestors, true ), true ); ?>><?php echo $pad . esc_html( $title ); ?></option> | |
| 503 | + <option class="<?php echo esc_attr( $class ); ?>" value="<?php echo esc_attr( $value ); ?>"<?php selected( $args['selected'], $object->ID ); ?> <?php disabled( in_array( $reply_id, $ancestors ), true ); ?>><?php echo $pad . esc_html( $title ); ?></option> | |
| 505 | 504 | |
| 506 | 505 | <?php |
| 507 | 506 | |
| 508 | 507 | // Append the output buffer to the $output variable |