00001 <?php
00016 $url = elgg_extract('href', $vars, null);
00017 if (!$url and isset($vars['value'])) {
00018 $url = trim($vars['value']);
00019 unset($vars['value']);
00020 }
00021
00022 if (isset($vars['text'])) {
00023 if (elgg_extract('encode_text', $vars, false)) {
00024 $text = htmlspecialchars($vars['text'], ENT_QUOTES, 'UTF-8', false);
00025 } else {
00026 $text = $vars['text'];
00027 }
00028 unset($vars['text']);
00029 } else {
00030 $text = htmlspecialchars($url, ENT_QUOTES, 'UTF-8', false);
00031 }
00032
00033 unset($vars['encode_text']);
00034
00035 if ($url) {
00036 $url = elgg_normalize_url($url);
00037
00038 if (elgg_extract('is_action', $vars, false)) {
00039 $url = elgg_add_action_tokens_to_url($url, false);
00040 }
00041
00042 if (!elgg_extract('is_trusted', $vars, false)) {
00043 if (!isset($vars['rel'])) {
00044 $vars['rel'] = 'nofollow';
00045 $url = strip_tags($url);
00046 }
00047 }
00048
00049 $vars['href'] = $url;
00050 }
00051
00052 unset($vars['is_action']);
00053 unset($vars['is_trusted']);
00054
00055 $attributes = elgg_format_attributes($vars);
00056 echo "<a $attributes>$text</a>";