Converts shorthand urls to absolute urls.If the url is already absolute or protocol-relative, no change is made.
<?php
$r = preg_replace_callback(
'/(?<![=\/"\'])((ht|f)tps?:\/\/[^\s\r\n\t<>"\']+)/i',
create_function(
'$matches',
'
$url = $matches[1];
$punc = "";
$last = substr($url, -1, 1);
if (in_array($last, array(".", "!", ",", "(", ")"))) {
$punc = $last;
$url = rtrim($url, ".!,()");
}
$urltext = str_replace("/", "/<wbr />", $url);
return "<a href=\"$url\" rel=\"nofollow\">$urltext</a>$punc";
'
}
}
if ($string_length <= $num_chars) {
}
if ($space === false) {
$space = $num_chars;
}
$excerpt .= '...';
}
return $excerpt;
}
return preg_replace(
'/&(?!amp;)/',
'&',
$url);
}
return '';
}
}
}
foreach (
$attrs as $attr => $val) {
$attr = strtolower($attr);
if ($val === true) {
$val = $attr;
}
if ($val !== NULL && $val !== false && (is_array($val) || !is_object($val))) {
if (is_array($val)) {
$val = implode(' ', $val);
}
$val = htmlspecialchars($val, ENT_QUOTES, 'UTF-8', false);
}
}
}
if (!is_string($tag_name)) {
throw new InvalidArgumentException('$tag_name is required');
}
} else {
$is_void = in_array(strtolower($tag_name), array(
'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem',
'meta', 'param', 'source', 'track', 'wbr'
));
}
$double_encode = empty(
$options[
'double_encode']) ? false :
true;
$text = htmlspecialchars(
$text, ENT_QUOTES,
'UTF-8', $double_encode);
}
}
} else {
}
if ($is_void) {
return empty(
$options[
'is_xml']) ?
"<{$tag_name}{$attrs}>" :
"<{$tag_name}{$attrs} />";
} else {
return "<{$tag_name}{$attrs}>$text</$tag_name>";
}
}
if (isset(
$vars[
'internalname'])) {
if (!isset(
$vars[
'__ignoreInternalname'])) {
}
unset(
$vars[
'internalname']);
}
if (isset(
$vars[
'internalid'])) {
if (!isset(
$vars[
'__ignoreInternalid'])) {
}
unset(
$vars[
'internalid']);
}
if (isset(
$vars[
'__ignoreInternalid'])) {
unset(
$vars[
'__ignoreInternalid']);
}
if (isset(
$vars[
'__ignoreInternalname'])) {
unset(
$vars[
'__ignoreInternalname']);
}
}
$php_5_2_13_and_below = version_compare(PHP_VERSION, '5.2.14', '<');
$php_5_3_0_to_5_3_2 = version_compare(PHP_VERSION, '5.3.0', '>=') &&
version_compare(PHP_VERSION, '5.3.3', '<');
if ($php_5_2_13_and_below || $php_5_3_0_to_5_3_2) {
$tmp_address = str_replace(
"-",
"",
$url);
$validated = filter_var($tmp_address, FILTER_VALIDATE_URL);
} else {
$validated = filter_var(
$url, FILTER_VALIDATE_URL);
}
if (!$validated && (strpos(
$url,
'http:') === 0) || (strpos(
$url,
'https:') === 0)) {
$validated = true;
}
if ($validated) {
} elseif (preg_match(
"#^(\#|\?|//)#i",
$url)) {
} elseif (stripos(
$url,
'javascript:') === 0 || stripos(
$url,
'mailto:') === 0) {
} elseif (preg_match(
"#^[^/]*\.php(\?.*)?$#i",
$url)) {
} elseif (preg_match(
"#^[^/?]*\.#i",
$url)) {
return "http://$url";
} else {
}
}
}
}
if (!$current_time) {
$current_time = time();
}
$params = array(
'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}", array($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;
}
}
$params[
'allowable_tags'] = $allowable_tags;
}
array('>', '<', '&', '"', '''),
array('&gt;', '&lt;', '&amp;', '&quot;', '&#039;'),
);
array('&gt;', '&lt;', '&amp;', '&quot;', '&#039;'),
array('>', '<', '&', '"', '''),
);
}
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);
}
$value[] =
"{$CONFIG->path}engine/tests/ElggCoreOutputAutoPTest.php";
}
}
static urlize($string, $separator='-')
Create a version of a string for embedding in a URL.
elgg_get_site_url($site_guid=0)
Get the URL for the current (or specified) site.
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
Register a callback as a plugin hook handler.
elgg_register_event_handler($event, $object_type, $callback, $priority=500)
Register a callback as an Elgg event handler.
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
Trigger a Plugin Hook and run all handler callbacks registered to that hook:type.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Sends a notice about deprecated use of a function, view, etc.
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
elgg_substr()
Wrapper function for mb_substr().
elgg_strrpos()
Wrapper function for mb_strrpos().
elgg_strlen()
Wrapper function for mb_strlen().
elgg_format_url($url)
Handles formatting of ampersands in urls.
elgg_get_friendly_title($title)
When given a title, returns a version suitable for inclusion in a URL.
_elgg_html_decode($string)
Apply html_entity_decode() to a string while re-entitising HTML special char entities to prevent them...
_elgg_clean_vars(array $vars=array())
Preps an associative array for use in elgg_format_attributes().
elgg_strip_tags($string, $allowable_tags=null)
Strip tags and offer plugins the chance.
elgg_get_friendly_upload_error($error_code)
Returns a human-readable message for PHP's upload error codes.
_elgg_output_init()
Initialize the output subsystem.
elgg_format_attributes(array $attrs=array())
Converts an associative array into a string of well-formed attributes.
_elgg_get_display_query($string)
Prepares query string for output to prevent CSRF attacks.
elgg_format_element($tag_name, array $attributes=array(), $text='', array $options=array())
Format an HTML element.
elgg_get_excerpt($text, $num_chars=250)
Returns an excerpt.
parse_urls($text)
Takes a string and turns any URLs into formatted links.
_elgg_output_unit_test($hook, $type, $value, $params)
Unit tests for Output.
elgg_get_friendly_time($time, $current_time=null)
Formats a UNIX timestamp in a friendly way (eg "less than a minute ago")
elgg_autop($string)
Create paragraphs from text with line spacing.
if(file_exists($welcome)) $vars