Changeset 9296
- Timestamp:
- 10/23/2008 04:08:47 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/schema.php
r9290 r9296 289 289 add_option('close_comments_for_old_posts', 0); 290 290 add_option('close_comments_days_old', 14); 291 add_option('thread_comments', 0); 292 add_option('thread_comments_depth', 5); 293 add_option('page_comments', 1); 294 add_option('comments_per_page', 10); 295 add_option('default_comments_page', 'newest'); 296 add_option('comment_order', 'asc'); 291 297 292 298 // Delete unused options -
trunk/wp-admin/options-discussion.php
r9233 r9296 44 44 <?php _e('Allow people to post comments on the article') ?></label> 45 45 <br /> 46 <small><em><?php echo '(' . __('These settings may be overridden for individual articles.') . ')'; ?></em></small> 47 </fieldset></td> 48 </tr> 49 <tr valign="top"> 50 <th scope="row"><?php _e('Other comment settings') ?></th> 51 <td><fieldset><legend class="hidden"><?php _e('Other comment settings') ?></legend> 46 52 <label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_option('require_name_email')); ?> /> <?php _e('Comment author must fill out name and e-mail') ?></label> 47 53 <br /> 48 54 <label for="close_comments_for_old_posts"> 49 55 <input name="close_comments_for_old_posts" type="checkbox" id="close_comments_for_old_posts" value="1" <?php checked('1', get_option('close_comments_for_old_posts')); ?> /> 50 <?php printf( __(' Close comments on articles older than %s days'), '</label><input name="close_comments_days_old" type="text" id="close_comments_days_old" value="' . attribute_escape(get_option('close_comments_days_old')) . '" size="3" />') ?>56 <?php printf( __('Automatically close comments on articles older than %s days'), '</label><input name="close_comments_days_old" type="text" id="close_comments_days_old" value="' . attribute_escape(get_option('close_comments_days_old')) . '" size="3" />') ?> 51 57 <br /> 52 58 <label for="thread_comments"> … … 69 75 <label for="page_comments"> 70 76 <input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked('1', get_option('page_comments')); ?> /> 71 <?php printf( __('Break comments into pages with %s comments per page'), '</label><input name="comments_per_page" type="text" id="comments_per_page" value="' . attribute_escape(get_option('comments_per_page')) . '" size="3" />') ?> 72 <br /> 73 <small><em><?php echo '(' . __('These settings may be overridden for individual articles.') . ')'; ?></em></small> 77 <?php 78 79 $default_comments_page = '</label><select name="default_comments_page" id="default_comments_page"><option value="newest"'; 80 if ( 'newest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"'; 81 $default_comments_page .= '>' . __('last') . '</option><option value="oldest"'; 82 if ( 'oldest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"'; 83 $default_comments_page .= '>' . __('first') . '</option></select>'; 84 85 printf( __('Break comments into pages with %1$s comments per page and the %2$s page displayed by default'), '</label><input name="comments_per_page" type="text" id="comments_per_page" value="' . attribute_escape(get_option('comments_per_page')) . '" size="3" />', $default_comments_page ); 86 87 ?> 88 <br /> 89 <label for="comment_order"><?php 90 91 $comment_order = '<select name="comment_order" id="comment_order"><option value="asc"'; 92 if ( 'asc' == get_option('comment_order') ) $comment_order .= ' selected="selected"'; 93 $comment_order .= '>' . __('older') . '</option><option value="desc"'; 94 if ( 'desc' == get_option('comment_order') ) $comment_order .= ' selected="selected"'; 95 $comment_order .= '>' . __('newer') . '</option></select>'; 96 97 printf( __('Comments should be displayed with the %s comments at the top of each page'), $comment_order ); 98 99 ?></label> 74 100 </fieldset></td> 75 101 </tr> -
trunk/wp-admin/options.php
r9250 r9296 24 24 $whitelist_options = array( 25 25 'general' => array('blogname', 'blogdescription', 'admin_email', 'users_can_register', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'comment_registration', 'default_role' ), 26 'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page' ),26 'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order' ), 27 27 'misc' => array( 'hack_file', 'use_linksupdate', 'uploads_use_yearmonth_folders', 'upload_path' ), 28 28 'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ), -
trunk/wp-comments-post.php
r8720 r9296 80 80 } 81 81 82 $location = ( empty($_POST['redirect_to']) ? get_permalink($comment_post_ID) : $_POST['redirect_to'] ) . '#comment-' . $comment_id; 82 if ( empty($_POST['redirect_to']) ) 83 $postlink = ( 'newest' == get_option('default_comments_page') ) ? get_permalink($comment_post_ID) : add_query_arg( 'cpage', get_comment_pages_count( get_comments( array( 'post_id' => $comment_post_ID ) ) ), get_permalink($comment_post_ID) ); 84 85 $location = ( empty($_POST['redirect_to']) ? $postlink : $_POST['redirect_to'] ) . '#comment-' . $comment_id; 83 86 $location = apply_filters('comment_post_redirect', $location, $comment); 84 87 -
trunk/wp-includes/classes.php
r9083 r9296 986 986 // flat display 987 987 if ( -1 == $max_depth ) { 988 if ( !empty($args[0]['reverse_top_level']) ) { 989 $elements = array_reverse( $elements ); 990 $oldstart = $start; 991 $start = $total_top - $end; 992 $end = $total_top - $oldstart; 993 } 994 988 995 $empty_array = array(); 989 996 foreach ( $elements as $e ) { … … 1018 1025 $end = $total_top; 1019 1026 1020 foreach( $top_level_elements as $e ){ 1027 if ( !empty($args[0]['reverse_top_level']) ) { 1028 $top_level_elements = array_reverse( $top_level_elements ); 1029 $oldstart = $start; 1030 $start = $total_top - $end; 1031 $end = $total_top - $oldstart; 1032 } 1033 if ( !empty($args[0]['reverse_children']) ) { 1034 foreach ( $children_elements as $parent => $children ) 1035 $children_elements[$parent] = array_reverse( $children ); 1036 } 1037 1038 foreach ( $top_level_elements as $e ) { 1021 1039 $count++; 1022 1040 -
trunk/wp-includes/comment-template.php
r9209 r9296 762 762 $comments_by_type = &$wp_query->comments_by_type; 763 763 } 764 765 if ( '' == get_query_var('cpage') && get_option('page_comments') && 'newest' == get_option('default_comments_page') ) 766 set_query_var( 'cpage', get_comment_pages_count() ); 764 767 765 768 define('COMMENTS_TEMPLATE', true); … … 1123 1126 * @uses Walker_Comment 1124 1127 * 1125 * @param $args string|arrayFormatting options1126 * @param $comments arrayOptional array of comment objects. Defaults to $wp_query->comments1128 * @param string|array $args Formatting options 1129 * @param array $comments Optional array of comment objects. Defaults to $wp_query->comments 1127 1130 */ 1128 1131 function wp_list_comments($args = array(), $comments = null ) { … … 1133 1136 1134 1137 $defaults = array('walker' => null, 'depth' => '', 'style' => 'ul', 'callback' => null, 'end-callback' => null, 'type' => 'all', 1135 'page' => get_query_var('cpage'), 'per_page' => '', 'avatar_size' => 32);1138 'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => '', 'reverse_children' => ''); 1136 1139 1137 1140 $r = wp_parse_args( $args, $defaults ); … … 1143 1146 $r['per_page'] = 0; 1144 1147 $r['page'] = 0; 1145 } else {1146 $r['page'] = intval($r['page']);1147 if ( empty($r['page']) )1148 $r['page'] = 1;1149 1148 } 1150 1149 … … 1155 1154 $r['depth'] = -1; 1156 1155 } 1156 1157 if ( '' === $r['page'] ) { 1158 if ( empty($comments) ) { 1159 $r['page'] = get_query_var('cpage'); 1160 } else { 1161 $threaded = ( -1 == $r['depth'] ) ? false : true; 1162 $r['page'] = ( 'newest' == get_option('default_comments_page') ) ? get_comment_pages_count($comments, $r['per_page'], $threaded) : 1; 1163 set_query_var( 'cpage', $r['page'] ); 1164 } 1165 } 1166 // Validation check 1167 $r['page'] = intval($r['page']); 1168 if ( 0 == $r['page'] && 0 != $r['per_page'] ) 1169 $r['page'] = 1; 1170 1171 if ( '' == $r['reverse_top_level'] ) 1172 $r['reverse_top_level'] = ( 'asc' == get_option('comment_order') ) ? FALSE : TRUE; 1157 1173 1158 1174 extract( $r, EXTR_SKIP ); -
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 * -
trunk/wp-includes/link-template.php
r9274 r9296 1136 1136 * @return string 1137 1137 */ 1138 function get_comments_pagenum_link( $pagenum = 1) {1138 function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) { 1139 1139 global $wp_rewrite; 1140 1140 … … 1152 1152 $base = trailingslashit( get_bloginfo( 'home' ) ); 1153 1153 1154 if ( $pagenum > 1 ) { 1154 $result = $base . $request; 1155 1156 if ( 'newest' == get_option('default_comments_page') ) { 1157 if ( $pagenum != $max_page ) 1158 $result = add_query_arg( 'cpage', $pagenum, $base . $request ); 1159 } elseif ( $pagenum > 1 ) 1155 1160 $result = add_query_arg( 'cpage', $pagenum, $base . $request ); 1156 } else {1157 $result = $base . $request;1158 }1159 1161 1160 1162 $result .= '#comments'; … … 1195 1197 $label = __('» Newer Comments'); 1196 1198 1197 echo '<a href="' . clean_url( get_comments_pagenum_link($nextpage));1199 echo '<a href="' . clean_url( get_comments_pagenum_link( $nextpage, $max_page ) ); 1198 1200 $attr = apply_filters( 'next_comments_link_attributes', '' ); 1199 1201 echo "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>'; -
trunk/wp-includes/version.php
r9290 r9296 9 9 * @global string $wp_version 10 10 */ 11 $wp_version = '2.7-almost-beta ';11 $wp_version = '2.7-almost-beta-9296'; 12 12 13 13 /** … … 16 16 * @global int $wp_db_version 17 17 */ 18 $wp_db_version = 929 0;18 $wp_db_version = 9296; 19 19 20 20 ?>
Note: See TracChangeset
for help on using the changeset viewer.