PageRenderTime 162ms CodeModel.GetById 81ms app.highlight 1ms RepoModel.GetById 79ms 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
 1<?php
 2
 3/**
 4 * ...
 5 *
 6 * @param array $params
 7 * @param Smarty $smarty
 8 * @return string
 9 *
10 * @package application.helper.smarty
11 * @author Integry Systems
12 */
13function smarty_function_uniqid($params, Smarty_Internal_Template $smarty)
14{
15	if (isset($params['last']))
16	{
17		return $smarty->getTemplateVars('lastUniqId');
18	}
19	else
20	{
21		// start with a letter for XHTML id attribute value compatibility
22		$id = 'a' . uniqid();
23		$smarty->assign('lastUniqId', $id);
24
25		if (isset($params['assign']))
26		{
27			$smarty->assign($params['assign'], $id);
28
29			if (!empty($params['noecho']))
30			{
31				return '';
32			}
33		}
34
35		return $id;
36	}
37}
38
39?>