Elgg
Version 1.9
views
default
output
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
) {
36
$url
=
elgg_normalize_url
(
$url
);
37
38
if
(
elgg_extract
(
'is_action'
,
$vars
,
false
)) {
39
$url
=
elgg_add_action_tokens_to_url
(
$url
,
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
55
$attributes
=
elgg_format_attributes
(
$vars
);
56
echo
"<a $attributes>$text</a>"
;
$text
$text
Definition:
default.php:25
$vars
$vars
Definition:
url.php:25
$url
$url
Definition:
url.php:16
$attributes
$attributes
Definition:
url.php:55
elgg_extract
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
elgg_add_action_tokens_to_url
elgg_add_action_tokens_to_url($url, $html_encode=false)
Adds action tokens to URL.
Definition:
elgglib.php:1277
elgg_format_attributes
elgg_format_attributes(array $attrs=array())
Converts an associative array into a string of well-formed attributes.
Definition:
output.php:118
elgg_normalize_url
elgg_normalize_url($url)
Definition:
output.php:290
Generated on Fri Aug 29 2025 00:00:30 for Elgg by
1.9.1