Make WordPress Core

Changeset 5749


Ignore:
Timestamp:
06/24/2007 05:46:08 AM (19 years ago)
Author:
markjaquith
Message:

Change to "and x more" for nags. see #4446

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/post-new.php

    r5707 r5749  
    3333$others_drafts = get_others_drafts($user_ID);
    3434
     35$nag_posts_limit = (int) apply_filters('nag_posts_limit', 3);
     36
     37$nag_posts = array(
     38        array(
     39                'my_drafts',
     40                __('Your Drafts:'),
     41                'edit.php?post_status=draft&author=' . $user_ID,
     42                count($my_drafts)),
     43        array(
     44                'pending',
     45                __('Pending Review:'),
     46                'edit.php?post_status=pending',
     47                count($pending)),
     48        array(
     49                'others_drafts',
     50                __('Others’ Drafts:'),
     51                'edit.php?post_status=pending&author=-' . $user_ID,
     52                count($others_drafts))
     53        );
     54
    3555if ( !empty($my_drafts) || !empty($pending) || !empty($others_drafts) ) {
    3656        echo '<div class="wrap" id="draft-nag">';
    3757
    38         if ( $my_drafts ) {
    39                 echo '<p><strong>' . __( 'Your Drafts:' ) . '</strong> ';
    40                 if ( count($my_drafts) < 3 ) {
     58        foreach ( $nag_posts as $nag ) {
     59                if ( ${$nag[0]} ) {
     60                        echo '<p><strong>' . wp_specialchars($nag[1]) . '</strong> ';
    4161                        $i = 0;
    42                         foreach ( $my_drafts as $post ) {
    43                                 if ( $i++ != 0 )
    44                                         echo ', ';
     62                        foreach ( ${$nag[0]} as $post ) {
     63                                $i++;
     64                                if ( $i > $nag_posts_limit )
     65                                        break;
    4566                                echo '<a href="post.php?action=edit&amp;post=' . $post->ID . '">';
    4667                                the_title();
    4768                                echo '</a>';
     69                                if ( $i < min($nag[3], $nag_posts_limit) )
     70                                        echo ', ';
    4871                        }
     72                        if ( $nag[3] > $nag_posts_limit )
     73                                printf(__(', and <a href="%s">%d more</a>'), $nag[2], $nag[3] - $nag_posts_limit);
    4974                        echo '.</p>';
    50                 } else {
    51                         printf(
    52                                 __( 'You have <a href="%s">%d drafts</a>.' ) . '</p>',
    53                                 'edit.php?post_status=draft&author=' . $user_ID, count($my_drafts)
    54                         );
    5575                }
    5676        }
    57 
    58         if ( $pending ) {
    59                 echo '<p><strong>' . __( 'Pending Review:' ) . '</strong> ';
    60                 if ( count($pending) < 3 ) {
    61                         $i = 0;
    62                         foreach ( $pending as $post ) {
    63                                 if ( $i++ != 0 )
    64                                         echo ', ';
    65                                 echo '<a href="post.php?action=edit&amp;post=' . $post->ID . '">';
    66                                 the_title();
    67                                 echo '</a>';
    68                         }
    69                         echo '.</p>';
    70                 } else {
    71                         printf(
    72                                 __( 'There are <a href="%s">%d drafts pending review</a>.' ) . '</p>',
    73                                 'edit.php?post_status=pending', count($pending)
    74                         );
    75                 }
    76         }
    77 
    78         if ( $others_drafts ) {
    79                 echo '<p><strong>' . __( 'Others&#8217; Drafts:' ) . '</strong> ';
    80                 if ( count($others_drafts) < 3 ) {
    81                         $i = 0;
    82                         foreach ( $others_drafts as $post ) {
    83                                 if ( $i++ != 0 )
    84                                         echo ', ';
    85                                 echo '<a href="post.php?action=edit&amp;post=' . $post->ID . '">';
    86                                 the_title();
    87                                 echo '</a>';
    88                         }
    89                         echo '.</p>';
    90                 } else {
    91                         printf(
    92                                 __( 'There are <a href="%s">%d in-progress drafts by other authors</a>.' ) . '</p>',
    93                                 'edit.php?post_status=pending&author=-' . $user_ID, count($others_drafts)
    94                         );
    95                 }
    96         }
    97 
    9877        echo "</div>\n";
    9978}
Note: See TracChangeset for help on using the changeset viewer.