Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/27/2024 05:51:41 PM (9 months ago)
Author:
imath
Message:

Activity component: improve PHP code standards using WPCS

See #7228 (trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-template.php

    r13757 r13816  
    1818 */
    1919function bp_activity_slug() {
    20     echo bp_get_activity_slug();
     20    echo esc_url( bp_get_activity_slug() );
    2121}
    2222    /**
     
    4747 */
    4848function bp_activity_root_slug() {
    49     echo bp_get_activity_root_slug();
     49    echo esc_url( bp_get_activity_root_slug() );
    5050}
    5151    /**
     
    458458 */
    459459function bp_activity_pagination_count() {
    460     echo bp_get_activity_pagination_count();
     460    echo esc_html( bp_get_activity_pagination_count() );
    461461}
    462462
     
    495495 */
    496496function bp_activity_pagination_links() {
     497    // Escaping is done in WordPress's `paginate_links()` function.
     498    // phpcs:ignore WordPress.Security.EscapeOutput
    497499    echo bp_get_activity_pagination_links();
    498500}
     
    561563 */
    562564function bp_activity_count() {
    563     echo bp_get_activity_count();
     565    echo intval( bp_get_activity_count() );
    564566}
    565567
     
    593595 */
    594596function bp_activity_per_page() {
    595     echo bp_get_activity_per_page();
     597    echo intval( bp_get_activity_per_page() );
    596598}
    597599
     
    625627 */
    626628function bp_activity_id() {
    627     echo bp_get_activity_id();
     629    echo intval( bp_get_activity_id() );
    628630}
    629631
     
    657659 */
    658660function bp_activity_item_id() {
    659     echo bp_get_activity_item_id();
     661    echo intval( bp_get_activity_item_id() );
    660662}
    661663
     
    689691 */
    690692function bp_activity_secondary_item_id() {
    691     echo bp_get_activity_secondary_item_id();
     693    echo intval( bp_get_activity_secondary_item_id() );
    692694}
    693695
     
    721723 */
    722724function bp_activity_date_recorded() {
    723     echo bp_get_activity_date_recorded();
     725    echo esc_html( bp_get_activity_date_recorded() );
    724726}
    725727
     
    753755 */
    754756function bp_activity_member_display_name() {
    755     echo bp_get_activity_member_display_name();
     757    echo esc_html( bp_get_activity_member_display_name() );
    756758}
    757759
     
    789791 */
    790792function bp_activity_object_name() {
    791     echo bp_get_activity_object_name();
     793    echo esc_html( bp_get_activity_object_name() );
    792794}
    793795
     
    821823 */
    822824function bp_activity_type() {
    823     echo bp_get_activity_type();
     825    echo esc_html( bp_get_activity_type() );
    824826}
    825827
     
    878880     *
    879881     */
    880     function bp_activity_action_name() { echo bp_activity_type(); }
     882    function bp_activity_action_name() { bp_activity_type(); }
    881883
    882884    /**
     
    902904 */
    903905function bp_activity_user_id() {
    904     echo bp_get_activity_user_id();
     906    echo intval( bp_get_activity_user_id() );
    905907}
    906908
     
    934936 */
    935937function bp_activity_user_link() {
    936     echo bp_get_activity_user_link();
     938    echo esc_url( bp_get_activity_user_link() );
    937939}
    938940
     
    975977 */
    976978function bp_activity_avatar( $args = '' ) {
     979    // phpcs:ignore WordPress.Security.EscapeOutput
    977980    echo bp_get_activity_avatar( $args );
    978981}
     
    10161019
    10171020        // Prepend some descriptive text to alt.
    1018         $alt_default = __( 'Profile picture', 'buddypress' );
     1021        $alt_default = esc_html__( 'Profile picture', 'buddypress' );
    10191022        if ( ! empty( $dn_default ) ) {
    10201023            /* translators: %s: member name */
    1021             $alt_default = sprintf( __( 'Profile picture of %s', 'buddypress' ), $dn_default );
     1024            $alt_default = sprintf( esc_html__( 'Profile picture of %s', 'buddypress' ), $dn_default );
    10221025        }
    10231026
     
    10351038        );
    10361039
    1037         extract( $r, EXTR_SKIP );
    1038 
    1039         if ( !isset( $height ) && !isset( $width ) ) {
     1040        if ( ! isset( $r['height'] ) && ! isset( $r['width'] ) ) {
    10401041
    10411042            // Backpat.
    10421043            if ( isset( $bp->avatar->full->height ) || isset( $bp->avatar->thumb->height ) ) {
    1043                 $height = ( 'full' == $type ) ? $bp->avatar->full->height : $bp->avatar->thumb->height;
     1044                $r['height'] = ( 'full' == $r['type'] ) ? $bp->avatar->full->height : $bp->avatar->thumb->height;
    10441045            } else {
    1045                 $height = 20;
     1046                $r['height'] = 20;
    10461047            }
    10471048
    10481049            // Backpat.
    10491050            if ( isset( $bp->avatar->full->width ) || isset( $bp->avatar->thumb->width ) ) {
    1050                 $width = ( 'full' == $type ) ? $bp->avatar->full->width : $bp->avatar->thumb->width;
     1051                $r['width'] = ( 'full' == $r['type'] ) ? $bp->avatar->full->width : $bp->avatar->thumb->width;
    10511052            } else {
    1052                 $width = 20;
     1053                $r['width'] = 20;
    10531054            }
    10541055        }
     
    10661067         */
    10671068        $object  = apply_filters( 'bp_get_activity_avatar_object_' . $current_activity_item->component, 'user' );
    1068         $item_id = !empty( $user_id ) ? $user_id : $current_activity_item->user_id;
     1069        $item_id = $current_activity_item->user_id;
     1070
     1071        if ( ! empty( $r['user_id'] ) ) {
     1072            $item_id = (int) $r['user_id'];
     1073        }
    10691074
    10701075        /**
     
    10781083
    10791084        // If this is a user object pass the users' email address for Gravatar so we don't have to prefetch it.
    1080         if ( 'user' == $object && empty( $user_id ) && empty( $email ) && isset( $current_activity_item->user_email ) ) {
    1081             $email = $current_activity_item->user_email;
     1085        if ( 'user' == $object && empty( $r['user_id'] ) && empty( $r['email'] ) && isset( $current_activity_item->user_email ) ) {
     1086            $r['email'] = $current_activity_item->user_email;
    10821087        }
    10831088
     
    10891094         * @param array $value HTML image element containing the activity avatar.
    10901095         */
    1091         return apply_filters( 'bp_get_activity_avatar', bp_core_fetch_avatar( array(
    1092             'item_id' => $item_id,
    1093             'object'  => $object,
    1094             'type'    => $type,
    1095             'alt'     => $alt,
    1096             'class'   => $class,
    1097             'width'   => $width,
    1098             'height'  => $height,
    1099             'email'   => $email
    1100         ) ) );
     1096        return apply_filters( 'bp_get_activity_avatar',
     1097            bp_core_fetch_avatar(
     1098                array(
     1099                    'item_id' => $item_id,
     1100                    'object'  => $object,
     1101                    'type'    => $r['type'],
     1102                    'alt'     => $r['alt'],
     1103                    'class'   => $r['class'],
     1104                    'width'   => $r['width'],
     1105                    'height'  => $r['height'],
     1106                    'email'   => $r['email'],
     1107                )
     1108            )
     1109        );
    11011110    }
    11021111
     
    11111120 */
    11121121function bp_activity_secondary_avatar( $args = '' ) {
     1122    // phpcs:ignore WordPress.Security.EscapeOutput
    11131123    echo bp_get_activity_secondary_avatar( $args );
    11141124}
     
    11511161        );
    11521162
    1153         extract( $r, EXTR_SKIP );
    1154 
    11551163        // Set item_id and object (default to user).
    11561164        switch ( $activities_template->activity->component ) {
     
    11721180                }
    11731181
    1174                 if ( empty( $alt ) ) {
    1175                     $alt = __( 'Group logo', 'buddypress' );
     1182                if ( empty( $r['alt'] ) ) {
     1183                    $r['alt'] = esc_html__( 'Group logo', 'buddypress' );
    11761184
    11771185                    if ( ! empty( $name ) ) {
    11781186                        /* translators: %s: the Group name */
    1179                         $alt = sprintf( __( 'Group logo of %s', 'buddypress' ), $name );
     1187                        $r['alt'] = sprintf( esc_html__( 'Group logo of %s', 'buddypress' ), $name );
    11801188                    }
    11811189                }
     
    11871195                $link    = home_url();
    11881196
    1189                 if ( empty( $alt ) ) {
     1197                if ( empty( $r['alt'] ) ) {
    11901198                    /* translators: %s: the blog name */
    1191                     $alt = sprintf( __( 'Profile picture of the author of the site %s', 'buddypress' ), get_blog_option( $item_id, 'blogname' ) );
     1199                    $r['alt'] = sprintf( esc_html__( 'Profile picture of the author of the site %s', 'buddypress' ), esc_html( get_blog_option( $item_id, 'blogname' ) ) );
    11921200                }
    11931201
     
    11981206                $link    = bp_core_get_userlink( $item_id, false, true );
    11991207
    1200                 if ( empty( $alt ) ) {
     1208                if ( empty( $r['alt'] ) ) {
    12011209                    /* translators: %s: member name */
    1202                     $alt = sprintf( __( 'Profile picture of %s', 'buddypress' ), bp_core_get_user_displayname( $activities_template->activity->secondary_item_id ) );
     1210                    $r['alt'] = sprintf( esc_html__( 'Profile picture of %s', 'buddypress' ), bp_core_get_user_displayname( $activities_template->activity->secondary_item_id ) );
    12031211                }
    12041212
    12051213                break;
    12061214            default :
    1207                 $object  = 'user';
    1208                 $item_id = $activities_template->activity->user_id;
    1209                 $email  = $activities_template->activity->user_email;
    1210                 $link    = bp_core_get_userlink( $item_id, false, true );
    1211 
    1212                 if ( empty( $alt ) ) {
     1215                $object     = 'user';
     1216                $item_id    = $activities_template->activity->user_id;
     1217                $r['email'] = $activities_template->activity->user_email;
     1218                $link       = bp_core_get_userlink( $item_id, false, true );
     1219
     1220                if ( empty( $r['alt'] ) ) {
    12131221                    /* translators: %s: member name */
    1214                     $alt = sprintf( __( 'Profile picture of %s', 'buddypress' ), $activities_template->activity->display_name );
     1222                    $r['alt'] = sprintf( esc_html__( 'Profile picture of %s', 'buddypress' ), esc_html( $activities_template->activity->display_name ) );
    12151223                }
    12161224
     
    12291237         * @param string $object Component being displayed.
    12301238         */
    1231         $object  = apply_filters( 'bp_get_activity_secondary_avatar_object_' . $activities_template->activity->component, $object );
     1239        $object = apply_filters( 'bp_get_activity_secondary_avatar_object_' . $activities_template->activity->component, $object );
    12321240
    12331241        /**
     
    12461254
    12471255        // Get the avatar.
    1248         $avatar = bp_core_fetch_avatar( array(
    1249             'item_id' => $item_id,
    1250             'object'  => $object,
    1251             'type'    => $type,
    1252             'alt'     => $alt,
    1253             'class'   => $class,
    1254             'width'   => $width,
    1255             'height'  => $height,
    1256             'email'   => $email
    1257         ) );
    1258 
    1259         if ( !empty( $linked ) ) {
     1256        $avatar = bp_core_fetch_avatar(
     1257            array(
     1258                'item_id' => $item_id,
     1259                'object'  => $object,
     1260                'type'    => $r['type'],
     1261                'alt'     => $r['alt'],
     1262                'class'   => $r['class'],
     1263                'width'   => $r['width'],
     1264                'height'  => $r['height'],
     1265                'email'   => $r['email'],
     1266            )
     1267        );
     1268
     1269        if ( ! empty( $r['linked'] ) ) {
    12601270
    12611271            /**
     
    12791289
    12801290            return sprintf( '<a href="%s" class="%s">%s</a>',
    1281                 $link,
    1282                 $link_class,
     1291                esc_url( $link ),
     1292                esc_attr( $r['link_class'] ),
    12831293                $avatar
    12841294            );
     
    12971307 */
    12981308function bp_activity_action( $args = array() ) {
    1299     echo bp_get_activity_action( $args );
     1309    echo wp_kses(
     1310        bp_get_activity_action( $args ),
     1311        array(
     1312            'p'    => true,
     1313            'a'    => array(
     1314                'href'            => true,
     1315                'class'           => true,
     1316                'data-bp-tooltip' => true,
     1317            ),
     1318            'span' => array(
     1319                'class' => true,
     1320            ),
     1321            'img'  => array(
     1322                'src'     => true,
     1323                'loading' => true,
     1324                'class'   => true,
     1325                'alt'     => true,
     1326                'height'  => true,
     1327                'width'   => true,
     1328            ),
     1329        )
     1330    );
    13001331}
    13011332
     
    13631394 */
    13641395function bp_activity_content_body() {
     1396    // Escaping is made in `bp-activity/bp-activity-filters.php`.
     1397    // phpcs:ignore WordPress.Security.EscapeOutput
    13651398    echo bp_get_activity_content_body();
    13661399}
     
    16081641 */
    16091642function bp_activity_generated_content_part( $property = '' ) {
     1643    // phpcs:ignore WordPress.Security.EscapeOutput
    16101644    echo bp_activity_get_generated_content_part( $property );
    16111645}
     
    16641698 */
    16651699function bp_activity_content() {
     1700    // Escaping is made in `bp-activity/bp-activity-filters.php`.
     1701    // phpcs:ignore WordPress.Security.EscapeOutput
    16661702    echo bp_get_activity_content();
    16671703}
     
    18421878 */
    18431879function bp_activity_parent_content( $args = '' ) {
    1844     echo bp_get_activity_parent_content($args);
     1880    // Escaping is made in `bp-activity/bp-activity-filters.php`.
     1881    // phpcs:ignore WordPress.Security.EscapeOutput
     1882    echo bp_get_activity_parent_content( $args );
    18451883}
    18461884
     
    19061944 */
    19071945function bp_activity_parent_user_id() {
    1908     echo bp_get_activity_parent_user_id();
     1946    echo intval( bp_get_activity_parent_user_id() );
    19091947}
    19101948
     
    19591997 */
    19601998function bp_activity_is_favorite() {
     1999    // phpcs:ignore WordPress.Security.EscapeOutput
    19612000    echo bp_get_activity_is_favorite();
    19622001}
     
    19992038            sprintf(
    20002039                /* translators: 1: the name of the function. 2: the name of the file. */
    2001                 __( '%1$s no longer accepts arguments. See the inline documentation at %2$s for more details.', 'buddypress' ),
     2040                esc_html__( '%1$s no longer accepts arguments. See the inline documentation at %2$s for more details.', 'buddypress' ),
    20022041                __FUNCTION__,
    20032042                __FILE__
     
    20062045    }
    20072046
     2047    // phpcs:ignore WordPress.Security.EscapeOutput
    20082048    echo bp_activity_get_comments();
    20092049}
     
    20322072                sprintf(
    20332073                    /* translators: 1: the name of the function. 2: the name of the file. */
    2034                     __( '%1$s no longer accepts arguments. See the inline documentation at %2$s for more details.', 'buddypress' ),
     2074                    esc_html__( '%1$s no longer accepts arguments. See the inline documentation at %2$s for more details.', 'buddypress' ),
    20352075                    __FUNCTION__,
    20362076                    __FILE__
     
    20702110            }
    20712111
    2072             /**
    2073              * Filters the opening tag for the template that lists activity comments.
    2074              *
    2075              * @since 1.6.0
    2076              *
    2077              * @param string $value Opening tag for the HTML markup to use.
    2078              */
    2079             echo apply_filters( 'bp_activity_recurse_comments_start_ul', '<ul>' );
     2112            // phpcs:ignore WordPress.Security.EscapeOutput
     2113            echo apply_filters(
     2114                /**
     2115                 * Filters the opening tag for the template that lists activity comments.
     2116                 *
     2117                 * @since 1.6.0
     2118                 *
     2119                 * @param string $value Opening tag for the HTML markup to use.
     2120                 */
     2121                'bp_activity_recurse_comments_start_ul',
     2122                '<ul>'
     2123            );
     2124
    20802125            foreach ( (array) $comment->children as $comment_child ) {
    20812126
     
    21082153            }
    21092154
    2110             /**
    2111              * Filters the closing tag for the template that list activity comments.
    2112              *
    2113              * @since  1.6.0
    2114              *
    2115              * @param string $value Closing tag for the HTML markup to use.
    2116              */
    2117             echo apply_filters( 'bp_activity_recurse_comments_end_ul', '</ul>' );
     2155            // phpcs:ignore WordPress.Security.EscapeOutput
     2156            echo apply_filters(
     2157                /**
     2158                 * Filters the closing tag for the template that list activity comments.
     2159                 *
     2160                 * @since  1.6.0
     2161                 *
     2162                 * @param string $value Closing tag for the HTML markup to use.
     2163                 */
     2164                'bp_activity_recurse_comments_end_ul',
     2165                '</ul>'
     2166            );
    21182167        }
    21192168
     
    21532202 */
    21542203function bp_activity_comment_id() {
    2155     echo bp_get_activity_comment_id();
     2204    echo intval( bp_get_activity_comment_id() );
    21562205}
    21572206
     
    21882237 */
    21892238function bp_activity_comment_user_id() {
    2190     echo bp_get_activity_comment_user_id();
     2239    echo intval( bp_get_activity_comment_user_id() );
    21912240}
    21922241
     
    22232272 */
    22242273function bp_activity_comment_user_link() {
    2225     echo bp_get_activity_comment_user_link();
     2274    echo esc_url( bp_get_activity_comment_user_link() );
    22262275}
    22272276
     
    22542303 */
    22552304function bp_activity_comment_name() {
    2256     echo bp_get_activity_comment_name();
     2305    echo esc_html( bp_get_activity_comment_name() );
    22572306}
    22582307
     
    22962345 */
    22972346function bp_activity_comment_date_recorded() {
    2298     echo bp_get_activity_comment_date_recorded();
     2347    echo esc_html( bp_get_activity_comment_date_recorded() );
    22992348}
    23002349
     
    23272376 */
    23282377function bp_activity_comment_date_recorded_raw() {
    2329     echo bp_get_activity_comment_date_recorded_raw();
     2378    echo esc_html( bp_get_activity_comment_date_recorded_raw() );
    23302379}
    23312380
     
    23602409 */
    23612410function bp_activity_comment_delete_link() {
    2362     echo bp_get_activity_comment_delete_link();
     2411    echo esc_url( bp_get_activity_comment_delete_link() );
    23632412}
    23642413
     
    23992448 */
    24002449function bp_activity_comment_content() {
     2450    // Escaping is made in `bp-activity/bp-activity-filters.php`.
     2451    // phpcs:ignore WordPress.Security.EscapeOutput
    24012452    echo bp_get_activity_comment_content();
    24022453}
     
    24412492 */
    24422493function bp_activity_comment_count() {
    2443     echo bp_activity_get_comment_count();
     2494    echo intval( bp_activity_get_comment_count() );
    24442495}
    24452496
     
    24642515                sprintf(
    24652516                    /* translators: 1: the name of the function. 2: the name of the file. */
    2466                     __( '%1$s no longer accepts arguments. See the inline documentation at %2$s for more details.', 'buddypress' ),
     2517                    esc_html__( '%1$s no longer accepts arguments. See the inline documentation at %2$s for more details.', 'buddypress' ),
    24672518                    __FUNCTION__,
    24682519                    __FILE__
     
    25342585 */
    25352586function bp_activity_comment_depth( $comment = 0 ) {
    2536     echo bp_activity_get_comment_depth( $comment );
     2587    echo intval( bp_activity_get_comment_depth( $comment ) );
    25372588}
    25382589
     
    26012652 */
    26022653function bp_activity_comment_link() {
    2603     echo bp_get_activity_comment_link();
     2654    echo esc_url( bp_get_activity_comment_link() );
    26042655}
    26052656
     
    26482699 */
    26492700function bp_activity_comment_form_nojs_display() {
     2701    // phpcs:ignore WordPress.Security.EscapeOutput
    26502702    echo bp_get_activity_comment_form_nojs_display();
    26512703}
     
    27522804 */
    27532805function bp_activity_permalink_id() {
    2754     echo bp_get_activity_permalink_id();
     2806    echo esc_html( bp_get_activity_permalink_id() );
    27552807}
    27562808
     
    28532905 */
    28542906function bp_activity_favorite_link() {
    2855     echo bp_get_activity_favorite_link();
     2907    echo esc_url( bp_get_activity_favorite_link() );
    28562908}
    28572909
     
    28952947 */
    28962948function bp_activity_unfavorite_link() {
    2897     echo bp_get_activity_unfavorite_link();
     2949    echo esc_url( bp_get_activity_unfavorite_link() );
    28982950}
    28992951
     
    29372989 */
    29382990function bp_activity_css_class() {
    2939     echo bp_get_activity_css_class();
     2991    echo esc_attr( bp_get_activity_css_class() );
    29402992}
    29412993
     
    29953047 */
    29963048function bp_activity_delete_link() {
     3049    // phpcs:ignore WordPress.Security.EscapeOutput
    29973050    echo bp_get_activity_delete_link();
    29983051}
     
    30203073        }
    30213074
    3022         $link = '<a href="' . esc_url( $url ) . '" class="button item-button bp-secondary-action ' . $class . ' confirm" rel="nofollow">' . __( 'Delete', 'buddypress' ) . '</a>';
     3075        $link = '<a href="' . esc_url( $url ) . '" class="button item-button bp-secondary-action ' . esc_attr( $class ) . ' confirm" rel="nofollow">' . esc_html__( 'Delete', 'buddypress' ) . '</a>';
    30233076
    30243077        /**
     
    30963149 */
    30973150function bp_activity_latest_update( $user_id = 0 ) {
     3151    // Escaping is made in `bp-activity/bp-activity-filters.php`.
     3152    // phpcs:ignore WordPress.Security.EscapeOutput
    30983153    echo bp_get_activity_latest_update( $user_id );
    30993154}
     
    31633218 */
    31643219function bp_activity_filter_links( $args = false ) {
     3220    // phpcs:ignore WordPress.Security.EscapeOutput
    31653221    echo bp_get_activity_filter_links( $args );
    31663222}
     
    32013257
    32023258            // Skip the activity comment filter.
    3203             if ( 'activity' == $component ) {
     3259            if ( 'activity' === $component ) {
    32043260                continue;
    32053261            }
    32063262
    3207             if ( isset( $_GET['afilter'] ) && $component == $_GET['afilter'] ) {
     3263            if ( isset( $_GET['afilter'] ) && $component === $_GET['afilter'] ) {
    32083264                $selected = ' class="selected"';
    32093265            } else {
     
    32503306
    32513307        if ( isset( $_GET['afilter'] ) ) {
    3252             $component_links[] = '<' . $tag . ' id="afilter-clear"><a href="' . esc_url( $link ) . '">' . __( 'Clear Filter', 'buddypress' ) . '</a></' . $tag . '>';
     3308            $component_links[] = '<' . $tag . ' id="afilter-clear"><a href="' . esc_url( $link ) . '">' . esc_html__( 'Clear Filter', 'buddypress' ) . '</a></' . $tag . '>';
    32533309        }
    32543310
     
    33783434 */
    33793435function bp_total_favorite_count_for_user( $user_id = 0 ) {
    3380     echo bp_get_total_favorite_count_for_user( $user_id );
     3436    echo intval( bp_get_total_favorite_count_for_user( $user_id ) );
    33813437}
    33823438
     
    34283484 */
    34293485function bp_total_mention_count_for_user( $user_id = 0 ) {
    3430     echo bp_get_total_mention_count_for_user( $user_id );
     3486    echo intval( bp_get_total_mention_count_for_user( $user_id ) );
    34313487}
    34323488
     
    35403596 */
    35413597function bp_mentioned_user_display_name( $user_id_or_username = false ) {
     3598    // phpcs:ignore WordPress.Security.EscapeOutput
    35423599    echo bp_get_mentioned_user_display_name( $user_id_or_username );
    35433600}
     
    35593616        // If user somehow has no name, return this really lame string.
    35603617        if ( empty( $name ) ) {
    3561             $name = __( 'a user', 'buddypress' );
     3618            $name = esc_html__( 'a user', 'buddypress' );
    35623619        }
    35633620
     
    35833640 */
    35843641function bp_send_public_message_button( $args = '' ) {
     3642    // Escaping is done in `BP_Core_HTML_Element()`.
     3643    // phpcs:ignore WordPress.Security.EscapeOutput
    35853644    echo bp_get_send_public_message_button( $args );
    35863645}
     
    36623721 */
    36633722function bp_activity_post_form_action() {
    3664     echo bp_get_activity_post_form_action();
     3723    echo esc_url( bp_get_activity_post_form_action() );
    36653724}
    36663725
     
    37343793
    37353794            // Get avatar for this user.
    3736             $image_html   = bp_core_fetch_avatar( array(
    3737                 'item_id' => $user_id,
    3738                 'height'  => $r['height'],
    3739                 'html'    => $r['html'],
    3740                 'type'    => $r['type'],
    3741                 'width'   => $r['width']
    3742             ) );
     3795            $image_html = bp_core_fetch_avatar(
     3796                array(
     3797                    'item_id' => $user_id,
     3798                    'height'  => $r['height'],
     3799                    'html'    => $r['html'],
     3800                    'type'    => $r['type'],
     3801                    'width'   => $r['width']
     3802                )
     3803            );
    37433804
    37443805            // If user has link & avatar, add them to the output array.
     
    37543815    }
    37553816
    3756     /**
    3757      * Filters the list of linked avatars for users who have commented on the current activity item.
    3758      *
    3759      * @since 1.7.0
    3760      *
    3761      * @param string $retval HTML markup for the list of avatars.
    3762      * @param array  $r      Array of arguments used for each avatar.
    3763      * @param array  $output Array of each avatar found, before imploded into single string.
    3764      */
    3765     echo apply_filters( 'bp_activity_comments_user_avatars', $retval, $r, $output );
     3817    // phpcs:ignore WordPress.Security.EscapeOutput
     3818    echo apply_filters(
     3819        /**
     3820         * Filters the list of linked avatars for users who have commented on the current activity item.
     3821         *
     3822         * @since 1.7.0
     3823         *
     3824         * @param string $retval HTML markup for the list of avatars.
     3825         * @param array  $r      Array of arguments used for each avatar.
     3826         * @param array  $output Array of each avatar found, before imploded into single string.
     3827         */
     3828        'bp_activity_comments_user_avatars',
     3829        $retval,
     3830        $r,
     3831        $output
     3832    );
    37663833}
    37673834
     
    38423909 */
    38433910function bp_displayed_user_mentionname() {
    3844     echo bp_get_displayed_user_mentionname();
     3911    echo esc_html( bp_get_displayed_user_mentionname() );
    38453912}
    38463913    /**
     
    39003967        switch ( $output ) {
    39013968            case 'select' :
     3969                // phpcs:ignore WordPress.Security.EscapeOutput
    39023970                printf( '<option value="%1$s" %2$s>%3$s</option>', esc_attr( $type ), $selected, esc_html( $description ) );
    39033971                break;
    39043972            case 'checkbox' :
     3973                // phpcs:ignore WordPress.Security.EscapeOutput
    39053974                printf( '<label style="" for="%1$s[]">%2$s<input type="checkbox" id="%1$s[]" name="%1$s[]" value="%3$s" %4$s/></label>', esc_attr( $args['checkbox_name'] ), esc_html( $description ), esc_attr( $args['checkbox_name'] ), esc_attr( $args['checkbox_name'] ), esc_attr( $type ), $checked );
    39063975                break;
     
    39384007 */
    39394008function bp_sitewide_activity_feed_link() {
    3940     echo bp_get_sitewide_activity_feed_link();
     4009    echo esc_url( bp_get_sitewide_activity_feed_link() );
    39414010}
    39424011
     
    40544123 */
    40554124function bp_activity_feed_item_guid() {
    4056     echo bp_get_activity_feed_item_guid();
     4125    echo esc_html( bp_get_activity_feed_item_guid() );
    40574126}
    40584127
     
    40864155 */
    40874156function bp_activity_feed_item_title() {
     4157    // phpcs:ignore WordPress.Security.EscapeOutput
    40884158    echo bp_get_activity_feed_item_title();
    40894159}
     
    41354205 */
    41364206function bp_activity_feed_item_link() {
    4137     echo bp_get_activity_feed_item_link();
     4207    echo esc_url( bp_get_activity_feed_item_link() );
    41384208}
    41394209
     
    41714241 */
    41724242function bp_activity_feed_item_date() {
    4173     echo bp_get_activity_feed_item_date();
     4243    echo esc_html( bp_get_activity_feed_item_date() );
    41744244}
    41754245
     
    42074277 */
    42084278function bp_activity_feed_item_description() {
     4279    // Escaping is made in `bp-activity/bp-activity-filters.php`.
     4280    // phpcs:ignore WordPress.Security.EscapeOutput
    42094281    echo bp_get_activity_feed_item_description();
    42104282}
     
    42514323?>
    42524324
    4253     <link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ) ?> | <?php _e( 'Site Wide Activity RSS Feed', 'buddypress' ) ?>" href="<?php bp_sitewide_activity_feed_link() ?>" />
     4325    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ) ?> | <?php esc_html_e( 'Site Wide Activity RSS Feed', 'buddypress' ) ?>" href="<?php bp_sitewide_activity_feed_link() ?>" />
    42544326
    42554327<?php
     
    42664338 */
    42674339function bp_activity_show_filters( $context = '' ) {
     4340    // phpcs:ignore WordPress.Security.EscapeOutput
    42684341    echo bp_get_activity_show_filters( $context );
    42694342}
Note: See TracChangeset for help on using the changeset viewer.