button.php 727 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * Create a input button
  4. *
  5. * @uses $vars['value'] The current value, if any
  6. * @uses $vars['name'] The name of the input field
  7. * @uses $vars['type'] submit or button.
  8. */
  9. if (isset($vars['class'])) {
  10. $class = $vars['class'];
  11. } else {
  12. $class = "elgg-button-submit";
  13. }
  14. if (isset($vars['name'])) {
  15. $name = $vars['name'];
  16. } else {
  17. $name = '';
  18. }
  19. if (isset($vars['type'])) {
  20. $type = strtolower($vars['type']);
  21. } else {
  22. $type = 'submit';
  23. }
  24. switch ($type) {
  25. case 'button' :
  26. $type='button';
  27. break;
  28. case 'submit':
  29. default:
  30. $type = 'submit';
  31. }
  32. $value = htmlentities($vars['value'], ENT_QUOTES, 'UTF-8');
  33. ?>
  34. <input type="<?php echo $type; ?>" value="<?php echo $value; ?>" class="<?php echo $class; ?>" />