Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
/**
|
|
|
|
* Functions for ajaxified updates, deletions and installs inside the WordPress admin.
|
|
|
|
*
|
|
|
|
* @version 4.2.0
|
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
* @subpackage Administration
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* global pagenow */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {jQuery} $ jQuery object.
|
|
|
|
* @param {object} wp WP object.
|
|
|
|
* @param {object} settings WP Updates settings.
|
|
|
|
* @param {string} settings.ajax_nonce AJAX nonce.
|
|
|
|
* @param {object} settings.l10n Translation strings.
|
|
|
|
* @param {object=} settings.plugins Base names of plugins in their different states.
|
|
|
|
* @param {Array} settings.plugins.all Base names of all plugins.
|
|
|
|
* @param {Array} settings.plugins.active Base names of active plugins.
|
|
|
|
* @param {Array} settings.plugins.inactive Base names of inactive plugins.
|
|
|
|
* @param {Array} settings.plugins.upgrade Base names of plugins with updates available.
|
|
|
|
* @param {Array} settings.plugins.recently_activated Base names of recently activated plugins.
|
|
|
|
* @param {object=} settings.totals Plugin/theme status information or null.
|
|
|
|
* @param {number} settings.totals.all Amount of all plugins or themes.
|
|
|
|
* @param {number} settings.totals.upgrade Amount of plugins or themes with updates available.
|
|
|
|
* @param {number} settings.totals.disabled Amount of disabled themes.
|
|
|
|
*/
|
|
|
|
(function( $, wp, settings ) {
|
|
|
|
var $document = $( document );
|
|
|
|
|
|
|
|
wp = wp || {};
|
2014-02-26 01:55:14 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
/**
|
|
|
|
* The WP Updates object.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*
|
|
|
|
* @type {object}
|
|
|
|
*/
|
2014-02-26 01:55:14 -05:00
|
|
|
wp.updates = {};
|
|
|
|
|
|
|
|
/**
|
2015-02-04 23:19:23 -05:00
|
|
|
* User nonce for ajax calls.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @type {string}
|
2015-02-04 23:19:23 -05:00
|
|
|
*/
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.ajaxNonce = settings.ajax_nonce;
|
2015-02-04 23:19:23 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Localized strings.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @type {object}
|
|
|
|
*/
|
|
|
|
wp.updates.l10n = settings.l10n;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Current search term.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @type {string}
|
2015-02-04 23:19:23 -05:00
|
|
|
*/
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.searchTerm = '';
|
2015-02-04 23:19:23 -05:00
|
|
|
|
2015-03-17 23:18:27 -04:00
|
|
|
/**
|
|
|
|
* Whether filesystem credentials need to be requested from the user.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @type {bool}
|
2015-03-17 23:18:27 -04:00
|
|
|
*/
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.shouldRequestFilesystemCredentials = false;
|
2015-03-17 23:18:27 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Filesystem credentials to be packaged along with the request.
|
|
|
|
*
|
2015-04-02 01:31:26 -04:00
|
|
|
* @since 4.2.0
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @since 4.6.0 Added `available` property to indicate whether credentials have been provided.
|
2015-03-17 23:18:27 -04:00
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @type {object} filesystemCredentials Holds filesystem credentials.
|
|
|
|
* @type {object} filesystemCredentials.ftp Holds FTP credentials.
|
|
|
|
* @type {string} filesystemCredentials.ftp.host FTP host. Default empty string.
|
|
|
|
* @type {string} filesystemCredentials.ftp.username FTP user name. Default empty string.
|
|
|
|
* @type {string} filesystemCredentials.ftp.password FTP password. Default empty string.
|
|
|
|
* @type {string} filesystemCredentials.ftp.connectionType Type of FTP connection. 'ssh', 'ftp', or 'ftps'.
|
|
|
|
* Default empty string.
|
|
|
|
* @type {object} filesystemCredentials.ssh Holds SSH credentials.
|
|
|
|
* @type {string} filesystemCredentials.ssh.publicKey The public key. Default empty string.
|
|
|
|
* @type {string} filesystemCredentials.ssh.privateKey The private key. Default empty string.
|
|
|
|
* @type {bool} filesystemCredentials.available Whether filesystem credentials have been provided.
|
|
|
|
* Default 'false'.
|
2015-03-17 23:18:27 -04:00
|
|
|
*/
|
|
|
|
wp.updates.filesystemCredentials = {
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
ftp: {
|
|
|
|
host: '',
|
|
|
|
username: '',
|
|
|
|
password: '',
|
|
|
|
connectionType: ''
|
2015-03-17 23:18:27 -04:00
|
|
|
},
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
ssh: {
|
|
|
|
publicKey: '',
|
|
|
|
privateKey: ''
|
|
|
|
},
|
|
|
|
available: false
|
2015-03-17 23:18:27 -04:00
|
|
|
};
|
|
|
|
|
2015-02-04 23:19:23 -05:00
|
|
|
/**
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* Whether we're waiting for an Ajax request to complete.
|
2015-02-04 23:19:23 -05:00
|
|
|
*
|
|
|
|
* @since 4.2.0
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @since 4.6.0 More accurately named `ajaxLocked`.
|
2015-02-04 23:19:23 -05:00
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @type {bool}
|
2015-02-04 23:19:23 -05:00
|
|
|
*/
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.ajaxLocked = false;
|
2015-02-04 23:19:23 -05:00
|
|
|
|
2015-03-17 23:18:27 -04:00
|
|
|
/**
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* Admin notice template.
|
2015-03-17 23:18:27 -04:00
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @since 4.6.0
|
2015-03-17 23:18:27 -04:00
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @type {function} A function that lazily-compiles the template requested.
|
2015-03-17 23:18:27 -04:00
|
|
|
*/
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.adminNotice = wp.template( 'wp-updates-admin-notice' );
|
2015-03-17 23:18:27 -04:00
|
|
|
|
2015-02-04 23:19:23 -05:00
|
|
|
/**
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* Update queue.
|
|
|
|
*
|
2015-03-25 22:30:28 -04:00
|
|
|
* If the user tries to update a plugin while an update is
|
2015-02-04 23:19:23 -05:00
|
|
|
* already happening, it can be placed in this queue to perform later.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @since 4.6.0 More accurately named `queue`.
|
2015-02-04 23:19:23 -05:00
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @type {Array.object}
|
2015-02-04 23:19:23 -05:00
|
|
|
*/
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.queue = [];
|
2015-02-04 23:19:23 -05:00
|
|
|
|
2015-03-31 22:48:28 -04:00
|
|
|
/**
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* Holds a jQuery reference to return focus to when exiting the request credentials modal.
|
2015-03-31 22:48:28 -04:00
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @type {jQuery}
|
|
|
|
*/
|
|
|
|
wp.updates.$elToReturnFocusToFromCredentialsModal = undefined;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds or updates an admin notice.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @param {object} data
|
|
|
|
* @param {*=} data.selector Optional. Selector of an element to be replaced with the admin notice.
|
|
|
|
* @param {string=} data.id Optional. Unique id that will be used as the notice's id attribute.
|
|
|
|
* @param {string=} data.className Optional. Class names that will be used in the admin notice.
|
|
|
|
* @param {string=} data.message Optional. The message displayed in the notice.
|
|
|
|
* @param {number=} data.successes Optional. The amount of successful operations.
|
|
|
|
* @param {number=} data.errors Optional. The amount of failed operations.
|
|
|
|
* @param {Array=} data.errorMessages Optional. Error messages of failed operations.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
wp.updates.addAdminNotice = function( data ) {
|
|
|
|
var $notice = $( data.selector ), $adminNotice;
|
|
|
|
|
|
|
|
delete data.selector;
|
|
|
|
$adminNotice = wp.updates.adminNotice( data );
|
|
|
|
|
|
|
|
// Check if this admin notice already exists.
|
|
|
|
if ( ! $notice.length ) {
|
|
|
|
$notice = $( '#' + data.id );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $notice.length ) {
|
|
|
|
$notice.replaceWith( $adminNotice );
|
|
|
|
} else {
|
2016-10-18 23:20:29 -04:00
|
|
|
if ( 'customize' === pagenow ) {
|
|
|
|
$( '.customize-themes-notifications' ).append( $adminNotice );
|
|
|
|
} else {
|
|
|
|
$( '.wrap' ).find( '> h1' ).after( $adminNotice );
|
|
|
|
}
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
$document.trigger( 'wp-updates-notice-added' );
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles Ajax requests to WordPress.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @param {string} action The type of Ajax request ('update-plugin', 'install-theme', etc).
|
|
|
|
* @param {object} data Data that needs to be passed to the ajax callback.
|
|
|
|
* @return {$.promise} A jQuery promise that represents the request,
|
|
|
|
* decorated with an abort() method.
|
2015-03-31 22:48:28 -04:00
|
|
|
*/
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.ajax = function( action, data ) {
|
|
|
|
var options = {};
|
|
|
|
|
|
|
|
if ( wp.updates.ajaxLocked ) {
|
|
|
|
wp.updates.queue.push( {
|
|
|
|
action: action,
|
|
|
|
data: data
|
|
|
|
} );
|
|
|
|
|
|
|
|
// Return a Deferred object so callbacks can always be registered.
|
|
|
|
return $.Deferred();
|
|
|
|
}
|
|
|
|
|
|
|
|
wp.updates.ajaxLocked = true;
|
|
|
|
|
|
|
|
if ( data.success ) {
|
|
|
|
options.success = data.success;
|
|
|
|
delete data.success;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( data.error ) {
|
|
|
|
options.error = data.error;
|
|
|
|
delete data.error;
|
|
|
|
}
|
|
|
|
|
|
|
|
options.data = _.extend( data, {
|
|
|
|
action: action,
|
|
|
|
_ajax_nonce: wp.updates.ajaxNonce,
|
|
|
|
username: wp.updates.filesystemCredentials.ftp.username,
|
|
|
|
password: wp.updates.filesystemCredentials.ftp.password,
|
|
|
|
hostname: wp.updates.filesystemCredentials.ftp.hostname,
|
|
|
|
connection_type: wp.updates.filesystemCredentials.ftp.connectionType,
|
|
|
|
public_key: wp.updates.filesystemCredentials.ssh.publicKey,
|
|
|
|
private_key: wp.updates.filesystemCredentials.ssh.privateKey
|
|
|
|
} );
|
|
|
|
|
|
|
|
return wp.ajax.send( options ).always( wp.updates.ajaxAlways );
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Actions performed after every Ajax request.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @param {object} response
|
|
|
|
* @param {array=} response.debug Optional. Debug information.
|
|
|
|
* @param {string=} response.errorCode Optional. Error code for an error that occurred.
|
|
|
|
*/
|
|
|
|
wp.updates.ajaxAlways = function( response ) {
|
2016-08-04 18:18:30 -04:00
|
|
|
if ( ! response.errorCode || 'unable_to_connect_to_filesystem' !== response.errorCode ) {
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.ajaxLocked = false;
|
|
|
|
wp.updates.queueChecker();
|
|
|
|
}
|
|
|
|
|
2016-08-03 18:28:39 -04:00
|
|
|
if ( 'undefined' !== typeof response.debug && window.console && window.console.log ) {
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
_.map( response.debug, function( message ) {
|
|
|
|
window.console.log( $( '<p />' ).html( message ).text() );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
};
|
2015-03-31 22:48:28 -04:00
|
|
|
|
2015-02-04 23:19:23 -05:00
|
|
|
/**
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* Decrements the update counts throughout the various menus.
|
|
|
|
*
|
|
|
|
* This includes the toolbar, the "Updates" menu item and the menu items
|
|
|
|
* for plugins and themes.
|
2015-02-04 23:19:23 -05:00
|
|
|
*
|
|
|
|
* @since 3.9.0
|
2014-02-26 01:55:14 -05:00
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @param {string} type The type of item that was updated or deleted.
|
|
|
|
* Can be 'plugin', 'theme'.
|
2014-02-26 01:55:14 -05:00
|
|
|
*/
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.decrementCount = function( type ) {
|
|
|
|
var $adminBarUpdates = $( '#wp-admin-bar-updates' ),
|
2015-04-02 01:31:26 -04:00
|
|
|
$dashboardNavMenuUpdateCount = $( 'a[href="update-core.php"] .update-plugins' ),
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
count = $adminBarUpdates.find( '.ab-label' ).text(),
|
|
|
|
$menuItem, $itemCount, itemCount;
|
2014-02-26 01:55:14 -05:00
|
|
|
|
|
|
|
count = parseInt( count, 10 ) - 1;
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
|
2014-10-18 15:55:18 -04:00
|
|
|
if ( count < 0 || isNaN( count ) ) {
|
2014-02-26 01:55:14 -05:00
|
|
|
return;
|
|
|
|
}
|
2015-02-04 23:19:23 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$adminBarUpdates.find( '.ab-item' ).removeAttr( 'title' );
|
|
|
|
$adminBarUpdates.find( '.ab-label' ).text( count );
|
|
|
|
|
|
|
|
// Remove the update count from the toolbar if it's zero.
|
|
|
|
if ( ! count ) {
|
|
|
|
$adminBarUpdates.find( '.ab-label' ).parents( 'li' ).remove();
|
|
|
|
}
|
2014-02-26 01:55:14 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
// Update the "Updates" menu item.
|
|
|
|
$dashboardNavMenuUpdateCount.each( function( index, element ) {
|
|
|
|
element.className = element.className.replace( /count-\d+/, 'count-' + count );
|
2014-02-26 01:55:14 -05:00
|
|
|
} );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
|
2015-02-04 23:19:23 -05:00
|
|
|
$dashboardNavMenuUpdateCount.removeAttr( 'title' );
|
|
|
|
$dashboardNavMenuUpdateCount.find( '.update-count' ).text( count );
|
2014-02-26 01:55:14 -05:00
|
|
|
|
2016-07-05 11:18:27 -04:00
|
|
|
if ( 'plugin' === type ) {
|
|
|
|
$menuItem = $( '#menu-plugins' );
|
|
|
|
$itemCount = $menuItem.find( '.plugin-count' );
|
|
|
|
} else if ( 'theme' === type ) {
|
|
|
|
$menuItem = $( '#menu-appearance' );
|
|
|
|
$itemCount = $menuItem.find( '.theme-count' );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
}
|
2015-02-04 23:19:23 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
// Decrement the counter of the other menu items.
|
|
|
|
if ( $itemCount ) {
|
|
|
|
itemCount = $itemCount.eq( 0 ).text();
|
|
|
|
itemCount = parseInt( itemCount, 10 ) - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( itemCount < 0 || isNaN( itemCount ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( itemCount > 0 ) {
|
|
|
|
$( '.subsubsub .upgrade .count' ).text( '(' + itemCount + ')' );
|
|
|
|
|
|
|
|
$itemCount.text( itemCount );
|
|
|
|
$menuItem.find( '.update-plugins' ).each( function( index, element ) {
|
|
|
|
element.className = element.className.replace( /count-\d+/, 'count-' + itemCount );
|
|
|
|
} );
|
|
|
|
} else {
|
|
|
|
$( '.subsubsub .upgrade' ).remove();
|
|
|
|
$menuItem.find( '.update-plugins' ).remove();
|
2015-02-04 23:19:23 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* Sends an Ajax request to the server to update a plugin.
|
2015-02-04 23:19:23 -05:00
|
|
|
*
|
|
|
|
* @since 4.2.0
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @since 4.6.0 More accurately named `updatePlugin`.
|
2015-02-04 23:19:23 -05:00
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @param {object} args Arguments.
|
|
|
|
* @param {string} args.plugin Plugin basename.
|
|
|
|
* @param {string} args.slug Plugin slug.
|
|
|
|
* @param {updatePluginSuccess=} args.success Optional. Success callback. Default: wp.updates.updatePluginSuccess
|
|
|
|
* @param {updatePluginError=} args.error Optional. Error callback. Default: wp.updates.updatePluginError
|
|
|
|
* @return {$.promise} A jQuery promise that represents the request,
|
|
|
|
* decorated with an abort() method.
|
2015-02-04 23:19:23 -05:00
|
|
|
*/
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.updatePlugin = function( args ) {
|
|
|
|
var $updateRow, $card, $message, message;
|
|
|
|
|
|
|
|
args = _.extend( {
|
|
|
|
success: wp.updates.updatePluginSuccess,
|
|
|
|
error: wp.updates.updatePluginError
|
|
|
|
}, args );
|
2015-11-18 15:10:26 -05:00
|
|
|
|
2015-02-04 23:19:23 -05:00
|
|
|
if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$updateRow = $( 'tr[data-plugin="' + args.plugin + '"]' );
|
2016-08-05 18:57:29 -04:00
|
|
|
$message = $updateRow.find( '.update-message' ).removeClass( 'notice-error' ).addClass( 'updating-message notice-warning' ).find( 'p' );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
message = wp.updates.l10n.updatingLabel.replace( '%s', $updateRow.find( '.plugin-title strong' ).text() );
|
|
|
|
} else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
|
|
|
|
$card = $( '.plugin-card-' + args.slug );
|
|
|
|
$message = $card.find( '.update-now' ).addClass( 'updating-message' );
|
|
|
|
message = wp.updates.l10n.updatingLabel.replace( '%s', $message.data( 'name' ) );
|
|
|
|
|
2015-11-18 15:10:26 -05:00
|
|
|
// Remove previous error messages, if any.
|
|
|
|
$card.removeClass( 'plugin-card-update-failed' ).find( '.notice.notice-error' ).remove();
|
2015-02-04 23:19:23 -05:00
|
|
|
}
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
if ( $message.html() !== wp.updates.l10n.updating ) {
|
2015-03-31 22:48:28 -04:00
|
|
|
$message.data( 'originaltext', $message.html() );
|
|
|
|
}
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$message
|
|
|
|
.attr( 'aria-label', message )
|
|
|
|
.text( wp.updates.l10n.updating );
|
2015-02-04 23:19:23 -05:00
|
|
|
|
2016-07-31 14:57:28 -04:00
|
|
|
$document.trigger( 'wp-plugin-updating', args );
|
2015-02-04 23:19:23 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
return wp.updates.ajax( 'update-plugin', args );
|
2015-02-05 14:52:22 -05:00
|
|
|
};
|
2015-02-04 23:19:23 -05:00
|
|
|
|
|
|
|
/**
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* Updates the UI appropriately after a successful plugin update.
|
2015-02-04 23:19:23 -05:00
|
|
|
*
|
|
|
|
* @since 4.2.0
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @since 4.6.0 More accurately named `updatePluginSuccess`.
|
2015-02-04 23:19:23 -05:00
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @typedef {object} updatePluginSuccess
|
|
|
|
* @param {object} response Response from the server.
|
|
|
|
* @param {string} response.slug Slug of the plugin to be updated.
|
|
|
|
* @param {string} response.plugin Basename of the plugin to be updated.
|
|
|
|
* @param {string} response.pluginName Name of the plugin to be updated.
|
|
|
|
* @param {string} response.oldVersion Old version of the plugin.
|
|
|
|
* @param {string} response.newVersion New version of the plugin.
|
2015-02-04 23:19:23 -05:00
|
|
|
*/
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.updatePluginSuccess = function( response ) {
|
|
|
|
var $pluginRow, $updateMessage, newText;
|
|
|
|
|
2015-02-04 23:19:23 -05:00
|
|
|
if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$pluginRow = $( 'tr[data-plugin="' + response.plugin + '"]' )
|
|
|
|
.removeClass( 'update' )
|
|
|
|
.addClass( 'updated' );
|
|
|
|
$updateMessage = $pluginRow.find( '.update-message' )
|
|
|
|
.removeClass( 'updating-message notice-warning' )
|
|
|
|
.addClass( 'updated-message notice-success' ).find( 'p' );
|
2015-03-19 01:26:28 -04:00
|
|
|
|
2015-03-17 23:18:27 -04:00
|
|
|
// Update the version number in the row.
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
newText = $pluginRow.find( '.plugin-version-author-uri' ).html().replace( response.oldVersion, response.newVersion );
|
|
|
|
$pluginRow.find( '.plugin-version-author-uri' ).html( newText );
|
|
|
|
} else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
|
|
|
|
$updateMessage = $( '.plugin-card-' + response.slug ).find( '.update-now' )
|
|
|
|
.removeClass( 'updating-message' )
|
|
|
|
.addClass( 'button-disabled updated-message' );
|
2015-02-04 23:19:23 -05:00
|
|
|
}
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$updateMessage
|
|
|
|
.attr( 'aria-label', wp.updates.l10n.updatedLabel.replace( '%s', response.pluginName ) )
|
|
|
|
.text( wp.updates.l10n.updated );
|
2015-02-04 23:19:23 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.a11y.speak( wp.updates.l10n.updatedMsg, 'polite' );
|
2015-04-15 10:37:27 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.decrementCount( 'plugin' );
|
2015-04-22 12:57:26 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$document.trigger( 'wp-plugin-update-success', response );
|
2015-02-04 23:19:23 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* Updates the UI appropriately after a failed plugin update.
|
2015-02-04 23:19:23 -05:00
|
|
|
*
|
|
|
|
* @since 4.2.0
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @since 4.6.0 More accurately named `updatePluginError`.
|
2015-02-04 23:19:23 -05:00
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @typedef {object} updatePluginError
|
|
|
|
* @param {object} response Response from the server.
|
|
|
|
* @param {string} response.slug Slug of the plugin to be updated.
|
|
|
|
* @param {string} response.plugin Basename of the plugin to be updated.
|
|
|
|
* @param {string=} response.pluginName Optional. Name of the plugin to be updated.
|
|
|
|
* @param {string} response.errorCode Error code for the error that occurred.
|
|
|
|
* @param {string} response.errorMessage The error that occurred.
|
2015-02-04 23:19:23 -05:00
|
|
|
*/
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.updatePluginError = function( response ) {
|
|
|
|
var $card, $message, errorMessage;
|
2015-11-18 15:10:26 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
if ( ! wp.updates.isValidResponse( response, 'update' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
2015-11-18 15:10:26 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
if ( wp.updates.maybeHandleCredentialError( response, 'update-plugin' ) ) {
|
2015-03-17 23:18:27 -04:00
|
|
|
return;
|
|
|
|
}
|
2015-11-18 15:10:26 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
errorMessage = wp.updates.l10n.updateFailed.replace( '%s', response.errorMessage );
|
2015-11-18 15:10:26 -05:00
|
|
|
|
2015-02-04 23:19:23 -05:00
|
|
|
if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
|
2016-07-27 13:44:41 -04:00
|
|
|
if ( response.plugin ) {
|
|
|
|
$message = $( 'tr[data-plugin="' + response.plugin + '"]' ).find( '.update-message' );
|
|
|
|
} else {
|
|
|
|
$message = $( 'tr[data-slug="' + response.slug + '"]' ).find( '.update-message' );
|
|
|
|
}
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$message.removeClass( 'updating-message notice-warning' ).addClass( 'notice-error' ).find( 'p' ).html( errorMessage );
|
2016-08-04 17:06:38 -04:00
|
|
|
|
|
|
|
if ( response.pluginName ) {
|
|
|
|
$message.find( 'p' )
|
|
|
|
.attr( 'aria-label', wp.updates.l10n.updateFailedLabel.replace( '%s', response.pluginName ) );
|
|
|
|
} else {
|
|
|
|
$message.find( 'p' ).removeAttr( 'aria-label' );
|
|
|
|
}
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
} else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
|
|
|
|
$card = $( '.plugin-card-' + response.slug )
|
2015-11-18 15:10:26 -05:00
|
|
|
.addClass( 'plugin-card-update-failed' )
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
.append( wp.updates.adminNotice( {
|
|
|
|
className: 'update-message notice-error notice-alt is-dismissible',
|
|
|
|
message: errorMessage
|
|
|
|
} ) );
|
2015-11-18 15:10:26 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$card.find( '.update-now' )
|
|
|
|
.text( wp.updates.l10n.updateFailedShort ).removeClass( 'updating-message' );
|
2015-11-18 15:10:26 -05:00
|
|
|
|
2016-07-27 13:44:41 -04:00
|
|
|
if ( response.pluginName ) {
|
|
|
|
$card.find( '.update-now' )
|
|
|
|
.attr( 'aria-label', wp.updates.l10n.updateFailedLabel.replace( '%s', response.pluginName ) );
|
2016-08-04 17:06:38 -04:00
|
|
|
} else {
|
|
|
|
$card.find( '.update-now' ).removeAttr( 'aria-label' );
|
2016-07-27 13:44:41 -04:00
|
|
|
}
|
|
|
|
|
2015-11-18 15:10:26 -05:00
|
|
|
$card.on( 'click', '.notice.is-dismissible .notice-dismiss', function() {
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
|
2015-11-18 15:10:26 -05:00
|
|
|
// Use same delay as the total duration of the notice fadeTo + slideUp animation.
|
|
|
|
setTimeout( function() {
|
|
|
|
$card
|
|
|
|
.removeClass( 'plugin-card-update-failed' )
|
|
|
|
.find( '.column-name a' ).focus();
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
|
|
|
|
$card.find( '.update-now' )
|
|
|
|
.attr( 'aria-label', false )
|
|
|
|
.text( wp.updates.l10n.updateNow );
|
2015-11-18 15:10:26 -05:00
|
|
|
}, 200 );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
} );
|
2015-02-04 23:19:23 -05:00
|
|
|
}
|
2015-11-18 15:10:26 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.a11y.speak( errorMessage, 'assertive' );
|
2015-06-15 00:28:25 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$document.trigger( 'wp-plugin-update-error', response );
|
2015-02-04 23:19:23 -05:00
|
|
|
};
|
|
|
|
|
2015-02-11 00:06:28 -05:00
|
|
|
/**
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* Sends an Ajax request to the server to install a plugin.
|
2015-02-11 00:06:28 -05:00
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @param {object} args Arguments.
|
|
|
|
* @param {string} args.slug Plugin identifier in the WordPress.org Plugin repository.
|
|
|
|
* @param {installPluginSuccess=} args.success Optional. Success callback. Default: wp.updates.installPluginSuccess
|
|
|
|
* @param {installPluginError=} args.error Optional. Error callback. Default: wp.updates.installPluginError
|
|
|
|
* @return {$.promise} A jQuery promise that represents the request,
|
|
|
|
* decorated with an abort() method.
|
2015-02-11 00:06:28 -05:00
|
|
|
*/
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.installPlugin = function( args ) {
|
|
|
|
var $card = $( '.plugin-card-' + args.slug ),
|
|
|
|
$message = $card.find( '.install-now' );
|
|
|
|
|
|
|
|
args = _.extend( {
|
|
|
|
success: wp.updates.installPluginSuccess,
|
|
|
|
error: wp.updates.installPluginError
|
|
|
|
}, args );
|
|
|
|
|
|
|
|
if ( 'import' === pagenow ) {
|
2016-07-17 11:32:30 -04:00
|
|
|
$message = $( '[data-slug="' + args.slug + '"]' );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
}
|
2015-03-17 23:18:27 -04:00
|
|
|
|
2016-08-08 21:14:28 -04:00
|
|
|
if ( $message.html() !== wp.updates.l10n.installing ) {
|
|
|
|
$message.data( 'originaltext', $message.html() );
|
|
|
|
}
|
2016-07-17 11:32:30 -04:00
|
|
|
|
2016-07-13 13:32:29 -04:00
|
|
|
$message
|
|
|
|
.addClass( 'updating-message' )
|
2016-08-08 21:14:28 -04:00
|
|
|
.attr( 'aria-label', wp.updates.l10n.pluginInstallingLabel.replace( '%s', $message.data( 'name' ) ) )
|
|
|
|
.text( wp.updates.l10n.installing );
|
2015-02-11 00:06:28 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.a11y.speak( wp.updates.l10n.installingMsg, 'polite' );
|
|
|
|
|
|
|
|
// Remove previous error messages, if any.
|
|
|
|
$card.removeClass( 'plugin-card-install-failed' ).find( '.notice.notice-error' ).remove();
|
|
|
|
|
2016-07-31 14:57:28 -04:00
|
|
|
$document.trigger( 'wp-plugin-installing', args );
|
2016-08-03 18:24:35 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
return wp.updates.ajax( 'install-plugin', args );
|
2015-03-17 23:18:27 -04:00
|
|
|
};
|
2015-02-11 00:06:28 -05:00
|
|
|
|
2015-03-17 23:18:27 -04:00
|
|
|
/**
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* Updates the UI appropriately after a successful plugin install.
|
2015-03-17 23:18:27 -04:00
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @typedef {object} installPluginSuccess
|
|
|
|
* @param {object} response Response from the server.
|
|
|
|
* @param {string} response.slug Slug of the installed plugin.
|
|
|
|
* @param {string} response.pluginName Name of the installed plugin.
|
|
|
|
* @param {string} response.activateUrl URL to activate the just installed plugin.
|
2015-03-17 23:18:27 -04:00
|
|
|
*/
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.installPluginSuccess = function( response ) {
|
|
|
|
var $message = $( '.plugin-card-' + response.slug ).find( '.install-now' );
|
|
|
|
|
|
|
|
$message
|
|
|
|
.removeClass( 'updating-message' )
|
|
|
|
.addClass( 'updated-message installed button-disabled' )
|
2016-07-13 13:32:29 -04:00
|
|
|
.attr( 'aria-label', wp.updates.l10n.pluginInstalledLabel.replace( '%s', response.pluginName ) )
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
.text( wp.updates.l10n.installed );
|
|
|
|
|
|
|
|
wp.a11y.speak( wp.updates.l10n.installedMsg, 'polite' );
|
|
|
|
|
|
|
|
$document.trigger( 'wp-plugin-install-success', response );
|
|
|
|
|
|
|
|
if ( response.activateUrl ) {
|
|
|
|
setTimeout( 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 )
|
2016-07-13 13:32:29 -04:00
|
|
|
.attr( 'aria-label', wp.updates.l10n.activatePluginLabel.replace( '%s', response.pluginName ) )
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
.text( wp.updates.l10n.activatePlugin );
|
|
|
|
}, 1000 );
|
|
|
|
}
|
2015-03-17 23:18:27 -04:00
|
|
|
};
|
2015-02-04 23:19:23 -05:00
|
|
|
|
|
|
|
/**
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* Updates the UI appropriately after a failed plugin install.
|
2015-02-04 23:19:23 -05:00
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @typedef {object} installPluginError
|
|
|
|
* @param {object} response Response from the server.
|
|
|
|
* @param {string} response.slug Slug of the plugin to be installed.
|
|
|
|
* @param {string=} response.pluginName Optional. Name of the plugin to be installed.
|
|
|
|
* @param {string} response.errorCode Error code for the error that occurred.
|
|
|
|
* @param {string} response.errorMessage The error that occurred.
|
2015-02-04 23:19:23 -05:00
|
|
|
*/
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.installPluginError = function( response ) {
|
|
|
|
var $card = $( '.plugin-card-' + response.slug ),
|
|
|
|
$button = $card.find( '.install-now' ),
|
|
|
|
errorMessage;
|
|
|
|
|
|
|
|
if ( ! wp.updates.isValidResponse( response, 'install' ) ) {
|
2015-02-04 23:19:23 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
if ( wp.updates.maybeHandleCredentialError( response, 'install-plugin' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
2015-02-04 23:19:23 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
errorMessage = wp.updates.l10n.installFailed.replace( '%s', response.errorMessage );
|
2015-02-04 23:19:23 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$card
|
|
|
|
.addClass( 'plugin-card-update-failed' )
|
|
|
|
.append( '<div class="notice notice-error notice-alt is-dismissible"><p>' + errorMessage + '</p></div>' );
|
2015-03-17 23:18:27 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$card.on( 'click', '.notice.is-dismissible .notice-dismiss', function() {
|
2015-03-31 22:48:28 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
// Use same delay as the total duration of the notice fadeTo + slideUp animation.
|
|
|
|
setTimeout( function() {
|
|
|
|
$card
|
|
|
|
.removeClass( 'plugin-card-update-failed' )
|
|
|
|
.find( '.column-name a' ).focus();
|
|
|
|
}, 200 );
|
|
|
|
} );
|
2015-03-31 22:48:28 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$button
|
|
|
|
.removeClass( 'updating-message' ).addClass( 'button-disabled' )
|
2016-07-13 13:32:29 -04:00
|
|
|
.attr( 'aria-label', wp.updates.l10n.pluginInstallFailedLabel.replace( '%s', $button.data( 'name' ) ) )
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
.text( wp.updates.l10n.installFailedShort );
|
|
|
|
|
|
|
|
wp.a11y.speak( errorMessage, 'assertive' );
|
|
|
|
|
|
|
|
$document.trigger( 'wp-plugin-install-error', response );
|
2015-03-31 22:48:28 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* Updates the UI appropriately after a successful importer install.
|
2015-03-31 22:48:28 -04:00
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @since 4.6.0
|
2015-03-31 22:48:28 -04:00
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @typedef {object} installImporterSuccess
|
|
|
|
* @param {object} response Response from the server.
|
|
|
|
* @param {string} response.slug Slug of the installed plugin.
|
|
|
|
* @param {string} response.pluginName Name of the installed plugin.
|
|
|
|
* @param {string} response.activateUrl URL to activate the just installed plugin.
|
2015-03-31 22:48:28 -04:00
|
|
|
*/
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.installImporterSuccess = function( response ) {
|
|
|
|
wp.updates.addAdminNotice( {
|
|
|
|
id: 'install-success',
|
|
|
|
className: 'notice-success is-dismissible',
|
|
|
|
message: wp.updates.l10n.importerInstalledMsg.replace( '%s', response.activateUrl + '&from=import' )
|
|
|
|
} );
|
2015-03-17 23:18:27 -04:00
|
|
|
|
2016-07-17 11:32:30 -04:00
|
|
|
$( '[data-slug="' + response.slug + '"]' )
|
|
|
|
.removeClass( 'install-now updating-message' )
|
|
|
|
.addClass( 'activate-now' )
|
|
|
|
.attr({
|
|
|
|
'href': response.activateUrl + '&from=import',
|
|
|
|
'aria-label': wp.updates.l10n.activateImporterLabel.replace( '%s', response.pluginName )
|
|
|
|
})
|
|
|
|
.text( wp.updates.l10n.activateImporter );
|
2015-03-31 22:48:28 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.a11y.speak( wp.updates.l10n.installedMsg, 'polite' );
|
2015-03-31 22:48:28 -04:00
|
|
|
|
2016-07-05 11:05:28 -04:00
|
|
|
$document.trigger( 'wp-importer-install-success', response );
|
2015-03-31 22:48:28 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* Updates the UI appropriately after a failed importer install.
|
2015-03-31 22:48:28 -04:00
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @typedef {object} installImporterError
|
|
|
|
* @param {object} response Response from the server.
|
|
|
|
* @param {string} response.slug Slug of the plugin to be installed.
|
|
|
|
* @param {string=} response.pluginName Optional. Name of the plugin to be installed.
|
|
|
|
* @param {string} response.errorCode Error code for the error that occurred.
|
|
|
|
* @param {string} response.errorMessage The error that occurred.
|
2015-03-31 22:48:28 -04:00
|
|
|
*/
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.installImporterError = function( response ) {
|
2016-07-17 11:32:30 -04:00
|
|
|
var errorMessage = wp.updates.l10n.installFailed.replace( '%s', response.errorMessage ),
|
|
|
|
$installLink = $( '[data-slug="' + response.slug + '"]' ),
|
|
|
|
pluginName = $installLink.data( 'name' );
|
2015-03-31 22:48:28 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
if ( ! wp.updates.isValidResponse( response, 'install' ) ) {
|
2015-03-31 22:48:28 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
if ( wp.updates.maybeHandleCredentialError( response, 'install-plugin' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
2015-03-31 22:48:28 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.addAdminNotice( {
|
|
|
|
id: response.errorCode,
|
|
|
|
className: 'notice-error is-dismissible',
|
|
|
|
message: errorMessage
|
|
|
|
} );
|
2015-03-31 22:48:28 -04:00
|
|
|
|
2016-07-17 11:32:30 -04:00
|
|
|
$installLink
|
|
|
|
.removeClass( 'updating-message' )
|
|
|
|
.text( wp.updates.l10n.installNow )
|
|
|
|
.attr( 'aria-label', wp.updates.l10n.installNowLabel.replace( '%s', pluginName ) );
|
2015-03-31 22:48:28 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.a11y.speak( errorMessage, 'assertive' );
|
|
|
|
|
|
|
|
$document.trigger( 'wp-importer-install-error', response );
|
2015-03-31 22:48:28 -04:00
|
|
|
};
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
|
2015-04-14 12:42:26 -04:00
|
|
|
/**
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* Sends an Ajax request to the server to delete a plugin.
|
2015-04-14 12:42:26 -04:00
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @since 4.6.0
|
2015-04-14 12:42:26 -04:00
|
|
|
*
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
* @param {object} args Arguments.
|
|
|
|
* @param {string} args.plugin Basename of the plugin to be deleted.
|
|
|
|
* @param {string} args.slug Slug of the plugin to be deleted.
|
|
|
|
* @param {deletePluginSuccess=} args.success Optional. Success callback. Default: wp.updates.deletePluginSuccess
|
|
|
|
* @param {deletePluginError=} args.error Optional. Error callback. Default: wp.updates.deletePluginError
|
|
|
|
* @return {$.promise} A jQuery promise that represents the request,
|
|
|
|
* decorated with an abort() method.
|
2015-04-14 12:42:26 -04:00
|
|
|
*/
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.deletePlugin = function( args ) {
|
2016-08-09 06:39:32 -04:00
|
|
|
var $link = $( '[data-plugin="' + args.plugin + '"]' ).find( '.row-actions a.delete' );
|
2015-04-14 12:42:26 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
args = _.extend( {
|
|
|
|
success: wp.updates.deletePluginSuccess,
|
|
|
|
error: wp.updates.deletePluginError
|
|
|
|
}, args );
|
|
|
|
|
2016-08-09 06:39:32 -04:00
|
|
|
if ( $link.html() !== wp.updates.l10n.deleting ) {
|
|
|
|
$link
|
|
|
|
.data( 'originaltext', $link.html() )
|
|
|
|
.text( wp.updates.l10n.deleting );
|
2015-04-14 12:42:26 -04:00
|
|
|
}
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.a11y.speak( wp.updates.l10n.deleting, 'polite' );
|
2015-03-31 22:48:28 -04:00
|
|
|
|
2016-07-31 14:57:28 -04:00
|
|
|
$document.trigger( 'wp-plugin-deleting', args );
|
2016-08-03 18:24:35 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
return wp.updates.ajax( 'delete-plugin', args );
|
|
|
|
};
|
2016-05-19 18:59:28 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
/**
|
|
|
|
* Updates the UI appropriately after a successful plugin deletion.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @typedef {object} deletePluginSuccess
|
|
|
|
* @param {object} response Response from the server.
|
|
|
|
* @param {string} response.slug Slug of the plugin that was deleted.
|
|
|
|
* @param {string} response.plugin Base name of the plugin that was deleted.
|
|
|
|
* @param {string} response.pluginName Name of the plugin that was deleted.
|
|
|
|
*/
|
|
|
|
wp.updates.deletePluginSuccess = function( response ) {
|
|
|
|
|
|
|
|
// Removes the plugin and updates rows.
|
|
|
|
$( '[data-plugin="' + response.plugin + '"]' ).css( { backgroundColor: '#faafaa' } ).fadeOut( 350, function() {
|
|
|
|
var $form = $( '#bulk-action-form' ),
|
|
|
|
$views = $( '.subsubsub' ),
|
|
|
|
$pluginRow = $( this ),
|
|
|
|
columnCount = $form.find( 'thead th:not(.hidden), thead td' ).length,
|
|
|
|
pluginDeletedRow = wp.template( 'item-deleted-row' ),
|
|
|
|
/** @type {object} plugins Base names of plugins in their different states. */
|
|
|
|
plugins = settings.plugins;
|
|
|
|
|
|
|
|
// Add a success message after deleting a plugin.
|
|
|
|
if ( ! $pluginRow.hasClass( 'plugin-update-tr' ) ) {
|
|
|
|
$pluginRow.after(
|
|
|
|
pluginDeletedRow( {
|
|
|
|
slug: response.slug,
|
|
|
|
plugin: response.plugin,
|
|
|
|
colspan: columnCount,
|
|
|
|
name: response.pluginName
|
|
|
|
} )
|
|
|
|
);
|
|
|
|
}
|
2015-03-17 23:18:27 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$pluginRow.remove();
|
2015-03-17 23:18:27 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
// Remove plugin from update count.
|
|
|
|
if ( -1 !== _.indexOf( plugins.upgrade, response.plugin ) ) {
|
|
|
|
plugins.upgrade = _.without( plugins.upgrade, response.plugin );
|
|
|
|
wp.updates.decrementCount( 'plugin' );
|
|
|
|
}
|
2015-03-17 23:18:27 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
// Remove from views.
|
|
|
|
if ( -1 !== _.indexOf( plugins.inactive, response.plugin ) ) {
|
|
|
|
plugins.inactive = _.without( plugins.inactive, response.plugin );
|
|
|
|
if ( plugins.inactive.length ) {
|
|
|
|
$views.find( '.inactive .count' ).text( '(' + plugins.inactive.length + ')' );
|
|
|
|
} else {
|
|
|
|
$views.find( '.inactive' ).remove();
|
|
|
|
}
|
|
|
|
}
|
2015-03-17 23:18:27 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
if ( -1 !== _.indexOf( plugins.active, response.plugin ) ) {
|
|
|
|
plugins.active = _.without( plugins.active, response.plugin );
|
|
|
|
if ( plugins.active.length ) {
|
|
|
|
$views.find( '.active .count' ).text( '(' + plugins.active.length + ')' );
|
|
|
|
} else {
|
|
|
|
$views.find( '.active' ).remove();
|
|
|
|
}
|
|
|
|
}
|
2015-03-17 23:18:27 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
if ( -1 !== _.indexOf( plugins.recently_activated, response.plugin ) ) {
|
|
|
|
plugins.recently_activated = _.without( plugins.recently_activated, response.plugin );
|
|
|
|
if ( plugins.recently_activated.length ) {
|
|
|
|
$views.find( '.recently_activated .count' ).text( '(' + plugins.recently_activated.length + ')' );
|
|
|
|
} else {
|
|
|
|
$views.find( '.recently_activated' ).remove();
|
|
|
|
}
|
|
|
|
}
|
2015-03-31 22:48:28 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
plugins.all = _.without( plugins.all, response.plugin );
|
|
|
|
|
|
|
|
if ( plugins.all.length ) {
|
|
|
|
$views.find( '.all .count' ).text( '(' + plugins.all.length + ')' );
|
|
|
|
} else {
|
|
|
|
$form.find( '.tablenav' ).css( { visibility: 'hidden' } );
|
|
|
|
$views.find( '.all' ).remove();
|
2015-06-14 23:20:28 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
if ( ! $form.find( 'tr.no-items' ).length ) {
|
|
|
|
$form.find( '#the-list' ).append( '<tr class="no-items"><td class="colspanchange" colspan="' + columnCount + '">' + wp.updates.l10n.noPlugins + '</td></tr>' );
|
|
|
|
}
|
2015-03-17 23:18:27 -04:00
|
|
|
}
|
2015-02-04 23:19:23 -05:00
|
|
|
} );
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.a11y.speak( wp.updates.l10n.deleted, 'polite' );
|
2015-03-31 22:48:28 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$document.trigger( 'wp-plugin-delete-success', response );
|
|
|
|
};
|
2016-02-17 14:42:26 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
/**
|
|
|
|
* Updates the UI appropriately after a failed plugin deletion.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @typedef {object} deletePluginError
|
|
|
|
* @param {object} response Response from the server.
|
|
|
|
* @param {string} response.slug Slug of the plugin to be deleted.
|
|
|
|
* @param {string} response.plugin Base name of the plugin to be deleted
|
|
|
|
* @param {string=} response.pluginName Optional. Name of the plugin to be deleted.
|
|
|
|
* @param {string} response.errorCode Error code for the error that occurred.
|
|
|
|
* @param {string} response.errorMessage The error that occurred.
|
|
|
|
*/
|
|
|
|
wp.updates.deletePluginError = function( response ) {
|
2016-07-27 13:44:41 -04:00
|
|
|
var $plugin, $pluginUpdateRow,
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
pluginUpdateRow = wp.template( 'item-update-row' ),
|
|
|
|
noticeContent = wp.updates.adminNotice( {
|
|
|
|
className: 'update-message notice-error notice-alt',
|
|
|
|
message: response.errorMessage
|
|
|
|
} );
|
2015-03-31 22:48:28 -04:00
|
|
|
|
2016-07-27 13:44:41 -04:00
|
|
|
if ( response.plugin ) {
|
|
|
|
$plugin = $( 'tr.inactive[data-plugin="' + response.plugin + '"]' );
|
|
|
|
$pluginUpdateRow = $plugin.siblings( '[data-plugin="' + response.plugin + '"]' );
|
|
|
|
} else {
|
|
|
|
$plugin = $( 'tr.inactive[data-slug="' + response.slug + '"]' );
|
|
|
|
$pluginUpdateRow = $plugin.siblings( '[data-slug="' + response.slug + '"]' );
|
|
|
|
}
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
if ( ! wp.updates.isValidResponse( response, 'delete' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
2015-02-04 23:19:23 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
if ( wp.updates.maybeHandleCredentialError( response, 'delete-plugin' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
2015-04-06 23:09:26 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
// Add a plugin update row if it doesn't exist yet.
|
|
|
|
if ( ! $pluginUpdateRow.length ) {
|
|
|
|
$plugin.addClass( 'update' ).after(
|
|
|
|
pluginUpdateRow( {
|
|
|
|
slug: response.slug,
|
2016-07-27 13:44:41 -04:00
|
|
|
plugin: response.plugin || response.slug,
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
colspan: $( '#bulk-action-form' ).find( 'thead th:not(.hidden), thead td' ).length,
|
|
|
|
content: noticeContent
|
|
|
|
} )
|
|
|
|
);
|
|
|
|
} else {
|
2015-04-06 23:09:26 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
// Remove previous error messages, if any.
|
|
|
|
$pluginUpdateRow.find( '.notice-error' ).remove();
|
2015-04-06 23:09:26 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$pluginUpdateRow.find( '.plugin-update' ).append( noticeContent );
|
|
|
|
}
|
2015-04-06 23:09:26 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$document.trigger( 'wp-plugin-delete-error', response );
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sends an Ajax request to the server to update a theme.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @param {object} args Arguments.
|
|
|
|
* @param {string} args.slug Theme stylesheet.
|
|
|
|
* @param {updateThemeSuccess=} args.success Optional. Success callback. Default: wp.updates.updateThemeSuccess
|
|
|
|
* @param {updateThemeError=} args.error Optional. Error callback. Default: wp.updates.updateThemeError
|
|
|
|
* @return {$.promise} A jQuery promise that represents the request,
|
|
|
|
* decorated with an abort() method.
|
|
|
|
*/
|
|
|
|
wp.updates.updateTheme = function( args ) {
|
|
|
|
var $notice;
|
|
|
|
|
|
|
|
args = _.extend( {
|
|
|
|
success: wp.updates.updateThemeSuccess,
|
|
|
|
error: wp.updates.updateThemeError
|
|
|
|
}, args );
|
|
|
|
|
|
|
|
if ( 'themes-network' === pagenow ) {
|
2016-08-05 18:57:29 -04:00
|
|
|
$notice = $( '[data-slug="' + args.slug + '"]' ).find( '.update-message' ).removeClass( 'notice-error' ).addClass( 'updating-message notice-warning' ).find( 'p' );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
|
2016-10-18 23:20:29 -04:00
|
|
|
} else if ( 'customize' === pagenow ) {
|
|
|
|
|
|
|
|
// Update the theme details UI.
|
|
|
|
$notice = $( '#update-theme' ).closest( '.notice' ).removeClass( 'notice-large' );
|
|
|
|
|
|
|
|
$notice.find( 'h3' ).remove();
|
|
|
|
|
|
|
|
// Add the top-level UI, and update both.
|
|
|
|
$notice = $notice.add( $( '#customize-control-theme-installed_' + args.slug ).find( '.update-message' ) );
|
|
|
|
$notice = $notice.addClass( 'updating-message' ).find( 'p' );
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
} else {
|
|
|
|
$notice = $( '#update-theme' ).closest( '.notice' ).removeClass( 'notice-large' );
|
|
|
|
|
|
|
|
$notice.find( 'h3' ).remove();
|
|
|
|
|
|
|
|
$notice = $notice.add( $( '[data-slug="' + args.slug + '"]' ).find( '.update-message' ) );
|
|
|
|
$notice = $notice.addClass( 'updating-message' ).find( 'p' );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $notice.html() !== wp.updates.l10n.updating ) {
|
|
|
|
$notice.data( 'originaltext', $notice.html() );
|
|
|
|
}
|
|
|
|
|
|
|
|
wp.a11y.speak( wp.updates.l10n.updatingMsg, 'polite' );
|
|
|
|
$notice.text( wp.updates.l10n.updating );
|
|
|
|
|
2016-07-31 14:57:28 -04:00
|
|
|
$document.trigger( 'wp-theme-updating', args );
|
2016-07-05 11:09:28 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
return wp.updates.ajax( 'update-theme', args );
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the UI appropriately after a successful theme update.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @typedef {object} updateThemeSuccess
|
|
|
|
* @param {object} response
|
|
|
|
* @param {string} response.slug Slug of the theme to be updated.
|
|
|
|
* @param {object} response.theme Updated theme.
|
|
|
|
* @param {string} response.oldVersion Old version of the theme.
|
|
|
|
* @param {string} response.newVersion New version of the theme.
|
|
|
|
*/
|
|
|
|
wp.updates.updateThemeSuccess = function( response ) {
|
|
|
|
var isModalOpen = $( 'body.modal-open' ).length,
|
|
|
|
$theme = $( '[data-slug="' + response.slug + '"]' ),
|
|
|
|
updatedMessage = {
|
|
|
|
className: 'updated-message notice-success notice-alt',
|
|
|
|
message: wp.updates.l10n.updated
|
|
|
|
},
|
|
|
|
$notice, newText;
|
|
|
|
|
2016-10-18 23:20:29 -04:00
|
|
|
if ( 'customize' === pagenow ) {
|
|
|
|
$theme = wp.customize.control( 'installed_theme_' + response.slug ).container;
|
|
|
|
}
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
if ( 'themes-network' === pagenow ) {
|
|
|
|
$notice = $theme.find( '.update-message' );
|
|
|
|
|
|
|
|
// Update the version number in the row.
|
|
|
|
newText = $theme.find( '.theme-version-author-uri' ).html().replace( response.oldVersion, response.newVersion );
|
|
|
|
$theme.find( '.theme-version-author-uri' ).html( newText );
|
|
|
|
} else {
|
|
|
|
$notice = $( '.theme-info .notice' ).add( $theme.find( '.update-message' ) );
|
|
|
|
|
|
|
|
// Focus on Customize button after updating.
|
|
|
|
if ( isModalOpen ) {
|
|
|
|
$( '.load-customize:visible' ).focus();
|
|
|
|
} else {
|
|
|
|
$theme.find( '.load-customize' ).focus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
wp.updates.addAdminNotice( _.extend( { selector: $notice }, updatedMessage ) );
|
|
|
|
wp.a11y.speak( wp.updates.l10n.updatedMsg, 'polite' );
|
|
|
|
|
|
|
|
wp.updates.decrementCount( 'theme' );
|
|
|
|
|
|
|
|
$document.trigger( 'wp-theme-update-success', response );
|
|
|
|
|
|
|
|
// Show updated message after modal re-rendered.
|
|
|
|
if ( isModalOpen ) {
|
|
|
|
$( '.theme-info .theme-author' ).after( wp.updates.adminNotice( updatedMessage ) );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the UI appropriately after a failed theme update.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @typedef {object} updateThemeError
|
|
|
|
* @param {object} response Response from the server.
|
|
|
|
* @param {string} response.slug Slug of the theme to be updated.
|
|
|
|
* @param {string} response.errorCode Error code for the error that occurred.
|
|
|
|
* @param {string} response.errorMessage The error that occurred.
|
|
|
|
*/
|
|
|
|
wp.updates.updateThemeError = function( response ) {
|
|
|
|
var $theme = $( '[data-slug="' + response.slug + '"]' ),
|
|
|
|
errorMessage = wp.updates.l10n.updateFailed.replace( '%s', response.errorMessage ),
|
|
|
|
$notice;
|
|
|
|
|
|
|
|
if ( ! wp.updates.isValidResponse( response, 'update' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( wp.updates.maybeHandleCredentialError( response, 'update-theme' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-10-18 23:20:29 -04:00
|
|
|
if ( 'customize' === pagenow ) {
|
|
|
|
$theme = wp.customize.control( 'installed_theme_' + response.slug ).container;
|
|
|
|
}
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
if ( 'themes-network' === pagenow ) {
|
|
|
|
$notice = $theme.find( '.update-message ' );
|
|
|
|
} else {
|
|
|
|
$notice = $( '.theme-info .notice' ).add( $theme.find( '.notice' ) );
|
|
|
|
|
|
|
|
$( 'body.modal-open' ).length ? $( '.load-customize:visible' ).focus() : $theme.find( '.load-customize' ).focus();
|
|
|
|
}
|
|
|
|
|
|
|
|
wp.updates.addAdminNotice( {
|
|
|
|
selector: $notice,
|
|
|
|
className: 'update-message notice-error notice-alt is-dismissible',
|
|
|
|
message: errorMessage
|
|
|
|
} );
|
|
|
|
|
|
|
|
wp.a11y.speak( errorMessage, 'polite' );
|
|
|
|
|
|
|
|
$document.trigger( 'wp-theme-update-error', response );
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sends an Ajax request to the server to install a theme.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @param {object} args
|
|
|
|
* @param {string} args.slug Theme stylesheet.
|
|
|
|
* @param {installThemeSuccess=} args.success Optional. Success callback. Default: wp.updates.installThemeSuccess
|
|
|
|
* @param {installThemeError=} args.error Optional. Error callback. Default: wp.updates.installThemeError
|
|
|
|
* @return {$.promise} A jQuery promise that represents the request,
|
|
|
|
* decorated with an abort() method.
|
|
|
|
*/
|
|
|
|
wp.updates.installTheme = function( args ) {
|
|
|
|
var $message = $( '.theme-install[data-slug="' + args.slug + '"]' );
|
|
|
|
|
|
|
|
args = _.extend( {
|
|
|
|
success: wp.updates.installThemeSuccess,
|
|
|
|
error: wp.updates.installThemeError
|
|
|
|
}, args );
|
|
|
|
|
|
|
|
$message.addClass( 'updating-message' );
|
|
|
|
$message.parents( '.theme' ).addClass( 'focus' );
|
|
|
|
if ( $message.html() !== wp.updates.l10n.installing ) {
|
|
|
|
$message.data( 'originaltext', $message.html() );
|
|
|
|
}
|
|
|
|
|
2016-07-13 13:32:29 -04:00
|
|
|
$message
|
|
|
|
.text( wp.updates.l10n.installing )
|
|
|
|
.attr( 'aria-label', wp.updates.l10n.themeInstallingLabel.replace( '%s', $message.data( 'name' ) ) );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.a11y.speak( wp.updates.l10n.installingMsg, 'polite' );
|
|
|
|
|
|
|
|
// Remove previous error messages, if any.
|
|
|
|
$( '.install-theme-info, [data-slug="' + args.slug + '"]' ).removeClass( 'theme-install-failed' ).find( '.notice.notice-error' ).remove();
|
|
|
|
|
2016-07-31 14:57:28 -04:00
|
|
|
$document.trigger( 'wp-theme-installing', args );
|
2016-08-03 18:24:35 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
return wp.updates.ajax( 'install-theme', args );
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the UI appropriately after a successful theme install.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @typedef {object} installThemeSuccess
|
|
|
|
* @param {object} response Response from the server.
|
|
|
|
* @param {string} response.slug Slug of the theme to be installed.
|
|
|
|
* @param {string} response.customizeUrl URL to the Customizer for the just installed theme.
|
|
|
|
* @param {string} response.activateUrl URL to activate the just installed theme.
|
|
|
|
*/
|
|
|
|
wp.updates.installThemeSuccess = function( response ) {
|
|
|
|
var $card = $( '.wp-full-overlay-header, [data-slug=' + response.slug + ']' ),
|
|
|
|
$message;
|
|
|
|
|
2016-08-08 18:49:28 -04:00
|
|
|
$document.trigger( 'wp-theme-install-success', response );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
|
|
|
|
$message = $card.find( '.button-primary' )
|
|
|
|
.removeClass( 'updating-message' )
|
|
|
|
.addClass( 'updated-message disabled' )
|
2016-07-13 13:32:29 -04:00
|
|
|
.attr( 'aria-label', wp.updates.l10n.themeInstalledLabel.replace( '%s', response.themeName ) )
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
.text( wp.updates.l10n.installed );
|
|
|
|
|
|
|
|
wp.a11y.speak( wp.updates.l10n.installedMsg, 'polite' );
|
|
|
|
|
|
|
|
setTimeout( function() {
|
|
|
|
|
|
|
|
if ( response.activateUrl ) {
|
|
|
|
|
|
|
|
// Transform the 'Install' button into an 'Activate' button.
|
|
|
|
$message
|
|
|
|
.attr( 'href', response.activateUrl )
|
|
|
|
.removeClass( 'theme-install updated-message disabled' )
|
|
|
|
.addClass( 'activate' )
|
2016-07-13 13:32:29 -04:00
|
|
|
.attr( 'aria-label', wp.updates.l10n.activateThemeLabel.replace( '%s', response.themeName ) )
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
.text( wp.updates.l10n.activateTheme );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( response.customizeUrl ) {
|
|
|
|
|
|
|
|
// Transform the 'Preview' button into a 'Live Preview' button.
|
|
|
|
$message.siblings( '.preview' ).replaceWith( function () {
|
|
|
|
return $( '<a>' )
|
|
|
|
.attr( 'href', response.customizeUrl )
|
2016-09-28 15:54:28 -04:00
|
|
|
.addClass( 'button load-customize' )
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
.text( wp.updates.l10n.livePreview );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
}, 1000 );
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the UI appropriately after a failed theme install.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @typedef {object} installThemeError
|
|
|
|
* @param {object} response Response from the server.
|
|
|
|
* @param {string} response.slug Slug of the theme to be installed.
|
|
|
|
* @param {string} response.errorCode Error code for the error that occurred.
|
|
|
|
* @param {string} response.errorMessage The error that occurred.
|
|
|
|
*/
|
|
|
|
wp.updates.installThemeError = function( response ) {
|
|
|
|
var $card, $button,
|
|
|
|
errorMessage = wp.updates.l10n.installFailed.replace( '%s', response.errorMessage ),
|
|
|
|
$message = wp.updates.adminNotice( {
|
|
|
|
className: 'update-message notice-error notice-alt',
|
|
|
|
message: errorMessage
|
|
|
|
} );
|
|
|
|
|
|
|
|
if ( ! wp.updates.isValidResponse( response, 'install' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( wp.updates.maybeHandleCredentialError( response, 'install-theme' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-10-18 23:20:29 -04:00
|
|
|
if ( 'customize' === pagenow ) {
|
|
|
|
if ( $document.find( 'body' ).hasClass( 'modal-open' ) ) {
|
|
|
|
$button = $( '.theme-install[data-slug="' + response.slug + '"]' );
|
|
|
|
$card = $( '.theme-overlay .theme-info' ).prepend( $message );
|
|
|
|
} else {
|
|
|
|
$button = $( '.theme-install[data-slug="' + response.slug + '"]' );
|
|
|
|
$card = $button.closest( '.theme' ).addClass( 'theme-install-failed' ).append( $message );
|
|
|
|
}
|
|
|
|
$( '.wp-full-overlay' ).removeClass( 'customize-loading' );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
} else {
|
2016-10-18 23:20:29 -04:00
|
|
|
if ( $document.find( 'body' ).hasClass( 'full-overlay-active' ) ) {
|
|
|
|
$button = $( '.theme-install[data-slug="' + response.slug + '"]' );
|
|
|
|
$card = $( '.install-theme-info' ).prepend( $message );
|
|
|
|
} else {
|
|
|
|
$card = $( '[data-slug="' + response.slug + '"]' ).removeClass( 'focus' ).addClass( 'theme-install-failed' ).append( $message );
|
|
|
|
$button = $card.find( '.theme-install' );
|
|
|
|
}
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
$button
|
|
|
|
.removeClass( 'updating-message' )
|
2016-07-13 13:32:29 -04:00
|
|
|
.attr( 'aria-label', wp.updates.l10n.themeInstallFailedLabel.replace( '%s', $button.data( 'name' ) ) )
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
.text( wp.updates.l10n.installFailedShort );
|
|
|
|
|
|
|
|
wp.a11y.speak( errorMessage, 'assertive' );
|
|
|
|
|
|
|
|
$document.trigger( 'wp-theme-install-error', response );
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sends an Ajax request to the server to install a theme.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @param {object} args
|
|
|
|
* @param {string} args.slug Theme stylesheet.
|
|
|
|
* @param {deleteThemeSuccess=} args.success Optional. Success callback. Default: wp.updates.deleteThemeSuccess
|
|
|
|
* @param {deleteThemeError=} args.error Optional. Error callback. Default: wp.updates.deleteThemeError
|
|
|
|
* @return {$.promise} A jQuery promise that represents the request,
|
|
|
|
* decorated with an abort() method.
|
|
|
|
*/
|
|
|
|
wp.updates.deleteTheme = function( args ) {
|
2016-08-09 06:39:32 -04:00
|
|
|
var $button;
|
|
|
|
|
|
|
|
if ( 'themes' === pagenow ) {
|
|
|
|
$button = $( '.theme-actions .delete-theme' );
|
|
|
|
} else if ( 'themes-network' === pagenow ) {
|
|
|
|
$button = $( '[data-slug="' + args.slug + '"]' ).find( '.row-actions a.delete' );
|
|
|
|
}
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
|
|
|
|
args = _.extend( {
|
|
|
|
success: wp.updates.deleteThemeSuccess,
|
|
|
|
error: wp.updates.deleteThemeError
|
|
|
|
}, args );
|
|
|
|
|
2016-08-09 06:39:32 -04:00
|
|
|
if ( $button && $button.html() !== wp.updates.l10n.deleting ) {
|
|
|
|
$button
|
|
|
|
.data( 'originaltext', $button.html() )
|
|
|
|
.text( wp.updates.l10n.deleting );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
wp.a11y.speak( wp.updates.l10n.deleting, 'polite' );
|
|
|
|
|
|
|
|
// Remove previous error messages, if any.
|
|
|
|
$( '.theme-info .update-message' ).remove();
|
|
|
|
|
2016-07-31 14:57:28 -04:00
|
|
|
$document.trigger( 'wp-theme-deleting', args );
|
2016-08-03 18:24:35 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
return wp.updates.ajax( 'delete-theme', args );
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the UI appropriately after a successful theme deletion.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @typedef {object} deleteThemeSuccess
|
|
|
|
* @param {object} response Response from the server.
|
|
|
|
* @param {string} response.slug Slug of the theme that was deleted.
|
|
|
|
*/
|
|
|
|
wp.updates.deleteThemeSuccess = function( response ) {
|
|
|
|
var $themeRows = $( '[data-slug="' + response.slug + '"]' );
|
|
|
|
|
|
|
|
if ( 'themes-network' === pagenow ) {
|
|
|
|
|
|
|
|
// Removes the theme and updates rows.
|
|
|
|
$themeRows.css( { backgroundColor: '#faafaa' } ).fadeOut( 350, function() {
|
|
|
|
var $views = $( '.subsubsub' ),
|
|
|
|
$themeRow = $( this ),
|
|
|
|
totals = settings.totals,
|
|
|
|
deletedRow = wp.template( 'item-deleted-row' );
|
|
|
|
|
|
|
|
if ( ! $themeRow.hasClass( 'plugin-update-tr' ) ) {
|
|
|
|
$themeRow.after(
|
|
|
|
deletedRow( {
|
|
|
|
slug: response.slug,
|
|
|
|
colspan: $( '#bulk-action-form' ).find( 'thead th:not(.hidden), thead td' ).length,
|
|
|
|
name: $themeRow.find( '.theme-title strong' ).text()
|
|
|
|
} )
|
|
|
|
);
|
2016-01-08 12:48:28 -05:00
|
|
|
}
|
2015-04-06 23:09:26 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$themeRow.remove();
|
2015-04-06 23:09:26 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
// Remove theme from update count.
|
|
|
|
if ( $themeRow.hasClass( 'update' ) ) {
|
|
|
|
totals.upgrade--;
|
|
|
|
wp.updates.decrementCount( 'theme' );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remove from views.
|
|
|
|
if ( $themeRow.hasClass( 'inactive' ) ) {
|
|
|
|
totals.disabled--;
|
|
|
|
if ( totals.disabled ) {
|
|
|
|
$views.find( '.disabled .count' ).text( '(' + totals.disabled + ')' );
|
|
|
|
} else {
|
|
|
|
$views.find( '.disabled' ).remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// There is always at least one theme available.
|
|
|
|
$views.find( '.all .count' ).text( '(' + --totals.all + ')' );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
wp.a11y.speak( wp.updates.l10n.deleted, 'polite' );
|
|
|
|
|
2016-08-08 18:49:28 -04:00
|
|
|
$document.trigger( 'wp-theme-delete-success', response );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
};
|
2015-02-04 23:19:23 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
/**
|
|
|
|
* Updates the UI appropriately after a failed theme deletion.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @typedef {object} deleteThemeError
|
|
|
|
* @param {object} response Response from the server.
|
|
|
|
* @param {string} response.slug Slug of the theme to be deleted.
|
|
|
|
* @param {string} response.errorCode Error code for the error that occurred.
|
|
|
|
* @param {string} response.errorMessage The error that occurred.
|
|
|
|
*/
|
|
|
|
wp.updates.deleteThemeError = function( response ) {
|
|
|
|
var $themeRow = $( 'tr.inactive[data-slug="' + response.slug + '"]' ),
|
|
|
|
$button = $( '.theme-actions .delete-theme' ),
|
|
|
|
updateRow = wp.template( 'item-update-row' ),
|
|
|
|
$updateRow = $themeRow.siblings( '#' + response.slug + '-update' ),
|
|
|
|
errorMessage = wp.updates.l10n.deleteFailed.replace( '%s', response.errorMessage ),
|
|
|
|
$message = wp.updates.adminNotice( {
|
|
|
|
className: 'update-message notice-error notice-alt',
|
|
|
|
message: errorMessage
|
|
|
|
} );
|
2014-02-26 01:55:14 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
if ( wp.updates.maybeHandleCredentialError( response, 'delete-theme' ) ) {
|
2014-02-26 01:55:14 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
if ( 'themes-network' === pagenow ) {
|
|
|
|
if ( ! $updateRow.length ) {
|
|
|
|
$themeRow.addClass( 'update' ).after(
|
|
|
|
updateRow( {
|
|
|
|
slug: response.slug,
|
|
|
|
colspan: $( '#bulk-action-form' ).find( 'thead th:not(.hidden), thead td' ).length,
|
|
|
|
content: $message
|
|
|
|
} )
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
// Remove previous error messages, if any.
|
|
|
|
$updateRow.find( '.notice-error' ).remove();
|
|
|
|
$updateRow.find( '.plugin-update' ).append( $message );
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$( '.theme-info .theme-description' ).before( $message );
|
|
|
|
}
|
|
|
|
|
|
|
|
$button.html( $button.data( 'originaltext' ) );
|
|
|
|
|
|
|
|
wp.a11y.speak( errorMessage, 'assertive' );
|
|
|
|
|
|
|
|
$document.trigger( 'wp-theme-delete-error', response );
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds the appropriate callback based on the type of action and the current page.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
* @private
|
|
|
|
*
|
|
|
|
* @param {object} data AJAX payload.
|
|
|
|
* @param {string} action The type of request to perform.
|
|
|
|
* @return {object} The AJAX payload with the appropriate callbacks.
|
|
|
|
*/
|
|
|
|
wp.updates._addCallbacks = function( data, action ) {
|
|
|
|
if ( 'import' === pagenow && 'install-plugin' === action ) {
|
|
|
|
data.success = wp.updates.installImporterSuccess;
|
|
|
|
data.error = wp.updates.installImporterError;
|
|
|
|
}
|
|
|
|
|
|
|
|
return data;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pulls available jobs from the queue and runs them.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
* @since 4.6.0 Can handle multiple job types.
|
|
|
|
*/
|
|
|
|
wp.updates.queueChecker = function() {
|
|
|
|
var job;
|
2014-02-26 01:55:14 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
if ( wp.updates.ajaxLocked || ! wp.updates.queue.length ) {
|
2014-02-26 01:55:14 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
job = wp.updates.queue.shift();
|
|
|
|
|
|
|
|
// Handle a queue job.
|
|
|
|
switch ( job.action ) {
|
|
|
|
case 'install-plugin':
|
|
|
|
wp.updates.installPlugin( job.data );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'update-plugin':
|
|
|
|
wp.updates.updatePlugin( job.data );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'delete-plugin':
|
|
|
|
wp.updates.deletePlugin( job.data );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'install-theme':
|
|
|
|
wp.updates.installTheme( job.data );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'update-theme':
|
|
|
|
wp.updates.updateTheme( job.data );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'delete-theme':
|
|
|
|
wp.updates.deleteTheme( job.data );
|
2015-04-06 23:09:26 -04:00
|
|
|
break;
|
2016-01-08 12:48:28 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
default:
|
2015-04-06 23:09:26 -04:00
|
|
|
break;
|
|
|
|
}
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
};
|
2015-04-06 23:09:26 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
/**
|
|
|
|
* Requests the users filesystem credentials if they aren't already known.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*
|
|
|
|
* @param {Event=} event Optional. Event interface.
|
|
|
|
*/
|
|
|
|
wp.updates.requestFilesystemCredentials = function( event ) {
|
|
|
|
if ( false === wp.updates.filesystemCredentials.available ) {
|
|
|
|
/*
|
|
|
|
* After exiting the credentials request modal,
|
|
|
|
* return the focus to the element triggering the request.
|
|
|
|
*/
|
|
|
|
if ( event && ! wp.updates.$elToReturnFocusToFromCredentialsModal ) {
|
|
|
|
wp.updates.$elToReturnFocusToFromCredentialsModal = $( event.target );
|
|
|
|
}
|
|
|
|
|
|
|
|
wp.updates.ajaxLocked = true;
|
|
|
|
wp.updates.requestForCredentialsModalOpen();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Requests the users filesystem credentials if needed and there is no lock.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @param {Event=} event Optional. Event interface.
|
|
|
|
*/
|
|
|
|
wp.updates.maybeRequestFilesystemCredentials = function( event ) {
|
|
|
|
if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) {
|
|
|
|
wp.updates.requestFilesystemCredentials( event );
|
|
|
|
}
|
|
|
|
};
|
2014-02-26 01:55:14 -05:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
/**
|
|
|
|
* Keydown handler for the request for credentials modal.
|
|
|
|
*
|
|
|
|
* Closes the modal when the escape key is pressed and
|
|
|
|
* constrains keyboard navigation to inside the modal.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*
|
|
|
|
* @param {Event} event Event interface.
|
|
|
|
*/
|
|
|
|
wp.updates.keydown = function( event ) {
|
|
|
|
if ( 27 === event.keyCode ) {
|
|
|
|
wp.updates.requestForCredentialsModalCancel();
|
|
|
|
} else if ( 9 === event.keyCode ) {
|
|
|
|
|
|
|
|
// #upgrade button must always be the last focus-able element in the dialog.
|
|
|
|
if ( 'upgrade' === event.target.id && ! event.shiftKey ) {
|
|
|
|
$( '#hostname' ).focus();
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
} else if ( 'hostname' === event.target.id && event.shiftKey ) {
|
|
|
|
$( '#upgrade' ).focus();
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Opens the request for credentials modal.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*/
|
|
|
|
wp.updates.requestForCredentialsModalOpen = function() {
|
|
|
|
var $modal = $( '#request-filesystem-credentials-dialog' );
|
|
|
|
|
|
|
|
$( 'body' ).addClass( 'modal-open' );
|
|
|
|
$modal.show();
|
|
|
|
$modal.find( 'input:enabled:first' ).focus();
|
|
|
|
$modal.on( 'keydown', wp.updates.keydown );
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Closes the request for credentials modal.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*/
|
|
|
|
wp.updates.requestForCredentialsModalClose = function() {
|
|
|
|
$( '#request-filesystem-credentials-dialog' ).hide();
|
|
|
|
$( 'body' ).removeClass( 'modal-open' );
|
|
|
|
|
|
|
|
if ( wp.updates.$elToReturnFocusToFromCredentialsModal ) {
|
|
|
|
wp.updates.$elToReturnFocusToFromCredentialsModal.focus();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Takes care of the steps that need to happen when the modal is canceled out.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
* @since 4.6.0 Triggers an event for callbacks to listen to and add their actions.
|
|
|
|
*/
|
|
|
|
wp.updates.requestForCredentialsModalCancel = function() {
|
|
|
|
|
|
|
|
// Not ajaxLocked and no queue means we already have cleared things up.
|
|
|
|
if ( ! wp.updates.ajaxLocked && ! wp.updates.queue.length ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_.each( wp.updates.queue, function( job ) {
|
|
|
|
$document.trigger( 'credential-modal-cancel', job );
|
|
|
|
} );
|
|
|
|
|
|
|
|
// Remove the lock, and clear the queue.
|
|
|
|
wp.updates.ajaxLocked = false;
|
|
|
|
wp.updates.queue = [];
|
2015-04-05 21:00:26 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.requestForCredentialsModalClose();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Displays an error message in the request for credentials form.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*
|
|
|
|
* @param {string} message Error message.
|
|
|
|
*/
|
|
|
|
wp.updates.showErrorInCredentialsForm = function( message ) {
|
|
|
|
var $modal = $( '#request-filesystem-credentials-form' );
|
|
|
|
|
|
|
|
// Remove any existing error.
|
|
|
|
$modal.find( '.notice' ).remove();
|
|
|
|
$modal.find( '#request-filesystem-credentials-title' ).after( '<div class="notice notice-alt notice-error"><p>' + message + '</p></div>' );
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles credential errors and runs events that need to happen in that case.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*
|
|
|
|
* @param {object} response Ajax response.
|
|
|
|
* @param {string} action The type of request to perform.
|
|
|
|
*/
|
|
|
|
wp.updates.credentialError = function( response, action ) {
|
|
|
|
|
|
|
|
// Restore callbacks.
|
|
|
|
response = wp.updates._addCallbacks( response, action );
|
|
|
|
|
2016-08-08 21:14:28 -04:00
|
|
|
wp.updates.queue.unshift( {
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
action: action,
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Not cool that we're depending on response for this data.
|
|
|
|
* This would feel more whole in a view all tied together.
|
|
|
|
*/
|
|
|
|
data: response
|
|
|
|
} );
|
|
|
|
|
|
|
|
wp.updates.filesystemCredentials.available = false;
|
|
|
|
wp.updates.showErrorInCredentialsForm( response.errorMessage );
|
|
|
|
wp.updates.requestFilesystemCredentials();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles credentials errors if it could not connect to the filesystem.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @typedef {object} maybeHandleCredentialError
|
|
|
|
* @param {object} response Response from the server.
|
|
|
|
* @param {string} response.errorCode Error code for the error that occurred.
|
|
|
|
* @param {string} response.errorMessage The error that occurred.
|
|
|
|
* @param {string} action The type of request to perform.
|
|
|
|
* @returns {boolean} Whether there is an error that needs to be handled or not.
|
|
|
|
*/
|
|
|
|
wp.updates.maybeHandleCredentialError = function( response, action ) {
|
2016-08-04 18:18:30 -04:00
|
|
|
if ( wp.updates.shouldRequestFilesystemCredentials && response.errorCode && 'unable_to_connect_to_filesystem' === response.errorCode ) {
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.credentialError( response, action );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Validates an AJAX response to ensure it's a proper object.
|
|
|
|
*
|
|
|
|
* If the response deems to be invalid, an admin notice is being displayed.
|
|
|
|
*
|
|
|
|
* @param {(object|string)} response Response from the server.
|
|
|
|
* @param {function=} response.always Optional. Callback for when the Deferred is resolved or rejected.
|
|
|
|
* @param {string=} response.statusText Optional. Status message corresponding to the status code.
|
|
|
|
* @param {string=} response.responseText Optional. Request response as text.
|
|
|
|
* @param {string} action Type of action the response is referring to. Can be 'delete',
|
|
|
|
* 'update' or 'install'.
|
|
|
|
*/
|
|
|
|
wp.updates.isValidResponse = function( response, action ) {
|
|
|
|
var error = wp.updates.l10n.unknownError,
|
|
|
|
errorMessage;
|
|
|
|
|
|
|
|
// Make sure the response is a valid data object and not a Promise object.
|
|
|
|
if ( _.isObject( response ) && ! _.isFunction( response.always ) ) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-08-05 15:28:30 -04:00
|
|
|
if ( _.isString( response ) && '-1' === response ) {
|
|
|
|
error = wp.updates.l10n.nonceError;
|
|
|
|
} else if ( _.isString( response ) ) {
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
error = response;
|
2016-08-05 15:28:30 -04:00
|
|
|
} else if ( 'undefined' !== typeof response.readyState && 0 === response.readyState ) {
|
|
|
|
error = wp.updates.l10n.connectionError;
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
} else if ( _.isString( response.responseText ) && '' !== response.responseText ) {
|
|
|
|
error = response.responseText;
|
|
|
|
} else if ( _.isString( response.statusText ) ) {
|
|
|
|
error = response.statusText;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ( action ) {
|
|
|
|
case 'update':
|
|
|
|
errorMessage = wp.updates.l10n.updateFailed;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'install':
|
|
|
|
errorMessage = wp.updates.l10n.installFailed;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'delete':
|
|
|
|
errorMessage = wp.updates.l10n.deleteFailed;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-08-05 15:28:30 -04:00
|
|
|
// Messages are escaped, remove HTML tags to make them more readable.
|
|
|
|
error = error.replace( /<[\/a-z][^<>]*>/gi, '' );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
errorMessage = errorMessage.replace( '%s', error );
|
|
|
|
|
|
|
|
// Add admin notice.
|
|
|
|
wp.updates.addAdminNotice( {
|
|
|
|
id: 'unknown_error',
|
|
|
|
className: 'notice-error is-dismissible',
|
2016-08-10 15:03:31 -04:00
|
|
|
message: _.escape( errorMessage )
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
} );
|
|
|
|
|
|
|
|
// Remove the lock, and clear the queue.
|
|
|
|
wp.updates.ajaxLocked = false;
|
|
|
|
wp.updates.queue = [];
|
|
|
|
|
|
|
|
// Change buttons of all running updates.
|
|
|
|
$( '.button.updating-message' )
|
|
|
|
.removeClass( 'updating-message' )
|
2016-08-04 17:06:38 -04:00
|
|
|
.removeAttr( 'aria-label' )
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
.prop( 'disabled', true )
|
|
|
|
.text( wp.updates.l10n.updateFailedShort );
|
|
|
|
|
|
|
|
$( '.updating-message:not(.button):not(.thickbox)' )
|
|
|
|
.removeClass( 'updating-message notice-warning' )
|
|
|
|
.addClass( 'notice-error' )
|
2016-08-04 17:06:38 -04:00
|
|
|
.find( 'p' )
|
|
|
|
.removeAttr( 'aria-label' )
|
|
|
|
.text( errorMessage );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
|
|
|
|
wp.a11y.speak( errorMessage, 'assertive' );
|
|
|
|
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Potentially adds an AYS to a user attempting to leave the page.
|
|
|
|
*
|
|
|
|
* If an update is on-going and a user attempts to leave the page,
|
|
|
|
* opens an "Are you sure?" alert.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*/
|
|
|
|
wp.updates.beforeunload = function() {
|
|
|
|
if ( wp.updates.ajaxLocked ) {
|
|
|
|
return wp.updates.l10n.beforeunload;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
$( function() {
|
2016-07-20 12:32:31 -04:00
|
|
|
var $pluginFilter = $( '#plugin-filter' ),
|
|
|
|
$bulkActionForm = $( '#bulk-action-form' ),
|
|
|
|
$filesystemModal = $( '#request-filesystem-credentials-dialog' ),
|
|
|
|
$pluginSearch = $( '.plugins-php .wp-filter-search' ),
|
|
|
|
$pluginInstallSearch = $( '.plugin-install-php .wp-filter-search' );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Whether a user needs to submit filesystem credentials.
|
|
|
|
*
|
|
|
|
* This is based on whether the form was output on the page server-side.
|
|
|
|
*
|
|
|
|
* @see {wp_print_request_filesystem_credentials_modal() in PHP}
|
|
|
|
*/
|
|
|
|
wp.updates.shouldRequestFilesystemCredentials = $filesystemModal.length > 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* File system credentials form submit noop-er / handler.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*/
|
|
|
|
$filesystemModal.on( 'submit', 'form', function( event ) {
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
// Persist the credentials input by the user for the duration of the page load.
|
|
|
|
wp.updates.filesystemCredentials.ftp.hostname = $( '#hostname' ).val();
|
|
|
|
wp.updates.filesystemCredentials.ftp.username = $( '#username' ).val();
|
|
|
|
wp.updates.filesystemCredentials.ftp.password = $( '#password' ).val();
|
|
|
|
wp.updates.filesystemCredentials.ftp.connectionType = $( 'input[name="connection_type"]:checked' ).val();
|
|
|
|
wp.updates.filesystemCredentials.ssh.publicKey = $( '#public_key' ).val();
|
|
|
|
wp.updates.filesystemCredentials.ssh.privateKey = $( '#private_key' ).val();
|
|
|
|
wp.updates.filesystemCredentials.available = true;
|
|
|
|
|
|
|
|
// Unlock and invoke the queue.
|
|
|
|
wp.updates.ajaxLocked = false;
|
|
|
|
wp.updates.queueChecker();
|
|
|
|
|
|
|
|
wp.updates.requestForCredentialsModalClose();
|
|
|
|
} );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Closes the request credentials modal when clicking the 'Cancel' button or outside of the modal.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*/
|
|
|
|
$filesystemModal.on( 'click', '[data-js-action="close"], .notification-dialog-background', wp.updates.requestForCredentialsModalCancel );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hide SSH fields when not selected.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*/
|
|
|
|
$filesystemModal.on( 'change', 'input[name="connection_type"]', function() {
|
|
|
|
$( '#ssh-keys' ).toggleClass( 'hidden', ( 'ssh' !== $( this ).val() ) );
|
|
|
|
} ).change();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles events after the credential modal was closed.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @param {Event} event Event interface.
|
|
|
|
* @param {string} job The install/update.delete request.
|
|
|
|
*/
|
|
|
|
$document.on( 'credential-modal-cancel', function( event, job ) {
|
|
|
|
var $updatingMessage = $( '.updating-message' ),
|
|
|
|
$message, originalText;
|
|
|
|
|
|
|
|
if ( 'import' === pagenow ) {
|
|
|
|
$updatingMessage.removeClass( 'updating-message' );
|
|
|
|
} else if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
|
2016-08-09 06:39:32 -04:00
|
|
|
if ( 'update-plugin' === job.action ) {
|
|
|
|
$message = $( 'tr[data-plugin="' + job.data.plugin + '"]' ).find( '.update-message' );
|
|
|
|
} else if ( 'delete-plugin' === job.action ) {
|
|
|
|
$message = $( '[data-plugin="' + job.data.plugin + '"]' ).find( '.row-actions a.delete' );
|
|
|
|
}
|
|
|
|
} else if ( 'themes' === pagenow || 'themes-network' === pagenow ) {
|
|
|
|
if ( 'update-theme' === job.action ) {
|
|
|
|
$message = $( '[data-slug="' + job.data.slug + '"]' ).find( '.update-message' );
|
|
|
|
} else if ( 'delete-theme' === job.action && 'themes-network' === pagenow ) {
|
|
|
|
$message = $( '[data-slug="' + job.data.slug + '"]' ).find( '.row-actions a.delete' );
|
|
|
|
} else if ( 'delete-theme' === job.action && 'themes' === pagenow ) {
|
|
|
|
$message = $( '.theme-actions .delete-theme' );
|
|
|
|
}
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
} else {
|
|
|
|
$message = $updatingMessage;
|
|
|
|
}
|
|
|
|
|
2016-08-08 21:14:28 -04:00
|
|
|
if ( $message && $message.hasClass( 'updating-message' ) ) {
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
originalText = $message.data( 'originaltext' );
|
|
|
|
|
|
|
|
if ( 'undefined' === typeof originalText ) {
|
|
|
|
originalText = $( '<p>' ).html( $message.find( 'p' ).data( 'originaltext' ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
$message
|
|
|
|
.removeClass( 'updating-message' )
|
|
|
|
.html( originalText );
|
2016-08-08 21:14:28 -04:00
|
|
|
|
|
|
|
if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
|
|
|
|
if ( 'update-plugin' === job.action ) {
|
|
|
|
$message.attr( 'aria-label', wp.updates.l10n.updateNowLabel.replace( '%s', $message.data( 'name' ) ) );
|
|
|
|
} else if ( 'install-plugin' === job.action ) {
|
|
|
|
$message.attr( 'aria-label', wp.updates.l10n.installNowLabel.replace( '%s', $message.data( 'name' ) ) );
|
|
|
|
}
|
|
|
|
}
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
wp.a11y.speak( wp.updates.l10n.updateCancel, 'polite' );
|
|
|
|
} );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Click handler for plugin updates in List Table view.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*
|
|
|
|
* @param {Event} event Event interface.
|
|
|
|
*/
|
|
|
|
$bulkActionForm.on( 'click', '[data-plugin] .update-link', function( event ) {
|
|
|
|
var $message = $( event.target ),
|
|
|
|
$pluginRow = $message.parents( 'tr' );
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
if ( $message.hasClass( 'updating-message' ) || $message.hasClass( 'button-disabled' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wp.updates.maybeRequestFilesystemCredentials( event );
|
|
|
|
|
|
|
|
// Return the user to the input box of the plugin's table row after closing the modal.
|
|
|
|
wp.updates.$elToReturnFocusToFromCredentialsModal = $pluginRow.find( '.check-column input' );
|
|
|
|
wp.updates.updatePlugin( {
|
|
|
|
plugin: $pluginRow.data( 'plugin' ),
|
|
|
|
slug: $pluginRow.data( 'slug' )
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Click handler for plugin updates in plugin install view.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*
|
|
|
|
* @param {Event} event Event interface.
|
|
|
|
*/
|
|
|
|
$pluginFilter.on( 'click', '.update-now', function( event ) {
|
|
|
|
var $button = $( event.target );
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
if ( $button.hasClass( 'updating-message' ) || $button.hasClass( 'button-disabled' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wp.updates.maybeRequestFilesystemCredentials( event );
|
|
|
|
|
|
|
|
wp.updates.updatePlugin( {
|
|
|
|
plugin: $button.data( 'plugin' ),
|
|
|
|
slug: $button.data( 'slug' )
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Click handler for plugin installs in plugin install view.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @param {Event} event Event interface.
|
|
|
|
*/
|
|
|
|
$pluginFilter.on( 'click', '.install-now', function( event ) {
|
|
|
|
var $button = $( event.target );
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
if ( $button.hasClass( 'updating-message' ) || $button.hasClass( 'button-disabled' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) {
|
|
|
|
wp.updates.requestFilesystemCredentials( event );
|
|
|
|
|
|
|
|
$document.on( 'credential-modal-cancel', function() {
|
|
|
|
var $message = $( '.install-now.updating-message' );
|
|
|
|
|
|
|
|
$message
|
|
|
|
.removeClass( 'updating-message' )
|
|
|
|
.text( wp.updates.l10n.installNow );
|
|
|
|
|
|
|
|
wp.a11y.speak( wp.updates.l10n.updateCancel, 'polite' );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
wp.updates.installPlugin( {
|
|
|
|
slug: $button.data( 'slug' )
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
|
2016-07-17 11:32:30 -04:00
|
|
|
/**
|
|
|
|
* Click handler for importer plugins installs in the Import screen.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @param {Event} event Event interface.
|
|
|
|
*/
|
|
|
|
$document.on( 'click', '.importer-item .install-now', function( event ) {
|
|
|
|
var $button = $( event.target ),
|
|
|
|
pluginName = $( this ).data( 'name' );
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
if ( $button.hasClass( 'updating-message' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) {
|
|
|
|
wp.updates.requestFilesystemCredentials( event );
|
|
|
|
|
|
|
|
$document.on( 'credential-modal-cancel', function() {
|
|
|
|
|
|
|
|
$button
|
|
|
|
.removeClass( 'updating-message' )
|
|
|
|
.text( wp.updates.l10n.installNow )
|
|
|
|
.attr( 'aria-label', wp.updates.l10n.installNowLabel.replace( '%s', pluginName ) );
|
|
|
|
|
|
|
|
wp.a11y.speak( wp.updates.l10n.updateCancel, 'polite' );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
wp.updates.installPlugin( {
|
|
|
|
slug: $button.data( 'slug' ),
|
2016-10-03 02:42:29 -04:00
|
|
|
pagenow: pagenow,
|
2016-07-17 11:32:30 -04:00
|
|
|
success: wp.updates.installImporterSuccess,
|
|
|
|
error: wp.updates.installImporterError
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
/**
|
|
|
|
* Click handler for plugin deletions.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @param {Event} event Event interface.
|
|
|
|
*/
|
|
|
|
$bulkActionForm.on( 'click', '[data-plugin] a.delete', function( event ) {
|
|
|
|
var $pluginRow = $( event.target ).parents( 'tr' );
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
if ( ! window.confirm( wp.updates.l10n.aysDeleteUninstall.replace( '%s', $pluginRow.find( '.plugin-title strong' ).text() ) ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wp.updates.maybeRequestFilesystemCredentials( event );
|
|
|
|
|
|
|
|
wp.updates.deletePlugin( {
|
|
|
|
plugin: $pluginRow.data( 'plugin' ),
|
|
|
|
slug: $pluginRow.data( 'slug' )
|
|
|
|
} );
|
|
|
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Click handler for theme updates.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @param {Event} event Event interface.
|
|
|
|
*/
|
|
|
|
$document.on( 'click', '.themes-php.network-admin .update-link', function( event ) {
|
|
|
|
var $message = $( event.target ),
|
|
|
|
$themeRow = $message.parents( 'tr' );
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
if ( $message.hasClass( 'updating-message' ) || $message.hasClass( 'button-disabled' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wp.updates.maybeRequestFilesystemCredentials( event );
|
|
|
|
|
|
|
|
// Return the user to the input box of the theme's table row after closing the modal.
|
|
|
|
wp.updates.$elToReturnFocusToFromCredentialsModal = $themeRow.find( '.check-column input' );
|
|
|
|
wp.updates.updateTheme( {
|
|
|
|
slug: $themeRow.data( 'slug' )
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Click handler for theme deletions.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @param {Event} event Event interface.
|
|
|
|
*/
|
|
|
|
$document.on( 'click', '.themes-php.network-admin a.delete', function( event ) {
|
|
|
|
var $themeRow = $( event.target ).parents( 'tr' );
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
if ( ! window.confirm( wp.updates.l10n.aysDelete.replace( '%s', $themeRow.find( '.theme-title strong' ).text() ) ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wp.updates.maybeRequestFilesystemCredentials( event );
|
|
|
|
|
|
|
|
wp.updates.deleteTheme( {
|
|
|
|
slug: $themeRow.data( 'slug' )
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Bulk action handler for plugins and themes.
|
|
|
|
*
|
|
|
|
* Handles both deletions and updates.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @param {Event} event Event interface.
|
|
|
|
*/
|
|
|
|
$bulkActionForm.on( 'click', '[type="submit"]', function( event ) {
|
|
|
|
var bulkAction = $( event.target ).siblings( 'select' ).val(),
|
|
|
|
itemsSelected = $bulkActionForm.find( 'input[name="checked[]"]:checked' ),
|
|
|
|
success = 0,
|
|
|
|
error = 0,
|
|
|
|
errorMessages = [],
|
|
|
|
type, action;
|
|
|
|
|
|
|
|
// Determine which type of item we're dealing with.
|
|
|
|
switch ( pagenow ) {
|
|
|
|
case 'plugins':
|
|
|
|
case 'plugins-network':
|
|
|
|
type = 'plugin';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'themes-network':
|
|
|
|
type = 'theme';
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bail if there were no items selected.
|
|
|
|
if ( ! itemsSelected.length ) {
|
|
|
|
event.preventDefault();
|
|
|
|
$( 'html, body' ).animate( { scrollTop: 0 } );
|
|
|
|
|
|
|
|
return wp.updates.addAdminNotice( {
|
|
|
|
id: 'no-items-selected',
|
|
|
|
className: 'notice-error is-dismissible',
|
|
|
|
message: wp.updates.l10n.noItemsSelected
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Determine the type of request we're dealing with.
|
|
|
|
switch ( bulkAction ) {
|
|
|
|
case 'update-selected':
|
|
|
|
action = bulkAction.replace( 'selected', type );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'delete-selected':
|
|
|
|
if ( ! window.confirm( 'plugin' === type ? wp.updates.l10n.aysBulkDelete : wp.updates.l10n.aysBulkDeleteThemes ) ) {
|
|
|
|
event.preventDefault();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
action = bulkAction.replace( 'selected', type );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wp.updates.maybeRequestFilesystemCredentials( event );
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
// Un-check the bulk checkboxes.
|
|
|
|
$bulkActionForm.find( '.manage-column [type="checkbox"]' ).prop( 'checked', false );
|
|
|
|
|
2016-07-31 14:57:28 -04:00
|
|
|
$document.trigger( 'wp-' + type + '-bulk-' + bulkAction, itemsSelected );
|
2016-08-03 18:24:35 -04:00
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
// Find all the checkboxes which have been checked.
|
|
|
|
itemsSelected.each( function( index, element ) {
|
2016-08-08 21:14:28 -04:00
|
|
|
var $checkbox = $( element ),
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$itemRow = $checkbox.parents( 'tr' );
|
|
|
|
|
|
|
|
// Only add update-able items to the update queue.
|
|
|
|
if ( 'update-selected' === bulkAction && ( ! $itemRow.hasClass( 'update' ) || $itemRow.find( 'notice-error' ).length ) ) {
|
2016-08-08 21:14:28 -04:00
|
|
|
|
|
|
|
// Un-check the box.
|
|
|
|
$checkbox.prop( 'checked', false );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add it to the queue.
|
|
|
|
wp.updates.queue.push( {
|
|
|
|
action: action,
|
|
|
|
data: {
|
|
|
|
plugin: $itemRow.data( 'plugin' ),
|
|
|
|
slug: $itemRow.data( 'slug' )
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
|
|
|
|
// Display bulk notification for updates of any kind.
|
|
|
|
$document.on( 'wp-plugin-update-success wp-plugin-update-error wp-theme-update-success wp-theme-update-error', function( event, response ) {
|
2016-08-08 21:14:28 -04:00
|
|
|
var $itemRow = $( '[data-slug="' + response.slug + '"]' ),
|
|
|
|
$bulkActionNotice, itemName;
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
|
|
|
|
if ( 'wp-' + response.update + '-update-success' === event.type ) {
|
|
|
|
success++;
|
|
|
|
} else {
|
2016-08-08 21:14:28 -04:00
|
|
|
itemName = response.pluginName ? response.pluginName : $itemRow.find( '.column-primary strong' ).text();
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
|
|
|
|
error++;
|
|
|
|
errorMessages.push( itemName + ': ' + response.errorMessage );
|
|
|
|
}
|
|
|
|
|
2016-08-08 21:14:28 -04:00
|
|
|
$itemRow.find( 'input[name="checked[]"]:checked' ).prop( 'checked', false );
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.adminNotice = wp.template( 'wp-bulk-updates-admin-notice' );
|
|
|
|
|
|
|
|
wp.updates.addAdminNotice( {
|
|
|
|
id: 'bulk-action-notice',
|
2016-08-03 18:24:35 -04:00
|
|
|
className: 'bulk-action-notice',
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
successes: success,
|
|
|
|
errors: error,
|
|
|
|
errorMessages: errorMessages,
|
|
|
|
type: response.update
|
|
|
|
} );
|
|
|
|
|
|
|
|
$bulkActionNotice = $( '#bulk-action-notice' ).on( 'click', 'button', function() {
|
2016-08-03 18:24:35 -04:00
|
|
|
// $( this ) is the clicked button, no need to get it again.
|
|
|
|
$( this )
|
|
|
|
.toggleClass( 'bulk-action-errors-collapsed' )
|
|
|
|
.attr( 'aria-expanded', ! $( this ).hasClass( 'bulk-action-errors-collapsed' ) );
|
|
|
|
// Show the errors list.
|
|
|
|
$bulkActionNotice.find( '.bulk-action-errors' ).toggleClass( 'hidden' );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
} );
|
|
|
|
|
|
|
|
if ( error > 0 && ! wp.updates.queue.length ) {
|
|
|
|
$( 'html, body' ).animate( { scrollTop: 0 } );
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
|
|
|
// Reset admin notice template after #bulk-action-notice was added.
|
|
|
|
$document.on( 'wp-updates-notice-added', function() {
|
|
|
|
wp.updates.adminNotice = wp.template( 'wp-updates-admin-notice' );
|
|
|
|
} );
|
|
|
|
|
|
|
|
// Check the queue, now that the event handlers have been added.
|
|
|
|
wp.updates.queueChecker();
|
|
|
|
} );
|
|
|
|
|
2016-07-20 12:32:31 -04:00
|
|
|
if ( $pluginInstallSearch.length ) {
|
|
|
|
$pluginInstallSearch.attr( 'aria-describedby', 'live-search-desc' );
|
|
|
|
}
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
/**
|
|
|
|
* Handles changes to the plugin search box on the new-plugin page,
|
|
|
|
* searching the repository dynamically.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*/
|
2016-07-20 12:32:31 -04:00
|
|
|
$pluginInstallSearch.on( 'keyup input', _.debounce( function( event, eventtype ) {
|
|
|
|
var $searchTab = $( '.plugin-install-search' ), data, searchLocation;
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
|
2016-07-20 12:32:31 -04:00
|
|
|
data = {
|
|
|
|
_ajax_nonce: wp.updates.ajaxNonce,
|
|
|
|
s: event.target.value,
|
|
|
|
tab: 'search',
|
|
|
|
type: $( '#typeselector' ).val(),
|
|
|
|
pagenow: pagenow
|
|
|
|
};
|
|
|
|
searchLocation = location.href.split( '?' )[ 0 ] + '?' + $.param( _.omit( data, [ '_ajax_nonce', 'pagenow' ] ) );
|
|
|
|
|
|
|
|
// Clear on escape.
|
|
|
|
if ( 'keyup' === event.type && 27 === event.which ) {
|
|
|
|
event.target.value = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( wp.updates.searchTerm === data.s && 'typechange' !== eventtype ) {
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
return;
|
|
|
|
} else {
|
2016-07-20 12:32:31 -04:00
|
|
|
$pluginFilter.empty();
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
wp.updates.searchTerm = data.s;
|
|
|
|
}
|
|
|
|
|
2016-07-26 16:01:28 -04:00
|
|
|
if ( window.history && window.history.replaceState ) {
|
|
|
|
window.history.replaceState( null, '', searchLocation );
|
2016-07-20 12:32:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! $searchTab.length ) {
|
|
|
|
$searchTab = $( '<li class="plugin-install-search" />' )
|
|
|
|
.append( $( '<a />', {
|
|
|
|
'class': 'current',
|
|
|
|
'href': searchLocation,
|
|
|
|
'text': wp.updates.l10n.searchResultsLabel
|
|
|
|
} ) );
|
|
|
|
|
|
|
|
$( '.wp-filter .filter-links .current' )
|
|
|
|
.removeClass( 'current' )
|
|
|
|
.parents( '.filter-links' )
|
|
|
|
.prepend( $searchTab );
|
|
|
|
|
|
|
|
$pluginFilter.prev( 'p' ).remove();
|
|
|
|
$( '.plugins-popular-tags-wrapper' ).remove();
|
2016-07-11 17:50:31 -04:00
|
|
|
}
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
|
|
|
|
if ( 'undefined' !== typeof wp.updates.searchRequest ) {
|
|
|
|
wp.updates.searchRequest.abort();
|
|
|
|
}
|
|
|
|
$( 'body' ).addClass( 'loading-content' );
|
|
|
|
|
|
|
|
wp.updates.searchRequest = wp.ajax.post( 'search-install-plugins', data ).done( function( response ) {
|
|
|
|
$( 'body' ).removeClass( 'loading-content' );
|
2016-07-20 12:32:31 -04:00
|
|
|
$pluginFilter.append( response.items );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
delete wp.updates.searchRequest;
|
2016-07-20 12:32:31 -04:00
|
|
|
|
|
|
|
if ( 0 === response.count ) {
|
|
|
|
wp.a11y.speak( wp.updates.l10n.noPluginsFound );
|
|
|
|
} else {
|
|
|
|
wp.a11y.speak( wp.updates.l10n.pluginsFound.replace( '%d', response.count ) );
|
|
|
|
}
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
} );
|
|
|
|
}, 500 ) );
|
|
|
|
|
2016-07-20 12:32:31 -04:00
|
|
|
if ( $pluginSearch.length ) {
|
2016-07-11 17:50:31 -04:00
|
|
|
$pluginSearch.attr( 'aria-describedby', 'live-search-desc' );
|
|
|
|
}
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
/**
|
|
|
|
* Handles changes to the plugin search box on the Installed Plugins screen,
|
|
|
|
* searching the plugin list dynamically.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*/
|
2016-07-11 17:50:31 -04:00
|
|
|
$pluginSearch.on( 'keyup input', _.debounce( function( event ) {
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
var data = {
|
|
|
|
_ajax_nonce: wp.updates.ajaxNonce,
|
2016-07-18 10:00:34 -04:00
|
|
|
s: event.target.value,
|
|
|
|
pagenow: pagenow
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
};
|
|
|
|
|
2016-07-11 17:50:31 -04:00
|
|
|
// Clear on escape.
|
|
|
|
if ( 'keyup' === event.type && 27 === event.which ) {
|
|
|
|
event.target.value = '';
|
|
|
|
}
|
|
|
|
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
if ( wp.updates.searchTerm === data.s ) {
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
wp.updates.searchTerm = data.s;
|
|
|
|
}
|
|
|
|
|
2016-07-26 16:01:28 -04:00
|
|
|
if ( window.history && window.history.replaceState ) {
|
|
|
|
window.history.replaceState( null, '', location.href.split( '?' )[ 0 ] + '?s=' + data.s );
|
2016-07-11 17:50:31 -04:00
|
|
|
}
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
|
|
|
|
if ( 'undefined' !== typeof wp.updates.searchRequest ) {
|
|
|
|
wp.updates.searchRequest.abort();
|
|
|
|
}
|
|
|
|
|
|
|
|
$bulkActionForm.empty();
|
|
|
|
$( 'body' ).addClass( 'loading-content' );
|
|
|
|
|
|
|
|
wp.updates.searchRequest = wp.ajax.post( 'search-plugins', data ).done( function( response ) {
|
|
|
|
|
|
|
|
// Can we just ditch this whole subtitle business?
|
2016-07-18 10:00:34 -04:00
|
|
|
var $subTitle = $( '<span />' ).addClass( 'subtitle' ).html( wp.updates.l10n.searchResults.replace( '%s', _.escape( data.s ) ) ),
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
$oldSubTitle = $( '.wrap .subtitle' );
|
|
|
|
|
|
|
|
if ( ! data.s.length ) {
|
|
|
|
$oldSubTitle.remove();
|
|
|
|
} else if ( $oldSubTitle.length ) {
|
|
|
|
$oldSubTitle.replaceWith( $subTitle );
|
|
|
|
} else {
|
|
|
|
$( '.wrap h1' ).append( $subTitle );
|
|
|
|
}
|
|
|
|
|
|
|
|
$( 'body' ).removeClass( 'loading-content' );
|
|
|
|
$bulkActionForm.append( response.items );
|
|
|
|
delete wp.updates.searchRequest;
|
2016-07-11 17:50:31 -04:00
|
|
|
|
|
|
|
if ( 0 === response.count ) {
|
|
|
|
wp.a11y.speak( wp.updates.l10n.noPluginsFound );
|
|
|
|
} else {
|
|
|
|
wp.a11y.speak( wp.updates.l10n.pluginsFound.replace( '%d', response.count ) );
|
|
|
|
}
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
} );
|
|
|
|
}, 500 ) );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Trigger a search event when the search form gets submitted.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*/
|
|
|
|
$document.on( 'submit', '.search-plugins', function( event ) {
|
|
|
|
event.preventDefault();
|
|
|
|
|
2016-07-20 12:32:31 -04:00
|
|
|
$( 'input.wp-filter-search' ).trigger( 'input' );
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
} );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Trigger a search event when the search type gets changed.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*/
|
|
|
|
$( '#typeselector' ).on( 'change', function() {
|
2016-07-20 12:32:31 -04:00
|
|
|
var $search = $( 'input[name="s"]' );
|
|
|
|
|
|
|
|
if ( $search.val().length ) {
|
|
|
|
$search.trigger( 'input', 'typechange' );
|
|
|
|
}
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
} );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Click handler for updating a plugin from the details modal on `plugin-install.php`.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*
|
|
|
|
* @param {Event} event Event interface.
|
|
|
|
*/
|
|
|
|
$( '#plugin_update_from_iframe' ).on( 'click', function( event ) {
|
|
|
|
var target = window.parent === window ? null : window.parent,
|
|
|
|
update;
|
|
|
|
|
|
|
|
$.support.postMessage = !! window.postMessage;
|
|
|
|
|
2016-07-05 11:32:28 -04:00
|
|
|
if ( false === $.support.postMessage || null === target || -1 !== window.parent.location.pathname.indexOf( 'update-core.php' ) ) {
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
update = {
|
|
|
|
action: 'update-plugin',
|
|
|
|
data: {
|
|
|
|
plugin: $( this ).data( 'plugin' ),
|
|
|
|
slug: $( this ).data( 'slug' )
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
target.postMessage( JSON.stringify( update ), window.location.origin );
|
|
|
|
} );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Click handler for installing a plugin from the details modal on `plugin-install.php`.
|
|
|
|
*
|
|
|
|
* @since 4.6.0
|
|
|
|
*
|
|
|
|
* @param {Event} event Event interface.
|
|
|
|
*/
|
|
|
|
$( '#plugin_install_from_iframe' ).on( 'click', function( event ) {
|
|
|
|
var target = window.parent === window ? null : window.parent,
|
|
|
|
install;
|
|
|
|
|
|
|
|
$.support.postMessage = !! window.postMessage;
|
|
|
|
|
2016-07-05 11:37:28 -04:00
|
|
|
if ( false === $.support.postMessage || null === target || -1 !== window.parent.location.pathname.indexOf( 'index.php' ) ) {
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
install = {
|
|
|
|
action: 'install-plugin',
|
|
|
|
data: {
|
|
|
|
slug: $( this ).data( 'slug' )
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
target.postMessage( JSON.stringify( install ), window.location.origin );
|
|
|
|
} );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles postMessage events.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
* @since 4.6.0 Switched `update-plugin` action to use the queue.
|
|
|
|
*
|
|
|
|
* @param {Event} event Event interface.
|
|
|
|
*/
|
|
|
|
$( window ).on( 'message', function( event ) {
|
|
|
|
var originalEvent = event.originalEvent,
|
|
|
|
expectedOrigin = document.location.protocol + '//' + document.location.hostname,
|
|
|
|
message;
|
|
|
|
|
|
|
|
if ( originalEvent.origin !== expectedOrigin ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-07-05 12:16:28 -04:00
|
|
|
try {
|
|
|
|
message = $.parseJSON( originalEvent.data );
|
|
|
|
} catch ( e ) {
|
|
|
|
return;
|
|
|
|
}
|
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
|
|
|
|
|
|
|
if ( 'undefined' === typeof message.action ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ( message.action ) {
|
|
|
|
|
|
|
|
// Called from `wp-admin/includes/class-wp-upgrader-skins.php`.
|
|
|
|
case 'decrementUpdateCount':
|
|
|
|
/** @property {string} message.upgradeType */
|
|
|
|
wp.updates.decrementCount( message.upgradeType );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'install-plugin':
|
|
|
|
case 'update-plugin':
|
|
|
|
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
|
|
|
window.tb_remove();
|
|
|
|
/* jscs:enable */
|
|
|
|
|
|
|
|
message.data = wp.updates._addCallbacks( message.data, message.action );
|
|
|
|
|
|
|
|
wp.updates.queue.push( message );
|
|
|
|
wp.updates.queueChecker();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a callback to display a warning before leaving the page.
|
|
|
|
*
|
|
|
|
* @since 4.2.0
|
|
|
|
*/
|
|
|
|
$( window ).on( 'beforeunload', wp.updates.beforeunload );
|
|
|
|
} );
|
|
|
|
})( jQuery, window.wp, _.extend( window._wpUpdatesSettings, window._wpUpdatesItemCounts || {} ) );
|