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 false;
}
$precision = (int) $precision;
if ($precision < 0) {
$precision = 2;
}
$suffixes = ['B', 'kB', 'MB', 'GB', 'TB'];
return round(pow(1024, $base - floor($base)), $precision) . ' ' . $suffixes[floor($base)];
}
}
}
$protocol_less_site_url = rtrim($protocol_less_site_url, '/');
$protocol_less_site_url = str_replace('/', '\/', $protocol_less_site_url);
}
if (preg_match(
"#^([a-z]+)\\:#",
$url, $m)) {
if ($m[1] !== 'http' && $m[1] !== 'https') {
}
}
if (preg_match(
"#^(\\#|\\?|//)#",
$url)) {
}
if (preg_match(
"#^[^/]*\\.php(\\?.*)?$#",
$url)) {
}
if (preg_match(
"#^[^/?]*\\.#",
$url)) {
return "http://$url";
}
}
if (!is_string($unsafe_url)) {
return false;
}
return $unsafe_url;
}
return false;
}
}
}
if (!isset($current_time)) {
$current_time = time();
}
$params = [
'time' =>
$time,
'current_time' => $current_time];
}
$diff = abs((
int) $current_time - (
int)
$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 = ((int) $current_time - (int) $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;
}
}
return _elgg_services()->html_formatter->stripTags($string, $allowable_tags);
}
}
if (function_exists('mb_convert_encoding')) {
$display_query = mb_convert_encoding($string, 'HTML-ENTITIES', 'UTF-8');
} else {
$display_query = preg_replace("/[^\x01-\x7F]/", "", $string);
}
return htmlspecialchars($display_query, ENT_QUOTES, 'UTF-8', false);
}
$res = filter_var(
$url, FILTER_VALIDATE_URL);
if ($res) {
return $res;
}
if (strlen(
$url) == $l) {
return $res;
}
$s = '';
for ($i = 0; $i < $l; ++$i) {
$s .= (strlen($ch) > 1) ? 'X' : $ch;
}
return filter_var($s, FILTER_VALIDATE_URL) ?
$url :
false;
}