Changes from branches/3.3/wp-admin/includes/dashboard.php at r19660 to trunk/wp-admin/includes/dashboard.php at r21003
- File:
-
- 1 edited
-
trunk/wp-admin/includes/dashboard.php (modified) (26 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/dashboard.php
r19660 r21003 87 87 $update = true; 88 88 $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/' ) ), 91 91 'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ), 92 92 'items' => 2, … … 102 102 $update = true; 103 103 $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/' ) ), 106 106 'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ), 107 107 'items' => 5, … … 194 194 */ 195 195 function wp_dashboard() { 196 global $screen_layout_columns;197 198 196 $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 217 199 ?> 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 236 215 <?php 237 216 wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); 238 217 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); 239 ?> 240 </p> 241 </form> 242 243 <?php 218 244 219 } 245 220 … … 274 249 echo '</tr><tr>'; 275 250 /* 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_can251 if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds. Don't show if !current_user_can 277 252 $post_type_texts[] = '<a href="edit-pages.php">'.sprintf( _n( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).'</a>'; 278 253 } … … 328 303 echo "\n\t</table>\n\t</div>"; 329 304 330 331 305 echo "\n\t".'<div class="table table_discussion">'; 332 306 echo "\n\t".'<p class="sub">' . __('Discussion') . '</p>'."\n\t".'<table>'; … … 385 359 386 360 echo "\n\t".'<div class="versions">'; 387 $ ct = current_theme_info();361 $theme = wp_get_theme(); 388 362 389 363 echo "\n\t<p>"; 390 364 391 if ( empty( $ct->stylesheet_dir) ) {365 if ( $theme->errors() ) { 392 366 if ( ! is_multisite() || is_super_admin() ) 393 367 echo '<span class="error-message">' . __('ERROR: The themes directory is either empty or doesn’t exist. Please check your installation.') . '</span>'; … … 403 377 $num = number_format_i18n( $num_widgets ); 404 378 405 $switch_themes = $ ct->title;379 $switch_themes = $theme->display('Name'); 406 380 if ( current_user_can( 'switch_themes') ) 407 381 $switch_themes = '<a href="themes.php">' . $switch_themes . '</a>'; … … 413 387 } else { 414 388 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') ); 416 390 else 417 printf( __('Theme <span class="b">%1$s</span>'), $ ct->title);391 printf( __('Theme <span class="b">%1$s</span>'), $theme->display('Name') ); 418 392 } 419 393 echo '</p>'; … … 463 437 <?php do_action( 'wpmuadminresult', '' ); ?> 464 438 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"> 466 440 <p> 467 <input type=" text" name="s" value="" size="17" />441 <input type="search" name="s" value="" size="30" autocomplete="off" /> 468 442 <?php submit_button( __( 'Search Users' ), 'button', 'submit', false, array( 'id' => 'submit_users' ) ); ?> 469 443 </p> 470 444 </form> 471 445 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"> 473 447 <p> 474 <input type=" text" name="s" value="" size="17" />448 <input type="search" name="s" value="" size="30" autocomplete="off" /> 475 449 <?php submit_button( __( 'Search Sites' ), 'button', 'submit', false, array( 'id' => 'submit_sites' ) ); ?> 476 450 </p> … … 616 590 global $wpdb; 617 591 618 if ( current_user_can('edit_posts') )619 $allowed_states = array('0', '1');620 else621 $allowed_states = array('1');622 623 592 // Select all comment types and filter out spam later for better query performance. 624 593 $comments = array(); … … 629 598 ? absint( $widgets['dashboard_recent_comments']['items'] ) : 5; 630 599 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 ) ) { 633 605 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">'; 648 618 foreach ( $comments as $comment ) 649 619 _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(); 658 624 659 625 wp_comment_reply( -1, false, 'dashboard', false ); 660 626 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 } 669 630 } 670 631 … … 701 662 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . esc_attr__('Edit comment') . "'>". __('Edit') . '</a>'; 702 663 $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>'; 704 665 if ( !EMPTY_TRASH_DAYS ) 705 666 $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>'; … … 938 899 wp_dashboard_cached_rss_widget( 'dashboard_plugins', 'wp_dashboard_plugins_output', array( 939 900 '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/' 942 902 ) ); 943 903 } … … 951 911 $popular = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/popular/' ); 952 912 $new = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/new/' ); 953 $updated = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/updated/' );954 913 955 914 if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) { … … 958 917 } 959 918 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 ) { 961 920 if ( is_wp_error($$feed) || !$$feed->get_item_quantity() ) 962 921 continue; … … 1116 1075 $_POST['widget-rss'][$number] = stripslashes_deep( $_POST['widget-rss'][$number] ); 1117 1076 $widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] ); 1118 // title is optional. If black, fill it if possible1077 // title is optional. If black, fill it if possible 1119 1078 if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) { 1120 1079 $rss = fetch_feed($widget_options[$widget_id]['url']); … … 1194 1153 } 1195 1154 $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>'; 1197 1162 $notice .= '<p class="hide-if-no-js"><a href="" class="dismiss">' . __( 'Dismiss' ) . '</a></p>'; 1198 1163 $notice .= '<div class="clear"></div>'; … … 1229 1194 $options = array( 1230 1195 'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ), 1231 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url')1196 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url() 1232 1197 ); 1233 1198 … … 1248 1213 * 'img_src_ssl' - string - An image (over SSL) representing the browser 1249 1214 */ 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 ) ) 1253 1218 return false; 1254 1219 … … 1267 1232 * Displays a welcome panel to introduce users to WordPress. 1268 1233 * 1269 * @since 3.3 1234 * @since 3.3.0 1270 1235 */ 1271 1236 function wp_welcome_panel() { … … 1291 1256 1292 1257 <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> 1294 1259 <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’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> 1295 1260 <div class="welcome-panel-column-container"> … … 1317 1282 <h4><span class="icon16 icon-appearance"></span> <?php _e( 'Customize Your Site' ); ?></h4> 1318 1283 <?php 1319 $ ct = current_theme_info();1320 if ( empty ( $ct->stylesheet_dir) ) :1284 $theme = wp_get_theme(); 1285 if ( $theme->errors() ) : 1321 1286 echo '<p>'; 1322 1287 printf( __( '<a href="%s">Install a theme</a> to get started customizing your site.' ), esc_url( admin_url( 'themes.php' ) ) ); … … 1324 1289 else: 1325 1290 $customize_links = array(); 1326 if ( 'twentyeleven' == $ ct->stylesheet)1291 if ( 'twentyeleven' == $theme->get_stylesheet() ) 1327 1292 $customize_links[] = sprintf( __( '<a href="%s">Choose light or dark</a>' ), esc_url( admin_url( 'themes.php?page=theme_options' ) ) ); 1328 1293 … … 1338 1303 if ( ! empty( $customize_links ) ) { 1339 1304 echo '<p>'; 1340 printf( __( 'Use the current theme — %1$s — 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 — %1$s — 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' ) ) ); 1341 1306 echo '</p>'; 1342 1307 ?> … … 1349 1314 } else { 1350 1315 echo '<p>'; 1351 printf( __( 'Use the current theme — %1$s — or <a href="%2$s">choose a new one</a>.' ), $ ct->title, esc_url( admin_url( 'themes.php' ) ) );1316 printf( __( 'Use the current theme — %1$s — or <a href="%2$s">choose a new one</a>.' ), $theme->display('Name'), esc_url( admin_url( 'themes.php' ) ) ); 1352 1317 echo '</p>'; 1353 1318 } … … 1360 1325 <?php 1361 1326 } 1362 1363 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)