document.inc.php
7.98 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
<?php
/*
File: document.inc.php
HTML Control Library - Document Level Tags
Title: xajax HTML control class library
Please see <copyright.inc.php> for a detailed description, copyright
and license information.
*/
/*
@package xajax
@version $Id: document.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $
@copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson
@copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson
@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/
/*
Section: Description
This file contains the class declarations for the following HTML Controls:
- document, doctype, html, head, body
- meta, link, script, style
- title, base
- noscript
- frameset, frame, iframe, noframes
The following controls are deprecated as of HTML 4.01, so they will not be supported:
- basefont
*/
class clsDocument extends xajaxControlContainer
{
function clsDocument($aConfiguration=array())
{
if (isset($aConfiguration['attributes']))
trigger_error(
'clsDocument objects cannot have attributes.'
. $this->backtrace(),
E_USER_ERROR);
xajaxControlContainer::xajaxControlContainer('DOCUMENT', $aConfiguration);
$this->sClass = '%block';
}
function printHTML()
{
$tStart = microtime();
$this->_printChildren();
$tStop = microtime();
echo '<' . '!--';
echo ' page generation took ';
$nTime = $tStop - $tStart;
$nTime *= 1000;
echo $nTime;
echo ' --' . '>';
}
}
class clsDoctype extends xajaxControlContainer
{
var $sText;
var $sFormat;
var $sVersion;
var $sValidation;
var $sEncoding;
function clsDocType($sFormat=null, $sVersion=null, $sValidation=null, $sEncoding='UTF-8')
{
if (null === $sFormat && false == defined('XAJAX_HTML_CONTROL_DOCTYPE_FORMAT'))
trigger_error('You must specify a doctype format.', E_USER_ERROR);
if (null === $sVersion && false == defined('XAJAX_HTML_CONTROL_DOCTYPE_VERSION'))
trigger_error('You must specify a doctype version.', E_USER_ERROR);
if (null === $sValidation && false == defined('XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION'))
trigger_error('You must specify a doctype validation.', E_USER_ERROR);
if (null === $sFormat)
$sFormat = XAJAX_HTML_CONTROL_DOCTYPE_FORMAT;
if (null === $sVersion)
$sVersion = XAJAX_HTML_CONTROL_DOCTYPE_VERSION;
if (null === $sValidation)
$sValidation = XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION;
xajaxControlContainer::xajaxControlContainer('DOCTYPE', array());
$this->sText = '<'.'!DOCTYPE html PUBLIC "-//W3C//DTD ';
$this->sText .= $sFormat;
$this->sText .= ' ';
$this->sText .= $sVersion;
if ('TRANSITIONAL' == $sValidation)
$this->sText .= ' Transitional';
else if ('FRAMESET' == $sValidation)
$this->sText .= ' Frameset';
$this->sText .= '//EN" ';
if ('HTML' == $sFormat) {
if ('4.0' == $sVersion) {
if ('STRICT' == $sValidation)
$this->sText .= '"http://www.w3.org/TR/html40/strict.dtd"';
else if ('TRANSITIONAL' == $sValidation)
$this->sText .= '"http://www.w3.org/TR/html40/loose.dtd"';
} else if ('4.01' == $sVersion) {
if ('STRICT' == $sValidation)
$this->sText .= '"http://www.w3.org/TR/html401/strict.dtd"';
else if ('TRANSITIONAL' == $sValidation)
$this->sText .= '"http://www.w3.org/TR/html401/loose.dtd"';
else if ('FRAMESET' == $sValidation)
$this->sText .= '"http://www.w3.org/TR/html4/frameset.dtd"';
}
} else if ('XHTML' == $sFormat) {
if ('1.0' == $sVersion) {
if ('STRICT' == $sValidation)
$this->sText .= '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"';
else if ('TRANSITIONAL' == $sValidation)
$this->sText .= '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"';
} else if ('1.1' == $sVersion) {
$this->sText .= '"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"';
}
} else
trigger_error('Unsupported DOCTYPE tag.'
. $this->backtrace(),
E_USER_ERROR
);
$this->sText .= '>';
$this->sFormat = $sFormat;
$this->sVersion = $sVersion;
$this->sValidation = $sValidation;
$this->sEncoding = $sEncoding;
}
function printHTML($sIndent='')
{
header('content-type: text/html; charset=' . $this->sEncoding);
if ('XHTML' == $this->sFormat)
print '<' . '?' . 'xml version="1.0" encoding="' . $this->sEncoding . '" ' . '?' . ">\n";
print $this->sText;
print "\n";
xajaxControlContainer::_printChildren($sIndent);
}
}
class clsHtml extends xajaxControlContainer
{
function clsHtml($aConfiguration=array())
{
xajaxControlContainer::xajaxControlContainer('html', $aConfiguration);
$this->sClass = '%block';
$this->sEndTag = 'optional';
}
}
class clsHead extends xajaxControlContainer
{
var $objXajax;
function clsHead($aConfiguration=array())
{
$this->objXajax = null;
if (isset($aConfiguration['xajax']))
$this->setXajax($aConfiguration['xajax']);
xajaxControlContainer::xajaxControlContainer('head', $aConfiguration);
$this->sClass = '%block';
$this->sEndTag = 'optional';
}
function setXajax(&$objXajax)
{
$this->objXajax =& $objXajax;
}
function _printChildren($sIndent='')
{
if (null != $this->objXajax)
$this->objXajax->printJavascript();
xajaxControlContainer::_printChildren($sIndent);
}
}
class clsBody extends xajaxControlContainer
{
function clsBody($aConfiguration=array())
{
xajaxControlContainer::xajaxControlContainer('body', $aConfiguration);
$this->sClass = '%block';
$this->sEndTag = 'optional';
}
}
class clsScript extends xajaxControlContainer
{
function clsScript($aConfiguration=array())
{
xajaxControlContainer::xajaxControlContainer('script', $aConfiguration);
$this->sClass = '%block';
}
}
class clsStyle extends xajaxControlContainer
{
function clsStyle($aConfiguration=array())
{
xajaxControlContainer::xajaxControlContainer('style', $aConfiguration);
$this->sClass = '%block';
}
}
class clsLink extends xajaxControl
{
function clsLink($aConfiguration=array())
{
xajaxControl::xajaxControl('link', $aConfiguration);
$this->sClass = '%block';
}
}
class clsMeta extends xajaxControl
{
function clsMeta($aConfiguration=array())
{
xajaxControl::xajaxControl('meta', $aConfiguration);
$this->sClass = '%block';
}
}
class clsTitle extends xajaxControlContainer
{
function clsTitle($aConfiguration=array())
{
xajaxControlContainer::xajaxControlContainer('title', $aConfiguration);
$this->sClass = '%block';
}
function setEvent($sEvent, &$objRequest)
{
trigger_error(
'clsTitle objects do not support events.'
. $this->backtrace(),
E_USER_ERROR);
}
}
class clsBase extends xajaxControl
{
function clsBase($aConfiguration=array())
{
xajaxControl::xajaxControl('base', $aConfiguration);
$this->sClass = '%block';
}
}
class clsNoscript extends xajaxControlContainer
{
function clsNoscript($aConfiguration=array())
{
xajaxControlContainer::xajaxControlContainer('noscript', $aConfiguration);
$this->sClass = '%flow';
}
}
class clsIframe extends xajaxControlContainer
{
function clsIframe($aConfiguration=array())
{
xajaxControlContainer::xajaxControlContainer('iframe', $aConfiguration);
$this->sClass = '%block';
}
}
class clsFrameset extends xajaxControlContainer
{
function clsFrameset($aConfiguration=array())
{
xajaxControlContainer::xajaxControlContainer('frameset', $aConfiguration);
$this->sClass = '%block';
}
}
class clsFrame extends xajaxControl
{
function clsFrame($aConfiguration=array())
{
xajaxControl::xajaxControl('frame', $aConfiguration);
$this->sClass = '%block';
}
}
class clsNoframes extends xajaxControlContainer
{
function clsNoframes($aConfiguration=array())
{
xajaxControlContainer::xajaxControlContainer('noframes', $aConfiguration);
$this->sClass = '%flow';
}
}