|
1
|
|
|
<?php |
|
2
|
|
|
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ |
|
3
|
|
|
|
|
4
|
|
|
/** |
|
5
|
|
|
* An abstract base class for QuickForm renderers |
|
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 Alexey Borzov <[email protected]> |
|
18
|
|
|
* @copyright 2001-2009 The PHP Group |
|
19
|
|
|
* @license http://www.php.net/license/3_01.txt PHP License 3.01 |
|
20
|
|
|
* @version CVS: $Id$ |
|
21
|
|
|
* @link http://pear.php.net/package/HTML_QuickForm |
|
22
|
|
|
*/ |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* An abstract base class for QuickForm renderers |
|
26
|
|
|
* |
|
27
|
|
|
* The class implements a Visitor design pattern |
|
28
|
|
|
* |
|
29
|
|
|
* @category HTML |
|
30
|
|
|
* @package HTML_QuickForm |
|
31
|
|
|
* @author Alexey Borzov <[email protected]> |
|
32
|
|
|
* @version Release: 3.2.11 |
|
33
|
|
|
* @since 3.0 |
|
34
|
|
|
* @abstract |
|
35
|
|
|
*/ |
|
36
|
|
|
class HTML_QuickForm_Renderer |
|
37
|
|
|
{ |
|
38
|
|
|
/** |
|
39
|
|
|
* Constructor |
|
40
|
|
|
* |
|
41
|
|
|
* @access public |
|
42
|
|
|
*/ |
|
43
|
|
|
public function __construct() |
|
44
|
|
|
{ |
|
45
|
|
|
} // end constructor |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Called when visiting a form, before processing any form elements |
|
49
|
|
|
* |
|
50
|
|
|
* @param HTML_QuickForm a form being visited |
|
51
|
|
|
* @access public |
|
52
|
|
|
* @return void |
|
53
|
|
|
* @abstract |
|
54
|
|
|
*/ |
|
55
|
|
|
function startForm(&$form) |
|
56
|
|
|
{ |
|
57
|
|
|
return; |
|
58
|
|
|
} // end func startForm |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Called when visiting a form, after processing all form elements |
|
62
|
|
|
* |
|
63
|
|
|
* @param HTML_QuickForm a form being visited |
|
64
|
|
|
* @access public |
|
65
|
|
|
* @return void |
|
66
|
|
|
* @abstract |
|
67
|
|
|
*/ |
|
68
|
|
|
function finishForm(&$form) |
|
69
|
|
|
{ |
|
70
|
|
|
return; |
|
71
|
|
|
} // end func finishForm |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* Called when visiting a header element |
|
75
|
|
|
* |
|
76
|
|
|
* @param HTML_QuickForm_header a header element being visited |
|
77
|
|
|
* @access public |
|
78
|
|
|
* @return void |
|
79
|
|
|
* @abstract |
|
80
|
|
|
*/ |
|
81
|
|
|
function renderHeader(&$header) |
|
82
|
|
|
{ |
|
83
|
|
|
return; |
|
84
|
|
|
} // end func renderHeader |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* Called when visiting an element |
|
88
|
|
|
* |
|
89
|
|
|
* @param HTML_QuickForm_element form element being visited |
|
90
|
|
|
* @param bool Whether an element is required |
|
91
|
|
|
* @param string An error message associated with an element |
|
92
|
|
|
* @access public |
|
93
|
|
|
* @return void |
|
94
|
|
|
* @abstract |
|
95
|
|
|
*/ |
|
96
|
|
|
function renderElement(&$element, $required, $error) |
|
97
|
|
|
{ |
|
98
|
|
|
return; |
|
99
|
|
|
} // end func renderElement |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* Called when visiting a hidden element |
|
103
|
|
|
* |
|
104
|
|
|
* @param HTML_QuickForm_element a hidden element being visited |
|
105
|
|
|
* @access public |
|
106
|
|
|
* @return void |
|
107
|
|
|
* @abstract |
|
108
|
|
|
*/ |
|
109
|
|
|
function renderHidden(&$element) |
|
110
|
|
|
{ |
|
111
|
|
|
return; |
|
112
|
|
|
} // end func renderHidden |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* Called when visiting a raw HTML/text pseudo-element |
|
116
|
|
|
* |
|
117
|
|
|
* Only implemented in Default renderer. Usage of 'html' elements is |
|
118
|
|
|
* discouraged, templates should be used instead. |
|
119
|
|
|
* |
|
120
|
|
|
* @param HTML_QuickForm_html a 'raw html' element being visited |
|
121
|
|
|
* @access public |
|
122
|
|
|
* @return void |
|
123
|
|
|
* @abstract |
|
124
|
|
|
*/ |
|
125
|
|
|
function renderHtml(&$data) |
|
126
|
|
|
{ |
|
127
|
|
|
return; |
|
128
|
|
|
} // end func renderHtml |
|
129
|
|
|
|
|
130
|
|
|
/** |
|
131
|
|
|
* Called when visiting a group, before processing any group elements |
|
132
|
|
|
* |
|
133
|
|
|
* @param HTML_QuickForm_group A group being visited |
|
134
|
|
|
* @param bool Whether a group is required |
|
135
|
|
|
* @param string An error message associated with a group |
|
136
|
|
|
* @access public |
|
137
|
|
|
* @return void |
|
138
|
|
|
* @abstract |
|
139
|
|
|
*/ |
|
140
|
|
|
function startGroup(&$group, $required, $error) |
|
141
|
|
|
{ |
|
142
|
|
|
return; |
|
143
|
|
|
} // end func startGroup |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* Called when visiting a group, after processing all group elements |
|
147
|
|
|
* |
|
148
|
|
|
* @param HTML_QuickForm_group A group being visited |
|
149
|
|
|
* @access public |
|
150
|
|
|
* @return void |
|
151
|
|
|
* @abstract |
|
152
|
|
|
*/ |
|
153
|
|
|
function finishGroup(&$group) |
|
154
|
|
|
{ |
|
155
|
|
|
return; |
|
156
|
|
|
} // end func finishGroup |
|
157
|
|
|
} // end class HTML_QuickForm_Renderer |
|
158
|
|
|
?> |
|
|
|
|
|
|
159
|
|
|
|
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.