This repository was archived by the owner on Jan 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDOCTYPE.php
More file actions
58 lines (57 loc) · 1.77 KB
/
Copy pathDOCTYPE.php
File metadata and controls
58 lines (57 loc) · 1.77 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
<?php
namespace RedCat\Templix;
use RedCat\Templix\Markup;
class DOCTYPE extends Markup{
protected $selfClosed = true;
protected $hiddenWrap = true;
private $contentText = '';
private $__compat;
var $nodeName = 'DOCTYPE';
function parse($text){
$this->contentText = self::phpImplode($text,$this->constructor);
$this->__compat = substr($this->contentText,10,-1);
if($this->__compat!='html'&&$this->templix)
$this->templix->isXhtml = true;
if($this->previousSibling&&$this->previousSibling->spaceAfterClose)
$this->previousSibling->spaceAfterClose = false;
if($this->parent&&$this->parent->spaceAfterOpen)
$this->parent->spaceAfterOpen = false;
}
function getInner(){
return $this->contentText;
}
function loaded(){
if($html=$this->closest()->children('html',0)){
if($this->__compat=='xhtml'){
$html->metaAttribution[] = '<?php if(stristr(@$_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) echo \'xmlns="http://www.w3.org/1999/xhtml"\';?>';
}
elseif($this->__compat=='xml'||$this->__compat!='html')
$html->xmlns = "http://www.w3.org/1999/xhtml";
}
$xml = 'echo \'<?xml version="1.0" encoding="utf-8"?>\';';
switch($this->__compat){
case 'xhtml5':
case 'xhtml':
$str = '<?php
if(stristr(@$_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")){
header("Content-Type: application/xhtml+xml; charset=utf-8");
'.$xml.'
}
else{
header("Content-Type: text/html; charset=utf-8");
?><!DOCTYPE html><?php
}
?>';
break;
case 'html5':
case 'html':
$str = '<!DOCTYPE html>';
break;
default:
case 'xml':
$str = '<?php header("Content-Type: application/xhtml+xml; charset=UTF-8"); '.$xml.'?>';
break;
}
$this->contentText = $str;
}
}