WordPress.org

Make WordPress Core

Ticket #3975: default-filters_php.patch

File default-filters_php.patch, 4.4 KB (added by harkos, 13 years ago)

Sorry, this patch should have been published here instead.

  • default-filters.php

     
    11<?php
    22
     3function __trim($text) {
     4   return trim($text);
     5}
     6
    37// Some default filters
    48add_filter('bloginfo','wp_specialchars');
    59add_filter('category_description', 'wptexturize');
     
    1418
    1519// Comments, trackbacks, pingbacks
    1620add_filter('pre_comment_author_name', 'strip_tags');
    17 add_filter('pre_comment_author_name', 'trim');
     21add_filter('pre_comment_author_name', '__trim');
    1822add_filter('pre_comment_author_name', 'wp_specialchars', 30);
    1923
    20 add_filter('pre_comment_author_email', 'trim');
     24add_filter('pre_comment_author_email', '__trim');
    2125add_filter('pre_comment_author_email', 'sanitize_email');
    2226
    2327add_filter('pre_comment_author_url', 'strip_tags');
    24 add_filter('pre_comment_author_url', 'trim');
     28add_filter('pre_comment_author_url', '__trim');
    2529add_filter('pre_comment_author_url', 'clean_url');
    2630
    2731add_filter('pre_comment_content', 'wp_rel_nofollow', 15);
     
    5458
    5559// Categories
    5660add_filter('pre_category_name', 'strip_tags');
    57 add_filter('pre_category_name', 'trim');
     61add_filter('pre_category_name', '__trim');
    5862add_filter('pre_category_name', 'wp_filter_kses');
    5963add_filter('pre_category_name', 'wp_specialchars', 30);
    6064add_filter('pre_category_description', 'wp_filter_kses');
    6165
    6266//Links
    6367add_filter('pre_link_name', 'strip_tags');
    64 add_filter('pre_link_name', 'trim');
     68add_filter('pre_link_name', '__trim');
    6569add_filter('pre_link_name', 'wp_filter_kses');
    6670add_filter('pre_link_name', 'wp_specialchars', 30);
    6771add_filter('pre_link_description', 'wp_filter_kses');
    6872add_filter('pre_link_notes', 'wp_filter_kses');
    6973add_filter('pre_link_url', 'strip_tags');
    70 add_filter('pre_link_url', 'trim');
     74add_filter('pre_link_url', '__trim');
    7175add_filter('pre_link_url', 'clean_url');
    7276add_filter('pre_link_image', 'strip_tags');
    73 add_filter('pre_link_image', 'trim');
     77add_filter('pre_link_image', '__trim');
    7478add_filter('pre_link_image', 'clean_url');
    7579add_filter('pre_link_rss', 'strip_tags');
    76 add_filter('pre_link_rss', 'trim');
     80add_filter('pre_link_rss', '__trim');
    7781add_filter('pre_link_rss', 'clean_url');
    7882add_filter('pre_link_target', 'strip_tags');
    79 add_filter('pre_link_target', 'trim');
     83add_filter('pre_link_target', '__trim');
    8084add_filter('pre_link_target', 'wp_filter_kses');
    8185add_filter('pre_link_target', 'wp_specialchars', 30);
    8286add_filter('pre_link_rel', 'strip_tags');
    83 add_filter('pre_link_rel', 'trim');
     87add_filter('pre_link_rel', '__trim');
    8488add_filter('pre_link_rel', 'wp_filter_kses');
    8589add_filter('pre_link_rel', 'wp_specialchars', 30);
    8690
    8791// Users
    8892add_filter('pre_user_display_name', 'strip_tags');
    89 add_filter('pre_user_display_name', 'trim');
     93add_filter('pre_user_display_name', '__trim');
    9094add_filter('pre_user_display_name', 'wp_filter_kses');
    9195add_filter('pre_user_display_name', 'wp_specialchars', 30);
    9296add_filter('pre_user_first_name', 'strip_tags');
    93 add_filter('pre_user_first_name', 'trim');
     97add_filter('pre_user_first_name', '__trim');
    9498add_filter('pre_user_first_name', 'wp_filter_kses');
    9599add_filter('pre_user_first_name', 'wp_specialchars', 30);
    96100add_filter('pre_user_last_name', 'strip_tags');
    97 add_filter('pre_user_last_name', 'trim');
     101add_filter('pre_user_last_name', '__trim');
    98102add_filter('pre_user_last_name', 'wp_filter_kses');
    99103add_filter('pre_user_last_name', 'wp_specialchars', 30);
    100104add_filter('pre_user_nickname', 'strip_tags');
    101 add_filter('pre_user_nickname', 'trim');
     105add_filter('pre_user_nickname', '__trim');
    102106add_filter('pre_user_nickname', 'wp_filter_kses');
    103107add_filter('pre_user_nickname', 'wp_specialchars', 30);
    104 add_filter('pre_user_description', 'trim');
     108add_filter('pre_user_description', '__trim');
    105109add_filter('pre_user_description', 'wp_filter_kses');
    106110add_filter('pre_user_url', 'strip_tags');
    107 add_filter('pre_user_url', 'trim');
     111add_filter('pre_user_url', '__trim');
    108112add_filter('pre_user_url', 'clean_url');
    109 add_filter('pre_user_email', 'trim');
     113add_filter('pre_user_email', '__trim');
    110114add_filter('pre_user_email', 'sanitize_email');
    111115
    112116// Places to balance tags on input
     
    116120
    117121// Misc. title, content, and excerpt filters
    118122add_filter('the_title', 'convert_chars');
    119 add_filter('the_title', 'trim');
     123add_filter('the_title', '__trim');
    120124
    121125add_filter('the_content', 'convert_smilies');
    122126add_filter('the_content', 'convert_chars');