|
1
|
|
|
<?php |
|
2
|
|
|
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ |
|
3
|
|
|
|
|
4
|
|
|
/** |
|
5
|
|
|
* HTML class for a hidden type element |
|
6
|
|
|
* |
|
7
|
|
|
* PHP versions 4 and 5 |
|
8
|
|
|
* |
|
9
|
|
|
* LICENSE: This source file is subject to version 3.01 of the PHP license |
|
10
|
|
|
* that is available through the world-wide-web at the following URI: |
|
11
|
|
|
* http://www.php.net/license/3_01.txt If you did not receive a copy of |
|
12
|
|
|
* the PHP License and are unable to obtain it through the web, please |
|
13
|
|
|
* send a note to [email protected] so we can mail you a copy immediately. |
|
14
|
|
|
* |
|
15
|
|
|
* @category HTML |
|
16
|
|
|
* @package HTML_QuickForm |
|
17
|
|
|
* @author Adam Daniel <[email protected]> |
|
18
|
|
|
* @author Bertrand Mansion <[email protected]> |
|
19
|
|
|
* @copyright 2001-2009 The PHP Group |
|
20
|
|
|
* @license http://www.php.net/license/3_01.txt PHP License 3.01 |
|
21
|
|
|
* @version CVS: $Id: hidden.php,v 1.12 2009/04/04 21:34:03 avb Exp $ |
|
22
|
|
|
* @link http://pear.php.net/package/HTML_QuickForm |
|
23
|
|
|
*/ |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* HTML class for a hidden type element |
|
27
|
|
|
* |
|
28
|
|
|
* @category HTML |
|
29
|
|
|
* @package HTML_QuickForm |
|
30
|
|
|
* @author Adam Daniel <[email protected]> |
|
31
|
|
|
* @author Bertrand Mansion <[email protected]> |
|
32
|
|
|
* @version Release: 3.2.11 |
|
33
|
|
|
* @since 1.0 |
|
34
|
|
|
*/ |
|
35
|
|
View Code Duplication |
class HTML_QuickForm_hidden extends HTML_QuickForm_input |
|
|
|
|
|
|
36
|
|
|
{ |
|
37
|
|
|
// {{{ constructor |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Class constructor |
|
41
|
|
|
* |
|
42
|
|
|
* @param string $elementName (optional)Input field name attribute |
|
43
|
|
|
* @param string $value (optional)Input field value |
|
44
|
|
|
* @param mixed $attributes (optional)Either a typical HTML attribute string |
|
45
|
|
|
* or an associative array |
|
46
|
|
|
* @since 1.0 |
|
47
|
|
|
* @access public |
|
48
|
|
|
* @return void |
|
|
|
|
|
|
49
|
|
|
*/ |
|
50
|
|
|
public function __construct($elementName = null, $value = '', $attributes = null) |
|
51
|
|
|
{ |
|
52
|
|
|
parent::__construct($elementName, null, $attributes); |
|
53
|
|
|
$this->setType('hidden'); |
|
54
|
|
|
$this->setValue($value); |
|
55
|
|
|
} //end constructor |
|
56
|
|
|
|
|
57
|
|
|
// }}} |
|
58
|
|
|
// {{{ freeze() |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Freeze the element so that only its value is returned |
|
62
|
|
|
* |
|
63
|
|
|
* @access public |
|
64
|
|
|
* @return void |
|
65
|
|
|
*/ |
|
66
|
|
|
function freeze() |
|
67
|
|
|
{ |
|
68
|
|
|
return false; |
|
69
|
|
|
} //end func freeze |
|
70
|
|
|
|
|
71
|
|
|
// }}} |
|
72
|
|
|
// {{{ accept() |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Accepts a renderer |
|
76
|
|
|
* |
|
77
|
|
|
* @param HTML_QuickForm_Renderer renderer object |
|
78
|
|
|
* @access public |
|
79
|
|
|
* @return void |
|
80
|
|
|
*/ |
|
81
|
|
|
//function accept(&$renderer) |
|
82
|
|
|
function accept(&$renderer, $required=false, $error=null) |
|
83
|
|
|
{ |
|
84
|
|
|
$renderer->renderHidden($this); |
|
85
|
|
|
} // end func accept |
|
86
|
|
|
|
|
87
|
|
|
// }}} |
|
88
|
|
|
|
|
89
|
|
|
} //end class HTML_QuickForm_hidden |
|
90
|
|
|
?> |
|
|
|
|
|
|
91
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.