auto-patch 748-dev-dev01-2024-06-08T22_32_58

This commit is contained in:
root
2024-06-08 22:32:59 +00:00
parent b81216dce7
commit aa87a51361
25 changed files with 3628 additions and 3201 deletions

View File

@@ -1105,33 +1105,21 @@
*
* @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. Some changes may not occur until you refresh the page.' ) );
wp.a11y.speak( __( 'Activation completed successfully.' ) );
$document.trigger( 'wp-plugin-activate-success', response );
$message
@@ -1140,7 +1128,7 @@
.attr( 'aria-label', ariaLabel )
.text( buttonText );
if ( isInModal ) {
if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
wp.updates.setCardButtonStatus(
{
status: 'activated-plugin',
@@ -1151,26 +1139,13 @@
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() {
if ( isInModal ) {
$message.removeClass( 'activated-message' )
.text( _x( 'Active', 'plugin' ) );
if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
wp.updates.setCardButtonStatus(
{
status: 'plugin-active',
@@ -1184,8 +1159,6 @@
)
}
);
} else {
$message.removeClass( 'activated-message' ).text( _x( 'Active', 'plugin' ) );
}
}, 1000 );
};
@@ -2664,41 +2637,16 @@
} );
/**
* Click handler for plugin activations in plugin activation view.
* Click handler for plugin activations in plugin activation modal view.
*
* @since 6.5.0
* @since 6.5.4 Redirect the parent window to the activation URL.
*
* @param {Event} event Event interface.
*/
$pluginFilter.on( 'click', '.activate-now', function( event ) {
var $activateButton = $( event.target );
$document.on( 'click', '#plugin-information-footer .activate-now', function( event ) {
event.preventDefault();
if ( $activateButton.hasClass( 'activating-message' ) || $activateButton.hasClass( 'button-disabled' ) ) {
return;
}
$activateButton
.removeClass( 'activate-now button-primary' )
.addClass( 'activating-message' )
.attr(
'aria-label',
sprintf(
/* translators: %s: Plugin name. */
_x( 'Activating %s', 'plugin' ),
$activateButton.data( 'name' )
)
)
.text( __( 'Activating...' ) );
wp.updates.activatePlugin(
{
name: $activateButton.data( 'name' ),
slug: $activateButton.data( 'slug' ),
plugin: $activateButton.data( 'plugin' )
}
);
window.parent.location.href = $( event.target ).attr( 'href' );
});
/**
@@ -3253,11 +3201,6 @@
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 &&
@@ -3490,22 +3433,5 @@
} );
}
);
/**
* 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 );