root/tags/2.1/wp-includes/default-filters.php

Revision 4556, 6.5 kB (checked in by markjaquith, 2 years ago)

Remember old post slugs and automatically redirect to the new slug. fixes #3202

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php
2
3 // Some default filters
4 add_filter('bloginfo','wp_specialchars');
5 add_filter('category_description', 'wptexturize');
6 add_filter('list_cats', 'wptexturize');
7 add_filter('comment_author', 'wptexturize');
8 add_filter('comment_text', 'wptexturize');
9 add_filter('single_post_title', 'wptexturize');
10 add_filter('the_title', 'wptexturize');
11 add_filter('the_content', 'wptexturize');
12 add_filter('the_excerpt', 'wptexturize');
13 add_filter('bloginfo', 'wptexturize');
14
15 // Comments, trackbacks, pingbacks
16 add_filter('pre_comment_author_name', 'strip_tags');
17 add_filter('pre_comment_author_name', 'trim');
18 add_filter('pre_comment_author_name', 'wp_specialchars', 30);
19
20 add_filter('pre_comment_author_email', 'trim');
21 add_filter('pre_comment_author_email', 'sanitize_email');
22
23 add_filter('pre_comment_author_url', 'strip_tags');
24 add_filter('pre_comment_author_url', 'trim');
25 add_filter('pre_comment_author_url', 'clean_url');
26
27 add_filter('pre_comment_content', 'wp_rel_nofollow', 15);
28 add_filter('pre_comment_content', 'balanceTags', 30);
29
30 add_filter('pre_comment_author_name', 'wp_filter_kses');
31 add_filter('pre_comment_author_email', 'wp_filter_kses');
32 add_filter('pre_comment_author_url', 'wp_filter_kses');
33
34 // Default filters for these functions
35 add_filter('comment_author', 'wptexturize');
36 add_filter('comment_author', 'convert_chars');
37 add_filter('comment_author', 'wp_specialchars');
38
39 add_filter('comment_email', 'antispambot');
40
41 add_filter('comment_flood_filter', 'wp_throttle_comment_flood', 10, 3);
42
43 add_filter('comment_url', 'clean_url');
44
45 add_filter('comment_text', 'convert_chars');
46 add_filter('comment_text', 'make_clickable');
47 add_filter('comment_text', 'force_balance_tags', 25);
48 add_filter('comment_text', 'wpautop', 30);
49 add_filter('comment_text', 'convert_smilies', 20);
50
51 add_filter('comment_excerpt', 'convert_chars');
52
53 // Categories
54 add_filter('pre_category_name', 'strip_tags');
55 add_filter('pre_category_name', 'trim');
56 add_filter('pre_category_name', 'wp_filter_kses');
57 add_filter('pre_category_name', 'wp_specialchars', 30);
58 add_filter('pre_category_description', 'wp_filter_kses');
59
60 //Links
61 add_filter('pre_link_name', 'strip_tags');
62 add_filter('pre_link_name', 'trim');
63 add_filter('pre_link_name', 'wp_filter_kses');
64 add_filter('pre_link_name', 'wp_specialchars', 30);
65 add_filter('pre_link_description', 'wp_filter_kses');
66 add_filter('pre_link_notes', 'wp_filter_kses');
67 add_filter('pre_link_url', 'strip_tags');
68 add_filter('pre_link_url', 'trim');
69 add_filter('pre_link_url', 'clean_url');
70 add_filter('pre_link_image', 'strip_tags');
71 add_filter('pre_link_image', 'trim');
72 add_filter('pre_link_image', 'clean_url');
73 add_filter('pre_link_rss', 'strip_tags');
74 add_filter('pre_link_rss', 'trim');
75 add_filter('pre_link_rss', 'clean_url');
76 add_filter('pre_link_target', 'strip_tags');
77 add_filter('pre_link_target', 'trim');
78 add_filter('pre_link_target', 'wp_filter_kses');
79 add_filter('pre_link_target', 'wp_specialchars', 30);
80 add_filter('pre_link_rel', 'strip_tags');
81 add_filter('pre_link_rel', 'trim');
82 add_filter('pre_link_rel', 'wp_filter_kses');
83 add_filter('pre_link_rel', 'wp_specialchars', 30);
84
85 // Users
86 add_filter('pre_user_display_name', 'strip_tags');
87 add_filter('pre_user_display_name', 'trim');
88 add_filter('pre_user_display_name', 'wp_filter_kses');
89 add_filter('pre_user_display_name', 'wp_specialchars', 30);
90 add_filter('pre_user_first_name', 'strip_tags');
91 add_filter('pre_user_first_name', 'trim');
92 add_filter('pre_user_first_name', 'wp_filter_kses');
93 add_filter('pre_user_first_name', 'wp_specialchars', 30);
94 add_filter('pre_user_last_name', 'strip_tags');
95 add_filter('pre_user_last_name', 'trim');
96 add_filter('pre_user_last_name', 'wp_filter_kses');
97 add_filter('pre_user_last_name', 'wp_specialchars', 30);
98 add_filter('pre_user_nickname', 'strip_tags');
99 add_filter('pre_user_nickname', 'trim');
100 add_filter('pre_user_nickname', 'wp_filter_kses');
101 add_filter('pre_user_nickname', 'wp_specialchars', 30);
102 add_filter('pre_user_description', 'trim');
103 add_filter('pre_user_description', 'wp_filter_kses');
104 add_filter('pre_user_url', 'strip_tags');
105 add_filter('pre_user_url', 'trim');
106 add_filter('pre_user_url', 'clean_url');
107 add_filter('pre_user_email', 'trim');
108 add_filter('pre_user_email', 'sanitize_email');
109
110 // Places to balance tags on input
111 add_filter('content_save_pre', 'balanceTags', 50);
112 add_filter('excerpt_save_pre', 'balanceTags', 50);
113 add_filter('comment_save_pre', 'balanceTags', 50);
114
115 // Misc. title, content, and excerpt filters
116 add_filter('the_title', 'convert_chars');
117 add_filter('the_title', 'trim');
118
119 add_filter('the_content', 'convert_smilies');
120 add_filter('the_content', 'convert_chars');
121 add_filter('the_content', 'wpautop');
122
123 add_filter('the_excerpt', 'convert_smilies');
124 add_filter('the_excerpt', 'convert_chars');
125 add_filter('the_excerpt', 'wpautop');
126 add_filter('get_the_excerpt', 'wp_trim_excerpt');
127
128 add_filter('sanitize_title', 'sanitize_title_with_dashes');
129
130 // RSS filters
131 add_filter('the_title_rss', 'strip_tags');
132 add_filter('the_title_rss', 'ent2ncr', 8);
133 add_filter('the_title_rss', 'wp_specialchars');
134 add_filter('the_content_rss', 'ent2ncr', 8);
135 add_filter('the_excerpt_rss', 'convert_chars');
136 add_filter('the_excerpt_rss', 'ent2ncr', 8);
137 add_filter('comment_author_rss', 'ent2ncr', 8);
138 add_filter('comment_text_rss', 'wp_specialchars');
139 add_filter('comment_text_rss', 'ent2ncr', 8);
140 add_filter('bloginfo_rss', 'ent2ncr', 8);
141 add_filter('the_author', 'ent2ncr', 8);
142
143 // Misc filters
144 add_filter('option_ping_sites', 'privacy_ping_filter');
145 add_filter('option_blog_charset', 'wp_specialchars');
146 add_filter('mce_plugins', '_mce_load_rtl_plugin');
147 add_filter('mce_buttons', '_mce_add_direction_buttons');
148
149 // Redirect Old Slugs
150 add_action('template_redirect', 'wp_old_slug_redirect');
151 add_action('edit_post', 'wp_check_for_changed_slugs');
152 add_action('edit_form_advanced', 'wp_remember_old_slug');
153
154 // Actions
155 add_action('wp_head', 'rsd_link');
156 add_action('wp_head', 'locale_stylesheet');
157 add_action('publish_future_post', 'wp_publish_post', 10, 1);
158 add_action('wp_head', 'noindex', 1);
159 add_action('wp_head', 'wp_print_scripts');
160 if(!defined('DOING_CRON'))
161     add_action('init', 'wp_cron');
162 add_action('do_feed_rdf', 'do_feed_rdf', 10, 1);
163 add_action('do_feed_rss', 'do_feed_rss', 10, 1);
164 add_action('do_feed_rss2', 'do_feed_rss2', 10, 1);
165 add_action('do_feed_atom', 'do_feed_atom', 10, 1);
166 add_action('do_pings', 'do_all_pings', 10, 1);
167 add_action('do_robots', 'do_robots');
168 add_action('sanitize_comment_cookies', 'sanitize_comment_cookies');
169 add_action('admin_print_scripts', 'wp_print_scripts', 20);
170 add_action('mce_options', '_mce_set_direction');
171 ?>
172
Note: See TracBrowser for help on using the browser.