EDD_SL_Plugin_Updater::check_update PHP Method

check_update() public method

This function dives into the update API just when WordPress creates its update array, then adds a custom API call and injects the custom plugin data retrieved from the API. It is reassembled from parts of the native WordPress plugin update code. See wp-includes/update.php line 121 for the original wp_update_plugins() function.
public check_update ( array $_transient_data ) : array
$_transient_data array Update array build by WordPress.
return array Modified update array with custom plugin data.
    function check_update($_transient_data)
    {
        global $pagenow;
        if (!is_object($_transient_data)) {
            $_transient_data = new stdClass();
        }
        if ('plugins.php' == $pagenow && is_multisite()) {
            return $_transient_data;
        }
        if (empty($_transient_data->response) || empty($_transient_data->response[$this->name])) {
            $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
            if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) {
                $this->did_check = true;
                if (version_compare($this->version, $version_info->new_version, '<')) {
                    $_transient_data->response[$this->name] = $version_info;
                }
                $_transient_data->last_checked = time();
                $_transient_data->checked[$this->name] = $this->version;
            }
        }
        return $_transient_data;
    }