1 |
<?php |
2 |
|
3 |
/** |
4 |
* This file contains all of the default |
5 |
* support xml tags by phpHtmlLib. |
6 |
* |
7 |
* $Id: XMLTAGS.inc,v 1.5 2003/02/18 23:02:04 hemna Exp $ |
8 |
* |
9 |
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
10 |
* @package phpHtmlLib |
11 |
* |
12 |
*/ |
13 |
|
14 |
/** |
15 |
* <!DOCTYPE> tag class |
16 |
* @package phpHtmlLib |
17 |
*/ |
18 |
class DOCTYPEtag extends XMLTagClass { |
19 |
var $_tag = "!DOCTYPE"; |
20 |
|
21 |
function DOCTYPEtag( $attributes=array() ) { |
22 |
$this->XMLTagClass( $this->get_tag_name(), |
23 |
$attributes); |
24 |
|
25 |
$num_args = func_num_args(); |
26 |
for ($i=1;$i<$num_args;$i++) { |
27 |
$this->add(func_get_arg($i)); |
28 |
} |
29 |
$this->_set_flags(); |
30 |
} |
31 |
|
32 |
function _set_flags() { |
33 |
parent::_set_flags(); |
34 |
$this->_flags &= ~(_CONTENTREQUIRED | _CLOSETAGREQUIRED); |
35 |
$this->_flags |= _ALWAYS_UPPERCASE | _NOFINISHSLASHXHTML; |
36 |
} |
37 |
} //!DOCTYPEtag |
38 |
|
39 |
|
40 |
/** |
41 |
* xml tag class |
42 |
* @package phpHtmlLib |
43 |
*/ |
44 |
class XMLtag extends XMLTagClass { |
45 |
var $_tag = "xml"; |
46 |
var $_tag_prefix = "<?"; |
47 |
var $_tag_postfix = " ?>"; |
48 |
|
49 |
function XMLtag( $attributes=array() ) { |
50 |
$this->XMLTagClass( $this->get_tag_name(), |
51 |
$attributes); |
52 |
|
53 |
$num_args = func_num_args(); |
54 |
for ($i=1;$i<$num_args;$i++) { |
55 |
$this->add(func_get_arg($i)); |
56 |
} |
57 |
$this->_set_flags(); |
58 |
} |
59 |
function _set_flags() { |
60 |
parent::_set_flags(); |
61 |
$this->_flags &= ~(_CONTENTREQUIRED | _CLOSETAGREQUIRED); |
62 |
$this->_flags |= _ALWAYS_LOWERCASE | _NOFINISHSLASHXHTML; |
63 |
} |
64 |
} // XMLtag |
65 |
|
66 |
/** |
67 |
* xml-stylesheet tag class |
68 |
* @package phpHtmlLib |
69 |
*/ |
70 |
class XMLSTYLESHEETtag extends XMLtag { |
71 |
var $_tag = "xml-stylesheet"; |
72 |
} // XMLSTYLESHEETtag |
73 |
|
74 |
|
75 |
/** |
76 |
* A simple wrapper for standard XML |
77 |
* CDATA section data |
78 |
* @package phpHtmlLib |
79 |
*/ |
80 |
class CDATAtag extends XMLtag { |
81 |
var $_tag = "CDATA["; |
82 |
var $_tag_prefix = "<!["; |
83 |
var $_tag_postfix = "]]>"; |
84 |
|
85 |
function CDATAtag() { |
86 |
$this->XMLTagClass($this->get_tag_name()); |
87 |
|
88 |
$num_args = func_num_args(); |
89 |
for ($i=0;$i<$num_args;$i++) { |
90 |
$this->add(func_get_arg($i)); |
91 |
} |
92 |
$this->_set_flags(); |
93 |
} |
94 |
|
95 |
function _set_flags() { |
96 |
parent::_set_flags(); |
97 |
$this->_flags &= ~_CLOSETAGREQUIRED; |
98 |
$this->_flags |= _NOFINISHSLASHXHTML; |
99 |
} |
100 |
|
101 |
|
102 |
function _render_open_tag( $indent_level, $finish_slash=FALSE ) { |
103 |
//get the indent level |
104 |
$indent = $this->_render_indent( $indent_level ); |
105 |
|
106 |
$xml = $indent . $this->_tag_prefix . $this->_tag; |
107 |
|
108 |
if ($this->_flags & _NEWLINEAFTEROPENTAG) { |
109 |
$xml .= "\n"; |
110 |
} |
111 |
return $xml; |
112 |
} |
113 |
|
114 |
function _render_close_tag($indent_level) { |
115 |
$indent = ""; |
116 |
if (($this->_flags & _INDENT) && ($this->_flags & _NEWLINEAFTEROPENTAG)) { |
117 |
$indent = $this->_render_indent($indent_level); |
118 |
} |
119 |
$str = $indent .$this->_tag_postfix; |
120 |
|
121 |
if ($this->_flags & _NEWLINEAFTERCLOSETAG) { |
122 |
$str .= "\n"; |
123 |
} |
124 |
return $str; |
125 |
} |
126 |
} |
127 |
|
128 |
?> |