';
-}
-
function wp_dashboard_recent_drafts( $drafts = false ) {
if ( !$drafts ) {
$drafts_query = new WP_Query( array(
@@ -581,7 +600,7 @@ function wp_dashboard_recent_drafts( $drafts = false ) {
\n
", $list ); ?>
-
+
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" ) ) {
+ 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" ) ) {
foreach ( $possible as $comment ) {
if ( count( $comments ) >= $total_items )
@@ -634,7 +653,7 @@ function wp_dashboard_recent_comments() {
-
';
+ wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_rss_output' );
}
function wp_dashboard_primary_control() {
@@ -877,7 +896,7 @@ function wp_dashboard_rss_output( $widget_id ) {
}
function wp_dashboard_secondary() {
- echo '
' . __( 'Loading…' ) . '
' . __('This widget requires JavaScript.') . '
';
+ wp_dashboard_cached_rss_widget( 'dashboard_secondary', 'wp_dashboard_secondary_output' );
}
function wp_dashboard_secondary_control() {
@@ -916,7 +935,11 @@ function wp_dashboard_secondary_output() {
}
function wp_dashboard_plugins() {
- echo '
' . __( 'Loading…' ) . '
' . __('This widget requires JavaScript.') . '
';
+ wp_dashboard_cached_rss_widget( 'dashboard_plugins', 'wp_dashboard_plugins_output', array(
+ 'http://wordpress.org/extend/plugins/rss/browse/popular/',
+ 'http://wordpress.org/extend/plugins/rss/browse/new/',
+ 'http://wordpress.org/extend/plugins/rss/browse/updated/'
+ ) );
}
/**
@@ -1004,7 +1027,7 @@ function wp_dashboard_plugins_output() {
* Checks to see if all of the feed url in $check_urls are cached.
*
* If $check_urls is empty, look for the rss feed url found in the dashboard
- * widget optios of $widget_id. If cached, call $callback, a function that
+ * widget options of $widget_id. If cached, call $callback, a function that
* echoes out output for this widget. If not cache, echo a "Loading..." stub
* which is later replaced by AJAX call (see top of /wp-admin/index.php)
*
@@ -1016,30 +1039,35 @@ function wp_dashboard_plugins_output() {
* @return bool False on failure. True on success.
*/
function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) {
- $loading = '
';
+ $notice .= '';
+ }
+
+ echo apply_filters( 'browse-happy-notice', $notice, $response );
+}
+
+function dashboard_browser_nag_class( $classes ) {
+ $response = wp_check_browser_version();
+
+ if ( $response && $response['insecure'] )
+ $classes[] = 'browser-insecure';
+
+ return $classes;
+}
+
+/**
+ * Check if the user needs a browser update
+ *
+ * @since 3.2.0
+ *
+ * @return array|bool False on failure, array of browser data on success.
+ */
+function wp_check_browser_version() {
+ if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
+ return false;
+
+ $key = md5( $_SERVER['HTTP_USER_AGENT'] );
+
+ if ( false === ($response = get_site_transient('browser_' . $key) ) ) {
+ global $wp_version;
+
+ $options = array(
+ 'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ),
+ 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
+ );
+
+ $response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.0/', $options );
+
+ if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
+ return false;
+
+ /**
+ * Response should be an array with:
+ * 'name' - string - A user friendly browser name
+ * 'version' - string - The most recent version of the browser
+ * 'current_version' - string - The version of the browser the user is using
+ * 'upgrade' - boolean - Whether the browser needs an upgrade
+ * 'insecure' - boolean - Whether the browser is deemed insecure
+ * 'upgrade_url' - string - The url to visit to upgrade
+ * 'img_src' - string - An image representing the browser
+ * 'img_src_ssl' - string - An image (over SSL) representing the browser
+ */
+ $response = unserialize( wp_remote_retrieve_body( $response ) );
+
+ if ( ! $response )
+ return false;
+
+ set_site_transient( 'browser_' . $key, $response, 604800 ); // cache for 1 week
+ }
+
+ return $response;
+}
+
/**
* Empty function usable by plugins to output empty dashboard widget (to be populated later by JS).
*/
function wp_dashboard_empty() {}
+/**
+ * Displays a welcome panel to introduce users to WordPress.
+ *
+ * @since 3.3
+ */
+function wp_welcome_panel() {
+ global $wp_version;
+
+ if ( ! current_user_can( 'edit_theme_options' ) )
+ return;
+
+ $classes = 'welcome-panel';
+
+ $option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
+ // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
+ $hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
+ if ( $hide )
+ $classes .= ' hidden';
+
+ list( $display_version ) = explode( '-', $wp_version );
+ ?>
+
+
+
+
+
+
+
+
First Steps with WordPress. 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.' ); ?>
+
+
+
+
+
+
Choose your privacy setting' ), esc_url( admin_url('options-privacy.php') ) ); ?>
+
Select your tagline and time zone' ), esc_url( admin_url('options-general.php') ) ); ?>
+
Turn comments on or off' ), esc_url( admin_url('options-discussion.php') ) ); ?>
+
Fill in your profile' ), esc_url( admin_url('profile.php') ) ); ?>
';
+ printf( __( 'Use the current theme — %1$s — or choose a new one. 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 );
+ echo '
';
+ ?>
+
+
+
+
+
+ ';
+ printf( __( 'Use the current theme — %1$s — or choose a new one.' ), $ct->title, esc_url( admin_url( 'themes.php' ) ) );
+ echo '';
+ }
+ endif; ?>
+