/**
  * Cast the standard check_for_update() response to an array for the theme
  * update API.
  *
  * @since 1.0.0
  */
 public function check_for_update($source = 'transient')
 {
     $response = parent::check_for_update($source);
     if ($response) {
         return (array) $response;
     }
     return false;
 }
 /**
  * Constructor. Sets up the plugin updater object.
  *
  * Loops through the class properties and sets any that are passed in
  * through the $args parameter.
  *
  * @since 1.0.0
  *
  * @param array $args Associative array to set object properties.
  * @param string $file Absolute path a plugin file.
  */
 public function __construct($args = array(), $file)
 {
     parent::__construct($args);
     $this->type = 'plugin';
     $this->file = $file;
     $this->id = plugin_basename($file);
     if (empty($this->slug)) {
         $this->slug = basename($this->id, '.php');
     }
     $plugin = get_plugin_data($this->file);
     $this->version = $plugin['Version'];
 }
예제 #3
0
/**
 * Send a request to the remote API to activate the license for the current
 * site.
 *
 * @since 1.0.0
 */
function audiotheme_ajax_activate_license()
{
    if (isset($_POST['license']) && wp_verify_nonce($_POST['nonce'], 'audiotheme-activate-license')) {
        update_option('audiotheme_license_key', $_POST['license']);
        $updater = new Audiotheme_Updater();
        $response = $updater->activate_license($_POST['license']);
        update_option('audiotheme_license_status', $response);
        if (isset($response->status) && 'ok' === $response->status) {
            // @todo Clear the last update status check with a 'not_activated' response.
            update_option('audiotheme_license_key', $_POST['license']);
        }
        wp_send_json($response);
    }
}