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