-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
220 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# This file is for unifying the coding style for different editors and IDEs | ||
# editorconfig.org | ||
|
||
# WordPress Coding Standards | ||
# https://make.wordpress.org/core/handbook/coding-standards/ | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = tab | ||
|
||
[*.yml] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.txt] | ||
end_of_line = crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
(function( $, wp ) { | ||
var $document = $( document ), | ||
__ = wp.i18n.__, | ||
_x = wp.i18n._x, | ||
sprintf = wp.i18n.sprintf; | ||
|
||
wp.updates.installPluginSuccess = function( response ) { | ||
var $message = $( '.plugin-card-' + response.slug ).find( '.install-now' ); | ||
|
||
$message | ||
.removeClass( 'updating-message' ) | ||
.addClass( 'updated-message installed button-disabled' ) | ||
.attr( | ||
'aria-label', | ||
sprintf( | ||
/* translators: %s: Plugin name and version. */ | ||
_x( '%s installed!', 'plugin' ), | ||
response.pluginName | ||
) | ||
) | ||
.text( _x( 'Installed!', 'plugin' ) ); | ||
|
||
wp.a11y.speak( __( 'Installation completed successfully.' ) ); | ||
|
||
$document.trigger( 'wp-plugin-install-success', response ); | ||
|
||
if ( response.activateUrl ) { | ||
setTimeout( function() { | ||
wp.updates.ajax( | ||
'check_plugin_dependencies', | ||
{ | ||
slug: response.slug, | ||
success: function() { | ||
// Transform the 'Install' button into an 'Activate' button. | ||
$message.removeClass( 'install-now installed button-disabled updated-message' ) | ||
.addClass( 'activate-now button-primary' ) | ||
.attr( 'href', response.activateUrl ); | ||
|
||
if ( 'plugins-network' === pagenow ) { | ||
$message | ||
.attr( | ||
'aria-label', | ||
sprintf( | ||
/* translators: %s: Plugin name. */ | ||
_x( 'Network Activate %s', 'plugin' ), | ||
response.pluginName | ||
) | ||
) | ||
.text( __( 'Network Activate' ) ); | ||
} else { | ||
$message | ||
.attr( | ||
'aria-label', | ||
sprintf( | ||
/* translators: %s: Plugin name. */ | ||
_x( 'Activate %s', 'plugin' ), | ||
response.pluginName | ||
) | ||
) | ||
.text( __( 'Activate' ) ); | ||
} | ||
}, | ||
error: function( error ) { | ||
$message | ||
.removeClass( 'install-now installed updated-message' ) | ||
.addClass( 'activate-now button-primary' ) | ||
.attr( | ||
'aria-label', | ||
sprintf( | ||
/* translators: 1: Plugin name, 2. The reason the plugin cannot be activated. */ | ||
_x( 'Cannot activate %1$s. %2$s', 'plugin' ), | ||
response.pluginName, | ||
error.errorMessage | ||
) | ||
) | ||
.text( __( 'Cannot Activate' ) ); | ||
} | ||
} | ||
); | ||
}, 1000 ); | ||
} | ||
}; | ||
})( jQuery, window.wp, window._wpUpdatesSettings ); |