Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/default-filters.php

    r17406 r17465  
    2222// Strip, kses, special chars for string display
    2323foreach ( array( 'term_name', 'comment_author_name', 'link_name', 'link_target', 'link_rel', 'user_display_name', 'user_first_name', 'user_last_name', 'user_nickname' ) as $filter ) {
    24     add_filter( $filter, 'sanitize_text_field'  );
    25     add_filter( $filter, 'wp_kses_data'       );
     24    if ( is_admin() ) {
     25        // These are expensive. Run only on admin pages for defense in depth.
     26        add_filter( $filter, 'sanitize_text_field'  );
     27        add_filter( $filter, 'wp_kses_data'       );
     28    }
    2629    add_filter( $filter, '_wp_specialchars', 30 );
    2730}
     
    3336
    3437// Kses only for textarea admin displays
    35 foreach ( array( 'term_description', 'link_description', 'link_notes', 'user_description', 'comment_text' ) as $filter ) {
    36     add_filter( $filter, 'wp_kses_data' );
     38if ( is_admin() ) {
     39    foreach ( array( 'term_description', 'link_description', 'link_notes', 'user_description' ) as $filter ) {
     40        add_filter( $filter, 'wp_kses_data' );
     41    }
     42    add_filter( 'comment_text', 'wp_kses_post' );
    3743}
    3844
     
    4450}
    4551
    46 // Email display
     52// Email admin display
    4753foreach ( array( 'comment_author_email', 'user_email' ) as $filter ) {
    4854    add_filter( $filter, 'sanitize_email' );
    49     add_filter( $filter, 'wp_kses_data' );
     55    if ( is_admin() )
     56        add_filter( $filter, 'wp_kses_data' );
    5057}
    5158
     
    6067// Display URL
    6168foreach ( array( 'user_url', 'link_url', 'link_image', 'link_rss', 'comment_url' ) as $filter ) {
    62     add_filter( $filter, 'wp_strip_all_tags' );
     69    if ( is_admin() )
     70        add_filter( $filter, 'wp_strip_all_tags' );
    6371    add_filter( $filter, 'esc_url'           );
    64     add_filter( $filter, 'wp_kses_data'    );
     72    if ( is_admin() )
     73        add_filter( $filter, 'wp_kses_data'    );
    6574}
    6675
     
    91100
    92101// Format WordPress
    93 foreach ( array( 'the_content', 'the_title', 'comment_text' ) as $filter )
     102foreach ( array( 'the_content', 'the_title' ) as $filter )
    94103    add_filter( $filter, 'capital_P_dangit', 11 );
     104add_filter( 'comment_text', 'capital_P_dangit', 31 );
    95105
    96106// Format titles
     
    113123}
    114124
     125// Pre save hierarchy
     126add_filter( 'wp_insert_post_parent', 'wp_check_post_hierarchy_for_loops', 10, 2 );
     127add_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 );
     128
    115129// Display filters
    116130add_filter( 'the_title', 'wptexturize'   );
     
    142156
    143157add_filter( 'list_cats',         'wptexturize' );
    144 add_filter( 'single_post_title', 'wptexturize' );
    145158
    146159add_filter( 'wp_sprintf', 'wp_sprintf_l', 10, 2 );
     
    202215add_action( 'wp_head',             'wp_shortlink_wp_head',          10, 0 );
    203216add_action( 'template_redirect',   'wp_shortlink_header',           11, 0 );
     217
     218// Login actions
     219add_action( 'login_head',          'wp_print_head_scripts',         9     );
     220add_action( 'login_footer',        'wp_print_footer_scripts'              );
    204221
    205222// Feed Generator Tags
     
    257274add_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
    258275
     276unset($filter, $action);
     277
    259278?>
Note: See TracChangeset for help on using the changeset viewer.