' . __( 'Create a New Site' ) . '';
}
if ( current_user_can( 'create_users' ) ) {
$actions['create-user'] = '' . __( 'Create a New User' ) . '';
}
$c_users = get_user_count();
$c_blogs = get_blog_count();
/* translators: %s: number of users on the network */
$user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) );
/* translators: %s: number of sites on the network */
$blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) );
/* translators: 1: text indicating the number of sites on the network, 2: text indicating the number of users on the network */
$sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text );
if ( $actions ) {
echo '
";
/* translators: Maximum number of words used in a preview of a draft on the dashboard. */
$draft_length = intval( _x( '10', 'draft_length' ) );
$drafts = array_slice( $drafts, 0, 3 );
foreach ( $drafts as $draft ) {
$url = get_edit_post_link( $draft->ID );
$title = _draft_or_post_title( $draft->ID );
echo "
';
}
/**
* 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 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)
*
* @since 2.5.0
*
* @param string $widget_id The widget ID.
* @param callable $callback The callback funtion used to display each feed.
* @param array $check_urls RSS feeds
* @param mixed ...$args Optional additional parameters to pass to the callback function when it's called.
* @return bool False on failure. True on success.
*/
function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) {
$loading = '
%2$s %3$s',
'https://make.wordpress.org/community/meetups-landing-page',
__( 'Meetups' ),
/* translators: accessibility text */
__( '(opens in a new tab)' )
);
?>
|
%2$s %3$s',
'https://central.wordcamp.org/schedule/',
__( 'WordCamps' ),
/* translators: accessibility text */
__( '(opens in a new tab)' )
);
?>
|
%2$s %3$s',
/* translators: If a Rosetta site exists (e.g. https://es.wordpress.org/news/), then use that. Otherwise, leave untranslated. */
esc_url( _x( 'https://wordpress.org/news/', 'Events and News dashboard widget' ) ),
__( 'News' ),
/* translators: accessibility text */
__( '(opens in a new tab)' )
);
?>
array(
/**
* Filters the primary link URL for the 'WordPress Events and News' dashboard widget.
*
* @since 2.5.0
*
* @param string $link The widget's primary link URL.
*/
'link' => apply_filters( 'dashboard_primary_link', __( 'https://wordpress.org/news/' ) ),
/**
* Filters the primary feed URL for the 'WordPress Events and News' dashboard widget.
*
* @since 2.3.0
*
* @param string $url The widget's primary feed URL.
*/
'url' => apply_filters( 'dashboard_primary_feed', __( 'https://wordpress.org/news/feed/' ) ),
/**
* Filters the primary link title for the 'WordPress Events and News' dashboard widget.
*
* @since 2.3.0
*
* @param string $title Title attribute for the widget's primary link.
*/
'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ),
'items' => 1,
'show_summary' => 0,
'show_author' => 0,
'show_date' => 0,
),
'planet' => array(
/**
* Filters the secondary link URL for the 'WordPress Events and News' dashboard widget.
*
* @since 2.3.0
*
* @param string $link The widget's secondary link URL.
*/
'link' => apply_filters( 'dashboard_secondary_link', __( 'https://planet.wordpress.org/' ) ),
/**
* Filters the secondary feed URL for the 'WordPress Events and News' dashboard widget.
*
* @since 2.3.0
*
* @param string $url The widget's secondary feed URL.
*/
'url' => apply_filters( 'dashboard_secondary_feed', __( 'https://planet.wordpress.org/feed/' ) ),
/**
* Filters the secondary link title for the 'WordPress Events and News' dashboard widget.
*
* @since 2.3.0
*
* @param string $title Title attribute for the widget's secondary link.
*/
'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ),
/**
* Filters the number of secondary link items for the 'WordPress Events and News' dashboard widget.
*
* @since 4.4.0
*
* @param string $items How many items to show in the secondary feed.
*/
'items' => apply_filters( 'dashboard_secondary_items', 3 ),
'show_summary' => 0,
'show_author' => 0,
'show_date' => 0,
),
);
wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_primary_output', $feeds );
}
/**
* Display the WordPress events and news feeds.
*
* @since 3.8.0
* @since 4.8.0 Removed popular plugins feed.
*
* @param string $widget_id Widget ID.
* @param array $feeds Array of RSS feeds.
*/
function wp_dashboard_primary_output( $widget_id, $feeds ) {
foreach ( $feeds as $type => $args ) {
$args['type'] = $type;
echo '
';
$notice .= '';
}
/**
* Filters the notice output for the 'Browse Happy' nag meta box.
*
* @since 3.2.0
*
* @param string $notice The notice content.
* @param array $response An array containing web browser information. See `wp_check_browser_version()`.
*/
echo apply_filters( 'browse-happy-notice', $notice, $response );
}
/**
* @since 3.2.0
*
* @param array $classes
* @return array
*/
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 ) ) ) {
// include an unmodified $wp_version
include( ABSPATH . WPINC . '/version.php' );
$url = 'http://api.wordpress.org/core/browse-happy/1.1/';
$options = array(
'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ),
'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
);
if ( wp_http_supports( array( 'ssl' ) ) ) {
$url = set_url_scheme( $url, 'https' );
}
$response = wp_remote_post( $url, $options );
if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
return false;
}
/**
* Response should be an array with:
* 'platform' - string - A user-friendly platform name, if it can be determined
* 'name' - string - A user-friendly browser name
* 'version' - string - The version of the browser the user is using
* 'current_version' - string - The most recent version of the browser
* 'upgrade' - boolean - Whether the browser needs an upgrade
* 'insecure' - boolean - Whether the browser is deemed insecure
* 'update_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 = json_decode( wp_remote_retrieve_body( $response ), true );
if ( ! is_array( $response ) ) {
return false;
}
set_site_transient( 'browser_' . $key, $response, WEEK_IN_SECONDS );
}
return $response;
}
/**
* Displays the PHP update nag.
*
* @since 5.1.0
*/
function wp_dashboard_php_nag() {
$response = wp_check_php_version();
if ( ! $response ) {
return;
}
if ( isset( $response['is_secure'] ) && ! $response['is_secure'] ) {
$msg = __( 'WordPress has detected that your site is running on an insecure version of PHP.' );
} else {
$msg = __( 'WordPress has detected that your site is running on an outdated version of PHP.' );
}
?>
%2$s %3$s',
esc_url( wp_get_update_php_url() ),
__( 'Learn more about updating PHP' ),
/* translators: accessibility text */
__( '(opens in a new tab)' )
);
?>
true ) ) ) > 1 ) ) : ?>
change your theme completely' ), $themes_link ); ?>
' . __( 'Edit your front page' ) . '', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?>
' . get_comment_author_link( $comment ) . '', $comment_post_link, '' . __( '[Pending]' ) . '' ); } else { printf( /* translators: 1: comment author, 2: notification if the comment is pending */ __( 'From %1$s %2$s' ), '' . get_comment_author_link( $comment ) . '', '' . __( '[Pending]' ) . '' ); } ?>
comment_type ) { case 'pingback': $type = __( 'Pingback' ); break; case 'trackback': $type = __( 'Trackback' ); break; default: $type = ucwords( $comment->comment_type ); } $type = esc_html( $type ); ?>$type", $comment_post_link, '' . __( '[Pending]' ) . '' ); } else { printf( /* translators: 1: type of comment, 2: notification if the comment is pending */ _x( '%1$s %2$s', 'dashboard' ), "$type", '' . __( '[Pending]' ) . '' ); } ?>
' . __( 'No activity yet!' ) . '
'; echo '