diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 7ecf93037..eba6a3a58 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -105,12 +105,6 @@ - - - - - - + + + /src/* + - + + /src/* + - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + + /src/* + - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + + /src/* + + + + /src/* + + + + /src/* + + + + /src/* + + + /src/* @@ -237,10 +251,18 @@ /src/* + + /src/* + + /src/* + + /src/* + + /src/* @@ -269,6 +291,10 @@ /src/* + + /src/* + + /src/* @@ -293,6 +319,10 @@ /src/* + + /src/* + + /src/* @@ -301,6 +331,10 @@ /src/* + + /src/* + + /src/* @@ -317,6 +351,14 @@ /src/* + + /src/* + + + + /src/* + + /src/* @@ -361,243 +403,251 @@ /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - - /src/* + + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + + /src/* + + + /src/* - + /src/* - + /src/* - + + /src/* + + + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* - + /src/* @@ -624,9 +674,4 @@ /src/* - - - /src/* - - diff --git a/src/includes/admin/classes/class-bbp-admin.php b/src/includes/admin/classes/class-bbp-admin.php index 7b3b00b3b..938d8ee6e 100644 --- a/src/includes/admin/classes/class-bbp-admin.php +++ b/src/includes/admin/classes/class-bbp-admin.php @@ -345,7 +345,7 @@ public function add_notice( $message, $class = false, $is_dismissible = true ) { // One message as string if ( is_string( $message ) ) { $message = '

' . $this->esc_notice( $message ) . '

'; - $default_class ='updated'; + $default_class = 'updated'; // Messages as objects } elseif ( is_wp_error( $message ) ) { diff --git a/src/includes/admin/classes/class-bbp-converter.php b/src/includes/admin/classes/class-bbp-converter.php index 4f1375e9c..9d007b40e 100644 --- a/src/includes/admin/classes/class-bbp-converter.php +++ b/src/includes/admin/classes/class-bbp-converter.php @@ -388,7 +388,7 @@ private function setup_options() { // Total mini steps if ( $this->rows_in_step > 0 ) { $total_mini_steps = ceil( $this->rows_in_step / $this->rows ); - $current_mini_step = ceil( $this->start / $this->rows ); + $current_mini_step = ceil( $this->start / $this->rows ); $this->step_percentage = round( ( $current_mini_step / $total_mini_steps ) * 100, 2 ); } else { $this->step_percentage = 0; diff --git a/src/includes/admin/converters/phpBB.php b/src/includes/admin/converters/phpBB.php index dc35d225f..17a216d52 100644 --- a/src/includes/admin/converters/phpBB.php +++ b/src/includes/admin/converters/phpBB.php @@ -809,7 +809,7 @@ private function _hash_encode64( $input, $count, &$itoa64 ) { $value = ord( $input[ $i++ ] ); $output .= $itoa64[ $value & 0x3f ]; - if ($i < $count) { + if ( $i < $count ) { $value |= ord( $input[ $i ] ) << 8; } diff --git a/src/includes/admin/metaboxes.php b/src/includes/admin/metaboxes.php index 87164539e..17fb30f07 100644 --- a/src/includes/admin/metaboxes.php +++ b/src/includes/admin/metaboxes.php @@ -112,9 +112,9 @@ function bbp_dashboard_widget_right_now() { $num = $r['forum_count']; $text = _n( 'Forum', 'Forums', $r['forum_count_int'], 'bbpress' ); if ( current_user_can( 'publish_forums' ) ) { - $link = add_query_arg( array( 'post_type' => bbp_get_forum_post_type() ), admin_url( 'edit.php' ) ); - $num = '' . $num . ''; - $text = '' . $text . ''; + $link = add_query_arg( array( 'post_type' => bbp_get_forum_post_type() ), admin_url( 'edit.php' ) ); + $num = '' . $num . ''; + $text = '' . $text . ''; } ?> @@ -129,9 +129,9 @@ function bbp_dashboard_widget_right_now() { $num = $r['topic_count']; $text = _n( 'Topic', 'Topics', $r['topic_count_int'], 'bbpress' ); if ( current_user_can( 'publish_topics' ) ) { - $link = add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) ); - $num = '' . $num . ''; - $text = '' . $text . ''; + $link = add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) ); + $num = '' . $num . ''; + $text = '' . $text . ''; } ?> @@ -146,9 +146,9 @@ function bbp_dashboard_widget_right_now() { $num = $r['reply_count']; $text = _n( 'Reply', 'Replies', $r['reply_count_int'], 'bbpress' ); if ( current_user_can( 'publish_replies' ) ) { - $link = add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ); - $num = '' . $num . ''; - $text = '' . $text . ''; + $link = add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ); + $num = '' . $num . ''; + $text = '' . $text . ''; } ?> @@ -165,9 +165,9 @@ function bbp_dashboard_widget_right_now() { $num = $r['topic_tag_count']; $text = _n( 'Topic Tag', 'Topic Tags', $r['topic_tag_count_int'], 'bbpress' ); if ( current_user_can( 'manage_topic_tags' ) ) { - $link = add_query_arg( array( 'taxonomy' => bbp_get_topic_tag_tax_id(), 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit-tags.php' ) ); - $num = '' . $num . ''; - $text = '' . $text . ''; + $link = add_query_arg( array( 'taxonomy' => bbp_get_topic_tag_tax_id(), 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit-tags.php' ) ); + $num = '' . $num . ''; + $text = '' . $text . ''; } ?> @@ -197,9 +197,9 @@ function bbp_dashboard_widget_right_now() { $num = $r['user_count']; $text = _n( 'User', 'Users', $r['user_count_int'], 'bbpress' ); if ( current_user_can( 'edit_users' ) ) { - $link = admin_url( 'users.php' ); - $num = '' . $num . ''; - $text = '' . $text . ''; + $link = admin_url( 'users.php' ); + $num = '' . $num . ''; + $text = '' . $text . ''; } ?> @@ -217,7 +217,7 @@ function bbp_dashboard_widget_right_now() { $text = _n( 'Hidden Topic', 'Hidden Topics', $r['topic_count_hidden_int'], 'bbpress' ); $link = add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) ); if ( '0' !== $num ) { - $link = add_query_arg( array( 'post_status' => bbp_get_spam_status_id() ), $link ); + $link = add_query_arg( array( 'post_status' => bbp_get_spam_status_id() ), $link ); } $num = '' . $num . ''; $text = '' . $text . ''; @@ -239,7 +239,7 @@ function bbp_dashboard_widget_right_now() { $text = _n( 'Hidden Reply', 'Hidden Replies', $r['reply_count_hidden_int'], 'bbpress' ); $link = add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ); if ( '0' !== $num ) { - $link = add_query_arg( array( 'post_status' => bbp_get_spam_status_id() ), $link ); + $link = add_query_arg( array( 'post_status' => bbp_get_spam_status_id() ), $link ); } $num = '' . $num . ''; $text = '' . $text . ''; @@ -354,22 +354,25 @@ function bbp_forum_metabox( $post ) {

- bbp_get_forum_post_type(), - 'selected' => $post_parent, - 'numberposts' => -1, - 'orderby' => 'title', - 'order' => 'ASC', - 'walker' => '', - 'exclude' => $post->ID, + bbp_get_forum_post_type(), + 'selected' => $post_parent, + 'numberposts' => -1, + 'orderby' => 'title', + 'order' => 'ASC', + 'walker' => '', + 'exclude' => $post->ID, - // Output-related - 'select_id' => 'parent_id', - 'options_only' => false, - 'show_none' => esc_html__( '— No parent —', 'bbpress' ), - 'disable_categories' => false, - 'disabled' => '' - ) ); ?> + // Output-related + 'select_id' => 'parent_id', + 'options_only' => false, + 'show_none' => esc_html__( '— No parent —', 'bbpress' ), + 'disable_categories' => false, + 'disabled' => '' + ) + ); + ?>

@@ -445,7 +448,7 @@ function bbp_topic_metabox( $post ) { 'show_none' => esc_html__( '— No forum —', 'bbpress' ), 'disable_categories' => current_user_can( 'edit_forums' ), 'disabled' => '' - ) ); ?> +) ); ?>

@@ -509,7 +512,7 @@ function bbp_reply_metabox( $post ) { 'show_none' => esc_html__( '— No reply —', 'bbpress' ), 'disable_categories' => current_user_can( 'edit_forums' ), 'disabled' => '' - ) ); ?> +) ); ?>

esc_html__( 'Forum root should show', 'bbpress' ), 'callback' => 'bbp_admin_setting_callback_show_on_root', 'sanitize_callback' => 'sanitize_text_field', - 'args' => array( 'label_for'=>'_bbp_show_on_root' ) + 'args' => array( 'label_for' => '_bbp_show_on_root' ) ), ), @@ -352,7 +352,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Forum', 'bbpress' ), 'callback' => 'bbp_admin_setting_callback_forum_slug', 'sanitize_callback' => 'bbp_sanitize_slug', - 'args' => array( 'label_for'=>'_bbp_forum_slug' ) + 'args' => array( 'label_for' => '_bbp_forum_slug' ) ), // Topic slug setting @@ -360,7 +360,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Topic', 'bbpress' ), 'callback' => 'bbp_admin_setting_callback_topic_slug', 'sanitize_callback' => 'bbp_sanitize_slug', - 'args' => array( 'label_for'=>'_bbp_topic_slug' ) + 'args' => array( 'label_for' => '_bbp_topic_slug' ) ), // Topic tag slug setting @@ -368,7 +368,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Topic Tag', 'bbpress' ), 'callback' => 'bbp_admin_setting_callback_topic_tag_slug', 'sanitize_callback' => 'bbp_sanitize_slug', - 'args' => array( 'label_for'=>'_bbp_topic_tag_slug' ) + 'args' => array( 'label_for' => '_bbp_topic_tag_slug' ) ), // View slug setting @@ -376,7 +376,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Topic View', 'bbpress' ), 'callback' => 'bbp_admin_setting_callback_view_slug', 'sanitize_callback' => 'bbp_sanitize_slug', - 'args' => array( 'label_for'=>'_bbp_view_slug' ) + 'args' => array( 'label_for' => '_bbp_view_slug' ) ), // Reply slug setting @@ -384,7 +384,7 @@ function bbp_admin_get_settings_fields() { 'title' => _x( 'Reply', 'noun', 'bbpress' ), 'callback' => 'bbp_admin_setting_callback_reply_slug', 'sanitize_callback' => 'bbp_sanitize_slug', - 'args' => array( 'label_for'=>'_bbp_reply_slug' ) + 'args' => array( 'label_for' => '_bbp_reply_slug' ) ), // Edit slug setting @@ -392,7 +392,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Edit', 'bbpress' ), 'callback' => 'bbp_admin_setting_callback_edit_slug', 'sanitize_callback' => 'bbp_sanitize_slug', - 'args' => array( 'label_for'=>'_bbp_edit_slug' ) + 'args' => array( 'label_for' => '_bbp_edit_slug' ) ), // Search slug setting @@ -400,7 +400,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Search', 'bbpress' ), 'callback' => 'bbp_admin_setting_callback_search_slug', 'sanitize_callback' => 'bbp_sanitize_slug', - 'args' => array( 'label_for'=>'_bbp_search_slug' ) + 'args' => array( 'label_for' => '_bbp_search_slug' ) ) ), @@ -413,7 +413,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'User Base', 'bbpress' ), 'callback' => 'bbp_admin_setting_callback_user_slug', 'sanitize_callback' => 'bbp_sanitize_slug', - 'args' => array( 'label_for'=>'_bbp_user_slug' ) + 'args' => array( 'label_for' => '_bbp_user_slug' ) ), // Topics slug setting @@ -421,7 +421,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Topics Started', 'bbpress' ), 'callback' => 'bbp_admin_setting_callback_topic_archive_slug', 'sanitize_callback' => 'bbp_sanitize_slug', - 'args' => array( 'label_for'=>'_bbp_topic_archive_slug' ) + 'args' => array( 'label_for' => '_bbp_topic_archive_slug' ) ), // Replies slug setting @@ -429,7 +429,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Replies Created', 'bbpress' ), 'callback' => 'bbp_admin_setting_callback_reply_archive_slug', 'sanitize_callback' => 'bbp_sanitize_slug', - 'args' => array( 'label_for'=>'_bbp_reply_archive_slug' ) + 'args' => array( 'label_for' => '_bbp_reply_archive_slug' ) ), // Favorites slug setting @@ -437,7 +437,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Favorite Topics', 'bbpress' ), 'callback' => 'bbp_admin_setting_callback_user_favs_slug', 'sanitize_callback' => 'bbp_sanitize_slug', - 'args' => array( 'label_for'=>'_bbp_user_favs_slug' ) + 'args' => array( 'label_for' => '_bbp_user_favs_slug' ) ), // Subscriptions slug setting @@ -445,7 +445,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Subscriptions', 'bbpress' ), 'callback' => 'bbp_admin_setting_callback_user_subs_slug', 'sanitize_callback' => 'bbp_sanitize_slug', - 'args' => array( 'label_for'=>'_bbp_user_subs_slug' ) + 'args' => array( 'label_for' => '_bbp_user_subs_slug' ) ), // Engagements slug setting @@ -453,7 +453,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Engagements', 'bbpress' ), 'callback' => 'bbp_admin_setting_callback_user_engagements_slug', 'sanitize_callback' => 'bbp_sanitize_slug', - 'args' => array( 'label_for'=>'_bbp_user_engs_slug' ) + 'args' => array( 'label_for' => '_bbp_user_engs_slug' ) ) ), @@ -474,7 +474,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Primary Forum', 'bbpress' ), 'callback' => 'bbp_admin_setting_callback_group_forums_root_id', 'sanitize_callback' => 'intval', - 'args' => array( 'label_for'=>'_bbp_group_forums_root_id' ) + 'args' => array( 'label_for' => '_bbp_group_forums_root_id' ) ) ), @@ -501,7 +501,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Select Platform', 'bbpress' ), 'callback' => 'bbp_converter_setting_callback_platform', 'sanitize_callback' => 'sanitize_text_field', - 'args' => array( 'label_for'=> '_bbp_converter_platform' ) + 'args' => array( 'label_for' => '_bbp_converter_platform' ) ), // Database Server @@ -509,7 +509,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Database Server', 'bbpress' ), 'callback' => 'bbp_converter_setting_callback_dbserver', 'sanitize_callback' => 'sanitize_text_field', - 'args' => array( 'label_for'=> '_bbp_converter_db_server' ) + 'args' => array( 'label_for' => '_bbp_converter_db_server' ) ), // Database Server Port @@ -517,7 +517,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Database Port', 'bbpress' ), 'callback' => 'bbp_converter_setting_callback_dbport', 'sanitize_callback' => 'intval', - 'args' => array( 'label_for'=> '_bbp_converter_db_port' ) + 'args' => array( 'label_for' => '_bbp_converter_db_port' ) ), // Database Name @@ -525,7 +525,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Database Name', 'bbpress' ), 'callback' => 'bbp_converter_setting_callback_dbname', 'sanitize_callback' => 'sanitize_text_field', - 'args' => array( 'label_for'=> '_bbp_converter_db_name' ) + 'args' => array( 'label_for' => '_bbp_converter_db_name' ) ), // Database User @@ -533,7 +533,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Database User', 'bbpress' ), 'callback' => 'bbp_converter_setting_callback_dbuser', 'sanitize_callback' => 'sanitize_text_field', - 'args' => array( 'label_for'=> '_bbp_converter_db_user' ) + 'args' => array( 'label_for' => '_bbp_converter_db_user' ) ), // Database Password @@ -541,7 +541,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Database Password', 'bbpress' ), 'callback' => 'bbp_converter_setting_callback_dbpass', 'sanitize_callback' => 'sanitize_text_field', - 'args' => array( 'label_for'=> '_bbp_converter_db_pass' ) + 'args' => array( 'label_for' => '_bbp_converter_db_pass' ) ), // Database Prefix @@ -549,7 +549,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Table Prefix', 'bbpress' ), 'callback' => 'bbp_converter_setting_callback_dbprefix', 'sanitize_callback' => 'sanitize_text_field', - 'args' => array( 'label_for'=> '_bbp_converter_db_prefix' ) + 'args' => array( 'label_for' => '_bbp_converter_db_prefix' ) ) ), @@ -561,7 +561,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Rows Limit', 'bbpress' ), 'callback' => 'bbp_converter_setting_callback_rows', 'sanitize_callback' => 'intval', - 'args' => array( 'label_for'=> '_bbp_converter_rows' ) + 'args' => array( 'label_for' => '_bbp_converter_rows' ) ), // Delay Time @@ -569,7 +569,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Delay Time', 'bbpress' ), 'callback' => 'bbp_converter_setting_callback_delay_time', 'sanitize_callback' => 'intval', - 'args' => array( 'label_for'=> '_bbp_converter_delay_time' ) + 'args' => array( 'label_for' => '_bbp_converter_delay_time' ) ), // Convert Users @@ -577,7 +577,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Convert Users', 'bbpress' ), 'callback' => 'bbp_converter_setting_callback_convert_users', 'sanitize_callback' => 'intval', - 'args' => array( 'label_for'=> '_bbp_converter_convert_users' ) + 'args' => array( 'label_for' => '_bbp_converter_convert_users' ) ), // Halt @@ -585,7 +585,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Stop on Error', 'bbpress' ), 'callback' => 'bbp_converter_setting_callback_halt', 'sanitize_callback' => 'intval', - 'args' => array( 'label_for'=> '_bbp_converter_halt' ) + 'args' => array( 'label_for' => '_bbp_converter_halt' ) ), // Restart @@ -593,7 +593,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Start Over', 'bbpress' ), 'callback' => 'bbp_converter_setting_callback_restart', 'sanitize_callback' => 'intval', - 'args' => array( 'label_for'=> '_bbp_converter_restart' ) + 'args' => array( 'label_for' => '_bbp_converter_restart' ) ), // Clean @@ -601,7 +601,7 @@ function bbp_admin_get_settings_fields() { 'title' => esc_html__( 'Helper Data', 'bbpress' ), 'callback' => 'bbp_converter_setting_callback_clean', 'sanitize_callback' => 'intval', - 'args' => array( 'label_for'=> '_bbp_converter_clean' ) + 'args' => array( 'label_for' => '_bbp_converter_clean' ) ) ) ) ); diff --git a/src/includes/admin/tools/repair.php b/src/includes/admin/tools/repair.php index 4504edfc1..41cd512cd 100644 --- a/src/includes/admin/tools/repair.php +++ b/src/includes/admin/tools/repair.php @@ -83,10 +83,23 @@ function bbp_admin_repair_page() { - + + + + + @@ -96,7 +109,7 @@ function bbp_admin_repair_page() { +) ) ); ?>"> @@ -118,7 +131,7 @@ function bbp_admin_repair_page() { // Optional description if ( ! empty( $item['description'] ) ) : - echo '

' . esc_html( $item['description'] ) . '

'; + echo '

' . esc_html( $item['description'] ) . '

'; endif; ?>
@@ -512,7 +525,7 @@ function bbp_admin_repair_user_topic_count() { $insert_values[] = "('{$insert_row->post_author}', '{$key}', '{$insert_row->_count}')"; } - if ( !count( $insert_values ) ) { + if ( ! count( $insert_values ) ) { return array( 2, sprintf( $statement, $result ) ); } @@ -562,7 +575,7 @@ function bbp_admin_repair_user_reply_count() { $insert_values[] = "('{$insert_row->post_author}', '{$key}', '{$insert_row->_count}')"; } - if ( !count( $insert_values ) ) { + if ( ! count( $insert_values ) ) { return array( 2, sprintf( $statement, $result ) ); } @@ -632,7 +645,7 @@ function bbp_admin_repair_user_favorites() { unset( $favorites, $favorites_joined ); } - if ( !count( $values ) ) { + if ( ! count( $values ) ) { $result = esc_html__( 'Nothing to remove!', 'bbpress' ); return array( 0, sprintf( $statement, $result ) ); } @@ -701,7 +714,7 @@ function bbp_admin_repair_user_topic_subscriptions() { unset( $subscriptions, $subscriptions_joined ); } - if ( !count( $values ) ) { + if ( ! count( $values ) ) { $result = esc_html__( 'Nothing to remove!', 'bbpress' ); return array( 0, sprintf( $statement, $result ) ); } @@ -770,7 +783,7 @@ function bbp_admin_repair_user_forum_subscriptions() { unset( $subscriptions, $subscriptions_joined ); } - if ( !count( $values ) ) { + if ( ! count( $values ) ) { $result = esc_html__( 'Nothing to remove!', 'bbpress' ); return array( 0, sprintf( $statement, $result ) ); } diff --git a/src/includes/admin/tools/upgrade.php b/src/includes/admin/tools/upgrade.php index 9e9a89492..07c5088c1 100644 --- a/src/includes/admin/tools/upgrade.php +++ b/src/includes/admin/tools/upgrade.php @@ -82,17 +82,30 @@ function bbp_admin_upgrade_page() { - + + + + + +) ) ); ?>"> @@ -100,7 +113,7 @@ function bbp_admin_upgrade_page() { +) ) ); ?>"> @@ -122,7 +135,7 @@ function bbp_admin_upgrade_page() { // Optional description if ( ! empty( $item['description'] ) ) : - echo '

' . esc_html( $item['description'] ) . '

'; + echo '

' . esc_html( $item['description'] ) . '

'; endif; ?>
diff --git a/src/includes/admin/topics.php b/src/includes/admin/topics.php index def70dd2d..5e3640276 100644 --- a/src/includes/admin/topics.php +++ b/src/includes/admin/topics.php @@ -621,13 +621,13 @@ public function toggle_topic() { $is_super = ( false === $is_sticky ) && ! empty( $_GET['super'] ) && ( '1' === $_GET['super'] ) ? true : false; - $message = ( true === $is_sticky ) + $message = ( true === $is_sticky ) ? 'unstuck' : 'stuck'; - $message = ( true === $is_super ) + $message = ( true === $is_super ) ? 'super_sticky' : $message; - $success = ( true === $is_sticky ) + $success = ( true === $is_sticky ) ? bbp_unstick_topic( $topic_id ) : bbp_stick_topic( $topic_id, $is_super ); diff --git a/src/includes/common/classes.php b/src/includes/common/classes.php index 1ea2b81a9..33ed7bd02 100644 --- a/src/includes/common/classes.php +++ b/src/includes/common/classes.php @@ -222,7 +222,7 @@ public function start_el( &$output, $object, $depth = 0, $args = array(), $curre // - the post type is a forum // - the forum is a category // - forum is closed - if ( ( true === $args['disable_categories'] ) + if ( ( true === $args['disable_categories'] ) && ( bbp_get_forum_post_type() === $object->post_type ) && ( bbp_is_forum_category( $object->ID ) || ( ! current_user_can( 'edit_forum', $object->ID ) && bbp_is_forum_closed( $object->ID ) diff --git a/src/includes/common/engagements.php b/src/includes/common/engagements.php index 0263c3ffb..2f6951390 100644 --- a/src/includes/common/engagements.php +++ b/src/includes/common/engagements.php @@ -278,21 +278,25 @@ public function get_query( $args = array(), $context_key = '', $meta_key = '', $ // Backwards compat for pre-2.6.0 if ( is_numeric( $args ) ) { $args = array( - 'meta_query' => array( array( - 'key' => $meta_key, - 'value' => bbp_get_user_id( $args, false, false ), - 'compare' => 'NUMERIC' - ) ) + 'meta_query' => array( + array( + 'key' => $meta_key, + 'value' => bbp_get_user_id( $args, false, false ), + 'compare' => 'NUMERIC' + ) + ) ); } // Default arguments $defaults = array( - 'meta_query' => array( array( - 'key' => $meta_key, - 'value' => bbp_get_displayed_user_id(), - 'compare' => 'NUMERIC' - ) ) + 'meta_query' => array( + array( + 'key' => $meta_key, + 'value' => bbp_get_displayed_user_id(), + 'compare' => 'NUMERIC' + ) + ) ); // Parse arguments @@ -502,21 +506,25 @@ public function get_query( $args = array(), $context_key = '', $meta_key = '', $ // Backwards compat for pre-2.6.0 if ( is_numeric( $args ) ) { $args = array( - 'tax_query' => array( array( - 'taxonomy' => $tax_key, - 'terms' => $user_key . bbp_get_user_id( $args, false, false ), - 'field' => 'slug' - ) ) + 'tax_query' => array( + array( + 'taxonomy' => $tax_key, + 'terms' => $user_key . bbp_get_user_id( $args, false, false ), + 'field' => 'slug' + ) + ) ); } // Default arguments $defaults = array( - 'tax_query' => array( array( - 'taxonomy' => $tax_key, - 'terms' => $user_key . bbp_get_displayed_user_id(), - 'field' => 'slug' - ) ) + 'tax_query' => array( + array( + 'taxonomy' => $tax_key, + 'terms' => $user_key . bbp_get_displayed_user_id(), + 'field' => 'slug' + ) + ) ); // Parse arguments diff --git a/src/includes/common/formatting.php b/src/includes/common/formatting.php index 0f9ff4f1f..27cee730b 100644 --- a/src/includes/common/formatting.php +++ b/src/includes/common/formatting.php @@ -214,7 +214,7 @@ function bbp_encode_callback( $matches = array() ) { $content = '' . $content . ''; // Wrap blocks in pre tags - if ('`' !== $matches[1] ) { + if ( '`' !== $matches[1] ) { $content = "\n
" . $content . "
\n"; } diff --git a/src/includes/common/functions.php b/src/includes/common/functions.php index 41673a74f..00d60b178 100644 --- a/src/includes/common/functions.php +++ b/src/includes/common/functions.php @@ -590,8 +590,8 @@ function bbp_filter_anonymous_post_data( $args = array() ) { // Parse arguments against default values $r = bbp_parse_args( $args, array( - 'bbp_anonymous_name' => ! empty( $_POST['bbp_anonymous_name'] ) ? $_POST['bbp_anonymous_name'] : false, - 'bbp_anonymous_email' => ! empty( $_POST['bbp_anonymous_email'] ) ? $_POST['bbp_anonymous_email'] : false, + 'bbp_anonymous_name' => ! empty( $_POST['bbp_anonymous_name'] ) ? $_POST['bbp_anonymous_name'] : false, + 'bbp_anonymous_email' => ! empty( $_POST['bbp_anonymous_email'] ) ? $_POST['bbp_anonymous_email'] : false, 'bbp_anonymous_website' => ! empty( $_POST['bbp_anonymous_website'] ) ? $_POST['bbp_anonymous_website'] : false, ), 'filter_anonymous_post_data' ); @@ -741,10 +741,17 @@ function bbp_check_for_duplicate( $post_data = array() ) { if ( ! empty( $email ) && is_email( $email ) ) { // Get the meta SQL - $clauses = get_meta_sql( array( array( - 'key' => '_bbp_anonymous_email', - 'value' => $email, - ) ), 'post', $bbp_db->posts, 'ID' ); + $clauses = get_meta_sql( + array( + array( + 'key' => '_bbp_anonymous_email', + 'value' => $email, + ) + ), + 'post', + $bbp_db->posts, + 'ID' + ); // Set clauses $join = $clauses['join']; @@ -2386,12 +2393,14 @@ function bbp_request_feed_trap( $query_vars = array() ) { ), $select_query_vars ) ); // Restrict to specific forum ID - $meta_query = array( array( - 'key' => '_bbp_forum_id', - 'value' => bbp_get_forum_id(), - 'type' => 'NUMERIC', - 'compare' => '=' - ) ); + $meta_query = array( + array( + 'key' => '_bbp_forum_id', + 'value' => bbp_get_forum_id(), + 'type' => 'NUMERIC', + 'compare' => '=' + ) + ); } // Only forum replies diff --git a/src/includes/common/locale.php b/src/includes/common/locale.php index d0ec3e41d..d761d9a8f 100644 --- a/src/includes/common/locale.php +++ b/src/includes/common/locale.php @@ -30,7 +30,9 @@ * @return string Translated role name on success, original name on failure. */ function bbp_translate_user_role( $name ) { - return translate_with_gettext_context( before_last_bar( $name ), 'User role', 'bbpress' ); + // WordPress.WP.I18n.NoEmptyStrings + // -- empty string is intentional here as actual content comes from database + return _x( before_last_bar( $name ), 'User role', 'bbpress' ); // phpcs:ignore } /** diff --git a/src/includes/common/locks.php b/src/includes/common/locks.php index 49558e868..253c958b7 100644 --- a/src/includes/common/locks.php +++ b/src/includes/common/locks.php @@ -23,12 +23,12 @@ function bbp_check_post_lock( $post_id = 0 ) { // Bail if no post - if ( !$post = get_post( $post_id ) ) { + if ( ! $post = get_post( $post_id ) ) { return false; } // Bail if no lock - if ( !$lock = get_post_meta( $post->ID, '_edit_lock', true ) ) { + if ( ! $lock = get_post_meta( $post->ID, '_edit_lock', true ) ) { return false; } @@ -62,7 +62,7 @@ function bbp_check_post_lock( $post_id = 0 ) { function bbp_set_post_lock( $post_id = 0 ) { // Bail if no post - if ( !$post = get_post( $post_id ) ) { + if ( ! $post = get_post( $post_id ) ) { return false; } diff --git a/src/includes/common/shortcodes.php b/src/includes/common/shortcodes.php index 6114d0eda..5d9fbb5ed 100644 --- a/src/includes/common/shortcodes.php +++ b/src/includes/common/shortcodes.php @@ -846,11 +846,13 @@ public function display_topic_index_query( $args = array() ) { * @return array */ public function display_topics_of_tag_query( $args = array() ) { - $args['tax_query'] = array( array( - 'taxonomy' => bbp_get_topic_tag_tax_id(), - 'field' => 'id', - 'terms' => bbpress()->current_topic_tag_id - ) ); + $args['tax_query'] = array( + array( + 'taxonomy' => bbp_get_topic_tag_tax_id(), + 'field' => 'id', + 'terms' => bbpress()->current_topic_tag_id + ) + ); return $args; } diff --git a/src/includes/common/widgets.php b/src/includes/common/widgets.php index ca37562cd..8c6846bc3 100644 --- a/src/includes/common/widgets.php +++ b/src/includes/common/widgets.php @@ -695,10 +695,12 @@ public function widget( $args = array(), $instance = array() ) { 'post_status' => bbp_get_public_topic_statuses(), 'post_parent' => $settings['parent_forum'], 'posts_per_page' => (int) $settings['max_shown'], - 'meta_query' => array( array( - 'key' => '_bbp_last_active_time', - 'type' => 'DATETIME' - ) ), + 'meta_query' => array( + array( + 'key' => '_bbp_last_active_time', + 'type' => 'DATETIME' + ) + ), // Ordering 'orderby' => 'meta_value', @@ -721,10 +723,12 @@ public function widget( $args = array(), $instance = array() ) { 'post_status' => bbp_get_public_topic_statuses(), 'post_parent' => $settings['parent_forum'], 'posts_per_page' => (int) $settings['max_shown'], - 'meta_query' => array( array( - 'key' => '_bbp_reply_count', - 'type' => 'NUMERIC' - ) ), + 'meta_query' => array( + array( + 'key' => '_bbp_reply_count', + 'type' => 'NUMERIC' + ) + ), // Ordering 'orderby' => 'meta_value_num', diff --git a/src/includes/core/template-loader.php b/src/includes/core/template-loader.php index 10deea78b..6bc3c12a5 100644 --- a/src/includes/core/template-loader.php +++ b/src/includes/core/template-loader.php @@ -32,58 +32,58 @@ function bbp_template_include_theme_supports( $template = '' ) { if ( bbp_is_single_user_edit() && ( $new_template = bbp_get_single_user_edit_template() ) ) : //phpcs:ignore // User favorites - elseif ( bbp_is_favorites() && ( $new_template = bbp_get_favorites_template() ) ) : + elseif ( bbp_is_favorites() && ( $new_template = bbp_get_favorites_template() ) ) : // User favorites - elseif ( bbp_is_subscriptions() && ( $new_template = bbp_get_subscriptions_template() ) ) : + elseif ( bbp_is_subscriptions() && ( $new_template = bbp_get_subscriptions_template() ) ) : // Viewing a user - elseif ( bbp_is_single_user() && ( $new_template = bbp_get_single_user_template() ) ) : + elseif ( bbp_is_single_user() && ( $new_template = bbp_get_single_user_template() ) ) : // Single View - elseif ( bbp_is_single_view() && ( $new_template = bbp_get_single_view_template() ) ) : + elseif ( bbp_is_single_view() && ( $new_template = bbp_get_single_view_template() ) ) : // Search - elseif ( bbp_is_search() && ( $new_template = bbp_get_search_template() ) ) : + elseif ( bbp_is_search() && ( $new_template = bbp_get_search_template() ) ) : // Forum edit - elseif ( bbp_is_forum_edit() && ( $new_template = bbp_get_forum_edit_template() ) ) : + elseif ( bbp_is_forum_edit() && ( $new_template = bbp_get_forum_edit_template() ) ) : // Single Forum - elseif ( bbp_is_single_forum() && ( $new_template = bbp_get_single_forum_template() ) ) : + elseif ( bbp_is_single_forum() && ( $new_template = bbp_get_single_forum_template() ) ) : // Forum Archive - elseif ( bbp_is_forum_archive() && ( $new_template = bbp_get_forum_archive_template() ) ) : + elseif ( bbp_is_forum_archive() && ( $new_template = bbp_get_forum_archive_template() ) ) : // Topic merge - elseif ( bbp_is_topic_merge() && ( $new_template = bbp_get_topic_merge_template() ) ) : + elseif ( bbp_is_topic_merge() && ( $new_template = bbp_get_topic_merge_template() ) ) : // Topic split - elseif ( bbp_is_topic_split() && ( $new_template = bbp_get_topic_split_template() ) ) : + elseif ( bbp_is_topic_split() && ( $new_template = bbp_get_topic_split_template() ) ) : // Topic edit - elseif ( bbp_is_topic_edit() && ( $new_template = bbp_get_topic_edit_template() ) ) : + elseif ( bbp_is_topic_edit() && ( $new_template = bbp_get_topic_edit_template() ) ) : // Single Topic - elseif ( bbp_is_single_topic() && ( $new_template = bbp_get_single_topic_template() ) ) : + elseif ( bbp_is_single_topic() && ( $new_template = bbp_get_single_topic_template() ) ) : // Topic Archive - elseif ( bbp_is_topic_archive() && ( $new_template = bbp_get_topic_archive_template() ) ) : + elseif ( bbp_is_topic_archive() && ( $new_template = bbp_get_topic_archive_template() ) ) : // Reply move - elseif ( bbp_is_reply_move() && ( $new_template = bbp_get_reply_move_template() ) ) : + elseif ( bbp_is_reply_move() && ( $new_template = bbp_get_reply_move_template() ) ) : // Editing a reply - elseif ( bbp_is_reply_edit() && ( $new_template = bbp_get_reply_edit_template() ) ) : + elseif ( bbp_is_reply_edit() && ( $new_template = bbp_get_reply_edit_template() ) ) : // Single Reply - elseif ( bbp_is_single_reply() && ( $new_template = bbp_get_single_reply_template() ) ) : + elseif ( bbp_is_single_reply() && ( $new_template = bbp_get_single_reply_template() ) ) : // Editing a topic tag - elseif ( bbp_is_topic_tag_edit() && ( $new_template = bbp_get_topic_tag_edit_template() ) ) : + elseif ( bbp_is_topic_tag_edit() && ( $new_template = bbp_get_topic_tag_edit_template() ) ) : // Viewing a topic tag - elseif ( bbp_is_topic_tag() && ( $new_template = bbp_get_topic_tag_template() ) ) : + elseif ( bbp_is_topic_tag() && ( $new_template = bbp_get_topic_tag_template() ) ) : endif; // A bbPress template file was located, so override the WordPress template diff --git a/src/includes/extend/buddypress/groups.php b/src/includes/extend/buddypress/groups.php index 147486dee..af30ae6ca 100644 --- a/src/includes/extend/buddypress/groups.php +++ b/src/includes/extend/buddypress/groups.php @@ -654,7 +654,7 @@ public function group_admin_ui_display_metabox( $item ) { public function create_screen( $group_id = 0 ) { // Bail if not looking at this screen - if ( !bp_is_group_creation_step( $this->slug ) ) { + if ( ! bp_is_group_creation_step( $this->slug ) ) { return false; } diff --git a/src/includes/extend/buddypress/loader.php b/src/includes/extend/buddypress/loader.php index 1e0d59eba..ed88dbe2d 100644 --- a/src/includes/extend/buddypress/loader.php +++ b/src/includes/extend/buddypress/loader.php @@ -177,7 +177,7 @@ private function fully_loaded() { public function setup_nav( $main_nav = array(), $sub_nav = array() ) { // Stop if there is no user displayed or logged in - if ( ! is_user_logged_in() && !bp_displayed_user_id() ) { + if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) { return; } diff --git a/src/includes/forums/functions.php b/src/includes/forums/functions.php index fa54e9d89..5407b3616 100644 --- a/src/includes/forums/functions.php +++ b/src/includes/forums/functions.php @@ -604,7 +604,7 @@ function bbp_edit_forum_handler( $action = '' ) { } else { $append_error = ( is_wp_error( $forum_id ) && $forum_id->get_error_message() ) ? $forum_id->get_error_message() . ' ' : ''; - bbp_add_error( 'bbp_forum_error', __( 'Error: The following problem(s) have been found with your forum:' . $append_error . 'Please try again.', 'bbpress' ) ); + bbp_add_error( 'bbp_forum_error', sprintf( __( 'Error: The following problem(s) have been found with your forum: %s Please try again.', 'bbpress' ) ), $append_error ); } } @@ -1094,7 +1094,7 @@ function bbp_bump_forum_topic_count( $forum_id = 0, $difference = 1, $update_anc $difference = (int) $difference; // Update this forum id - update_post_meta( $forum_id, '_bbp_topic_count', (int) ( $topic_count + $difference ) ); + update_post_meta( $forum_id, '_bbp_topic_count', (int) ( $topic_count + $difference ) ); update_post_meta( $forum_id, '_bbp_total_topic_count', (int) ( $total_topic_count + $difference ) ); // Check for ancestors @@ -1216,7 +1216,7 @@ function bbp_bump_forum_topic_count_hidden( $forum_id = 0, $difference = 1, $upd $difference = (int) $difference; // Update this forum id - update_post_meta( $forum_id, '_bbp_topic_count_hidden', (int) ( $reply_count + $difference ) ); + update_post_meta( $forum_id, '_bbp_topic_count_hidden', (int) ( $reply_count + $difference ) ); update_post_meta( $forum_id, '_bbp_total_topic_count_hidden', (int) ( $total_topic_count + $difference ) ); // Check for ancestors @@ -1339,7 +1339,7 @@ function bbp_bump_forum_reply_count( $forum_id = 0, $difference = 1, $update_anc $difference = (int) $difference; // Update this forum id - update_post_meta( $forum_id, '_bbp_reply_count', (int) ( $reply_count + $difference ) ); + update_post_meta( $forum_id, '_bbp_reply_count', (int) ( $reply_count + $difference ) ); update_post_meta( $forum_id, '_bbp_total_reply_count', (int) ( $total_reply_count + $difference ) ); // Check for ancestors @@ -1398,7 +1398,7 @@ function bbp_bump_forum_reply_count_hidden( $forum_id = 0, $difference = 1, $upd $difference = (int) $difference; // Update this forum id - update_post_meta( $forum_id, '_bbp_reply_count_hidden', (int) ( $reply_count + $difference ) ); + update_post_meta( $forum_id, '_bbp_reply_count_hidden', (int) ( $reply_count + $difference ) ); update_post_meta( $forum_id, '_bbp_total_reply_count_hidden', (int) ( $total_reply_count + $difference ) ); // Check for ancestors diff --git a/src/includes/replies/functions.php b/src/includes/replies/functions.php index 220d6380c..53e05a702 100644 --- a/src/includes/replies/functions.php +++ b/src/includes/replies/functions.php @@ -789,7 +789,7 @@ function bbp_edit_reply_handler( $action = '' ) { } else { $append_error = ( is_wp_error( $reply_id ) && $reply_id->get_error_message() ) ? $reply_id->get_error_message() . ' ' : ''; - bbp_add_error( 'bbp_reply_error', __( 'Error: The following problem(s) have been found with your reply:' . $append_error . 'Please try again.', 'bbpress' ) ); + bbp_add_error( 'bbp_reply_error', sprintf( __( 'Error: The following problem(s) have been found with your reply: %s. Please try again.', 'bbpress' ) ), $append_error ); } } diff --git a/src/includes/replies/template.php b/src/includes/replies/template.php index 7ddbf7113..f47aa427c 100644 --- a/src/includes/replies/template.php +++ b/src/includes/replies/template.php @@ -1001,7 +1001,7 @@ function bbp_is_reply_anonymous( $reply_id = 0 ) { * @param int $reply_id Optional. Reply id */ function bbp_reply_author( $reply_id = 0 ) { - echo bbp_get_reply_author( $reply_id ); + echo bbp_get_reply_author_display_name( $reply_id ); } /** * Deprecated. Use bbp_get_reply_author_display_name() instead. @@ -1101,7 +1101,7 @@ function bbp_get_reply_author_display_name( $reply_id = 0 ) { // Encode possible UTF8 display names if ( seems_utf8( $author_name ) === false ) { - $author_name = utf8_encode( $author_name ); + $author_name = mb_convert_encoding( $author_name, 'UTF-8', mb_detect_encoding( $author_name ) ); } // Filter & return @@ -2304,7 +2304,7 @@ function bbp_get_reply_class( $reply_id = 0, $classes = array() ) { function bbp_get_replies_pagination_base( $topic_id = 0 ) { // If pretty permalinks are enabled, make our pagination pretty - if ( bbp_use_pretty_urls() && ! bbp_is_topic_pending( $topic_id )) { + if ( bbp_use_pretty_urls() && ! bbp_is_topic_pending( $topic_id ) ) { // User's replies if ( bbp_is_single_user_replies() ) { diff --git a/src/includes/search/template.php b/src/includes/search/template.php index cb67cf5d4..9d7398ecf 100644 --- a/src/includes/search/template.php +++ b/src/includes/search/template.php @@ -297,7 +297,7 @@ function bbp_get_search_terms( $passed_terms = '' ) { $search_terms = get_query_var( bbp_get_search_rewrite_id(), null ); // Searching globally - if ( ! is_null( $search_terms ) ) { + if ( ! is_null( $search_terms ) ) { $search_terms = wp_unslash( $search_terms ); // Other searches diff --git a/src/includes/topics/functions.php b/src/includes/topics/functions.php index 823b6acf7..e2ffe8062 100644 --- a/src/includes/topics/functions.php +++ b/src/includes/topics/functions.php @@ -727,7 +727,7 @@ function bbp_edit_topic_handler( $action = '' ) { } else { $append_error = ( is_wp_error( $topic_id ) && $topic_id->get_error_message() ) ? $topic_id->get_error_message() . ' ' : ''; - bbp_add_error( 'bbp_topic_error', __( 'Error: The following problem(s) have been found with your topic:' . $append_error . 'Please try again.', 'bbpress' ) ); + bbp_add_error( 'bbp_topic_error', sprintf( esc_html_e( 'Error: The following problem(s) have been found with your topic: %s. Please try again.', 'bbpress' ) ), $append_error ); } } @@ -1742,7 +1742,7 @@ function bbp_edit_topic_tag_handler( $action = '' ) { } // Attempt to update the tag - $slug = ! empty( $_POST['tag-slug'] ) ? $_POST['tag-slug'] : ''; + $slug = ! empty( $_POST['tag-slug'] ) ? $_POST['tag-slug'] : ''; $description = ! empty( $_POST['tag-description'] ) ? $_POST['tag-description'] : ''; $tag = wp_update_term( $tag_id, bbp_get_topic_tag_tax_id(), array( 'name' => $name, @@ -3819,7 +3819,7 @@ function bbp_display_topics_feed_rss2( $topics_query = array() ) { - + found_posts = (int) $query->found_posts + (int) $sticky_count; - $query->post_count = (int) $query->post_count + (int) $sticky_count; + $query->post_count = (int) $query->post_count + (int) $sticky_count; } } diff --git a/src/includes/users/engagements.php b/src/includes/users/engagements.php index e18c58d55..3dd81861d 100644 --- a/src/includes/users/engagements.php +++ b/src/includes/users/engagements.php @@ -956,20 +956,21 @@ function bbp_get_user_object_ids( $args = array() ) { 'fields' => 'ids', 'post_type' => $r['object_type'], 'posts_per_page' => -1, - 'meta_query' => array( array( - 'key' => $r['rel_key'], - 'value' => $r['user_id'], - 'compare' => 'NUMERIC' - ), - - // Performance - 'nopaging' => true, - 'suppress_filters' => true, - 'update_post_term_cache' => false, - 'update_post_meta_cache' => false, - 'ignore_sticky_posts' => true, - 'no_found_rows' => true - ) ); + 'meta_query' => array( + array( + 'key' => $r['rel_key'], + 'value' => $r['user_id'], + 'compare' => 'NUMERIC' + ), + // Performance + 'nopaging' => true, + 'suppress_filters' => true, + 'update_post_term_cache' => false, + 'update_post_meta_cache' => false, + 'ignore_sticky_posts' => true, + 'no_found_rows' => true + ) + ); } // Parse arguments diff --git a/src/templates/default/bbpress-functions.php b/src/templates/default/bbpress-functions.php index 6488322ea..275c76af3 100644 --- a/src/templates/default/bbpress-functions.php +++ b/src/templates/default/bbpress-functions.php @@ -240,7 +240,7 @@ public function ajax_favorite() { // Get user and topic data $user_id = bbp_get_current_user_id(); - $id = ! empty( $_POST['id'] ) ? intval( $_POST['id'] ) : 0; + $id = ! empty( $_POST['id'] ) ? intval( $_POST['id'] ) : 0; $type = ! empty( $_POST['type'] ) ? sanitize_key( $_POST['type'] ) : 'post'; // Bail if user cannot add favorites for this user @@ -266,7 +266,7 @@ public function ajax_favorite() { // Take action $status = bbp_is_user_favorite( $user_id, $object->ID ) ? bbp_remove_user_favorite( $user_id, $object->ID ) - : bbp_add_user_favorite( $user_id, $object->ID ); + : bbp_add_user_favorite( $user_id, $object->ID ); // Bail if action failed if ( empty( $status ) ) { @@ -303,7 +303,7 @@ public function ajax_subscription() { // Get user and topic data $user_id = bbp_get_current_user_id(); - $id = ! empty( $_POST['id'] ) ? intval( $_POST['id'] ) : 0; + $id = ! empty( $_POST['id'] ) ? intval( $_POST['id'] ) : 0; $type = ! empty( $_POST['type'] ) ? sanitize_key( $_POST['type'] ) : 'post'; // Bail if user cannot add favorites for this user @@ -329,7 +329,7 @@ public function ajax_subscription() { // Take action $status = bbp_is_user_subscribed( $user_id, $object->ID ) ? bbp_remove_user_subscription( $user_id, $object->ID ) - : bbp_add_user_subscription( $user_id, $object->ID ); + : bbp_add_user_subscription( $user_id, $object->ID ); // Bail if action failed if ( empty( $status ) ) { @@ -353,4 +353,5 @@ public function ajax_subscription() { } } new BBP_Default(); -endif; + +endif; // class_exists check