Changeset 9296 for trunk/wp-includes/comment.php
- Timestamp:
- 10/23/2008 04:08:47 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment.php
r9292 r9296 482 482 483 483 /** 484 * Calculate the total number of comment pages. 485 * 486 * @since 2.7.0 487 * 488 * @param array $comments Optional array of comment objects. Defaults to $wp_query->comments 489 * @param int $per_page Optional comments per page. 490 * @param boolean $threaded Optional control over flat or threaded comments. 491 * @return int Number of comment pages. 492 */ 493 function get_comment_pages_count( $comments = null, $per_page = null, $threaded = null ) { 494 global $wp_query; 495 496 if ( !$comments || !is_array($comments) ) 497 $comments = $wp_query->comments; 498 499 if ( empty($comments) ) 500 return 0; 501 502 if ( !isset($per_page) ) 503 $per_page = (int) get_query_var('comments_per_page'); 504 if ( 0 === $per_page ) 505 $per_page = (int) get_option('comments_per_page'); 506 if ( 0 === $per_page ) 507 return 1; 508 509 if ( !isset($threaded) ) 510 $threaded = get_option('thread_comments'); 511 512 if ( $threaded ) { 513 $walker = new Walker_Comment; 514 $count = ceil( $walker->get_number_of_root_elements( $comments ) / $per_page ); 515 } else { 516 $count = ceil( count( $comments ) / $per_page ); 517 } 518 519 return $count; 520 } 521 522 /** 484 523 * Does comment contain blacklisted characters or words. 485 524 *
Note: See TracChangeset
for help on using the changeset viewer.