diff --git a/snippet.php b/snippet.php new file mode 100644 index 0000000..c3fff47 --- /dev/null +++ b/snippet.php @@ -0,0 +1,86 @@ +diff($ago); + + $diff->w = floor($diff->d / 7); + $diff->d -= $diff->w * 7; + + $string = array( + 'y' => 'Jahr', + 'm' => 'Monat', + 'w' => 'Woche', + 'd' => 'Tag', + 'h' => 'Stunde', + 'i' => 'Minute', + 's' => 'Sekunde', + ); + foreach ($string as $k => &$v) { + if ($diff->$k) { + //you won't need $pc ('plural character') if you i.e. just need to add an "s" because you deal with the English language + $pc = (($v == 'Jahr' || $v == 'Monat' || $v == 'Tag') ? 'en' : 'n'); + $v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? $pc : ''); + } else { + unset($string[$k]); + } + } + if (!$full) $string = array_slice($string, 0, 1); + return $string ? implode(', ', $string) . '' : 'Gerade eben'; + } + + //list the repositories + for($i = 0; $i < count($entries); $i++){ + echo("

" . $entries[$i]['name'] . "

" . "\n"); + echo("Zuletzt bearbeitet vor " . time_elapsed_string($entries[$i]['updated_at']) . " · Erstellt vor " . time_elapsed_string($entries[$i]['created_at']) . "
\n"); + if($entries[$i]['description'] != '') echo($entries[$i]['description'] . "
\n"); + if($entries[$i]['website'] != '') echo("Link zur Website
\n"); + echo("
\n"); + } + ?> + + +
+ 1){ + ?> +
+ \ No newline at end of file