Make WordPress Core

Changeset 10300


Ignore:
Timestamp:
01/05/2009 10:08:31 AM (18 years ago)
Author:
azaozz
Message:

Make titles into links in Dashboard Right Now module, props mattwalters, fixes #8438 for trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/dashboard.php

    r10279 r10300  
    182182        // Posts
    183183        $num = number_format_i18n( $num_posts->publish );
    184         if ( current_user_can( 'edit_posts' ) )
    185                 $text = "<a href='edit.php'>$num</a>";
    186         else
    187                 $text = $num;
    188         echo '<td class="first b b-posts">' . $text . '</td>';
    189         echo '<td class="t posts">' . __ngettext( 'Post', 'Posts', intval($num_posts->publish) ) . '</td>';
     184        $text = __ngettext( 'Post', 'Posts', intval($num_posts->publish) );
     185        if ( current_user_can( 'edit_posts' ) ) {
     186                $num = "<a href='edit.php'>$num</a>";
     187                $text = "<a href='edit.php'>$text</a>";
     188        }
     189        echo '<td class="first b b-posts">' . $num . '</td>';
     190        echo '<td class="t posts">' . $text . '</td>';
    190191        /* TODO: Show status breakdown on hover
    191192        if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds.  Don't show if !current_user_can
     
    207208        // Total Comments
    208209        $num = number_format_i18n($num_comm->total_comments);
    209         if ( current_user_can( 'moderate_comments' ) )
     210        $text = __ngettext( 'Comment', 'Comments', $num_comm->total_comments );
     211        if ( current_user_can( 'moderate_comments' ) ) {
    210212                $num = "<a href='edit-comments.php'>$num</a>";
    211         echo '<td class="b b-comments">'.$num.'</td>';
    212         echo '<td class="last t comments">' . __ngettext( 'Comment', 'Comments', $num_comm->total_comments ) . '</td>';
     213                $text = "<a href='edit-comments.php'>$text</a>";
     214        }
     215        echo '<td class="b b-comments">' . $num . '</td>';
     216        echo '<td class="last t comments">' . $text . '</td>';
    213217
    214218        echo '</tr><tr>';
     
    216220        // Pages
    217221        $num = number_format_i18n( $num_pages->publish );
    218         if ( current_user_can( 'edit_pages' ) )
     222        $text = __ngettext( 'Page', 'Pages', $num_pages->publish );
     223        if ( current_user_can( 'edit_pages' ) ) {
    219224                $num = "<a href='edit-pages.php'>$num</a>";
    220         echo '<td class="first b b_pages">'.$num.'</td>';
    221         echo '<td class="t pages">' . __ngettext( 'Page', 'Pages', $num_pages->publish ) . '</td>';
     225                $text = "<a href='edit-pages.php'>$text</a>";
     226        }
     227        echo '<td class="first b b_pages">' . $num . '</td>';
     228        echo '<td class="t pages">' . $text . '</td>';
    222229
    223230        // Approved Comments
    224231        $num = number_format_i18n($num_comm->approved);
    225         if ( current_user_can( 'moderate_comments' ) )
     232        $text = __ngettext( 'Approved', 'Approved', $num_comm->approved );
     233        if ( current_user_can( 'moderate_comments' ) ) {
    226234                $num = "<a href='edit-comments.php?comment_status=approved'>$num</a>";
    227         echo '<td class="b b_approved">'.$num.'</td>';
    228         echo '<td class="last t approved">' . __ngettext( 'Approved', 'Approved', $num_comm->approved ) . '</td>';
     235                $text = "<a class='approved' href='edit-comments.php?comment_status=approved'>$text</a>";
     236        }
     237        echo '<td class="b b_approved">' . $num . '</td>';
     238        echo '<td class="last t">' . $text . '</td>';
    229239
    230240        echo "</tr>\n\t<tr>";
     
    232242        // Categories
    233243        $num = number_format_i18n( $num_cats );
    234         if ( current_user_can( 'manage_categories' ) )
     244        $text = __ngettext( 'Category', 'Categories', $num_cats );
     245        if ( current_user_can( 'manage_categories' ) ) {
    235246                $num = "<a href='categories.php'>$num</a>";
    236         echo '<td class="first b b-cats">'.$num.'</td>';
    237         echo '<td class="t cats">' . __ngettext( 'Category', 'Categories', $num_cats ) . '</td>';
     247                $text = "<a href='categories.php'>$text</a>";
     248        }
     249        echo '<td class="first b b-cats">' . $num . '</td>';
     250        echo '<td class="t cats">' . $text . '</td>';
    238251
    239252        // Pending Comments
    240253        $num = number_format_i18n($num_comm->moderated);
    241         if ( current_user_can( 'moderate_comments' ) )
     254        $text = __ngettext( 'Pending', 'Pending', $num_comm->moderated );
     255        if ( current_user_can( 'moderate_comments' ) ) {
    242256                $num = "<a href='edit-comments.php?comment_status=moderated'><span class='pending-count'>$num</span></a>";
    243         echo '<td class="b b-waiting">'.$num.'</td>';
    244         echo '<td class="last t waiting">' . __ngettext( 'Pending', 'Pending', $num_comm->moderated ) . '</td>';
     257                $text = "<a class='waiting' href='edit-comments.php?comment_status=moderated'>$text</a>";
     258        }
     259        echo '<td class="b b-waiting">' . $num . '</td>';
     260        echo '<td class="last t">' . $text . '</td>';
    245261
    246262        echo "</tr>\n\t<tr>";
     
    248264        // Tags
    249265        $num = number_format_i18n( $num_tags );
    250         if ( current_user_can( 'manage_categories' ) )
     266        $text = __ngettext( 'Tag', 'Tags', $num_tags );
     267        if ( current_user_can( 'manage_categories' ) ) {
    251268                $num = "<a href='edit-tags.php'>$num</a>";
    252         echo '<td class="first b b-tags">'.$num.'</td>';
    253         echo '<td class="t tags">' . __ngettext( 'Tag', 'Tags', $num_tags ) . '</td>';
     269                $text = "<a href='edit-tags.php'>$text</a>";
     270        }
     271        echo '<td class="first b b-tags">' . $num . '</td>';
     272        echo '<td class="t tags">' . $text . '</td>';
    254273
    255274        // Spam Comments
    256275        $num = number_format_i18n($num_comm->spam);
    257         if ( current_user_can( 'moderate_comments' ) )
     276        $text = __ngettext( 'Spam', 'Spam', $num_comm->spam );
     277        if ( current_user_can( 'moderate_comments' ) ) {
    258278                $num = "<a href='edit-comments.php?comment_status=spam'><span class='spam-count'>$num</span></a>";
    259         echo '<td class="b b-spam">'.$num.'</td>';
    260         echo '<td class="last t spam">' . __ngettext( 'Spam', 'Spam', $num_comm->spam ) . '</td>';
     279                $text = "<a class='spam' href='edit-comments.php?comment_status=spam'>$text</a>";
     280        }
     281        echo '<td class="b b-spam">' . $num . '</td>';
     282        echo '<td class="last t">' . $text . '</td>';
    261283
    262284        echo "</tr>";
Note: See TracChangeset for help on using the changeset viewer.