Changeset 16019
- Timestamp:
- 10/27/2010 06:49:45 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment.php
r16018 r16019 230 230 231 231 $this->query_vars = wp_parse_args( $query_vars, $defaults ); 232 232 do_action_ref_array( 'pre_get_comments', array( &$this ) ); 233 233 extract( $this->query_vars, EXTR_SKIP ); 234 234 … … 300 300 } 301 301 302 $ post_where = "WHERE $approved";302 $where = "WHERE $approved"; 303 303 304 304 if ( ! empty($post_id) ) 305 $ post_where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id );305 $where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id ); 306 306 if ( '' !== $author_email ) 307 $ post_where .= $wpdb->prepare( 'AND comment_author_email = %s', $author_email );307 $where .= $wpdb->prepare( ' AND comment_author_email = %s', $author_email ); 308 308 if ( '' !== $karma ) 309 $ post_where .= $wpdb->prepare( 'AND comment_karma = %d', $karma );309 $where .= $wpdb->prepare( ' AND comment_karma = %d', $karma ); 310 310 if ( 'comment' == $type ) 311 $ post_where .= " AND comment_type = ''";311 $where .= " AND comment_type = ''"; 312 312 elseif ( ! empty( $type ) ) 313 $ post_where .= $wpdb->prepare( ' AND comment_type = %s', $type );313 $where .= $wpdb->prepare( ' AND comment_type = %s', $type ); 314 314 if ( '' !== $parent ) 315 $ post_where .= $wpdb->prepare( ' AND comment_parent = %d', $parent );315 $where .= $wpdb->prepare( ' AND comment_parent = %d', $parent ); 316 316 if ( '' !== $user_id ) 317 $ post_where .= $wpdb->prepare( ' AND user_id = %d', $user_id );317 $where .= $wpdb->prepare( ' AND user_id = %d', $user_id ); 318 318 if ( '' !== $search ) 319 $post_where .= $this->get_search_sql( $search, array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_content' ) ); 319 $where .= $this->get_search_sql( $search, array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_content' ) ); 320 321 $pieces = array( 'where', 'orderby', 'order', 'limit' ); 322 $clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$this ) ); 323 foreach ( $pieces as $piece ) 324 $$piece = isset( $clauses[ $piece ] ) ? $clauses[ $piece ] : ''; 320 325 321 326 if ( $count ) 322 return $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments $post_where ORDER BY $orderby $order $limit" ); 323 324 $comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments $post_where ORDER BY $orderby $order $limit" ); 327 return $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments $where ORDER BY $orderby $order $limit" ); 328 329 $comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments $where ORDER BY $orderby $order $limit" ); 330 $comments = apply_filters_ref_array( 'the_comments', array( $comments, &$this ) ); 325 331 326 332 wp_cache_add( $cache_key, $comments, 'comment' );
Note: See TracChangeset
for help on using the changeset viewer.