diff -r 490d5cc509ed -r cf61fcea0001 wp/wp-admin/includes/dashboard.php --- a/wp/wp-admin/includes/dashboard.php Tue Jun 09 11:14:17 2015 +0000 +++ b/wp/wp-admin/includes/dashboard.php Mon Oct 14 17:39:30 2019 +0200 @@ -12,6 +12,10 @@ * Handles POST data, sets up filters. * * @since 2.5.0 + * + * @global array $wp_registered_widgets + * @global array $wp_registered_widget_controls + * @global array $wp_dashboard_control_callbacks */ function wp_dashboard_setup() { global $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks; @@ -20,6 +24,18 @@ /* Register Widgets and Controls */ + // Try Gutenberg + + // If Gutenberg isn't activated, only show the panel to users who can install and activate it. + $plugins = get_plugins(); + if ( is_plugin_inactive( 'gutenberg/gutenberg.php' ) && ! current_user_can( 'install_plugins' ) ) { + remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' ); + } + // If Gutenberg is activated, only show it to users who can use it. + if ( is_plugin_active( 'gutenberg/gutenberg.php' ) && ! current_user_can( 'edit_posts' ) ) { + remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' ); + } + $response = wp_check_browser_version(); if ( $response && $response['upgrade'] ) { @@ -43,13 +59,13 @@ } // QuickPress Widget - if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) { - $quick_draft_title = sprintf( '%1$s %2$s', __( 'Quick Draft' ), __( 'Drafts' ) ); + if ( is_blog_admin() && current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { + $quick_draft_title = sprintf( '%1$s %2$s', __( 'Quick Draft' ), __( 'Your Recent Drafts' ) ); wp_add_dashboard_widget( 'dashboard_quick_press', $quick_draft_title, 'wp_dashboard_quick_press' ); } - // WordPress News - wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress News' ), 'wp_dashboard_primary' ); + // WordPress Events and News + wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress Events and News' ), 'wp_dashboard_events_news' ); if ( is_network_admin() ) { @@ -61,7 +77,7 @@ do_action( 'wp_network_dashboard_setup' ); /** - * Filter the list of widgets to load for the Network Admin dashboard. + * Filters the list of widgets to load for the Network Admin dashboard. * * @since 3.1.0 * @@ -78,7 +94,7 @@ do_action( 'wp_user_dashboard_setup' ); /** - * Filter the list of widgets to load for the User Admin dashboard. + * Filters the list of widgets to load for the User Admin dashboard. * * @since 3.1.0 * @@ -95,7 +111,7 @@ do_action( 'wp_dashboard_setup' ); /** - * Filter the list of widgets to load for the admin dashboard. + * Filters the list of widgets to load for the admin dashboard. * * @since 2.5.0 * @@ -125,10 +141,33 @@ do_action( 'do_meta_boxes', $screen->id, 'side', '' ); } +/** + * Adds a new dashboard widget. + * + * @since 2.7.0 + * + * @global array $wp_dashboard_control_callbacks + * + * @param string $widget_id Widget ID (used in the 'id' attribute for the widget). + * @param string $widget_name Title of the widget. + * @param callable $callback Function that fills the widget with the desired content. + * The function should echo its output. + * @param callable $control_callback Optional. Function that outputs controls for the widget. Default null. + * @param array $callback_args Optional. Data that should be set as the $args property of the widget array + * (which is the second parameter passed to your callback). Default null. + */ function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null ) { $screen = get_current_screen(); global $wp_dashboard_control_callbacks; + $private_callback_args = array( '__widget_basename' => $widget_name ); + + if ( is_null( $callback_args ) ) { + $callback_args = $private_callback_args; + } else if ( is_array( $callback_args ) ) { + $callback_args = array_merge( $callback_args, $private_callback_args ); + } + if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) { $wp_dashboard_control_callbacks[$widget_id] = $control_callback; if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) { @@ -154,8 +193,17 @@ add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority, $callback_args ); } +/** + * Outputs controls for the current dashboard widget. + * + * @access private + * @since 2.7.0 + * + * @param mixed $dashboard + * @param array $meta_box + */ function _wp_dashboard_control_callback( $dashboard, $meta_box ) { - echo '
'; + echo ''; wp_dashboard_trigger_widget_control( $meta_box['id'] ); wp_nonce_field( 'edit-dashboard-widget_' . $meta_box['id'], 'dashboard-widget-nonce' ); echo ''; @@ -235,22 +283,27 @@ } // Comments $num_comm = wp_count_comments(); - if ( $num_comm && $num_comm->approved ) { + if ( $num_comm && ( $num_comm->approved || $num_comm->moderated ) ) { $text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->approved ), number_format_i18n( $num_comm->approved ) ); ?>
  • moderated ) { - /* translators: Number of comments in moderation */ - $text = sprintf( _nx( '%s in moderation', '%s in moderation', $num_comm->moderated, 'comments' ), number_format_i18n( $num_comm->moderated ) ); - ?> -
  • - moderated ); + /* translators: %s: number of comments in moderation */ + $text = sprintf( _nx( '%s in moderation', '%s in moderation', $num_comm->moderated, 'comments' ), $moderated_comments_count_i18n ); + /* translators: %s: number of comments in moderation */ + $aria_label = sprintf( _nx( '%s comment in moderation', '%s comments in moderation', $num_comm->moderated, 'comments' ), $moderated_comments_count_i18n ); + ?> +
  • + $content

    "; + echo "

    $content

    "; } ?> @@ -336,6 +391,9 @@ - 'submit_users' ) ); ?> + 'submit_users' ) ); ?>

    @@ -389,21 +450,21 @@

    - 'submit_sites' ) ); ?> + 'submit_sites' ) ); ?>

    ID ); // Save post_ID } @@ -479,6 +546,8 @@ * Show recent drafts of the user on the dashboard. * * @since 2.7.0 + * + * @param array $drafts */ function wp_dashboard_recent_drafts( $drafts = false ) { if ( ! $drafts ) { @@ -490,6 +559,16 @@ 'orderby' => 'modified', 'order' => 'DESC' ); + + /** + * Filters the post query arguments for the 'Recent Drafts' dashboard widget. + * + * @since 4.4.0 + * + * @param array $query_args The query arguments for the 'Recent Drafts' dashboard widget. + */ + $query_args = apply_filters( 'dashboard_recent_drafts_query_args', $query_args ); + $drafts = get_posts( $query_args ); if ( ! $drafts ) { return; @@ -498,17 +577,18 @@ echo '
    '; if ( count( $drafts ) > 3 ) { - echo '

    ' . _x( 'View all', 'drafts' ) . "

    \n"; + echo '

    ' . __( 'View all drafts' ) . "

    \n"; } - echo '

    ' . __( 'Drafts' ) . "

    \n
    "; } +/** + * Outputs a row for the Recent Comments widget. + * + * @access private + * @since 2.7.0 + * + * @global WP_Comment $comment + * + * @param WP_Comment $comment The current comment. + * @param bool $show_date Optional. Whether to display the date. + */ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { - $GLOBALS['comment'] =& $comment; + $GLOBALS['comment'] = clone $comment; - $comment_post_title = _draft_or_post_title( $comment->comment_post_ID ); + if ( $comment->comment_post_ID > 0 ) { - if ( current_user_can( 'edit_post', $comment->comment_post_ID ) ) { - $comment_post_url = get_edit_post_link( $comment->comment_post_ID ); + $comment_post_title = _draft_or_post_title( $comment->comment_post_ID ); + $comment_post_url = get_the_permalink( $comment->comment_post_ID ); $comment_post_link = "$comment_post_title"; } else { - $comment_post_link = $comment_post_title; + $comment_post_link = ''; } - $comment_link = '#'; - $actions_string = ''; if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) { // Pre-order it: Approve | Reply | Edit | Spam | Trash. @@ -539,7 +628,8 @@ 'reply' => '', 'edit' => '', 'spam' => '', - 'trash' => '', 'delete' => '' + 'trash' => '', 'delete' => '', + 'view' => '', ); $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); @@ -551,26 +641,30 @@ $trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); $delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); - $actions['approve'] = "" . __( 'Approve' ) . ''; - $actions['unapprove'] = "" . __( 'Unapprove' ) . ''; - $actions['edit'] = "". __('Edit') . ''; - $actions['reply'] = '' . __('Reply') . ''; - $actions['spam'] = "" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . ''; - if ( !EMPTY_TRASH_DAYS ) - $actions['delete'] = "" . __('Delete Permanently') . ''; - else - $actions['trash'] = "" . _x('Trash', 'verb') . ''; + $actions['approve'] = "" . __( 'Approve' ) . ''; + $actions['unapprove'] = "" . __( 'Unapprove' ) . ''; + $actions['edit'] = "". __( 'Edit' ) . ''; + $actions['reply'] = '' . __( 'Reply' ) . ''; + $actions['spam'] = "" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . ''; + + if ( ! EMPTY_TRASH_DAYS ) { + $actions['delete'] = "" . __( 'Delete Permanently' ) . ''; + } else { + $actions['trash'] = "" . _x( 'Trash', 'verb' ) . ''; + } + + $actions['view'] = '' . __( 'View' ) . ''; /** - * Filter the action links displayed for each comment in the 'Recent Comments' + * Filters the action links displayed for each comment in the 'Recent Comments' * dashboard widget. * * @since 2.6.0 * - * @param array $actions An array of comment actions. Default actions include: - * 'Approve', 'Unapprove', 'Edit', 'Reply', 'Spam', - * 'Delete', and 'Trash'. - * @param object $comment The comment object. + * @param array $actions An array of comment actions. Default actions include: + * 'Approve', 'Unapprove', 'Edit', 'Reply', 'Spam', + * 'Delete', and 'Trash'. + * @param WP_Comment $comment The comment object. */ $actions = apply_filters( 'comment_row_actions', array_filter($actions), $comment ); @@ -580,26 +674,46 @@ ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; // Reply and quickedit need a hide-if-no-js span - if ( 'reply' == $action || 'quickedit' == $action ) + if ( 'reply' == $action || 'quickedit' == $action ) { $action .= ' hide-if-no-js'; + } + if ( 'view' === $action && '1' !== $comment->comment_approved ) { + $action .= ' hidden'; + } $actions_string .= "$sep$link"; } } - ?> -
    comment_ID) ) ); ?>> +
  • > comment_type || 'comment' == $comment->comment_type ) : ?> -
    -

    - ' . get_comment_author_link() . '', $comment_post_link.' '.$comment_link, ' ' . __( '[Pending]' ) . '' ); ?> -

    +
    +

    + ' . 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]' ) . '' + ); + } + ?> +

    -
    - -

    $type", $comment_post_link." ".$comment_link ); ?>

    -

    +
    +

    + $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]' ) . '' + ); + } + ?> +

    +

    -

    +

    +

    +
    -
    +
  • '; - echo '

    '; + echo ''; echo '

    ' . __( 'No activity yet!' ) . '

    '; echo '
    '; } @@ -693,7 +829,7 @@ ); /** - * Filter the query arguments used for the Recent Posts widget. + * Filters the query arguments used for the Recent Posts widget. * * @since 4.2.0 * @@ -706,7 +842,7 @@ echo '
    '; - echo '

    ' . $args['title'] . '

    '; + echo '

    ' . $args['title'] . '

    '; echo ''; @@ -766,6 +912,9 @@ $comments_query['status'] = 'approve'; while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) { + if ( ! is_array( $possible ) ) { + break; + } foreach ( $possible as $comment ) { if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) ) continue; @@ -779,15 +928,17 @@ if ( $comments ) { echo '
    '; - echo '

    ' . __( 'Comments' ) . '

    '; + echo '

    ' . __( 'Recent Comments' ) . '

    '; - echo '
    '; + echo '
      '; foreach ( $comments as $comment ) _wp_dashboard_recent_comments_row( $comment ); - echo '
    '; + echo ''; - if ( current_user_can('edit_posts') ) - _get_list_table('WP_Comments_List_Table')->views(); + if ( current_user_can( 'edit_posts' ) ) { + echo '

    ' . __( 'View more comments' ) . '

    '; + _get_list_table( 'WP_Comments_List_Table' )->views(); + } wp_comment_reply( -1, false, 'dashboard', false ); wp_comment_trashnotice(); @@ -819,18 +970,18 @@ * 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) + * which is later replaced by Ajax call (see top of /wp-admin/index.php) * * @since 2.5.0 * * @param string $widget_id - * @param callback $callback + * @param callable $callback * @param array $check_urls RSS feeds * @return bool False on failure. True on success. */ function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) { - $loading = '

    ' . __( 'Loading…' ) . '

    ' . __( 'This widget requires JavaScript.' ) . '

    '; - $doing_ajax = ( defined('DOING_AJAX') && DOING_AJAX ); + $loading = '

    ' . __( 'Loading…' ) . '

    ' . __( 'This widget requires JavaScript.' ) . '

    '; + $doing_ajax = wp_doing_ajax(); if ( empty($check_urls) ) { $widgets = get_option( 'dashboard_widget_options' ); @@ -841,7 +992,8 @@ $check_urls = array( $widgets[$widget_id]['url'] ); } - $cache_key = 'dash_' . md5( $widget_id ); + $locale = get_user_locale(); + $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); if ( false !== ( $output = get_transient( $cache_key ) ) ) { echo $output; return true; @@ -863,14 +1015,17 @@ return true; } -/* Dashboard Widgets Controls */ +// +// Dashboard Widgets Controls +// -// Calls widget_control callback /** * Calls widget control callback. * * @since 2.5.0 * + * @global array $wp_dashboard_control_callbacks + * * @param int $widget_control_id Registered Widget ID. */ function wp_dashboard_trigger_widget_control( $widget_control_id = false ) { @@ -919,33 +1074,233 @@ } } update_option( 'dashboard_widget_options', $widget_options ); - $cache_key = 'dash_' . md5( $widget_id ); + $locale = get_user_locale(); + $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); delete_transient( $cache_key ); } wp_widget_rss_form( $widget_options[$widget_id], $form_inputs ); } + +/** + * Renders the Events and News dashboard widget. + * + * @since 4.8.0 + */ +function wp_dashboard_events_news() { + wp_print_community_events_markup(); + + ?> + +
    + +
    + + + + + +
    +

    + +

    + + + + +
    + +
    + +
    + + + + + + + + + + + + + + array( /** - * Filter the primary link URL for the 'WordPress News' dashboard widget. + * Filters the primary link URL for the 'WordPress News' dashboard widget. * * @since 2.5.0 * * @param string $link The widget's primary link URL. */ - 'link' => apply_filters( 'dashboard_primary_link', __( 'http://wordpress.org/news/' ) ), + 'link' => apply_filters( 'dashboard_primary_link', __( 'https://wordpress.org/news/' ) ), /** - * Filter the primary feed URL for the 'WordPress News' dashboard widget. + * Filters the primary feed URL for the 'WordPress News' dashboard widget. * * @since 2.3.0 * @@ -954,7 +1309,7 @@ 'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ), /** - * Filter the primary link title for the 'WordPress News' dashboard widget. + * Filters the primary link title for the 'WordPress News' dashboard widget. * * @since 2.3.0 * @@ -962,14 +1317,14 @@ */ 'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ), 'items' => 1, - 'show_summary' => 1, + 'show_summary' => 0, 'show_author' => 0, - 'show_date' => 1, + 'show_date' => 0, ), 'planet' => array( /** - * Filter the secondary link URL for the 'WordPress News' dashboard widget. + * Filters the secondary link URL for the 'WordPress News' dashboard widget. * * @since 2.3.0 * @@ -978,7 +1333,7 @@ 'link' => apply_filters( 'dashboard_secondary_link', __( 'https://planet.wordpress.org/' ) ), /** - * Filter the secondary feed URL for the 'WordPress News' dashboard widget. + * Filters the secondary feed URL for the 'WordPress News' dashboard widget. * * @since 2.3.0 * @@ -987,34 +1342,28 @@ 'url' => apply_filters( 'dashboard_secondary_feed', __( 'https://planet.wordpress.org/feed/' ) ), /** - * Filter the secondary link title for the 'WordPress News' dashboard widget. + * Filters the secondary link title for the 'WordPress 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' ) ), - 'items' => 3, + + /** + * Filters the number of secondary link items for the 'WordPress 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, ) ); - if ( ( ! is_multisite() && is_blog_admin() && current_user_can( 'install_plugins' ) ) || ( is_network_admin() && current_user_can( 'manage_network_plugins' ) && current_user_can( 'install_plugins' ) ) ) { - $feeds['plugins'] = array( - 'link' => '', - 'url' => array( - 'popular' => 'http://wordpress.org/plugins/rss/browse/popular/', - ), - 'title' => '', - 'items' => 1, - 'show_summary' => 0, - 'show_author' => 0, - 'show_date' => 0, - ); - } - wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_primary_output', $feeds ); } @@ -1022,105 +1371,29 @@ * Display the WordPress 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 ) { + foreach ( $feeds as $type => $args ) { $args['type'] = $type; echo '
    '; - if ( $type === 'plugins' ) { - wp_dashboard_plugins_output( $args['url'], $args ); - } else { wp_widget_rss_output( $args['url'], $args ); - } echo "
    "; } } /** - * Display plugins text for the WordPress news widget. - * - * @since 2.5.0 - */ -function wp_dashboard_plugins_output( $rss, $args = array() ) { - // Plugin feeds plus link to install them - $popular = fetch_feed( $args['url']['popular'] ); - - if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) { - $plugin_slugs = array_keys( get_plugins() ); - set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS ); - } - - echo ''; -} - -/** * Display file upload quota on dashboard. * - * Runs on the activity_box_end hook in wp_dashboard_right_now(). + * Runs on the {@see 'activity_box_end'} hook in wp_dashboard_right_now(). * * @since 3.0.0 * * @return bool|null True if not multisite, user can't upload files, or the space check option is disabled. -*/ + */ function wp_dashboard_quota() { if ( !is_multisite() || !current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) ) return true; @@ -1137,20 +1410,20 @@ $percentused = number_format( $percentused ); ?> -

    +

    • %3$s', + '%2$s (%3$s)', esc_url( admin_url( 'upload.php' ) ), - __( 'Manage Uploads' ), - $text + $text, + __( 'Manage Uploads' ) ); ?>
    • %3$s', + '%2$s (%3$s)', esc_url( admin_url( 'upload.php' ) ), - __( 'Manage Uploads' ), - $text + $text, + __( 'Manage Uploads' ) ); ?>
    %s. Using an outdated browser makes your computer unsafe. For the best WordPress experience, please update your browser." ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ) ); + /* translators: %s: browser name and link */ + $msg = sprintf( __( "It looks like you're using an insecure version of %s. Using an outdated browser makes your computer unsafe. For the best WordPress experience, please update your browser." ), + sprintf( '%s', esc_url( $response['update_url'] ), esc_html( $response['name'] ) ) + ); } else { - $msg = sprintf( __( "It looks like you're using an old version of %s. For the best WordPress experience, please update your browser." ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ) ); + /* translators: %s: browser name and link */ + $msg = sprintf( __( "It looks like you're using an old version of %s. For the best WordPress experience, please update your browser." ), + sprintf( '%s', esc_url( $response['update_url'] ), esc_html( $response['name'] ) ) + ); } $browser_nag_class = ''; @@ -1193,18 +1471,18 @@ } $notice .= "

    {$msg}

    "; - $browsehappy = 'http://browsehappy.com/'; - $locale = get_locale(); + $browsehappy = 'https://browsehappy.com/'; + $locale = get_user_locale(); if ( 'en_US' !== $locale ) $browsehappy = add_query_arg( 'locale', $locale, $browsehappy ); $notice .= '

    ' . sprintf( __( 'Update %2$s or learn how to browse happy' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), esc_url( $browsehappy ) ) . '

    '; - $notice .= '

    ' . __( 'Dismiss' ) . '

    '; + $notice .= '

    ' . __( 'Dismiss' ) . '

    '; $notice .= '
    '; } /** - * Filter the notice output for the 'Browse Happy' nag meta box. + * Filters the notice output for the 'Browse Happy' nag meta box. * * @since 3.2.0 * @@ -1214,6 +1492,12 @@ 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(); @@ -1237,26 +1521,33 @@ $key = md5( $_SERVER['HTTP_USER_AGENT'] ); if ( false === ($response = get_site_transient('browser_' . $key) ) ) { - global $wp_version; + // 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() + 'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ), + 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ) ); - $response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.1/', $options ); + 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: - * '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 + * '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 - * 'upgrade_url' - string - The url to visit to upgrade + * '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 */ @@ -1284,21 +1575,22 @@ function wp_welcome_panel() { ?>
    -

    +

    - -

    + +

    true ) ) ) > 1 ) ) : ?> -

    change your theme completely' ), admin_url( 'themes.php' ) ); ?>

    + +

    change your theme completely' ), $themes_link ); ?>

    -

    +

    • ' . __( 'Edit your front page' ) . '', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?>
    • @@ -1315,7 +1607,7 @@
    -

    +

    • +
      +

      + +

      + +
      + +
      +
      + + + <?php esc_attr_e( 'Screenshot from the Gutenberg interface' ); ?> + +
      +
      + +
      +

      + +

      + + testing, filing bugs, or contributing on the GitHub repository.' ), + 'https://make.wordpress.org/test/handbook/call-for-testing/gutenberg-testing/', + 'https://github.com/WordPress/gutenberg/issues', + 'https://github.com/WordPress/gutenberg/blob/master/CONTRIBUTING.md' + ); + ?> +

      +
      + +
      + +

      + + +

      + Learn more about Gutenberg' ), + __( 'https://wordpress.org/gutenberg/' ) + ); + + /** + * Filters the "Learn more" link in the Try Gutenberg panel. + * + * It allows hosts or site owners to change the link, to provide extra + * information about Gutenberg, specific to their service. + * + * WARNING: This filter will only exist in the 4.9.x series, it will not be + * added to WordPress 5.0 and later. + * + * @since 4.9.8 + */ + echo apply_filters( 'try_gutenberg_learn_more_link', $learnmore ); + ?> +

      +
      +
      + +
      + +
      +

      + +

      + + Classic Editor plugin to keep using the current editor until you’re ready to make the switch.' ), + __( 'https://wordpress.org/plugins/classic-editor' ) + ); + ?> +

      +
      + + +
      +

      +
      + +
      +
      +
      +