Skip to:
Content

BuddyPress.org

Changeset 12379


Ignore:
Timestamp:
04/25/2019 02:38:26 PM (7 years ago)
Author:
boonebgorges
Message:

Activity: Fine-tune HTML whitelist for user-provided content.

Merges [12377] to the 4.0 branch.

Location:
branches/4.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.0

  • branches/4.0/src/bp-activity/bp-activity-filters.php

    r12281 r12379  
    1616add_filter( 'bp_get_activity_action',                'bp_activity_filter_kses', 1 );
    1717add_filter( 'bp_get_activity_content_body',          'bp_activity_filter_kses', 1 );
    18 add_filter( 'bp_get_activity_content',               'bp_activity_filter_kses', 1 );
    1918add_filter( 'bp_get_activity_parent_content',        'bp_activity_filter_kses', 1 );
    2019add_filter( 'bp_get_activity_latest_update',         'bp_activity_filter_kses', 1 );
     
    206205 */
    207206function bp_activity_filter_kses( $content ) {
     207    $activity_allowedtags = bp_get_allowedtags();
     208
     209    // Don't allow 'class' or 'id'.
     210    foreach ( $activity_allowedtags as $el => &$atts ) {
     211        unset( $atts['class'] );
     212        unset( $atts['id'] );
     213    }
     214
    208215    /**
    209216     * Filters the allowed HTML tags for BuddyPress Activity content.
     
    213220     * @param array $value Array of allowed HTML tags and attributes.
    214221     */
    215     $activity_allowedtags = apply_filters( 'bp_activity_allowed_tags', bp_get_allowedtags() );
     222    $activity_allowedtags = apply_filters( 'bp_activity_allowed_tags', $activity_allowedtags );
    216223    return wp_kses( $content, $activity_allowedtags );
    217224}
Note: See TracChangeset for help on using the changeset viewer.