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