2005-02-07 08:46:41 +01:00
|
|
|
<?php
|
|
|
|
|
2007-08-21 00:50:04 +02:00
|
|
|
// Strip, trim, kses, special chars for string saves
|
|
|
|
$filters = 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');
|
|
|
|
foreach ( $filters as $filter ) {
|
|
|
|
add_filter($filter, 'strip_tags');
|
|
|
|
add_filter($filter, 'trim');
|
|
|
|
add_filter($filter, 'wp_filter_kses');
|
|
|
|
add_filter($filter, 'wp_specialchars', 30);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Kses only for textarea saves
|
|
|
|
$filters = array('pre_term_description', 'pre_link_description', 'pre_link_notes', 'pre_user_description');
|
|
|
|
foreach ( $filters as $filter ) {
|
|
|
|
add_filter($filter, 'wp_filter_kses');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Email
|
|
|
|
$filters = array('pre_comment_author_email', 'pre_user_email');
|
|
|
|
foreach ( $filters as $filter ) {
|
|
|
|
add_filter($filter, 'trim');
|
|
|
|
add_filter($filter, 'sanitize_email');
|
|
|
|
add_filter($filter, 'wp_filter_kses');
|
|
|
|
}
|
|
|
|
|
|
|
|
// URL
|
|
|
|
$filters = array('pre_comment_author_url', 'pre_user_url', 'pre_link_url', 'pre_link_image',
|
|
|
|
'pre_link_rss', 'comment_url');
|
|
|
|
foreach ( $filters as $filter ) {
|
|
|
|
add_filter($filter, 'strip_tags');
|
|
|
|
add_filter($filter, 'trim');
|
|
|
|
add_filter($filter, 'clean_url');
|
|
|
|
add_filter($filter, 'wp_filter_kses');
|
|
|
|
}
|
2006-05-27 00:47:13 +02:00
|
|
|
|
2007-08-24 16:44:26 +02:00
|
|
|
// Slugs
|
|
|
|
$filters = array('pre_term_slug');
|
|
|
|
foreach ( $filters as $filter ) {
|
|
|
|
add_filter($filter, 'sanitize_title');
|
|
|
|
}
|
|
|
|
|
2005-02-07 08:46:41 +01:00
|
|
|
// Places to balance tags on input
|
2007-08-21 00:50:04 +02:00
|
|
|
$filters = array('content_save_pre', 'excerpt_save_pre', 'comment_save_pre', 'pre_comment_content');
|
|
|
|
foreach ( $filters as $filter ) {
|
|
|
|
add_filter( $filter, 'balanceTags', 50);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Format strings for display.
|
2007-09-20 20:23:33 +02:00
|
|
|
$filters = array('comment_author', 'term_name', 'link_name', 'link_description',
|
2007-09-05 05:11:04 +02:00
|
|
|
'link_notes', 'bloginfo', 'wp_title');
|
2007-08-21 00:50:04 +02:00
|
|
|
foreach ( $filters as $filter ) {
|
|
|
|
add_filter($filter, 'wptexturize');
|
|
|
|
add_filter($filter, 'convert_chars');
|
|
|
|
add_filter($filter, 'wp_specialchars');
|
|
|
|
}
|
|
|
|
|
2007-09-20 20:23:33 +02:00
|
|
|
// Format text area for display.
|
|
|
|
$filters = array('term_description');
|
|
|
|
foreach ( $filters as $filter ) {
|
|
|
|
add_filter($filter, 'wptexturize');
|
|
|
|
add_filter($filter, 'convert_chars');
|
|
|
|
add_filter($filter, 'wpautop');
|
|
|
|
}
|
|
|
|
|
2007-08-29 23:10:20 +02:00
|
|
|
// Format for RSS
|
|
|
|
$filters = array('term_name_rss');
|
|
|
|
foreach ( $filters as $filter ) {
|
|
|
|
add_filter($filter, 'convert_chars');
|
|
|
|
}
|
|
|
|
|
2007-08-21 00:50:04 +02:00
|
|
|
// Display filters
|
|
|
|
add_filter('the_title', 'wptexturize');
|
2005-02-07 08:46:41 +01:00
|
|
|
add_filter('the_title', 'convert_chars');
|
|
|
|
add_filter('the_title', 'trim');
|
|
|
|
|
2007-08-21 00:50:04 +02:00
|
|
|
add_filter('the_content', 'wptexturize');
|
2005-02-07 08:46:41 +01:00
|
|
|
add_filter('the_content', 'convert_smilies');
|
|
|
|
add_filter('the_content', 'convert_chars');
|
|
|
|
add_filter('the_content', 'wpautop');
|
|
|
|
|
2007-08-21 00:50:04 +02:00
|
|
|
add_filter('the_excerpt', 'wptexturize');
|
2005-02-07 08:46:41 +01:00
|
|
|
add_filter('the_excerpt', 'convert_smilies');
|
|
|
|
add_filter('the_excerpt', 'convert_chars');
|
|
|
|
add_filter('the_excerpt', 'wpautop');
|
2005-02-15 01:21:21 +01:00
|
|
|
add_filter('get_the_excerpt', 'wp_trim_excerpt');
|
|
|
|
|
2007-08-21 00:50:04 +02:00
|
|
|
add_filter('comment_text', 'wptexturize');
|
|
|
|
add_filter('comment_text', 'convert_chars');
|
|
|
|
add_filter('comment_text', 'make_clickable', 9);
|
|
|
|
add_filter('comment_text', 'force_balance_tags', 25);
|
|
|
|
add_filter('comment_text', 'convert_smilies', 20);
|
|
|
|
add_filter('comment_text', 'wpautop', 30);
|
|
|
|
|
|
|
|
add_filter('comment_excerpt', 'convert_chars');
|
|
|
|
|
|
|
|
add_filter('list_cats', 'wptexturize');
|
|
|
|
add_filter('single_post_title', 'wptexturize');
|
2005-02-07 08:46:41 +01:00
|
|
|
|
2005-04-05 19:25:57 +02:00
|
|
|
// RSS filters
|
|
|
|
add_filter('the_title_rss', 'strip_tags');
|
|
|
|
add_filter('the_title_rss', 'ent2ncr', 8);
|
2006-07-26 19:43:15 +02:00
|
|
|
add_filter('the_title_rss', 'wp_specialchars');
|
2005-04-05 19:25:57 +02:00
|
|
|
add_filter('the_content_rss', 'ent2ncr', 8);
|
|
|
|
add_filter('the_excerpt_rss', 'convert_chars');
|
|
|
|
add_filter('the_excerpt_rss', 'ent2ncr', 8);
|
|
|
|
add_filter('comment_author_rss', 'ent2ncr', 8);
|
|
|
|
add_filter('comment_text_rss', 'ent2ncr', 8);
|
2007-08-21 00:50:04 +02:00
|
|
|
add_filter('comment_text_rss', 'wp_specialchars');
|
2005-04-05 19:25:57 +02:00
|
|
|
add_filter('bloginfo_rss', 'ent2ncr', 8);
|
|
|
|
add_filter('the_author', 'ent2ncr', 8);
|
|
|
|
|
2006-02-18 08:40:43 +01:00
|
|
|
// Misc filters
|
|
|
|
add_filter('option_ping_sites', 'privacy_ping_filter');
|
2006-08-25 00:33:16 +02:00
|
|
|
add_filter('option_blog_charset', 'wp_specialchars');
|
2007-03-23 18:45:40 +01:00
|
|
|
add_filter('option_home', '_config_wp_home');
|
|
|
|
add_filter('option_siteurl', '_config_wp_siteurl');
|
2006-09-21 02:34:34 +02:00
|
|
|
add_filter('mce_plugins', '_mce_load_rtl_plugin');
|
|
|
|
add_filter('mce_buttons', '_mce_add_direction_buttons');
|
2007-08-21 00:50:04 +02:00
|
|
|
add_filter('pre_kses', 'wp_pre_kses_less_than');
|
|
|
|
add_filter('sanitize_title', 'sanitize_title_with_dashes');
|
2007-08-27 08:34:18 +02:00
|
|
|
add_action('check_comment_flood', 'check_comment_flood_db', 10, 3);
|
2007-08-21 00:50:04 +02:00
|
|
|
add_filter('comment_flood_filter', 'wp_throttle_comment_flood', 10, 3);
|
|
|
|
add_filter('pre_comment_content', 'wp_rel_nofollow', 15);
|
|
|
|
add_filter('comment_email', 'antispambot');
|
2006-11-30 09:48:56 +01:00
|
|
|
|
2005-04-05 19:25:57 +02:00
|
|
|
// Actions
|
2005-11-07 10:47:51 +01:00
|
|
|
add_action('wp_head', 'rsd_link');
|
2006-09-19 01:40:19 +02:00
|
|
|
add_action('wp_head', 'locale_stylesheet');
|
2006-02-12 08:41:56 +01:00
|
|
|
add_action('publish_future_post', 'wp_publish_post', 10, 1);
|
2006-02-18 08:40:43 +01:00
|
|
|
add_action('wp_head', 'noindex', 1);
|
2006-05-22 19:16:05 +02:00
|
|
|
add_action('wp_head', 'wp_print_scripts');
|
2006-03-07 23:34:05 +01:00
|
|
|
if(!defined('DOING_CRON'))
|
|
|
|
add_action('init', 'wp_cron');
|
2006-03-12 23:57:00 +01:00
|
|
|
add_action('do_feed_rdf', 'do_feed_rdf', 10, 1);
|
|
|
|
add_action('do_feed_rss', 'do_feed_rss', 10, 1);
|
|
|
|
add_action('do_feed_rss2', 'do_feed_rss2', 10, 1);
|
|
|
|
add_action('do_feed_atom', 'do_feed_atom', 10, 1);
|
2006-03-30 09:36:54 +02:00
|
|
|
add_action('do_pings', 'do_all_pings', 10, 1);
|
2006-05-23 00:06:06 +02:00
|
|
|
add_action('do_robots', 'do_robots');
|
2006-06-22 22:52:12 +02:00
|
|
|
add_action('sanitize_comment_cookies', 'sanitize_comment_cookies');
|
2006-08-29 01:08:48 +02:00
|
|
|
add_action('admin_print_scripts', 'wp_print_scripts', 20);
|
2006-09-21 02:34:34 +02:00
|
|
|
add_action('mce_options', '_mce_set_direction');
|
2007-03-12 22:31:24 +01:00
|
|
|
add_action('init', 'smilies_init', 5);
|
2007-05-01 03:58:18 +02:00
|
|
|
add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 );
|
2007-05-13 00:06:31 +02:00
|
|
|
add_action( 'shutdown', 'wp_ob_end_flush_all', 1);
|
2007-07-12 18:00:51 +02:00
|
|
|
add_action('publish_post', '_publish_post_hook', 5, 1);
|
|
|
|
add_action('future_post', '_future_post_hook', 5, 2);
|
|
|
|
add_action('future_page', '_future_post_hook', 5, 2);
|
|
|
|
add_action('save_post', '_save_post_hook', 5, 2);
|
|
|
|
add_action('transition_post_status', '_transition_post_status', 5, 3);
|
2007-08-21 00:50:04 +02:00
|
|
|
add_action('comment_form', 'wp_comment_form_unfiltered_html_nonce');
|
|
|
|
// Redirect Old Slugs
|
|
|
|
add_action('template_redirect', 'wp_old_slug_redirect');
|
|
|
|
add_action('edit_post', 'wp_check_for_changed_slugs');
|
|
|
|
add_action('edit_form_advanced', 'wp_remember_old_slug');
|
2007-05-01 03:13:06 +02:00
|
|
|
|
|
|
|
?>
|