diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 5e04365f2f..9751bc5bef 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -3344,6 +3344,8 @@ function wp_ajax_install_theme() { wp_send_json_error( $status ); } + $status['themeName'] = wp_get_theme( $slug )->get( 'Name' ); + if ( current_user_can( 'switch_themes' ) ) { if ( is_multisite() ) { $status['activateUrl'] = add_query_arg( array( diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index d758480f39..6f25348280 100644 --- a/wp-admin/includes/theme.php +++ b/wp-admin/includes/theme.php @@ -635,7 +635,11 @@ function customize_themes_print_templates() { <# if ( ! data.active ) { #>
<# } #> diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php index 88452190d0..eff6f7647c 100644 --- a/wp-admin/includes/update.php +++ b/wp-admin/includes/update.php @@ -690,7 +690,7 @@ function wp_print_admin_notice_templates() { * @type string colspan The number of table columns this row spans. * @type string content The row content. * } - * + * * The delete template takes one argument with four values: * * param {object} data { @@ -716,13 +716,23 @@ function wp_print_update_row_templates() { diff --git a/wp-admin/js/updates.js b/wp-admin/js/updates.js index 0de60b5a1c..24a8186a24 100644 --- a/wp-admin/js/updates.js +++ b/wp-admin/js/updates.js @@ -508,7 +508,9 @@ $message.text( wp.updates.l10n.installing ); } - $message.addClass( 'updating-message' ); + $message + .addClass( 'updating-message' ) + .attr( 'aria-label', wp.updates.l10n.pluginInstallingLabel.replace( '%s', $message.data( 'name' ) ) ); wp.a11y.speak( wp.updates.l10n.installingMsg, 'polite' ); @@ -535,6 +537,7 @@ $message .removeClass( 'updating-message' ) .addClass( 'updated-message installed button-disabled' ) + .attr( 'aria-label', wp.updates.l10n.pluginInstalledLabel.replace( '%s', response.pluginName ) ) .text( wp.updates.l10n.installed ); wp.a11y.speak( wp.updates.l10n.installedMsg, 'polite' ); @@ -547,6 +550,7 @@ // 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 ) + .attr( 'aria-label', wp.updates.l10n.activatePluginLabel.replace( '%s', response.pluginName ) ) .text( wp.updates.l10n.activatePlugin ); }, 1000 ); } @@ -595,7 +599,7 @@ $button .removeClass( 'updating-message' ).addClass( 'button-disabled' ) - .attr( 'aria-label', wp.updates.l10n.installFailedLabel.replace( '%s', response.pluginName ) ) + .attr( 'aria-label', wp.updates.l10n.pluginInstallFailedLabel.replace( '%s', $button.data( 'name' ) ) ) .text( wp.updates.l10n.installFailedShort ); wp.a11y.speak( errorMessage, 'assertive' ); @@ -1003,7 +1007,9 @@ $message.data( 'originaltext', $message.html() ); } - $message.text( wp.updates.l10n.installing ); + $message + .text( wp.updates.l10n.installing ) + .attr( 'aria-label', wp.updates.l10n.themeInstallingLabel.replace( '%s', $message.data( 'name' ) ) ); wp.a11y.speak( wp.updates.l10n.installingMsg, 'polite' ); // Remove previous error messages, if any. @@ -1032,6 +1038,7 @@ $message = $card.find( '.button-primary' ) .removeClass( 'updating-message' ) .addClass( 'updated-message disabled' ) + .attr( 'aria-label', wp.updates.l10n.themeInstalledLabel.replace( '%s', response.themeName ) ) .text( wp.updates.l10n.installed ); wp.a11y.speak( wp.updates.l10n.installedMsg, 'polite' ); @@ -1045,6 +1052,7 @@ .attr( 'href', response.activateUrl ) .removeClass( 'theme-install updated-message disabled' ) .addClass( 'activate' ) + .attr( 'aria-label', wp.updates.l10n.activateThemeLabel.replace( '%s', response.themeName ) ) .text( wp.updates.l10n.activateTheme ); } @@ -1098,7 +1106,7 @@ $button .removeClass( 'updating-message' ) - .attr( 'aria-label', wp.updates.l10n.installFailedLabel.replace( '%s', $card.find( '.theme-name' ).text() ) ) + .attr( 'aria-label', wp.updates.l10n.themeInstallFailedLabel.replace( '%s', $button.data( 'name' ) ) ) .text( wp.updates.l10n.installFailedShort ); wp.a11y.speak( errorMessage, 'assertive' ); diff --git a/wp-admin/js/updates.min.js b/wp-admin/js/updates.min.js index 679b0d1745..6d83bfd23c 100644 --- a/wp-admin/js/updates.min.js +++ b/wp-admin/js/updates.min.js @@ -1 +1 @@ -!function(a,b,c){var d=a(document);b=b||{},b.updates={},b.updates.ajaxNonce=c.ajax_nonce,b.updates.l10n=c.l10n,b.updates.searchTerm="",b.updates.shouldRequestFilesystemCredentials=!1,b.updates.filesystemCredentials={ftp:{host:"",username:"",password:"",connectionType:""},ssh:{publicKey:"",privateKey:""},available:!1},b.updates.ajaxLocked=!1,b.updates.adminNotice=b.template("wp-updates-admin-notice"),b.updates.queue=[],b.updates.$elToReturnFocusToFromCredentialsModal=void 0,b.updates.addAdminNotice=function(c){var e,f=a(c.selector);delete c.selector,e=b.updates.adminNotice(c),f.length||(f=a("#"+c.id)),f.length?f.replaceWith(e):a(".wrap").find("> h1").after(e),d.trigger("wp-updates-notice-added")},b.updates.ajax=function(c,d){var e={};return b.updates.ajaxLocked?(b.updates.queue.push({action:c,data:d}),a.Deferred()):(b.updates.ajaxLocked=!0,d.success&&(e.success=d.success,delete d.success),d.error&&(e.error=d.error,delete d.error),e.data=_.extend(d,{action:c,_ajax_nonce:b.updates.ajaxNonce,username:b.updates.filesystemCredentials.ftp.username,password:b.updates.filesystemCredentials.ftp.password,hostname:b.updates.filesystemCredentials.ftp.hostname,connection_type:b.updates.filesystemCredentials.ftp.connectionType,public_key:b.updates.filesystemCredentials.ssh.publicKey,private_key:b.updates.filesystemCredentials.ssh.privateKey}),b.ajax.send(e).always(b.updates.ajaxAlways))},b.updates.ajaxAlways=function(c){c.errorCode||"unable_to_connect_to_filesystem"===c.errorCode||(b.updates.ajaxLocked=!1,b.updates.queueChecker()),"undefined"!=typeof c.debug&&_.map(c.debug,function(b){window.console.log(a("").html(b).text())})},b.updates.decrementCount=function(b){var c,d,e,f=a("#wp-admin-bar-updates"),g=a('a[href="update-core.php"] .update-plugins'),h=f.find(".ab-label").text();h=parseInt(h,10)-1,0>h||isNaN(h)||(f.find(".ab-item").removeAttr("title"),f.find(".ab-label").text(h),h||f.find(".ab-label").parents("li").remove(),g.each(function(a,b){b.className=b.className.replace(/count-\d+/,"count-"+h)}),g.removeAttr("title"),g.find(".update-count").text(h),"plugin"===b?(c=a("#menu-plugins"),d=c.find(".plugin-count")):"theme"===b&&(c=a("#menu-appearance"),d=c.find(".theme-count")),d&&(e=d.eq(0).text(),e=parseInt(e,10)-1),0>e||isNaN(e)||(e>0?(a(".subsubsub .upgrade .count").text("("+e+")"),d.text(e),c.find(".update-plugins").each(function(a,b){b.className=b.className.replace(/count-\d+/,"count-"+e)})):(a(".subsubsub .upgrade").remove(),c.find(".update-plugins").remove())))},b.updates.updatePlugin=function(c){var e,f,g,h;return c=_.extend({success:b.updates.updatePluginSuccess,error:b.updates.updatePluginError},c),"plugins"===pagenow||"plugins-network"===pagenow?(e=a('tr[data-plugin="'+c.plugin+'"]'),g=e.find(".update-message").addClass("updating-message").find("p"),h=b.updates.l10n.updatingLabel.replace("%s",e.find(".plugin-title strong").text())):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||(f=a(".plugin-card-"+c.slug),g=f.find(".update-now").addClass("updating-message"),h=b.updates.l10n.updatingLabel.replace("%s",g.data("name")),f.removeClass("plugin-card-update-failed").find(".notice.notice-error").remove()),g.html()!==b.updates.l10n.updating&&g.data("originaltext",g.html()),g.attr("aria-label",h).text(b.updates.l10n.updating),d.trigger("wp-plugin-updating"),b.updates.ajax("update-plugin",c)},b.updates.updatePluginSuccess=function(c){var e,f,g;"plugins"===pagenow||"plugins-network"===pagenow?(e=a('tr[data-plugin="'+c.plugin+'"]').removeClass("update").addClass("updated"),f=e.find(".update-message").removeClass("updating-message notice-warning").addClass("updated-message notice-success").find("p"),g=e.find(".plugin-version-author-uri").html().replace(c.oldVersion,c.newVersion),e.find(".plugin-version-author-uri").html(g)):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||(f=a(".plugin-card-"+c.slug).find(".update-now").removeClass("updating-message").addClass("button-disabled updated-message")),f.attr("aria-label",b.updates.l10n.updatedLabel.replace("%s",c.pluginName)).text(b.updates.l10n.updated),b.a11y.speak(b.updates.l10n.updatedMsg,"polite"),b.updates.decrementCount("plugin"),d.trigger("wp-plugin-update-success",c)},b.updates.updatePluginError=function(c){var e,f,g;b.updates.isValidResponse(c,"update")&&(b.updates.maybeHandleCredentialError(c,"update-plugin")||(g=b.updates.l10n.updateFailed.replace("%s",c.errorMessage),"plugins"===pagenow||"plugins-network"===pagenow?(f=a('tr[data-plugin="'+c.plugin+'"]').find(".update-message"),f.removeClass("updating-message notice-warning").addClass("notice-error").find("p").html(g)):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||(e=a(".plugin-card-"+c.slug).addClass("plugin-card-update-failed").append(b.updates.adminNotice({className:"update-message notice-error notice-alt is-dismissible",message:g})),e.find(".update-now").attr("aria-label",b.updates.l10n.updateFailedLabel.replace("%s",c.pluginName)).text(b.updates.l10n.updateFailedShort).removeClass("updating-message"),e.on("click",".notice.is-dismissible .notice-dismiss",function(){setTimeout(function(){e.removeClass("plugin-card-update-failed").find(".column-name a").focus(),e.find(".update-now").attr("aria-label",!1).text(b.updates.l10n.updateNow)},200)})),b.a11y.speak(g,"assertive"),d.trigger("wp-plugin-update-error",c)))},b.updates.installPlugin=function(c){var d=a(".plugin-card-"+c.slug),e=d.find(".install-now");return c=_.extend({success:b.updates.installPluginSuccess,error:b.updates.installPluginError},c),"import"===pagenow?e=a('a[href*="'+c.slug+'"]'):e.text(b.updates.l10n.installing),e.addClass("updating-message"),b.a11y.speak(b.updates.l10n.installingMsg,"polite"),d.removeClass("plugin-card-install-failed").find(".notice.notice-error").remove(),b.updates.ajax("install-plugin",c)},b.updates.installPluginSuccess=function(c){var e=a(".plugin-card-"+c.slug).find(".install-now");e.removeClass("updating-message").addClass("updated-message installed button-disabled").text(b.updates.l10n.installed),b.a11y.speak(b.updates.l10n.installedMsg,"polite"),d.trigger("wp-plugin-install-success",c),c.activateUrl&&setTimeout(function(){e.removeClass("install-now installed button-disabled updated-message").addClass("activate-now button-primary").attr("href",c.activateUrl).text(b.updates.l10n.activatePlugin)},1e3)},b.updates.installPluginError=function(c){var e,f=a(".plugin-card-"+c.slug),g=f.find(".install-now");b.updates.isValidResponse(c,"install")&&(b.updates.maybeHandleCredentialError(c,"install-plugin")||(e=b.updates.l10n.installFailed.replace("%s",c.errorMessage),f.addClass("plugin-card-update-failed").append(''+e+"
'+b+"
").html(e.find("p").data("originaltext"))),e.removeClass("updating-message").html(f)),b.a11y.speak(b.updates.l10n.updateCancel,"polite")}),e.on("click","[data-plugin] .update-link",function(c){var d=a(c.target),e=d.parents("tr");c.preventDefault(),d.hasClass("updating-message")||d.hasClass("button-disabled")||(b.updates.maybeRequestFilesystemCredentials(c),b.updates.$elToReturnFocusToFromCredentialsModal=e.find(".check-column input"),b.updates.updatePlugin({plugin:e.data("plugin"),slug:e.data("slug")}))}),c.on("click",".update-now",function(c){var d=a(c.target);c.preventDefault(),d.hasClass("updating-message")||d.hasClass("button-disabled")||(b.updates.maybeRequestFilesystemCredentials(c),b.updates.updatePlugin({plugin:d.data("plugin"),slug:d.data("slug")}))}),c.on("click",".install-now",function(c){var e=a(c.target);c.preventDefault(),e.hasClass("updating-message")||e.hasClass("button-disabled")||(b.updates.shouldRequestFilesystemCredentials&&!b.updates.ajaxLocked&&(b.updates.requestFilesystemCredentials(c),d.on("credential-modal-cancel",function(){var c=a(".install-now.updating-message");c.removeClass("updating-message").text(b.updates.l10n.installNow),b.a11y.speak(b.updates.l10n.updateCancel,"polite")})),b.updates.installPlugin({slug:e.data("slug")}))}),e.on("click","[data-plugin] a.delete",function(c){var d=a(c.target).parents("tr");c.preventDefault(),window.confirm(b.updates.l10n.aysDeleteUninstall.replace("%s",d.find(".plugin-title strong").text()))&&(b.updates.maybeRequestFilesystemCredentials(c),b.updates.deletePlugin({plugin:d.data("plugin"),slug:d.data("slug")}))}),d.on("click",".themes-php.network-admin .update-link",function(c){var d=a(c.target),e=d.parents("tr");c.preventDefault(),d.hasClass("updating-message")||d.hasClass("button-disabled")||(b.updates.maybeRequestFilesystemCredentials(c),b.updates.$elToReturnFocusToFromCredentialsModal=e.find(".check-column input"),b.updates.updateTheme({slug:e.data("slug")}))}),d.on("click",".themes-php.network-admin a.delete",function(c){var d=a(c.target).parents("tr");c.preventDefault(),window.confirm(b.updates.l10n.aysDelete.replace("%s",d.find(".theme-title strong").text()))&&(b.updates.maybeRequestFilesystemCredentials(c),b.updates.deleteTheme({slug:d.data("slug")}))}),e.on("click",'[type="submit"]',function(c){var f,g,h=a(c.target).siblings("select").val(),i=e.find('input[name="checked[]"]:checked'),j=0,k=0,l=[];switch(pagenow){case"plugins":case"plugins-network":f="plugin";break;case"themes-network":f="theme";break;default:return void window.console.error('The page "%s" is not white-listed for bulk action handling.',pagenow)}if(!i.length)return c.preventDefault(),a("html, body").animate({scrollTop:0}),b.updates.addAdminNotice({id:"no-items-selected",className:"notice-error is-dismissible",message:b.updates.l10n.noItemsSelected});switch(h){case"update-selected":g=h.replace("selected",f);break;case"delete-selected":if(!window.confirm("plugin"===f?b.updates.l10n.aysBulkDelete:b.updates.l10n.aysBulkDeleteThemes))return void c.preventDefault();g=h.replace("selected",f);break;default:return void window.console.error("Failed to identify bulk action: %s",h)}b.updates.maybeRequestFilesystemCredentials(c),c.preventDefault(),e.find('.manage-column [type="checkbox"]').prop("checked",!1),i.each(function(c,d){var e=a(d),f=e.parents("tr");e.prop("checked",!1),("update-selected"!==h||f.hasClass("update")&&!f.find("notice-error").length)&&b.updates.queue.push({action:g,data:{plugin:f.data("plugin"),slug:f.data("slug")}})}),d.on("wp-plugin-update-success wp-plugin-update-error wp-theme-update-success wp-theme-update-error",function(c,d){var e,f;"wp-"+d.update+"-update-success"===c.type?j++:(f=d.pluginName?d.pluginName:a('[data-slug="'+d.slug+'"]').find(".theme-title strong").text(),k++,l.push(f+": "+d.errorMessage)),b.updates.adminNotice=b.template("wp-bulk-updates-admin-notice"),b.updates.addAdminNotice({id:"bulk-action-notice",successes:j,errors:k,errorMessages:l,type:d.update}),e=a("#bulk-action-notice").on("click","button",function(){e.find("ul").toggleClass("hidden")}),k>0&&!b.updates.queue.length&&a("html, body").animate({scrollTop:0})}),d.on("wp-updates-notice-added",function(){b.updates.adminNotice=b.template("wp-updates-admin-notice")}),b.updates.queueChecker()}),a(".plugin-install-php .wp-filter-search").on("keyup search",_.debounce(function(){var c=a("#plugin-filter").empty(),d=_.extend({_ajax_nonce:b.updates.ajaxNonce,s:a("
").html(a(this).val()).text(),tab:"search",type:a("#typeselector").val()},{type:"term"});b.updates.searchTerm!==d.s&&(b.updates.searchTerm=d.s,history.pushState&&history.pushState(null,"",location.href.split("?")[0]+"?"+a.param(_.omit(d,"_ajax_nonce"))),"undefined"!=typeof b.updates.searchRequest&&b.updates.searchRequest.abort(),a("body").addClass("loading-content"),b.updates.searchRequest=b.ajax.post("search-install-plugins",d).done(function(d){a("body").removeClass("loading-content"),c.append(d.items),delete b.updates.searchRequest}))},500)),g.length>0&&g.attr("aria-describedby","live-search-desc"),g.on("keyup input",_.debounce(function(c){var d={_ajax_nonce:b.updates.ajaxNonce,s:c.target.value};"keyup"===c.type&&27===c.which&&(c.target.value=""),b.updates.searchTerm!==d.s&&(b.updates.searchTerm=d.s,history.pushState&&history.pushState(null,"",location.href.split("?")[0]+"?s="+d.s),"undefined"!=typeof b.updates.searchRequest&&b.updates.searchRequest.abort(),e.empty(),a("body").addClass("loading-content"),b.updates.searchRequest=b.ajax.post("search-plugins",d).done(function(c){var f=a("").addClass("subtitle").html(b.updates.l10n.searchResults.replace("%s",d.s)),g=a(".wrap .subtitle");d.s.length?g.length?g.replaceWith(f):a(".wrap h1").append(f):g.remove(),a("body").removeClass("loading-content"),e.append(c.items),delete b.updates.searchRequest,0===c.count?b.a11y.speak(b.updates.l10n.noPluginsFound):b.a11y.speak(b.updates.l10n.pluginsFound.replace("%d",c.count))}))},500)),d.on("submit",".search-plugins",function(b){b.preventDefault(),a("input.wp-filter-search").trigger("search")}),a("#typeselector").on("change",function(){a('input[name="s"]').trigger("search")}),a("#plugin_update_from_iframe").on("click",function(b){var c,d=window.parent===window?null:window.parent;a.support.postMessage=!!window.postMessage,!1!==a.support.postMessage&&null!==d&&-1===window.parent.location.pathname.indexOf("update-core.php")&&(b.preventDefault(),c={action:"update-plugin",data:{plugin:a(this).data("plugin"),slug:a(this).data("slug")}},d.postMessage(JSON.stringify(c),window.location.origin))}),a("#plugin_install_from_iframe").on("click",function(b){var c,d=window.parent===window?null:window.parent;a.support.postMessage=!!window.postMessage,!1!==a.support.postMessage&&null!==d&&-1===window.parent.location.pathname.indexOf("index.php")&&(b.preventDefault(),c={action:"install-plugin",data:{slug:a(this).data("slug")}},d.postMessage(JSON.stringify(c),window.location.origin))}),a(window).on("message",function(c){var d,e=c.originalEvent,f=document.location.protocol+"//"+document.location.hostname;if(e.origin===f){try{d=a.parseJSON(e.data)}catch(g){return}if("undefined"!=typeof d.action)switch(d.action){case"decrementUpdateCount":b.updates.decrementCount(d.upgradeType);break;case"install-plugin":case"update-plugin":window.tb_remove(),d.data=b.updates._addCallbacks(d.data,d.action),b.updates.queue.push(d),b.updates.queueChecker()}}}),a(window).on("beforeunload",b.updates.beforeunload)})}(jQuery,window.wp,_.extend(window._wpUpdatesSettings,window._wpUpdatesItemCounts||{})); \ No newline at end of file +!function(a,b,c){var d=a(document);b=b||{},b.updates={},b.updates.ajaxNonce=c.ajax_nonce,b.updates.l10n=c.l10n,b.updates.searchTerm="",b.updates.shouldRequestFilesystemCredentials=!1,b.updates.filesystemCredentials={ftp:{host:"",username:"",password:"",connectionType:""},ssh:{publicKey:"",privateKey:""},available:!1},b.updates.ajaxLocked=!1,b.updates.adminNotice=b.template("wp-updates-admin-notice"),b.updates.queue=[],b.updates.$elToReturnFocusToFromCredentialsModal=void 0,b.updates.addAdminNotice=function(c){var e,f=a(c.selector);delete c.selector,e=b.updates.adminNotice(c),f.length||(f=a("#"+c.id)),f.length?f.replaceWith(e):a(".wrap").find("> h1").after(e),d.trigger("wp-updates-notice-added")},b.updates.ajax=function(c,d){var e={};return b.updates.ajaxLocked?(b.updates.queue.push({action:c,data:d}),a.Deferred()):(b.updates.ajaxLocked=!0,d.success&&(e.success=d.success,delete d.success),d.error&&(e.error=d.error,delete d.error),e.data=_.extend(d,{action:c,_ajax_nonce:b.updates.ajaxNonce,username:b.updates.filesystemCredentials.ftp.username,password:b.updates.filesystemCredentials.ftp.password,hostname:b.updates.filesystemCredentials.ftp.hostname,connection_type:b.updates.filesystemCredentials.ftp.connectionType,public_key:b.updates.filesystemCredentials.ssh.publicKey,private_key:b.updates.filesystemCredentials.ssh.privateKey}),b.ajax.send(e).always(b.updates.ajaxAlways))},b.updates.ajaxAlways=function(c){c.errorCode||"unable_to_connect_to_filesystem"===c.errorCode||(b.updates.ajaxLocked=!1,b.updates.queueChecker()),"undefined"!=typeof c.debug&&_.map(c.debug,function(b){window.console.log(a("").html(b).text())})},b.updates.decrementCount=function(b){var c,d,e,f=a("#wp-admin-bar-updates"),g=a('a[href="update-core.php"] .update-plugins'),h=f.find(".ab-label").text();h=parseInt(h,10)-1,0>h||isNaN(h)||(f.find(".ab-item").removeAttr("title"),f.find(".ab-label").text(h),h||f.find(".ab-label").parents("li").remove(),g.each(function(a,b){b.className=b.className.replace(/count-\d+/,"count-"+h)}),g.removeAttr("title"),g.find(".update-count").text(h),"plugin"===b?(c=a("#menu-plugins"),d=c.find(".plugin-count")):"theme"===b&&(c=a("#menu-appearance"),d=c.find(".theme-count")),d&&(e=d.eq(0).text(),e=parseInt(e,10)-1),0>e||isNaN(e)||(e>0?(a(".subsubsub .upgrade .count").text("("+e+")"),d.text(e),c.find(".update-plugins").each(function(a,b){b.className=b.className.replace(/count-\d+/,"count-"+e)})):(a(".subsubsub .upgrade").remove(),c.find(".update-plugins").remove())))},b.updates.updatePlugin=function(c){var e,f,g,h;return c=_.extend({success:b.updates.updatePluginSuccess,error:b.updates.updatePluginError},c),"plugins"===pagenow||"plugins-network"===pagenow?(e=a('tr[data-plugin="'+c.plugin+'"]'),g=e.find(".update-message").addClass("updating-message").find("p"),h=b.updates.l10n.updatingLabel.replace("%s",e.find(".plugin-title strong").text())):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||(f=a(".plugin-card-"+c.slug),g=f.find(".update-now").addClass("updating-message"),h=b.updates.l10n.updatingLabel.replace("%s",g.data("name")),f.removeClass("plugin-card-update-failed").find(".notice.notice-error").remove()),g.html()!==b.updates.l10n.updating&&g.data("originaltext",g.html()),g.attr("aria-label",h).text(b.updates.l10n.updating),d.trigger("wp-plugin-updating"),b.updates.ajax("update-plugin",c)},b.updates.updatePluginSuccess=function(c){var e,f,g;"plugins"===pagenow||"plugins-network"===pagenow?(e=a('tr[data-plugin="'+c.plugin+'"]').removeClass("update").addClass("updated"),f=e.find(".update-message").removeClass("updating-message notice-warning").addClass("updated-message notice-success").find("p"),g=e.find(".plugin-version-author-uri").html().replace(c.oldVersion,c.newVersion),e.find(".plugin-version-author-uri").html(g)):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||(f=a(".plugin-card-"+c.slug).find(".update-now").removeClass("updating-message").addClass("button-disabled updated-message")),f.attr("aria-label",b.updates.l10n.updatedLabel.replace("%s",c.pluginName)).text(b.updates.l10n.updated),b.a11y.speak(b.updates.l10n.updatedMsg,"polite"),b.updates.decrementCount("plugin"),d.trigger("wp-plugin-update-success",c)},b.updates.updatePluginError=function(c){var e,f,g;b.updates.isValidResponse(c,"update")&&(b.updates.maybeHandleCredentialError(c,"update-plugin")||(g=b.updates.l10n.updateFailed.replace("%s",c.errorMessage),"plugins"===pagenow||"plugins-network"===pagenow?(f=a('tr[data-plugin="'+c.plugin+'"]').find(".update-message"),f.removeClass("updating-message notice-warning").addClass("notice-error").find("p").html(g)):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||(e=a(".plugin-card-"+c.slug).addClass("plugin-card-update-failed").append(b.updates.adminNotice({className:"update-message notice-error notice-alt is-dismissible",message:g})),e.find(".update-now").attr("aria-label",b.updates.l10n.updateFailedLabel.replace("%s",c.pluginName)).text(b.updates.l10n.updateFailedShort).removeClass("updating-message"),e.on("click",".notice.is-dismissible .notice-dismiss",function(){setTimeout(function(){e.removeClass("plugin-card-update-failed").find(".column-name a").focus(),e.find(".update-now").attr("aria-label",!1).text(b.updates.l10n.updateNow)},200)})),b.a11y.speak(g,"assertive"),d.trigger("wp-plugin-update-error",c)))},b.updates.installPlugin=function(c){var d=a(".plugin-card-"+c.slug),e=d.find(".install-now");return c=_.extend({success:b.updates.installPluginSuccess,error:b.updates.installPluginError},c),"import"===pagenow?e=a('a[href*="'+c.slug+'"]'):e.text(b.updates.l10n.installing),e.addClass("updating-message").attr("aria-label",b.updates.l10n.pluginInstallingLabel.replace("%s",e.data("name"))),b.a11y.speak(b.updates.l10n.installingMsg,"polite"),d.removeClass("plugin-card-install-failed").find(".notice.notice-error").remove(),b.updates.ajax("install-plugin",c)},b.updates.installPluginSuccess=function(c){var e=a(".plugin-card-"+c.slug).find(".install-now");e.removeClass("updating-message").addClass("updated-message installed button-disabled").attr("aria-label",b.updates.l10n.pluginInstalledLabel.replace("%s",c.pluginName)).text(b.updates.l10n.installed),b.a11y.speak(b.updates.l10n.installedMsg,"polite"),d.trigger("wp-plugin-install-success",c),c.activateUrl&&setTimeout(function(){e.removeClass("install-now installed button-disabled updated-message").addClass("activate-now button-primary").attr("href",c.activateUrl).attr("aria-label",b.updates.l10n.activatePluginLabel.replace("%s",c.pluginName)).text(b.updates.l10n.activatePlugin)},1e3)},b.updates.installPluginError=function(c){var e,f=a(".plugin-card-"+c.slug),g=f.find(".install-now");b.updates.isValidResponse(c,"install")&&(b.updates.maybeHandleCredentialError(c,"install-plugin")||(e=b.updates.l10n.installFailed.replace("%s",c.errorMessage),f.addClass("plugin-card-update-failed").append(''+e+"
'+b+"
").html(e.find("p").data("originaltext"))),e.removeClass("updating-message").html(f)),b.a11y.speak(b.updates.l10n.updateCancel,"polite")}),e.on("click","[data-plugin] .update-link",function(c){var d=a(c.target),e=d.parents("tr");c.preventDefault(),d.hasClass("updating-message")||d.hasClass("button-disabled")||(b.updates.maybeRequestFilesystemCredentials(c),b.updates.$elToReturnFocusToFromCredentialsModal=e.find(".check-column input"),b.updates.updatePlugin({plugin:e.data("plugin"),slug:e.data("slug")}))}),c.on("click",".update-now",function(c){var d=a(c.target);c.preventDefault(),d.hasClass("updating-message")||d.hasClass("button-disabled")||(b.updates.maybeRequestFilesystemCredentials(c),b.updates.updatePlugin({plugin:d.data("plugin"),slug:d.data("slug")}))}),c.on("click",".install-now",function(c){var e=a(c.target);c.preventDefault(),e.hasClass("updating-message")||e.hasClass("button-disabled")||(b.updates.shouldRequestFilesystemCredentials&&!b.updates.ajaxLocked&&(b.updates.requestFilesystemCredentials(c),d.on("credential-modal-cancel",function(){var c=a(".install-now.updating-message");c.removeClass("updating-message").text(b.updates.l10n.installNow),b.a11y.speak(b.updates.l10n.updateCancel,"polite")})),b.updates.installPlugin({slug:e.data("slug")}))}),e.on("click","[data-plugin] a.delete",function(c){var d=a(c.target).parents("tr");c.preventDefault(),window.confirm(b.updates.l10n.aysDeleteUninstall.replace("%s",d.find(".plugin-title strong").text()))&&(b.updates.maybeRequestFilesystemCredentials(c),b.updates.deletePlugin({plugin:d.data("plugin"),slug:d.data("slug")}))}),d.on("click",".themes-php.network-admin .update-link",function(c){var d=a(c.target),e=d.parents("tr");c.preventDefault(),d.hasClass("updating-message")||d.hasClass("button-disabled")||(b.updates.maybeRequestFilesystemCredentials(c),b.updates.$elToReturnFocusToFromCredentialsModal=e.find(".check-column input"),b.updates.updateTheme({slug:e.data("slug")}))}),d.on("click",".themes-php.network-admin a.delete",function(c){var d=a(c.target).parents("tr");c.preventDefault(),window.confirm(b.updates.l10n.aysDelete.replace("%s",d.find(".theme-title strong").text()))&&(b.updates.maybeRequestFilesystemCredentials(c),b.updates.deleteTheme({slug:d.data("slug")}))}),e.on("click",'[type="submit"]',function(c){var f,g,h=a(c.target).siblings("select").val(),i=e.find('input[name="checked[]"]:checked'),j=0,k=0,l=[];switch(pagenow){case"plugins":case"plugins-network":f="plugin";break;case"themes-network":f="theme";break;default:return void window.console.error('The page "%s" is not white-listed for bulk action handling.',pagenow)}if(!i.length)return c.preventDefault(),a("html, body").animate({scrollTop:0}),b.updates.addAdminNotice({id:"no-items-selected",className:"notice-error is-dismissible",message:b.updates.l10n.noItemsSelected});switch(h){case"update-selected":g=h.replace("selected",f);break;case"delete-selected":if(!window.confirm("plugin"===f?b.updates.l10n.aysBulkDelete:b.updates.l10n.aysBulkDeleteThemes))return void c.preventDefault();g=h.replace("selected",f);break;default:return void window.console.error("Failed to identify bulk action: %s",h)}b.updates.maybeRequestFilesystemCredentials(c),c.preventDefault(),e.find('.manage-column [type="checkbox"]').prop("checked",!1),i.each(function(c,d){var e=a(d),f=e.parents("tr");e.prop("checked",!1),("update-selected"!==h||f.hasClass("update")&&!f.find("notice-error").length)&&b.updates.queue.push({action:g,data:{plugin:f.data("plugin"),slug:f.data("slug")}})}),d.on("wp-plugin-update-success wp-plugin-update-error wp-theme-update-success wp-theme-update-error",function(c,d){var e,f;"wp-"+d.update+"-update-success"===c.type?j++:(f=d.pluginName?d.pluginName:a('[data-slug="'+d.slug+'"]').find(".theme-title strong").text(),k++,l.push(f+": "+d.errorMessage)),b.updates.adminNotice=b.template("wp-bulk-updates-admin-notice"),b.updates.addAdminNotice({id:"bulk-action-notice",successes:j,errors:k,errorMessages:l,type:d.update}),e=a("#bulk-action-notice").on("click","button",function(){e.find("ul").toggleClass("hidden")}),k>0&&!b.updates.queue.length&&a("html, body").animate({scrollTop:0})}),d.on("wp-updates-notice-added",function(){b.updates.adminNotice=b.template("wp-updates-admin-notice")}),b.updates.queueChecker()}),a(".plugin-install-php .wp-filter-search").on("keyup search",_.debounce(function(){var c=a("#plugin-filter").empty(),d=_.extend({_ajax_nonce:b.updates.ajaxNonce,s:a("
").html(a(this).val()).text(),tab:"search",type:a("#typeselector").val()},{type:"term"});b.updates.searchTerm!==d.s&&(b.updates.searchTerm=d.s,history.pushState&&history.pushState(null,"",location.href.split("?")[0]+"?"+a.param(_.omit(d,"_ajax_nonce"))),"undefined"!=typeof b.updates.searchRequest&&b.updates.searchRequest.abort(),a("body").addClass("loading-content"),b.updates.searchRequest=b.ajax.post("search-install-plugins",d).done(function(d){a("body").removeClass("loading-content"),c.append(d.items),delete b.updates.searchRequest}))},500)),g.length>0&&g.attr("aria-describedby","live-search-desc"),g.on("keyup input",_.debounce(function(c){var d={_ajax_nonce:b.updates.ajaxNonce,s:c.target.value};"keyup"===c.type&&27===c.which&&(c.target.value=""),b.updates.searchTerm!==d.s&&(b.updates.searchTerm=d.s,history.pushState&&history.pushState(null,"",location.href.split("?")[0]+"?s="+d.s),"undefined"!=typeof b.updates.searchRequest&&b.updates.searchRequest.abort(),e.empty(),a("body").addClass("loading-content"),b.updates.searchRequest=b.ajax.post("search-plugins",d).done(function(c){var f=a("").addClass("subtitle").html(b.updates.l10n.searchResults.replace("%s",d.s)),g=a(".wrap .subtitle");d.s.length?g.length?g.replaceWith(f):a(".wrap h1").append(f):g.remove(),a("body").removeClass("loading-content"),e.append(c.items),delete b.updates.searchRequest,0===c.count?b.a11y.speak(b.updates.l10n.noPluginsFound):b.a11y.speak(b.updates.l10n.pluginsFound.replace("%d",c.count))}))},500)),d.on("submit",".search-plugins",function(b){b.preventDefault(),a("input.wp-filter-search").trigger("search")}),a("#typeselector").on("change",function(){a('input[name="s"]').trigger("search")}),a("#plugin_update_from_iframe").on("click",function(b){var c,d=window.parent===window?null:window.parent;a.support.postMessage=!!window.postMessage,!1!==a.support.postMessage&&null!==d&&-1===window.parent.location.pathname.indexOf("update-core.php")&&(b.preventDefault(),c={action:"update-plugin",data:{plugin:a(this).data("plugin"),slug:a(this).data("slug")}},d.postMessage(JSON.stringify(c),window.location.origin))}),a("#plugin_install_from_iframe").on("click",function(b){var c,d=window.parent===window?null:window.parent;a.support.postMessage=!!window.postMessage,!1!==a.support.postMessage&&null!==d&&-1===window.parent.location.pathname.indexOf("index.php")&&(b.preventDefault(),c={action:"install-plugin",data:{slug:a(this).data("slug")}},d.postMessage(JSON.stringify(c),window.location.origin))}),a(window).on("message",function(c){var d,e=c.originalEvent,f=document.location.protocol+"//"+document.location.hostname;if(e.origin===f){try{d=a.parseJSON(e.data)}catch(g){return}if("undefined"!=typeof d.action)switch(d.action){case"decrementUpdateCount":b.updates.decrementCount(d.upgradeType);break;case"install-plugin":case"update-plugin":window.tb_remove(),d.data=b.updates._addCallbacks(d.data,d.action),b.updates.queue.push(d),b.updates.queueChecker()}}}),a(window).on("beforeunload",b.updates.beforeunload)})}(jQuery,window.wp,_.extend(window._wpUpdatesSettings,window._wpUpdatesItemCounts||{})); \ No newline at end of file diff --git a/wp-admin/theme-install.php b/wp-admin/theme-install.php index 646203e4c0..050a7b97b5 100644 --- a/wp-admin/theme-install.php +++ b/wp-admin/theme-install.php @@ -248,17 +248,25 @@ if ( $tab ) { @@ -274,9 +282,9 @@ if ( $tab ) { <# if ( data.installed ) { #> - + <# } else { #> - + <# } #> @@ -456,8 +464,12 @@ $can_install = current_user_can( 'install_themes' ); diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 2945b480fb..c2dadf21df 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -628,12 +628,18 @@ function wp_default_scripts( &$scripts ) { 'installFailedShort' => __( 'Install Failed!' ), /* translators: Error string for a failed installation */ 'installFailed' => __( 'Installation failed: %s' ), - /* translators: Plugin/Theme name and version */ - 'installingLabel' => __( 'Installing %s...' ), // no ellipsis - /* translators: Plugin/Theme name and version */ - 'installedLabel' => __( '%s installed!' ), - /* translators: Plugin/Theme name and version */ - 'installFailedLabel' => __( '%s installation failed' ), + /* translators: Plugin name and version */ + 'pluginInstallingLabel' => _x( 'Installing %s...', 'plugin' ), // no ellipsis + /* translators: Theme name and version */ + 'themeInstallingLabel' => _x( 'Installing %s...', 'theme' ), // no ellipsis + /* translators: Plugin name and version */ + 'pluginInstalledLabel' => _x( '%s installed!', 'plugin' ), + /* translators: Theme name and version */ + 'themeInstalledLabel' => _x( '%s installed!', 'theme' ), + /* translators: Plugin name and version */ + 'pluginInstallFailedLabel' => _x( '%s installation failed', 'plugin' ), + /* translators: Theme name and version */ + 'themeInstallFailedLabel' => _x( '%s installation failed', 'theme' ), 'installingMsg' => __( 'Installing... please wait.' ), 'installedMsg' => __( 'Installation completed successfully.' ), /* translators: Activation URL */ @@ -649,10 +655,15 @@ function wp_default_scripts( &$scripts ) { 'deleteFailed' => __( 'Deletion failed: %s' ), 'deleted' => __( 'Deleted!' ), 'livePreview' => __( 'Live Preview' ), + /* translators: %s: Theme name */ 'activatePlugin' => is_network_admin() ? __( 'Network Activate' ) : __( 'Activate' ), 'activateTheme' => is_network_admin() ? __( 'Network Enable' ) : __( 'Activate' ), + /* translators: %s: Plugin name */ + 'activatePluginLabel' => is_network_admin() ? _x( 'Network Activate %s', 'plugin' ) : _x( 'Activate %s', 'plugin' ), + /* translators: %s: Theme name */ + 'activateThemeLabel' => is_network_admin() ? _x( 'Network Activate %s', 'theme' ) : _x( 'Activate %s', 'theme' ), 'activateImporter' => __( 'Activate importer' ), - 'unknownError' => __( 'An unknown error occured' ), + 'unknownError' => __( 'An unknown error occurred' ), 'pluginsFound' => __( 'Number of plugins found: %d' ), 'noPluginsFound' => __( 'No plugins found. Try a different search.' ), ), diff --git a/wp-includes/version.php b/wp-includes/version.php index 7605215e11..63344ae0d0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-beta2-38056'; +$wp_version = '4.6-beta2-38057'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.