]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Adding a view to generate action links for single-click actions.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 21 Jan 2010 01:19:28 +0000 (01:19 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 21 Jan 2010 01:19:28 +0000 (01:19 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@3819 36083f99-b078-4883-b0ff-0f9b5a30f544

views/default/output/action_link.php [new file with mode: 0644]

diff --git a/views/default/output/action_link.php b/views/default/output/action_link.php
new file mode 100644 (file)
index 0000000..1f64d4f
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Elgg action link
+ * Creates a link to an action that includes action tokens
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ *
+ * @uses $vars['text'] The text of the link
+ * @uses $vars['href'] The address
+ * @uses $vars['confirm'] The dialog text
+ *
+ */
+
+// always generate missing action tokens
+$link = elgg_validate_action_url($vars['href']);
+
+if (isset($vars['class']) && $vars['class']) {
+       $class = 'class="' . $vars['class'] . '"';
+} else {
+       $class = '';
+}
+?>
+<a href="<?php echo $link; ?>" <?php echo $class; ?> ><?php echo htmlentities($vars['text'], ENT_QUOTES, 'UTF-8'); ?></a>
\ No newline at end of file