Adjustments to [15549]. See #11624.

git-svn-id: http://svn.automattic.com/wordpress/trunk@15563 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-09-04 15:51:04 +00:00
parent 713b3c1b82
commit 650f97e684
3 changed files with 21 additions and 21 deletions

View File

@ -545,11 +545,11 @@ function comments_link( $deprecated = '', $deprecated_2 = '' ) {
* @return int The number of comments a post has * @return int The number of comments a post has
*/ */
function get_comments_number( $post_id = 0 ) { function get_comments_number( $post_id = 0 ) {
$post_id = absint( $post_id );
if ( !$post_id ) if ( !$post_id )
$post_id = get_the_ID(); $post_id = get_the_ID();
$post_id = absint($post_id);
$post = get_post($post_id); $post = get_post($post_id);
if ( ! isset($post->comment_count) ) if ( ! isset($post->comment_count) )
$count = 0; $count = 0;

View File

@ -461,13 +461,13 @@ function get_feed_link($feed = '') {
* @param string $feed Optional. Feed type. * @param string $feed Optional. Feed type.
* @return string * @return string
*/ */
function get_post_comments_feed_link($post_id = '', $feed = '') { function get_post_comments_feed_link($post_id = 0, $feed = '') {
if ( !$post_id ) $post_id = absint( $post_id );
if ( ! $post_id )
$post_id = get_the_ID(); $post_id = get_the_ID();
$post_id = absint($post_id); if ( empty( $feed ) )
if ( empty($feed) )
$feed = get_default_feed(); $feed = get_default_feed();
if ( '' != get_option('permalink_structure') ) { if ( '' != get_option('permalink_structure') ) {

View File

@ -1267,16 +1267,16 @@ function delete_post_meta_by_key($post_meta_key) {
* @param int $post_id post ID * @param int $post_id post ID
* @return array * @return array
*/ */
function get_post_custom($post_id = 0) { function get_post_custom( $post_id = 0 ) {
if ( !$post_id ) $post_id = absint( $post_id );
if ( ! $post_id )
$post_id = get_the_ID(); $post_id = get_the_ID();
$post_id = (int) $post_id; if ( ! wp_cache_get( $post_id, 'post_meta' ) )
update_postmeta_cache( $post_id );
if ( ! wp_cache_get($post_id, 'post_meta') ) return wp_cache_get( $post_id, 'post_meta' );
update_postmeta_cache($post_id);
return wp_cache_get($post_id, 'post_meta');
} }
/** /**
@ -1333,18 +1333,18 @@ function get_post_custom_values( $key = '', $post_id = 0 ) {
* @param int $post_id Optional. Post ID. * @param int $post_id Optional. Post ID.
* @return bool Whether post is sticky. * @return bool Whether post is sticky.
*/ */
function is_sticky($post_id = null) { function is_sticky( $post_id = 0 ) {
if ( !$post_id ) $post_id = absint( $post_id );
if ( ! $post_id )
$post_id = get_the_ID(); $post_id = get_the_ID();
$post_id = absint($post_id); $stickies = get_option( 'sticky_posts' );
$stickies = get_option('sticky_posts'); if ( ! is_array( $stickies ) )
if ( !is_array($stickies) )
return false; return false;
if ( in_array($post_id, $stickies) ) if ( in_array( $post_id, $stickies ) )
return true; return true;
return false; return false;