Index: /trunk/src/wp-admin/includes/plugin-install.php
===================================================================
--- /trunk/src/wp-admin/includes/plugin-install.php (revision 32061)
+++ /trunk/src/wp-admin/includes/plugin-install.php (revision 32062)
@@ -562,5 +562,5 @@
case 'update_available':
if ( $status['url'] ) {
- echo '' . __( 'Install Update Now' ) .'';
+ echo '' . __( 'Install Update Now' ) .'';
}
break;
Index: /trunk/src/wp-admin/js/updates.js
===================================================================
--- /trunk/src/wp-admin/js/updates.js (revision 32061)
+++ /trunk/src/wp-admin/js/updates.js (revision 32062)
@@ -1,2 +1,3 @@
+/* global tb_remove */
window.wp = window.wp || {};
@@ -474,4 +475,24 @@
} );
+ //
+ $( '#plugin_update_from_iframe' ).on( 'click' , function( e ) {
+ var target, data;
+
+ target = window.parent == window ? null : window.parent,
+ $.support.postMessage = !! window.postMessage;
+
+ if ( $.support.postMessage === false || target === null )
+ return;
+
+ e.preventDefault();
+
+ data = {
+ 'action' : 'updatePlugin',
+ 'slug' : $(this).data('slug')
+ };
+
+ target.postMessage( JSON.stringify( data ), window.location.origin );
+ });
+
} );
@@ -488,9 +509,27 @@
message = $.parseJSON( event.data );
- if ( typeof message.action === 'undefined' || message.action !== 'decrementUpdateCount' ) {
- return;
- }
-
- wp.updates.decrementCount( message.upgradeType );
+ if ( typeof message.action === 'undefined' ) {
+ return;
+ }
+
+ switch (message.action){
+ case 'decrementUpdateCount' :
+ wp.updates.decrementCount( message.upgradeType );
+ break;
+ case 'updatePlugin' :
+ tb_remove();
+ if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
+ // Return the user to the input box of the plugin's table row after closing the modal.
+ $( '#' + message.slug ).find( '.check-column input' ).focus();
+ // trigger the update
+ $( '.plugin-update-tr[data-slug="' + message.slug + '"]' ).find( '.update-link' ).trigger( 'click' );
+ } else if ( 'plugin-install' === pagenow ) {
+ $( '.plugin-card-' + message.slug ).find( 'h4 a' ).focus();
+ $( '.plugin-card-' + message.slug ).find( '[data-slug="' + message.slug + '"]' ).trigger( 'click' );
+ }
+ break;
+ }
+
+
} );