Changes in trunk/wp-includes/comment.php [18087:17053]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment.php
r18087 r17053 214 214 'post_ID' => '', 215 215 'post_id' => 0, 216 'post_author' => '',217 'post_name' => '',218 'post_parent' => '',219 'post_status' => '',220 'post_type' => '',221 216 'status' => '', 222 217 'type' => '', … … 325 320 $where .= $this->get_search_sql( $search, array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_content' ) ); 326 321 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 334 322 $pieces = array( 'fields', 'join', 'where', 'orderby', 'order', 'limits' ); 335 323 $clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$this ) ); … … 905 893 $total = 0; 906 894 $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed'); 895 $known_types = array_keys( $approved ); 907 896 foreach ( (array) $count as $row ) { 908 897 // Don't count post-trashed toward totals 909 898 if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) 910 899 $total += $row['num_comments']; 911 if ( i sset( $approved[$row['comment_approved']]) )900 if ( in_array( $row['comment_approved'], $known_types ) ) 912 901 $stats[$approved[$row['comment_approved']]] = $row['num_comments']; 913 902 } … … 1406 1395 } 1407 1396 1408 $comment_old = clone get_comment($comment_id);1397 $comment_old = wp_clone(get_comment($comment_id)); 1409 1398 1410 1399 if ( !$wpdb->update( $wpdb->comments, array('comment_approved' => $status), array('comment_ID' => $comment_id) ) ) { … … 1620 1609 return false; 1621 1610 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']; 1624 1613 1625 1614 // 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']) ) 1627 1616 return false; 1628 1617 … … 1633 1622 return false; 1634 1623 1635 $contents = wp_remote_retrieve_body( $response );1624 $contents = $response['body']; 1636 1625 1637 1626 $pingback_link_offset_dquote = strpos($contents, $pingback_str_dquote); … … 1966 1955 return $posts; 1967 1956 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 1972 1957 $days_old = (int) get_option('close_comments_days_old'); 1973 1958 if ( !$days_old ) … … 2005 1990 $post = get_post($post_id); 2006 1991 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 2011 1992 if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * 24 * 60 * 60 ) ) 2012 1993 return false;
Note: See TracChangeset
for help on using the changeset viewer.