Make WordPress Core


Ignore:
Timestamp:
09/04/2010 03:51:04 PM (16 years ago)
Author:
nacin
Message:

Adjustments to [15549]. See #11624.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r15549 r15563  
    12681268 * @return array
    12691269 */
    1270 function get_post_custom($post_id = 0) {
    1271         if ( !$post_id )
     1270function get_post_custom( $post_id = 0 ) {
     1271        $post_id = absint( $post_id );
     1272
     1273        if ( ! $post_id )
    12721274                $post_id = get_the_ID();
    12731275
    1274         $post_id = (int) $post_id;
    1275 
    1276         if ( ! wp_cache_get($post_id, 'post_meta') )
    1277                 update_postmeta_cache($post_id);
    1278 
    1279         return wp_cache_get($post_id, 'post_meta');
     1276        if ( ! wp_cache_get( $post_id, 'post_meta' ) )
     1277                update_postmeta_cache( $post_id );
     1278
     1279        return wp_cache_get( $post_id, 'post_meta' );
    12801280}
    12811281
    … …  
    13341334 * @return bool Whether post is sticky.
    13351335 */
    1336 function is_sticky($post_id = null) {
    1337         if ( !$post_id )
     1336function is_sticky( $post_id = 0 ) {
     1337        $post_id = absint( $post_id );
     1338
     1339        if ( ! $post_id )
    13381340                $post_id = get_the_ID();
    13391341
    1340         $post_id = absint($post_id);
    1341 
    1342         $stickies = get_option('sticky_posts');
    1343 
    1344         if ( !is_array($stickies) )
     1342        $stickies = get_option( 'sticky_posts' );
     1343
     1344        if ( ! is_array( $stickies ) )
    13451345                return false;
    13461346
    1347         if ( in_array($post_id, $stickies) )
     1347        if ( in_array( $post_id, $stickies ) )
    13481348                return true;
    13491349
Note: See TracChangeset for help on using the changeset viewer.