-
Notifications
You must be signed in to change notification settings - Fork 0
/
function.html_hidden.php
49 lines (46 loc) · 1.05 KB
/
function.html_hidden.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* template_lite {html_hidden} function plugin
*
* Type: function
* Name: html_hidden
* Purpose: Creates a hidden box
* Input:
* - name = the name of the hidden field
* - value = the value of the hidden field
* Author: Paul Lockaby <[email protected]>
*/
function tpl_function_html_hidden($params, &$tpl)
{
require_once("shared.escape_chars.php");
$name = null;
$value = '';
$extra = '';
foreach($params as $_key => $_value)
{
switch($_key)
{
case 'name':
case 'value':
$$_key = $_value;
break;
default:
if(!is_array($_key))
{
$extra .= ' ' . $_key . '="' . tpl_escape_chars($_value) . '"';
}
else
{
$tpl->trigger_error("html_hidden: attribute '$_key' cannot be an array");
}
}
}
if (!isset($name) || empty($name))
{
$tpl->trigger_error("html_input: missing 'name' parameter");
return;
}
$toReturn = '<input type="hidden" name="' . tpl_escape_chars($name) . '" value="' . tpl_escape_chars($value) . '" ' . $extra . ' />';
return $toReturn;
}
?>