Skip to:
Content

bbPress.org

Changeset 4604


Ignore:
Timestamp:
12/20/2012 12:59:10 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Add forum specific kses allowed tags to common component. Tweak topic and reply content filters to use these new kses functions.

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bbpress.php

    r4600 r4604  
    291291        // Common
    292292        require( $this->includes_dir . 'common/ajax.php'           );
     293        require( $this->includes_dir . 'common/kses.php'           );
    293294        require( $this->includes_dir . 'common/classes.php'        );
    294295        require( $this->includes_dir . 'common/functions.php'      );
  • trunk/includes/common/template-tags.php

    r4579 r4604  
    22422242     * @since bbPress (r2780)
    22432243     *
    2244      * @uses allowed_tags() To get the allowed tags
     2244     * @uses bbp_kses_allowed_tags() To get the allowed tags
    22452245     * @uses apply_filters() Calls 'bbp_allowed_tags' with the tags
    22462246     * @return string HTML allowed tags entity encoded.
    22472247     */
    22482248    function bbp_get_allowed_tags() {
    2249         return apply_filters( 'bbp_get_allowed_tags', allowed_tags() );
     2249
     2250        $allowed = '';
     2251
     2252        foreach ( (array) bbp_kses_allowed_tags() as $tag => $attributes ) {
     2253            $allowed .= '<' . $tag;
     2254            if ( 0 < count( $attributes ) ) {
     2255                foreach ( array_keys( $attributes ) as $attribute ) {
     2256                    $allowed .= ' ' . $attribute . '=""';
     2257                }
     2258            }
     2259            $allowed .= '> ';
     2260        }
     2261
     2262        return apply_filters( 'bbp_get_allowed_tags', htmlentities( $allowed ) );
    22502263    }
    22512264
  • trunk/includes/core/filters.php

    r4522 r4604  
    9595add_filter( 'bbp_new_reply_pre_content',  'balanceTags'     );
    9696add_filter( 'bbp_new_reply_pre_content',  'wp_rel_nofollow' );
    97 add_filter( 'bbp_new_reply_pre_content',  'wp_filter_kses' );
     97add_filter( 'bbp_new_reply_pre_content',  'bbp_filter_kses' );
    9898add_filter( 'bbp_new_topic_pre_content',  'balanceTags'     );
    9999add_filter( 'bbp_new_topic_pre_content',  'wp_rel_nofollow' );
    100 add_filter( 'bbp_new_topic_pre_content',  'wp_filter_kses' );
     100add_filter( 'bbp_new_topic_pre_content',  'bbp_filter_kses' );
    101101add_filter( 'bbp_edit_reply_pre_content', 'balanceTags'     );
    102102add_filter( 'bbp_edit_reply_pre_content', 'wp_rel_nofollow' );
    103 add_filter( 'bbp_edit_reply_pre_content', 'wp_filter_kses' );
     103add_filter( 'bbp_edit_reply_pre_content', 'bbp_filter_kses' );
    104104add_filter( 'bbp_edit_topic_pre_content', 'balanceTags'     );
    105105add_filter( 'bbp_edit_topic_pre_content', 'wp_rel_nofollow' );
    106 add_filter( 'bbp_edit_topic_pre_content', 'wp_filter_kses' );
     106add_filter( 'bbp_edit_topic_pre_content', 'bbp_filter_kses' );
    107107
    108108// No follow and stripslashes on user profile links
     
    154154// Run wp_kses_data on topic/reply content in admin section
    155155if ( is_admin() ) {
    156     add_filter( 'bbp_get_reply_content', 'wp_kses_data' );
    157     add_filter( 'bbp_get_topic_content', 'wp_kses_data' );
     156    add_filter( 'bbp_get_reply_content', 'bbp_kses_data' );
     157    add_filter( 'bbp_get_topic_content', 'bbp_kses_data' );
    158158
    159159// Revisions (only when not in admin)
Note: See TracChangeset for help on using the changeset viewer.