Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[plugin-information-dialog] [updates] Updated the update mechanism to… #726

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 39 additions & 4 deletions includes/class-fs-plugin-updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ private function filters() {

if ( ! $this->_fs->has_any_active_valid_license() ) {
add_action( 'admin_head', array( &$this, 'catch_plugin_information_dialog_contents' ) );
} else {
add_action( 'admin_footer', array( &$this, '_add_fs_allow_updater_and_dialog_request_param' ) );
}

if ( ! WP_FS__IS_PRODUCTION_MODE ) {
Expand All @@ -129,15 +131,48 @@ private function filters() {
}
}

/**
* @author Leo Fajardo (@leorw)
* @since 2.7.4
*/
function _add_fs_allow_updater_and_dialog_request_param() {
if ( ! $this->is_plugin_information_dialog_for_plugin() ) {
return;
}
?>
<script type="text/javascript">
if ( typeof jQuery !== 'undefined' ) {
jQuery( document ).on( 'wp-plugin-updating', function( event, args ) {
if ( typeof args === 'object' && args.slug && typeof args.slug === 'string' ) {
if ( <?php echo json_encode( $this->_fs->get_slug() ) ?> === args.slug ) {
args.fs_allow_updater_and_dialog = true;
}
}
} );
}
</script>
<?php
}

/**
* @author Leo Fajardo (@leorw)
* @since 2.7.4
*
* @return bool
*/
private function is_plugin_information_dialog_for_plugin() {
return (
'plugin-information' === fs_request_get( 'tab', false ) &&
$this->_fs->get_slug() === fs_request_get_raw( 'plugin', false )
);
}

/**
* @author Leo Fajardo (@leorw)
* @since 2.1.4
*/
function catch_plugin_information_dialog_contents() {
if (
'plugin-information' !== fs_request_get( 'tab', false ) ||
$this->_fs->get_slug() !== fs_request_get_raw( 'plugin', false )
) {
if ( ! $this->is_plugin_information_dialog_for_plugin() ) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion start.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @var string
*/
$this_sdk_version = '2.7.3.1';
$this_sdk_version = '2.7.3.2';

#region SDK Selection Logic --------------------------------------------------------------------

Expand Down
Loading