Elgg  Version 1.9
url.php
Go to the documentation of this file.
1 <?php
16 $url = elgg_extract('href', $vars, null);
17 if (!$url and isset($vars['value'])) {
18  $url = trim($vars['value']);
19  unset($vars['value']);
20 }
21 
22 if (isset($vars['text'])) {
23  if (elgg_extract('encode_text', $vars, false)) {
24  $text = htmlspecialchars($vars['text'], ENT_QUOTES, 'UTF-8', false);
25  } else {
26  $text = $vars['text'];
27  }
28  unset($vars['text']);
29 } else {
30  $text = htmlspecialchars($url, ENT_QUOTES, 'UTF-8', false);
31 }
32 
33 unset($vars['encode_text']);
34 
35 if ($url) {
37 
38  if (elgg_extract('is_action', $vars, false)) {
40  }
41 
42  if (!elgg_extract('is_trusted', $vars, false)) {
43  if (!isset($vars['rel'])) {
44  $vars['rel'] = 'nofollow';
45  $url = strip_tags($url);
46  }
47  }
48 
49  $vars['href'] = $url;
50 }
51 
52 unset($vars['is_action']);
53 unset($vars['is_trusted']);
54 
56 echo "<a $attributes>$text</a>";
$attributes
Definition: url.php:55
elgg_add_action_tokens_to_url($url, $html_encode=false)
Adds action tokens to URL.
Definition: elgglib.php:1277
elgg_normalize_url($url)
Definition: output.php:290
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1464
$url
Definition: url.php:16
$text
Definition: default.php:25
elgg echo
Translates a string.
Definition: languages.js:43
elgg_format_attributes(array $attrs=array())
Converts an associative array into a string of well-formed attributes.
Definition: output.php:118
$vars
Definition: url.php:25