Skip to content

Commit

Permalink
Update to WordPress 6.5.3. For more information, see https://wordpres…
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantheon Automation committed May 7, 2024
1 parent 233447f commit c66e78b
Show file tree
Hide file tree
Showing 38 changed files with 585 additions and 175 deletions.
25 changes: 25 additions & 0 deletions wp-admin/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,31 @@
<div class="about__section changelog has-subtle-background-color">
<div class="column">
<h2><?php _e( 'Maintenance and Security Release' ); ?></h2>
<p>
<?php
printf(
/* translators: 1: WordPress version number, 2: Plural number of bugs. */
_n(
'<strong>Version %1$s</strong> addressed %2$s bug.',
'<strong>Version %1$s</strong> addressed %2$s bugs.',
10
),
'6.5.3',
'21'
);
?>
<?php
printf(
/* translators: %s: HelpHub URL. */
__( 'For more information, see <a href="%s">the release notes</a>.' ),
sprintf(
/* translators: %s: WordPress version. */
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
sanitize_title( '6.5.3' )
)
);
?>
</p>
<p>
<?php
printf(
Expand Down
19 changes: 19 additions & 0 deletions wp-admin/css/common-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -1514,6 +1514,25 @@ div.error {
margin-top: -5px;
}

#plugin-information-footer #plugin-activated-successfully {
margin-bottom: 0;
}

#plugin-information-footer #plugin-activated-successfully p {
display: flex;
gap: 1em;
align-items: center;
justify-content: space-between;
margin: 0;
}

#plugin-information-footer #plugin-activated-successfully .refresh-page {
flex-grow: 0;
line-height: 2.15384615;
min-height: 0;
margin-bottom: 0;
}

.update-message p:before,
.updating-message p:before,
.updated-message p:before,
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/css/common-rtl.min.css

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions wp-admin/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -1513,6 +1513,25 @@ div.error {
margin-top: -5px;
}

#plugin-information-footer #plugin-activated-successfully {
margin-bottom: 0;
}

#plugin-information-footer #plugin-activated-successfully p {
display: flex;
gap: 1em;
align-items: center;
justify-content: space-between;
margin: 0;
}

#plugin-information-footer #plugin-activated-successfully .refresh-page {
flex-grow: 0;
line-height: 2.15384615;
min-height: 0;
margin-bottom: 0;
}

.update-message p:before,
.updating-message p:before,
.updated-message p:before,
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/css/common.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion wp-admin/css/media-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ border color while dragging a file over the uploader drop area */
.imgedit-panel-tools > .imgedit-menu {
display: flex;
column-gap: 4px;
align-items: start;
align-items: flex-start;
flex-wrap: wrap;
}

Expand Down
2 changes: 1 addition & 1 deletion wp-admin/css/media-rtl.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion wp-admin/css/media.css
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ border color while dragging a file over the uploader drop area */
.imgedit-panel-tools > .imgedit-menu {
display: flex;
column-gap: 4px;
align-items: start;
align-items: flex-start;
flex-wrap: wrap;
}

Expand Down
2 changes: 1 addition & 1 deletion wp-admin/css/media.min.css

Large diffs are not rendered by default.

71 changes: 60 additions & 11 deletions wp-admin/js/updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -1105,21 +1105,33 @@
*
* @since 6.5.0
*
* @param {Object} response Response from the server.
* @param {string} response.slug Slug of the activated plugin.
* @param {string} response.pluginName Name of the activated plugin.
* @param {string} response.plugin The plugin file, relative to the plugins directory.
* @param {Object} response Response from the server.
* @param {string} response.slug Slug of the activated plugin.
* @param {string} response.pluginName Name of the activated plugin.
* @param {string} response.plugin The plugin file, relative to the plugins directory.
*/
wp.updates.activatePluginSuccess = function( response ) {
var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.activating-message' ),
isInModal = 'plugin-information-footer' === $message.parent().attr( 'id' ),
buttonText = _x( 'Activated!', 'plugin' ),
ariaLabel = sprintf(
/* translators: %s: The plugin name. */
'%s activated successfully.',
response.pluginName
);
),
noticeData = {
id: 'plugin-activated-successfully',
className: 'notice-success',
message: sprintf(
/* translators: %s: The refresh link's attributes. */
__( 'Plugin activated. Some changes may not occur until you refresh the page. <a %s>Refresh Now</a>' ),
'href="#" class="button button-secondary refresh-page"'
),
slug: response.slug
},
noticeTarget;

