Converts shorthand URLs to absolute URLs, unless the given URL is absolute, protocol-relative, or starts with a protocol/fragment/queryelgg_normalize_url(''); // 'http://my.site.com/' elgg_normalize_url('dashboard'); // 'http://my.site.com/dashboard' elgg_normalize_url('http://google.com/'); // no change elgg_normalize_url('//google.com/'); // no change
<?php
}
}
}
}
}
$view =
'output/excerpt';
];
}
}
return '0 B';
}
if ($precision < 0) {
$precision = 2;
}
$suffixes = ['B', 'kB', 'MB', 'GB', 'TB'];
return round(pow(1024, $base - floor($base)), $precision) . ' ' . $suffixes[floor($base)];
}
}
}
return $unsafe_url;
}
return null;
}
}
$title = html_entity_decode(
$title ??
'', ENT_QUOTES,
'UTF-8');
return \Elgg\Translit::urlize(
$title);
}
if (!isset($current_time)) {
$current_time = time();
}
$params = [
'time' =>
$time,
'current_time' => $current_time];
}
$diff = abs($current_time -
$time);
$minute = 60;
$hour = $minute * 60;
$day = $hour * 24;
if ($diff < $minute) {
}
if ($diff < $hour) {
$granularity = ':minutes';
$diff = round($diff / $minute);
} else if ($diff < $day) {
$granularity = ':hours';
$diff = round($diff / $hour);
} else {
$granularity = ':days';
$diff = round($diff / $day);
}
if ($diff == 0) {
$diff = 1;
}
$future = ($current_time -
$time < 0) ?
':future' :
'';
$singular = ($diff == 1) ? ':singular' : '';
return elgg_echo(
"friendlytime{$future}{$granularity}{$singular}", [$diff]);
}
switch ($error_code) {
case UPLOAD_ERR_OK:
return '';
case UPLOAD_ERR_INI_SIZE:
break;
case UPLOAD_ERR_FORM_SIZE:
break;
case UPLOAD_ERR_PARTIAL:
break;
case UPLOAD_ERR_NO_FILE:
break;
case UPLOAD_ERR_NO_TMP_DIR:
break;
case UPLOAD_ERR_CANT_WRITE:
break;
case UPLOAD_ERR_EXTENSION:
break;
default:
break;
}
}
function elgg_strip_tags(
string $string,
string $allowable_tags = null):
string {
return _elgg_services()->html_formatter->stripTags($string, $allowable_tags);
}
}
if (empty($string)) {
return $string;
}
$string = htmlentities($string, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, 'UTF-8');
return htmlspecialchars($string, ENT_QUOTES, 'UTF-8', false);
}