Ticket #17456: 1-default-filters.patch
| File 1-default-filters.patch, 7.1 KB (added by ramiy, 2 years ago) |
|---|
-
default-filters.php
12 12 * @package WordPress 13 13 */ 14 14 15 16 /** 17 * Filters 18 */ 19 20 15 21 // Strip, trim, kses, special chars for string saves 16 22 foreach ( array( 'pre_term_name', 'pre_comment_author_name', 'pre_link_name', 'pre_link_target', 'pre_link_rel', 'pre_user_display_name', 'pre_user_first_name', 'pre_user_last_name', 'pre_user_nickname' ) as $filter ) { 17 23 add_filter( $filter, 'sanitize_text_field' ); … … 57 63 } 58 64 59 65 // Save URL 60 foreach ( array( 'pre_comment_author_url', 'pre_user_url', 'pre_link_url', 'pre_link_image', 61 'pre_link_rss' ) as $filter ) { 66 foreach ( array( 'pre_comment_author_url', 'pre_user_url', 'pre_link_url', 'pre_link_image', 'pre_link_rss' ) as $filter ) { 62 67 add_filter( $filter, 'wp_strip_all_tags' ); 63 68 add_filter( $filter, 'esc_url_raw' ); 64 69 add_filter( $filter, 'wp_filter_kses' ); … … 91 96 add_filter( $filter, 'balanceTags', 50 ); 92 97 } 93 98 94 // Format strings for display .99 // Format strings for display 95 100 foreach ( array( 'comment_author', 'term_name', 'link_name', 'link_description', 'link_notes', 'bloginfo', 'wp_title', 'widget_title' ) as $filter ) { 96 101 add_filter( $filter, 'wptexturize' ); 97 102 add_filter( $filter, 'convert_chars' ); … … 99 104 } 100 105 101 106 // Format WordPress 102 foreach ( array( 'the_content', 'the_title' ) as $filter ) 103 add_filter( $filter,'capital_P_dangit', 11 );107 add_filter( 'the_title', 'capital_P_dangit', 11 ); 108 add_filter( 'the_content', 'capital_P_dangit', 11 ); 104 109 add_filter( 'comment_text', 'capital_P_dangit', 31 ); 105 110 106 111 // Format titles … … 109 114 add_filter( $filter, 'strip_tags' ); 110 115 } 111 116 112 // Format text area for display. 113 foreach ( array( 'term_description' ) as $filter ) { 114 add_filter( $filter, 'wptexturize' ); 115 add_filter( $filter, 'convert_chars' ); 116 add_filter( $filter, 'wpautop' ); 117 add_filter( $filter, 'shortcode_unautop'); 118 } 117 // Format text area for display 118 add_filter( 'term_description', 'wptexturize' ); 119 add_filter( 'term_description', 'convert_chars' ); 120 add_filter( 'term_description', 'wpautop' ); 121 add_filter( 'term_description', 'shortcode_unautop' ); 119 122 120 123 // Format for RSS 121 foreach ( array( 'term_name_rss' ) as $filter ) { 122 add_filter( $filter, 'convert_chars' ); 123 } 124 add_filter( 'term_name_rss', 'convert_chars' ); 124 125 125 126 // Pre save hierarchy 126 127 add_filter( 'wp_insert_post_parent', 'wp_check_post_hierarchy_for_loops', 10, 2 ); 127 128 add_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 ); 128 129 129 // Display filters130 // Title Display filters 130 131 add_filter( 'the_title', 'wptexturize' ); 131 132 add_filter( 'the_title', 'convert_chars' ); 132 133 add_filter( 'the_title', 'trim' ); 133 134 135 // Content Display filters 134 136 add_filter( 'the_content', 'wptexturize' ); 135 137 add_filter( 'the_content', 'convert_smilies' ); 136 138 add_filter( 'the_content', 'convert_chars' ); … … 138 140 add_filter( 'the_content', 'shortcode_unautop' ); 139 141 add_filter( 'the_content', 'prepend_attachment' ); 140 142 141 add_filter( 'the_excerpt', 'wptexturize' ); 142 add_filter( 'the_excerpt', 'convert_smilies' ); 143 add_filter( 'the_excerpt', 'convert_chars' ); 144 add_filter( 'the_excerpt', 'wpautop' ); 145 add_filter( 'the_excerpt', 'shortcode_unautop'); 146 add_filter( 'get_the_excerpt', 'wp_trim_excerpt' ); 143 // Excerpt Display filters 144 add_filter( 'the_excerpt', 'wptexturize' ); 145 add_filter( 'the_excerpt', 'convert_smilies' ); 146 add_filter( 'the_excerpt', 'convert_chars' ); 147 add_filter( 'the_excerpt', 'wpautop' ); 148 add_filter( 'the_excerpt', 'shortcode_unautop' ); 149 add_filter( 'get_the_excerpt', 'wp_trim_excerpt' ); 147 150 148 add_filter( 'comment_text', 'wptexturize' ); 149 add_filter( 'comment_text', 'convert_chars' ); 150 add_filter( 'comment_text', 'make_clickable', 9 ); 151 add_filter( 'comment_text', 'force_balance_tags', 25 ); 152 add_filter( 'comment_text', 'convert_smilies', 20 ); 153 add_filter( 'comment_text', 'wpautop', 30 ); 151 // Comment Display filters 152 add_filter( 'comment_text', 'wptexturize' ); 153 add_filter( 'comment_text', 'convert_chars' ); 154 add_filter( 'comment_text', 'make_clickable', 9 ); 155 add_filter( 'comment_text', 'force_balance_tags', 25 ); 156 add_filter( 'comment_text', 'convert_smilies', 20 ); 157 add_filter( 'comment_text', 'wpautop', 30 ); 158 add_filter( 'comment_excerpt', 'convert_chars' ); 154 159 155 add_filter( 'comment_excerpt', 'convert_chars' ); 156 157 add_filter( 'list_cats', 'wptexturize' ); 158 160 // Other Display filters 161 add_filter( 'list_cats', 'wptexturize' ); 159 162 add_filter( 'wp_sprintf', 'wp_sprintf_l', 10, 2 ); 160 163 161 164 // RSS filters … … 173 176 174 177 // Misc filters 175 178 add_filter( 'option_ping_sites', 'privacy_ping_filter' ); 176 add_filter( 'option_blog_charset', '_wp_specialchars' ); // IMPORTANT: This must not be wp_specialchars() or esc_html() or it'll cause an infinite loop 179 add_filter( 'option_blog_charset', '_wp_specialchars' ); // IMPORTANT: This must not be wp_specialchars() or esc_html() or it'll cause an infinite loop. 177 180 add_filter( 'option_home', '_config_wp_home' ); 178 181 add_filter( 'option_siteurl', '_config_wp_siteurl' ); 179 182 add_filter( 'tiny_mce_before_init', '_mce_set_direction' ); … … 191 194 add_filter( 'editable_slug', 'urldecode' ); 192 195 add_filter( 'nav_menu_meta_box_object', '_wp_nav_menu_meta_box_object' ); 193 196 194 // Actions 197 // Timezone 198 add_filter( 'pre_option_gmt_offset', 'wp_timezone_override_offset' ); 199 200 201 /** 202 * Actions 203 */ 204 205 195 206 add_action( 'wp_head', 'wp_enqueue_scripts', 1 ); 196 207 add_action( 'wp_head', 'feed_links', 2 ); 197 208 add_action( 'wp_head', 'feed_links_extra', 3 ); … … 255 266 add_action( 'admin_init', 'send_frame_options_header', 10, 0 ); 256 267 257 268 // Navigation menu actions 258 add_action( 'delete_post', '_wp_delete_post_menu_item' );259 add_action( 'delete_term', '_wp_delete_tax_menu_item' );260 add_action( 'transition_post_status', '_wp_auto_add_pages_to_menu', 10, 3 );269 add_action( 'delete_post', '_wp_delete_post_menu_item' ); 270 add_action( 'delete_term', '_wp_delete_tax_menu_item' ); 271 add_action( 'transition_post_status', '_wp_auto_add_pages_to_menu', 10, 3 ); 261 272 262 273 // Post Thumbnail CSS class filtering 263 274 add_action( 'begin_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_add' ); … … 270 281 // Nonce check for Post Previews 271 282 add_action( 'init', '_show_post_preview' ); 272 283 273 // Timezone274 add_filter( 'pre_option_gmt_offset','wp_timezone_override_offset' );275 276 284 // Admin Color Schemes 277 285 add_action( 'admin_init', 'register_admin_color_schemes', 1); 278 286 add_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' ); 279 287 280 unset( $filter, $action);288 unset( $filter, $action ); 281 289 282 290 ?>
