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