Skip to:
Content

BuddyPress.org

Changeset 1925


Ignore:
Timestamp:
09/23/2009 12:33:11 AM (16 years ago)
Author:
apeatling
Message:

Modifying kses filter on wire and activity streams to allow for image posting.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-filters.php

    r1905 r1925  
    22
    33/* Apply WordPress defined filters */
    4 add_filter( 'bp_get_activity_content', 'wp_filter_kses', 1 );
     4add_filter( 'bp_get_activity_content', 'bp_activity_filter_kses', 1 );
    55add_filter( 'bp_get_activity_content', 'force_balance_tags' );
    66add_filter( 'bp_get_activity_content', 'wptexturize' );
     
    1111add_filter( 'bp_get_activity_content', 'stripslashes_deep' );
    1212
    13 function bp_activity_add_allowed_tags( $allowedtags ) {
    14     $allowedtags['span'] = array();
    15     $allowedtags['span']['class'] = array();
    16     $allowedtags['a']['class'] = array();
    17     $allowedtags['img'] = array();
    18     $allowedtags['img']['src'] = array();
    19     $allowedtags['img']['alt'] = array();
    20     $allowedtags['img']['class'] = array();
    21     $allowedtags['img']['id'] = array();
     13function bp_activity_filter_kses( $content ) {
     14    global $allowedtags;
    2215   
    23     return $allowedtags;
     16    $activity_allowedtags = $allowedtags;
     17    $activity_allowedtags['span'] = array();
     18    $activity_allowedtags['span']['class'] = array();
     19    $activity_allowedtags['a']['class'] = array();
     20    $activity_allowedtags['img'] = array();
     21    $activity_allowedtags['img']['src'] = array();
     22    $activity_allowedtags['img']['alt'] = array();
     23    $activity_allowedtags['img']['class'] = array();
     24    $activity_allowedtags['img']['width'] = array();
     25    $activity_allowedtags['img']['height'] = array();
     26    $activity_allowedtags['img']['class'] = array();
     27    $activity_allowedtags['img']['id'] = array();
     28
     29    return wp_kses( $content, $activity_allowedtags );
    2430}
    25 add_filter( 'edit_allowedtags', 'bp_activity_add_allowed_tags', 1 );
     31
    2632
    2733?>
  • trunk/bp-core/bp-core-templatetags.php

    r1906 r1925  
    713713function bp_create_excerpt( $text, $excerpt_length = 55, $filter_shortcodes = true ) { // Fakes an excerpt if needed
    714714    $text = str_replace(']]>', ']]>', $text);
    715     $text = strip_tags($text);
    716    
     715
    717716    if ( $filter_shortcodes )
    718717        $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
  • trunk/bp-wire/bp-wire-filters.php

    r1905 r1925  
    22
    33/* Apply WordPress defined filters */
    4 add_filter( 'bp_wire_post_content_before_save', 'wp_filter_kses', 1 );
    5 add_filter( 'bp_get_wire_post_content', 'wp_filter_kses', 1 );
     4add_filter( 'bp_wire_post_content_before_save', 'bp_wire_filter_kses', 1 );
     5add_filter( 'bp_get_wire_post_content', 'bp_wire_filter_kses', 1 );
    66
    77add_filter( 'bp_get_wire_post_content', 'wptexturize' );
     
    1313
    1414add_filter( 'bp_wire_post_content_before_save', 'force_balance_tags' );
     15add_filter( 'bp_get_wire_post_content', 'force_balance_tags' );
    1516
    16 function bp_wire_add_allowed_tags( $allowedtags ) {
    17     $allowedtags['strong'] = array();
    18     $allowedtags['em'] = array();
    19     $allowedtags['img'] = array();
    20     return $allowedtags;
     17function bp_wire_filter_kses( $content ) {
     18    global $allowedtags;
     19   
     20    $wire_allowedtags = $allowedtags;
     21    $wire_allowedtags['img'] = array();
     22    $wire_allowedtags['img']['src'] = array();
     23    $wire_allowedtags['img']['alt'] = array();
     24    $wire_allowedtags['img']['class'] = array();
     25    $wire_allowedtags['img']['width'] = array();
     26    $wire_allowedtags['img']['height'] = array();
     27
     28    return wp_kses( $content, $wire_allowedtags );
    2129}
    22 add_filter( 'edit_allowedtags', 'bp_wire_add_allowed_tags', 1 );
    23 
    2430
    2531?>
Note: See TracChangeset for help on using the changeset viewer.