75 $view =
'output/excerpt';
100 $precision = (int) $precision;
101 if ($precision < 0) {
106 $suffixes = [
'B',
'kB',
'MB',
'GB',
'TB'];
108 return round(pow(1024, $base - floor($base)), $precision) .
' ' . $suffixes[floor($base)];
187 $url = str_replace(
' ',
'%20',
$url);
192 $protocol_less_site_url = rtrim($protocol_less_site_url,
'/');
193 $protocol_less_site_url = str_replace(
'/',
'\/', $protocol_less_site_url);
198 if (preg_match(
"#^([a-z]+)\\:#",
$url, $m)) {
201 if ($m[1] !==
'http' && $m[1] !==
'https') {
206 if (preg_match(
"#^(\\#|\\?|//)#",
$url)) {
211 if (preg_match(
"#^[^/]*\\.php(\\?.*)?$#",
$url)) {
217 if (preg_match(
"#^[^/?]*\\.#",
$url)) {
219 return "http://$url";
238 if (!is_string($unsafe_url)) {
268 $title = html_entity_decode(
$title, ENT_QUOTES,
'UTF-8');
288 if (!isset($current_time)) {
289 $current_time = time();
293 $params = [
'time' =>
$time,
'current_time' => $current_time];
299 $diff = abs((
int) $current_time - (
int)
$time);
302 $hour = $minute * 60;
305 if ($diff < $minute) {
306 return elgg_echo(
"friendlytime:justnow");
310 $granularity =
':minutes';
311 $diff = round($diff / $minute);
312 }
else if ($diff < $day) {
313 $granularity =
':hours';
314 $diff = round($diff / $hour);
316 $granularity =
':days';
317 $diff = round($diff / $day);
324 $future = ((int) $current_time - (
int) $time < 0) ?
':future' :
'';
325 $singular = ($diff == 1) ?
':singular' :
'';
327 return elgg_echo(
"friendlytime{$future}{$granularity}{$singular}", [$diff]);
337 switch ($error_code) {
341 case UPLOAD_ERR_INI_SIZE:
345 case UPLOAD_ERR_FORM_SIZE:
349 case UPLOAD_ERR_PARTIAL:
353 case UPLOAD_ERR_NO_FILE:
357 case UPLOAD_ERR_NO_TMP_DIR:
361 case UPLOAD_ERR_CANT_WRITE:
365 case UPLOAD_ERR_EXTENSION:
389 return _elgg_services()->html_formatter->stripTags($string, $allowable_tags);
433 if (function_exists(
'mb_convert_encoding')) {
434 $display_query = mb_convert_encoding($string,
'HTML-ENTITIES',
'UTF-8');
437 $display_query = preg_replace(
"/[^\x01-\x7F]/",
"", $string);
439 return htmlspecialchars($display_query, ENT_QUOTES,
'UTF-8',
false);
451 $res = filter_var(
$url, FILTER_VALIDATE_URL);
458 if (strlen(
$url) == $l) {
464 for ($i = 0; $i < $l; ++$i) {
466 $s .= (strlen($ch) > 1) ?
'X' : $ch;
470 return filter_var($s, FILTER_VALIDATE_URL) ?
$url :
false;
elgg_view_exists($view, $viewtype= '', $recurse=true)
Returns whether the specified view exists.
elgg_format_html($html, array $options=[])
Prepare HTML output.
log($msg, $level=LogLevel::NOTICE)
Log a message.
elgg_format_attributes(array $attrs=[])
Converts an associative array into a string of well-formed HTML/XML attributes Returns a concatenated...
$params
Saves global plugin settings.
parse_urls($text)
Takes a string and turns any URLs into formatted links.
_elgg_sane_validate_url($url)
Use a "fixed" filter_var() with FILTER_VALIDATE_URL that handles multi-byte chars.
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.
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
elgg_get_friendly_upload_error($error_code)
Returns a human-readable message for PHP's upload error codes.
elgg_strlen()
Wrapper function for mb_strlen().
if(!$owner||!$owner->canEdit()) if(!$owner->hasIcon('master')) if(!$owner->saveIconFromElggFile($owner->getIcon('master'), 'icon', $coords)) $view
elgg_autop($string)
Create paragraphs from text with line spacing.
if(!$entity instanceof ElggEntity) $time
elgg_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
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
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.
if(elgg_extract('hidden', $vars, true)) $attrs
_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.