Skip to:
Content

bbPress.org

Changeset 7357


Ignore:
Timestamp:
11/16/2025 04:55:52 AM (5 months ago)
Author:
johnjamesjacoby
Message:

Tools - Code Improvement:

This commit modifies several PHP files to strictly adhere to the following PHPCS rules:

  • WordPress.WP.I18n.NonSingularStringLiteralText
  • WordPress.WP.PostsPerPage.posts_per_page_posts_per_page
  • WordPress.WhiteSpace.ControlStructureSpacing.ExtraSpaceAfterOpenParenthesis
  • WordPress.WhiteSpace.ControlStructureSpacing.ExtraSpaceBeforeCloseParenthesis
  • WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterOpenParenthesis
  • WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeCloseParenthesis
  • WordPress.WhiteSpace.OperatorSpacing.NoSpaceAfter
  • WordPress.WhiteSpace.OperatorSpacing.NoSpaceBefore
  • WordPress.WhiteSpace.OperatorSpacing.SpacingAfter
  • WordPress.WhiteSpace.OperatorSpacing.SpacingBefore

This commit does not include changes to the phpcs.xml.dist config file to add these rules yet - this will happen in a separate commit.

Props sirlouen.

In trunk, for 2.7.

See #3614.

Location:
trunk/src
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/classes/class-bbp-admin.php

    r7352 r7357  
    346346        if ( is_string( $message ) ) {
    347347            $message       = '<p>' . $this->esc_notice( $message ) . '</p>';
    348             $default_class ='updated';
     348            $default_class = 'updated';
    349349
    350350        // Messages as objects
  • trunk/src/includes/admin/classes/class-bbp-converter.php

    r6833 r7357  
    389389        if ( $this->rows_in_step > 0 ) {
    390390            $total_mini_steps      = ceil( $this->rows_in_step / $this->rows );
    391             $current_mini_step     = ceil( $this->start        / $this->rows );
     391            $current_mini_step     = ceil( $this->start / $this->rows );
    392392            $this->step_percentage = round( ( $current_mini_step / $total_mini_steps ) * 100, 2 );
    393393        } else {
  • trunk/src/includes/admin/converters/phpBB.php

    r7006 r7357  
    810810            $output .= $itoa64[ $value & 0x3f ];
    811811
    812             if ($i < $count) {
     812            if ( $i < $count ) {
    813813                $value |= ord( $input[ $i ] ) << 8;
    814814            }
  • trunk/src/includes/admin/metaboxes.php

    r7006 r7357  
    355355        <strong class="label"><?php esc_html_e( 'Parent:', 'bbpress' ); ?></strong>
    356356        <label class="screen-reader-text" for="parent_id"><?php esc_html_e( 'Forum Parent', 'bbpress' ); ?></label>
    357         <?php bbp_dropdown( array(
    358             'post_type'          => bbp_get_forum_post_type(),
    359             'selected'           => $post_parent,
    360             'numberposts'        => -1,
    361             'orderby'            => 'title',
    362             'order'              => 'ASC',
    363             'walker'             => '',
    364             'exclude'            => $post->ID,
    365 
    366             // Output-related
    367             'select_id'          => 'parent_id',
    368             'options_only'       => false,
    369             'show_none'          => esc_html__( '&mdash; No parent &mdash;', 'bbpress' ),
    370             'disable_categories' => false,
    371             'disabled'           => ''
    372         ) ); ?>
     357        <?php
     358        bbp_dropdown(
     359            array(
     360                'post_type'          => bbp_get_forum_post_type(),
     361                'selected'           => $post_parent,
     362                'numberposts'        => -1,
     363                'orderby'            => 'title',
     364                'order'              => 'ASC',
     365                'walker'             => '',
     366                'exclude'            => $post->ID,
     367
     368                // Output-related
     369                'select_id'          => 'parent_id',
     370                'options_only'       => false,
     371                'show_none'          => esc_html__( '&mdash; No parent &mdash;', 'bbpress' ),
     372                'disable_categories' => false,
     373                'disabled'           => ''
     374            )
     375        );
     376        ?>
    373377    </p>
    374378
     
    431435        <strong class="label"><?php esc_html_e( 'Forum:', 'bbpress' ); ?></strong>
    432436        <label class="screen-reader-text" for="parent_id"><?php esc_html_e( 'Forum', 'bbpress' ); ?></label>
    433         <?php bbp_dropdown( array(
    434             'post_type'          => bbp_get_forum_post_type(),
    435             'selected'           => bbp_get_topic_forum_id( $post->ID ),
    436             'numberposts'        => -1,
    437             'orderby'            => 'title',
    438             'order'              => 'ASC',
    439             'walker'             => '',
    440             'exclude'            => '',
     437        <?php
     438        bbp_dropdown(
     439            array(
     440                'post_type'          => bbp_get_forum_post_type(),
     441                'selected'           => bbp_get_topic_forum_id( $post->ID ),
     442                'numberposts'        => -1,
     443                'orderby'            => 'title',
     444                'order'              => 'ASC',
     445                'walker'             => '',
     446                'exclude'            => '',
    441447
    442448            // Output-related
     
    446452            'disable_categories' => current_user_can( 'edit_forums' ),
    447453            'disabled'           => ''
    448         ) ); ?>
     454            )
     455        );
     456        ?>
    449457    </p>
    450458
     
    495503            <strong class="label"><?php esc_html_e( 'Forum:', 'bbpress' ); ?></strong>
    496504            <label class="screen-reader-text" for="bbp_forum_id"><?php esc_html_e( 'Forum', 'bbpress' ); ?></label>
    497             <?php bbp_dropdown( array(
    498                 'post_type'          => bbp_get_forum_post_type(),
    499                 'selected'           => $reply_forum_id,
    500                 'numberposts'        => -1,
    501                 'orderby'            => 'title',
    502                 'order'              => 'ASC',
    503                 'walker'             => '',
    504                 'exclude'            => '',
    505 
    506                 // Output-related
    507                 'select_id'          => 'bbp_forum_id',
    508                 'options_only'       => false,
    509                 'show_none'          => esc_html__( '&mdash; No reply &mdash;', 'bbpress' ),
    510                 'disable_categories' => current_user_can( 'edit_forums' ),
    511                 'disabled'           => ''
    512             ) ); ?>
     505            <?php
     506            bbp_dropdown(
     507                array(
     508                    'post_type'          => bbp_get_forum_post_type(),
     509                    'selected'           => $reply_forum_id,
     510                    'numberposts'        => -1,
     511                    'orderby'            => 'title',
     512                    'order'              => 'ASC',
     513                    'walker'             => '',
     514                    'exclude'            => '',
     515
     516                    // Output-related
     517                    'select_id'          => 'bbp_forum_id',
     518                    'options_only'       => false,
     519                    'show_none'          => esc_html__( '&mdash; No reply &mdash;', 'bbpress' ),
     520                    'disable_categories' => current_user_can( 'edit_forums' ),
     521                    'disabled'           => ''
     522                )
     523            );
     524            ?>
    513525        </p>
    514526
  • trunk/src/includes/admin/replies.php

    r7352 r7357  
    415415
    416416        // Get the reply meta post values
    417         $topic_id = ! empty( $_POST['parent_id']    ) ? (int) $_POST['parent_id']    : 0;
     417        $topic_id = ! empty( $_POST['parent_id']    ) ? (int) $_POST['parent_id'] : 0;
    418418        $forum_id = ! empty( $_POST['bbp_forum_id'] ) ? (int) $_POST['bbp_forum_id'] : bbp_get_topic_forum_id( $topic_id );
    419419        $reply_to = ! empty( $_POST['bbp_reply_to'] ) ? (int) $_POST['bbp_reply_to'] : 0;
  • trunk/src/includes/admin/settings.php

    r7179 r7357  
    340340                'callback'          => 'bbp_admin_setting_callback_show_on_root',
    341341                'sanitize_callback' => 'sanitize_text_field',
    342                 'args'              => array( 'label_for'=>'_bbp_show_on_root' )
     342                'args'              => array( 'label_for' => '_bbp_show_on_root' )
    343343            ),
    344344        ),
     
    353353                'callback'          => 'bbp_admin_setting_callback_forum_slug',
    354354                'sanitize_callback' => 'bbp_sanitize_slug',
    355                 'args'              => array( 'label_for'=>'_bbp_forum_slug' )
     355                'args'              => array( 'label_for' => '_bbp_forum_slug' )
    356356            ),
    357357
     
    361361                'callback'          => 'bbp_admin_setting_callback_topic_slug',
    362362                'sanitize_callback' => 'bbp_sanitize_slug',
    363                 'args'              => array( 'label_for'=>'_bbp_topic_slug' )
     363                'args'              => array( 'label_for' => '_bbp_topic_slug' )
    364364            ),
    365365
     
    369369                'callback'          => 'bbp_admin_setting_callback_topic_tag_slug',
    370370                'sanitize_callback' => 'bbp_sanitize_slug',
    371                 'args'              => array( 'label_for'=>'_bbp_topic_tag_slug' )
     371                'args'              => array( 'label_for' => '_bbp_topic_tag_slug' )
    372372            ),
    373373
     
    377377                'callback'          => 'bbp_admin_setting_callback_view_slug',
    378378                'sanitize_callback' => 'bbp_sanitize_slug',
    379                 'args'              => array( 'label_for'=>'_bbp_view_slug' )
     379                'args'              => array( 'label_for' => '_bbp_view_slug' )
    380380            ),
    381381
     
    385385                'callback'          => 'bbp_admin_setting_callback_reply_slug',
    386386                'sanitize_callback' => 'bbp_sanitize_slug',
    387                 'args'              => array( 'label_for'=>'_bbp_reply_slug' )
     387                'args'              => array( 'label_for' => '_bbp_reply_slug' )
    388388            ),
    389389
     
    393393                'callback'          => 'bbp_admin_setting_callback_edit_slug',
    394394                'sanitize_callback' => 'bbp_sanitize_slug',
    395                 'args'              => array( 'label_for'=>'_bbp_edit_slug' )
     395                'args'              => array( 'label_for' => '_bbp_edit_slug' )
    396396            ),
    397397
     
    401401                'callback'          => 'bbp_admin_setting_callback_search_slug',
    402402                'sanitize_callback' => 'bbp_sanitize_slug',
    403                 'args'              => array( 'label_for'=>'_bbp_search_slug' )
     403                'args'              => array( 'label_for' => '_bbp_search_slug' )
    404404            )
    405405        ),
     
    414414                'callback'          => 'bbp_admin_setting_callback_user_slug',
    415415                'sanitize_callback' => 'bbp_sanitize_slug',
    416                 'args'              => array( 'label_for'=>'_bbp_user_slug' )
     416                'args'              => array( 'label_for' => '_bbp_user_slug' )
    417417            ),
    418418
     
    422422                'callback'          => 'bbp_admin_setting_callback_topic_archive_slug',
    423423                'sanitize_callback' => 'bbp_sanitize_slug',
    424                 'args'              => array( 'label_for'=>'_bbp_topic_archive_slug' )
     424                'args'              => array( 'label_for' => '_bbp_topic_archive_slug' )
    425425            ),
    426426
     
    430430                'callback'          => 'bbp_admin_setting_callback_reply_archive_slug',
    431431                'sanitize_callback' => 'bbp_sanitize_slug',
    432                 'args'              => array( 'label_for'=>'_bbp_reply_archive_slug' )
     432                'args'              => array( 'label_for' => '_bbp_reply_archive_slug' )
    433433            ),
    434434
     
    438438                'callback'          => 'bbp_admin_setting_callback_user_favs_slug',
    439439                'sanitize_callback' => 'bbp_sanitize_slug',
    440                 'args'              => array( 'label_for'=>'_bbp_user_favs_slug' )
     440                'args'              => array( 'label_for' => '_bbp_user_favs_slug' )
    441441            ),
    442442
     
    446446                'callback'          => 'bbp_admin_setting_callback_user_subs_slug',
    447447                'sanitize_callback' => 'bbp_sanitize_slug',
    448                 'args'              => array( 'label_for'=>'_bbp_user_subs_slug' )
     448                'args'              => array( 'label_for' => '_bbp_user_subs_slug' )
    449449            ),
    450450
     
    454454                'callback'          => 'bbp_admin_setting_callback_user_engagements_slug',
    455455                'sanitize_callback' => 'bbp_sanitize_slug',
    456                 'args'              => array( 'label_for'=>'_bbp_user_engs_slug' )
     456                'args'              => array( 'label_for' => '_bbp_user_engs_slug' )
    457457            )
    458458        ),
     
    475475                'callback'          => 'bbp_admin_setting_callback_group_forums_root_id',
    476476                'sanitize_callback' => 'intval',
    477                 'args'              => array( 'label_for'=>'_bbp_group_forums_root_id' )
     477                'args'              => array( 'label_for' => '_bbp_group_forums_root_id' )
    478478            )
    479479        ),
     
    502502                'callback'          => 'bbp_converter_setting_callback_platform',
    503503                'sanitize_callback' => 'sanitize_text_field',
    504                 'args'              => array( 'label_for'=> '_bbp_converter_platform' )
     504                'args'              => array( 'label_for' => '_bbp_converter_platform' )
    505505            ),
    506506
     
    510510                'callback'          => 'bbp_converter_setting_callback_dbserver',
    511511                'sanitize_callback' => 'sanitize_text_field',
    512                 'args'              => array( 'label_for'=> '_bbp_converter_db_server' )
     512                'args'              => array( 'label_for' => '_bbp_converter_db_server' )
    513513            ),
    514514
     
    518518                'callback'          => 'bbp_converter_setting_callback_dbport',
    519519                'sanitize_callback' => 'intval',
    520                 'args'              => array( 'label_for'=> '_bbp_converter_db_port' )
     520                'args'              => array( 'label_for' => '_bbp_converter_db_port' )
    521521            ),
    522522
     
    526526                'callback'          => 'bbp_converter_setting_callback_dbname',
    527527                'sanitize_callback' => 'sanitize_text_field',
    528                 'args'              => array( 'label_for'=> '_bbp_converter_db_name' )
     528                'args'              => array( 'label_for' => '_bbp_converter_db_name' )
    529529            ),
    530530
     
    534534                'callback'          => 'bbp_converter_setting_callback_dbuser',
    535535                'sanitize_callback' => 'sanitize_text_field',
    536                 'args'              => array( 'label_for'=> '_bbp_converter_db_user' )
     536                'args'              => array( 'label_for' => '_bbp_converter_db_user' )
    537537            ),
    538538
     
    542542                'callback'          => 'bbp_converter_setting_callback_dbpass',
    543543                'sanitize_callback' => 'sanitize_text_field',
    544                 'args'              => array( 'label_for'=> '_bbp_converter_db_pass' )
     544                'args'              => array( 'label_for' => '_bbp_converter_db_pass' )
    545545            ),
    546546
     
    550550                'callback'          => 'bbp_converter_setting_callback_dbprefix',
    551551                'sanitize_callback' => 'sanitize_text_field',
    552                 'args'              => array( 'label_for'=> '_bbp_converter_db_prefix' )
     552                'args'              => array( 'label_for' => '_bbp_converter_db_prefix' )
    553553            )
    554554        ),
     
    562562                'callback'          => 'bbp_converter_setting_callback_rows',
    563563                'sanitize_callback' => 'intval',
    564                 'args'              => array( 'label_for'=> '_bbp_converter_rows' )
     564                'args'              => array( 'label_for' => '_bbp_converter_rows' )
    565565            ),
    566566
     
    570570                'callback'          => 'bbp_converter_setting_callback_delay_time',
    571571                'sanitize_callback' => 'intval',
    572                 'args'              => array( 'label_for'=> '_bbp_converter_delay_time' )
     572                'args'              => array( 'label_for' => '_bbp_converter_delay_time' )
    573573            ),
    574574
     
    578578                'callback'          => 'bbp_converter_setting_callback_convert_users',
    579579                'sanitize_callback' => 'intval',
    580                 'args'              => array( 'label_for'=> '_bbp_converter_convert_users' )
     580                'args'              => array( 'label_for' => '_bbp_converter_convert_users' )
    581581            ),
    582582
     
    586586                'callback'          => 'bbp_converter_setting_callback_halt',
    587587                'sanitize_callback' => 'intval',
    588                 'args'              => array( 'label_for'=> '_bbp_converter_halt' )
     588                'args'              => array( 'label_for' => '_bbp_converter_halt' )
    589589            ),
    590590
     
    594594                'callback'          => 'bbp_converter_setting_callback_restart',
    595595                'sanitize_callback' => 'intval',
    596                 'args'              => array( 'label_for'=> '_bbp_converter_restart' )
     596                'args'              => array( 'label_for' => '_bbp_converter_restart' )
    597597            ),
    598598
     
    602602                'callback'          => 'bbp_converter_setting_callback_clean',
    603603                'sanitize_callback' => 'intval',
    604                 'args'              => array( 'label_for'=> '_bbp_converter_clean' )
     604                'args'              => array( 'label_for' => '_bbp_converter_clean' )
    605605            )
    606606        )
  • trunk/src/includes/admin/tools/repair.php

    r7352 r7357  
    8484                        </td>
    8585                        <th scope="col" id="description" class="manage-column column-primary column-description sortable <?php echo ( 'priority' === $orderby ) ? esc_attr( $order ) : 'asc'; ?>">
    86                             <a href="<?php echo esc_url( bbp_get_admin_repair_tool_page_url( array(
    87                                     'orderby' => 'priority',
    88                                     'order'   => $new_order
    89                                 ) ) ); ?>"><span><?php esc_html_e( 'Description', 'bbpress' ); ?></span><span class="sorting-indicator"></span>
    90                             </a>
     86                            <a href="
     87                                <?php
     88                                echo esc_url(
     89                                    bbp_get_admin_repair_tool_page_url(
     90                                        array(
     91                                            'orderby' => 'priority',
     92                                            'order'   => $new_order
     93                                        )
     94                                    )
     95                                );
     96                                ?>">
     97                                <span>
     98                                    <?php
     99                                    esc_html_e( 'Description', 'bbpress' );
     100                                    ?>
     101                                </span>
     102                                <span class="sorting-indicator"></span>
    91103                        </th>
    92104                        <th scope="col" id="components" class="manage-column column-components">
     
    94106                        </th>
    95107                        <th scope="col" id="overhead" class="manage-column column-overhead sortable <?php echo ( 'overhead' === $orderby ) ? esc_attr( $order ) : 'asc'; ?>">
    96                             <a href="<?php echo esc_url( bbp_get_admin_repair_tool_page_url( array(
    97                                     'orderby' => 'overhead',
    98                                     'order'   => $new_order
    99                                 ) ) ); ?>"><span><?php esc_html_e( 'Overhead', 'bbpress' ); ?></span><span class="sorting-indicator"></span>
    100                             </a>
     108                            <a href="
     109                                <?php
     110                                echo esc_url(
     111                                    bbp_get_admin_repair_tool_page_url(
     112                                        array(
     113                                            'orderby' => 'overhead',
     114                                            'order'   => $new_order
     115                                        )
     116                                    )
     117                                );
     118                                ?>">
     119                                <span>
     120                                    <?php
     121                                    esc_html_e( 'Overhead', 'bbpress' );
     122                                    ?>
     123                                </span>
     124                                <span class="sorting-indicator"></span>
    101125                        </th>
    102126                    </tr>
     
    513537    }
    514538
    515     if ( !count( $insert_values ) ) {
     539    if ( ! count( $insert_values ) ) {
    516540        return array( 2, sprintf( $statement, $result ) );
    517541    }
     
    563587    }
    564588
    565     if ( !count( $insert_values ) ) {
     589    if ( ! count( $insert_values ) ) {
    566590        return array( 2, sprintf( $statement, $result ) );
    567591    }
     
    633657    }
    634658
    635     if ( !count( $values ) ) {
     659    if ( ! count( $values ) ) {
    636660        $result = esc_html__( 'Nothing to remove!', 'bbpress' );
    637661        return array( 0, sprintf( $statement, $result ) );
     
    702726    }
    703727
    704     if ( !count( $values ) ) {
     728    if ( ! count( $values ) ) {
    705729        $result = esc_html__( 'Nothing to remove!', 'bbpress' );
    706730        return array( 0, sprintf( $statement, $result ) );
     
    771795    }
    772796
    773     if ( !count( $values ) ) {
     797    if ( ! count( $values ) ) {
    774798        $result = esc_html__( 'Nothing to remove!', 'bbpress' );
    775799        return array( 0, sprintf( $statement, $result ) );
  • trunk/src/includes/admin/tools/upgrade.php

    r7150 r7357  
    8383                        </td>
    8484                        <th scope="col" id="description" class="manage-column column-primary column-description sortable <?php echo ( 'priority' === $orderby ) ? esc_attr( $order ) : 'asc'; ?>">
    85                             <a href="<?php echo esc_url( bbp_get_admin_repair_tool_page_url( array(
    86                                     'orderby' => 'priority',
    87                                     'order'   => $new_order
    88                                 ) ) ); ?>"><span><?php esc_html_e( 'Description', 'bbpress' ); ?></span><span class="sorting-indicator"></span>
     85                            <a href="
     86                                <?php
     87                                echo esc_url(
     88                                    bbp_get_admin_repair_tool_page_url(
     89                                        array(
     90                                            'orderby' => 'priority',
     91                                            'order'   => $new_order
     92                                        )
     93                                    )
     94                                );
     95                                ?>">
     96                                <span><?php esc_html_e( 'Description', 'bbpress' ); ?></span>
     97                                <span class="sorting-indicator"></span>
    8998                            </a>
    9099                        </th>
    91100                        <th scope="col" id="version" class="manage-column column-version sortable <?php echo ( 'version' === $orderby ) ? esc_attr( $order ) : 'asc'; ?>">
    92                             <a href="<?php echo esc_url( bbp_get_admin_repair_tool_page_url( array(
    93                                     'orderby' => 'version',
    94                                     'order'   => $new_order
    95                                 ) ) ); ?>"><span><?php esc_html_e( 'Version', 'bbpress' ); ?></span><span class="sorting-indicator"></span>
     101                            <a href="
     102                                <?php
     103                                echo esc_url(
     104                                    bbp_get_admin_repair_tool_page_url(
     105                                        array(
     106                                            'orderby' => 'version',
     107                                            'order'   => $new_order
     108                                        )
     109                                    )
     110                                );
     111                                ?>">
     112                                <span><?php esc_html_e( 'Version', 'bbpress' ); ?></span>
     113                                <span class="sorting-indicator"></span>
    96114                            </a>
    97115                        </th>
    98                         <th scope="col" id="components" class="manage-column column-components"><?php esc_html_e( 'Components', 'bbpress' ); ?></th>
     116                        <th scope="col" id="components" class="manage-column column-components">
     117                            <?php esc_html_e( 'Components', 'bbpress' ); ?>
     118                        </th>
    99119                        <th scope="col" id="overhead" class="manage-column column-overhead sortable <?php echo ( 'overhead' === $orderby ) ? esc_attr( $order ) : 'asc'; ?>">
    100                             <a href="<?php echo esc_url( bbp_get_admin_repair_tool_page_url( array(
    101                                     'orderby' => 'overhead',
    102                                     'order'   => $new_order
    103                                 ) ) ); ?>"><span><?php esc_html_e( 'Overhead', 'bbpress' ); ?></span><span class="sorting-indicator"></span>
     120                            <a href="
     121                                <?php
     122                                echo esc_url(
     123                                    bbp_get_admin_repair_tool_page_url(
     124                                        array(
     125                                            'orderby' => 'overhead',
     126                                            'order'   => $new_order
     127                                        )
     128                                    )
     129                                );
     130                                ?>">
     131                                <span><?php esc_html_e( 'Overhead', 'bbpress' ); ?></span>
     132                                <span class="sorting-indicator"></span>
    104133                            </a>
    105134                        </th>
  • trunk/src/includes/admin/topics.php

    r7352 r7357  
    622622                    ? true
    623623                    : false;
    624                 $message   = ( true  === $is_sticky )
     624                $message   = ( true === $is_sticky )
    625625                    ? 'unstuck'
    626626                    : 'stuck';
    627                 $message   = ( true  === $is_super )
     627                $message   = ( true === $is_super )
    628628                    ? 'super_sticky'
    629629                    : $message;
    630                 $success   = ( true  === $is_sticky )
     630                $success   = ( true === $is_sticky )
    631631                    ? bbp_unstick_topic( $topic_id )
    632632                    : bbp_stick_topic( $topic_id, $is_super );
  • trunk/src/includes/common/classes.php

    r6573 r7357  
    223223        // - the forum is a category
    224224        // - forum is closed
    225         if (    ( true === $args['disable_categories'] )
     225        if ( ( true === $args['disable_categories'] )
    226226                && ( bbp_get_forum_post_type() === $object->post_type )
    227227                && ( bbp_is_forum_category( $object->ID )
  • trunk/src/includes/common/engagements.php

    r7025 r7357  
    279279        if ( is_numeric( $args ) ) {
    280280            $args = array(
    281                 'meta_query' => array( array(
    282                     'key'     => $meta_key,
    283                     'value'   => bbp_get_user_id( $args, false, false ),
    284                     'compare' => 'NUMERIC'
    285                 ) )
     281                'meta_query' => array(
     282                    array(
     283                        'key'     => $meta_key,
     284                        'value'   => bbp_get_user_id( $args, false, false ),
     285                        'compare' => 'NUMERIC'
     286                    )
     287                )
    286288            );
    287289        }
     
    289291        // Default arguments
    290292        $defaults = array(
    291             'meta_query' => array( array(
    292                 'key'     => $meta_key,
    293                 'value'   => bbp_get_displayed_user_id(),
    294                 'compare' => 'NUMERIC'
    295             ) )
     293            'meta_query' => array(
     294                array(
     295                    'key'     => $meta_key,
     296                    'value'   => bbp_get_displayed_user_id(),
     297                    'compare' => 'NUMERIC'
     298                )
     299            )
    296300        );
    297301
     
    503507        if ( is_numeric( $args ) ) {
    504508            $args = array(
    505                 'tax_query' => array( array(
    506                     'taxonomy' => $tax_key,
    507                     'terms'    => $user_key . bbp_get_user_id( $args, false, false ),
    508                     'field'    => 'slug'
    509                 ) )
     509                'tax_query' => array(
     510                    array(
     511                        'taxonomy' => $tax_key,
     512                        'terms'    => $user_key . bbp_get_user_id( $args, false, false ),
     513                        'field'    => 'slug'
     514                    )
     515                )
    510516            );
    511517        }
     
    513519        // Default arguments
    514520        $defaults = array(
    515             'tax_query' => array( array(
    516                 'taxonomy' => $tax_key,
    517                 'terms'    => $user_key . bbp_get_displayed_user_id(),
    518                 'field'    => 'slug'
    519             ) )
     521            'tax_query' => array(
     522                array(
     523                    'taxonomy' => $tax_key,
     524                    'terms'    => $user_key . bbp_get_displayed_user_id(),
     525                    'field'    => 'slug'
     526                )
     527            )
    520528        );
    521529
  • trunk/src/includes/common/formatting.php

    r7352 r7357  
    215215
    216216    // Wrap blocks in pre tags
    217     if ('`' !== $matches[1] ) {
     217    if ( '`' !== $matches[1] ) {
    218218        $content = "\n<pre>" . $content . "</pre>\n";
    219219    }
  • trunk/src/includes/common/functions.php

    r7315 r7357  
    591591    // Parse arguments against default values
    592592    $r = bbp_parse_args( $args, array(
    593         'bbp_anonymous_name'    => ! empty( $_POST['bbp_anonymous_name']    ) ? $_POST['bbp_anonymous_name']    : false,
    594         'bbp_anonymous_email'   => ! empty( $_POST['bbp_anonymous_email']   ) ? $_POST['bbp_anonymous_email']   : false,
     593        'bbp_anonymous_name'    => ! empty( $_POST['bbp_anonymous_name']    ) ? $_POST['bbp_anonymous_name'] : false,
     594        'bbp_anonymous_email'   => ! empty( $_POST['bbp_anonymous_email']   ) ? $_POST['bbp_anonymous_email'] : false,
    595595        'bbp_anonymous_website' => ! empty( $_POST['bbp_anonymous_website'] ) ? $_POST['bbp_anonymous_website'] : false,
    596596    ), 'filter_anonymous_post_data' );
     
    742742
    743743            // Get the meta SQL
    744             $clauses = get_meta_sql( array( array(
    745                 'key'   => '_bbp_anonymous_email',
    746                 'value' => $email,
    747             ) ), 'post', $bbp_db->posts, 'ID' );
     744            $clauses = get_meta_sql(
     745                array(
     746                    array(
     747                        'key'   => '_bbp_anonymous_email',
     748                        'value' => $email,
     749                    )
     750                ),
     751                'post',
     752                $bbp_db->posts,
     753                'ID'
     754            );
    748755
    749756            // Set clauses
     
    23872394
    23882395                            // Restrict to specific forum ID
    2389                             $meta_query = array( array(
    2390                                 'key'     => '_bbp_forum_id',
    2391                                 'value'   => bbp_get_forum_id(),
    2392                                 'type'    => 'NUMERIC',
    2393                                 'compare' => '='
    2394                             ) );
     2396                            $meta_query = array(
     2397                                array(
     2398                                    'key'     => '_bbp_forum_id',
     2399                                    'value'   => bbp_get_forum_id(),
     2400                                    'type'    => 'NUMERIC',
     2401                                    'compare' => '='
     2402                                )
     2403                            );
    23952404                        }
    23962405
  • trunk/src/includes/common/locale.php

    r6118 r7357  
    3131 */
    3232function bbp_translate_user_role( $name ) {
    33     return translate_with_gettext_context( before_last_bar( $name ), 'User role', 'bbpress' );
     33    // WordPress.WP.I18n.NoEmptyStrings
     34    // -- empty string is intentional here as actual content comes from database
     35    return _x( before_last_bar( $name ), 'User role', 'bbpress' ); // phpcs:ignore
    3436}
    3537
  • trunk/src/includes/common/locks.php

    r7352 r7357  
    2424
    2525    // Bail if no post
    26     if ( !$post = get_post( $post_id ) ) {
     26    if ( ! $post = get_post( $post_id ) ) {
    2727        return false;
    2828    }
    2929
    3030    // Bail if no lock
    31     if ( !$lock = get_post_meta( $post->ID, '_edit_lock', true ) ) {
     31    if ( ! $lock = get_post_meta( $post->ID, '_edit_lock', true ) ) {
    3232        return false;
    3333    }
     
    6363
    6464    // Bail if no post
    65     if ( !$post = get_post( $post_id ) ) {
     65    if ( ! $post = get_post( $post_id ) ) {
    6666        return false;
    6767    }
  • trunk/src/includes/common/shortcodes.php

    r7076 r7357  
    847847     */
    848848    public function display_topics_of_tag_query( $args = array() ) {
    849         $args['tax_query'] = array( array(
    850             'taxonomy' => bbp_get_topic_tag_tax_id(),
    851             'field'    => 'id',
    852             'terms'    => bbpress()->current_topic_tag_id
    853         ) );
     849        $args['tax_query'] = array(
     850            array(
     851                'taxonomy' => bbp_get_topic_tag_tax_id(),
     852                'field'    => 'id',
     853                'terms'    => bbpress()->current_topic_tag_id
     854            )
     855        );
    854856
    855857        return $args;
  • trunk/src/includes/common/widgets.php

    r7009 r7357  
    696696                    'post_parent'    => $settings['parent_forum'],
    697697                    'posts_per_page' => (int) $settings['max_shown'],
    698                     'meta_query'     => array( array(
    699                         'key'  => '_bbp_last_active_time',
    700                         'type' => 'DATETIME'
    701                     ) ),
     698                    'meta_query'     => array(
     699                        array(
     700                            'key'  => '_bbp_last_active_time',
     701                            'type' => 'DATETIME'
     702                        )
     703                    ),
    702704
    703705                    // Ordering
     
    722724                    'post_parent'    => $settings['parent_forum'],
    723725                    'posts_per_page' => (int) $settings['max_shown'],
    724                     'meta_query'     => array( array(
    725                         'key'  => '_bbp_reply_count',
    726                         'type' => 'NUMERIC'
    727                     ) ),
     726                    'meta_query'     => array(
     727                        array(
     728                            'key'  => '_bbp_reply_count',
     729                            'type' => 'NUMERIC'
     730                        )
     731                    ),
    728732
    729733                    // Ordering
  • trunk/src/includes/core/template-loader.php

    r7343 r7357  
    3333
    3434    // User favorites
    35     elseif ( bbp_is_favorites()        && ( $new_template = bbp_get_favorites_template()        ) ) :
     35    elseif ( bbp_is_favorites() && ( $new_template = bbp_get_favorites_template()        ) ) :
    3636
    3737    // User favorites
    38     elseif ( bbp_is_subscriptions()    && ( $new_template = bbp_get_subscriptions_template()    ) ) :
     38    elseif ( bbp_is_subscriptions() && ( $new_template = bbp_get_subscriptions_template()    ) ) :
    3939
    4040    // Viewing a user
    41     elseif ( bbp_is_single_user()      && ( $new_template = bbp_get_single_user_template()      ) ) :
     41    elseif ( bbp_is_single_user() && ( $new_template = bbp_get_single_user_template()      ) ) :
    4242
    4343    // Single View
    44     elseif ( bbp_is_single_view()      && ( $new_template = bbp_get_single_view_template()      ) ) :
     44    elseif ( bbp_is_single_view() && ( $new_template = bbp_get_single_view_template()      ) ) :
    4545
    4646    // Search
    47     elseif ( bbp_is_search()           && ( $new_template = bbp_get_search_template()           ) ) :
     47    elseif ( bbp_is_search() && ( $new_template = bbp_get_search_template()           ) ) :
    4848
    4949    // Forum edit
    50     elseif ( bbp_is_forum_edit()       && ( $new_template = bbp_get_forum_edit_template()       ) ) :
     50    elseif ( bbp_is_forum_edit() && ( $new_template = bbp_get_forum_edit_template()       ) ) :
    5151
    5252    // Single Forum
    53     elseif ( bbp_is_single_forum()     && ( $new_template = bbp_get_single_forum_template()     ) ) :
     53    elseif ( bbp_is_single_forum() && ( $new_template = bbp_get_single_forum_template()     ) ) :
    5454
    5555    // Forum Archive
    56     elseif ( bbp_is_forum_archive()    && ( $new_template = bbp_get_forum_archive_template()    ) ) :
     56    elseif ( bbp_is_forum_archive() && ( $new_template = bbp_get_forum_archive_template()    ) ) :
    5757
    5858    // Topic merge
    59     elseif ( bbp_is_topic_merge()      && ( $new_template = bbp_get_topic_merge_template()      ) ) :
     59    elseif ( bbp_is_topic_merge() && ( $new_template = bbp_get_topic_merge_template()      ) ) :
    6060
    6161    // Topic split
    62     elseif ( bbp_is_topic_split()      && ( $new_template = bbp_get_topic_split_template()      ) ) :
     62    elseif ( bbp_is_topic_split() && ( $new_template = bbp_get_topic_split_template()      ) ) :
    6363
    6464    // Topic edit
    65     elseif ( bbp_is_topic_edit()       && ( $new_template = bbp_get_topic_edit_template()       ) ) :
     65    elseif ( bbp_is_topic_edit() && ( $new_template = bbp_get_topic_edit_template()       ) ) :
    6666
    6767    // Single Topic
    68     elseif ( bbp_is_single_topic()     && ( $new_template = bbp_get_single_topic_template()     ) ) :
     68    elseif ( bbp_is_single_topic() && ( $new_template = bbp_get_single_topic_template()     ) ) :
    6969
    7070    // Topic Archive
    71     elseif ( bbp_is_topic_archive()    && ( $new_template = bbp_get_topic_archive_template()    ) ) :
     71    elseif ( bbp_is_topic_archive() && ( $new_template = bbp_get_topic_archive_template()    ) ) :
    7272
    7373    // Reply move
    74     elseif ( bbp_is_reply_move()       && ( $new_template = bbp_get_reply_move_template()       ) ) :
     74    elseif ( bbp_is_reply_move() && ( $new_template = bbp_get_reply_move_template()       ) ) :
    7575
    7676    // Editing a reply
    77     elseif ( bbp_is_reply_edit()       && ( $new_template = bbp_get_reply_edit_template()       ) ) :
     77    elseif ( bbp_is_reply_edit() && ( $new_template = bbp_get_reply_edit_template()       ) ) :
    7878
    7979    // Single Reply
    80     elseif ( bbp_is_single_reply()     && ( $new_template = bbp_get_single_reply_template()     ) ) :
     80    elseif ( bbp_is_single_reply() && ( $new_template = bbp_get_single_reply_template()     ) ) :
    8181
    8282    // Editing a topic tag
    83     elseif ( bbp_is_topic_tag_edit()   && ( $new_template = bbp_get_topic_tag_edit_template()   ) ) :
     83    elseif ( bbp_is_topic_tag_edit() && ( $new_template = bbp_get_topic_tag_edit_template()   ) ) :
    8484
    8585    // Viewing a topic tag
    86     elseif ( bbp_is_topic_tag()        && ( $new_template = bbp_get_topic_tag_template()        ) ) :
     86    elseif ( bbp_is_topic_tag() && ( $new_template = bbp_get_topic_tag_template()        ) ) :
    8787    endif;
    8888
  • trunk/src/includes/extend/buddypress/groups.php

    r7336 r7357  
    656656
    657657        // Bail if not looking at this screen
    658         if ( !bp_is_group_creation_step( $this->slug ) ) {
     658        if ( ! bp_is_group_creation_step( $this->slug ) ) {
    659659            return false;
    660660        }
  • trunk/src/includes/extend/buddypress/loader.php

    r7305 r7357  
    196196
    197197        // Stop if there is no user displayed or logged in
    198         if ( ! is_user_logged_in() && !bp_displayed_user_id() ) {
     198        if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) {
    199199            return;
    200200        }
  • trunk/src/includes/forums/functions.php

    r7352 r7357  
    602602    } else {
    603603        $append_error = ( is_wp_error( $forum_id ) && $forum_id->get_error_message() ) ? $forum_id->get_error_message() . ' ' : '';
    604         bbp_add_error( 'bbp_forum_error', __( '<strong>Error</strong>: The following problem(s) have been found with your forum:' . $append_error . 'Please try again.', 'bbpress' ) );
     604        bbp_add_error( 'bbp_forum_error', sprintf( __( '<strong>Error</strong>: The following problem(s) have been found with your forum: %s Please try again.', 'bbpress' ) ), $append_error );
    605605    }
    606606}
     
    10921092
    10931093    // Update this forum id
    1094     update_post_meta( $forum_id, '_bbp_topic_count',       (int) ( $topic_count       + $difference ) );
     1094    update_post_meta( $forum_id, '_bbp_topic_count',       (int) ( $topic_count + $difference ) );
    10951095    update_post_meta( $forum_id, '_bbp_total_topic_count', (int) ( $total_topic_count + $difference ) );
    10961096
     
    12141214
    12151215    // Update this forum id
    1216     update_post_meta( $forum_id, '_bbp_topic_count_hidden',       (int) ( $reply_count       + $difference ) );
     1216    update_post_meta( $forum_id, '_bbp_topic_count_hidden',       (int) ( $reply_count + $difference ) );
    12171217    update_post_meta( $forum_id, '_bbp_total_topic_count_hidden', (int) ( $total_topic_count + $difference ) );
    12181218
     
    13371337
    13381338    // Update this forum id
    1339     update_post_meta( $forum_id, '_bbp_reply_count',       (int) ( $reply_count       + $difference ) );
     1339    update_post_meta( $forum_id, '_bbp_reply_count',       (int) ( $reply_count + $difference ) );
    13401340    update_post_meta( $forum_id, '_bbp_total_reply_count', (int) ( $total_reply_count + $difference ) );
    13411341
     
    13961396
    13971397    // Update this forum id
    1398     update_post_meta( $forum_id, '_bbp_reply_count_hidden',       (int) ( $reply_count       + $difference ) );
     1398    update_post_meta( $forum_id, '_bbp_reply_count_hidden',       (int) ( $reply_count + $difference ) );
    13991399    update_post_meta( $forum_id, '_bbp_total_reply_count_hidden', (int) ( $total_reply_count + $difference ) );
    14001400
  • trunk/src/includes/replies/functions.php

    r7352 r7357  
    825825    } else {
    826826        $append_error = ( is_wp_error( $reply_id ) && $reply_id->get_error_message() ) ? $reply_id->get_error_message() . ' ' : '';
    827         bbp_add_error( 'bbp_reply_error', __( '<strong>Error</strong>: The following problem(s) have been found with your reply:' . $append_error . 'Please try again.', 'bbpress' ) );
     827        bbp_add_error( 'bbp_reply_error', sprintf( __( '<strong>Error</strong>: The following problem(s) have been found with your reply: %s. Please try again.', 'bbpress' ) ), $append_error );
    828828    }
    829829}
  • trunk/src/includes/replies/template.php

    r7352 r7357  
    23012301
    23022302    // If pretty permalinks are enabled, make our pagination pretty
    2303     if ( bbp_use_pretty_urls() && ! bbp_is_topic_pending( $topic_id )) {
     2303    if ( bbp_use_pretty_urls() && ! bbp_is_topic_pending( $topic_id ) ) {
    23042304
    23052305        // User's replies
  • trunk/src/includes/search/template.php

    r7280 r7357  
    298298
    299299            // Searching globally
    300             if ( ! is_null( $search_terms )  ) {
     300            if ( ! is_null( $search_terms ) ) {
    301301                $search_terms = wp_unslash( $search_terms );
    302302
  • trunk/src/includes/topics/functions.php

    r7352 r7357  
    760760    } else {
    761761        $append_error = ( is_wp_error( $topic_id ) && $topic_id->get_error_message() ) ? $topic_id->get_error_message() . ' ' : '';
    762         bbp_add_error( 'bbp_topic_error', __( '<strong>Error</strong>: The following problem(s) have been found with your topic:' . $append_error . 'Please try again.', 'bbpress' ) );
     762        bbp_add_error( 'bbp_topic_error', sprintf( esc_html_e( '<strong>Error</strong>: The following problem(s) have been found with your topic: %s. Please try again.', 'bbpress' ) ), $append_error );
    763763    }
    764764}
     
    17751775
    17761776            // Attempt to update the tag
    1777             $slug        = ! empty( $_POST['tag-slug']        ) ? $_POST['tag-slug']        : '';
     1777            $slug        = ! empty( $_POST['tag-slug']        ) ? $_POST['tag-slug'] : '';
    17781778            $description = ! empty( $_POST['tag-description'] ) ? $_POST['tag-description'] : '';
    17791779            $tag         = wp_update_term( $tag_id, bbp_get_topic_tag_tax_id(), array(
     
    38523852                    <dc:creator><?php the_author(); ?></dc:creator>
    38533853
    3854                     <?php if ( !post_password_required() ) : ?>
     3854                    <?php if ( ! post_password_required() ) : ?>
    38553855
    38563856                    <description>
  • trunk/src/includes/topics/template.php

    r7352 r7357  
    418418            // Adjust loop and counts for new sticky positions
    419419            $query->found_posts = (int) $query->found_posts + (int) $sticky_count;
    420             $query->post_count  = (int) $query->post_count  + (int) $sticky_count;
     420            $query->post_count  = (int) $query->post_count + (int) $sticky_count;
    421421        }
    422422    }
  • trunk/src/includes/users/engagements.php

    r7098 r7357  
    957957            'post_type'      => $r['object_type'],
    958958            'posts_per_page' => -1,
    959             'meta_query'     => array( array(
    960                 'key'     => $r['rel_key'],
    961                 'value'   => $r['user_id'],
    962                 'compare' => 'NUMERIC'
    963             ),
    964 
    965             // Performance
    966             'nopaging'               => true,
    967             'suppress_filters'       => true,
    968             'update_post_term_cache' => false,
    969             'update_post_meta_cache' => false,
    970             'ignore_sticky_posts'    => true,
    971             'no_found_rows'          => true
    972         ) );
     959            'meta_query'     => array(
     960                array(
     961                    'key'     => $r['rel_key'],
     962                    'value'   => $r['user_id'],
     963                    'compare' => 'NUMERIC'
     964                ),
     965                // Performance
     966                'nopaging'               => true,
     967                'suppress_filters'       => true,
     968                'update_post_term_cache' => false,
     969                'update_post_meta_cache' => false,
     970                'ignore_sticky_posts'    => true,
     971                'no_found_rows'          => true
     972            )   
     973        );
    973974    }
    974975
  • trunk/src/templates/default/bbpress-functions.php

    r7190 r7357  
    241241        // Get user and topic data
    242242        $user_id = bbp_get_current_user_id();
    243         $id      = ! empty( $_POST['id']   ) ? intval( $_POST['id'] )         : 0;
     243        $id      = ! empty( $_POST['id']   ) ? intval( $_POST['id'] ) : 0;
    244244        $type    = ! empty( $_POST['type'] ) ? sanitize_key( $_POST['type'] ) : 'post';
    245245
     
    267267        $status = bbp_is_user_favorite( $user_id, $object->ID )
    268268            ? bbp_remove_user_favorite( $user_id, $object->ID )
    269             :    bbp_add_user_favorite( $user_id, $object->ID );
     269            : bbp_add_user_favorite( $user_id, $object->ID );
    270270
    271271        // Bail if action failed
     
    304304        // Get user and topic data
    305305        $user_id = bbp_get_current_user_id();
    306         $id      = ! empty( $_POST['id']   ) ? intval( $_POST['id'] )         : 0;
     306        $id      = ! empty( $_POST['id']   ) ? intval( $_POST['id'] ) : 0;
    307307        $type    = ! empty( $_POST['type'] ) ? sanitize_key( $_POST['type'] ) : 'post';
    308308
     
    330330        $status = bbp_is_user_subscribed( $user_id, $object->ID )
    331331            ? bbp_remove_user_subscription( $user_id, $object->ID )
    332             :    bbp_add_user_subscription( $user_id, $object->ID );
     332            : bbp_add_user_subscription( $user_id, $object->ID );
    333333
    334334        // Bail if action failed
     
    354354}
    355355new BBP_Default();
    356 endif;
     356
     357endif; // class_exists check
Note: See TracChangeset for help on using the changeset viewer.