Ticket #7927: 7927.2.patch
| File 7927.2.patch, 8.8 KB (added by , 18 years ago) |
|---|
-
wp-admin/includes/schema.php
287 287 add_option('image_default_align', ''); 288 288 add_option('close_comments_for_old_posts', 0); 289 289 add_option('close_comments_days_old', 14); 290 add_option('thread_comments', 0); 291 add_option('thread_comments_depth', 5); 292 add_option('page_comments', 1); 293 add_option('comments_per_page', 10); 294 add_option('default_comments_page', 'newest'); 290 295 291 296 // Delete unused options 292 297 $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins'); -
wp-admin/options-discussion.php
68 68 ?><br /> 69 69 <label for="page_comments"> 70 70 <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" />') ?> 71 <?php 72 73 $default_comments_page = '</label><select name="default_comments_page" id="default_comments_page"><option value="newest"'; 74 if ( 'newest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"'; 75 $default_comments_page .= '>' . __('newest') . '</option><option value="oldest"'; 76 if ( 'oldest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"'; 77 $default_comments_page .= '>' . __('oldest') . '</option></select>'; 78 79 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 ); 80 81 ?> 72 82 <br /> 73 83 <small><em><?php echo '(' . __('These settings may be overridden for individual articles.') . ')'; ?></em></small> 74 84 </fieldset></td> -
wp-admin/options.php
23 23 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' ), 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' ), 29 29 'privacy' => array( 'blog_public' ), -
wp-includes/comment-template.php
762 762 $comments_by_type = &$wp_query->comments_by_type; 763 763 } 764 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() ); 767 765 768 define('COMMENTS_TEMPLATE', true); 766 769 767 770 $include = apply_filters('comments_template', STYLESHEETPATH . $file ); … … 1132 1135 $comment_depth = 1; 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); 1136 1139 1137 1140 $r = wp_parse_args( $args, $defaults ); 1138 1141 … … 1142 1145 if ( empty($r['per_page']) ) { 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 1151 1150 if ( '' === $r['depth'] ) { … … 1155 1154 $r['depth'] = -1; 1156 1155 } 1157 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 ( empty($r['page']) ) 1169 $r['page'] = 1; 1170 1158 1171 extract( $r, EXTR_SKIP ); 1159 1172 1160 1173 if ( empty($walker) ) -
wp-includes/comment.php
481 481 } 482 482 483 483 /** 484 * Calculate the total number of comment pages. 485 * 486 * @since 2.7.0 487 */ 488 function get_comment_pages_count( $comments = null, $per_page = null, $threaded = null ) { 489 global $wp_query; 490 491 if ( !$comments ) 492 $comments = $wp_query->comments; 493 494 if ( !$comments ) 495 return 0; 496 497 if ( !$per_page ) 498 $per_page = get_query_var('comments_per_page'); 499 500 if ( !$threaded ) 501 $threaded = get_option('thread_comments'); 502 503 if ( $threaded ) { 504 $walker = new Walker_Comment; 505 $count = floor( $walker->get_number_of_root_elements( $comments ) / $per_page ); 506 } else { 507 $count = floor( count( $comments ) / $per_page ); 508 } 509 510 return $count; 511 } 512 513 /** 484 514 * Does comment contain blacklisted characters or words. 485 515 * 486 516 * @since 1.5.0 -
wp-includes/link-template.php
1135 1135 * @param int $pagenum Optional. Page number. 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 1141 1141 $pagenum = (int) $pagenum; … … 1151 1151 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'; 1161 1163 … … 1194 1196 if ( empty($label) ) 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>'; 1200 1202 }