diff --git a/linuxfoo-gitlab.php b/linuxfoo-gitlab.php index 85b603c..fb31146 100644 --- a/linuxfoo-gitlab.php +++ b/linuxfoo-gitlab.php @@ -48,40 +48,28 @@ 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. ': '. ''.$commit->short_id.' '.$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; + return + ( + ($commits_count==0) + ? __('No commits', 'linuxfoo-gitlab') + /* 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'])).':'; } static function commits_list($atts, $project_url) {