WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/28/2010 11:57:28 AM (9 years ago)
Author:
scribu
Message:

Don't use the global anymore. Fixes #11624

File:
1 edited

Legend:

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

    r15433 r15549  
    546546 */
    547547function get_comments_number( $post_id = 0 ) {
    548     global $id;
    549     $post_id = (int) $post_id;
    550 
    551548    if ( !$post_id )
    552         $post_id = (int) $id;
     549        $post_id = get_the_ID();
     550
     551    $post_id = absint($post_id);
    553552
    554553    $post = get_post($post_id);
     
    565564 *
    566565 * @since 0.71
    567  * @uses $id
    568566 * @uses apply_filters() Calls the 'comments_number' hook on the output and number of comments respectively.
    569567 *
     
    574572 */
    575573function comments_number( $zero = false, $one = false, $more = false, $deprecated = '' ) {
    576     global $id;
    577 
    578574    if ( !empty( $deprecated ) )
    579575        _deprecated_argument( __FUNCTION__, '1.3' );
    580576
    581     $number = get_comments_number($id);
     577    $number = get_comments_number(get_the_ID());
    582578
    583579    if ( $number > 1 )
     
    704700 * @since 1.5.0
    705701 * @uses apply_filters() Calls 'trackback_url' on the resulting trackback URL
    706  * @uses $id
    707702 *
    708703 * @return string The trackback URL after being filtered
    709704 */
    710705function get_trackback_url() {
    711     global $id;
    712706    if ( '' != get_option('permalink_structure') ) {
    713707        $tb_url = trailingslashit(get_permalink()) . user_trailingslashit('trackback', 'single_trackback');
    714708    } else {
    715         $tb_url = get_option('siteurl') . '/wp-trackback.php?p=' . $id;
     709        $tb_url = get_option('siteurl') . '/wp-trackback.php?p=' . get_the_ID();
    716710    }
    717711    return apply_filters('trackback_url', $tb_url);
     
    845839 * @global array $comment List of comment objects for the current post
    846840 * @uses $wpdb
    847  * @uses $id
    848841 * @uses $post
    849842 * @uses $withcomments Will not try to get the comments if the post has none.
     
    962955 *
    963956 * @since 0.71
    964  * @uses $id
    965957 * @uses $wpcommentspopupfile
    966958 * @uses $wpcommentsjavascript
     
    975967 */
    976968function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
    977     global $id, $wpcommentspopupfile, $wpcommentsjavascript;
     969    global $wpcommentspopupfile, $wpcommentsjavascript;
     970
     971    $id = get_the_ID();
    978972
    979973    if ( false === $zero ) $zero = __( 'No Comments' );
     
    11691163 */
    11701164function get_comment_id_fields() {
    1171     global $id;
     1165    $id = get_the_ID();
    11721166
    11731167    $replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;
Note: See TracChangeset for help on using the changeset viewer.