Make WordPress Core


Ignore:
Timestamp:
08/20/2008 09:42:31 PM (16 years ago)
Author:
ryan
Message:

Collapse crazyhorse to trunk. Incoming! see #7552

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/index.php

    r8618 r8691  
    5454
    5555<div class="wrap">
    56 
    57 <h2><?php _e('Dashboard'); ?></h2>
    58 
    59 <div id="rightnow">
    60 <h3 class="reallynow">
    61     <span><?php _e('Right Now'); ?></span>
    62 
    63 <?php if ( $can_edit_posts = current_user_can( 'edit_posts' ) ) : ?>
    64     <a href="post-new.php" class="rbutton"><strong><?php _e('Write a New Post'); ?></strong></a>
    65 <?php endif; if ( $can_edit_pages = current_user_can( 'edit_pages' ) ) : ?>
    66     <a href="page-new.php" class="rbutton"><?php _e('Write a New Page'); ?></a>
    67 <?php endif; ?>
    68     <br class="clear" />
    69 </h3>
    70 
    71 <?php
    72 $num_posts = wp_count_posts( 'post' );
    73 $num_pages = wp_count_posts( 'page' );
    74 
    75 $num_cats  = wp_count_terms('category');
    76 
    77 $num_tags = wp_count_terms('post_tag');
    78 
    79 $num_comm = get_comment_count( );
    80 
    81 $post_type_texts = array();
    82 
    83 if ( !empty($num_posts->publish) ) { // with feeds, anyone can tell how many posts there are.  Just unlink if !current_user_can
    84     $post_text = sprintf( __ngettext( '%s post', '%s posts', $num_posts->publish ), number_format_i18n( $num_posts->publish ) );
    85     $post_type_texts[] = $can_edit_posts ? "<a href='edit.php'>$post_text</a>" : $post_text;
    86 }
    87 if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds.  Don't show if !current_user_can
    88     $post_type_texts[] = '<a href="edit-pages.php">'.sprintf( __ngettext( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).'</a>';
    89 }
    90 if ( $can_edit_posts && !empty($num_posts->draft) ) {
    91     $post_type_texts[] = '<a href="edit.php?post_status=draft">'.sprintf( __ngettext( '%s draft', '%s drafts', $num_posts->draft ), number_format_i18n( $num_posts->draft ) ).'</a>';
    92 }
    93 if ( $can_edit_posts && !empty($num_posts->future) ) {
    94     $post_type_texts[] = '<a href="edit.php?post_status=future">'.sprintf( __ngettext( '%s scheduled post', '%s scheduled posts', $num_posts->future ), number_format_i18n( $num_posts->future ) ).'</a>';
    95 }
    96 
    97 if ( current_user_can('publish_posts') && !empty($num_posts->pending) ) {
    98     $pending_text = sprintf( __ngettext( 'There is <a href="%1$s">%2$s post</a> pending your review.', 'There are <a href="%1$s">%2$s posts</a> pending your review.', $num_posts->pending ), 'edit.php?post_status=pending', number_format_i18n( $num_posts->pending ) );
    99 } else {
    100     $pending_text = '';
    101 }
    102 
    103 $cats_text = sprintf( __ngettext( '%s category', '%s categories', $num_cats ), number_format_i18n( $num_cats ) );
    104 $tags_text = sprintf( __ngettext( '%s tag', '%s tags', $num_tags ), number_format_i18n( $num_tags ) );
    105 if ( current_user_can( 'manage_categories' ) ) {
    106     $cats_text = "<a href='categories.php'>$cats_text</a>";
    107     $tags_text = "<a href='edit-tags.php'>$tags_text</a>";
    108 }
    109 
    110 $total_comments = sprintf( __ngettext( '%1$s total', '%1$s total', $num_comm['total_comments'] ), number_format_i18n($num_comm['total_comments']) );
    111 $approved_comments = sprintf( __ngettext( '%1$s approved', '%1$s approved', $num_comm['approved'] ), number_format_i18n($num_comm['approved']) );
    112 $spam_comments = sprintf( __ngettext( '%1$s spam', '%1$s spam', $num_comm['spam'] ), number_format_i18n($num_comm['spam']) );
    113 $moderated_comments = sprintf( __ngettext( '%1$s awaiting moderation', '%1$s awaiting moderation', $num_comm['awaiting_moderation'] ), number_format_i18n($num_comm['awaiting_moderation']) );
    114 
    115 if( current_user_can( 'moderate_comments' ) ) {
    116     $total_comments = "<a href='edit-comments.php'>{$total_comments}</a>";
    117     $approved_comments = "<a href='edit-comments.php?comment_status=approved'>{$approved_comments}</a>";
    118     $moderated_comments = "<a href='edit-comments.php?comment_status=moderated'>{$moderated_comments}</a>";
    119 }
    120 
    121 $comm_text = sprintf( __ngettext( 'You have %1$s comment, %2$s, %3$s and %4$s.', 'You have %1$s comments, %2$s, %3$s and %4$s.', $num_comm['total_comments'] ), $total_comments, $approved_comments, $spam_comments, $moderated_comments );
    122 
    123 $post_type_text = implode(', ', $post_type_texts);
    124 
    125 // There is always a category
    126 $sentence = sprintf( __( 'You have %1$s, contained within %2$s and %3$s. %4$s %5$s' ), $post_type_text, $cats_text, $tags_text, $pending_text, $comm_text );
    127 $sentence = apply_filters( 'dashboard_count_sentence', $sentence, $post_type_text, $cats_text, $tags_text, $pending_text, $comm_text );
    128 
    129 ?>
    130 <p class="youhave"><?php echo $sentence; ?></p>
    131 <?php
    132 $ct = current_theme_info();
    133 $sidebars_widgets = wp_get_sidebars_widgets();
    134 $num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ), 0 );
    135 $widgets_text = sprintf( __ngettext( '%d widget', '%d widgets', $num_widgets ), $num_widgets );
    136 if ( $can_switch_themes = current_user_can( 'switch_themes' ) )
    137     $widgets_text = "<a href='widgets.php'>$widgets_text</a>";
    138 ?>
    139 <p class="youare">
    140     <?php printf( __( 'You are using the %1$s theme with %2$s.' ), $ct->title, $widgets_text ); ?>
    141     <?php if ( $can_switch_themes ) : ?>
    142         <a href="themes.php" class="rbutton"><?php _e('Change Theme'); ?></a>
    143     <?php endif; ?>
    144     <?php update_right_now_message(); ?>
    145 </p>
    146 <?php do_action( 'rightnow_end' ); ?>
    147 <?php do_action( 'activity_box_end' ); ?>
    148 </div><!-- rightnow -->
    149 
    150 <br class="clear" />
    151 
    15256<div id="dashboard-widgets-wrap">
    15357
Note: See TracChangeset for help on using the changeset viewer.