diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-10-16 20:26:12 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-10-16 20:26:12 +0000 |
commit | c66831fa5138a277a9729174caf14c7eb323fb07 (patch) | |
tree | 2444b54badf4914b59c88700cc1ce30a57ae7ff1 /views/default/output | |
parent | 8048313e87b9fd5ab6734e29a0e951524fa33e45 (diff) | |
download | elgg-c66831fa5138a277a9729174caf14c7eb323fb07.tar.gz elgg-c66831fa5138a277a9729174caf14c7eb323fb07.tar.bz2 |
Standardizing views.`
git-svn-id: http://code.elgg.org/elgg/trunk@3555 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/output')
-rw-r--r-- | views/default/output/calendar.php | 39 | ||||
-rw-r--r-- | views/default/output/checkboxes.php | 32 | ||||
-rw-r--r-- | views/default/output/confirmlink.php | 67 | ||||
-rw-r--r-- | views/default/output/date.php | 34 | ||||
-rw-r--r-- | views/default/output/email.php | 34 | ||||
-rw-r--r-- | views/default/output/iframe.php | 22 | ||||
-rw-r--r-- | views/default/output/longtext.php | 32 | ||||
-rw-r--r-- | views/default/output/pulldown.php | 32 | ||||
-rw-r--r-- | views/default/output/radio.php | 32 | ||||
-rw-r--r-- | views/default/output/tagcloud.php | 90 | ||||
-rw-r--r-- | views/default/output/tags.php | 95 | ||||
-rw-r--r-- | views/default/output/text.php | 32 | ||||
-rw-r--r-- | views/default/output/url.php | 58 |
13 files changed, 277 insertions, 322 deletions
diff --git a/views/default/output/calendar.php b/views/default/output/calendar.php index 336129aed..0a21eb74c 100644 --- a/views/default/output/calendar.php +++ b/views/default/output/calendar.php @@ -1,24 +1,19 @@ <?php +/** + * Elgg calendar output + * Displays a calendar output field + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * + */ - /** - * Elgg calendar output - * Displays a calendar output field - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * - */ - - if (is_int($vars['value'])) { - echo date("F j, Y", $vars['value']); - } else { - echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); - } - -?>
\ No newline at end of file +if (is_int($vars['value'])) { + echo date("F j, Y", $vars['value']); +} else { + echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); +}
\ No newline at end of file diff --git a/views/default/output/checkboxes.php b/views/default/output/checkboxes.php index a93455e28..537d996e0 100644 --- a/views/default/output/checkboxes.php +++ b/views/default/output/checkboxes.php @@ -1,19 +1,15 @@ <?php - - /** - * Elgg text output - * Displays some text that was input using a standard text field - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['text'] The text to display - * - */ - - echo elgg_view('output/tags',$vars); -?>
\ No newline at end of file +/** + * Elgg text output + * Displays some text that was input using a standard text field + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['text'] The text to display + * + */ + +echo elgg_view('output/tags',$vars);
\ No newline at end of file diff --git a/views/default/output/confirmlink.php b/views/default/output/confirmlink.php index bb7e866f2..e0a6f65d7 100644 --- a/views/default/output/confirmlink.php +++ b/views/default/output/confirmlink.php @@ -1,42 +1,39 @@ <?php +/** + * Elgg confirmation link + * A link that displays a confirmation dialog before it executes + * + * @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 + * + */ - /** - * Elgg confirmation link - * A link that displays a confirmation dialog before it executes - * - * @package Elgg - * @subpackage Core +$confirm = $vars['confirm']; +if (!$confirm) { + $confirm = elgg_echo('question:areyousure'); +} - * @author Curverider Ltd +$link = $vars['href']; - * @link http://elgg.org/ - * - * @uses $vars['text'] The text of the link - * @uses $vars['href'] The address - * @uses $vars['confirm'] The dialog text - * - */ +if ($vars['is_action']) { + $ts = time(); + $token = generate_action_token($ts); - $confirm = $vars['confirm']; - if (!$confirm) - $confirm = elgg_echo('question:areyousure'); - - $link = $vars['href']; - - if ($vars['is_action']) - { - $ts = time(); - $token = generate_action_token($ts); - - $sep = "?"; - if (strpos($link, '?')>0) $sep = "&"; - $link = "$link{$sep}__elgg_token=$token&__elgg_ts=$ts"; - } - - if ($vars['class']) { - $class = 'class="' . $vars['class'] . '"'; - } else { - $class = ''; - } + $sep = "?"; + if (strpos($link, '?')>0) $sep = "&"; + $link = "$link{$sep}__elgg_token=$token&__elgg_ts=$ts"; +} + +if ($vars['class']) { + $class = 'class="' . $vars['class'] . '"'; +} else { + $class = ''; +} ?> <a href="<?php echo $link; ?>" <?php echo $class; ?> onclick="return confirm('<?php echo addslashes($confirm); ?>');"><?php echo htmlentities($vars['text'], ENT_QUOTES, 'UTF-8'); ?></a>
\ No newline at end of file diff --git a/views/default/output/date.php b/views/default/output/date.php index d4fba97a0..fdc8e3a1b 100644 --- a/views/default/output/date.php +++ b/views/default/output/date.php @@ -1,21 +1,17 @@ <?php +/** + * Date + * Displays a properly formatted date + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] A UNIX epoch timestamp + * + */ - /** - * Date - * Displays a properly formatted date - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['value'] A UNIX epoch timestamp - * - */ - - if ($vars['value'] > 86400) { - echo date("F j, Y",$vars['value']); - } -?>
\ No newline at end of file +if ($vars['value'] > 86400) { + echo date("F j, Y",$vars['value']); +}
\ No newline at end of file diff --git a/views/default/output/email.php b/views/default/output/email.php index 2d454213f..e2142b09b 100644 --- a/views/default/output/email.php +++ b/views/default/output/email.php @@ -1,21 +1,17 @@ <?php +/** + * Elgg email output + * Displays an email address that was entered using an email input field + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The email address to display + * + */ - /** - * Elgg email output - * Displays an email address that was entered using an email input field - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['value'] The email address to display - * - */ - - if (!empty($vars['value'])) { - echo "<a href=\"mailto:" . $vars['value'] . "\">". htmlentities($vars['value'], ENT_QUOTES, 'UTF-8') ."</a>"; - } -?>
\ No newline at end of file +if (!empty($vars['value'])) { + echo "<a href=\"mailto:" . $vars['value'] . "\">". htmlentities($vars['value'], ENT_QUOTES, 'UTF-8') ."</a>"; +}
\ No newline at end of file diff --git a/views/default/output/iframe.php b/views/default/output/iframe.php index eb0cea0b4..e1a1e98c4 100644 --- a/views/default/output/iframe.php +++ b/views/default/output/iframe.php @@ -1,15 +1,15 @@ <?php - /** - * Display a page in an embedded window - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - * - * @uses $vars['value'] Source of the page - * - */ +/** + * Display a page in an embedded window + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] Source of the page + * + */ ?> <iframe src="<?php echo $vars['value']; ?>"> </iframe>
\ No newline at end of file diff --git a/views/default/output/longtext.php b/views/default/output/longtext.php index 3d130359a..a8540913f 100644 --- a/views/default/output/longtext.php +++ b/views/default/output/longtext.php @@ -1,21 +1,17 @@ <?php +/** + * Elgg display long text + * Displays a large amount of text, with new lines converted to line breaks + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['text'] The text to display + * + */ - /** - * Elgg display long text - * Displays a large amount of text, with new lines converted to line breaks - * - * @package Elgg - * @subpackage Core +global $CONFIG; - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['text'] The text to display - * - */ - - global $CONFIG; - - echo autop(parse_urls(filter_tags($vars['value']))); -?>
\ No newline at end of file +echo autop(parse_urls(filter_tags($vars['value'])));
\ No newline at end of file diff --git a/views/default/output/pulldown.php b/views/default/output/pulldown.php index 60b365b11..6e48043a9 100644 --- a/views/default/output/pulldown.php +++ b/views/default/output/pulldown.php @@ -1,19 +1,15 @@ <?php - - /** - * Elgg pulldown display - * Displays a value that was entered into the system via a pulldown - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['text'] The text to display - * - */ - - echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); //$vars['value']; -?>
\ No newline at end of file +/** + * Elgg pulldown display + * Displays a value that was entered into the system via a pulldown + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['text'] The text to display + * + */ + +echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); //$vars['value'];
\ No newline at end of file diff --git a/views/default/output/radio.php b/views/default/output/radio.php index 78723b555..b454bae71 100644 --- a/views/default/output/radio.php +++ b/views/default/output/radio.php @@ -1,19 +1,15 @@ <?php - - /** - * Elgg text output - * Displays some text that was input using a standard text field - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['text'] The text to display - * - */ - - echo elgg_view('output/text',$vars); -?>
\ No newline at end of file +/** + * Elgg text output + * Displays some text that was input using a standard text field + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['text'] The text to display + * + */ + +echo elgg_view('output/text',$vars);
\ No newline at end of file diff --git a/views/default/output/tagcloud.php b/views/default/output/tagcloud.php index 27d49b089..a41ec20c3 100644 --- a/views/default/output/tagcloud.php +++ b/views/default/output/tagcloud.php @@ -1,52 +1,50 @@ <?php +/** + * Elgg tagcloud + * Displays a tagcloud + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['tagcloud'] An array of stdClass objects with two elements: 'tag' (the text of the tag) and 'total' (the number of elements with this tag) + * + */ - /** - * Elgg tagcloud - * Displays a tagcloud - * - * @package Elgg - * @subpackage Core +if (!empty($vars['subtype'])) { + $subtype = "&subtype=" . urlencode($vars['subtype']); +} else { + $subtype = ""; +} +if (!empty($vars['object'])) { + $object = "&object=" . urlencode($vars['object']); +} else { + $object = ""; +} - * @author Curverider Ltd +if (empty($vars['tagcloud']) && !empty($vars['value'])) { + $vars['tagcloud'] = $vars['value']; +} - * @link http://elgg.org/ - * - * @uses $vars['tagcloud'] An array of stdClass objects with two elements: 'tag' (the text of the tag) and 'total' (the number of elements with this tag) - * - */ - - if (!empty($vars['subtype'])) { - $subtype = "&subtype=" . urlencode($vars['subtype']); - } else { - $subtype = ""; +if (!empty($vars['tagcloud']) && is_array($vars['tagcloud'])) { + $counter = 0; + $cloud = ""; + $max = 0; + foreach($vars['tagcloud'] as $tag) { + if ($tag->total > $max) { + $max = $tag->total; + } } - if (!empty($vars['object'])) { - $object = "&object=" . urlencode($vars['object']); - } else { - $object = ""; + foreach($vars['tagcloud'] as $tag) { + if (!empty($cloud)) { + $cloud .= ", "; + } + $size = round((log($tag->total) / log($max)) * 100) + 30; + if ($size < 60) { + $size = 60; + } + $cloud .= "<a href=\"" . $vars['url'] . "search/?tag=". urlencode($tag->tag) . $object . $subtype . "\" style=\"font-size: {$size}%\" title=\"".addslashes($tag->tag)." ({$tag->total})\" style=\"text-decoration:none;\">" . htmlentities($tag->tag, ENT_QUOTES, 'UTF-8') . "</a>"; } - - if (empty($vars['tagcloud']) && !empty($vars['value'])) - $vars['tagcloud'] = $vars['value']; - - if (!empty($vars['tagcloud']) && is_array($vars['tagcloud'])) { - - $counter = 0; - $cloud = ""; - $max = 0; - foreach($vars['tagcloud'] as $tag) { - if ($tag->total > $max) { - $max = $tag->total; - } - } - foreach($vars['tagcloud'] as $tag) { - if (!empty($cloud)) $cloud .= ", "; - $size = round((log($tag->total) / log($max)) * 100) + 30; - if ($size < 60) $size = 60; - $cloud .= "<a href=\"" . $vars['url'] . "search/?tag=". urlencode($tag->tag) . $object . $subtype . "\" style=\"font-size: {$size}%\" title=\"".addslashes($tag->tag)." ({$tag->total})\" style=\"text-decoration:none;\">" . htmlentities($tag->tag, ENT_QUOTES, 'UTF-8') . "</a>"; - } - echo $cloud; - - } - -?>
\ No newline at end of file + echo $cloud; +}
\ No newline at end of file diff --git a/views/default/output/tags.php b/views/default/output/tags.php index 901fa806b..f394d084f 100644 --- a/views/default/output/tags.php +++ b/views/default/output/tags.php @@ -1,55 +1,52 @@ <?php +/** + * Elgg tags + * Displays a list of tags, separated by commas + * + * Tags can be a single string (for one tag) or an array of strings + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['tags'] The tags to display + * @uses $vars['tagtype'] The tagtype, optionally + */ - /** - * Elgg tags - * Displays a list of tags, separated by commas - * - * Tags can be a single string (for one tag) or an array of strings - * - * @package Elgg - * @subpackage Core +if (!empty($vars['subtype'])) { + $subtype = "&subtype=" . urlencode($vars['subtype']); +} else { + $subtype = ""; +} +if (!empty($vars['object'])) { + $object = "&object=" . urlencode($vars['object']); +} else { + $object = ""; +} - * @author Curverider Ltd +if (empty($vars['tags']) && !empty($vars['value'])) { + $vars['tags'] = $vars['value']; +} - * @link http://elgg.org/ - * - * @uses $vars['tags'] The tags to display - * @uses $vars['tagtype'] The tagtype, optionally - */ - - if (!empty($vars['subtype'])) { - $subtype = "&subtype=" . urlencode($vars['subtype']); - } else { - $subtype = ""; - } - if (!empty($vars['object'])) { - $object = "&object=" . urlencode($vars['object']); - } else { - $object = ""; +if (!empty($vars['tags'])) { + $tagstr = ""; + if (!is_array($vars['tags'])) { + $vars['tags'] = array($vars['tags']); } - if (empty($vars['tags']) && !empty($vars['value'])) - $vars['tags'] = $vars['value']; - if (!empty($vars['tags'])) { - - $tagstr = ""; - if (!is_array($vars['tags'])) - $vars['tags'] = array($vars['tags']); - - foreach($vars['tags'] as $tag) { - if (!empty($tagstr)) { - $tagstr .= ", "; - } - if (!empty($vars['type'])) { - $type = "&type={$vars['type']}"; - } else { - $type = ""; - } - if (is_string($tag)) { - $tagstr .= "<a rel=\"tag\" href=\"{$vars['url']}tag/".urlencode($tag) . "{$type}{$subtype}{$object}\">" . htmlentities($tag, ENT_QUOTES, 'UTF-8') . "</a>"; - } - } - echo $tagstr; - - } -?>
\ No newline at end of file + foreach($vars['tags'] as $tag) { + if (!empty($tagstr)) { + $tagstr .= ", "; + } + if (!empty($vars['type'])) { + $type = "&type={$vars['type']}"; + } else { + $type = ""; + } + if (is_string($tag)) { + $tagstr .= "<a rel=\"tag\" href=\"{$vars['url']}tag/".urlencode($tag) . "{$type}{$subtype}{$object}\">" . htmlentities($tag, ENT_QUOTES, 'UTF-8') . "</a>"; + } + } + echo $tagstr; +}
\ No newline at end of file diff --git a/views/default/output/text.php b/views/default/output/text.php index 080b81d68..bcfe33ea0 100644 --- a/views/default/output/text.php +++ b/views/default/output/text.php @@ -1,19 +1,15 @@ <?php - - /** - * Elgg text output - * Displays some text that was input using a standard text field - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['text'] The text to display - * - */ - - echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); // $vars['value']; -?>
\ No newline at end of file +/** + * Elgg text output + * Displays some text that was input using a standard text field + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['text'] The text to display + * + */ + +echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); // $vars['value'];
\ No newline at end of file diff --git a/views/default/output/url.php b/views/default/output/url.php index 7f72f0dce..190b08c21 100644 --- a/views/default/output/url.php +++ b/views/default/output/url.php @@ -1,37 +1,33 @@ <?php +/** + * Elgg URL display + * Displays a URL as a link + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The URL to display + * + */ - /** - * Elgg URL display - * Displays a URL as a link - * - * @package Elgg - * @subpackage Core +$val = trim($vars['value']); +if (!empty($val)) { + if ((substr_count($val, "http://") == 0) && (substr_count($val, "https://") == 0)) { + $val = "http://" . $val; + } - * @author Curverider Ltd + if ($vars['is_action']) { + $ts = time(); + $token = generate_action_token($ts); - * @link http://elgg.org/ - * - * @uses $vars['value'] The URL to display - * - */ - - $val = trim($vars['value']); - if (!empty($val)) { - if ((substr_count($val, "http://") == 0) && (substr_count($val, "https://") == 0)) { - $val = "http://" . $val; - } - - if ($vars['is_action']) - { - $ts = time(); - $token = generate_action_token($ts); - - $sep = "?"; - if (strpos($val, '?')>0) $sep = "&"; - $val = "$val{$sep}__elgg_token=$token&__elgg_ts=$ts"; + $sep = "?"; + if (strpos($val, '?')>0) { + $sep = "&"; } - - echo "<a href=\"{$val}\" target=\"_blank\">". htmlentities($val, ENT_QUOTES, 'UTF-8'). "</a>"; - } + $val = "$val{$sep}__elgg_token=$token&__elgg_ts=$ts"; + } -?>
\ No newline at end of file + echo "<a href=\"{$val}\" target=\"_blank\">". htmlentities($val, ENT_QUOTES, 'UTF-8'). "</a>"; +}
\ No newline at end of file |