84 $view =
'output/excerpt';
105 return (
string)
$size;
112 if ($precision < 0) {
116 $base =
log($size) /
log(1024);
117 $suffixes = [
'B',
'kB',
'MB',
'GB',
'TB'];
119 return round(pow(1024, $base - floor($base)), $precision) .
' ' . $suffixes[floor($base)];
201 $title = html_entity_decode($title ??
'', ENT_QUOTES,
'UTF-8');
207 return \Elgg\Translit::urlize($title);
223 if (!isset($current_time)) {
224 $current_time = time();
228 $params = [
'time' =>
$time,
'current_time' => $current_time];
234 $diff = abs($current_time - $time);
237 $hour = $minute * 60;
240 if ($diff < $minute) {
241 return elgg_echo(
'friendlytime:justnow');
245 $granularity =
':minutes';
246 $diff = round($diff / $minute);
247 }
else if ($diff < $day) {
248 $granularity =
':hours';
249 $diff = round($diff / $hour);
251 $granularity =
':days';
252 $diff = round($diff / $day);
259 $future = ($current_time - $time < 0) ?
':future' :
'';
260 $singular = ($diff == 1) ?
':singular' :
'';
262 return elgg_echo(
"friendlytime{$future}{$granularity}{$singular}", [$diff]);
273 switch ($error_code) {
277 case UPLOAD_ERR_INI_SIZE:
281 case UPLOAD_ERR_FORM_SIZE:
285 case UPLOAD_ERR_PARTIAL:
289 case UPLOAD_ERR_NO_FILE:
293 case UPLOAD_ERR_NO_TMP_DIR:
297 case UPLOAD_ERR_CANT_WRITE:
301 case UPLOAD_ERR_EXTENSION:
324 return _elgg_services()->html_formatter->stripTags($string, $allowable_tags);
367 if (empty($string)) {
371 $string = htmlentities($string, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401,
'UTF-8');
373 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.
$html
A wrapper to render a section of the page shell.
if($who_can_change_language=== 'nobody') elseif($who_can_change_language=== 'admin_only'&&!elgg_is_admin_logged_in()) $options
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().
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.