Ticket #33414: 33414.2.diff
File 33414.2.diff, 4.8 KB (added by , 9 years ago) |
---|
-
src/wp-admin/admin-header.php
75 75 pagenow = '<?php echo $current_screen->id; ?>', 76 76 typenow = '<?php echo $current_screen->post_type; ?>', 77 77 adminpage = '<?php echo $admin_body_class; ?>', 78 adminTitle = '<?php echo esc_js( html_entity_decode( $admin_title ) ) ?>', 78 79 thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>', 79 80 decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>', 80 81 isRtl = <?php echo (int) is_rtl(); ?>; -
src/wp-admin/edit-comments.php
104 104 wp_enqueue_script('admin-comments'); 105 105 enqueue_comment_hotkeys_js(); 106 106 107 if ( $post_id ) 108 $title = sprintf( __( 'Comments on “%s”' ), wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '…' ) ); 109 else 110 $title = __('Comments'); 107 if ( $post_id ) { 108 $comments_count = get_comment_count( $post_id ); 109 $draft_or_post_title = wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '…' ); 110 if ( $comments_count['awaiting_moderation'] > 0 ) { 111 $title = sprintf( 112 __( 'Comments (%s) on “%s”' ), 113 number_format_i18n( $comments_count['awaiting_moderation'] ), 114 $draft_or_post_title 115 ); 116 } else { 117 $title = sprintf( __( 'Comments on “%s”' ), $draft_or_post_title ); 118 } 119 } else { 120 $comments_count = get_comment_count(); 121 if ( $comments_count['awaiting_moderation'] > 0 ) { 122 $title = sprintf( 123 __( 'Comments (%s)' ), 124 number_format_i18n( $comments_count['awaiting_moderation'] ) 125 ); 126 } else { 127 $title = __( 'Comments' ); 128 } 129 } 111 130 112 131 add_screen_option( 'per_page' ); 113 132 -
src/wp-admin/js/edit-comments.js
1 /* global admin CommentsL10n, thousandsSeparator, list_args, QTags, ajaxurl, wpAjax */1 /* global adminTitle, adminCommentsL10n, thousandsSeparator, list_args, QTags, ajaxurl, wpAjax */ 2 2 var setCommentsList, theList, theExtraList, commentReply; 3 3 4 4 (function($) { 5 var getCount, updateCount, updateCountText, updatePending, updateApproved ;5 var getCount, updateCount, updateCountText, updatePending, updateApproved, updateHtmlTitle; 6 6 7 7 setCommentsList = function() { 8 8 var totalInput, perPageInput, pageInput, dimAfter, delBefore, updateTotalCount, delAfter, refillTheExtraList, diff, 9 lastConfidentTime = 0 ;9 lastConfidentTime = 0, titleDiv, titleRegEx; 10 10 11 11 totalInput = $('input[name="_total"]', '#comments-form'); 12 12 perPageInput = $('input[name="_per_page"]', '#comments-form'); … … 135 135 el.html(n); 136 136 }; 137 137 138 updateHtmlTitle = function ( diff ) { 139 var newTitle, regexMatch, titleCount; 140 141 titleRegEx = titleRegEx || new RegExp( 'Comments (\\([0-9' + thousandsSeparator + ']+\\))?' ); 142 titleDiv = titleDiv || $( '<div />' ); 143 144 titleDiv.html( document.title ); 145 titleCount = getCount( titleDiv ) + diff; 146 if ( titleCount >= 1 ) { 147 updateCount( titleDiv, titleCount ); 148 regexMatch = titleRegEx.exec( document.title ); 149 if ( regexMatch ) { 150 newTitle = document.title.replace( regexMatch[0], 'Comments (' + titleDiv.text() + ') ' ); 151 } 152 } else { 153 newTitle = adminTitle; 154 regexMatch = titleRegEx.exec( newTitle ); 155 if ( regexMatch ) { 156 newTitle = newTitle.replace( regexMatch[0], 'Comments' ); 157 } 158 } 159 document.title = newTitle; 160 }; 161 138 162 updatePending = function( diff, commentPostId ) { 139 163 var postSelector = '.post-com-count-' + commentPostId, 140 164 noClass = 'comment-count-no-pending', … … 143 167 pending, 144 168 noPending; 145 169 170 updateHtmlTitle( diff ); 171 146 172 $( 'span.pending-count' ).each(function() { 147 173 var a = $(this), n = getCount(a) + diff; 148 174 if ( n < 1 ) -
src/wp-includes/comment-functions.php
366 366 "approved" => 0, 367 367 "awaiting_moderation" => 0, 368 368 "spam" => 0, 369 "trash" => 0, 369 370 "total_comments" => 0 370 371 ); 371 372 … … 375 376 $comment_count['spam'] = $row['total']; 376 377 $comment_count["total_comments"] += $row['total']; 377 378 break; 379 case 'trash': 380 $comment_count['trash'] = $row['total']; 381 break; 378 382 case 1: 379 383 $comment_count['approved'] = $row['total']; 380 384 $comment_count['total_comments'] += $row['total'];