/application/helper/smarty/function.uniqid.php
PHP | 39 lines | 23 code | 5 blank | 11 comment | 3 complexity | 3ad571cf1f33eccb7a6ea59c0dfea878 MD5 | raw file
Possible License(s): LGPL-3.0
- <?php
- /**
- * ...
- *
- * @param array $params
- * @param Smarty $smarty
- * @return string
- *
- * @package application.helper.smarty
- * @author Integry Systems
- */
- function smarty_function_uniqid($params, Smarty_Internal_Template $smarty)
- {
- if (isset($params['last']))
- {
- return $smarty->getTemplateVars('lastUniqId');
- }
- else
- {
- // start with a letter for XHTML id attribute value compatibility
- $id = 'a' . uniqid();
- $smarty->assign('lastUniqId', $id);
- if (isset($params['assign']))
- {
- $smarty->assign($params['assign'], $id);
- if (!empty($params['noecho']))
- {
- return '';
- }
- }
- return $id;
- }
- }
- ?>