$value) {
$this->{$key} = $value;
}
$this->label_created = __('Created', 'f13-github');
$this->label_description = __('Description', 'f13-github');
$this->label_download_file = __('Download file', 'f13-github');
$this->label_files = __('Files', 'f13-github');
$this->label_forks = __('Forks', 'f13-github');
$this->label_github = __('GitHub', 'f13-github');
$this->label_github_repository = __('GitHub repository', 'f13-github');
$this->label_open_issues = __('Open issues', 'f13-github');
$this->label_last_commit = __('Last commit', 'f13-github');
$this->label_na = __('N/A', 'f13-github');
$this->label_owner = __('Owner', 'f13-github');
$this->label_stars = __('Stars', 'f13-github');
$this->label_watchers = __('Watchers', 'f13-github');
}
public function shortcode()
{
$v = '
';
$v .= '';
$v .= '
';
$v .= ''.$this->label_created.': ' . date("F d, Y - h:ia", strtotime($this->data['created_at'])).'
';
$v .= ''.$this->label_last_commit.': ' . date("F d, Y - h:ia", strtotime($this->data['updated_at'])).'
';
$v .= ''.$this->label_forks.': ' . $this->data['forks'].'
';
$v .= ''.$this->label_open_issues.': ' . $this->data['open_issues'].'
';
$v .= ''.$this->label_stars.': ' . $this->data['stargazers_count'].'
';
$v .= ''.$this->label_watchers.': ' . $this->data['watchers_count'].'
';
$v .= '
';
$v .= '
';
$v .= ''.$this->label_description.': ';
if ($this->data['description'] != '') {
$v .= htmlentities($this->data['description']);
} else {
$v .= $this->label_na;
}
$v .= '
';
if (is_array($this->files)) {
$v .= '
';
$v .= '
';
$v .= ''.$this->label_files.' (' . count($this->files) . ')';
$v .= '
';
foreach ($this->files as &$eachFile)
{
if ($eachFile['size'] == '0') {
continue;
}
$v .= '
';
$v .= $eachFile['path'] . ' (' . round($eachFile['size'] / 1024, 2) . 'kb)
'.$this->label_download_file.'';
if ($this->show_files != 'names') {
$v .= '
';
$v .= htmlentities(file_get_contents($eachFile['download_url']));
$v .= '
';
}
}
}
$v .= '
';
$v .= '';
return $v;
}
}