Make WordPress Core

Ticket #50907: 50907.1.diff

File 50907.1.diff, 30.8 KB (added by audrasjb, 3 years ago)

New iteration based on what we shared with @karmatosed

  • src/js/_enqueues/admin/common.js

    diff --git a/src/js/_enqueues/admin/common.js b/src/js/_enqueues/admin/common.js
    index 3832bcac2c..ef92097f66 100644
    a b function deprecatedProperty( propName, version, replacement ) { 
    5555 * Deprecate all properties on an object.
    5656 *
    5757 * @since 5.5.1
    58  * @since 5.6.0 Added the `version` parameter.
    5958 *
    6059 * @param {string} name       The name of the object, i.e. commonL10n.
    6160 * @param {object} l10nObject The object to deprecate the properties on.
    62  * @param {string} version    The version of WordPress that deprecated the property.
    6361 *
    6462 * @return {object} The object with all its properties deprecated.
    6563 */
    66 function deprecateL10nObject( name, l10nObject, version ) {
     64function deprecateL10nObject( name, l10nObject ) {
    6765        var deprecatedObject = {};
    6866
    6967        Object.keys( l10nObject ).forEach( function( key ) {
    function deprecateL10nObject( name, l10nObject, version ) { 
    7270
    7371                if ( 'object' === typeof prop ) {
    7472                        Object.defineProperty( deprecatedObject, key, { get: function() {
    75                                 deprecatedProperty( propName, version, prop.alternative );
     73                                deprecatedProperty( propName, '5.5.0', prop.alternative );
    7674                                return prop.func();
    7775                        } } );
    7876                } else {
    7977                        Object.defineProperty( deprecatedObject, key, { get: function() {
    80                                 deprecatedProperty( propName, version, 'wp.i18n' );
     78                                deprecatedProperty( propName, '5.5.0', 'wp.i18n' );
    8179                                return prop;
    8280                        } } );
    8381                }
    window.commonL10n = window.commonL10n || { 
    10199        expandMenu: ''
    102100};
    103101
    104 window.commonL10n = deprecateL10nObject( 'commonL10n', window.commonL10n, '5.5.0' );
     102window.commonL10n = deprecateL10nObject( 'commonL10n', window.commonL10n );
    105103
    106104/**
    107105 * Removed in 5.5.0, needed for back-compatibility.
    window.wpPointerL10n = window.wpPointerL10n || { 
    113111        dismiss: ''
    114112};
    115113
    116 window.wpPointerL10n = deprecateL10nObject( 'wpPointerL10n', window.wpPointerL10n, '5.5.0' );
     114window.wpPointerL10n = deprecateL10nObject( 'wpPointerL10n', window.wpPointerL10n );
    117115
    118116/**
    119117 * Removed in 5.5.0, needed for back-compatibility.
    window.userProfileL10n = window.userProfileL10n || { 
    131129        ariaHide: ''
    132130};
    133131
    134 window.userProfileL10n = deprecateL10nObject( 'userProfileL10n', window.userProfileL10n, '5.5.0' );
     132window.userProfileL10n = deprecateL10nObject( 'userProfileL10n', window.userProfileL10n );
    135133
    136134/**
    137135 * Removed in 5.5.0, needed for back-compatibility.
    window.privacyToolsL10n = window.privacyToolsL10n || { 
    150148        exportError: ''
    151149};
    152150
    153 window.privacyToolsL10n = deprecateL10nObject( 'privacyToolsL10n', window.privacyToolsL10n, '5.5.0' );
     151window.privacyToolsL10n = deprecateL10nObject( 'privacyToolsL10n', window.privacyToolsL10n );
    154152
    155153/**
    156154 * Removed in 5.5.0, needed for back-compatibility.
    window.authcheckL10n = { 
    162160        beforeunload: ''
    163161};
    164162
    165 window.authcheckL10n = window.authcheckL10n || deprecateL10nObject( 'authcheckL10n', window.authcheckL10n, '5.5.0' );
     163window.authcheckL10n = window.authcheckL10n || deprecateL10nObject( 'authcheckL10n', window.authcheckL10n );
    166164
    167165/**
    168166 * Removed in 5.5.0, needed for back-compatibility.
    window.tagsl10n = { 
    175173        broken: ''
    176174};
    177175
    178 window.tagsl10n = window.tagsl10n || deprecateL10nObject( 'tagsl10n', window.tagsl10n, '5.5.0' );
     176window.tagsl10n = window.tagsl10n || deprecateL10nObject( 'tagsl10n', window.tagsl10n );
    179177
    180178/**
    181179 * Removed in 5.5.0, needed for back-compatibility.
    window.adminCommentsL10n = window.adminCommentsL10n || { 
    200198        docTitleCommentsCount: ''
    201199};
    202200
    203 window.adminCommentsL10n = deprecateL10nObject( 'adminCommentsL10n', window.adminCommentsL10n, '5.5.0' );
     201window.adminCommentsL10n = deprecateL10nObject( 'adminCommentsL10n', window.adminCommentsL10n );
    204202
    205203/**
    206204 * Removed in 5.5.0, needed for back-compatibility.
    window.tagsSuggestL10n = window.tagsSuggestL10n || { 
    216214        termRemoved: ''
    217215};
    218216
    219 window.tagsSuggestL10n = deprecateL10nObject( 'tagsSuggestL10n', window.tagsSuggestL10n, '5.5.0' );
     217window.tagsSuggestL10n = deprecateL10nObject( 'tagsSuggestL10n', window.tagsSuggestL10n );
    220218
    221219/**
    222220 * Removed in 5.5.0, needed for back-compatibility.
    window.wpColorPickerL10n = window.wpColorPickerL10n || { 
    233231        defaultLabel: ''
    234232};
    235233
    236 window.wpColorPickerL10n = deprecateL10nObject( 'wpColorPickerL10n', window.wpColorPickerL10n, '5.5.0' );
     234window.wpColorPickerL10n = deprecateL10nObject( 'wpColorPickerL10n', window.wpColorPickerL10n );
    237235
    238236/**
    239237 * Removed in 5.5.0, needed for back-compatibility.
    window.attachMediaBoxL10n = window.attachMediaBoxL10n || { 
    245243        error: ''
    246244};
    247245
    248 window.attachMediaBoxL10n = deprecateL10nObject( 'attachMediaBoxL10n', window.attachMediaBoxL10n, '5.5.0' );
     246window.attachMediaBoxL10n = deprecateL10nObject( 'attachMediaBoxL10n', window.attachMediaBoxL10n );
    249247
    250248/**
    251249 * Removed in 5.5.0, needed for back-compatibility.
    window.postL10n = window.postL10n || { 
    278276        permalinkSaved: ''
    279277};
    280278
    281 window.postL10n = deprecateL10nObject( 'postL10n', window.postL10n, '5.5.0' );
     279window.postL10n = deprecateL10nObject( 'postL10n', window.postL10n );
    282280
    283281/**
    284282 * Removed in 5.5.0, needed for back-compatibility.
    window.inlineEditL10n = window.inlineEditL10n || { 
    294292        saved: ''
    295293};
    296294
    297 window.inlineEditL10n = deprecateL10nObject( 'inlineEditL10n', window.inlineEditL10n, '5.5.0' );
     295window.inlineEditL10n = deprecateL10nObject( 'inlineEditL10n', window.inlineEditL10n );
    298296
    299297/**
    300298 * Removed in 5.5.0, needed for back-compatibility.
    window.plugininstallL10n = window.plugininstallL10n || { 
    308306        ays: ''
    309307};
    310308
    311 window.plugininstallL10n = deprecateL10nObject( 'plugininstallL10n', window.plugininstallL10n, '5.5.0' );
     309window.plugininstallL10n = deprecateL10nObject( 'plugininstallL10n', window.plugininstallL10n );
    312310
    313311/**
    314312 * Removed in 5.5.0, needed for back-compatibility.
    window.navMenuL10n = window.navMenuL10n || { 
    323321        untitled: ''
    324322};
    325323
    326 window.navMenuL10n = deprecateL10nObject( 'navMenuL10n', window.navMenuL10n, '5.5.0' );
     324window.navMenuL10n = deprecateL10nObject( 'navMenuL10n', window.navMenuL10n );
    327325
    328326/**
    329327 * Removed in 5.5.0, needed for back-compatibility.
    window.commentL10n = window.commentL10n || { 
    336334        dateFormat: ''
    337335};
    338336
    339 window.commentL10n = deprecateL10nObject( 'commentL10n', window.commentL10n, '5.5.0' );
     337window.commentL10n = deprecateL10nObject( 'commentL10n', window.commentL10n );
    340338
    341339/**
    342340 * Removed in 5.5.0, needed for back-compatibility.
    window.setPostThumbnailL10n = window.setPostThumbnailL10n || { 
    351349        done: ''
    352350};
    353351
    354 window.setPostThumbnailL10n = deprecateL10nObject( 'setPostThumbnailL10n', window.setPostThumbnailL10n, '5.5.0' );
     352window.setPostThumbnailL10n = deprecateL10nObject( 'setPostThumbnailL10n', window.setPostThumbnailL10n );
    355353
    356354/**
    357355 * Removed in 3.3.0, needed for back-compatibility.
  • src/js/_enqueues/admin/widgets.js

    diff --git a/src/js/_enqueues/admin/widgets.js b/src/js/_enqueues/admin/widgets.js
    index ed956157eb..fb3759bfc9 100644
    a b wpWidgets.l10n = wpWidgets.l10n || { 
    760760        widgetAdded: ''
    761761};
    762762
    763 wpWidgets.l10n = window.wp.deprecateL10nObject( 'wpWidgets.l10n', wpWidgets.l10n, '5.5.0' );
     763wpWidgets.l10n = window.wp.deprecateL10nObject( 'wpWidgets.l10n', wpWidgets.l10n );
  • src/js/_enqueues/wp/dashboard.js

    diff --git a/src/js/_enqueues/wp/dashboard.js b/src/js/_enqueues/wp/dashboard.js
    index 1929388d55..87a8493128 100644
    a b  
    55/* global pagenow, ajaxurl, postboxes, wpActiveEditor:true, ajaxWidgets */
    66/* global ajaxPopulateWidgets, quickPressLoad,  */
    77window.wp = window.wp || {};
    8 window.communityEventsData = window.communityEventsData || {};
    98
    109/**
    1110 * Initializes the dashboard widget functionality.
    jQuery(document).ready( function($) { 
    266265jQuery( function( $ ) {
    267266        'use strict';
    268267
    269         var communityEventsData = window.communityEventsData,
     268        var communityEventsData = window.communityEventsData || {},
    270269                dateI18n = wp.date.dateI18n,
    271270                format = wp.date.format,
    272271                sprintf = wp.i18n.sprintf,
    jQuery( function( $ ) { 
    467466                renderEventsTemplate: function( templateParams, initiatedBy ) {
    468467                        var template,
    469468                                elementVisibility,
     469                                l10nPlaceholder  = /%(?:\d\$)?s/g, // Match `%s`, `%1$s`, `%2$s`, etc.
    470470                                $toggleButton    = $( '.community-events-toggle-location' ),
    471471                                $locationMessage = $( '#community-events-location-message' ),
    472472                                $results         = $( '.community-events-results' );
    jQuery( function( $ ) { 
    505505                                 * If the API determined the location by geolocating an IP, it will
    506506                                 * provide events, but not a specific location.
    507507                                 */
    508                                 $locationMessage.text( __( 'Attend an upcoming event near you.' ) );
     508                                $locationMessage.text( communityEventsData.l10n.attend_event_near_generic );
    509509
    510510                                if ( templateParams.events.length ) {
    511511                                        template = wp.template( 'community-events-event-list' );
    jQuery( function( $ ) { 
    532532                                }
    533533
    534534                                if ( 'user' === initiatedBy ) {
    535                                         wp.a11y.speak(
    536                                                 sprintf(
    537                                                         /* translators: %s: The name of a city. */
    538                                                         __( 'City updated. Listing events near %s.' ),
    539                                                         templateParams.location.description
    540                                                 ),
    541                                                 'assertive'
    542                                         );
     535                                        wp.a11y.speak( communityEventsData.l10n.city_updated.replace( l10nPlaceholder, templateParams.location.description ), 'assertive' );
    543536                                }
    544537
    545538                                elementVisibility['#community-events-location-message'] = true;
    jQuery( function( $ ) { 
    549542                        } else if ( templateParams.unknownCity ) {
    550543                                template = wp.template( 'community-events-could-not-locate' );
    551544                                $( '.community-events-could-not-locate' ).html( template( templateParams ) );
    552                                 wp.a11y.speak(
    553                                         sprintf(
    554                                                 /*
    555                                                  * These specific examples were chosen to highlight the fact that a
    556                                                  * state is not needed, even for cities whose name is not unique.
    557                                                  * It would be too cumbersome to include that in the instructions
    558                                                  * to the user, so it's left as an implication.
    559                                                  */
    560                                                 /*
    561                                                  * translators: %s is the name of the city we couldn't locate.
    562                                                  * Replace the examples with cities related to your locale. Test that
    563                                                  * they match the expected location and have upcoming events before
    564                                                  * including them. If no cities related to your locale have events,
    565                                                  * then use cities related to your locale that would be recognizable
    566                                                  * to most users. Use only the city name itself, without any region
    567                                                  * or country. Use the endonym (native locale name) instead of the
    568                                                  * English name if possible.
    569                                                  */
    570                                                 __( 'We couldn’t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ),
    571                                                 templateParams.unknownCity
    572                                         )
    573                                 );
     545                                wp.a11y.speak( communityEventsData.l10n.could_not_locate_city.replace( l10nPlaceholder, templateParams.unknownCity ) );
    574546
    575547                                elementVisibility['.community-events-errors']           = true;
    576548                                elementVisibility['.community-events-could-not-locate'] = true;
    jQuery( function( $ ) { 
    582554                                 * Showing error messages for an event that user isn't aware of
    583555                                 * could be confusing or unnecessarily distracting.
    584556                                 */
    585                                 wp.a11y.speak( __( 'An error occurred. Please try again.' ) );
     557                                wp.a11y.speak( communityEventsData.l10n.error_occurred_please_try_again );
    586558
    587559                                elementVisibility['.community-events-errors']         = true;
    588560                                elementVisibility['.community-events-error-occurred'] = true;
    589561                        } else {
    590                                 $locationMessage.text( __( 'Enter your closest city to find nearby events.' ) );
     562                                $locationMessage.text( communityEventsData.l10n.enter_closest_city );
    591563
    592564                                elementVisibility['#community-events-location-message'] = true;
    593565                                elementVisibility['.community-events-toggle-location']  = true;
    jQuery( function( $ ) { 
    623595                 * These can't be stored in the database, because they're dependent on
    624596                 * the user's current time zone, locale, etc.
    625597                 *
    626                  * @since 5.5.2
     598                 * @since 5.6.0
    627599                 *
    628600                 * @param {Array}  rawEvents  The events that should have dynamic fields added to them.
    629601                 * @param {string} timeFormat A time format acceptable by `wp.date.dateI18n()`.
    jQuery( function( $ ) { 
    658630                /**
    659631                 * Returns the user's local/browser time zone, in a form suitable for `wp.date.i18n()`.
    660632                 *
    661                  * @since 5.5.2
     633                 * @since 5.6.0
    662634                 *
    663635                 * @param startTimestamp
    664636                 *
    jQuery( function( $ ) { 
    693665                 *
    694666                 * See https://stackoverflow.com/questions/21102435/why-does-javascript-date-gettimezoneoffset-consider-0500-as-a-positive-off.
    695667                 *
    696                  * @since 5.5.2
     668                 * @since 5.6.0
    697669                 *
    698670                 * @param {number} startTimestamp
    699671                 *
    jQuery( function( $ ) { 
    706678                /**
    707679                 * Get a short time zone name, like `PST`.
    708680                 *
    709                  * @since 5.5.2
     681                 * @since 5.6.0
    710682                 *
    711683                 * @param {number} startTimestamp
    712684                 *
    jQuery( function( $ ) { 
    748720                /**
    749721                 * Format a start/end date in the user's local time zone and locale.
    750722                 *
    751                  * @since 5.5.2
     723                 * @since 5.6.0
    752724                 *
    753725                 * @param {int}    startDate   The Unix timestamp in milliseconds when the the event starts.
    754726                 * @param {int}    endDate     The Unix timestamp in milliseconds when the the event ends.
    jQuery( function( $ ) { 
    819791                });
    820792        }
    821793});
    822 
    823 /**
    824  * Removed in 5.6.0, needed for back-compatibility.
    825  *
    826  * @since 4.8.0
    827  * @deprecated 5.6.0
    828  *
    829  * @type {object}
    830 */
    831 window.communityEventsData.l10n = window.communityEventsData.l10n || {
    832         enter_closest_city: '',
    833         error_occurred_please_try_again: '',
    834         attend_event_near_generic: '',
    835         could_not_locate_city: '',
    836         city_updated: ''
    837 };
    838 
    839 window.communityEventsData.l10n = window.wp.deprecateL10nObject( 'communityEventsData.l10n', window.communityEventsData.l10n, '5.6.0' );
  • src/js/_enqueues/wp/theme-plugin-editor.js

    diff --git a/src/js/_enqueues/wp/theme-plugin-editor.js b/src/js/_enqueues/wp/theme-plugin-editor.js
    index cffbc69637..59e8ce3d0c 100644
    a b wp.themePluginEditor.l10n = wp.themePluginEditor.l10n || { 
    10231023        }
    10241024};
    10251025
    1026 wp.themePluginEditor.l10n = window.wp.deprecateL10nObject( 'wp.themePluginEditor.l10n', wp.themePluginEditor.l10n, '5.5.0' );
     1026wp.themePluginEditor.l10n = window.wp.deprecateL10nObject( 'wp.themePluginEditor.l10n', wp.themePluginEditor.l10n );
  • src/js/_enqueues/wp/updates.js

    diff --git a/src/js/_enqueues/wp/updates.js b/src/js/_enqueues/wp/updates.js
    index 402afaf585..36a9437db9 100644
    a b  
    115115                autoUpdatesError: ''
    116116        };
    117117
    118         wp.updates.l10n = window.wp.deprecateL10nObject( 'wp.updates.l10n', wp.updates.l10n, '5.5.0' );
     118        wp.updates.l10n = window.wp.deprecateL10nObject( 'wp.updates.l10n', wp.updates.l10n );
    119119
    120120        /**
    121121         * User nonce for ajax calls.
  • src/wp-admin/css/common.css

    diff --git a/src/wp-admin/css/common.css b/src/wp-admin/css/common.css
    index 083159a22f..e60ee25c6c 100644
    a b h3 { 
    344344}
    345345
    346346.update-core-php h2 {
    347         margin-top: 2em;
     347        margin-top: 4em;
    348348}
    349349
    350350.update-php h2,
  • src/wp-admin/includes/class-core-upgrader.php

    diff --git a/src/wp-admin/includes/class-core-upgrader.php b/src/wp-admin/includes/class-core-upgrader.php
    index 4184bc8ea9..df0bbf141f 100644
    a b class Core_Upgrader extends WP_Upgrader { 
    4848         *
    4949         * @param object $current Response object for whether WordPress is current.
    5050         * @param array  $args {
    51          *     Optional. Arguments for upgrading WordPress core. Default empty array.
     51         *        Optional. Arguments for upgrading WordPress core. Default empty array.
    5252         *
    53          *     @type bool $pre_check_md5    Whether to check the file checksums before
    54          *                                  attempting the upgrade. Default true.
    55          *     @type bool $attempt_rollback Whether to attempt to rollback the chances if
    56          *                                  there is a problem. Default false.
    57          *     @type bool $do_rollback      Whether to perform this "upgrade" as a rollback.
    58          *                                  Default false.
     53         *        @type bool $pre_check_md5    Whether to check the file checksums before
     54         *                                     attempting the upgrade. Default true.
     55         *        @type bool $attempt_rollback Whether to attempt to rollback the chances if
     56         *                                     there is a problem. Default false.
     57         *        @type bool $do_rollback      Whether to perform this "upgrade" as a rollback.
     58         *                                     Default false.
    5959         * }
    6060         * @return string|false|WP_Error New WordPress version on success, false or WP_Error on failure.
    6161         */
    class Core_Upgrader extends WP_Upgrader { 
    279279                $current_is_development_version = (bool) strpos( $wp_version, '-' );
    280280
    281281                // Defaults:
    282                 $upgrade_dev   = true;
    283                 $upgrade_minor = true;
    284                 $upgrade_major = false;
     282                $upgrade_dev   = get_site_option( 'auto_update_core_dev', true );
     283                $upgrade_minor = get_site_option( 'auto_update_core_minor', true );
     284                $upgrade_major = get_site_option( 'auto_update_core_major', false );
    285285
    286286                // WP_AUTO_UPDATE_CORE = true (all), 'minor', false.
    287287                if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) {
  • src/wp-admin/includes/class-wp-community-events.php

    diff --git a/src/wp-admin/includes/class-wp-community-events.php b/src/wp-admin/includes/class-wp-community-events.php
    index 35708547af..6f4a101067 100644
    a b class WP_Community_Events { 
    7777         * mitigates possible privacy concerns.
    7878         *
    7979         * @since 4.8.0
    80          * @since 5.5.2 Response no longer contains formatted date field. They're added
     80         * @since 5.6.0 Response no longer contains formatted date field. They're added
    8181         *              in `wp.communityEvents.populateDynamicEventFields()` now.
    8282         *
    8383         * @param string $location_search Optional. City name to help determine the location.
    class WP_Community_Events { 
    345345         * Gets cached events.
    346346         *
    347347         * @since 4.8.0
    348          * @since 5.5.2 Response no longer contains formatted date field. They're added
     348         * @since 5.6.0 Response no longer contains formatted date field. They're added
    349349         *              in `wp.communityEvents.populateDynamicEventFields()` now.
    350350         *
    351351         * @return array|false An array containing `location` and `events` items
    class WP_Community_Events { 
    377377        protected function format_event_data_time( $response_body ) {
    378378                _deprecated_function(
    379379                        __METHOD__,
    380                         '5.5.2',
     380                        '5.6.0',
    381381                        'This is no longer used by Core, and only kept for backwards-compatibility.'
    382382                );
    383383
    class WP_Community_Events { 
    451451         *
    452452         * @since 4.8.0
    453453         * @since 4.9.7 Stick a WordCamp to the final list.
    454          * @since 5.5.2 Accepts and returns only the events, rather than an entire HTTP response.
     454         * @since 5.6.0 Accepts and returns only the events, rather than an entire HTTP response.
    455455         *
    456456         * @param array $events The events that will be prepared.
    457457         * @return array The response body with events trimmed.
  • src/wp-admin/update-core.php

    diff --git a/src/wp-admin/update-core.php b/src/wp-admin/update-core.php
    index fcae12eaa0..a4ef446f10 100644
    a b function core_upgrade_preamble() { 
    300300        dismissed_updates();
    301301}
    302302
     303/**
     304 * Display WordPress auto-updates settings.
     305 *
     306 * @since 5.6.0
     307 */
     308function core_auto_updates_settings() {
     309        $upgrade_major_value = '';
     310        if ( isset( $_POST['core-auto-updates-settings'] ) && wp_verify_nonce( $_POST['set_core_auto_updates_settings'], 'core-auto-updates-nonce' ) ) {
     311                if ( isset( $_POST['core-auto-updates-major'] ) && 1 === (int) $_POST['core-auto-updates-major'] ) {
     312                        update_site_option( 'auto_update_core_major', 1 );
     313                } else {
     314                        update_site_option( 'auto_update_core_major', 0 );
     315                }
     316                echo '<div class="notice notice-info is-dismissible"><p>';
     317                _e( 'WordPress auto-updates settings updated.' );
     318                echo '</p></div>';
     319        }
     320
     321        $upgrade_dev   = get_site_option( 'auto_update_core_dev', true );
     322        $upgrade_minor = get_site_option( 'auto_update_core_minor', true );
     323        $upgrade_major = get_site_option( 'auto_update_core_major', false );
     324
     325        if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) {
     326                if ( false === WP_AUTO_UPDATE_CORE ) {
     327                        // Defaults to turned off, unless a filter allows it.
     328                        $upgrade_dev   = false;
     329                        $upgrade_minor = false;
     330                        $upgrade_major = false;
     331                } elseif ( true === WP_AUTO_UPDATE_CORE ) {
     332                        // ALL updates for core.
     333                        $upgrade_dev   = true;
     334                        $upgrade_minor = true;
     335                        $upgrade_major = true;
     336                } elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) {
     337                        // Only minor updates for core.
     338                        $upgrade_dev   = false;
     339                        $upgrade_minor = true;
     340                        $upgrade_major = false;
     341                }
     342        }
     343
     344        $upgrade_dev   = apply_filters( 'allow_dev_auto_core_updates', $upgrade_dev );
     345        $upgrade_minor = apply_filters( 'allow_minor_auto_core_updates', $upgrade_minor );
     346        $upgrade_major = apply_filters( 'allow_major_auto_core_updates', $upgrade_major );
     347
     348        $auto_update_settings = array(
     349                'dev'   => $upgrade_dev,
     350                'minor' => $upgrade_minor,
     351                'major' => $upgrade_major,
     352        );
     353        ?>
     354        <form method="post" action="<?php echo esc_url( $_SERVER['REQUEST_URI'] ); ?>" name="core-auto-updates" class="form-core-auto-updates">
     355                <?php wp_nonce_field( 'core-auto-updates-nonce', 'set_core_auto_updates_settings' ); ?>
     356                <h2><?php _e( 'WordPress auto-updates settings' ); ?></h2>
     357                <p>
     358                        <?php
     359                        if ( $auto_update_settings['major'] ) {
     360                                $wp_version = get_bloginfo( 'version' );
     361                                $updates    = get_core_updates();
     362                                if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) {
     363                                        echo wp_get_auto_update_message();
     364                                }
     365                        }
     366                        ?>
     367                </p>
     368                <p>
     369                        <input type="checkbox" name="core-auto-updates-major" id="core-auto-updates-major" value="1" <?php checked( $auto_update_settings['major'], 1 ); ?> />
     370                        <label for="core-auto-updates-major">
     371                                <?php _e( 'Keep my site up-to-date with regular feature updates (major versions).' ); ?>
     372                        </label>
     373                </p>
     374                <?php
     375                /**
     376                 * Fires after the major core auto-update checkbox.
     377                 *
     378                 * @since 5.6.0
     379                 */
     380                do_action( 'after_core_auto_updates_settings_fields', $auto_update_settings );
     381                ?>
     382                <p>
     383                        <input id="core-auto-updates-settings" class="button" type="submit" value="<?php esc_attr_e( 'Save settings' ); ?>" name="core-auto-updates-settings" />
     384                </p>
     385        <?php
     386}
     387
    303388/**
    304389 * Display the upgrade plugins form.
    305390 *
    if ( 'upgrade-core' === $action ) { 
    890975
    891976        if ( current_user_can( 'update_core' ) ) {
    892977                core_upgrade_preamble();
     978                core_auto_updates_settings();
    893979        }
    894980        if ( current_user_can( 'update_plugins' ) ) {
    895981                list_plugin_updates();
  • src/wp-includes/default-filters.php

    diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php
    index dbc4fefb09..cd6b86f816 100644
    a b add_action( 'wp_head', 'wp_print_styles', 8 ); 
    297297add_action( 'wp_head', 'wp_print_head_scripts', 9 );
    298298add_action( 'wp_head', 'wp_generator' );
    299299add_action( 'wp_head', 'rel_canonical' );
     300add_action( 'wp_head', 'rel_feed_for_posts', 10, 0 );
    300301add_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
    301302add_action( 'wp_head', 'wp_custom_css_cb', 101 );
    302303add_action( 'wp_head', 'wp_site_icon', 99 );
  • src/wp-includes/general-template.php

    diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
    index dc5b374121..52bc061a28 100644
    a b function wp_enqueue_code_editor( $args ) { 
    36433643        return $settings;
    36443644}
    36453645
     3646/**
     3647 * Adds a link rel=feed element to the home page when a static front page is set in Settings > Reading.
     3648 *
     3649 * See {@see 'wp_head'}.
     3650 *
     3651 * @since 5.6.0
     3652 */
     3653function rel_feed_for_posts() {
     3654        $page_for_posts = get_option( 'page_for_posts' );
     3655
     3656        if ( is_front_page() && ! is_home() ) {
     3657                echo '<link rel="feed" type="text/html" href="' . get_the_permalink( $page_for_posts ) . '" title="' . the_title_attribute( array( 'echo' => false, 'post' => $page_for_posts ) ) . '" />';
     3658        }
     3659}
     3660
    36463661/**
    36473662 * Generate and return code editor settings.
    36483663 *
  • src/wp-includes/script-loader.php

    diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
    index 1dd43e9393..4a0417901d 100644
    a b function wp_localize_community_events() { 
    17571757                        'nonce'       => wp_create_nonce( 'community_events' ),
    17581758                        'cache'       => $events_client->get_cached_events(),
    17591759                        'time_format' => get_option( 'time_format' ),
     1760
     1761                        'l10n'        => array(
     1762                                'enter_closest_city'              => __( 'Enter your closest city to find nearby events.' ),
     1763                                'error_occurred_please_try_again' => __( 'An error occurred. Please try again.' ),
     1764                                'attend_event_near_generic'       => __( 'Attend an upcoming event near you.' ),
     1765
     1766                                /*
     1767                                 * These specific examples were chosen to highlight the fact that a
     1768                                 * state is not needed, even for cities whose name is not unique.
     1769                                 * It would be too cumbersome to include that in the instructions
     1770                                 * to the user, so it's left as an implication.
     1771                                 */
     1772                                /*
     1773                                 * translators: %s is the name of the city we couldn't locate.
     1774                                 * Replace the examples with cities related to your locale. Test that
     1775                                 * they match the expected location and have upcoming events before
     1776                                 * including them. If no cities related to your locale have events,
     1777                                 * then use cities related to your locale that would be recognizable
     1778                                 * to most users. Use only the city name itself, without any region
     1779                                 * or country. Use the endonym (native locale name) instead of the
     1780                                 * English name if possible.
     1781                                 */
     1782                                'could_not_locate_city'           => __( 'We couldn&#8217;t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ),
     1783
     1784                                // This one is only used with wp.a11y.speak(), so it can/should be more brief.
     1785                                /* translators: %s: The name of a city. */
     1786                                'city_updated'                    => __( 'City updated. Listing events near %s.' ),
     1787                        ),
    17601788                )
    17611789        );
    17621790}
  • tests/phpunit/tests/admin/includesCommunityEvents.php

    diff --git a/tests/phpunit/tests/admin/includesCommunityEvents.php b/tests/phpunit/tests/admin/includesCommunityEvents.php
    index 6b84790334..b0280dd92e 100644
    a b class Test_WP_Community_Events extends WP_UnitTestCase { 
    280280         *
    281281         * @covers WP_Community_Events::trim_events
    282282         *
    283          * @since 5.5.2
     283         * @since 5.6.0
    284284         */
    285285        public function test_trim_expired_events() {
    286286                $trim_events = new ReflectionMethod( $this->instance, 'trim_events' );
    class Test_WP_Community_Events extends WP_UnitTestCase { 
    309309         * @covers WP_Community_Events::trim_events
    310310         *
    311311         * @since 4.9.7
    312          * @since 5.5.2 Tests `trim_events()` directly instead of indirectly via `get_events()`.
     312         * @since 5.6.0 Tests `trim_events()` directly instead of indirectly via `get_events()`.
    313313         */
    314314        public function test_trim_events_pin_wordcamp() {
    315315                $trim_events = new ReflectionMethod( $this->instance, 'trim_events' );
    class Test_WP_Community_Events extends WP_UnitTestCase { 
    331331         * Simulates a scenario where a WordCamp needs to be pinned higher than it's default position.
    332332         *
    333333         * @since 4.9.7
    334          * @since 5.5.2 Accepts and returns only the events, rather than an entire HTTP response.
     334         * @since 5.6.0 Accepts and returns only the events, rather than an entire HTTP response.
    335335         *
    336336         * @return array A list of mock events.
    337337         */
    class Test_WP_Community_Events extends WP_UnitTestCase { 
    414414         * @covers WP_Community_Events::trim_events
    415415         *
    416416         * @since 4.9.7
    417          * @since 5.5.2 Tests `trim_events()` directly instead of indirectly via `get_events()`.
     417         * @since 5.6.0 Tests `trim_events()` directly instead of indirectly via `get_events()`.
    418418         */
    419419        public function test_trim_events_dont_pin_multiple_wordcamps() {
    420420                $trim_events = new ReflectionMethod( $this->instance, 'trim_events' );
    class Test_WP_Community_Events extends WP_UnitTestCase { 
    437437         * no need to pin extra camp b/c one already exists in response
    438438         *
    439439         * @since 4.9.7
    440          * @since 5.5.2 Tests `trim_events()` directly instead of indirectly via `get_events()`.
     440         * @since 5.6.0 Tests `trim_events()` directly instead of indirectly via `get_events()`.
    441441         *
    442442         * @return array A mock HTTP response.
    443443         */
  • tests/phpunit/tests/general/document-title.php

    diff --git a/tests/phpunit/tests/general/document-title.php b/tests/phpunit/tests/general/document-title.php
    index a15f926ea9..8117106582 100644
    a b  
    11<?php
    22
    33/**
    4  * A set of unit tests for functions in wp-includes/general-template.php
     4 * A set of unit tests for testing the Document Title functions in wp-includes/general-template.php
    55 *
     6 * @group general
    67 * @group template
    78 * @group document-title
     9 * @ticket 46227
    810 */
    911class Tests_General_DocumentTitle extends WP_UnitTestCase {
    1012
    class Tests_General_DocumentTitle extends WP_UnitTestCase { 
    275277        function _change_title_separator( $sep ) {
    276278                return '%%';
    277279        }
    278 }
     280
     281        // Test adding custom feed link to the blog page in the header.
     282        function test_add_feed_link_to_header_front_page() {
     283                $test_title = 'Blog';
     284                // create a sample blog page.
     285                $blog_page_id = $this->factory->post->create(
     286                        array(
     287                                'post_title' => $test_title,
     288                                'post_type'  => 'page',
     289                        )
     290                );
     291
     292                update_option( 'page_for_posts', $blog_page_id );
     293                update_option( 'show_on_front', 'page' );
     294
     295                $this->go_to('/');
     296
     297                $doc = new DOMDocument();
     298                $doc->preserveWhiteSpace = false;
     299
     300                $test_link_str = '<link rel="feed" type="text/html" href="' . get_the_permalink( $blog_page_id ) . '" title="' . the_title_attribute( array( 'echo' => false, 'post' => $blog_page_id ) ) . '" />';
     301                $doc->loadHTML( $test_link_str );
     302
     303                $selector = new DOMXPath( $doc );
     304                $result = $selector->query( "/html/head/link[@rel= 'feed']" );
     305                $test_blog_title = $result->item(0)->getAttribute( 'title' );
     306
     307                $this->assertEquals( $test_blog_title, $test_title );
     308        }
  • deleted file tests/qunit/fixtures/common.js

    diff --git a/tests/qunit/fixtures/common.js b/tests/qunit/fixtures/common.js
    deleted file mode 100644
    index 79e9ae5019..0000000000
    + -  
    1 /**
    2  * Mock the deprecateL10nObject() for tests.
    3  *
    4  * deprecateL10nObject() is part of wp-admin/js/common.js which requires
    5  * some HTML markup to exist. Instead of adding all the markup this adds
    6  * a noop version of deprecateL10nObject(). This makes it possible
    7  * to test wp-admin/js/dashboard.js.
    8  */
    9 window.wp = window.wp || {};
    10 window.wp.deprecateL10nObject = function () {};
  • tests/qunit/index.html

    diff --git a/tests/qunit/index.html b/tests/qunit/index.html
    index 4b7ecaebd2..e06ddc4bcb 100644
    a b  
    8282                        <script src="fixtures/wp-api-generated.js"></script>
    8383                        <script src="fixtures/js-widgets-endpoint.js"></script>
    8484                        <script src="fixtures/wp-api.js"></script>
    85                         <script src="fixtures/common.js"></script>
    8685                </div>
    8786
    8887                <!-- Tested files -->