Ticket #19590: 19590.2.patch
File 19590.2.patch, 6.4 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/dashboard.php
75 75 wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' ); 76 76 77 77 // QuickPress Widget 78 if ( is_blog_admin() && current_user_can( 'edit_posts') )78 if ( is_blog_admin() && current_user_can( 'edit_posts' ) && post_type_exists( 'post' ) ) 79 79 wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press' ); 80 80 81 81 // Recent Drafts 82 if ( is_blog_admin() && current_user_can( 'edit_posts') )82 if ( is_blog_admin() && current_user_can( 'edit_posts' ) && post_type_exists( 'post' ) ) 83 83 wp_add_dashboard_widget( 'dashboard_recent_drafts', __('Recent Drafts'), 'wp_dashboard_recent_drafts' ); 84 84 85 85 // Primary feed (Dev Blog) Widget … … 248 248 function wp_dashboard_right_now() { 249 249 global $wp_registered_sidebars; 250 250 251 $num_posts = wp_count_posts( 'post' );252 $num_pages = wp_count_posts( 'page' );251 if ( post_type_exists( 'post' ) ) 252 $num_posts = wp_count_posts( 'post' ); 253 253 254 $num_cats = wp_count_terms('category'); 254 if ( post_type_exists( 'page' ) ) 255 $num_pages = wp_count_posts( 'page' ); 255 256 256 $num_tags = wp_count_terms('post_tag'); 257 if ( taxonomy_exists( 'category' ) ) 258 $num_cats = wp_count_terms( 'category' ); 257 259 260 if ( taxonomy_exists( 'post_tag' ) ) 261 $num_tags = wp_count_terms( 'post_tag' ); 262 258 263 $num_comm = wp_count_comments( ); 259 264 260 265 echo "\n\t".'<div class="table table_content">'; … … 262 267 echo "\n\t".'<tr class="first">'; 263 268 264 269 // Posts 265 $num = number_format_i18n( $num_posts->publish ); 266 $text = _n( 'Post', 'Posts', intval($num_posts->publish) ); 267 if ( current_user_can( 'edit_posts' ) ) { 268 $num = "<a href='edit.php'>$num</a>"; 269 $text = "<a href='edit.php'>$text</a>"; 270 if ( post_type_exists( 'post' ) ) { 271 $num = number_format_i18n( $num_posts->publish ); 272 $text = _n( 'Post', 'Posts', intval($num_posts->publish) ); 273 if ( current_user_can( 'edit_posts' ) ) { 274 $num = "<a href='edit.php'>$num</a>"; 275 $text = "<a href='edit.php'>$text</a>"; 276 } 277 echo '<td class="first b b-posts">' . $num . '</td>'; 278 echo '<td class="t posts">' . $text . '</td>'; 279 280 echo '</tr><tr>'; 270 281 } 271 echo '<td class="first b b-posts">' . $num . '</td>';272 echo '<td class="t posts">' . $text . '</td>';273 274 echo '</tr><tr>';275 282 /* TODO: Show status breakdown on hover 276 283 if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds. Don't show if !current_user_can 277 284 $post_type_texts[] = '<a href="edit-pages.php">'.sprintf( _n( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).'</a>'; … … 290 297 */ 291 298 292 299 // Pages 293 $num = number_format_i18n( $num_pages->publish ); 294 $text = _n( 'Page', 'Pages', $num_pages->publish ); 295 if ( current_user_can( 'edit_pages' ) ) { 296 $num = "<a href='edit.php?post_type=page'>$num</a>"; 297 $text = "<a href='edit.php?post_type=page'>$text</a>"; 300 if ( post_type_exists( 'page' ) ) { 301 $num = number_format_i18n( $num_pages->publish ); 302 $text = _n( 'Page', 'Pages', $num_pages->publish ); 303 if ( current_user_can( 'edit_pages' ) ) { 304 $num = "<a href='edit.php?post_type=page'>$num</a>"; 305 $text = "<a href='edit.php?post_type=page'>$text</a>"; 306 } 307 echo '<td class="first b b_pages">' . $num . '</td>'; 308 echo '<td class="t pages">' . $text . '</td>'; 309 310 echo '</tr><tr>'; 298 311 } 299 echo '<td class="first b b_pages">' . $num . '</td>';300 echo '<td class="t pages">' . $text . '</td>';301 312 302 echo '</tr><tr>'; 313 // Categories 314 if ( taxonomy_exists( 'category' ) ) { 315 $num = number_format_i18n( $num_cats ); 316 $text = _n( 'Category', 'Categories', $num_cats ); 317 if ( current_user_can( 'manage_categories' ) ) { 318 $num = "<a href='edit-tags.php?taxonomy=category'>$num</a>"; 319 $text = "<a href='edit-tags.php?taxonomy=category'>$text</a>"; 320 } 321 echo '<td class="first b b-cats">' . $num . '</td>'; 322 echo '<td class="t cats">' . $text . '</td>'; 303 323 304 // Categories 305 $num = number_format_i18n( $num_cats ); 306 $text = _n( 'Category', 'Categories', $num_cats ); 307 if ( current_user_can( 'manage_categories' ) ) { 308 $num = "<a href='edit-tags.php?taxonomy=category'>$num</a>"; 309 $text = "<a href='edit-tags.php?taxonomy=category'>$text</a>"; 324 echo '</tr><tr>'; 310 325 } 311 echo '<td class="first b b-cats">' . $num . '</td>';312 echo '<td class="t cats">' . $text . '</td>';313 326 314 echo '</tr><tr>'; 327 // Tags 328 if ( taxonomy_exists( 'post_tag' ) ) { 329 $num = number_format_i18n( $num_tags ); 330 $text = _n( 'Tag', 'Tags', $num_tags ); 331 if ( current_user_can( 'manage_categories' ) ) { 332 $num = "<a href='edit-tags.php'>$num</a>"; 333 $text = "<a href='edit-tags.php'>$text</a>"; 334 } 335 echo '<td class="first b b-tags">' . $num . '</td>'; 336 echo '<td class="t tags">' . $text . '</td>'; 315 337 316 // Tags 317 $num = number_format_i18n( $num_tags ); 318 $text = _n( 'Tag', 'Tags', $num_tags ); 319 if ( current_user_can( 'manage_categories' ) ) { 320 $num = "<a href='edit-tags.php'>$num</a>"; 321 $text = "<a href='edit-tags.php'>$text</a>"; 338 echo "</tr>"; 322 339 } 323 echo '<td class="first b b-tags">' . $num . '</td>';324 echo '<td class="t tags">' . $text . '</td>';325 340 326 echo "</tr>";327 341 do_action('right_now_content_table_end'); 328 342 echo "\n\t</table>\n\t</div>"; 329 343 … … 546 560 547 561 <script type="text/javascript">edCanvas = document.getElementById('content');edInsertContent = null;</script> 548 562 563 <?php if ( is_object_in_taxonomy( $post->post_type, 'post_tag' ) ) : ?> 549 564 <h4><label for="tags-input"><?php _e('Tags') ?></label></h4> 550 565 <div class="input-text-wrap"> 551 566 <input type="text" name="tags_input" id="tags-input" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /> 552 567 </div> 568 <?php endif; ?> 553 569 554 570 <p class="submit"> 555 571 <input type="hidden" name="action" id="quickpost-action" value="post-quickpress-save" /> -
wp-includes/taxonomy.php
1651 1651 * 1652 1652 * @param string $taxonomy Taxonomy name 1653 1653 * @param array|string $args Overwrite defaults. See get_terms() 1654 * @return int How many terms are in $taxonomy1654 * @return int|WP_Error How many terms are in $taxonomy. WP_Error if $taxonomy does not exist. 1655 1655 */ 1656 1656 function wp_count_terms( $taxonomy, $args = array() ) { 1657 1657 $defaults = array('hide_empty' => false);