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 | |
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
57 files changed, 1518 insertions, 1601 deletions
diff --git a/views/default/friends/tablelist.php b/views/default/friends/tablelist.php index af37ff4ed..4581c04f7 100644 --- a/views/default/friends/tablelist.php +++ b/views/default/friends/tablelist.php @@ -1,64 +1,52 @@ <?php +/** + * Elgg friends picker + * Lists the friends picker + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['entities'] The array of ElggUser objects + */ + +if (is_array($vars['entities'])) { - /** - * Elgg friends picker - * Lists the friends picker - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - * - * @uses $vars['entities'] The array of ElggUser objects - */ - - if (is_array($vars['entities'])) { - -?> - - <table cellspacing="0" id="collectionMembersTable"> - <tr> -<?php - $column = 0; - foreach($vars['entities'] as $entity) { - if (!($entity instanceof ElggEntity)) $entity = get_entity($entity); - if ($entity instanceof ElggEntity) { ?> - <td style="width:25px;"> - <div style="width: 25px; margin-bottom: 15px;"> - <?php echo elgg_view("profile/icon",array('entity' => $entity, 'size' => 'tiny')); ?> - </div> - </td> - <td style="width: 200px; padding: 5px;"> -<?php - - echo $entity->name; - -?> - </td> +<table cellspacing="0" id="collectionMembersTable"> + <tr> + <?php + $column = 0; + foreach($vars['entities'] as $entity) { + if (!($entity instanceof ElggEntity)) { + $entity = get_entity($entity); + } -<?php - + if ($entity instanceof ElggEntity) { + ?> + <td style="width:25px;"> + <div style="width: 25px; margin-bottom: 15px;"> + <?php echo elgg_view("profile/icon",array('entity' => $entity, 'size' => 'tiny')); ?> + </div> + </td> + <td style="width: 200px; padding: 5px;"> + <?php echo $entity->name; ?> + </td> + <?php $column++; if ($column == 3) { echo "</tr><tr>"; $column = 0; } - } - - -?> - - - -<?php - } - if ($column < 3 && $column != 0) echo "</tr>"; - echo "</table>"; } - - if (isset($vars['content'])) echo $vars['content']; -?>
\ No newline at end of file +if ($column < 3 && $column != 0) echo "</tr>"; + echo "</table>"; +} + +if (isset($vars['content'])) { + echo $vars['content']; +}
\ No newline at end of file diff --git a/views/default/friends/tablelistcountupdate.php b/views/default/friends/tablelistcountupdate.php index 4c4e26c80..81a061439 100644 --- a/views/default/friends/tablelistcountupdate.php +++ b/views/default/friends/tablelistcountupdate.php @@ -1,19 +1,16 @@ <?php - - /** - * Elgg friends picker count updater - * Updates the friends count on a collection - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['count'] The count - * @uses $vars['friendspicker'] The friendspicker counter number - */ +/** + * Elgg friends picker count updater + * Updates the friends count on a collection + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['count'] The count + * @uses $vars['friendspicker'] The friendspicker counter number + */ ?> diff --git a/views/default/graphics/icon.php b/views/default/graphics/icon.php index ca1bc2054..bc7c36e71 100644 --- a/views/default/graphics/icon.php +++ b/views/default/graphics/icon.php @@ -1,30 +1,40 @@ <?php - /** - * Generic icon view. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ +/** + * Generic icon view. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ + +$entity = $vars['entity']; + +$sizes = array('small','medium','large','tiny','master','topbar'); +// Get size +if (!in_array($vars['size'], $sizes)) { + $vars['size'] = "medium"; +} + +// Get any align and js +if (!empty($vars['align'])) { + $align = " align=\"{$vars['align']}\" "; +} else { + $align = ""; +} + - $entity = $vars['entity']; - - // Get size - if (!in_array($vars['size'],array('small','medium','large','tiny','master','topbar'))) - $vars['size'] = "medium"; - - // Get any align and js - if (!empty($vars['align'])) { - $align = " align=\"{$vars['align']}\" "; - } else { - $align = ""; - } - - ?> <div class="icon"> -<?php if ($vars['link']) { ?><a href="<?php echo $vars['link'] ?>"><?php } ?> +<?php +if ($vars['link']) { + ?><a href="<?php echo $vars['link'] ?>"><?php +} +?> <img src="<?php echo $entity->getIcon($vars['size']); ?>" border="0" <?php echo $align; ?> <?php echo $vars['js']; ?> /> -<?php if ($vars['link']) { ?></a><?php } ?> +<?php +if ($vars['link']) { + ?></a><?php +} +?> </div>
\ No newline at end of file diff --git a/views/default/group/default.php b/views/default/group/default.php index a3fa96724..92594bf4a 100644 --- a/views/default/group/default.php +++ b/views/default/group/default.php @@ -1,12 +1,12 @@ <?php - /** - * ElggGroup default view. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ +/** + * ElggGroup default view. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ - echo elgg_view('object/default', $vars); +echo elgg_view('object/default', $vars); ?>
\ No newline at end of file diff --git a/views/default/group/search/finishblurb.php b/views/default/group/search/finishblurb.php index caee030b7..4164c6713 100644 --- a/views/default/group/search/finishblurb.php +++ b/views/default/group/search/finishblurb.php @@ -1,15 +1,17 @@ <?php
-
- if ($vars['count'] > $vars['threshold']) {
+/**
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
+if ($vars['count'] > $vars['threshold']) {
?>
-<div class="contentWrapper"><a href="<?php echo $vars['url']; ?>pg/search/groups/?tag=<?php echo urlencode($vars['tag']); ?>"><?php
-
- echo elgg_echo("group:search:finishblurb");
-
- ?></a></div>
+<div class="contentWrapper"><a href="<?php echo $vars['url']; ?>pg/search/groups/?tag=<?php echo urlencode($vars['tag']); ?>">
+ <?php
+ echo elgg_echo("group:search:finishblurb");
+ ?></a>
+</div>
<?php
-
- }
-
-?>
\ No newline at end of file +}
diff --git a/views/default/group/search/startblurb.php b/views/default/group/search/startblurb.php index c7f3a4e55..3abfe4dc5 100644 --- a/views/default/group/search/startblurb.php +++ b/views/default/group/search/startblurb.php @@ -1,8 +1,14 @@ +<?php
+/**
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
+?>
<div class="contentWrapper">
- <?php
-
- echo sprintf(elgg_echo("group:search:startblurb"),$vars['tag']);
-
+ <?php
+ echo sprintf(elgg_echo("group:search:startblurb"),$vars['tag']);
?>
</div>
\ No newline at end of file diff --git a/views/default/input/access.php b/views/default/input/access.php index 461fbf625..42247af61 100644 --- a/views/default/input/access.php +++ b/views/default/input/access.php @@ -1,55 +1,53 @@ <?php - - /** - * Elgg access level input - * Displays a pulldown input field - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * - */ - - if (isset($vars['class'])) $class = $vars['class']; - if (!$class) $class = "input-access"; - - if (!array_key_exists('value', $vars) || $vars['value'] == ACCESS_DEFAULT) - $vars['value'] = get_default_access(); - - - if ((!isset($vars['options'])) || (!is_array($vars['options']))) - { - $vars['options'] = array(); - $vars['options'] = get_write_access_array(); +/** + * Elgg access level input + * Displays a pulldown input field + * + * @package Elgg + * @subpackage Core + + * @author Curverider Ltd + + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * + */ + +if (isset($vars['class'])) { + $class = $vars['class']; +} +if (!$class) { + $class = "input-access"; +} + +if (!array_key_exists('value', $vars) || $vars['value'] == ACCESS_DEFAULT) { + $vars['value'] = get_default_access(); +} + + +if ((!isset($vars['options'])) || (!is_array($vars['options']))) { + $vars['options'] = array(); + $vars['options'] = get_write_access_array(); +} + +if (is_array($vars['options']) && sizeof($vars['options']) > 0) { + ?> + + <select <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['js'])) echo $vars['js']; ?> <?php if ((isset($vars['disabled'])) && ($vars['disabled'])) echo ' disabled="yes" '; ?> class="<?php echo $class; ?>"> + <?php + + foreach($vars['options'] as $key => $option) { + if ($key != $vars['value']) { + echo "<option value=\"{$key}\">". htmlentities($option, ENT_QUOTES, 'UTF-8') ."</option>"; + } else { + echo "<option value=\"{$key}\" selected=\"selected\">". htmlentities($option, ENT_QUOTES, 'UTF-8') ."</option>"; } - - if (is_array($vars['options']) && sizeof($vars['options']) > 0) { - -?> - -<select <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['js'])) echo $vars['js']; ?> <?php if ((isset($vars['disabled'])) && ($vars['disabled'])) echo ' disabled="yes" '; ?> class="<?php echo $class; ?>"> -<?php - - foreach($vars['options'] as $key => $option) { - if ($key != $vars['value']) { - echo "<option value=\"{$key}\">". htmlentities($option, ENT_QUOTES, 'UTF-8') ."</option>"; - } else { - echo "<option value=\"{$key}\" selected=\"selected\">". htmlentities($option, ENT_QUOTES, 'UTF-8') ."</option>"; - } - } - -?> -</select> - -<?php - - } + } -?>
\ No newline at end of file + ?> + </select> + <?php +}
\ No newline at end of file diff --git a/views/default/input/autocomplete.php b/views/default/input/autocomplete.php index 052219a1b..7dc088d0e 100644 --- a/views/default/input/autocomplete.php +++ b/views/default/input/autocomplete.php @@ -1,56 +1,59 @@ <?php +/** + * Displays an autocomplete text input. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @TODO: This currently only works for ONE AUTOCOMPLETE TEXT FIELD on a page. + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * @uses $vars['match_on'] Array | str What to match on. all|array(group|user|friend|subtype) + * @uses $vars['match_owner'] Bool. Match only entities that are owned by logged in user. + * + */ + +global $autocomplete_js_loaded; + +$internalname = $vars['internalname']; +$value = $vars['value']; + +if(!$value) { + $value= ''; +} + +if($vars['internal_id']) { + $id_autocomplete = $vars['internal_id']; +} + +$ac_url_params = http_build_query(array( + 'match_on' => $vars['match_on'], + 'match_owner' => $vars['match_owner'], +)); +$ac_url = $vars['url'] . 'pg/autocomplete?' . $ac_url_params; + +if (!isset($autocomplete_js_loaded)) { + $autocomplete_js_loaded = false; +} - /** - * Displays an autocomplete text input. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - * - * @TODO: This currently only works for ONE AUTOCOMPLETE TEXT FIELD on a page. - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * @uses $vars['match_on'] Array | str What to match on. all|array(group|user|friend|subtype) - * @uses $vars['match_owner'] Bool. Match only entities that are owned by logged in user. - * - */ - - global $autocomplete_js_loaded; - - $internalname = $vars['internalname']; - $value = $vars['value']; - - if(!$value) - $value= ''; - - if($vars['internal_id']) - $id_autocomplete = $vars['internal_id']; - - $ac_url_params = http_build_query(array( - 'match_on' => $vars['match_on'], - 'match_owner' => $vars['match_owner'], - )); - $ac_url = $vars['url'] . 'pg/autocomplete?' . $ac_url_params; - - if (!isset($autocomplete_js_loaded)) $autocomplete_js_loaded = false; - ?> <!-- show the input --> - <input type="text" class='autocomplete' name ='<?php echo $internalname; ?>_autocomplete' value='<?php echo $value?>' /> - <input type="hidden" name="<?php echo $internalname; ?>" value='<?php echo $value; ?>' /> - +<input type="text" class='autocomplete' name ='<?php echo $internalname; ?>_autocomplete' value='<?php echo $value?>' /> +<input type="hidden" name="<?php echo $internalname; ?>" value='<?php echo $value; ?>' /> + <?php - if (!$autocomplete_js_loaded) { -?> +if (!$autocomplete_js_loaded) { + ?> -<!-- include autocomplete --> -<script language="javascript" type="text/javascript" src="<?php echo $vars['url']; ?>vendors/jquery/jquery.autocomplete.min.js"></script> -<script type="text/javascript"> -function bindAutocomplete() { + <!-- include autocomplete --> + <script language="javascript" type="text/javascript" src="<?php echo $vars['url']; ?>vendors/jquery/jquery.autocomplete.min.js"></script> + <script type="text/javascript"> + function bindAutocomplete() { $('input[type=text].autocomplete').autocomplete("<?php echo $ac_url; ?>", { minChars: 1, matchContains: true, @@ -58,13 +61,13 @@ function bindAutocomplete() { formatItem: function(row, i, max, term) { eval("var info = " + row + ";"); var r = ''; - + switch (info.type) { case 'user': case 'group': r = info.icon + info.name + ' - ' + info.desc; break; - + default: r = info.name + ' - ' + info.desc; break; @@ -80,20 +83,20 @@ function bindAutocomplete() { var hidden = $(this).next(); hidden.val(info.guid); }); -} + } -$(document).ready(function() { + $(document).ready(function() { bindAutocomplete(); -}); + }); -</script> + </script> -<?php + <?php - $autocomplete_js_loaded = true; - } else { -?> -<!-- rebind autocomplete --> -<script type="text/javascript">bindAutocomplete();</script> -<?php - }
\ No newline at end of file + $autocomplete_js_loaded = true; +} else { + ?> + <!-- rebind autocomplete --> + <script type="text/javascript">bindAutocomplete();</script> + <?php +}
\ No newline at end of file diff --git a/views/default/input/button.php b/views/default/input/button.php index 4a21a3127..0a65feb82 100644 --- a/views/default/input/button.php +++ b/views/default/input/button.php @@ -1,39 +1,59 @@ <?php - /** - * Create a input button - * Use this view for forms rather than creating a submit/reset button tag in the wild as it provides - * extra security which help prevent CSRF attacks. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * @uses $vars['type'] Submit or reset, defaults to submit. - * @uses $vars['src'] Src of an image - * - */ +/** + * Create a input button + * Use this view for forms rather than creating a submit/reset button tag in the wild as it provides + * extra security which help prevent CSRF attacks. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * @uses $vars['type'] Submit or reset, defaults to submit. + * @uses $vars['src'] Src of an image + * + */ - global $CONFIG; - - if (isset($vars['class'])) $class = $vars['class']; - if (!$class) $class = "submit_button"; +global $CONFIG; - if (isset($vars['type'])) { $type = strtolower($vars['type']); } else { $type = 'submit'; } - switch ($type) - { - case 'button' : $type='button'; break; - case 'reset' : $type='reset'; break; - case 'submit': - default: $type = 'submit'; - } - - $value = htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); - if (isset($vars['internalname'])) $name = $vars['internalname']; - if (isset($vars['src'])) $src = "src=\"{$vars['src']}\""; - if (strpos($src,$CONFIG->wwwroot)===false) $src = ""; // blank src if trying to access an offsite image. +if (isset($vars['class'])) { + $class = $vars['class']; +} +if (!$class) { + $class = "submit_button"; +} + +if (isset($vars['type'])) { + $type = strtolower($vars['type']); +} else { + $type = 'submit'; +} + +switch ($type) { + case 'button' : + $type='button'; + break; + case 'reset' : + $type='reset'; + break; + case 'submit': + default: + $type = 'submit'; +} + +$value = htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); +if (isset($vars['internalname'])) { + $name = $vars['internalname']; +} +if (isset($vars['src'])) { + $src = "src=\"{$vars['src']}\""; +} +// blank src if trying to access an offsite image. +if (strpos($src,$CONFIG->wwwroot)===false) { + $src = ""; +} ?> <input name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> type="<?php echo $type; ?>" class="<?php echo $class; ?>" <?php echo $vars['js']; ?> value="<?php echo $value; ?>" <?php echo $src; ?> />
\ No newline at end of file diff --git a/views/default/input/calendar.php b/views/default/input/calendar.php index 9dd5b2dc0..12cbf95ec 100644 --- a/views/default/input/calendar.php +++ b/views/default/input/calendar.php @@ -1,44 +1,40 @@ -<?php +<?php +/** + * Elgg calendar input + * Displays a calendar input field + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * + */ - /** - * Elgg calendar input - * Displays a calendar input field - * - * @package Elgg - * @subpackage Core +static $calendarjs; +if (empty($calendarjs)) { + echo <<< END - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * - */ - - static $calendarjs; - if (empty($calendarjs)) { - - echo <<< END - <script language="JavaScript" src="{$vars['url']}vendors/calendarpopup/CalendarPopup.js"></script> - + END; - $calendarjs = 1; - } - $strippedname = sanitise_string($vars['internalname']); - $js = "cal" . $strippedname; + $calendarjs = 1; +} +$strippedname = sanitise_string($vars['internalname']); +$js = "cal" . $strippedname; + +if ($vars['value'] > 86400) { + $val = date("F j, Y",$vars['value']); +} else { + $val = $vars['value']; +} - if ($vars['value'] > 86400) { - $val = date("F j, Y",$vars['value']); - } else { - $val = $vars['value']; - } - ?> <script language="JavaScript"> - var cal<?php echo $strippedname; ?> = new CalendarPopup(); +var cal<?php echo $strippedname; ?> = new CalendarPopup(); </script> <input type="text" <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" id="<?php echo $strippedname; ?>" value="<?php echo $val; ?>" /> -<a href="#" onclick="<?php echo $js; ?>.select(document.getElementById('<?php echo $strippedname; ?>'),'anchor<?php echo $strippedname; ?>','MMM dd, yyyy'); return false;" TITLE="<?php echo $js; ?>.select(document.forms[0].<?php echo $strippedname; ?>,'anchor<?php echo $strippedname; ?>','MMM dd, yyyy'); return false;" NAME="anchor<?php echo $strippedname; ?>" ID="anchor<?php echo $strippedname; ?>">select</a>
\ No newline at end of file +<a href="#" onclick="<?php echo $js; ?>.select(document.getElementById('<?php echo $strippedname; ?>'),'anchor<?php echo $strippedname; ?>','MMM dd, yyyy'); return false;" TITLE="<?php echo $js; ?>.select(document.forms[0].<?php echo $strippedname; ?>,'anchor<?php echo $strippedname; ?>','MMM dd, yyyy'); return false;" NAME="anchor<?php echo $strippedname; ?>" ID="anchor<?php echo $strippedname; ?>">select</a>
\ No newline at end of file diff --git a/views/default/input/captcha.php b/views/default/input/captcha.php index f4ebc218a..d1d780e77 100644 --- a/views/default/input/captcha.php +++ b/views/default/input/captcha.php @@ -1,10 +1,10 @@ <?php - /** - * This view provides a hook for third parties to provide captcha behaviour. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ +/** + * This view provides a hook for third parties to provide captcha behaviour. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ ?>
\ No newline at end of file diff --git a/views/default/input/checkboxes.php b/views/default/input/checkboxes.php index 4e806bbfc..7d03db257 100644 --- a/views/default/input/checkboxes.php +++ b/views/default/input/checkboxes.php @@ -1,52 +1,49 @@ <?php +/** + * Elgg checkbox input + * Displays a checkbox input field + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * @uses $vars['options'] An array of strings representing the label => options for the checkbox field + * + */ - /** - * Elgg checkbox input - * Displays a checkbox input field - * - * @package Elgg - * @subpackage Core +$class = $vars['class']; +if (!$class) { + $class = "input-checkboxes"; +} - * @author Curverider Ltd +foreach($vars['options'] as $label => $option) { + //if (!in_array($option,$vars['value'])) { + if (is_array($vars['value'])) { + $valarray = $vars['value']; + $valarray = array_map('strtolower', $valarray); + if (!in_array(strtolower($option),$valarray)) { + $selected = ""; + } else { + $selected = "checked = \"checked\""; + } + } else { + if (strtolower($option) != strtolower($vars['value'])) { + $selected = ""; + } else { + $selected = "checked = \"checked\""; + } + } + $labelint = (int) $label; + if ("{$label}" == "{$labelint}") { + $label = $option; + } - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * @uses $vars['options'] An array of strings representing the label => options for the checkbox field - * - */ - - $class = $vars['class']; - if (!$class) $class = "input-checkboxes"; - - foreach($vars['options'] as $label => $option) { - //if (!in_array($option,$vars['value'])) { - if (is_array($vars['value'])) { - $valarray = $vars['value']; - $valarray = array_map('strtolower', $valarray); - if (!in_array(strtolower($option),$valarray)) { - $selected = ""; - } else { - $selected = "checked = \"checked\""; - } - } else { - if (strtolower($option) != strtolower($vars['value'])) { - $selected = ""; - } else { - $selected = "checked = \"checked\""; - } - } - $labelint = (int) $label; - if ("{$label}" == "{$labelint}") { - $label = $option; - } - - if (isset($vars['internalid'])) $id = "id=\"{$vars['internalid']}\""; - $disabled = ""; - if ($vars['disabled']) $disabled = ' disabled="yes" '; - echo "<label><input type=\"checkbox\" $id $disabled {$vars['js']} name=\"{$vars['internalname']}[]\" value=\"".htmlentities($option, ENT_QUOTES, 'UTF-8')."\" {$selected} class=\"$class\" />{$label}</label><br />"; - } - -?>
\ No newline at end of file + if (isset($vars['internalid'])) $id = "id=\"{$vars['internalid']}\""; + $disabled = ""; + if ($vars['disabled']) $disabled = ' disabled="yes" '; + echo "<label><input type=\"checkbox\" $id $disabled {$vars['js']} name=\"{$vars['internalname']}[]\" value=\"".htmlentities($option, ENT_QUOTES, 'UTF-8')."\" {$selected} class=\"$class\" />{$label}</label><br />"; +}
\ No newline at end of file diff --git a/views/default/input/email.php b/views/default/input/email.php index e1fb61eab..bd2892e97 100644 --- a/views/default/input/email.php +++ b/views/default/input/email.php @@ -1,24 +1,25 @@ <?php +/** + * Elgg email input + * Displays an email input field + * + * @package Elgg + * @subpackage Core - /** - * Elgg email input - * Displays an email input field - * - * @package Elgg - * @subpackage Core + * @author Curverider Ltd - * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * + */ - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * - */ - - $class = $vars['class']; - if (!$class) $class = "input-text"; +$class = $vars['class']; +if (!$class) { + $class = "input-text"; +} ?> -<input type="text" <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?>value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" class="<?php echo $class; ?>"/>
\ No newline at end of file +<input type="text" <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?>value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" class="<?php echo $class; ?>"/>
\ No newline at end of file diff --git a/views/default/input/file.php b/views/default/input/file.php index e707e3ee0..15cc011f6 100644 --- a/views/default/input/file.php +++ b/views/default/input/file.php @@ -1,26 +1,25 @@ <?php +/** + * Elgg file input + * Displays a file input field + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * + */ - /** - * Elgg file input - * Displays a file input field - * - * @package Elgg - * @subpackage Core +if (!empty($vars['value'])) { + echo elgg_echo('fileexists') . "<br />"; +} - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * - */ - - if (!empty($vars['value'])) { - echo elgg_echo('fileexists') . "<br />"; - } - - $class = $vars['class']; - if (!$class) $class = "input-file"; +$class = $vars['class']; +if (!$class) { + $class = "input-file"; +} ?> <input type="file" size="30" <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> class="<?php echo $class; ?>" />
\ No newline at end of file diff --git a/views/default/input/form.php b/views/default/input/form.php index 0a4619ac1..25f140a01 100644 --- a/views/default/input/form.php +++ b/views/default/input/form.php @@ -1,34 +1,50 @@ <?php - /** - * Create a form for data submission. - * Use this view for forms rather than creating a form tag in the wild as it provides - * extra security which help prevent CSRF attacks. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - * - * @uses $vars['body'] The body of the form (made up of other input/xxx views and html - * @uses $vars['method'] Method (default POST) - * @uses $vars['enctype'] How the form is encoded, default blank - * @uses $vars['action'] URL of the action being called - * - */ - - if (isset($vars['internalid'])) { $id = $vars['internalid']; } else { $id = ''; } - if (isset($vars['internalname'])) { $name = $vars['internalname']; } else { $name = ''; } - $body = $vars['body']; - $action = $vars['action']; - if (isset($vars['enctype'])) { $enctype = $vars['enctype']; } else { $enctype = ''; } - if (isset($vars['method'])) { $method = $vars['method']; } else { $method = 'POST'; } +/** + * Create a form for data submission. + * Use this view for forms rather than creating a form tag in the wild as it provides + * extra security which help prevent CSRF attacks. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['body'] The body of the form (made up of other input/xxx views and html + * @uses $vars['method'] Method (default POST) + * @uses $vars['enctype'] How the form is encoded, default blank + * @uses $vars['action'] URL of the action being called + * + */ - // Generate a security header - $security_header = ""; - if ($vars['disable_security']!=true) - { - $security_header = elgg_view('input/securitytoken'); - } +if (isset($vars['internalid'])) { + $id = $vars['internalid']; +} else { + $id = ''; +} + +if (isset($vars['internalname'])) { + $name = $vars['internalname']; +} else { + $name = ''; +} +$body = $vars['body']; +$action = $vars['action']; +if (isset($vars['enctype'])) { + $enctype = $vars['enctype']; +} else { + $enctype = ''; +} +if (isset($vars['method'])) { + $method = $vars['method']; +} else { + $method = 'POST'; +} + +// Generate a security header +$security_header = ""; +if ($vars['disable_security']!=true) { + $security_header = elgg_view('input/securitytoken'); +} ?> <form <?php if ($id) { ?>id="<?php echo $id; ?>" <?php } ?> <?php if ($name) { ?>name="<?php echo $name; ?>" <?php } ?> action="<?php echo $action; ?>" method="<?php echo $method; ?>" <?php if ($enctype!="") echo "enctype=\"$enctype\""; ?>> <?php echo $security_header; ?> diff --git a/views/default/input/hidden.php b/views/default/input/hidden.php index 2338a66bb..e95779367 100644 --- a/views/default/input/hidden.php +++ b/views/default/input/hidden.php @@ -1,18 +1,18 @@ <?php - /** - * Create a hidden data field - * Use this view for forms rather than creating a hidden tag in the wild as it provides - * extra security which help prevent CSRF attacks. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * - */ +/** + * Create a hidden data field + * Use this view for forms rather than creating a hidden tag in the wild as it provides + * extra security which help prevent CSRF attacks. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * + */ ?> -<input type="hidden" <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" />
\ No newline at end of file +<input type="hidden" <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" />
\ No newline at end of file diff --git a/views/default/input/longtext.php b/views/default/input/longtext.php index 86b0f3fc4..f60e29a70 100644 --- a/views/default/input/longtext.php +++ b/views/default/input/longtext.php @@ -1,25 +1,22 @@ <?php +/** + * Elgg long text input + * Displays a long text input field + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * + */ - /** - * Elgg long text input - * Displays a long text input field - * - * @package Elgg - * @subpackage Core +$class = $vars['class']; +if (!$class) $class = "input-textarea"; - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * - */ - - $class = $vars['class']; - if (!$class) $class = "input-textarea"; - ?> -<textarea class="<?php echo $class; ?>" name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?>><?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?></textarea>
\ No newline at end of file +<textarea class="<?php echo $class; ?>" name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?>><?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?></textarea>
\ No newline at end of file diff --git a/views/default/input/password.php b/views/default/input/password.php index 8ab0b6935..90ee984d4 100644 --- a/views/default/input/password.php +++ b/views/default/input/password.php @@ -1,24 +1,23 @@ <?php +/** + * Elgg password input + * Displays a password input field + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * + */ - /** - * Elgg password input - * Displays a password input field - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * - */ - - $class = $vars['class']; - if (!$class) $class = "input-password"; +$class = $vars['class']; +if (!$class) { + $class = "input-password"; +} ?> -<input type="password" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" class="<?php echo $class; ?>" />
\ No newline at end of file +<input type="password" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" class="<?php echo $class; ?>" />
\ No newline at end of file diff --git a/views/default/input/plaintext.php b/views/default/input/plaintext.php index a99084a43..e177f8b3f 100644 --- a/views/default/input/plaintext.php +++ b/views/default/input/plaintext.php @@ -1,25 +1,24 @@ <?php +/** + * Elgg long text input (plaintext) + * Displays a long text input field that should not be overridden by wysiwyg editors. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * + */ - /** - * Elgg long text input (plaintext) - * Displays a long text input field that should not be overridden by wysiwyg editors. - * - * @package Elgg - * @subpackage Core +$class = $vars['class']; +if (!$class) { + $class = "input-textarea"; +} - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * - */ - - $class = $vars['class']; - if (!$class) $class = "input-textarea"; - ?> -<textarea class="<?php echo $class; ?>" name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?>><?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?></textarea>
\ No newline at end of file +<textarea class="<?php echo $class; ?>" name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?>><?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?></textarea>
\ No newline at end of file diff --git a/views/default/input/pulldown.php b/views/default/input/pulldown.php index 6aa69f428..03143d677 100644 --- a/views/default/input/pulldown.php +++ b/views/default/input/pulldown.php @@ -1,52 +1,46 @@ <?php - - /** - * Elgg pulldown input - * Displays a pulldown input field - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * @uses $vars['options'] An array of strings representing the options for the pulldown field - * @uses $vars['options_values'] An associative array of "value" => "option" where "value" is an internal name and "option" is - * the value displayed on the button. Replaces $vars['options'] when defined. - */ - - - $class = $vars['class']; - if (!$class) $class = "input-pulldown"; +/** + * Elgg pulldown input + * Displays a pulldown input field + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * @uses $vars['options'] An array of strings representing the options for the pulldown field + * @uses $vars['options_values'] An associative array of "value" => "option" where "value" is an internal name and "option" is + * the value displayed on the button. Replaces $vars['options'] when defined. + */ + +$class = $vars['class']; +if (!$class) { + $class = "input-pulldown"; +} ?> - <select name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> <?php echo $vars['js']; ?> <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> class="<?php echo $class; ?>"> <?php - if ($vars['options_values']) - { - foreach($vars['options_values'] as $value => $option) { - if ($value != $vars['value']) { - echo "<option value=\"".htmlentities($value, ENT_QUOTES, 'UTF-8')."\">". htmlentities($option, ENT_QUOTES, 'UTF-8') ."</option>"; - } else { - echo "<option value=\"".htmlentities($value, ENT_QUOTES, 'UTF-8')."\" selected=\"selected\">". htmlentities($option, ENT_QUOTES, 'UTF-8') ."</option>"; - } - } +if ($vars['options_values']) { + foreach($vars['options_values'] as $value => $option) { + if ($value != $vars['value']) { + echo "<option value=\"".htmlentities($value, ENT_QUOTES, 'UTF-8')."\">". htmlentities($option, ENT_QUOTES, 'UTF-8') ."</option>"; + } else { + echo "<option value=\"".htmlentities($value, ENT_QUOTES, 'UTF-8')."\" selected=\"selected\">". htmlentities($option, ENT_QUOTES, 'UTF-8') ."</option>"; + } } - else - { - foreach($vars['options'] as $option) { - if ($option != $vars['value']) { - echo "<option>". htmlentities($option, ENT_QUOTES, 'UTF-8') ."</option>"; - } else { - echo "<option selected=\"selected\">". htmlentities($option, ENT_QUOTES, 'UTF-8') ."</option>"; - } - } +} else { + foreach($vars['options'] as $option) { + if ($option != $vars['value']) { + echo "<option>". htmlentities($option, ENT_QUOTES, 'UTF-8') ."</option>"; + } else { + echo "<option selected=\"selected\">". htmlentities($option, ENT_QUOTES, 'UTF-8') ."</option>"; + } } -?> +} +?> </select>
\ No newline at end of file diff --git a/views/default/input/radio.php b/views/default/input/radio.php index 12e40ccdd..c6163b141 100644 --- a/views/default/input/radio.php +++ b/views/default/input/radio.php @@ -1,40 +1,41 @@ <?php +/** + * Elgg radio input + * Displays a radio input field + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * @uses $vars['options'] An array of strings representing the options for the radio field as "label" => option + * + */ - /** - * Elgg radio input - * Displays a radio input field - * - * @package Elgg - * @subpackage Core +$class = $vars['class']; +if (!$class) { + $class = "input-radio"; +} - * @author Curverider Ltd +foreach($vars['options'] as $label => $option) { + if (strtolower($option) != strtolower($vars['value'])) { + $selected = ""; + } else { + $selected = "checked = \"checked\""; + } + $labelint = (int) $label; + if ("{$label}" == "{$labelint}") { + $label = $option; + } - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * @uses $vars['options'] An array of strings representing the options for the radio field as "label" => option - * - */ - - $class = $vars['class']; - if (!$class) $class = "input-radio"; - - foreach($vars['options'] as $label => $option) { - if (strtolower($option) != strtolower($vars['value'])) { - $selected = ""; - } else { - $selected = "checked = \"checked\""; - } - $labelint = (int) $label; - if ("{$label}" == "{$labelint}") { - $label = $option; - } - - if (isset($vars['internalid'])) $id = "id=\"{$vars['internalid']}\""; - if ($vars['disabled']) $disabled = ' disabled="yes" '; - echo "<label><input type=\"radio\" $disabled {$vars['js']} name=\"{$vars['internalname']}\" $id value=\"".htmlentities($option, ENT_QUOTES, 'UTF-8')."\" {$selected} class=\"$class\" />{$label}</label><br />"; - } - -?>
\ No newline at end of file + if (isset($vars['internalid'])) { + $id = "id=\"{$vars['internalid']}\""; + } + if ($vars['disabled']) { + $disabled = ' disabled="yes" '; + } + echo "<label><input type=\"radio\" $disabled {$vars['js']} name=\"{$vars['internalname']}\" $id value=\"".htmlentities($option, ENT_QUOTES, 'UTF-8')."\" {$selected} class=\"$class\" />{$label}</label><br />"; +}
\ No newline at end of file diff --git a/views/default/input/reset.php b/views/default/input/reset.php index 96fc57a4f..bb8d278c3 100644 --- a/views/default/input/reset.php +++ b/views/default/input/reset.php @@ -1,25 +1,26 @@ <?php - /** - * Create a reset input button - * Use this view for forms rather than creating a submit/reset button tag in the wild as it provides - * extra security which help prevent CSRF attacks. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * @uses $vars['type'] Submit or reset, defaults to submit. - * - */ +/** + * Create a reset input button + * Use this view for forms rather than creating a submit/reset button tag in the wild as it provides + * extra security which help prevent CSRF attacks. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * @uses $vars['type'] Submit or reset, defaults to submit. + * + */ - $vars['type'] = 'reset'; - $class = $vars['class']; - if (!$class) $class = "submit_button"; - $vars['class'] = $class; - - echo elgg_view('input/button', $vars); -?>
\ No newline at end of file +$vars['type'] = 'reset'; +$class = $vars['class']; +if (!$class) { + $class = "submit_button"; +} +$vars['class'] = $class; + +echo elgg_view('input/button', $vars);
\ No newline at end of file diff --git a/views/default/input/securitytoken.php b/views/default/input/securitytoken.php index fa202548e..a2a4a0e01 100644 --- a/views/default/input/securitytoken.php +++ b/views/default/input/securitytoken.php @@ -1,18 +1,17 @@ <?php - /** - * CSRF security token view for use with secure forms. - * - * It is still recommended that you use input/form. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ +/** + * CSRF security token view for use with secure forms. + * + * It is still recommended that you use input/form. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ - $ts = time(); - $token = generate_action_token($ts); - - echo elgg_view('input/hidden', array('internalname' => '__elgg_token', 'value' => $token)); - echo elgg_view('input/hidden', array('internalname' => '__elgg_ts', 'value' => $ts)); -?> +$ts = time(); +$token = generate_action_token($ts); + +echo elgg_view('input/hidden', array('internalname' => '__elgg_token', 'value' => $token)); +echo elgg_view('input/hidden', array('internalname' => '__elgg_ts', 'value' => $ts)); diff --git a/views/default/input/submit.php b/views/default/input/submit.php index 66e5c543b..b0c72791f 100644 --- a/views/default/input/submit.php +++ b/views/default/input/submit.php @@ -1,25 +1,28 @@ <?php - /** - * Create a submit input button - * Use this view for forms rather than creating a submit/reset button tag in the wild as it provides - * extra security which help prevent CSRF attacks. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * @uses $vars['type'] Submit or reset, defaults to submit. - * - */ +/** + * Create a submit input button + * Use this view for forms rather than creating a submit/reset button tag in the wild as it provides + * extra security which help prevent CSRF attacks. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * @uses $vars['type'] Submit or reset, defaults to submit. + * + */ - $vars['type'] = 'submit'; - if (isset($vars['class'])) $class = $vars['class']; - if (!$class) $class = "submit_button"; - $vars['class'] = $class; - - echo elgg_view('input/button', $vars); -?>
\ No newline at end of file +$vars['type'] = 'submit'; +if (isset($vars['class'])) { + $class = $vars['class']; +} +if (!$class) { + $class = "submit_button"; +} +$vars['class'] = $class; + +echo elgg_view('input/button', $vars);
\ No newline at end of file diff --git a/views/default/input/tags.php b/views/default/input/tags.php index 8793756e2..172875004 100644 --- a/views/default/input/tags.php +++ b/views/default/input/tags.php @@ -1,45 +1,45 @@ -<?php +<?php +/** + * Elgg tag input + * Displays a tag input field + * + * @package Elgg + * @subpackage Core - /** - * Elgg tag input - * Displays a tag input field - * - * @package Elgg - * @subpackage Core + * @author Curverider Ltd - * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * @uses $vars['value'] An array of tags + * @uses $vars['class'] Class override + */ - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * @uses $vars['value'] An array of tags - * @uses $vars['class'] Class override - */ +$class = $vars['class']; +if (!$class) { + $class = "input-tags"; +} - $class = $vars['class']; - if (!$class) $class = "input-tags"; +$tags = ""; +if (!empty($vars['value'])) { + if (is_array($vars['value'])) { + foreach($vars['value'] as $tag) { + + if (!empty($tags)) { + $tags .= ", "; + } + if (is_string($tag)) { + $tags .= $tag; + } else { + $tags .= $tag->value; + } + } + } else { + $tags = $vars['value']; + } +} - $tags = ""; - if (!empty($vars['value'])) { - if (is_array($vars['value'])) { - foreach($vars['value'] as $tag) { - - if (!empty($tags)) { - $tags .= ", "; - } - if (is_string($tag)) { - $tags .= $tag; - } else { - $tags .= $tag->value; - } - - } - } else { - $tags = $vars['value']; - } - } - ?> -<input type="text" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?><?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> value="<?php echo htmlentities($tags, ENT_QUOTES, 'UTF-8'); ?>" class="<?php echo $class; ?>"/>
\ No newline at end of file +<input type="text" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?><?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> value="<?php echo htmlentities($tags, ENT_QUOTES, 'UTF-8'); ?>" class="<?php echo $class; ?>"/>
\ No newline at end of file diff --git a/views/default/input/text.php b/views/default/input/text.php index 2a30ba081..1814e5801 100644 --- a/views/default/input/text.php +++ b/views/default/input/text.php @@ -1,27 +1,28 @@ <?php +/** + * Elgg text input + * Displays a text input field + * + * @package Elgg + * @subpackage Core - /** - * Elgg text input - * Displays a text input field - * - * @package Elgg - * @subpackage Core + * @author Curverider Ltd - * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * @uses $vars['disabled'] If true then control is read-only + * @uses $vars['class'] Class override + */ - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * @uses $vars['disabled'] If true then control is read-only - * @uses $vars['class'] Class override - */ - - $class = $vars['class']; - if (!$class) $class = "input-text"; - +$class = $vars['class']; +if (!$class) { + $class = "input-text"; +} + ?> -<input type="text" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" class="<?php echo $class ?>"/>
\ No newline at end of file +<input type="text" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" class="<?php echo $class ?>"/>
\ No newline at end of file diff --git a/views/default/input/url.php b/views/default/input/url.php index 82fde938e..6bf19d319 100644 --- a/views/default/input/url.php +++ b/views/default/input/url.php @@ -1,24 +1,23 @@ <?php +/** + * Elgg URL input + * Displays a URL input field + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * @uses $vars['class'] Class override + */ - /** - * Elgg URL input - * Displays a URL input field - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * @uses $vars['class'] Class override - */ - - $class = $vars['class']; - if (!$class) $class = "input-url"; +$class = $vars['class']; +if (!$class) { + $class = "input-url"; +} ?> -<input type="text" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" class="<?php echo $class; ?>"/>
\ No newline at end of file +<input type="text" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" class="<?php echo $class; ?>"/>
\ No newline at end of file diff --git a/views/default/input/urlshortener.php b/views/default/input/urlshortener.php index 4707809f5..7a8c2786a 100644 --- a/views/default/input/urlshortener.php +++ b/views/default/input/urlshortener.php @@ -1,10 +1,10 @@ <?php - /** - * This view provides a hook for third parties to provide a URL shortener. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ +/** + * This view provides a hook for third parties to provide a URL shortener. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ ?>
\ No newline at end of file diff --git a/views/default/input/userpicker.php b/views/default/input/userpicker.php index efe83ec14..742554dbd 100644 --- a/views/default/input/userpicker.php +++ b/views/default/input/userpicker.php @@ -1,23 +1,23 @@ -<?php +<?php /** - * User Picker. Sends an array of user guids. - * + * User Picker. Sends an array of user guids. + * * @package Elgg * @subpackage Core * @author Curverider Ltd * @link http://elgg.org/ - * + * * @uses $vars['value'] The current value, if any * @uses $vars['internalname'] The name of the input field - * - * + * + * * pops up defaulted to lazy load friends lists in paginated alphabetical order. - * upon - * + * upon + * * As users are checked they move down to a "users" box. * When this happens, a hidden input is created also. * {$internalnal}[] with the value th GUID. - * + * */ global $user_picker_js_sent; @@ -81,13 +81,13 @@ function userPickerFormatItem(row, i, max, term) { var r = ''; var name = info.name.replace(new RegExp("(" + term + ")", "gi"), "<span class=\"user_picker_highlight\">$1</b>"); var desc = info.desc.replace(new RegExp("(" + term + ")", "gi"), "<span class=\"user_picker_highlight\">$1</b>"); - + switch (info.type) { case 'user': case 'group': r = info.icon + name + ' - ' + desc; break; - + default: r = name + ' - ' + desc; break; @@ -103,10 +103,10 @@ function userPickerAddUser(event, data, formatted) { var internalName = picker.find('input.internalname').val(); // not sure why formatted isn't. var formatted = userPickerFormatItem(data); - + // add guid as hidden input and to list. var li = formatted + ' <a class="delete_collection" onclick="userPickerRemoveUser(this, ' + info.guid + ')"><strong>X</strong></a>' - + '<input type="hidden" name="' + internalName + '[]" value="' + info.guid + '" />'; + + '<input type="hidden" name="' + internalName + '[]" value="' + info.guid + '" />'; $('<li class="user_picker_entry">').html(li).appendTo(users); $(this).val(''); @@ -137,11 +137,10 @@ $(document).ready(function() { <input class="internalname" type="hidden" name="internalname" value="<?php echo $vars['internalname']; ?>" /> <input class="search" type="text" name="user_search" size="30"/> <span class="controls"> - <label><input class="all_users" type="checkbox" name="match_on" value="true" /><?php echo elgg_echo('userpicker:only_friends'); ?></label> + <label><input class="all_users" type="checkbox" name="match_on" value="true" /><?php echo elgg_echo('userpicker:only_friends'); ?></label> </span> <div class="results"> <!-- This space will be filled with users, checkboxes and magic. --> </div> <ul class="users"></ul> </div> - diff --git a/views/default/js/initialise_elgg.php b/views/default/js/initialise_elgg.php index e63cd70ef..fbe46824e 100644 --- a/views/default/js/initialise_elgg.php +++ b/views/default/js/initialise_elgg.php @@ -3,19 +3,19 @@ $(document).ready(function () { // COLLAPSABLE WIDGETS (on Dashboard & Profile pages) // toggle widget box contents $('a.toggle_box_contents').bind('click', toggleContent); - + // toggle widget box edit panel $('a.toggle_box_edit_panel').click(function () { $(this.parentNode.parentNode).children(".collapsable_box_editpanel").slideToggle("fast"); return false; }); - + // toggle customise edit panel $('a.toggle_customise_edit_panel').click(function () { $('div#customise_editpanel').slideToggle("fast"); return false; - }); - + }); + // toggle plugin's settings nad more info on admin tools admin $('a.pluginsettings_link').click(function () { $(this.parentNode.parentNode).children(".pluginsettings").slideToggle("fast"); @@ -30,12 +30,12 @@ $(document).ready(function () { $(this.parentNode.parentNode).children(".collapsible_box").slideToggle("fast"); return false; }); - + // WIDGET GALLERY EDIT PANEL // Sortable widgets var els = ['#leftcolumn_widgets', '#middlecolumn_widgets', '#rightcolumn_widgets', '#widget_picker_gallery' ]; var $els = $(els.toString()); - + $els.sortable({ items: '.draggable_widget', handle: '.drag_handle', @@ -47,25 +47,25 @@ $(document).ready(function () { appendTo: 'body', connectWith: els, start:function(e,ui) { - + }, - stop: function(e,ui) { - // refresh list before updating hidden fields with new widget order + stop: function(e,ui) { + // refresh list before updating hidden fields with new widget order $(this).sortable( "refresh" ); - + var widgetNamesLeft = outputWidgetList('#leftcolumn_widgets'); var widgetNamesMiddle = outputWidgetList('#middlecolumn_widgets'); var widgetNamesRight = outputWidgetList('#rightcolumn_widgets'); - + document.getElementById('debugField1').value = widgetNamesLeft; document.getElementById('debugField2').value = widgetNamesMiddle; document.getElementById('debugField3').value = widgetNamesRight; } }); - + // bind more info buttons - called when new widgets are created widget_moreinfo(); - + // set-up hover class for dragged widgets $("#rightcolumn_widgets").droppable({ accept: ".draggable_widget", @@ -85,7 +85,7 @@ $(document).ready(function () { // List active widgets for each page column function outputWidgetList(forElement) { - return( $("input[name='handler'], input[name='guid']", forElement ).makeDelimitedList("value") ); + return( $("input[name='handler'], input[name='guid']", forElement ).makeDelimitedList("value") ); } // Make delimited list @@ -93,7 +93,7 @@ jQuery.fn.makeDelimitedList = function(elementAttribute) { var delimitedListArray = new Array(); var listDelimiter = "::"; - + // Loop over each element in the stack and add the elementAttribute to the array this.each(function(e) { var listElement = $(this); @@ -101,7 +101,7 @@ jQuery.fn.makeDelimitedList = function(elementAttribute) { delimitedListArray[delimitedListArray.length] = listElement.attr(elementAttribute); } ); - + // Return value list by joining the array return(delimitedListArray.join(listDelimiter)); } @@ -117,7 +117,7 @@ function widget_state(forWidget) { $(forWidget).find("div.collapsable_box_content").hide(); $(forWidget).find("a.toggle_box_contents").html('+'); $(forWidget).find("a.toggle_box_edit_panel").fadeOut('medium'); - }; + }; } @@ -128,21 +128,21 @@ var targetContent = $('div.collapsable_box_content', this.parentNode.parentNode) targetContent.slideDown(400); $(this).html('-'); $(this.parentNode).children(".toggle_box_edit_panel").fadeIn('medium'); - + // set cookie for widget panel open-state var thisWidgetName = $(this.parentNode.parentNode.parentNode).attr('id'); $.cookie(thisWidgetName, 'expanded', { expires: 365 }); - + } else { targetContent.slideUp(400); $(this).html('+'); $(this.parentNode).children(".toggle_box_edit_panel").fadeOut('medium'); // make sure edit pane is closed $(this.parentNode.parentNode).children(".collapsable_box_editpanel").hide(); - + // set cookie for widget panel closed-state var thisWidgetName = $(this.parentNode.parentNode.parentNode).attr('id'); - $.cookie(thisWidgetName, 'collapsed', { expires: 365 }); + $.cookie(thisWidgetName, 'collapsed', { expires: 365 }); } return false; }; @@ -150,147 +150,132 @@ var targetContent = $('div.collapsable_box_content', this.parentNode.parentNode) // More info tooltip in widget gallery edit panel function widget_moreinfo() { - $("img.more_info").hover(function(e) { + $("img.more_info").hover(function(e) { var widgetdescription = $("input[name='description']", this.parentNode.parentNode.parentNode ).attr('value'); $("body").append("<p id='widget_moreinfo'><b>"+ widgetdescription +" </b></p>"); - + if (e.pageX < 900) { $("#widget_moreinfo") .css("top",(e.pageY + 10) + "px") .css("left",(e.pageX + 10) + "px") - .fadeIn("medium"); - } + .fadeIn("medium"); + } else { $("#widget_moreinfo") .css("top",(e.pageY + 10) + "px") .css("left",(e.pageX - 210) + "px") - .fadeIn("medium"); - } + .fadeIn("medium"); + } }, function() { $("#widget_moreinfo").remove(); - }); - + }); + $("img.more_info").mousemove(function(e) { // action on mousemove - }); + }); }; // COOKIES jQuery.cookie = function(name, value, options) { if (typeof value != 'undefined') { // name and value given, set cookie - options = options || {}; - if (value === null) { - value = ''; - options.expires = -1; - } - var expires = ''; - if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { - var date; - if (typeof options.expires == 'number') { - date = new Date(); - date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); - } else { - date = options.expires; - } - expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE - } - // CAUTION: Needed to parenthesize options.path and options.domain - // in the following expressions, otherwise they evaluate to undefined - // in the packed version for some reason. - var path = options.path ? '; path=' + (options.path) : ''; - var domain = options.domain ? '; domain=' + (options.domain) : ''; - var secure = options.secure ? '; secure' : ''; - document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); - + options = options || {}; + if (value === null) { + value = ''; + options.expires = -1; + } + var expires = ''; + if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { + var date; + if (typeof options.expires == 'number') { + date = new Date(); + date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); + } else { + date = options.expires; + } + expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE + } + // CAUTION: Needed to parenthesize options.path and options.domain + // in the following expressions, otherwise they evaluate to undefined + // in the packed version for some reason. + var path = options.path ? '; path=' + (options.path) : ''; + var domain = options.domain ? '; domain=' + (options.domain) : ''; + var secure = options.secure ? '; secure' : ''; + document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); + } else { // only name given, get cookie - var cookieValue = null; - if (document.cookie && document.cookie != '') { - var cookies = document.cookie.split(';'); - for (var i = 0; i < cookies.length; i++) { - var cookie = jQuery.trim(cookies[i]); - // Does this cookie string begin with the name we want? - if (cookie.substring(0, name.length + 1) == (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } - } - } - return cookieValue; + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = jQuery.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; } }; // ELGG TOOLBAR MENU $.fn.elgg_topbardropdownmenu = function(options) { - - options = $.extend({speed: 350}, options || {}); - - this.each(function() { - - var root = this, zIndex = 5000; - - function getSubnav(ele) { - if (ele.nodeName.toLowerCase() == 'li') { - var subnav = $('> ul', ele); - return subnav.length ? subnav[0] : null; - } else { - - return ele; - } - } - - function getActuator(ele) { - if (ele.nodeName.toLowerCase() == 'ul') { - return $(ele).parents('li')[0]; - } else { - return ele; - } - } - - function hide() { - var subnav = getSubnav(this); - if (!subnav) return; - $.data(subnav, 'cancelHide', false); - setTimeout(function() { - if (!$.data(subnav, 'cancelHide')) { - $(subnav).slideUp(100); - } - }, 250); - } - - function show() { - var subnav = getSubnav(this); - if (!subnav) return; - $.data(subnav, 'cancelHide', true); - $(subnav).css({zIndex: zIndex++}).slideDown(options.speed); - if (this.nodeName.toLowerCase() == 'ul') { - var li = getActuator(this); - $(li).addClass('hover'); - $('> a', li).addClass('hover'); - } - } - - $('ul, li', this).hover(show, hide); - $('li', this).hover( - function() { $(this).addClass('hover'); $('> a', this).addClass('hover'); }, - function() { $(this).removeClass('hover'); $('> a', this).removeClass('hover'); } - ); - - }); - -}; - - - - +options = $.extend({speed: 350}, options || {}); +this.each(function() { + var root = this, zIndex = 5000; + function getSubnav(ele) { + if (ele.nodeName.toLowerCase() == 'li') { + var subnav = $('> ul', ele); + return subnav.length ? subnav[0] : null; + } else { + return ele; + } + } + function getActuator(ele) { + if (ele.nodeName.toLowerCase() == 'ul') { + return $(ele).parents('li')[0]; + } else { + return ele; + } + } + function hide() { + var subnav = getSubnav(this); + if (!subnav) return; + $.data(subnav, 'cancelHide', false); + setTimeout(function() { + if (!$.data(subnav, 'cancelHide')) { + $(subnav).slideUp(100); + } + }, 250); + } + function show() { + var subnav = getSubnav(this); + if (!subnav) return; + $.data(subnav, 'cancelHide', true); + $(subnav).css({zIndex: zIndex++}).slideDown(options.speed); + if (this.nodeName.toLowerCase() == 'ul') { + var li = getActuator(this); + $(li).addClass('hover'); + $('> a', li).addClass('hover'); + } + } + $('ul, li', this).hover(show, hide); + $('li', this).hover( + function() { $(this).addClass('hover'); $('> a', this).addClass('hover'); }, + function() { $(this).removeClass('hover'); $('> a', this).removeClass('hover'); } + ); +}); +}; diff --git a/views/default/messages/errors/error.php b/views/default/messages/errors/error.php index 468505c89..26a24c807 100644 --- a/views/default/messages/errors/error.php +++ b/views/default/messages/errors/error.php @@ -1,20 +1,17 @@ <?php - - /** - * Elgg error message - * Displays a single error message - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['object'] An error message (string) - */ +/** + * Elgg error message + * Displays a single error message + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['object'] An error message (string) + */ ?> - <p> - <?php echo elgg_view('output/longtext', array('value' => $vars['object'])); ?> - </p>
\ No newline at end of file +<p> + <?php echo elgg_view('output/longtext', array('value' => $vars['object'])); ?> +</p>
\ No newline at end of file diff --git a/views/default/messages/errors/list.php b/views/default/messages/errors/list.php index e9b9b2ebb..846e22a80 100644 --- a/views/default/messages/errors/list.php +++ b/views/default/messages/errors/list.php @@ -1,57 +1,50 @@ <?php - - /** - * Elgg list errors - * Lists error messages - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['object'] An array of error messages - */ - - if (!empty($vars['object']) && is_array($vars['object'])) { +/** + * Elgg list errors + * Lists error messages + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['object'] An array of error messages + */ + +if (!empty($vars['object']) && is_array($vars['object'])) { ?> <!-- used to fade out the system messages after 3 seconds --> <script> $(document).ready(function () { - $('.messages_error').animate({opacity: 1.0}, 1000); + $('.messages_error').animate({opacity: 1.0}, 1000); $('.messages_error').animate({opacity: 1.0}, 5000); $('.messages_error').fadeOut('slow'); - + $('span.closeMessages a').click(function () { $(".messages_error").stop(); $('.messages_error').fadeOut('slow'); return false; - }); - + }); + $('div.messages_error').click(function () { $(".messages_error").stop(); $('.messages_error').fadeOut('slow'); return false; - }); + }); -}); +}); </script> <div class="messages_error"> <span class="closeMessages"><a href="#"><?php echo elgg_echo('systemmessages:dismiss'); ?></a></span> <?php - foreach($vars['object'] as $error) { - echo elgg_view('messages/errors/error',array('object' => $error)); - } + foreach($vars['object'] as $error) { + echo elgg_view('messages/errors/error',array('object' => $error)); + } ?> </div> <?php - } - - - -?>
\ No newline at end of file +}
\ No newline at end of file diff --git a/views/default/messages/exceptions/exception.php b/views/default/messages/exceptions/exception.php index 0b482d845..c93883cbc 100644 --- a/views/default/messages/exceptions/exception.php +++ b/views/default/messages/exceptions/exception.php @@ -1,44 +1,39 @@ <?php +/** + * Elgg exception + * Displays a single exception + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['object'] An exception + */ - /** - * Elgg exception - * Displays a single exception - * - * @package Elgg - * @subpackage Core +global $CONFIG; - * @author Curverider Ltd +$class = get_class($vars['object']); +$message = elgg_view('output/longtext', array('value' => $vars['object']->getMessage())); - * @link http://elgg.org/ - * - * @uses $vars['object'] An exception - */ +$body = <<< END +<p class="messages-exception"> + <span title="$class"> + <b>$message</b> + </span> +</p> +END; - global $CONFIG; - - $class = get_class($vars['object']); - $message = elgg_view('output/longtext', array('value' => $vars['object']->getMessage())); - - $body = <<< END - <p class="messages-exception"> - <span title="$class"> - <b>$message</b> - </span> +if ($CONFIG->debug) { + $details = elgg_view('output/longtext', array('value' => htmlentities(print_r($vars['object'], true), ENT_QUOTES, 'UTF-8'))); + $body .= <<< END + <hr /> + <p class="messages-exception-detail"> + $details </p> END; +} - if ($CONFIG->debug) - { - $details = elgg_view('output/longtext', array('value' => htmlentities(print_r($vars['object'], true), ENT_QUOTES, 'UTF-8'))); - $body .= <<< END - <hr /> - <p class="messages-exception-detail"> - $details - </p> -END; - } - - $title = $class; - - echo elgg_view_layout("one_column", elgg_view_title($title) . $body); -?>
\ No newline at end of file +$title = $class; + +echo elgg_view_layout("one_column", elgg_view_title($title) . $body);
\ No newline at end of file diff --git a/views/default/messages/list.php b/views/default/messages/list.php index dd02fdac5..62500882c 100644 --- a/views/default/messages/list.php +++ b/views/default/messages/list.php @@ -1,25 +1,18 @@ <?php +/** + * Elgg global system message list + * Lists all system messages + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['object'] The array of message registers + */ - /** - * Elgg global system message list - * Lists all system messages - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['object'] The array of message registers - */ - - if (!empty($vars['object']) && is_array($vars['object']) && sizeof($vars['object']) > 0) { - - foreach($vars['object'] as $register => $list ) { - echo elgg_view("messages/{$register}/list", array('object' => $list)); - } - - } - -?>
\ No newline at end of file +if (!empty($vars['object']) && is_array($vars['object']) && sizeof($vars['object']) > 0) { + foreach($vars['object'] as $register => $list ) { + echo elgg_view("messages/{$register}/list", array('object' => $list)); + } +} diff --git a/views/default/messages/messages/list.php b/views/default/messages/messages/list.php index 81f3a45a8..67da01657 100644 --- a/views/default/messages/messages/list.php +++ b/views/default/messages/messages/list.php @@ -1,58 +1,50 @@ <?php - - /** - * Elgg list system messages - * Lists system messages - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['object'] An array of system messages - */ - - if (!empty($vars['object']) && is_array($vars['object'])) { +/** + * Elgg list system messages + * Lists system messages + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['object'] An array of system messages + */ + +if (!empty($vars['object']) && is_array($vars['object'])) { ?> <!-- used to fade out the system messages after 3 seconds --> <script type="text/javascript"> $(document).ready(function () { - $('.messages').animate({opacity: 1.0}, 1000); + $('.messages').animate({opacity: 1.0}, 1000); $('.messages').animate({opacity: 1.0}, 5000); $('.messages').fadeOut('slow'); - + $('span.closeMessages a').click(function () { $(".messages").stop(); $('.messages').fadeOut('slow'); return false; - }); - + }); + $('div.messages').click(function () { $(".messages").stop(); $('.messages').fadeOut('slow'); return false; - }); -}); + }); +}); </script> <div class="messages"> <span class="closeMessages"><a href="#"><?php echo elgg_echo('systemmessages:dismiss'); ?></a></span> <?php - - - foreach($vars['object'] as $message) { - echo elgg_view('messages/messages/message',array('object' => $message)); - } - + foreach($vars['object'] as $message) { + echo elgg_view('messages/messages/message',array('object' => $message)); + } ?> </div> - -<?php - } +<?php -?>
\ No newline at end of file +} diff --git a/views/default/messages/messages/message.php b/views/default/messages/messages/message.php index bd3514e7a..717fd5e57 100644 --- a/views/default/messages/messages/message.php +++ b/views/default/messages/messages/message.php @@ -1,20 +1,17 @@ <?php - - /** - * Elgg standard message - * Displays a single Elgg system message - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - * - * @uses $vars['object'] A system message (string) - */ +/** + * Elgg standard message + * Displays a single Elgg system message + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['object'] A system message (string) + */ ?> - <p> - <?php echo elgg_view('output/longtext', array('value' => $vars['object'])); ?> - </p>
\ No newline at end of file +<p> + <?php echo elgg_view('output/longtext', array('value' => $vars['object'])); ?> +</p>
\ No newline at end of file diff --git a/views/default/navigation/pagination.php b/views/default/navigation/pagination.php index e141675c8..aec005eaf 100644 --- a/views/default/navigation/pagination.php +++ b/views/default/navigation/pagination.php @@ -1,75 +1,74 @@ <?php +/** + * Elgg pagination + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + */ - /** - * Elgg pagination - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - * - */ - - if (!isset($vars['offset'])) { - $offset = 0; - } else { - $offset = $vars['offset']; - } - if ((!isset($vars['limit'])) || (!$vars['limit'])) { - $limit = 10; - } else { - $limit = (int)$vars['limit']; - } - if (!isset($vars['count'])) { - $count = 0; - } else { - $count = $vars['count']; - } - if (!isset($vars['word'])) { - $word = "offset"; - } else { - $word = $vars['word']; - } - if (isset($vars['nonefound'])) { - $nonefound = $vars['nonefound']; - } else { - $nonefound = true; - } - - $totalpages = ceil($count / $limit); - $currentpage = ceil($offset / $limit) + 1; +if (!isset($vars['offset'])) { + $offset = 0; +} else { + $offset = $vars['offset']; +} +if ((!isset($vars['limit'])) || (!$vars['limit'])) { + $limit = 10; +} else { + $limit = (int)$vars['limit']; +} +if (!isset($vars['count'])) { + $count = 0; +} else { + $count = $vars['count']; +} +if (!isset($vars['word'])) { + $word = "offset"; +} else { + $word = $vars['word']; +} +if (isset($vars['nonefound'])) { + $nonefound = $vars['nonefound']; +} else { + $nonefound = true; +} - $baseurl = preg_replace('/[\&\?]'.$word.'\=[0-9]*/',"",$vars['baseurl']); - - //only display if there is content to paginate through or if we already have an offset - if (($count > $limit || $offset > 0) && get_context() != 'widget') { +$totalpages = ceil($count / $limit); +$currentpage = ceil($offset / $limit) + 1; -?> +$baseurl = preg_replace('/[\&\?]'.$word.'\=[0-9]*/',"",$vars['baseurl']); -<div class="pagination"> -<?php +//only display if there is content to paginate through or if we already have an offset +if (($count > $limit || $offset > 0) && get_context() != 'widget') { + + ?> + + <div class="pagination"> + <?php if ($offset > 0) { - + $prevoffset = $offset - $limit; if ($prevoffset < 0) $prevoffset = 0; - + $prevurl = $baseurl; if (substr_count($baseurl,'?')) { $prevurl .= "&{$word}=" . $prevoffset; } else { $prevurl .= "?{$word}=" . $prevoffset; } - + echo "<a href=\"{$prevurl}\" class=\"pagination_previous\">« ". elgg_echo("previous") ."</a> "; - + } if ($offset > 0 || $offset < ($count - $limit)) { - + $currentpage = round($offset / $limit) + 1; $allpages = ceil($count / $limit); - + $i = 1; $pagesarray = array(); while ($i <= $allpages && $i <= 4) { @@ -78,28 +77,27 @@ } $i = $currentpage - 2; while ($i <= $allpages && $i <= ($currentpage + 2)) { - if ($i > 0 && !in_array($i,$pagesarray)) + if ($i > 0 && !in_array($i,$pagesarray)) { $pagesarray[] = $i; + } $i++; } $i = $allpages - 3; while ($i <= $allpages) { - if ($i > 0 && !in_array($i,$pagesarray)) + if ($i > 0 && !in_array($i,$pagesarray)) { $pagesarray[] = $i; + } $i++; } - + sort($pagesarray); - + $prev = 0; foreach($pagesarray as $i) { - if (($i - $prev) > 1) { - echo "<span class=\"pagination_more\">...</span>"; - } - + $counturl = $baseurl; $curoffset = (($i - 1) * $limit); if (substr_count($baseurl,'?')) { @@ -113,30 +111,30 @@ echo "<span class=\"pagination_currentpage\"> {$i} </span>"; } $prev = $i; - - } + } } - + if ($offset < ($count - $limit)) { - + $nextoffset = $offset + $limit; - if ($nextoffset >= $count) $nextoffset--; - + if ($nextoffset >= $count) { + $nextoffset--; + } + $nexturl = $baseurl; if (substr_count($baseurl,'?')) { $nexturl .= "&{$word}=" . $nextoffset; } else { $nexturl .= "?{$word}=" . $nextoffset; } - + echo " <a href=\"{$nexturl}\" class=\"pagination_next\">" . elgg_echo("next") . " »</a>"; - + } -?> -<div class="clearfloat"></div> -</div> -<?php - } // end of pagination check if statement -?>
\ No newline at end of file + ?> + <div class="clearfloat"></div> + </div> + <?php +} // end of pagination check if statement
\ No newline at end of file diff --git a/views/default/navigation/topbar_tools.php b/views/default/navigation/topbar_tools.php index 49dacde72..897a827d6 100644 --- a/views/default/navigation/topbar_tools.php +++ b/views/default/navigation/topbar_tools.php @@ -1,47 +1,45 @@ <?php +/** + * Elgg standard tools drop down + * This will be populated depending on the plugins active - only plugin navigation will appear here + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + */ - /** - * Elgg standard tools drop down - * This will be populated depending on the plugins active - only plugin navigation will appear here - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - * - */ - - $menu = get_register('menu'); - - //var_export($menu); +$menu = get_register('menu'); + +//var_export($menu); + +if (is_array($menu) && sizeof($menu) > 0) { + $alphamenu = array(); + foreach($menu as $item) { + $alphamenu[$item->name] = $item; + } + ksort($alphamenu); - if (is_array($menu) && sizeof($menu) > 0) { - $alphamenu = array(); - foreach($menu as $item) { - $alphamenu[$item->name] = $item; - } - ksort($alphamenu); - ?> <ul class="topbardropdownmenu"> - <li class="drop"><a href="#" class="menuitemtools"><?php echo(elgg_echo('tools')); ?></a> - <ul> - <?php - foreach($alphamenu as $item) { - echo "<li><a href=\"{$item->value}\">" . $item->name . "</a></li>"; - } - ?> - </ul> - </li> + <li class="drop"><a href="#" class="menuitemtools"><?php echo(elgg_echo('tools')); ?></a> + <ul> + <?php + foreach($alphamenu as $item) { + echo "<li><a href=\"{$item->value}\">" . $item->name . "</a></li>"; + } + ?> + </ul> + </li> </ul> <script type="text/javascript"> - $(function() { - $('ul.topbardropdownmenu').elgg_topbardropdownmenu(); - }); +$(function() { + $('ul.topbardropdownmenu').elgg_topbardropdownmenu(); +}); </script> <?php - } -?> +}
\ No newline at end of file diff --git a/views/default/navigation/viewtype.php b/views/default/navigation/viewtype.php index c5f3a80a1..fcea39b61 100644 --- a/views/default/navigation/viewtype.php +++ b/views/default/navigation/viewtype.php @@ -1,34 +1,30 @@ <?php +/** + * Elgg list view switcher + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ - /** - * Elgg list view switcher - * - * @package Elgg - * @subpackage Core +$baseurl = preg_replace('/[\&\?]search\_viewtype\=[A-Za-z0-9]*/',"",$vars['baseurl']); - * @author Curverider Ltd +if ($vars['viewtype'] == "list") { + $viewtype = "gallery"; +} else { + $viewtype = "list"; +} - * @link http://elgg.org/ - */ - - - $baseurl = preg_replace('/[\&\?]search\_viewtype\=[A-Za-z0-9]*/',"",$vars['baseurl']); - - if ($vars['viewtype'] == "list") { - $viewtype = "gallery"; - } else { - $viewtype = "list"; - } - - if (substr_count($baseurl,'?')) { - $baseurl .= "&search_viewtype=" . $viewtype; - } else { - $baseurl .= "?search_viewtype=" . $viewtype; - } +if (substr_count($baseurl,'?')) { + $baseurl .= "&search_viewtype=" . $viewtype; +} else { + $baseurl .= "?search_viewtype=" . $viewtype; +} ?> - <div class="contentWrapper"> - <?php echo elgg_echo("viewtype:change") ?>: - <a href="<?php echo $baseurl; ?>"><?php echo elgg_echo("viewtype:{$viewtype}"); ?></a> - </div>
\ No newline at end of file +<div class="contentWrapper"> + <?php echo elgg_echo("viewtype:change") ?>: + <a href="<?php echo $baseurl; ?>"><?php echo elgg_echo("viewtype:{$viewtype}"); ?></a> +</div>
\ No newline at end of file diff --git a/views/default/notifications/settings/usersettings.php b/views/default/notifications/settings/usersettings.php index ff894cd0e..cba5cdef0 100644 --- a/views/default/notifications/settings/usersettings.php +++ b/views/default/notifications/settings/usersettings.php @@ -1,33 +1,30 @@ <?php - /** - * User settings for notifications. - * - * @package Elgg - * @subpackage Core +/** + * User settings for notifications. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ - * @author Curverider Ltd +global $NOTIFICATION_HANDLERS; +$notification_settings = get_user_notification_settings(page_owner()); - * @link http://elgg.org/ - */ - - global $NOTIFICATION_HANDLERS; - $notification_settings = get_user_notification_settings(page_owner()); - ?> - <h3><?php echo elgg_echo('notifications:usersettings'); ?></h3> - - <p><?php echo elgg_echo('notifications:methods'); ?> - - <table> +<h3><?php echo elgg_echo('notifications:usersettings'); ?></h3> + +<p><?php echo elgg_echo('notifications:methods'); ?> + +<table> <?php - // Loop through options - foreach ($NOTIFICATION_HANDLERS as $k => $v) - { + // Loop through options + foreach ($NOTIFICATION_HANDLERS as $k => $v) { ?> - <tr> - <td><?php echo elgg_echo($k); ?>: </td> + <tr> + <td><?php echo elgg_echo($k); ?>: </td> - <td> + <td> <?php if ($notification_settings->$k) { @@ -37,10 +34,10 @@ } echo elgg_view('input/radio',array('internalname' => "method[{$k}]", 'options' => array(elgg_echo('option:yes') => 'yes',elgg_echo('option:no') => 'no'), 'value' => $val)); -?> - </td> - </tr> +?> + </td> + </tr> <?php - } + } ?> - </table>
\ No newline at end of file +</table>
\ No newline at end of file diff --git a/views/default/object/default.php b/views/default/object/default.php index 10ac062d1..3ace73d7f 100644 --- a/views/default/object/default.php +++ b/views/default/object/default.php @@ -1,57 +1,59 @@ <?php - /** - * ElggEntity default view. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ - - if ($vars['full']) { - echo elgg_view('export/entity', $vars); - } else { - - $icon = elgg_view( - 'graphics/icon', array( - 'entity' => $vars['entity'], - 'size' => 'small', - ) - ); - - - $title = $vars['entity']->title; - if (!$title) $title = $vars['entity']->name; - if (!$title) $title = get_class($vars['entity']); - - $controls = ""; - if ($vars['entity']->canEdit()) - { - $controls .= " (<a href=\"{$vars['url']}action/entities/delete?guid={$vars['entity']->guid}\">" . elgg_echo('delete') . "</a>)"; - } - - $info = "<div><p><b><a href=\"" . $vars['entity']->getUrl() . "\">" . $title . "</a></b> $controls </p></div>"; - - if (get_input('search_viewtype') == "gallery") { - - $icon = ""; - - } - - $owner = $vars['entity']->getOwnerEntity(); - $ownertxt = elgg_echo('unknown'); - if ($owner) - $ownertxt = "<a href=\"" . $owner->getURL() . "\">" . $owner->name ."</a>"; - - $info .= "<div>".sprintf(elgg_echo("entity:default:strapline"), - friendly_time($vars['entity']->time_created), - $ownertxt - ); - - $info .= "</div>"; - - $info = "<span title=\"" . elgg_echo('entity:default:missingsupport:popup') . "\">$info</span>"; - $icon = "<span title=\"" . elgg_echo('entity:default:missingsupport:popup') . "\">$icon</span>"; - - echo elgg_view_listing($icon, $info); +/** + * ElggEntity default view. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ + +if ($vars['full']) { + echo elgg_view('export/entity', $vars); +} else { + + $icon = elgg_view( + 'graphics/icon', array( + 'entity' => $vars['entity'], + 'size' => 'small', + ) + ); + + + $title = $vars['entity']->title; + if (!$title) { + $title = $vars['entity']->name; + } + if (!$title) { + $title = get_class($vars['entity']); + } + + $controls = ""; + if ($vars['entity']->canEdit()) { + $controls .= " (<a href=\"{$vars['url']}action/entities/delete?guid={$vars['entity']->guid}\">" . elgg_echo('delete') . "</a>)"; + } + + $info = "<div><p><b><a href=\"" . $vars['entity']->getUrl() . "\">" . $title . "</a></b> $controls </p></div>"; + + if (get_input('search_viewtype') == "gallery") { + $icon = ""; + } + + $owner = $vars['entity']->getOwnerEntity(); + $ownertxt = elgg_echo('unknown'); + if ($owner) { + $ownertxt = "<a href=\"" . $owner->getURL() . "\">" . $owner->name ."</a>"; } + + $info .= "<div>".sprintf(elgg_echo("entity:default:strapline"), + friendly_time($vars['entity']->time_created), + $ownertxt + ); + + $info .= "</div>"; + + $info = "<span title=\"" . elgg_echo('entity:default:missingsupport:popup') . "\">$info</span>"; + $icon = "<span title=\"" . elgg_echo('entity:default:missingsupport:popup') . "\">$icon</span>"; + + echo elgg_view_listing($icon, $info); +}
\ No newline at end of file diff --git a/views/default/object/object.php b/views/default/object/object.php index a27a2910f..2be9e1fa1 100644 --- a/views/default/object/object.php +++ b/views/default/object/object.php @@ -1,15 +1,15 @@ <?php - /** - * Elgg default object view. - * This is a placeholder. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ +/** + * Elgg default object view. + * This is a placeholder. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ - $entity = $vars['entity']; +$entity = $vars['entity']; ?> <div> diff --git a/views/default/object/plugin.php b/views/default/object/plugin.php index 5f9c5354c..411a9f8d8 100644 --- a/views/default/object/plugin.php +++ b/views/default/object/plugin.php @@ -1,20 +1,19 @@ <?php - /** - * Elgg plugin - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ +/** + * Elgg plugin + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ - $entity = $vars['entity']; - $plugin = $vars['plugin']; - $prefix = $vars['prefix']; // Do we want to show admin settings (default) or user settings - - $form_body = elgg_view("{$prefix}settings/{$plugin}/edit", $vars); - $form_body .= "<p>" . elgg_view('input/hidden', array('internalname' => 'plugin', 'value' => $plugin)) . elgg_view('input/submit', array('value' => elgg_echo('save'))) . "</p>"; - +$entity = $vars['entity']; +$plugin = $vars['plugin']; +$prefix = $vars['prefix']; // Do we want to show admin settings (default) or user settings + +$form_body = elgg_view("{$prefix}settings/{$plugin}/edit", $vars); +$form_body .= "<p>" . elgg_view('input/hidden', array('internalname' => 'plugin', 'value' => $plugin)) . elgg_view('input/submit', array('value' => elgg_echo('save'))) . "</p>"; ?> <div> diff --git a/views/default/object/widget.php b/views/default/object/widget.php index b49120e2e..9dd2999ce 100644 --- a/views/default/object/widget.php +++ b/views/default/object/widget.php @@ -1,16 +1,11 @@ <?php - - /** - * Elgg default widget view - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - */ - - echo elgg_view('widgets/wrapper',$vars); - -?>
\ No newline at end of file +/** + * Elgg default widget view + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ + +echo elgg_view('widgets/wrapper',$vars); 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 |