PageRenderTime 51ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/application/helper/smarty/function.uniqid.php

http://github.com/integry/livecart
PHP | 39 lines | 23 code | 5 blank | 11 comment | 3 complexity | 3ad571cf1f33eccb7a6ea59c0dfea878 MD5 | raw file
Possible License(s): LGPL-3.0
  1. <?php
  2. /**
  3. * ...
  4. *
  5. * @param array $params
  6. * @param Smarty $smarty
  7. * @return string
  8. *
  9. * @package application.helper.smarty
  10. * @author Integry Systems
  11. */
  12. function smarty_function_uniqid($params, Smarty_Internal_Template $smarty)
  13. {
  14. if (isset($params['last']))
  15. {
  16. return $smarty->getTemplateVars('lastUniqId');
  17. }
  18. else
  19. {
  20. // start with a letter for XHTML id attribute value compatibility
  21. $id = 'a' . uniqid();
  22. $smarty->assign('lastUniqId', $id);
  23. if (isset($params['assign']))
  24. {
  25. $smarty->assign($params['assign'], $id);
  26. if (!empty($params['noecho']))
  27. {
  28. return '';
  29. }
  30. }
  31. return $id;
  32. }
  33. }
  34. ?>