Changeset 16020
- Timestamp:
- 10/27/2010 07:05:39 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment.php
r16019 r16020 293 293 if ( !empty($number) ) { 294 294 if ( $offset ) 295 $limit = 'LIMIT ' . $offset . ',' . $number;295 $limits = 'LIMIT ' . $offset . ',' . $number; 296 296 else 297 $limit = 'LIMIT ' . $number;297 $limits = 'LIMIT ' . $number; 298 298 } else { 299 $limit = '';299 $limits = ''; 300 300 } 301 301 302 $where = "WHERE $approved"; 302 if ( $count ) 303 $fields = 'COUNT(*)'; 304 else 305 $fields = '*'; 306 307 $join = ''; 308 $where = $approved; 303 309 304 310 if ( ! empty($post_id) ) … … 319 325 $where .= $this->get_search_sql( $search, array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_content' ) ); 320 326 321 $pieces = array( ' where', 'orderby', 'order', 'limit' );327 $pieces = array( 'fields', 'join', 'where', 'orderby', 'order', 'limits' ); 322 328 $clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$this ) ); 323 329 foreach ( $pieces as $piece ) 324 330 $$piece = isset( $clauses[ $piece ] ) ? $clauses[ $piece ] : ''; 325 331 332 $query = "SELECT $fields FROM $wpdb->comments $join WHERE $where ORDER BY $orderby $order $limits"; 333 326 334 if ( $count ) 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");335 return $wpdb->get_var( $query ); 336 337 $comments = $wpdb->get_results( $query ); 330 338 $comments = apply_filters_ref_array( 'the_comments', array( $comments, &$this ) ); 331 339
Note: See TracChangeset
for help on using the changeset viewer.