Make WordPress Core

Ticket #20946: 20946.4-array.diff

File 20946.4-array.diff, 7.5 KB (added by DrewAPicture, 13 years ago)

introduces $mu_rightnow array

  • wp-admin/includes/dashboard.php

     
    408408}
    409409
    410410function wp_network_dashboard_right_now() {
     411
     412        if ( ! wp_is_large_network('users') )
     413                $c_users = get_user_count();
     414        else
     415                $c_users = __( '10,000+' );
     416
     417        if ( ! wp_is_large_network('sites') )
     418                $c_blogs = get_blog_count();           
     419        else
     420                $c_blogs = __( '10,000+' );
     421       
     422        $c_plugins = count( get_plugins() );
     423        $c_themes = count( wp_get_themes() );   
     424
     425        echo "\n\t".'<div class="table table_totals">';
     426        echo "\n\t".'<p class="sub">' . __('Network') . '</p>'."\n\t".'<table>';
     427        echo "\n\t".'<tr class="first">';
     428
     429        $mu_rightnow = array();
     430
     431        /** Array Values
     432        * 0: Single
     433        * 1: Plural
     434        * 2: count
     435        * 3: url
     436        * 4: $num class
     437        * 5: $text class
     438        */
     439
     440        $mu_rightnow[5] = array( __( 'Site' ), __( 'Sites' ), $c_blogs, 'sites.php', 'b_sites', 'sites' );
     441        $mu_rightnow[10] = array( __( 'User' ), __( 'Users' ), $c_users, 'users.php', 'b_users', 'users' );
     442        $mu_rightnow[15] = array( __( 'Theme' ), __( 'Themes' ), $c_themes, 'themes.php', 'b_themes', 'themes' );
     443        $mu_rightnow[20] = array( __( 'Plugin' ), __( 'Plugins' ), $c_plugins, 'plugins.php', 'b_plugins', 'plugins' );
     444
     445        apply_filters( 'mu_right_now_rows', $mu_rightnow );
     446
     447        foreach( $mu_rightnow as $rightnow => $key ) {
     448                $num = number_format_i18n( $key[2] );
     449                $text = _n( $key[0], $key[1], $key[2] );
     450                $count_url = network_admin_url( $key[3] );
     451                        $num = '<a href="' . $count_url . '">' . $num . '</a>';
     452                        $text = '<a href="' . $count_url . '">' . $text . '</a>';
     453                echo '<td class="first b ' . $key[4] . '">' . $num . '</td>';
     454                echo '<td class="t ' . $key[5] . '">' . $text . '</td>';
     455                echo '</tr><tr>';
     456        }
     457
     458        echo '</tr>';
     459        echo "\n\t</table>\n\t</div>";
     460
     461        echo "\n\t".'<div class="table table_tools">';
     462        echo "\n\t".'<p class="sub">' . __( 'Tools' ) . '</p>'."\n\t".'<table>';
     463        echo "\n\t".'<tr class="first">';
     464
    411465        $actions = array();
    412466        if ( current_user_can('create_sites') )
    413                 $actions['create-site'] = '<a href="' . network_admin_url('site-new.php') . '">' . __( 'Create a New Site' ) . '</a>';
     467                $actions['create-site'] = '<a href="' . network_admin_url('site-new.php') . '">' . __( 'Add a New Site' ) . '</a>';
    414468        if ( current_user_can('create_users') )
    415                 $actions['create-user'] = '<a href="' . network_admin_url('user-new.php') . '">' . __( 'Create a New User' ) . '</a>';
     469                $actions['create-user'] = '<a href="' . network_admin_url('user-new.php') . '">' . __( 'Add a New User' ) . '</a>';
    416470
    417         $c_users = get_user_count();
    418         $c_blogs = get_blog_count();
    419 
    420         $user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) );
    421         $blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) );
    422 
    423         $sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text );
    424 
    425471        if ( $actions ) {
    426472                echo '<ul class="subsubsub">';
    427473                foreach ( $actions as $class => $action ) {
     
    430476                echo implode( " |</li>\n", $actions ) . "</li>\n";
    431477                echo '</ul>';
    432478        }
     479       
     480        echo '</tr><tr>'
    433481?>
    434         <br class="clear" />
    435482
    436         <p class="youhave"><?php echo $sentence; ?></p>
    437         <?php do_action( 'wpmuadminresult', '' ); ?>
    438 
    439483        <form action="<?php echo network_admin_url('users.php'); ?>" method="get">
    440484                <p>
    441485                        <input type="search" name="s" value="" size="30" autocomplete="off" />
     
    443487                </p>
    444488        </form>
    445489
     490        </tr><tr>
     491
    446492        <form action="<?php echo network_admin_url('sites.php'); ?>" method="get">
    447493                <p>
    448494                        <input type="search" name="s" value="" size="30" autocomplete="off" />
    449495                        <?php submit_button( __( 'Search Sites' ), 'button', 'submit', false, array( 'id' => 'submit_sites' ) ); ?>
    450496                </p>
    451497        </form>
     498
     499        </tr>
    452500<?php
     501        echo "\n\t</table>\n\t</div>";
     502
     503        echo "\n\t".'<div class="versions">';
     504
     505        // WordPress Version
     506        update_right_now_message();
     507
     508        echo "\n\t".'<br class="clear" /></div>';
    453509        do_action( 'mu_rightnow_end' );
    454510        do_action( 'mu_activity_box_end' );
     511       
     512        do_action( 'wpmuadminresult', '' );
    455513}
    456514
    457515function wp_dashboard_quick_press() {
  • wp-admin/css/wp-admin.dev.css

     
    653653#dashboard_plugins h5,
    654654a.rsswidget,
    655655#dashboard_right_now td.b,
     656#network_dashboard_right_now td.b,
    656657#dashboard-widgets h4,
    657658.tool-box .title,
    658659#poststuff h3,
     
    47024703------------------------------------------------------------------------------*/
    47034704
    47044705#dashboard_right_now .versions .b,
     4706#network_dashboard_right_now .versions .b,
    47054707#post-status-display,
    47064708#post-visibility-display,
    47074709#adminmenu .wp-submenu li.current,
     
    59445946
    59455947/* Right Now */
    59465948#dashboard_right_now p.sub,
    5947 #dashboard_right_now .table, #dashboard_right_now .versions {
     5949#dashboard_right_now .table,
     5950#dashboard_right_now .versions,
     5951#network_dashboard_right_now p.sub,
     5952#network_dashboard_right_now .table,
     5953#network_dashboard_right_now .versions {
    59485954        margin: -12px;
    59495955}
    59505956
    5951 #dashboard_right_now .inside {
     5957#dashboard_right_now .inside,
     5958#network_dashboard_right_now .inside {
    59525959        font-size: 12px;
    59535960        padding-top: 20px;
    59545961}
    59555962
    5956 #dashboard_right_now p.sub {
     5963#dashboard_right_now p.sub,
     5964#network_dashboard_right_now p.sub {
    59575965        padding: 5px 0 15px;
    59585966        color: #8f8f8f;
    59595967        font-size: 14px;
     
    59625970        left: 15px;
    59635971}
    59645972
    5965 #dashboard_right_now .table {
     5973#dashboard_right_now .table,
     5974#network_dashboard_right_now .table {
    59665975        margin: 0;
    59675976        padding: 0;
    59685977        position: relative;
    59695978}
    59705979
    5971 #dashboard_right_now .table_content {
     5980#dashboard_right_now .table_content,
     5981#network_dashboard_right_now .table_totals {
    59725982        float: left;
    59735983        border-top: #ececec 1px solid;
    5974         width: 45%;
    59755984}
     5985#dashboard_right_now .table_content {
     5986        width: 45%;     
     5987}
    59765988
    5977 #dashboard_right_now .table_discussion {
     5989#network_dashboard_right_now .table_totals {
     5990        width: 35%;
     5991}
     5992
     5993#dashboard_right_now .table_discussion,
     5994#network_dashboard_right_now .table_tools {
    59785995        float: right;
    59795996        border-top: #ececec 1px solid;
    5980         width: 45%;
    59815997}
    59825998
    5983 #dashboard_right_now table td {
     5999#dashboard_right_now .table_discussion {
     6000        width: 45%;     
     6001}
     6002
     6003#network_dashboard_right_now .table_tools {
     6004        width: 55%;     
     6005}
     6006
     6007#dashboard_right_now table td,
     6008#network_dashboard_right_now td {
    59846009        padding: 3px 0;
    59856010        white-space: nowrap;
    59866011}
    59876012
    5988 #dashboard_right_now table tr.first td {
     6013#dashboard_right_now table tr.first td,
     6014#network_dashboard_right_now table tr.first td {
    59896015        border-top: none;
    59906016}
    59916017
    5992 #dashboard_right_now td.b {
     6018#dashboard_right_now td.b,
     6019#network_dashboard_right_now td.b {
    59936020        padding-right: 6px;
    59946021        text-align: right;
    59956022        font-size: 14px;
    59966023        width: 1%;
    59976024}
    59986025
    5999 #dashboard_right_now td.b a {
     6026#dashboard_right_now td.b a,
     6027#network_dashboard_right_now td.b a {
    60006028        font-size: 18px;
    60016029}
    60026030
    6003 #dashboard_right_now td.b a:hover {
     6031#dashboard_right_now td.b a:hover,
     6032#network_dashboard_right_now td.b a:hover {
    60046033        color: #d54e21;
    60056034}
    60066035
    6007 #dashboard_right_now .t {
     6036#dashboard_right_now .t,
     6037#network_dashboard_right_now .t {
    60086038        font-size: 12px;
    60096039        padding-right: 12px;
    60106040        padding-top: 6px;
    60116041        color: #777;
    60126042}
    60136043
    6014 #dashboard_right_now .t a {
     6044#dashboard_right_now .t a,
     6045#network_dashboard_right_now .t a {
    60156046        white-space: nowrap;
    60166047}
    60176048
     
    60276058        color: green;
    60286059}
    60296060
    6030 #dashboard_right_now .versions {
     6061#dashboard_right_now .versions,
     6062#network_dashboard_right_now .versions {
    60316063        padding: 6px 10px 12px;
    60326064        clear: both;
    60336065}
    60346066
    6035 #dashboard_right_now a.button {
     6067#dashboard_right_now a.button,
     6068#network_dashboard_right_now a.button {
    60366069        float: right;
    60376070        clear: right;
    60386071        position: relative;