forked from tk-sls.de/linuxfoo-gitlab
include .mo file
This commit is contained in:
@ -47,6 +47,43 @@ class LinuxfooGitlab {
|
||||
return sprintf(__('since %d %s ago', 'linuxfoo-gitlab'), $num, $unit);
|
||||
}
|
||||
|
||||
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 .=
|
||||
$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 .=
|
||||
/* 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) {
|
||||
$since = null;
|
||||
|
||||
@ -99,37 +136,18 @@ class LinuxfooGitlab {
|
||||
else {
|
||||
$commits_count = count($commits);
|
||||
$commits_count = is_null($atts['max']) ? $commits_count : min($commits_count, $atts['max']);
|
||||
|
||||
$commits = array_slice($commits, 0, $commits_count);
|
||||
|
||||
if($commits_count==0) {
|
||||
$out .=
|
||||
'<span class="stats">'.
|
||||
__('No commits', 'linuxfoo-gitlab').
|
||||
(is_null($branch) ? '' : ' '.__('in branch', 'linuxfoo-gitlab').' "'.$branch.'"').
|
||||
(is_null($atts['since']) ? '' : ' '.('since '.$atts['since'].' ago')).'.'.
|
||||
'</span>';
|
||||
}
|
||||
else {
|
||||
$out .=
|
||||
'<span class="stats">'.
|
||||
/* 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'])).':'.
|
||||
'</span>'.
|
||||
'<ul class="commits">';
|
||||
$out .=
|
||||
'<span class="stats">'.
|
||||
self::format_commit_stats($atts, $commits_count, $branch).
|
||||
'</span>';
|
||||
|
||||
if($commits_count>0) {
|
||||
$out .= '<ul class="commits">';
|
||||
|
||||
foreach($commits as $commit) {
|
||||
preg_match('/^....-..-../', $commit->committed_date, $m);
|
||||
$date = $m[0];
|
||||
|
||||
$title = htmlspecialchars($commit->title, ENT_NOQUOTES|ENT_HTML5|ENT_SUBSTITUTE, 'UTF-8', FALSE);
|
||||
|
||||
$out .=
|
||||
'<li>'.
|
||||
$date.': <a href="'.$commit->web_url.'">'.$commit->short_id.'</a> '.$title.
|
||||
'</li>';
|
||||
$out .= '<li>'.self::format_commit($atts, $commit).'</li>';
|
||||
}
|
||||
|
||||
$out .= '</ul>';
|
||||
|
Reference in New Issue
Block a user