use_autodate option
This commit is contained in:
parent
8e2b5d7c1e
commit
685d079da8
@ -96,12 +96,15 @@ function to_shorthand_int($int) {
|
||||
* @retval string
|
||||
*/
|
||||
function autodate($date) {
|
||||
$diff = time() - strtotime($date);
|
||||
if ($diff<60) return $diff . " second" . plural($diff) . " ago"; $diff = round($diff/60);
|
||||
if ($diff<60) return $diff . " minute" . plural($diff) . " ago"; $diff = round($diff/60);
|
||||
if ($diff<24) return $diff . " hour" . plural($diff) . " ago"; $diff = round($diff/24);
|
||||
if ($diff<7) return $diff . " day" . plural($diff) . " ago"; $diff = round($diff/7);
|
||||
if ($diff<4) return $diff . " week" . plural($diff) . " ago";
|
||||
global $config;
|
||||
if($config->get_bool('use_autodate', true)) {
|
||||
$diff = time() - strtotime($date);
|
||||
if ($diff<60) return $diff . " second" . plural($diff) . " ago"; $diff = round($diff/60);
|
||||
if ($diff<60) return $diff . " minute" . plural($diff) . " ago"; $diff = round($diff/60);
|
||||
if ($diff<24) return $diff . " hour" . plural($diff) . " ago"; $diff = round($diff/24);
|
||||
if ($diff<7) return $diff . " day" . plural($diff) . " ago"; $diff = round($diff/7);
|
||||
if ($diff<4) return $diff . " week" . plural($diff) . " ago";
|
||||
}
|
||||
return "on " . date("F j, Y", strtotime($date));
|
||||
}
|
||||
|
||||
|
@ -163,6 +163,7 @@ class Setup extends SimpleExtension {
|
||||
$config->set_default_string("main_page", "post/list");
|
||||
$config->set_default_string("base_href", "./index.php?q=");
|
||||
$config->set_default_string("theme", "default");
|
||||
$config->set_default_bool("use_autodate", true);
|
||||
}
|
||||
|
||||
public function onPageRequest($event) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user