2005-02-07 08:46:41 +01:00
|
|
|
<?php
|
2007-12-25 21:48:01 +01:00
|
|
|
/**
|
|
|
|
* Sets up the default filters and actions for most
|
|
|
|
* of the WordPress hooks.
|
|
|
|
*
|
|
|
|
* If you need to remove a default hook, this file will
|
|
|
|
* give you the priority for which to use to remove the
|
|
|
|
* hook.
|
|
|
|
*
|
|
|
|
* Not all of the default hooks are found in default-filters.php
|
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
*/
|
2005-02-07 08:46:41 +01:00
|
|
|
|
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');
|
|
|
|
}
|
|
|
|
|
2007-10-03 18:16:55 +02:00
|
|
|
// Save URL
|
2007-08-21 00:50:04 +02:00
|
|
|
$filters = array('pre_comment_author_url', 'pre_user_url', 'pre_link_url', 'pre_link_image',
|
2007-10-03 18:16:55 +02:00
|
|
|
'pre_link_rss');
|
|
|
|
foreach ( $filters as $filter ) {
|
|
|
|
add_filter($filter, 'strip_tags');
|
|
|
|
add_filter($filter, 'trim');
|
|
|
|
add_filter($filter, 'sanitize_url');
|
|
|
|
add_filter($filter, 'wp_filter_kses');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Display URL
|
|
|
|
$filters = array('user_url', 'link_url', 'link_image', 'link_rss', 'comment_url');
|
2007-08-21 00:50:04 +02:00
|
|
|
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');
|
|
|
|
}
|
|
|
|
|
2008-02-02 20:22:14 +01:00
|
|
|
// Keys
|
|
|
|
$filters = array('pre_post_type');
|
|
|
|
foreach ( $filters as $filter ) {
|
|
|
|
add_filter($filter, 'sanitize_user');
|
|
|
|
}
|
|
|
|
|
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');
|
2008-03-23 18:02:11 +01:00
|
|
|
add_filter('the_content', 'prepend_attachment');
|
2005-02-07 08:46:41 +01:00
|
|
|
|
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
|
|
|
|
2008-02-22 06:53:47 +01:00
|
|
|
add_filter('wp_sprintf', 'wp_sprintf_l', 10, 2);
|
|
|
|
|
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');
|
2008-02-11 18:45:18 +01:00
|
|
|
add_filter('tiny_mce_before_init', '_mce_set_direction');
|
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');
|
2008-06-29 10:20:25 +02:00
|
|
|
add_filter('option_tag_base', '_wp_filter_taxonomy_base');
|
|
|
|
add_filter('option_category_base', '_wp_filter_taxonomy_base');
|
2006-11-30 09:48:56 +01:00
|
|
|
|
2007-11-17 12:21:34 +01:00
|
|
|
//Atom SSL support
|
|
|
|
add_filter('atom_service_url','atom_service_url_filter');
|
|
|
|
|
2005-04-05 19:25:57 +02:00
|
|
|
// Actions
|
2005-11-07 10:47:51 +01:00
|
|
|
add_action('wp_head', 'rsd_link');
|
2007-10-05 19:29:34 +02:00
|
|
|
add_action('wp_head', 'wlwmanifest_link');
|
2006-09-19 01:40:19 +02:00
|
|
|
add_action('wp_head', 'locale_stylesheet');
|
2008-02-22 20:59:12 +01:00
|
|
|
add_action('publish_future_post', 'check_and_publish_future_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');
|
2007-10-06 08:55:24 +02:00
|
|
|
add_action('wp_head', 'wp_generator');
|
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);
|
2008-05-21 07:56:04 +02:00
|
|
|
add_action('admin_print_styles', 'wp_print_styles', 20);
|
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);
|
2008-05-30 00:21:36 +02:00
|
|
|
add_action( 'pre_post_update', 'wp_save_post_revision' );
|
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
|
|
|
|
2007-10-05 19:29:34 +02:00
|
|
|
?>
|