diff --git a/src/js/_enqueues/wp/updates.js b/src/js/_enqueues/wp/updates.js index c422fcf64c05f..8b52bfcdd6b32 100644 --- a/src/js/_enqueues/wp/updates.js +++ b/src/js/_enqueues/wp/updates.js @@ -2470,18 +2470,13 @@ * @since 4.2.0 */ $( window ).on( 'beforeunload', wp.updates.beforeunload ); - } ); - /** - * Click handler for enabling and disabling plugin and theme auto-updates. - * - * @since 5.5.0 - * - * TODO: this needs to be refactored to be like the remainder of the handlers - * in this file. - */ - $( document ).ready( function() { - $( $document ).on( 'click', '.column-auto-updates a.toggle-auto-update, .theme-overlay a.toggle-auto-update', function( event ) { + /** + * Click handler for enabling and disabling plugin and theme auto-updates. + * + * @since 5.5.0 + */ + $document.on( 'click', '.column-auto-updates a.toggle-auto-update, .theme-overlay a.toggle-auto-update', function( event ) { var data, asset, type, $parent; var $anchor = $( this ), action = $anchor.attr( 'data-wp-action' ), @@ -2522,14 +2517,12 @@ $parent.find( '.notice.error' ).addClass( 'hidden' ); // Show loading status. - // TODO: make it readable when network is fast, or possibly remove the interim text change. if ( 'enable' === action ) { $label.text( wp.updates.l10n.autoUpdatesEnabling ); } else { $label.text( wp.updates.l10n.autoUpdatesDisabling ); } - // TODO: Needs design review - the link text jumps under the mouse (part may get selected). $anchor.find( '.dashicons-update' ).removeClass( 'hidden' ); data = { @@ -2546,9 +2539,8 @@ var href = $anchor.attr( 'href' ); if ( ! response.success ) { - // if WP returns 0 for response (which can happen in a few cases - // that aren't quite failures), output the general error message, - // since we won't have response.data.error. + // if WP returns 0 for response (which can happen in a few cases), + // output the general error message since we won't have response.data.error. if ( response.data && response.data.error ) { errorMessage = response.data.error; } else { diff --git a/src/wp-admin/includes/class-wp-automatic-updater.php b/src/wp-admin/includes/class-wp-automatic-updater.php index 71adac3f2c494..20f1847de7797 100644 --- a/src/wp-admin/includes/class-wp-automatic-updater.php +++ b/src/wp-admin/includes/class-wp-automatic-updater.php @@ -159,10 +159,12 @@ public function should_update( $type, $item, $context ) { if ( 'core' === $type ) { $update = Core_Upgrader::should_update_to_version( $item->current ); } elseif ( 'plugin' === $type || 'theme' === $type ) { - $update = false; - if ( wp_is_auto_update_enabled_for_type( $type ) ) { + $update = ! empty( $item->autoupdate ); + + if ( ! $update && wp_is_auto_update_enabled_for_type( $type ) ) { + // Check if the site admin has enabled auto-updates by default for the specific item. $auto_updates = (array) get_site_option( "auto_update_{$type}s", array() ); - $update = in_array( $item->{$type}, $auto_updates, true ) || ! empty( $item->autoupdate ); + $update = in_array( $item->{$type}, $auto_updates, true ); } } else { $update = ! empty( $item->autoupdate ); @@ -976,8 +978,7 @@ protected function send_plugin_theme_email( $type, $successful_updates, $failed_ $body[] = __( 'The following plugins failed to update:' ); // List failed updates. foreach ( $failed_updates['plugin'] as $item ) { - /* translators: %s: Name of the related plugin. */ - $body[] = ' ' . sprintf( __( '- %s' ), $item->name ); + $body[] = "- {$item->name}"; } $body[] = "\n"; } @@ -986,8 +987,7 @@ protected function send_plugin_theme_email( $type, $successful_updates, $failed_ $body[] = __( 'The following themes failed to update:' ); // List failed updates. foreach ( $failed_updates['theme'] as $item ) { - /* translators: %s: Name of the related plugin. */ - $body[] = ' ' . sprintf( __( '- %s' ), $item->name ); + $body[] = "- {$item->name}"; } $body[] = "\n"; } @@ -996,8 +996,7 @@ protected function send_plugin_theme_email( $type, $successful_updates, $failed_ $body[] = __( 'The following plugins were successfully updated:' ); // List successful updates. foreach ( $successful_updates['plugin'] as $item ) { - /* translators: %s: Name of the related plugin. */ - $body[] = ' ' . sprintf( __( '- %s' ), $item->name ); + $body[] = "- {$item->name}"; } $body[] = "\n"; } @@ -1006,8 +1005,7 @@ protected function send_plugin_theme_email( $type, $successful_updates, $failed_ $body[] = __( 'The following themes were successfully updated:' ); // List successful updates. foreach ( $successful_updates['theme'] as $item ) { - /* translators: %s: Name of the related plugin. */ - $body[] = ' ' . sprintf( __( '- %s' ), $item->name ); + $body[] = "- {$item->name}"; } $body[] = "\n"; } diff --git a/src/wp-admin/includes/class-wp-debug-data.php b/src/wp-admin/includes/class-wp-debug-data.php index b9854839fb32d..41ce09ef84c5d 100644 --- a/src/wp-admin/includes/class-wp-debug-data.php +++ b/src/wp-admin/includes/class-wp-debug-data.php @@ -856,10 +856,14 @@ static function debug_data() { } // List all available plugins. - $plugins = get_plugins(); - $plugin_updates = get_plugin_updates(); - $auto_updates = array(); - $auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'plugin' ); + $plugins = get_plugins(); + $plugin_updates = get_plugin_updates(); + $auto_updates = array(); + + $auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'plugin' ); + $auto_updates_enabled_str = __( 'Auto-updates enabled' ); + $auto_updates_disabled_str = __( 'Auto-updates disabled' ); + if ( $auto_updates_enabled ) { $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); } @@ -899,11 +903,11 @@ static function debug_data() { if ( $auto_updates_enabled ) { if ( in_array( $plugin_path, $auto_updates, true ) ) { - $plugin_version_string .= ' | ' . __( 'Auto-updates enabled' ); - $plugin_version_string_debug .= ', ' . __( 'Auto-updates enabled' ); + $plugin_version_string .= ' | ' . $auto_updates_enabled_str; + $plugin_version_string_debug .= ', ' . $auto_updates_enabled_str; } else { - $plugin_version_string .= ' | ' . __( 'Auto-updates disabled' ); - $plugin_version_string_debug .= ', ' . __( 'Auto-updates disabled' ); + $plugin_version_string .= ' | ' . $auto_updates_disabled_str; + $plugin_version_string_debug .= ', ' . $auto_updates_disabled_str; } } @@ -1123,11 +1127,11 @@ static function debug_data() { if ( $auto_updates_enabled ) { if ( in_array( $theme_slug, $auto_updates ) ) { - $theme_version_string .= ' | ' . __( 'Auto-updates enabled' ); - $theme_version_string_debug .= ',' . __( 'Auto-updates enabled' ); + $theme_version_string .= ' | ' . $auto_updates_enabled_str; + $theme_version_string_debug .= ',' . $auto_updates_enabled_str; } else { - $theme_version_string .= ' | ' . __( 'Auto-updates disabled' ); - $theme_version_string_debug .= ', ' . __( 'Auto-updates disabled' ); + $theme_version_string .= ' | ' . $auto_updates_disabled_str; + $theme_version_string_debug .= ', ' . $auto_updates_disabled_str; } } diff --git a/src/wp-admin/includes/class-wp-ms-themes-list-table.php b/src/wp-admin/includes/class-wp-ms-themes-list-table.php index 1809c10d5fb8b..dabcb5689de29 100644 --- a/src/wp-admin/includes/class-wp-ms-themes-list-table.php +++ b/src/wp-admin/includes/class-wp-ms-themes-list-table.php @@ -718,27 +718,39 @@ function column_autoupdates( $theme ) { $stylesheet = $theme->get_stylesheet(); if ( in_array( $stylesheet, $auto_updates, true ) ) { - $text = __( 'Disable auto-updates', 'wp-autoupdates' ); - $auto_update_time_class = ''; - $action = 'disable'; + $text = __( 'Disable auto-updates' ); + $action = 'disable'; + $time_class = ''; } else { - $text = __( 'Enable auto-updates', 'wp-autoupdates' ); - $action = 'enable'; - $auto_update_time_class = ' hidden'; + $text = __( 'Enable auto-updates' ); + $action = 'enable'; + $time_class = ' hidden'; } + $query_args = array( + 'action' => "{$action}-auto-update", + 'theme' => $stylesheet, + 'paged' => $page, + 'theme_status' => $status, + ); + + $url = add_query_arg( $query_args, 'themes.php' ); + printf( - '%s', - wp_nonce_url( 'themes.php?action=' . $action . '-auto-update&theme=' . urlencode( $stylesheet ) . '&paged=' . $page . '&theme_status=' . $status, 'updates' ), - $action, - $text + '', + wp_nonce_url( $url, 'updates' ), + $action ); + echo ''; + echo '' . $text . ''; + echo ''; + $available_updates = get_site_transient( 'update_themes' ); if ( isset( $available_updates->response[ $stylesheet ] ) ) { printf( '
%s
', - $auto_update_time_class, + $time_class, wp_get_auto_update_message() ); } diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index d55aa202f40e8..083156bbaa906 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -1041,27 +1041,39 @@ public function single_row( $item ) { echo ""; if ( in_array( $plugin_file, $auto_updates, true ) ) { - $text = __( 'Disable auto-updates', 'wp-autoupdates' ); - $action = 'disable'; - $auto_update_time_class = ''; + $text = __( 'Disable auto-updates' ); + $action = 'disable'; + $time_class = ''; } else { - $text = __( 'Enable auto-updates', 'wp-autoupdates' ); - $action = 'enable'; - $auto_update_time_class = ' hidden'; + $text = __( 'Enable auto-updates' ); + $action = 'enable'; + $time_class = ' hidden'; } + $query_args = array( + 'action' => "{$action}-auto-update", + 'plugin' => $plugin_file, + 'paged' => $page, + 'plugin_status' => $status, + ); + + $url = add_query_arg( $query_args, 'plugins.php' ); + printf( - '%s', - wp_nonce_url( 'plugins.php?action=' . $action . '-auto-update&plugin=' . urlencode( $plugin_file ) . '&paged=' . $page . '&plugin_status=' . $status, 'updates' ), - $action, - $text + '', + wp_nonce_url( $url, 'updates' ), + $action ); + echo ''; + echo '' . $text . ''; + echo ''; + $available_updates = get_site_transient( 'update_plugins' ); if ( isset( $available_updates->response[ $plugin_file ] ) ) { printf( '
%s
', - $auto_update_time_class, + $time_class, wp_get_auto_update_message() ); } diff --git a/src/wp-admin/network/themes.php b/src/wp-admin/network/themes.php index 85ee95eabf213..c71315aa2a5d1 100644 --- a/src/wp-admin/network/themes.php +++ b/src/wp-admin/network/themes.php @@ -22,7 +22,15 @@ $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; // Clean up request URI from temporary args for screen options/paging uri's to work as expected. -$temp_args = array( 'enabled', 'disabled', 'deleted', 'error', 'enabled-auto-update', 'disabled-auto-update' ); +$temp_args = array( + 'enabled', + 'disabled', + 'deleted', + 'error', + 'enabled-auto-update', + 'disabled-auto-update', +); + $_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] ); $referer = remove_query_arg( $temp_args, wp_get_referer() ); @@ -123,8 +131,8 @@ require_once ABSPATH . 'wp-admin/admin-header.php'; $themes_to_delete = count( $themes ); ?> -
- +
+

@@ -145,7 +153,7 @@ } ?> - +

@@ -154,27 +162,28 @@ '; } - wp_nonce_field( 'bulk-themes' ); + wp_nonce_field( 'bulk-themes' ); - if ( 1 == $themes_to_delete ) { + if ( 1 === $themes_to_delete ) { submit_button( __( 'Yes, delete this theme' ), '', 'submit', false ); } else { submit_button( __( 'Yes, delete these themes' ), '', 'submit', false ); } + ?> - +
-
+

' . sprintf( $message, number_format_i18n( $enabled ) ) . '

'; } elseif ( isset( $_GET['disabled'] ) ) { $disabled = absint( $_GET['disabled'] ); - if ( 1 == $disabled ) { + if ( 1 === $disabled ) { $message = __( 'Theme disabled.' ); } else { /* translators: %s: Number of themes. */ @@ -390,7 +363,7 @@ echo '

' . sprintf( $message, number_format_i18n( $disabled ) ) . '

'; } elseif ( isset( $_GET['deleted'] ) ) { $deleted = absint( $_GET['deleted'] ); - if ( 1 == $deleted ) { + if ( 1 === $deleted ) { $message = __( 'Theme deleted.' ); } else { /* translators: %s: Number of themes. */ @@ -399,7 +372,7 @@ echo '

' . sprintf( $message, number_format_i18n( $deleted ) ) . '

'; } elseif ( isset( $_GET['enabled-auto-update'] ) ) { $enabled = absint( $_GET['enabled-auto-update'] ); - if ( 1 == $enabled ) { + if ( 1 === $enabled ) { $message = __( 'Theme will be auto-updated.' ); } else { /* translators: %s: Number of themes. */ @@ -408,25 +381,17 @@ echo '

' . sprintf( $message, number_format_i18n( $enabled ) ) . '

'; } elseif ( isset( $_GET['disabled-auto-update'] ) ) { $disabled = absint( $_GET['disabled-auto-update'] ); - if ( 1 == $disabled ) { + if ( 1 === $disabled ) { $message = __( 'Theme will no longer be auto-updated.' ); } else { /* translators: %s: Number of themes. */ $message = _n( '%s theme will no longer be auto-updated.', '%s themes will no longer be auto-updated.', $disabled ); } echo '

' . sprintf( $message, number_format_i18n( $disabled ) ) . '

'; -} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) { +} elseif ( isset( $_GET['error'] ) && 'none' === $_GET['error'] ) { echo '

' . __( 'No theme selected.' ) . '

'; -} elseif ( isset( $_GET['error'] ) && 'main' == $_GET['error'] ) { +} elseif ( isset( $_GET['error'] ) && 'main' === $_GET['error'] ) { echo '

' . __( 'You cannot delete a theme while it is active on the main site.' ) . '

'; -} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) { - echo '

' . __( 'No theme selected.' ) . '

'; -} elseif ( isset( $_GET['disable-auto-update'] ) ) { - echo '

' . __( 'Theme will no longer be auto-updated.' ) . '

'; -} elseif ( isset( $_GET['enable-autoupdate-multi'] ) ) { - echo '

' . __( 'Themes will be auto-updated.' ) . '

'; -} elseif ( isset( $_GET['disable-autoupdate-multi'] ) ) { - echo '

' . __( 'Themes will no longer be auto-updated.' ) . '

'; } ?> @@ -438,7 +403,7 @@ views(); -if ( 'broken' == $status ) { +if ( 'broken' === $status ) { echo '

' . __( 'The following themes are installed but incomplete.' ) . '

'; } ?> diff --git a/src/wp-admin/plugins.php b/src/wp-admin/plugins.php index dc484a25e1272..62726ba12f632 100644 --- a/src/wp-admin/plugins.php +++ b/src/wp-admin/plugins.php @@ -22,7 +22,21 @@ $s = isset( $_REQUEST['s'] ) ? urlencode( wp_unslash( $_REQUEST['s'] ) ) : ''; // Clean up request URI from temporary args for screen options/paging uri's to work as expected. -$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', 'enable-auto-update', 'disable-auto-update', 'enable-auto-update-multi', 'disable-auto-update-multi', '_error_nonce' ), $_SERVER['REQUEST_URI'] ); +$query_args_to_remove = array( + 'error', + 'deleted', + 'activate', + 'activate-multi', + 'deactivate', + 'deactivate-multi', + 'enabled-auto-update', + 'disabled-auto-update', + 'enabled-auto-update-multi', + 'disabled-auto-update-multi', + '_error_nonce', +); + +$_SERVER['REQUEST_URI'] = remove_query_arg( $query_args_to_remove, $_SERVER['REQUEST_URI'] ); wp_enqueue_script( 'updates' ); @@ -284,11 +298,14 @@ if ( ! isset( $_REQUEST['verify-delete'] ) ) { wp_enqueue_script( 'jquery' ); require_once ABSPATH . 'wp-admin/admin-header.php'; + ?> -
+
- +

@@ -332,7 +351,9 @@

'; } + ?>
-
+
'true' ), $redirect ); + } elseif ( 'disable-auto-update' === $action ) { + $auto_updates = array_diff( $auto_updates, array( $plugin ) ); + $redirect = add_query_arg( array( 'disabled-auto-update' => 'true' ), $redirect ); + } else { + $plugins = (array) wp_unslash( $_POST['checked'] ); - $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array(); + if ( 'enable-auto-update-selected' === $action ) { + $new_auto_updates = array_merge( $auto_updates, $plugins ); + $new_auto_updates = array_unique( $new_auto_updates ); + $query_args = array( 'enabled-auto-update-multi' => 'true' ); + } else { + $new_auto_updates = array_diff( $auto_updates, $plugins ); + $query_args = array( 'disabled-auto-update-multi' => 'true' ); + } - $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); - $new_auto_updates = array_diff( $auto_updates, $plugins ); - $new_auto_updates = array_unique( $new_auto_updates ); + // Return early if all selected plugins already have auto-updates enabled or disabled. + // Must use non-strict comparison, so that array order is not treated as significant. + if ( $new_auto_updates == $auto_updates ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison + wp_redirect( $redirect ); + exit; + } - // Return early if all selected plugins already have auto-updates enabled. - // Must use non-strict comparison, so that array order is not treated as significant. - if ( $new_auto_updates == $auto_updates ) { - wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ); - exit; + $auto_updates = $new_auto_updates; + $redirect = add_query_arg( $query_args, $redirect ); } /** This filter is documented in wp-admin/includes/class-wp-plugins-list-table.php */ $all_items = apply_filters( 'all_plugins', get_plugins() ); - // Remove plugins that have been deleted since the site option was last updated. - $auto_updates = array_intersect( $new_auto_updates, array_keys( $all_items ) ); - update_site_option( 'auto_update_plugins', $new_auto_updates ); + // Remove plugins that don't exist or have been deleted since the option was last updated. + $auto_updates = array_intersect( $auto_updates, array_keys( $all_items ) ); + + update_site_option( 'auto_update_plugins', $auto_updates ); - wp_redirect( self_admin_url( "plugins.php?disable-auto-update-multi=true&plugin_status=$status&paged=$page&s=$s" ) ); + wp_redirect( $redirect ); exit; default: if ( isset( $_POST['checked'] ) ) { @@ -624,9 +597,7 @@ echo '

