73 $view =
'output/excerpt';
98 $precision = (int) $precision;
104 $suffixes = [
'B',
'kB',
'MB',
'GB',
'TB'];
106 return round(pow(1024, $base - floor($base)), $precision) .
' ' . $suffixes[floor($base)];
167 if (!is_string($unsafe_url)) {
171 $unsafe_url =
_elgg_services()->urls->normalizeUrl((
string) $unsafe_url);
197 $title = html_entity_decode(
$title ??
'', ENT_QUOTES,
'UTF-8');
218 if (!isset($current_time)) {
219 $current_time = time();
223 $params = [
'time' =>
$time,
'current_time' => $current_time];
229 $diff = abs((
int) $current_time - (
int)
$time);
232 $hour = $minute * 60;
235 if ($diff < $minute) {
236 return elgg_echo(
"friendlytime:justnow");
240 $granularity =
':minutes';
241 $diff = round($diff / $minute);
242 }
else if ($diff < $day) {
243 $granularity =
':hours';
244 $diff = round($diff / $hour);
246 $granularity =
':days';
247 $diff = round($diff / $day);
254 $future = ((int) $current_time - (
int) $time < 0) ?
':future' :
'';
255 $singular = ($diff == 1) ?
':singular' :
'';
257 return elgg_echo(
"friendlytime{$future}{$granularity}{$singular}", [$diff]);
267 switch ($error_code) {
271 case UPLOAD_ERR_INI_SIZE:
275 case UPLOAD_ERR_FORM_SIZE:
279 case UPLOAD_ERR_PARTIAL:
283 case UPLOAD_ERR_NO_FILE:
287 case UPLOAD_ERR_NO_TMP_DIR:
291 case UPLOAD_ERR_CANT_WRITE:
295 case UPLOAD_ERR_EXTENSION:
318 return _elgg_services()->html_formatter->stripTags($string, $allowable_tags);
362 if (empty($string)) {
367 if (function_exists(
'mb_convert_encoding')) {
368 $display_query = mb_convert_encoding($string,
'HTML-ENTITIES',
'UTF-8');
371 $display_query = preg_replace(
"/[^\x01-\x7F]/",
"", $string);
374 return htmlspecialchars($display_query, ENT_QUOTES,
'UTF-8',
false);
elgg_view_exists($view, $viewtype= '', $recurse=true)
Returns whether the specified view exists.
elgg_format_html($html, array $options=[])
Output functions Processing text for output such as pulling out URLs and extracting excerpts...
$params
Saves global plugin settings.
elgg_html_decode($string)
Decode HTML markup into a raw text string.
elgg_strip_tags($string, $allowable_tags=null)
Strip tags and offer plugins the chance.
elgg_normalize_site_url($unsafe_url)
From untrusted input, get a site URL safe for forwarding.
_elgg_get_display_query($string)
Prepares query string for output to prevent CSRF attacks.
if(!$annotation instanceof ElggAnnotation) $time
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
elgg_parse_urls(string $text)
Takes a string and turns any URLs into formatted links.
elgg_get_friendly_upload_error($error_code)
Returns a human-readable message for PHP's upload error codes.
elgg_autop($string)
Create paragraphs from text with line spacing.
if(!empty($avatar)&&!$avatar->isValid()) elseif(empty($avatar)) if(!$owner->saveIconFromUploadedFile('avatar')) if(!elgg_trigger_event('profileiconupdate', $owner->type, $owner)) $view
elgg_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
elgg_strpos()
Wrapper function for mb_strpos().
static urlize($string, $separator= '-')
Create a version of a string for embedding in a URL.
elgg_parse_emails($text)
Takes a string and turns any email addresses into formatted links.
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
elgg_format_bytes($size, $precision=2)
Format bytes to a human readable format.
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_get_friendly_time($time, $current_time=null)
Formats a UNIX timestamp in a friendly way (eg "less than a minute ago")
elgg_get_excerpt($text, $num_chars=250)
Returns an excerpt.
foreach($plugin_guids as $guid) if(empty($deactivated_plugins)) $url
_elgg_services()
Get the global service provider.
elgg_get_friendly_title($title)
When given a title, returns a version suitable for inclusion in a URL.
_elgg_view_under_viewtype($view, $vars, $viewtype)
Render a view while the global viewtype is temporarily changed.
$attributes
Elgg AJAX loader.