Make WordPress Core

Changeset 15563


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

Adjustments to [15549]. See #11624.

Location:
trunk/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment-template.php

    r15549 r15563  
    546546 */
    547547function get_comments_number( $post_id = 0 ) {
     548        $post_id = absint( $post_id );
     549
    548550        if ( !$post_id )
    549551                $post_id = get_the_ID();
    550 
    551         $post_id = absint($post_id);
    552552
    553553        $post = get_post($post_id);
  • trunk/wp-includes/link-template.php

    r15549 r15563  
    462462 * @return string
    463463 */
    464 function get_post_comments_feed_link($post_id = '', $feed = '') {
    465         if ( !$post_id )
     464function get_post_comments_feed_link($post_id = 0, $feed = '') {
     465        $post_id = absint( $post_id );
     466
     467        if ( ! $post_id )
    466468                $post_id = get_the_ID();
    467469
    468         $post_id = absint($post_id);
    469 
    470         if ( empty($feed) )
     470        if ( empty( $feed ) )
    471471                $feed = get_default_feed();
    472472
  • 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.