Ticket #10972: posts-only-sanitize-once.patch
| File posts-only-sanitize-once.patch, 2.2 KB (added by , 16 years ago) |
|---|
-
wp-includes/default-filters.php
151 151 add_filter( 'comment_email', 'antispambot' ); 152 152 add_filter( 'option_tag_base', '_wp_filter_taxonomy_base' ); 153 153 add_filter( 'option_category_base', '_wp_filter_taxonomy_base' ); 154 add_filter( 'the_posts', '_sanitize_the_posts' ); 154 155 add_filter( 'the_posts', '_close_comments_for_old_posts' ); 155 156 add_filter( 'comments_open', '_close_comments_for_old_post', 10, 2 ); 156 157 add_filter( 'pings_open', '_close_comments_for_old_post', 10, 2 ); -
wp-includes/post.php
232 232 return $null; 233 233 } elseif ( is_object($post) && empty($post->filter) ) { 234 234 _get_post_ancestors($post); 235 wp_cache_add($post->ID, $post, 'posts');236 $_post = &$post;235 $_post = sanitize_post($post, 'raw'); 236 wp_cache_add($post->ID, $_post, 'posts'); 237 237 } else { 238 238 if ( is_object($post) ) 239 239 $post = $post->ID; … … 243 243 if ( ! $_post ) 244 244 return $null; 245 245 _get_post_ancestors($_post); 246 $_post = sanitize_post($_post, 'raw'); 246 247 wp_cache_add($_post->ID, $_post, 'posts'); 247 248 } 248 249 } 249 250 250 $_post = sanitize_post($_post, $filter); 251 if ($filter != 'raw') 252 $_post = sanitize_post($_post, $filter); 251 253 252 254 if ( $output == OBJECT ) { 253 255 return $_post; … … 834 836 } 835 837 836 838 /** 839 * Sanitize (filter 'raw') all posts returned in wp_query, once. Hooked to the_posts. 840 * 841 * @access private 842 * @since 2.9.0 843 * 844 * @param array $posts Array of post data objects. 845 * @return array Sanitized posts objects 846 */ 847 function _sanitize_the_posts( $posts ) { 848 if ( empty($posts) ) 849 return $posts; 850 851 $num_posts = count($posts); 852 for ($i = 0; $i < $num_posts; $i++) { 853 $posts[$i] = sanitize_post($posts[$i], 'raw'); 854 } 855 856 return $posts; 857 } 858 859 /** 837 860 * Sanitize post field based on context. 838 861 * 839 862 * Possible context values are: 'raw', 'edit', 'db', 'display', 'attribute' and 'js'. The