public function get_remote_readme()
{
if (!file_exists($this->type->local_path . 'readme.txt') && !file_exists($this->type->local_path_extended . 'readme.txt')) {
return false;
}
$response = isset($this->response['readme']) ? $this->response['readme'] : false;
/*
* Set $response from local file if no update available.
*/
if (!$response && !$this->can_update($this->type)) {
$response = new \stdClass();
$content = $this->get_local_info($this->type, 'readme.txt');
if ($content) {
$response->data = $content;
} else {
$response = false;
}
}
if (!$response) {
if (!isset($this->type->branch)) {
$this->type->branch = 'master';
}
$response = $this->api('/1.0/repositories/:owner/:repo/src/' . trailingslashit($this->type->branch) . 'readme.txt');
if (!$response) {
$response = new \stdClass();
$response->message = 'No readme found';
}
}
if ($response && isset($response->data)) {
$file = $response->data;
$parser = new Readme_Parser($file);
$response = $parser->parse_data();
$this->set_transient('readme', $response);
}
if ($this->validate_response($response)) {
return false;
}
$this->set_readme_info($response);
return true;
}