'; } } -?> -fatal error.' ); } + ?>

- +
@@ -688,7 +663,7 @@

- +

@@ -709,13 +684,13 @@

- +

- +

- +

- +

diff --git a/src/wp-content/themes/twentytwenty/style.css b/src/wp-content/themes/twentytwenty/style.css index 17b9df7914315..af1497901a910 100644 --- a/src/wp-content/themes/twentytwenty/style.css +++ b/src/wp-content/themes/twentytwenty/style.css @@ -3530,6 +3530,11 @@ figure.wp-block-table.is-style-stripes { margin: 4rem auto; } +.post-inner .entry-content > .wp-block-cover.alignwide:first-child, +.post-inner .entry-content > .wp-block-cover.alignfull:first-child { + margin-top: 0; +} + /* Font Families ----------------------------- */ .entry-content { @@ -5408,6 +5413,11 @@ a.to-the-top > * { margin-right: 4rem; } + .entry-content > .alignwide:first-child, + .entry-content > .alignfull:first-child { + margin-bottom: 8rem; + } + /* ENTRY MEDIA */ .alignfull > figcaption, @@ -5917,7 +5927,7 @@ a.to-the-top > * { /*rtl:ignore*/ margin-left: 0; } - + .wp-block-image .aligncenter figcaption { text-align: center; } diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php index 3933b5c87ecdc..9d55fb23acbe4 100644 --- a/src/wp-includes/class-wp-customize-manager.php +++ b/src/wp-includes/class-wp-customize-manager.php @@ -889,7 +889,7 @@ public function panels() { * @return bool */ public function is_theme_active() { - return $this->get_stylesheet() == $this->original_stylesheet; + return $this->get_stylesheet() === $this->original_stylesheet; } /** @@ -5856,8 +5856,8 @@ public function handle_load_themes_request() { $theme->id = $theme->slug; $theme->screenshot = array( $theme->screenshot_url ); $theme->authorAndUri = wp_kses( $theme->author['display_name'], $themes_allowedtags ); - $theme->compatibleWP = is_wp_version_compatible( $theme->requires ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase - $theme->compatiblePHP = is_php_version_compatible( $theme->requires_php ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase + $theme->compatibleWP = is_wp_version_compatible( $theme->requires ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName + $theme->compatiblePHP = is_php_version_compatible( $theme->requires_php ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName if ( isset( $theme->parent ) ) { $theme->parent = $theme->parent['slug'];