diff options
author | Evan Winslow <evan.b.winslow@gmail.com> | 2010-10-21 19:43:43 +0000 |
---|---|---|
committer | Evan Winslow <evan.b.winslow@gmail.com> | 2010-10-21 19:43:43 +0000 |
commit | 37a8c770bea778b047f2b2a864dae1682ac6c311 (patch) | |
tree | ad044ce4d7a110a7eb59219244abf53767a2a1b9 /views/default | |
parent | 42db97f9d404179f1d7f4059c891fca7766e482e (diff) | |
download | elgg-37a8c770bea778b047f2b2a864dae1682ac6c311.tar.gz elgg-37a8c770bea778b047f2b2a864dae1682ac6c311.tar.bz2 |
Added output/url to the mix -- includes ability to accept arbitrary attributes
Diffstat (limited to 'views/default')
-rw-r--r-- | views/default/output/url.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/views/default/output/url.php b/views/default/output/url.php new file mode 100644 index 000000000..f497a093d --- /dev/null +++ b/views/default/output/url.php @@ -0,0 +1,47 @@ +<?php +/** + * Elgg URL display + * Displays a URL as a link + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses string $vars['href'] The string to display in the <a></a> tags + * @uses string $vars['text'] The string between the <a></a> tags. + * @uses bool $vars['is_action'] Is this a link to an action? + * + */ + +if (isset($vars['value'])) { + $vars['href'] = $vars['value']; + unset($vars['value']); +} + +$url = trim($vars['href']); + +if (isset($vars['is_action']) && $vars['is_action']) { + $url = elgg_add_action_tokens_to_url($url); + unset($vars['is_action']); +} + +if (isset($vars['body'])) { + $body = $vars['body']; + unset($vars['body']); +} + +if (!isset($body)) { + if (isset($vars['text'])) { + $text = $vars['text']; + unset($vars['text']); + } else { + $text = $url; + } + + $body = htmlentities($text, ENT_QUOTES, 'UTF-8'); +} + +$vars['href'] = $url; +$attributes = html5_get_html_attributes($vars); +echo "<a $attributes>$text</a>"; |