source: trunk/www.guidonia.net/wp/wp-includes/default-filters.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 7.7 KB
Line 
1<?php
2/**
3 * Sets up the default filters and actions for most
4 * of the WordPress hooks.
5 *
6 * If you need to remove a default hook, this file will
7 * give you the priority for which to use to remove the
8 * hook.
9 *
10 * Not all of the default hooks are found in default-filters.php
11 *
12 * @package WordPress
13 */
14
15// Strip, trim, kses, special chars for string saves
16$filters = array('pre_term_name', 'pre_comment_author_name', 'pre_link_name', 'pre_link_target',
17 'pre_link_rel', 'pre_user_display_name', 'pre_user_first_name', 'pre_user_last_name',
18 'pre_user_nickname');
19foreach ( $filters as $filter ) {
20 add_filter($filter, 'strip_tags');
21 add_filter($filter, 'trim');
22 add_filter($filter, 'wp_filter_kses');
23 add_filter($filter, '_wp_specialchars', 30);
24}
25
26// Kses only for textarea saves
27$filters = array('pre_term_description', 'pre_link_description', 'pre_link_notes', 'pre_user_description');
28foreach ( $filters as $filter ) {
29 add_filter($filter, 'wp_filter_kses');
30}
31
32// Email
33$filters = array('pre_comment_author_email', 'pre_user_email');
34foreach ( $filters as $filter ) {
35 add_filter($filter, 'trim');
36 add_filter($filter, 'sanitize_email');
37 add_filter($filter, 'wp_filter_kses');
38}
39
40// Save URL
41$filters = array('pre_comment_author_url', 'pre_user_url', 'pre_link_url', 'pre_link_image',
42 'pre_link_rss');
43foreach ( $filters as $filter ) {
44 add_filter($filter, 'strip_tags');
45 add_filter($filter, 'trim');
46 add_filter($filter, 'esc_url_raw');
47 add_filter($filter, 'wp_filter_kses');
48}
49
50// Display URL
51$filters = array('user_url', 'link_url', 'link_image', 'link_rss', 'comment_url');
52foreach ( $filters as $filter ) {
53 add_filter($filter, 'strip_tags');
54 add_filter($filter, 'trim');
55 add_filter($filter, 'esc_url');
56 add_filter($filter, 'wp_filter_kses');
57}
58
59// Slugs
60$filters = array('pre_term_slug');
61foreach ( $filters as $filter ) {
62 add_filter($filter, 'sanitize_title');
63}
64
65// Keys
66$filters = array('pre_post_type');
67foreach ( $filters as $filter ) {
68 add_filter($filter, 'sanitize_user');
69}
70
71// Places to balance tags on input
72$filters = array('content_save_pre', 'excerpt_save_pre', 'comment_save_pre', 'pre_comment_content');
73foreach ( $filters as $filter ) {
74 add_filter( $filter, 'balanceTags', 50);
75}
76
77// Format strings for display.
78$filters = array('comment_author', 'term_name', 'link_name', 'link_description',
79 'link_notes', 'bloginfo', 'wp_title', 'widget_title');
80foreach ( $filters as $filter ) {
81 add_filter($filter, 'wptexturize');
82 add_filter($filter, 'convert_chars');
83 add_filter($filter, 'esc_html');
84}
85
86// Format text area for display.
87$filters = array('term_description');
88foreach ( $filters as $filter ) {
89 add_filter($filter, 'wptexturize');
90 add_filter($filter, 'convert_chars');
91 add_filter($filter, 'wpautop');
92}
93
94// Format for RSS
95$filters = array('term_name_rss');
96foreach ( $filters as $filter ) {
97 add_filter($filter, 'convert_chars');
98}
99
100// Display filters
101add_filter('the_title', 'wptexturize');
102add_filter('the_title', 'convert_chars');
103add_filter('the_title', 'trim');
104
105add_filter('the_content', 'wptexturize');
106add_filter('the_content', 'convert_smilies');
107add_filter('the_content', 'convert_chars');
108add_filter('the_content', 'wpautop');
109add_filter('the_content', 'prepend_attachment');
110
111add_filter('the_excerpt', 'wptexturize');
112add_filter('the_excerpt', 'convert_smilies');
113add_filter('the_excerpt', 'convert_chars');
114add_filter('the_excerpt', 'wpautop');
115add_filter('get_the_excerpt', 'wp_trim_excerpt');
116
117add_filter('comment_text', 'wptexturize');
118add_filter('comment_text', 'convert_chars');
119add_filter('comment_text', 'make_clickable', 9);
120add_filter('comment_text', 'force_balance_tags', 25);
121add_filter('comment_text', 'convert_smilies', 20);
122add_filter('comment_text', 'wpautop', 30);
123
124add_filter('comment_excerpt', 'convert_chars');
125
126add_filter('list_cats', 'wptexturize');
127add_filter('single_post_title', 'wptexturize');
128
129add_filter('wp_sprintf', 'wp_sprintf_l', 10, 2);
130
131// RSS filters
132add_filter('the_title_rss', 'strip_tags');
133add_filter('the_title_rss', 'ent2ncr', 8);
134add_filter('the_title_rss', 'esc_html');
135add_filter('the_content_rss', 'ent2ncr', 8);
136add_filter('the_excerpt_rss', 'convert_chars');
137add_filter('the_excerpt_rss', 'ent2ncr', 8);
138add_filter('comment_author_rss', 'ent2ncr', 8);
139add_filter('comment_text_rss', 'ent2ncr', 8);
140add_filter('comment_text_rss', 'esc_html');
141add_filter('bloginfo_rss', 'ent2ncr', 8);
142add_filter('the_author', 'ent2ncr', 8);
143
144// Misc filters
145add_filter('option_ping_sites', 'privacy_ping_filter');
146add_filter('option_blog_charset', '_wp_specialchars'); // IMPORTANT: This must not be wp_specialchars() or esc_html() or it'll cause an infinite loop
147add_filter('option_home', '_config_wp_home');
148add_filter('option_siteurl', '_config_wp_siteurl');
149add_filter('tiny_mce_before_init', '_mce_set_direction');
150add_filter('pre_kses', 'wp_pre_kses_less_than');
151add_filter('sanitize_title', 'sanitize_title_with_dashes');
152add_action('check_comment_flood', 'check_comment_flood_db', 10, 3);
153add_filter('comment_flood_filter', 'wp_throttle_comment_flood', 10, 3);
154add_filter('pre_comment_content', 'wp_rel_nofollow', 15);
155add_filter('comment_email', 'antispambot');
156add_filter('option_tag_base', '_wp_filter_taxonomy_base');
157add_filter('option_category_base', '_wp_filter_taxonomy_base');
158add_filter( 'the_posts', '_close_comments_for_old_posts' );
159add_filter( 'comments_open', '_close_comments_for_old_post', 10, 2 );
160add_filter( 'pings_open', '_close_comments_for_old_post', 10, 2 );
161add_filter( 'editable_slug', 'urldecode' );
162
163// Atom SSL support
164add_filter('atom_service_url','atom_service_url_filter');
165
166// Actions
167add_action('wp_head', 'wp_enqueue_scripts', 1);
168add_action('wp_head', 'feed_links_extra', 3);
169add_action('wp_head', 'rsd_link');
170add_action('wp_head', 'wlwmanifest_link');
171add_action('wp_head', 'index_rel_link');
172add_action('wp_head', 'parent_post_rel_link', 10, 0);
173add_action('wp_head', 'start_post_rel_link', 10, 0);
174add_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
175add_action('wp_head', 'locale_stylesheet');
176add_action('publish_future_post', 'check_and_publish_future_post', 10, 1);
177add_action('wp_head', 'noindex', 1);
178add_action('wp_head', 'wp_print_styles', 8);
179add_action('wp_head', 'wp_print_head_scripts', 9);
180add_action('wp_head', 'wp_generator');
181add_action('wp_footer', 'wp_print_footer_scripts');
182if(!defined('DOING_CRON'))
183 add_action('sanitize_comment_cookies', 'wp_cron');
184add_action('do_feed_rdf', 'do_feed_rdf', 10, 1);
185add_action('do_feed_rss', 'do_feed_rss', 10, 1);
186add_action('do_feed_rss2', 'do_feed_rss2', 10, 1);
187add_action('do_feed_atom', 'do_feed_atom', 10, 1);
188add_action('do_pings', 'do_all_pings', 10, 1);
189add_action('do_generic_ping', 'generic_ping', 10, 1);
190add_action('do_robots', 'do_robots');
191add_action('sanitize_comment_cookies', 'sanitize_comment_cookies');
192add_action('admin_print_scripts', 'print_head_scripts', 20);
193add_action('admin_print_footer_scripts', 'print_footer_scripts', 20);
194add_action('admin_print_styles', 'print_admin_styles', 20);
195add_action('init', 'smilies_init', 5);
196add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 );
197add_action( 'shutdown', 'wp_ob_end_flush_all', 1);
198add_action( 'pre_post_update', 'wp_save_post_revision' );
199add_action('publish_post', '_publish_post_hook', 5, 1);
200add_action('future_post', '_future_post_hook', 5, 2);
201add_action('future_page', '_future_post_hook', 5, 2);
202add_action('save_post', '_save_post_hook', 5, 2);
203add_action('transition_post_status', '_transition_post_status', 5, 3);
204add_action('comment_form', 'wp_comment_form_unfiltered_html_nonce');
205// Redirect Old Slugs
206add_action('template_redirect', 'wp_old_slug_redirect');
207add_action('edit_post', 'wp_check_for_changed_slugs');
208add_action('edit_form_advanced', 'wp_remember_old_slug');
209add_action('init', '_show_post_preview');
210
211add_filter('pre_option_gmt_offset','wp_timezone_override_offset');
212
213?>
Note: See TracBrowser for help on using the repository browser.