84 $view =
'output/excerpt';
105 return (
string)
$size;
108 $precision = (int) $precision;
109 if ($precision < 0) {
113 $base =
log($size) /
log(1024);
114 $suffixes = [
'B',
'kB',
'MB',
'GB',
'TB'];
116 return round(pow(1024, $base - floor($base)), $precision) .
' ' . $suffixes[floor($base)];
198 $title = html_entity_decode($title ??
'', ENT_QUOTES,
'UTF-8');
219 if (!isset($current_time)) {
220 $current_time = time();
224 $params = [
'time' =>
$time,
'current_time' => $current_time];
230 $diff = abs($current_time - $time);
233 $hour = $minute * 60;
236 if ($diff < $minute) {
237 return elgg_echo(
'friendlytime:justnow');
241 $granularity =
':minutes';
242 $diff = round($diff / $minute);
243 }
else if ($diff < $day) {
244 $granularity =
':hours';
245 $diff = round($diff / $hour);
247 $granularity =
':days';
248 $diff = round($diff / $day);
255 $future = ($current_time - $time < 0) ?
':future' :
'';
256 $singular = ($diff == 1) ?
':singular' :
'';
258 return elgg_echo(
"friendlytime{$future}{$granularity}{$singular}", [$diff]);
269 switch ($error_code) {
273 case UPLOAD_ERR_INI_SIZE:
277 case UPLOAD_ERR_FORM_SIZE:
281 case UPLOAD_ERR_PARTIAL:
285 case UPLOAD_ERR_NO_FILE:
289 case UPLOAD_ERR_NO_TMP_DIR:
293 case UPLOAD_ERR_CANT_WRITE:
297 case UPLOAD_ERR_EXTENSION:
320 return _elgg_services()->html_formatter->stripTags($string, $allowable_tags);
363 if (empty($string)) {
367 $string = htmlentities($string, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401,
'UTF-8');
369 return htmlspecialchars($string, ENT_QUOTES,
'UTF-8',
false);
elgg_format_bytes(int $size, int $precision=2)
Format bytes to a human readable format.
elgg_get_friendly_time(int $time, int $current_time=null)
Formats a UNIX timestamp in a friendly way (eg "less than a minute ago")
$params
Saves global plugin settings.
_elgg_get_display_query(string $string)
Prepares query string for output to prevent CSRF attacks.
elgg_normalize_site_url(string $unsafe_url)
From untrusted input, get a site URL safe for forwarding.
elgg_get_excerpt(string $text, int $num_chars=250)
Returns an excerpt.
elgg_parse_mentions(string $text)
Takes a string and turns any @ mentions into formatted links.
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
if(!$annotation instanceof ElggAnnotation) $time
elgg_trigger_event_results(string $event, string $type, array $params=[], $returnvalue=null)
Triggers an event where it is expected that the mixed return value could be manipulated by event call...
elgg_parse_emails(string $text)
Takes a string and turns any email addresses into formatted links.
elgg_parse_urls(string $text)
Takes a string and turns any URLs into formatted links.
elgg_format_html(string $html, array $options=[])
Output functions Processing text for output such as pulling out URLs and extracting excerpts...
if(!empty($avatar)&&!$avatar->isValid()) elseif(empty($avatar)) if(!$owner->saveIconFromUploadedFile('avatar')) if(!elgg_trigger_event('profileiconupdate', $owner->type, $owner)) $view
elgg_get_friendly_title(string $title)
When given a title, returns a version suitable for inclusion in a URL.
elgg_strpos()
Wrapper function for mb_strpos().
static urlize($string, $separator= '-')
Create a version of a string for embedding in a URL.
elgg_get_friendly_upload_error(int $error_code)
Returns a human-readable message for PHP's upload error codes.
elgg_get_site_url()
Get the URL for the current (or specified) site, ending with "/".
if($container instanceof ElggGroup &&$container->guid!=elgg_get_page_owner_guid()) $key
log($level, $message, array $context=[])
Log a message.
elgg_substr()
Wrapper function for mb_substr().
elgg_autop(string $string)
Create paragraphs from text with line spacing.
foreach($plugin_guids as $guid) if(empty($deactivated_plugins)) $url
_elgg_services()
Get the global service provider.
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
elgg_normalize_url(string $url)
_elgg_view_under_viewtype(string $view, array $vars, string $viewtype)
Render a view while the global viewtype is temporarily changed.
$attributes
Elgg AJAX loader.
elgg_view_exists(string $view, string $viewtype= '', bool $recurse=true)
Returns whether the specified view exists.
elgg_html_decode(string $string)
Decode HTML markup into a raw text string.
elgg_strip_tags(string $string, string $allowable_tags=null)
Strip tags and offer plugins the chance.