~canonical-sysadmins/wordpress/4.9.2

« back to all changes in this revision

Viewing changes to wp-admin/includes/dashboard.php

  • Committer: Barry Price
  • Date: 2017-11-17 04:49:02 UTC
  • mfrom: (1.1.30 upstream)
  • Revision ID: barry.price@canonical.com-20171117044902-5frux4ycbq6g9fyf
Merge WP4.9 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
 
49
49
        // QuickPress Widget
50
50
        if ( is_blog_admin() && current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
51
 
                $quick_draft_title = sprintf( '<span class="hide-if-no-js">%1$s</span> <span class="hide-if-js">%2$s</span>', __( 'Quick Draft' ), __( 'Drafts' ) );
 
51
                $quick_draft_title = sprintf( '<span class="hide-if-no-js">%1$s</span> <span class="hide-if-js">%2$s</span>', __( 'Quick Draft' ), __( 'Your Recent Drafts' ) );
52
52
                wp_add_dashboard_widget( 'dashboard_quick_press', $quick_draft_title, 'wp_dashboard_quick_press' );
53
53
        }
54
54
 
277
277
                <li class="comment-count"><a href="edit-comments.php"><?php echo $text; ?></a></li>
278
278
                <?php
279
279
                $moderated_comments_count_i18n = number_format_i18n( $num_comm->moderated );
280
 
                /* translators: Number of comments in moderation */
 
280
                /* translators: %s: number of comments in moderation */
281
281
                $text = sprintf( _nx( '%s in moderation', '%s in moderation', $num_comm->moderated, 'comments' ), $moderated_comments_count_i18n );
282
 
                /* translators: Number of comments in moderation */
 
282
                /* translators: %s: number of comments in moderation */
283
283
                $aria_label = sprintf( _nx( '%s comment in moderation', '%s comments in moderation', $num_comm->moderated, 'comments' ), $moderated_comments_count_i18n );
284
284
                ?>
285
285
                <li class="comment-mod-count<?php
392
392
        $c_users = get_user_count();
393
393
        $c_blogs = get_blog_count();
394
394
 
395
 
        /* translators: 1: Number of users on the network */
 
395
        /* translators: %s: number of users on the network */
396
396
        $user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) );
397
 
        /* translators: 1: Number of sites on the network */
 
397
        /* translators: %s: number of sites on the network */
398
398
        $blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) );
399
399
 
400
 
        /* translators: 1: Text indicating the number of sites on the network, 2: Text indicating the number of users on the network */
 
400
        /* translators: 1: text indicating the number of sites on the network, 2: text indicating the number of users on the network */
401
401
        $sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text );
402
402
 
403
403
        if ( $actions ) {
419
419
                 * Fires in the Network Admin 'Right Now' dashboard widget
420
420
                 * just before the user and site search form fields.
421
421
                 *
422
 
                 * @since MU
 
422
                 * @since MU (3.0.0)
423
423
                 *
424
424
                 * @param null $unused
425
425
                 */
445
445
        /**
446
446
         * Fires at the end of the 'Right Now' widget in the Network Admin dashboard.
447
447
         *
448
 
         * @since MU
 
448
         * @since MU (3.0.0)
449
449
         */
450
450
        do_action( 'mu_rightnow_end' );
451
451
 
452
452
        /**
453
453
         * Fires at the end of the 'Right Now' widget in the Network Admin dashboard.
454
454
         *
455
 
         * @since MU
 
455
         * @since MU (3.0.0)
456
456
         */
457
457
        do_action( 'mu_activity_box_end' );
458
458
}
565
565
 
566
566
        echo '<div class="drafts">';
567
567
        if ( count( $drafts ) > 3 ) {
568
 
                echo '<p class="view-all"><a href="' . esc_url( admin_url( 'edit.php?post_status=draft' ) ) . '" aria-label="' . __( 'View all drafts' ) . '">' . _x( 'View all', 'drafts' ) . "</a></p>\n";
 
568
                echo '<p class="view-all"><a href="' . esc_url( admin_url( 'edit.php?post_status=draft' ) ) . '">' . __( 'View all drafts' ) . "</a></p>\n";
569
569
        }
570
 
        echo '<h2 class="hide-if-no-js">' . __( 'Drafts' ) . "</h2>\n<ul>";
 
570
        echo '<h2 class="hide-if-no-js">' . __( 'Your Recent Drafts' ) . "</h2>\n<ul>";
571
571
 
572
572
        $drafts = array_slice( $drafts, 0, 3 );
