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