Skip to content

Commit 59cf95d

Browse files
committed
[plugin-information-dialog] [updates] Updated the update mechanism to align with the changes in WordPress plugin update AJAX requests.
1 parent 5feee60 commit 59cf95d

File tree

2 files changed

+40
-5
lines changed

2 files changed

+40
-5
lines changed

includes/class-fs-plugin-updater.php

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ private function filters() {
106106

107107
if ( ! $this->_fs->has_any_active_valid_license() ) {
108108
add_action( 'admin_head', array( &$this, 'catch_plugin_information_dialog_contents' ) );
109+
} else {
110+
add_action( 'admin_footer', array( &$this, '_add_fs_allow_updater_and_dialog_request_param' ) );
109111
}
110112

111113
if ( ! WP_FS__IS_PRODUCTION_MODE ) {
@@ -129,15 +131,48 @@ private function filters() {
129131
}
130132
}
131133

134+
/**
135+
* @author Leo Fajardo (@leorw)
136+
* @since 2.7.4
137+
*/
138+
function _add_fs_allow_updater_and_dialog_request_param() {
139+
if ( ! $this->is_plugin_information_dialog_for_plugin() ) {
140+
return;
141+
}
142+
?>
143+
<script type="text/javascript">
144+
if ( typeof jQuery !== 'undefined' ) {
145+
jQuery( document ).on( 'wp-plugin-updating', function( event, args ) {
146+
if ( typeof args === 'object' && args.slug && typeof args.slug === 'string' ) {
147+
if ( <?php echo json_encode( $this->_fs->get_slug() ) ?> === args.slug ) {
148+
args.fs_allow_updater_and_dialog = true;
149+
}
150+
}
151+
} );
152+
}
153+
</script>
154+
<?php
155+
}
156+
157+
/**
158+
* @author Leo Fajardo (@leorw)
159+
* @since 2.7.4
160+
*
161+
* @return bool
162+
*/
163+
private function is_plugin_information_dialog_for_plugin() {
164+
return (
165+
'plugin-information' === fs_request_get( 'tab', false ) &&
166+
$this->_fs->get_slug() === fs_request_get_raw( 'plugin', false )
167+
);
168+
}
169+
132170
/**
133171
* @author Leo Fajardo (@leorw)
134172
* @since 2.1.4
135173
*/
136174
function catch_plugin_information_dialog_contents() {
137-
if (
138-
'plugin-information' !== fs_request_get( 'tab', false ) ||
139-
$this->_fs->get_slug() !== fs_request_get_raw( 'plugin', false )
140-
) {
175+
if ( ! $this->is_plugin_information_dialog_for_plugin() ) {
141176
return;
142177
}
143178

start.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* @var string
1717
*/
18-
$this_sdk_version = '2.7.3.1';
18+
$this_sdk_version = '2.7.3.2';
1919

2020
#region SDK Selection Logic --------------------------------------------------------------------
2121

0 commit comments

Comments
 (0)