aboutsummaryrefslogtreecommitdiff
path: root/views/default/output/confirmlink.php
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/output/confirmlink.php')
-rw-r--r--views/default/output/confirmlink.php33
1 files changed, 23 insertions, 10 deletions
diff --git a/views/default/output/confirmlink.php b/views/default/output/confirmlink.php
index 28facc26c..532790a38 100644
--- a/views/default/output/confirmlink.php
+++ b/views/default/output/confirmlink.php
@@ -6,29 +6,42 @@
* @package Elgg
* @subpackage Core
*
- * @uses $vars['text'] The text of the link
- * @uses $vars['href'] The address
- * @uses $vars['confirm'] The dialog text
- * @uses $vars['text_encode'] Encode special characters?
+ * @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)
*/
-$confirm = elgg_get_array_value('confirm', $vars, elgg_echo('question:areyousure'));
-
-$encode = elgg_get_array_value('text_encode', $vars, true);
+$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_get_array_value('text', $vars, '');
+$text = elgg_extract('text', $vars, '');
if ($encode) {
- $text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
+ $text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8', false);
+}
+
+if (!isset($vars['title']) && isset($vars['confirm'])) {
+ $vars['title'] = $vars['rel'];
}
-$vars['onclick'] = "return confirm('" . addslashes($confirm) . "')";
+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>";