Compare commits

...

1 commit
1.0.7 ... main

Author SHA1 Message Date
4suredev
e6dcbe86b6 Check response before comparing versions 2025-06-19 08:36:26 +08:00
2 changed files with 6 additions and 7 deletions

View file

@ -3,7 +3,7 @@
* Plugin Name: 4sure - Avada Button Shortcode * Plugin Name: 4sure - Avada Button Shortcode
* Plugin URI: https://4sure.com.au * Plugin URI: https://4sure.com.au
* Description: Adds Avada button shortcodes to the classic editor * Description: Adds Avada button shortcodes to the classic editor
* Version: 1.0.7 * Version: 1.0.8
* Author: 4sure * Author: 4sure
* Requires PHP: 7.2 * Requires PHP: 7.2
* Requires at least: 5.8 * Requires at least: 5.8

View file

@ -47,7 +47,7 @@ class Custom_visual_builder_button_updater {
} }
public function initialize() { public function initialize() {
/* Adding a filter to the transient. */ /* Adding a filter to the transient. */
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'modify_transient' ), 10, 1 ); add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'modify_transient' ), 10, 1 );
add_filter( 'plugins_api', array( $this, 'plugin_popup' ), 10, 3); add_filter( 'plugins_api', array( $this, 'plugin_popup' ), 10, 3);
add_filter( 'upgrader_post_install', array( $this, 'after_install' ), 10, 3 ); add_filter( 'upgrader_post_install', array( $this, 'after_install' ), 10, 3 );
// Add Authorization Token to download_package // Add Authorization Token to download_package
@ -60,15 +60,14 @@ class Custom_visual_builder_button_updater {
} }
public function modify_transient( $transient ) { public function modify_transient( $transient ) {
if( property_exists( $transient, 'checked') ) { // Check if transient has a checked property if( property_exists( $transient, 'checked') ) { // Check if transient has a checked property
if( $transient->checked ) { // Did WordPress check for updates? if( $checked = $transient->checked ) { // Did WordPress check for updates?
$checked = $transient->checked;
$this->get_repository_info(); // Get the repo info $this->get_repository_info(); // Get the repo info
if (!empty($checked[$this->basename])) { if( is_array($this->github_response) && !empty($this->github_response['tag_name']) && !empty($checked[$this->basename]) ) { // Check response
$out_of_date = version_compare( $this->github_response['tag_name'], $checked[$this->basename], 'gt' ); // Check if we're out of date $out_of_date = version_compare( $this->github_response['tag_name'], $checked[$this->basename], 'gt' ); // Check if we're out of date
} else { } else {
$out_of_date = false; $out_of_date = false;
} }
if( $out_of_date != false ) { if( $out_of_date ) {
$new_files = $this->github_response['zipball_url']; // Get the ZIP $new_files = $this->github_response['zipball_url']; // Get the ZIP
$slug = current( explode('/', $this->basename ) ); // Create valid slug $slug = current( explode('/', $this->basename ) ); // Create valid slug
$plugin = array( // setup our plugin info $plugin = array( // setup our plugin info