blob: 532790a38870c14a8c9e6640a39440f99f240efe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<?php
/**
* Elgg confirmation link
* A link that displays a confirmation dialog before it executes
*
* @package Elgg
* @subpackage Core
*
* @uses $vars['text'] The text of the link
* @uses $vars['href'] The address
* @uses $vars['title'] The title text (defaults to confirm text)
* @uses $vars['confirm'] The dialog text
* @uses $vars['encode_text'] Run $vars['text'] through htmlspecialchars() (false)
*/
$vars['rel'] = elgg_extract('confirm', $vars, elgg_echo('question:areyousure'));
$vars['rel'] = addslashes($vars['rel']);
$encode = elgg_extract('encode_text', $vars, false);
// always generate missing action tokens
$vars['href'] = elgg_add_action_tokens_to_url(elgg_normalize_url($vars['href']), true);
$text = elgg_extract('text', $vars, '');
if ($encode) {
$text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8', false);
}
if (!isset($vars['title']) && isset($vars['confirm'])) {
$vars['title'] = $vars['rel'];
}
if (isset($vars['class'])) {
if (!is_array($vars['class'])) {
$vars['class'] = array($vars['class']);
}
$vars['class'][] = 'elgg-requires-confirmation';
} else {
$vars['class'] = 'elgg-requires-confirmation';
}
unset($vars['encode_text']);
unset($vars['text']);
unset($vars['confirm']);
unset($vars['is_trusted']);
$attributes = elgg_format_attributes($vars);
echo "<a $attributes>$text</a>";
|