5 use DateTime as PHPDateTime;
64 return self::normalizeTime(
$time)->getTimestamp();
80 $dt =
new ElggDateTime(
$time->format(PHPDateTime::RFC3339_EXTENDED));
82 $dt =
new ElggDateTime();
87 $dt =
new ElggDateTime();
89 }
catch (\Exception $e) {
110 foreach (
$args as $arg) {
115 if (is_object($arg) && isset($arg->id)) {
116 $ids[] = (int) $arg->id;
117 }
elseif (is_array($arg)) {
118 foreach ($arg as $a) {
119 $el_ids = self::normalizeIds($a);
120 $ids = array_merge($ids, $el_ids);
122 }
elseif (is_numeric($arg)) {
125 $arg = print_r($arg,
true);
130 return array_unique($ids);
147 foreach (
$args as $arg) {
152 if (is_object($arg) && isset($arg->guid)) {
153 $guids[] = (int) $arg->guid;
154 }
elseif (is_array($arg)) {
155 foreach ($arg as $a) {
156 $el_guids = self::normalizeGuids($a);
159 }
elseif (is_numeric($arg)) {
162 $arg = print_r($arg,
true);
167 return array_unique(
$guids);
179 return [ViewsService::OUTPUT_KEY =>
''];
213 if ($n < 1000 || !is_numeric($n)) {
217 $decimal_separator =
substr(
elgg_echo(
'number_counter:decimal_separator'), 0, 1);
218 $thousands_separator =
substr(
elgg_echo(
'number_counter:thousands_separator'), 0, 1);
222 $n = number_format($n / 1000, $precision, $decimal_separator, $thousands_separator);
223 $text_key =
'number_counter:view:thousand';
224 }
else if ($n < 1000000000) {
226 $n = number_format($n / 1000000, $precision, $decimal_separator, $thousands_separator);
227 $text_key =
'number_counter:view:million';
228 }
else if ($n < 1000000000000) {
230 $n = number_format($n / 1000000000, $precision, $decimal_separator, $thousands_separator);
231 $text_key =
'number_counter:view:billion';
234 $n = number_format($n / 1000000000000, $precision, $decimal_separator, $thousands_separator);
235 $text_key =
'number_counter:view:trillion';
238 if (stristr($n, $decimal_separator) !==
false) {
240 $parts = explode($decimal_separator, $n);
241 $parts[1] =
rtrim($parts[1], 0);
243 $n =
implode($decimal_separator, array_filter($parts));
static normalizeGuids(...$args)
Flatten an array of data into an array of GUIDs.
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
if(!$annotation instanceof ElggAnnotation) $time
$args
Some servers don't allow PHP to check the rewrite, so try via AJAX.
static isEmpty($value)
Check if a value isn't empty, but allow 0 and '0'.
static getNull()
Return null.
if($item instanceof\ElggEntity) elseif($item instanceof\ElggRiverItem) elseif($item instanceof\ElggRelationship) elseif(is_callable([$item, 'getType']))
static getFalse()
Return false.
static normalizeTimestamp($time)
Returns timestamp value of the time representation.
static shortFormatOutput($n, $precision=0)
Use to convert large positive numbers in to short form like 1K, 1M, 1B or 1T Example: shortFormatOutp...
static preventViewOutput()
Return array with __view_output set to prevent view output during view_vars event.
static normalizeIds(...$args)
Prepare IDs.
static getTrue()
Return true.
const ELGG_ENTITIES_ANY_VALUE
Constant to request the value of a parameter be ignored in elgg_get_*() functions.
$guids
Activates all specified installed and inactive plugins.
Functions for use as event handlers or other situations where you need a globally accessible callable...
static getArray()
Return empty array.
static normalizeTime($time)
Returns DateTime object based on time representation.