Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r18087 r17053  
    214214            'post_ID' => '',
    215215            'post_id' => 0,
    216             'post_author' => '',
    217             'post_name' => '',
    218             'post_parent' => '',
    219             'post_status' => '',
    220             'post_type' => '',
    221216            'status' => '',
    222217            'type' => '',
     
    325320            $where .= $this->get_search_sql( $search, array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_content' ) );
    326321
    327         $post_fields = array_filter( compact( array( 'post_author', 'post_name', 'post_parent', 'post_status', 'post_type', ) ) );
    328         if ( ! empty( $post_fields ) ) {
    329             $join = "JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID";
    330             foreach( $post_fields as $field_name => $field_value )
    331                 $where .= $wpdb->prepare( " AND {$wpdb->posts}.{$field_name} = %s", $field_value );
    332         }
    333 
    334322        $pieces = array( 'fields', 'join', 'where', 'orderby', 'order', 'limits' );
    335323        $clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$this ) );
     
    905893    $total = 0;
    906894    $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed');
     895    $known_types = array_keys( $approved );
    907896    foreach ( (array) $count as $row ) {
    908897        // Don't count post-trashed toward totals
    909898        if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] )
    910899            $total += $row['num_comments'];
    911         if ( isset( $approved[$row['comment_approved']] ) )
     900        if ( in_array( $row['comment_approved'], $known_types ) )
    912901            $stats[$approved[$row['comment_approved']]] = $row['num_comments'];
    913902    }
     
    14061395    }
    14071396
    1408     $comment_old = clone get_comment($comment_id);
     1397    $comment_old = wp_clone(get_comment($comment_id));
    14091398
    14101399    if ( !$wpdb->update( $wpdb->comments, array('comment_approved' => $status), array('comment_ID' => $comment_id) ) ) {
     
    16201609        return false;
    16211610
    1622     if ( wp_remote_retrieve_header( $response, 'x-pingback' ) )
    1623         return wp_remote_retrieve_header( $response, 'x-pingback' );
     1611    if ( isset( $response['headers']['x-pingback'] ) )
     1612        return $response['headers']['x-pingback'];
    16241613
    16251614    // Not an (x)html, sgml, or xml page, no use going further.
    1626     if ( preg_match('#(image|audio|video|model)/#is', wp_remote_retrieve_header( $response, 'content-type' )) )
     1615    if ( isset( $response['headers']['content-type'] ) && preg_match('#(image|audio|video|model)/#is', $response['headers']['content-type']) )
    16271616        return false;
    16281617
     
    16331622        return false;
    16341623
    1635     $contents = wp_remote_retrieve_body( $response );
     1624    $contents = $response['body'];
    16361625
    16371626    $pingback_link_offset_dquote = strpos($contents, $pingback_str_dquote);
     
    19661955        return $posts;
    19671956
    1968     $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) );
    1969     if ( ! in_array( $posts[0]->post_type, $post_types ) )
    1970         return $posts;
    1971 
    19721957    $days_old = (int) get_option('close_comments_days_old');
    19731958    if ( !$days_old )
     
    20051990    $post = get_post($post_id);
    20061991
    2007     $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) );
    2008     if ( ! in_array( $post->post_type, $post_types ) )
    2009         return $open;
    2010 
    20111992    if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * 24 * 60 * 60 ) )
    20121993        return false;
Note: See TracChangeset for help on using the changeset viewer.