Elgg  Version 3.0
friendlytime.php
Go to the documentation of this file.
1 <?php
10 use Elgg\Values;
11 
13 
14 try {
15  $date = Values::normalizeTime($timestamp);
16 } catch (DataFormatException $e) {
17  return;
18 }
19 
20 $default_friendly_time_number_of_days = elgg_get_config('friendly_time_number_of_days', 30);
22 
23 if (strtotime("-{$friendly_time_number_of_days}days") < $timestamp) {
25 } else {
26  $output = $date->formatLocale(elgg_echo('friendlytime:date_format:short'));
27 }
28 
30  'title' => $date->formatLocale(elgg_echo('friendlytime:date_format')),
31  'datetime' => $date->format('c'),
32 ];
33 
catch(DataFormatException $e) $default_friendly_time_number_of_days
catch(LoginException $e) if($request->isXhr()) $output
Definition: login.php:56
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
Definition: output.php:168
$timestamp
elgg echo
Translates a string.
Definition: languages.js:43
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1131
$friendly_time_number_of_days
elgg_get_friendly_time($time, $current_time=null)
Formats a UNIX timestamp in a friendly way (eg "less than a minute ago")
Definition: output.php:286
$attributes
$vars['type']
Definition: save.php:11
elgg_get_config($name, $default=null)
Get an Elgg configuration value.