Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r19660 r21003  
    8787                $update = true;
    8888                $widget_options['dashboard_primary'] = array(
    89                         'link' => apply_filters( 'dashboard_primary_link',  __( 'http://wordpress.org/news/' ) ),
    90                         'url' => apply_filters( 'dashboard_primary_feed',  __( 'http://wordpress.org/news/feed/' ) ),
     89                        'link' => apply_filters( 'dashboard_primary_link', __( 'http://wordpress.org/news/' ) ),
     90                        'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ),
    9191                        'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ),
    9292                        'items' => 2,
    … …  
    102102                $update = true;
    103103                $widget_options['dashboard_secondary'] = array(
    104                         'link' => apply_filters( 'dashboard_secondary_link',  __( 'http://planet.wordpress.org/' ) ),
    105                         'url' => apply_filters( 'dashboard_secondary_feed',  __( 'http://planet.wordpress.org/feed/' ) ),
     104                        'link' => apply_filters( 'dashboard_secondary_link', __( 'http://planet.wordpress.org/' ) ),
     105                        'url' => apply_filters( 'dashboard_secondary_feed', __( 'http://planet.wordpress.org/feed/' ) ),
    106106                        'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ),
    107107                        'items' => 5,
    … …  
    194194 */
    195195function wp_dashboard() {
    196         global $screen_layout_columns;
    197 
    198196        $screen = get_current_screen();
    199 
    200         $hide2 = $hide3 = $hide4 = '';
    201         switch ( $screen_layout_columns ) {
    202                 case 4:
    203                         $width = 'width:25%;';
    204                         break;
    205                 case 3:
    206                         $width = 'width:33.333333%;';
    207                         $hide4 = 'display:none;';
    208                         break;
    209                 case 2:
    210                         $width = 'width:50%;';
    211                         $hide3 = $hide4 = 'display:none;';
    212                         break;
    213                 default:
    214                         $width = 'width:100%;';
    215                         $hide2 = $hide3 = $hide4 = 'display:none;';
    216         }
     197        $class = 'columns-' . get_current_screen()->get_columns();
     198
    217199?>
    218 <div id="dashboard-widgets" class="metabox-holder">
    219 <?php
    220         echo "\t<div id='postbox-container-1' class='postbox-container' style='$width'>\n";
    221         do_meta_boxes( $screen->id, 'normal', '' );
    222 
    223         echo "\t</div><div id='postbox-container-2' class='postbox-container' style='{$hide2}$width'>\n";
    224         do_meta_boxes( $screen->id, 'side', '' );
    225 
    226         echo "\t</div><div id='postbox-container-3' class='postbox-container' style='{$hide3}$width'>\n";
    227         do_meta_boxes( $screen->id, 'column3', '' );
    228 
    229         echo "\t</div><div id='postbox-container-4' class='postbox-container' style='{$hide4}$width'>\n";
    230         do_meta_boxes( $screen->id, 'column4', '' );
    231 ?>
    232 </div></div>
    233 
    234 <form style="display:none" method="get" action="">
    235         <p>
     200<div id="dashboard-widgets" class="metabox-holder <?php echo $class; ?>">
     201        <div id='postbox-container-1' class='postbox-container'>
     202        <?php do_meta_boxes( $screen->id, 'normal', '' ); ?>
     203        </div>
     204        <div id='postbox-container-2' class='postbox-container'>
     205        <?php do_meta_boxes( $screen->id, 'side', '' ); ?>
     206        </div>
     207        <div id='postbox-container-3' class='postbox-container'>
     208        <?php do_meta_boxes( $screen->id, 'column3', '' ); ?>
     209        </div>
     210        <div id='postbox-container-4' class='postbox-container'>
     211        <?php do_meta_boxes( $screen->id, 'column4', '' ); ?>
     212        </div>
     213</div>
     214
    236215<?php
    237216        wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
    238217        wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
    239 ?>
    240         </p>
    241 </form>
    242 
    243 <?php
     218
    244219}
    245220
    … …  
    274249        echo '</tr><tr>';
    275250        /* TODO: Show status breakdown on hover
    276         if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds.  Don't show if !current_user_can
     251        if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds. Don't show if !current_user_can
    277252                $post_type_texts[] = '<a href="edit-pages.php">'.sprintf( _n( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).'</a>';
    278253        }
    … …  
    328303        echo "\n\t</table>\n\t</div>";
    329304
    330 
    331305        echo "\n\t".'<div class="table table_discussion">';
    332306        echo "\n\t".'<p class="sub">' . __('Discussion') . '</p>'."\n\t".'<table>';
    … …  
    385359
    386360        echo "\n\t".'<div class="versions">';
    387         $ct = current_theme_info();
     361        $theme = wp_get_theme();
    388362
    389363        echo "\n\t<p>";
    390364
    391         if ( empty( $ct->stylesheet_dir ) ) {
     365        if ( $theme->errors() ) {
    392366                if ( ! is_multisite() || is_super_admin() )
    393367                        echo '<span class="error-message">' . __('ERROR: The themes directory is either empty or doesn&#8217;t exist. Please check your installation.') . '</span>';
    … …  
    403377                $num = number_format_i18n( $num_widgets );
    404378
    405                 $switch_themes = $ct->title;
     379                $switch_themes = $theme->display('Name');
    406380                if ( current_user_can( 'switch_themes') )
    407381                        $switch_themes = '<a href="themes.php">' . $switch_themes . '</a>';
    … …  
    413387        } else {
    414388                if ( current_user_can( 'switch_themes' ) )
    415                         printf( __('Theme <span class="b"><a href="themes.php">%1$s</a></span>'), $ct->title );
     389                        printf( __('Theme <span class="b"><a href="themes.php">%1$s</a></span>'), $theme->display('Name') );
    416390                else
    417                         printf( __('Theme <span class="b">%1$s</span>'), $ct->title );
     391                        printf( __('Theme <span class="b">%1$s</span>'), $theme->display('Name') );
    418392        }
    419393        echo '</p>';
    … …  
    463437        <?php do_action( 'wpmuadminresult', '' ); ?>
    464438
    465         <form name="searchform" action="<?php echo network_admin_url('users.php'); ?>" method="get">
     439        <form action="<?php echo network_admin_url('users.php'); ?>" method="get">
    466440                <p>
    467                         <input type="text" name="s" value="" size="17" />
     441                        <input type="search" name="s" value="" size="30" autocomplete="off" />
    468442                        <?php submit_button( __( 'Search Users' ), 'button', 'submit', false, array( 'id' => 'submit_users' ) ); ?>
    469443                </p>
    470444        </form>
    471445
    472         <form name="searchform" action="<?php echo network_admin_url('sites.php'); ?>" method="get">
     446        <form action="<?php echo network_admin_url('sites.php'); ?>" method="get">
    473447                <p>
    474                         <input type="text" name="s" value="" size="17" />
     448                        <input type="search" name="s" value="" size="30" autocomplete="off" />
    475449                        <?php submit_button( __( 'Search Sites' ), 'button', 'submit', false, array( 'id' => 'submit_sites' ) ); ?>
    476450                </p>
    … …  
    616590        global $wpdb;
    617591
    618         if ( current_user_can('edit_posts') )
    619                 $allowed_states = array('0', '1');
    620         else
    621                 $allowed_states = array('1');
    622 
    623592        // Select all comment types and filter out spam later for better query performance.
    624593        $comments = array();
    … …  
    629598                ? absint( $widgets['dashboard_recent_comments']['items'] ) : 5;
    630599
    631         while ( count( $comments ) < $total_items && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT $start, 50" ) ) {
    632 
     600        $comments_query = array( 'number' => $total_items * 5, 'offset' => 0 );
     601        if ( ! current_user_can( 'edit_posts' ) )
     602                $comments_query['status'] = 'approve';
     603
     604        while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) {
    633605                foreach ( $possible as $comment ) {
    634                         if ( count( $comments ) >= $total_items )
    635                                 break;
    636                         if ( in_array( $comment->comment_approved, $allowed_states ) && current_user_can( 'read_post', $comment->comment_post_ID ) )
    637                                 $comments[] = $comment;
    638                 }
    639 
    640                 $start = $start + 50;
    641         }
    642 
    643         if ( $comments ) :
    644 ?>
    645 
    646                 <div id="the-comment-list" class="list:comment">
    647 <?php
     606                        if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) )
     607                                continue;
     608                        $comments[] = $comment;
     609                        if ( count( $comments ) == $total_items )
     610                                break 2;
     611                }
     612                $comments_query['offset'] += $comments_query['number'];
     613                $comments_query['number'] = $total_items * 10;
     614        }
     615
     616        if ( $comments ) {
     617                echo '<div id="the-comment-list" class="list:comment">';
    648618                foreach ( $comments as $comment )
    649619                        _wp_dashboard_recent_comments_row( $comment );
    650 ?>
    651 
    652                 </div>
    653 
    654 <?php
    655                 if ( current_user_can('edit_posts') ) { ?>
    656                         <?php _get_list_table('WP_Comments_List_Table')->views(); ?>
    657 <?php   }
     620                echo '</div>';
     621
     622                if ( current_user_can('edit_posts') )
     623                        _get_list_table('WP_Comments_List_Table')->views();
    658624
    659625                wp_comment_reply( -1, false, 'dashboard', false );
    660626                wp_comment_trashnotice();
    661 
    662         else :
    663 ?>
    664 
    665         <p><?php _e( 'No comments yet.' ); ?></p>
    666 
    667 <?php
    668         endif; // $comments;
     627        } else {
     628                echo '<p>' . __( 'No comments yet.' ) . '</p>';
     629        }
    669630}
    670631
    … …  
    701662                $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__('Edit comment') . "'>". __('Edit') . '</a>';
    702663                $actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.esc_attr__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
    703                 $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */  _x( 'Spam', 'verb' ) . '</a>';
     664                $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
    704665                if ( !EMPTY_TRASH_DAYS )
    705666                        $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
    … …  
    938899        wp_dashboard_cached_rss_widget( 'dashboard_plugins', 'wp_dashboard_plugins_output', array(
    939900                'http://wordpress.org/extend/plugins/rss/browse/popular/',
    940                 'http://wordpress.org/extend/plugins/rss/browse/new/',
    941                 'http://wordpress.org/extend/plugins/rss/browse/updated/'
     901                'http://wordpress.org/extend/plugins/rss/browse/new/'
    942902        ) );
    943903}
    … …  
    951911        $popular = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/popular/' );
    952912        $new     = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/new/' );
    953         $updated = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/updated/' );
    954913
    955914        if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) {
    … …  
    958917        }
    959918
    960         foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins'), 'updated' => __('Recently Updated') ) as $feed => $label ) {
     919        foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins') ) as $feed => $label ) {
    961920                if ( is_wp_error($$feed) || !$$feed->get_item_quantity() )
    962921                        continue;
    … …  
    11161075                $_POST['widget-rss'][$number] = stripslashes_deep( $_POST['widget-rss'][$number] );
    11171076                $widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] );
    1118                 // title is optional.  If black, fill it if possible
     1077                // title is optional. If black, fill it if possible
    11191078                if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) {
    11201079                        $rss = fetch_feed($widget_options[$widget_id]['url']);
    … …  
    11941153                }
    11951154                $notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>";
    1196                 $notice .= '<p>' . sprintf( __( '<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), 'http://browsehappy.com/' ) . '</p>';
     1155
     1156                $browsehappy = 'http://browsehappy.com/';
     1157                $locale = get_locale();
     1158                if ( 'en_US' !== $locale )
     1159                        $browsehappy = add_query_arg( 'locale', $locale, $browsehappy );
     1160
     1161                $notice .= '<p>' . sprintf( __( '<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), esc_url( $browsehappy ) ) . '</p>';
    11971162                $notice .= '<p class="hide-if-no-js"><a href="" class="dismiss">' . __( 'Dismiss' ) . '</a></p>';
    11981163                $notice .= '<div class="clear"></div>';
    … …  
    12291194                $options = array(
    12301195                        'body'                  => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ),
    1231                         'user-agent'    => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
     1196                        'user-agent'    => 'WordPress/' . $wp_version . '; ' . home_url()
    12321197                );
    12331198
    … …  
    12481213                 *  'img_src_ssl' - string - An image (over SSL) representing the browser
    12491214                 */
    1250                 $response = unserialize( wp_remote_retrieve_body( $response ) );
    1251 
    1252                 if ( ! $response )
     1215                $response = maybe_unserialize( wp_remote_retrieve_body( $response ) );
     1216
     1217                if ( ! is_array( $response ) )
    12531218                        return false;
    12541219
    … …  
    12671232 * Displays a welcome panel to introduce users to WordPress.
    12681233 *
    1269  * @since 3.3
     1234 * @since 3.3.0
    12701235 */
    12711236function wp_welcome_panel() {
    … …  
    12911256
    12921257        <div class="welcome-panel-content">
    1293         <h3><?php _e( 'Welcome to your new WordPress site! ' ); ?></h3>
     1258        <h3><?php _e( 'Welcome to your new WordPress site!' ); ?></h3>
    12941259        <p class="about-description"><?php _e( 'If you need help getting started, check out our documentation on <a href="http://codex.wordpress.org/First_Steps_With_WordPress">First Steps with WordPress</a>. If you&#8217;d rather dive right in, here are a few things most people do first when they set up a new WordPress site. If you need help, use the Help tabs in the upper right corner to get information on how to use your current screen and where to go for more assistance.' ); ?></p>
    12951260        <div class="welcome-panel-column-container">
    … …  
    13171282                <h4><span class="icon16 icon-appearance"></span> <?php _e( 'Customize Your Site' ); ?></h4>
    13181283                <?php
    1319                 $ct = current_theme_info();
    1320                 if ( empty ( $ct->stylesheet_dir ) ) :
     1284                $theme = wp_get_theme();
     1285                if ( $theme->errors() ) :
    13211286                        echo '<p>';
    13221287                        printf( __( '<a href="%s">Install a theme</a> to get started customizing your site.' ), esc_url( admin_url( 'themes.php' ) ) );
    … …  
    13241289                else:
    13251290                        $customize_links = array();
    1326                         if ( 'twentyeleven' == $ct->stylesheet )
     1291                        if ( 'twentyeleven' == $theme->get_stylesheet() )
    13271292                                $customize_links[] = sprintf( __( '<a href="%s">Choose light or dark</a>' ), esc_url( admin_url( 'themes.php?page=theme_options' ) ) );
    13281293
    … …  
    13381303                        if ( ! empty( $customize_links ) ) {
    13391304                                echo '<p>';
    1340                                 printf( __( 'Use the current theme &mdash; %1$s &mdash; or <a href="%2$s">choose a new one</a>. If you stick with %3$s, here are a few ways to make your site look unique.' ), $ct->title, esc_url( admin_url( 'themes.php' ) ), $ct->title );
     1305                                printf( __( 'Use the current theme &mdash; %1$s &mdash; or <a href="%2$s">choose a new one</a>. If you stick with %1$s, here are a few ways to make your site look unique.' ), $theme->display('Name'), esc_url( admin_url( 'themes.php' ) ) );
    13411306                                echo '</p>';
    13421307                        ?>
    … …  
    13491314                        } else {
    13501315                                echo '<p>';
    1351                                 printf( __( 'Use the current theme &mdash; %1$s &mdash; or <a href="%2$s">choose a new one</a>.' ), $ct->title, esc_url( admin_url( 'themes.php' ) ) );
     1316                                printf( __( 'Use the current theme &mdash; %1$s &mdash; or <a href="%2$s">choose a new one</a>.' ), $theme->display('Name'), esc_url( admin_url( 'themes.php' ) ) );
    13521317                                echo '</p>';
    13531318                        }
    … …  
    13601325        <?php
    13611326}
    1362 
    1363 ?>
Note: See TracChangeset for help on using the changeset viewer.