wp.a11y.speak( __( 'Activation completed successfully.' ) );
wp.a11y.speak( __( 'Activation completed successfully. Some changes may not occur until you refresh the page.' ) );
$document.trigger( 'wp-plugin-activate-success', response );

$message
Expand All @@ -1128,7 +1140,7 @@
.attr( 'aria-label', ariaLabel )
.text( buttonText );

if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
if ( isInModal ) {
wp.updates.setCardButtonStatus(
{
status: 'activated-plugin',
Expand All @@ -1139,13 +1151,26 @@
ariaLabel: ariaLabel
}
);

// Add a notice to the modal's footer.
$message.replaceWith( wp.updates.adminNotice( noticeData ) );

// Send notice information back to the parent screen.
noticeTarget = window.parent === window ? null : window.parent;
$.support.postMessage = !! window.postMessage;
if ( false !== $.support.postMessage && null !== noticeTarget && -1 === window.parent.location.pathname.indexOf( 'index.php' ) ) {
noticeTarget.postMessage(
JSON.stringify( noticeData ),
window.location.origin
);
}
} else {
// Add a notice to the top of the screen.
wp.updates.addAdminNotice( noticeData );
}

setTimeout( function() {
$message.removeClass( 'activated-message' )
.text( _x( 'Active', 'plugin' ) );

if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
if ( isInModal ) {
wp.updates.setCardButtonStatus(
{
status: 'plugin-active',
Expand All @@ -1159,6 +1184,8 @@
)
}
);
} else {
$message.removeClass( 'activated-message' ).text( _x( 'Active', 'plugin' ) );
}
}, 1000 );
};
Expand Down Expand Up @@ -3226,6 +3253,11 @@
return;
}

if ( 'undefined' !== typeof message.id && 'plugin-activated-successfully' === message.id ) {
wp.updates.addAdminNotice( message );
return;
}

if (
'undefined' !== typeof message.status &&
'undefined' !== typeof message.slug &&
Expand Down Expand Up @@ -3458,5 +3490,22 @@
} );
}
);

/**
* Click handler for page refresh link.
*
* @since 6.5.3
*
* @param {Event} event Event interface.
*/
$document.on( 'click', '.refresh-page', function( event ) {
event.preventDefault();

if ( window.parent === window ) {
window.location.reload();
} else {
window.parent.location.reload();
}
} );
} );
})( jQuery, window.wp, window._wpUpdatesSettings );
2 changes: 1 addition & 1 deletion wp-admin/js/updates.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion wp-admin/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
if ( wp_is_block_theme() ) {
$submenu['themes.php'][6] = array( _x( 'Editor', 'site editor menu item' ), 'edit_theme_options', 'site-editor.php' );
} else {
$submenu['themes.php'][6] = array( __( 'Patterns' ), 'edit_theme_options', 'edit.php?post_type=wp_block' );
$submenu['themes.php'][6] = array( _x( 'Patterns', 'patterns menu item' ), 'edit_theme_options', 'edit.php?post_type=wp_block' );
}

