Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/29/2024 08:15:44 PM (20 months ago)
Author:
imath
Message:

Deprecated functions: improve PHP code standards using WPCS

See #7228 (trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/deprecated/12.0.php

    r13775 r13824  
    626626    $user_groups = bp_displayed_user_url() . bp_get_groups_slug(); ?>
    627627
    628     <li<?php if ( !bp_action_variable( 0 ) || bp_is_action_variable( 'recently-active', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $user_groups . '/my-groups/recently-active' ); ?>"><?php _e( 'Recently Active', 'buddypress' ); ?></a></li>
    629     <li<?php if ( bp_is_action_variable( 'recently-joined', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $user_groups . '/my-groups/recently-joined' ); ?>"><?php _e( 'Recently Joined',  'buddypress' ); ?></a></li>
    630     <li<?php if ( bp_is_action_variable( 'most-popular',    0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $user_groups . '/my-groups/most-popular'    ); ?>"><?php _e( 'Most Popular',     'buddypress' ); ?></a></li>
    631     <li<?php if ( bp_is_action_variable( 'admin-of',        0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $user_groups . '/my-groups/admin-of'        ); ?>"><?php _e( 'Administrator Of', 'buddypress' ); ?></a></li>
    632     <li<?php if ( bp_is_action_variable( 'mod-of',          0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $user_groups . '/my-groups/mod-of'          ); ?>"><?php _e( 'Moderator Of',     'buddypress' ); ?></a></li>
    633     <li<?php if ( bp_is_action_variable( 'alphabetically'     ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $user_groups . '/my-groups/alphabetically'  ); ?>"><?php _e( 'Alphabetically',   'buddypress' ); ?></a></li>
     628    <li<?php if ( !bp_action_variable( 0 ) || bp_is_action_variable( 'recently-active', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/recently-active' ) ); ?>"><?php esc_html_e( 'Recently Active', 'buddypress' ); ?></a></li>
     629    <li<?php if ( bp_is_action_variable( 'recently-joined', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/recently-joined' ) ); ?>"><?php esc_html_e( 'Recently Joined',  'buddypress' ); ?></a></li>
     630    <li<?php if ( bp_is_action_variable( 'most-popular',    0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/most-popular'    ) ); ?>"><?php esc_html_e( 'Most Popular',     'buddypress' ); ?></a></li>
     631    <li<?php if ( bp_is_action_variable( 'admin-of',        0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/admin-of'        ) ); ?>"><?php esc_html_e( 'Administrator Of', 'buddypress' ); ?></a></li>
     632    <li<?php if ( bp_is_action_variable( 'mod-of',          0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/mod-of'          ) ); ?>"><?php esc_html_e( 'Moderator Of',     'buddypress' ); ?></a></li>
     633    <li<?php if ( bp_is_action_variable( 'alphabetically'     ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo esc_url( trailingslashit( $user_groups . '/my-groups/alphabetically'  ) ); ?>"><?php esc_html_e( 'Alphabetically',   'buddypress' ); ?></a></li>
    634634
    635635<?php
     
    664664                <?php
    665665                /* translators: %s: the User Display Name */
    666                 printf( esc_html__( "%s's Sites", 'buddypress' ), bp_get_displayed_user_fullname() );
     666                printf( esc_html__( "%s's Sites", 'buddypress' ), esc_html( bp_get_displayed_user_fullname() ) );
    667667                ?>
    668668            </a>
     
    672672                <?php
    673673                /* translators: %s: the User Display Name */
    674                 printf( esc_html__( "%s's Recent Posts", 'buddypress' ), bp_get_displayed_user_fullname() );
     674                printf( esc_html__( "%s's Recent Posts", 'buddypress' ), esc_html( bp_get_displayed_user_fullname() ) );
    675675                ?>
    676676            </a>
     
    680680                <?php
    681681                /* translators: %s: the User Display Name */
    682                 printf( esc_html__( "%s's Recent Comments", 'buddypress' ), bp_get_displayed_user_fullname() );
     682                printf( esc_html__( "%s's Recent Comments", 'buddypress' ), esc_html( bp_get_displayed_user_fullname() ) );
    683683                ?>
    684684            </a>
     
    977977
    978978                <?php
    979                 /* translators: %s: member name */
     979                // phpcs:ignore WordPress.Security.EscapeOutput
    980980                echo bp_core_fetch_avatar(
    981981                    array(
     
    994994
    995995                <h5>
    996                     <?php echo bp_core_get_userlink( $mod->user_id ); ?>
     996                    <?php
     997                    // phpcs:ignore WordPress.Security.EscapeOutput
     998                    echo bp_core_get_userlink( $mod->user_id );
     999                    ?>
    9971000
    9981001                    <span class="small">
    999                         <a href="<?php bp_group_member_promote_admin_link( array( 'user_id' => $mod->user_id ) ) ?>" class="button confirm mod-promote-to-admin"><?php _e( 'Promote to Admin', 'buddypress' ); ?></a>
    1000                         <a class="button confirm mod-demote-to-member" href="<?php bp_group_member_demote_link($mod->user_id) ?>"><?php _e( 'Demote to Member', 'buddypress' ) ?></a>
     1002                        <a href="<?php bp_group_member_promote_admin_link( array( 'user_id' => $mod->user_id ) ) ?>" class="button confirm mod-promote-to-admin"><?php esc_html_e( 'Promote to Admin', 'buddypress' ); ?></a>
     1003                        <a class="button confirm mod-demote-to-member" href="<?php bp_group_member_demote_link($mod->user_id) ?>"><?php esc_html_e( 'Demote to Member', 'buddypress' ) ?></a>
    10011004                    </span>
    10021005                </h5>
     
    10081011
    10091012                <?php
     1013                // phpcs:ignore WordPress.Security.EscapeOutput
    10101014                echo bp_core_fetch_avatar(
    10111015                    array(
     
    10211025                ?>
    10221026
    1023                 <h5><?php echo bp_core_get_userlink( $mod->user_id ) ?></h5>
     1027                <h5>
     1028                    <?php
     1029                    // phpcs:ignore WordPress.Security.EscapeOutput
     1030                    echo bp_core_get_userlink( $mod->user_id );
     1031                    ?>
     1032                </h5>
    10241033
    10251034                <span class="activity">
    10261035                    <?php
    10271036                    /* translators: %s: human time diff */
    1028                     echo bp_core_get_last_activity( strtotime( $mod->date_modified ), __( 'joined %s', 'buddypress') );
     1037                    echo esc_html( bp_core_get_last_activity( strtotime( $mod->date_modified ), esc_html__( 'joined %s', 'buddypress' ) ) );
    10291038                    ?>
    10301039                </span>
     
    10481057
    10491058        <div id="message" class="info">
    1050             <p><?php _e( 'This group has no moderators', 'buddypress' ); ?></p>
     1059            <p><?php esc_html_e( 'This group has no moderators', 'buddypress' ); ?></p>
    10511060        </div>
    10521061
     
    10621071function bp_activities_title() {
    10631072    _deprecated_function( __FUNCTION__, '12.0.0' );
    1064     echo bp_get_activities_title();
     1073    echo esc_html( bp_get_activities_title() );
    10651074}
    10661075
     
    10981107function bp_activities_no_activity() {
    10991108    _deprecated_function( __FUNCTION__, '12.0.0' );
    1100     echo bp_get_activities_no_activity();
     1109    echo esc_html( bp_get_activities_no_activity() );
    11011110}
    11021111
     
    11411150    }
    11421151
    1143     echo apply_filters_deprecated( 'bp_get_options_title', array( esc_attr( $bp->bp_options_title ) ), '12.0.0' );
     1152    echo esc_html( apply_filters_deprecated( 'bp_get_options_title', array( esc_attr( $bp->bp_options_title ) ), '12.0.0' ) );
    11441153}
    11451154
     
    11661175function bp_get_options_avatar() {
    11671176    _deprecated_function( __FUNCTION__, '12.0.0' );
     1177    // phpcs:ignore WordPress.Security.EscapeOutput
    11681178    echo apply_filters_deprecated( 'bp_get_options_avatar', array( buddypress()->bp_options_avatar ), '12.0.0' );
    11691179}
     
    11781188    global $comment;
    11791189
     1190    // phpcs:ignore WordPress.Security.EscapeOutput
    11801191    echo apply_filters_deprecated(
    11811192        'bp_comment_author_avatar',
     
    12061217    global $post;
    12071218
     1219    // phpcs:ignore WordPress.Security.EscapeOutput
    12081220    echo apply_filters_deprecated(
    12091221        'bp_post_author_avatar',
     
    12801292function bp_blog_signup_allowed() {
    12811293    _deprecated_function( __FUNCTION__, '12.0.0' );
     1294    // phpcs:ignore WordPress.Security.EscapeOutput
    12821295    echo bp_get_blog_signup_allowed();
    12831296}
     
    13051318            ?>
    13061319            &nbsp;
    1307             (<?php echo BP_Friends_Friendship::total_friend_count( bp_displayed_user_id() ); ?>)
     1320            (<?php echo esc_html( BP_Friends_Friendship::total_friend_count( bp_displayed_user_id() ) ); ?>)
    13081321            &nbsp;
    13091322            <span>
     
    13211334
    13221335                <li>
    1323                     <a href="<?php echo bp_members_get_user_url( $friend_ids[$i] ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $friend_ids[$i], 'type' => 'thumb' ) ) ?></a>
    1324                     <h5><?php echo bp_core_get_userlink($friend_ids[$i]) ?></h5>
     1336                    <a href="<?php echo esc_url( bp_members_get_user_url( $friend_ids[$i] ) ); ?>">
     1337                        <?php
     1338                        // phpcs:ignore WordPress.Security.EscapeOutput
     1339                        echo bp_core_fetch_avatar( array( 'item_id' => $friend_ids[$i], 'type' => 'thumb' ) );
     1340                        ?>
     1341                    </a>
     1342                    <h5>
     1343                        <?php
     1344                        // phpcs:ignore WordPress.Security.EscapeOutput
     1345                        echo bp_core_get_userlink($friend_ids[$i]);
     1346                        ?>
     1347                    </h5>
    13251348                </li>
    13261349
     
    13741397
    13751398            <li>
    1376                 <a href="<?php echo bp_members_get_user_url( $user_ids['users'][$i]->id ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $user_ids['users'][$i]->id, 'type' => 'thumb' ) ) ?></a>
    1377                 <h5><?php echo bp_core_get_userlink( $user_ids['users'][$i]->id ) ?></h5>
     1399                <a href="<?php echo esc_url( bp_members_get_user_url( $user_ids['users'][$i]->id ) ); ?>">
     1400                    <?php
     1401                    // phpcs:ignore WordPress.Security.EscapeOutput
     1402                    echo bp_core_fetch_avatar( array( 'item_id' => $user_ids['users'][$i]->id, 'type' => 'thumb' ) );
     1403                    ?>
     1404                </a>
     1405                <h5>
     1406                    <?php
     1407                    // phpcs:ignore WordPress.Security.EscapeOutput
     1408                    echo bp_core_get_userlink( $user_ids['users'][$i]->id );
     1409                    ?>
     1410                </h5>
    13781411
    13791412                <?php if ( bp_is_active( 'xprofile' ) ) { ?>
     
    13821415
    13831416                    <div class="profile-data">
    1384                         <p class="field-name"><?php echo $random_data[0]->name ?></p>
    1385 
    1386                         <?php echo $random_data[0]->value ?>
     1417                        <p class="field-name"><?php echo esc_html( $random_data[0]->name ); ?></p>
     1418
     1419                        <?php echo esc_html( $random_data[0]->value ); ?>
    13871420
    13881421                    </div>
     
    14081441
    14091442        <div id="message" class="info">
    1410             <p><?php _e( "There aren't enough site members to show a random sample just yet.", 'buddypress' ) ?></p>
     1443            <p><?php esc_html_e( "There aren't enough site members to show a random sample just yet.", 'buddypress' ) ?></p>
    14111444        </div>
    14121445
     
    15061539        </form>';
    15071540
     1541    // phpcs:ignore WordPress.Security.EscapeOutput
    15081542    echo apply_filters( 'bp_group_search_form', $search_form_html );
    15091543}
     
    15591593    switch ( $current_filter ) {
    15601594        case 'recently-active': default:
    1561             _e( 'Recently Active', 'buddypress' );
     1595            esc_html_e( 'Recently Active', 'buddypress' );
    15621596            break;
    15631597        case 'recently-joined':
    1564             _e( 'Recently Joined', 'buddypress' );
     1598            esc_html_e( 'Recently Joined', 'buddypress' );
    15651599            break;
    15661600        case 'most-popular':
    1567             _e( 'Most Popular', 'buddypress' );
     1601            esc_html_e( 'Most Popular', 'buddypress' );
    15681602            break;
    15691603        case 'admin-of':
    1570             _e( 'Administrator Of', 'buddypress' );
     1604            esc_html_e( 'Administrator Of', 'buddypress' );
    15711605            break;
    15721606        case 'mod-of':
    1573             _e( 'Moderator Of', 'buddypress' );
     1607            esc_html_e( 'Moderator Of', 'buddypress' );
    15741608            break;
    15751609        case 'alphabetically':
    1576             _e( 'Alphabetically', 'buddypress' );
     1610            esc_html_e( 'Alphabetically', 'buddypress' );
    15771611        break;
    15781612    }
Note: See TracChangeset for help on using the changeset viewer.