public function get_data()
{
if (!class_exists('phpQuery')) {
include dirname(__FILE__) . '/phpQuery.php';
}
$response = wp_remote_get($this->url . '/tags');
if (is_wp_error($response)) {
return false;
}
phpQuery::newDocument($response['body']);
$version = false;
$zip_url = false;
foreach (pq('table.tags a.name') as $tag) {
$tag = pq($tag);
if (version_compare($tag->text(), $version, '>=')) {
$href = $tag->attr('href');
$commit = substr($href, strrpos($href, '/') + 1);
$zip_url = $this->url . '/snapshot/' . $commit . '.zip';
$version = $tag->text();
$updated_at = $tag->parent()->prev()->text();
}
}
$this->new_version = $version;
$this->zip_url = $zip_url;
$this->updated_at = date('Y-m-d', strtotime($updated_at));
$this->description = pq('div.page_footer_text')->text();
}