tags
* @uses string $vars['text'] The string between the tags.
* @uses bool $vars['target'] Set the target="" attribute.
* @uses string $vars['class'] what to add in class=""
* @uses string $vars['js'] Javascript to insert in tag
* @uses bool $vars['is_action'] Is this a link to an action?
*
*/
$url = trim($vars['href']);
if (!empty($url)) {
if ((substr_count($url, "http://") == 0) && (substr_count($url, "https://") == 0)) {
$url = "http://" . $url;
}
if (array_key_exists('is_action', $vars) && $vars['is_action']) {
$url = elgg_add_action_tokens_to_url($url);
}
if (array_key_exists('target', $vars) && $vars['target']) {
$target = "target = \"{$vars['target']}\"";
} else {
$target = '';
}
if (array_key_exists('class', $vars) && $vars['class']) {
$class = "class = \"{$vars['class']}\"";
} else {
$class = '';
}
if (array_key_exists('js', $vars) && $vars['js']) {
$js = "{$vars['target']}";
} else {
$js = '';
}
if (array_key_exists('text', $vars) && $vars['text']) {
$text = htmlentities($vars['text'], ENT_QUOTES, 'UTF-8');
} else {
$text = htmlentities($url, ENT_QUOTES, 'UTF-8');
}
echo "$text";
}