consolidate format_commit_stats
This commit is contained in:
parent
c543ac72dd
commit
7c7685bee7
@ -48,42 +48,30 @@ class LinuxfooGitlab {
|
||||
}
|
||||
|
||||
static function format_commit($atts, $commit) {
|
||||
$out = '';
|
||||
|
||||
preg_match('/^....-..-../', $commit->committed_date, $m);
|
||||
$date = $m[0];
|
||||
|
||||
$title = htmlspecialchars($commit->title, ENT_NOQUOTES|ENT_HTML5|ENT_SUBSTITUTE, 'UTF-8', FALSE);
|
||||
|
||||
$out .=
|
||||
return
|
||||
$date.' '.
|
||||
__('by', 'linuxfoo-gitlab').' '.$commit->author_name.
|
||||
': '.
|
||||
'<a href="'.$commit->web_url.'">'.$commit->short_id.'</a> '.$title;
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
static function format_commit_stats($atts, $commits_count, $branch) {
|
||||
$out = '';
|
||||
|
||||
if($commits_count==0) {
|
||||
$out .=
|
||||
__('No commits', 'linuxfoo-gitlab').
|
||||
(is_null($branch) ? '' : ' '.__('in branch', 'linuxfoo-gitlab').' "'.$branch.'"').
|
||||
(is_null($atts['since']) ? '' : ' '.('since '.$atts['since'].' ago')).'.';
|
||||
}
|
||||
else {
|
||||
$out .=
|
||||
return
|
||||
(
|
||||
($commits_count==0)
|
||||
? __('No commits', 'linuxfoo-gitlab')
|
||||
/* translators: %d: maximum number of commits displayed */
|
||||
sprintf(__('Last %d commits', 'linuxfoo-gitlab'), $commits_count).
|
||||
: sprintf(__('Last %d commits', 'linuxfoo-gitlab'), $commits_count)
|
||||
).
|
||||
(is_null($branch) ? '' : ' '.__('in branch', 'linuxfoo-gitlab').' "'.$branch.'"').
|
||||
(is_null($atts['since']) ? '' : ' '.self::format_since($atts['since'])).':';
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
static function commits_list($atts, $project_url) {
|
||||
$since = null;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user