if ( ! wp_is_block_theme() && current_theme_supports( 'block-template-parts' ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ function network_step1( $errors = false ) {
function network_step2( $errors = false ) {
global $wpdb, $is_nginx;

$hostname = get_clean_basedomain();
$slashed_home = trailingslashit( get_option( 'home' ) );
$base = parse_url( $slashed_home, PHP_URL_PATH );
$document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );
Expand Down Expand Up @@ -459,40 +458,21 @@ function network_step2( $errors = false ) {
</label></p>
<textarea id="network-wpconfig-rules" class="code" readonly="readonly" cols="100" rows="31" aria-describedby="network-wpconfig-rules-description">
<?php ob_start(); ?>
if ( !empty( $_ENV['PANTHEON_ENVIRONMENT'] )) {
$site_name = $_ENV['PANTHEON_SITE_NAME'];
// Override $hostname value as needed.
switch ( $_ENV['PANTHEON_ENVIRONMENT'] ) {
case 'live':
$hostname = $_SERVER['HTTP_HOST'];
break;
case 'test':
$hostname = 'test-' . $site_name . '.pantheonsite.io';
break;
case 'dev':
$hostname = 'dev-' . $site_name . '.pantheonsite.io';
break;
case 'lando':
$hostname = $site_name . '.lndo.site';
break;
default:
$hostname = $_ENV['PANTHEON_ENVIRONMENT'] . '-' . $site_name . '.pantheonsite.io';
break;
}
} else {
// Override with a default hostname.
$hostname = '<?php echo $hostname; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>';
}
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?> );
define( 'DOMAIN_CURRENT_SITE', $hostname );
define( 'PATH_CURRENT_SITE', '<?php echo $base; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>' );
// Use PANTHEON_HOSTNAME if in a Pantheon environment, otherwise use HTTP_HOST.
define( 'DOMAIN_CURRENT_SITE', defined( 'PANTHEON_HOSTNAME' ) ? PANTHEON_HOSTNAME : $_SERVER['HTTP_HOST'] );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
<?php
$config_file_contents = ob_get_contents();
ob_end_clean();
$config_file_contents = apply_filters( 'pantheon.multisite.config_contents', $config_file_contents );
/**
* Filters the contents of the network configuration rules for WordPress configuration files.
*
* This allows this screen to be modified for different environments or configurations (e.g. Composer-based WordPress multisite).
*
* @param string $config_file_contents The contents of the network configuration rules.
*/
$config_file_contents = apply_filters( 'pantheon.multisite.config_contents', ob_get_clean() );
echo $config_file_contents; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>
</textarea>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,21 @@ protected function __construct() {
* @return void
*/
protected function setup() {
/**
* Modify the default max-age for the Pantheon cache. Defaults to 1 week (604800 seconds).
*
* Usage:
* add_filter( 'pantheon_cache_default_max_age', function() {
* return DAY_IN_SECONDS;
* } );
*
* @param int $default_ttl The default max-age in seconds.
*/
$default_ttl = apply_filters( 'pantheon_cache_default_max_age', WEEK_IN_SECONDS );

$this->options = get_option( self::SLUG, [] );
$this->default_options = [
'default_ttl' => 600,
'default_ttl' => $default_ttl,
'maintenance_mode' => 'disabled',
];
$this->options = wp_parse_args( $this->options, $this->default_options );
Expand Down Expand Up @@ -209,14 +221,20 @@ public function action_admin_footer_trigger_plugin_open() {
}

/**
* Add the HTML for the default TTL field.
* Add the HTML for the default max-age field.
*
* @return void
*/
public function default_ttl_field() {
echo '<h3>' . esc_html__( 'Default Time to Live (TTL)', 'pantheon-cache' ) . '</h3>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '<p>' . esc_html__( 'Maximum time a cached page will be served. A higher TTL typically improves site performance.', 'pantheon-cache' ) . '</p>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '<input type="text" name="' . self::SLUG . '[default_ttl]" value="' . $this->options['default_ttl'] . '" size="5" /> ' . esc_html__( 'seconds', 'pantheon-cache' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
$disabled = ( has_filter( 'pantheon_cache_default_max_age' ) ) ? ' disabled' : '';
echo '<h3>' . esc_html__( 'Default Max Age', 'pantheon-cache' ) . '</h3>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '<p>' . esc_html__( 'Maximum time a cached page will be served. A higher max-age typically improves site performance.', 'pantheon-cache' ) . '</p>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '<input type="text" name="' . self::SLUG . '[default_ttl]" value="' . $this->options['default_ttl'] . '" size="5" ' . $disabled . ' /> ' . esc_html__( 'seconds', 'pantheon-cache' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped

// Display a message if the setting is disabled.
if ( $disabled ) {
echo '<p>' . esc_html__( 'This setting is disabled because the default max-age has been filtered to the current value.', 'pantheon-cache' ) . '</p>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}

/**
Expand Down Expand Up @@ -362,6 +380,19 @@ private function get_cache_control_header_value() {
* @return void
*/
public function cache_add_headers() {
/**
* Filter to skip the cache control header.
*
* @param bool $skip_cache_control Whether to skip the cache control header.
* @see https://github.com/pantheon-systems/pantheon-mu-plugin/issues/37
* @return bool
*/
$skip_cache_control = apply_filters( 'pantheon_skip_cache_control', false );

if ( $skip_cache_control ) {
return;
}

header( sprintf( 'cache-control: %s', $this->get_cache_control_header_value() ) );
}

Expand Down
Loading

0 comments on commit c66e78b

Please sign in to comment.