Changeset 12062 for trunk/wp-includes/post.php
- Timestamp:
- 10/19/2009 09:28:44 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r12054 r12062 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) ) … … 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 ) { … … 818 820 function sanitize_post($post, $context = 'display') { 819 821 if ( is_object($post) ) { 822 // Check if post already filtered for this context 823 if ( isset($post->filter) && $context == $post->filter ) 824 return $post; 820 825 if ( !isset($post->ID) ) 821 826 $post->ID = 0; … … 824 829 $post->filter = $context; 825 830 } else { 831 // Check if post already filtered for this context 832 if ( isset($post['filter']) && $context == $post['filter'] ) 833 return $post; 826 834 if ( !isset($post['ID']) ) 827 835 $post['ID'] = 0; … … 2451 2459 } 2452 2460 2461 // Sanitize before caching so it'll only get done once 2462 $num_pages = count($pages); 2463 for ($i = 0; $i < $num_pages; $i++) { 2464 $pages[$i] = sanitize_post($pages[$i], 'raw'); 2465 } 2466 2453 2467 // Update cache. 2454 2468 update_page_cache($pages); … … 2466 2480 $excludes[] = $child->ID; 2467 2481 $excludes[] = $exclude; 2468 $total = count($pages); 2469 for ( $i = 0; $i < $total; $i++ ) { 2482 for ( $i = 0; $i < $num_pages; $i++ ) { 2470 2483 if ( in_array($pages[$i]->ID, $excludes) ) 2471 2484 unset($pages[$i]);
Note: See TracChangeset
for help on using the changeset viewer.