current_version = $current_version; $this->update_path = $update_path; // Set the License $this->license_user = $license_user; $this->license_key = $license_key; // Set the Plugin Slug $this->plugin_slug = $plugin_slug; list ($t1, $t2) = explode( '/', $plugin_slug ); $this->slug = $t1; // define the alternative API for updating checking add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); // Define the alternative response for information checking add_filter( 'plugins_api', array( $this, 'check_info' ), 10, 3 ); if( $qcld_renew_subscription ){ add_action("after_plugin_row_{$this->plugin_slug}", array($this, 'show_upgrade_subscription_on_plugin_row'), 10, 3 ); } } /** * Add our self-hosted autoupdate plugin to the filter transient * * @param $transient * @return object $ transient */ public function check_update( $transient ) { if ( empty( $transient->checked ) ) { return $transient; } // Get the remote version $remote_version = $this->getRemote('info'); // If a newer version is available, add the update if ( version_compare( $this->current_version, $remote_version->new_version, '<' ) ) { if(isset($remote_version->subscription_enable->plugin_name) ){ $subscription_enable = $remote_version->subscription_enable->plugin_name; }else{ $subscription_enable = ''; } if( $this->slug == $subscription_enable ){ $obj = new stdClass(); $obj->slug = $this->slug; $obj->new_version = $remote_version->new_version; $obj->url = $remote_version->url; $obj->plugin = $this->plugin_slug; $obj->package = $remote_version->package; $obj->tested = $remote_version->tested; $obj->requires = $remote_version->requires; $obj->last_updated = $remote_version->last_updated; $obj->sections = $remote_version->sections; setqc_openaiaddon_update_transient($obj); deleteqc_openaiaddon_renew_transient(); $transient->response[$this->plugin_slug] = $obj; }else{ $obj = new stdClass(); setqc_openaiaddon_renew_transient($obj); $qcld_renew_subscription = get_openaiaddon_renew_transient(); if( $qcld_renew_subscription ){ add_action("after_plugin_row_{$this->plugin_slug}", array($this, 'show_upgrade_subscription_on_plugin_row'), 10, 3 ); } } } return $transient; } public function show_upgrade_subscription_on_plugin_row( $plugin_file, $plugin_data, $status ) { $qcld_renew_subscription = get_openaiaddon_renew_transient(); if( $qcld_renew_subscription ){ echo '