573
573
        foreach ( $drafts as $draft ) {
1114
1114
                        printf(
1115
1115
                                '<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
1116
1116
                                /* translators: If a Rosetta site exists (e.g. https://es.wordpress.org/news/), then use that. Otherwise, leave untranslated. */
1117
 
                                esc_url( __( 'https://wordpress.org/news/' ) ),
 
1117
                                esc_url( _x( 'https://wordpress.org/news/', 'Events and News dashboard widget' ) ),
1118
1118
                                __( 'News' ),
1119
1119
                                /* translators: accessibility text */
1120
1120
                                __( '(opens in a new window)' )
1207
1207
 
1208
1208
        <script id="tmpl-community-events-attend-event-near" type="text/template">
1209
1209
                <?php printf(
1210
 
                        /* translators: %s is a placeholder for the name of a city. */
 
1210
                        /* translators: %s: the name of a city */
1211
1211
                        __( 'Attend an upcoming event near %s.' ),
1212
1212
                        '<strong>{{ data.location.description }}</strong>'
1213
1213
                ); ?>
1258
1258
 
1259
1259
                        <# } else { #>
1260
1260
                                <?php printf(
1261
 
                                        /* translators: meetup organization documentation URL. */
 
1261
                                        /* translators: %s: meetup organization documentation URL */
1262
1262
                                        __( 'There aren&#8217;t any events scheduled near you at the moment. Would you like to <a href="%s">organize one</a>?' ),
1263
1263
                                        __( 'https://make.wordpress.org/community/handbook/meetup-organizer/welcome/' )
1264
1264
                                ); ?>
1403
1403
        <ul>
1404
1404
                <li class="storage-count">
1405
1405
                        <?php $text = sprintf(
1406
 
                                /* translators: number of megabytes */
 
1406
                                /* translators: %s: number of megabytes */
1407
1407
                                __( '%s MB Space Allowed' ),
1408
1408
                                number_format_i18n( $quota )
1409
1409
                        );
1459
1459
                }
1460
1460
                $notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>";
1461
1461
 
1462
 
                $browsehappy = 'http://browsehappy.com/';
 
1462
                $browsehappy = 'https://browsehappy.com/';
1463
1463
                $locale = get_user_locale();
1464
1464
                if ( 'en_US' !== $locale )
1465
1465
                        $browsehappy = add_query_arg( 'locale', $locale, $browsehappy );
1509
1509
        $key = md5( $_SERVER['HTTP_USER_AGENT'] );
1510
1510
 
1511
1511
        if ( false === ($response = get_site_transient('browser_' . $key) ) ) {
 
1512
                // include an unmodified $wp_version
 
1513
                include( ABSPATH . WPINC . '/version.php' );
 
1514
 
 
1515
                $url = 'http://api.wordpress.org/core/browse-happy/1.1/';
1512
1516
                $options = array(
1513
 
                        'body'                  => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ),
1514
 
                        'user-agent'    => 'WordPress/' . get_bloginfo( 'version' ) . '; ' . home_url()
 
1517
                        'body'       => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ),
 
1518
                        'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' )
1515
1519
                );
1516
1520
 
1517
 
                $response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.1/', $options );
 
1521
                if ( wp_http_supports( array( 'ssl' ) ) ) {
 
1522
                        $url = set_url_scheme( $url, 'https' );
 
1523
                }
 
1524
 
 
1525
                $response = wp_remote_post( $url, $options );
1518
1526
 
1519
1527
                if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
1520
1528
                        return false;
1559
1567
        <p class="about-description"><?php _e( 'We&#8217;ve assembled some links to get you started:' ); ?></p>
1560
1568
        <div class="welcome-panel-column-container">
1561
1569
        <div class="welcome-panel-column">
1562
 
                <?php if ( current_user_can( 'customize' ) ): ?>
 
1570
                <?php if ( current_user_can( 'customize' ) ) : ?>
1563
1571
                        <h3><?php _e( 'Get Started' ); ?></h3>
1564
1572
                        <a class="button button-primary button-hero load-customize hide-if-no-customize" href="<?php echo wp_customize_url(); ?>"><?php _e( 'Customize Your Site' ); ?></a>
1565
1573
                <?php endif; ?>
1566
1574
                <a class="button button-primary button-hero hide-if-customize" href="<?php echo admin_url( 'themes.php' ); ?>"><?php _e( 'Customize Your Site' ); ?></a>
1567
1575
                <?php if ( current_user_can( 'install_themes' ) || ( current_user_can( 'switch_themes' ) && count( wp_get_themes( array( 'allowed' => true ) ) ) > 1 ) ) : ?>
1568
 
                        <p class="hide-if-no-customize"><?php printf( __( 'or, <a href="%s">change your theme completely</a>' ), admin_url( 'themes.php' ) ); ?></p>
 
1576
                        <?php $themes_link = current_user_can( 'customize' ) ? add_query_arg( 'autofocus[panel]', 'themes', admin_url( 'customize.php' ) ) : admin_url( 'themes.php' ); ?>
 
1577
                        <p class="hide-if-no-customize"><?php printf( __( 'or, <a href="%s">change your theme completely</a>' ), $themes_link ); ?></p>
1569
1578
                <?php endif; ?>
1570
1579
        </div>
1571
1580
        <div class="welcome-panel-column">