Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPCS sorting: WordPress.WhiteSpace and WP.PostsPerPage #26

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
227 changes: 136 additions & 91 deletions phpcs.xml.dist

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/includes/admin/classes/class-bbp-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public function add_notice( $message, $class = false, $is_dismissible = true ) {
// One message as string
if ( is_string( $message ) ) {
$message = '<p>' . $this->esc_notice( $message ) . '</p>';
$default_class ='updated';
$default_class = 'updated';

// Messages as objects
} elseif ( is_wp_error( $message ) ) {
Expand Down
2 changes: 1 addition & 1 deletion src/includes/admin/classes/class-bbp-converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/includes/admin/converters/phpBB.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
71 changes: 37 additions & 34 deletions src/includes/admin/metaboxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<a href="' . esc_url( $link ) . '">' . $num . '</a>';
$text = '<a href="' . esc_url( $link ) . '">' . $text . '</a>';
$link = add_query_arg( array( 'post_type' => bbp_get_forum_post_type() ), admin_url( 'edit.php' ) );
$num = '<a href="' . esc_url( $link ) . '">' . $num . '</a>';
$text = '<a href="' . esc_url( $link ) . '">' . $text . '</a>';
}
?>

Expand All @@ -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 = '<a href="' . esc_url( $link ) . '">' . $num . '</a>';
$text = '<a href="' . esc_url( $link ) . '">' . $text . '</a>';
$link = add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) );
$num = '<a href="' . esc_url( $link ) . '">' . $num . '</a>';
$text = '<a href="' . esc_url( $link ) . '">' . $text . '</a>';
}
?>

Expand All @@ -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 = '<a href="' . esc_url( $link ) . '">' . $num . '</a>';
$text = '<a href="' . esc_url( $link ) . '">' . $text . '</a>';
$link = add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) );
$num = '<a href="' . esc_url( $link ) . '">' . $num . '</a>';
$text = '<a href="' . esc_url( $link ) . '">' . $text . '</a>';
}
?>

Expand All @@ -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 = '<a href="' . esc_url( $link ) . '">' . $num . '</a>';
$text = '<a href="' . esc_url( $link ) . '">' . $text . '</a>';
$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 = '<a href="' . esc_url( $link ) . '">' . $num . '</a>';
$text = '<a href="' . esc_url( $link ) . '">' . $text . '</a>';
}
?>

Expand Down Expand Up @@ -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 = '<a href="' . $link . '">' . $num . '</a>';
$text = '<a href="' . $link . '">' . $text . '</a>';
$link = admin_url( 'users.php' );
$num = '<a href="' . $link . '">' . $num . '</a>';
$text = '<a href="' . $link . '">' . $text . '</a>';
}
?>

Expand All @@ -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 = '<a href="' . esc_url( $link ) . '" title="' . esc_attr( $r['hidden_topic_title'] ) . '">' . $num . '</a>';
$text = '<a class="waiting" href="' . esc_url( $link ) . '" title="' . esc_attr( $r['hidden_topic_title'] ) . '">' . $text . '</a>';
Expand All @@ -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 = '<a href="' . esc_url( $link ) . '" title="' . esc_attr( $r['hidden_reply_title'] ) . '">' . $num . '</a>';
$text = '<a class="waiting" href="' . esc_url( $link ) . '" title="' . esc_attr( $r['hidden_reply_title'] ) . '">' . $text . '</a>';
Expand Down Expand Up @@ -354,22 +354,25 @@ function bbp_forum_metabox( $post ) {
<p>
<strong class="label"><?php esc_html_e( 'Parent:', 'bbpress' ); ?></strong>
<label class="screen-reader-text" for="parent_id"><?php esc_html_e( 'Forum Parent', 'bbpress' ); ?></label>
<?php bbp_dropdown( array(
'post_type' => bbp_get_forum_post_type(),
'selected' => $post_parent,
'numberposts' => -1,
'orderby' => 'title',
'order' => 'ASC',
'walker' => '',
'exclude' => $post->ID,
<?php bbp_dropdown(
array(
'post_type' => 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__( '&mdash; No parent &mdash;', 'bbpress' ),
'disable_categories' => false,
'disabled' => ''
) ); ?>
// Output-related
'select_id' => 'parent_id',
'options_only' => false,
'show_none' => esc_html__( '&mdash; No parent &mdash;', 'bbpress' ),
'disable_categories' => false,
'disabled' => ''
)
);
?>
</p>

<p>
Expand Down Expand Up @@ -445,7 +448,7 @@ function bbp_topic_metabox( $post ) {
'show_none' => esc_html__( '&mdash; No forum &mdash;', 'bbpress' ),
'disable_categories' => current_user_can( 'edit_forums' ),
'disabled' => ''
) ); ?>
) ); ?>
</p>

<input name="ping_status" type="hidden" id="ping_status" value="open" />
Expand Down Expand Up @@ -509,7 +512,7 @@ function bbp_reply_metabox( $post ) {
'show_none' => esc_html__( '&mdash; No reply &mdash;', 'bbpress' ),
'disable_categories' => current_user_can( 'edit_forums' ),
'disabled' => ''
) ); ?>
) ); ?>
</p>

<?php endif;
Expand Down
2 changes: 1 addition & 1 deletion src/includes/admin/replies.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public function save_meta_boxes( $reply_id ) {
}

// Get the reply meta post values
$topic_id = ! empty( $_POST['parent_id'] ) ? (int) $_POST['parent_id'] : 0;
$topic_id = ! empty( $_POST['parent_id'] ) ? (int) $_POST['parent_id'] : 0;
$forum_id = ! empty( $_POST['bbp_forum_id'] ) ? (int) $_POST['bbp_forum_id'] : bbp_get_topic_forum_id( $topic_id );
$reply_to = ! empty( $_POST['bbp_reply_to'] ) ? (int) $_POST['bbp_reply_to'] : 0;

Expand Down
Loading