1 |
jonen |
1.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.3 2002/11/04 22:47:46 hemna Exp $ |
8 |
|
|
* |
9 |
|
|
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
10 |
|
|
* @package phpHtmlLib |
11 |
|
|
* |
12 |
|
|
*/ |
13 |
|
|
|
14 |
|
|
/** |
15 |
|
|
* <!DOCTYPE> tag class |
16 |
|
|
* |
17 |
|
|
*/ |
18 |
|
|
class DOCTYPEtag extends XMLTagClass { |
19 |
|
|
var $_tag = "!DOCTYPE"; |
20 |
|
|
var $_close_tag_required = FALSE; |
21 |
|
|
var $_content_required = FALSE; |
22 |
|
|
var $_always_upper_case = TRUE; |
23 |
|
|
var $_no_finish_slash_xhtml = TRUE; |
24 |
|
|
|
25 |
|
|
function DOCTYPEtag( $attributes=array() ) { |
26 |
|
|
$this->XMLTagClass( $this->get_tag_name(), |
27 |
|
|
$attributes); |
28 |
|
|
|
29 |
|
|
$num_args = func_num_args(); |
30 |
|
|
for ($i=1;$i<$num_args;$i++) { |
31 |
|
|
$this->add(func_get_arg($i)); |
32 |
|
|
} |
33 |
|
|
} |
34 |
|
|
} //!DOCTYPEtag |
35 |
|
|
|
36 |
|
|
|
37 |
|
|
/** |
38 |
|
|
* xml tag class |
39 |
|
|
*/ |
40 |
|
|
class XMLtag extends XMLTagClass { |
41 |
|
|
var $_tag = "xml"; |
42 |
|
|
var $_close_tag_required = FALSE; |
43 |
|
|
var $_content_required = FALSE; |
44 |
|
|
var $_no_finish_slash_xhtml = TRUE; |
45 |
|
|
var $_always_lower_case = TRUE; |
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 |
|
|
} |
58 |
|
|
} // XMLtag |
59 |
|
|
|
60 |
|
|
/** |
61 |
|
|
* xml-stylesheet tag class |
62 |
|
|
*/ |
63 |
|
|
class XMLSTYLESHEETtag extends XMLtag { |
64 |
|
|
var $_tag = "xml-stylesheet"; |
65 |
|
|
} // XMLSTYLESHEETtag |
66 |
|
|
|
67 |
|
|
|
68 |
|
|
/** |
69 |
|
|
* A simple wrapper for standard XML |
70 |
|
|
* CDATA section data |
71 |
|
|
*/ |
72 |
|
|
class CDATAtag extends XMLtag { |
73 |
|
|
var $_tag = "CDATA["; |
74 |
|
|
var $_close_tag_required = FALSE; |
75 |
|
|
var $_no_finish_slash_xhtml = TRUE; |
76 |
|
|
var $_tag_prefix = "<!["; |
77 |
|
|
var $_tag_postfix = "]]>"; |
78 |
|
|
|
79 |
|
|
function CDATAtag() { |
80 |
|
|
$this->XMLTagClass($this->get_tag_name()); |
81 |
|
|
|
82 |
|
|
$num_args = func_num_args(); |
83 |
|
|
for ($i=0;$i<$num_args;$i++) { |
84 |
|
|
$this->add(func_get_arg($i)); |
85 |
|
|
} |
86 |
|
|
} |
87 |
|
|
|
88 |
|
|
|
89 |
|
|
function _render_open_tag( $indent_level, $finish_slash=FALSE ) { |
90 |
|
|
//get the indent level |
91 |
|
|
$indent = $this->_render_indent( $indent_level ); |
92 |
|
|
|
93 |
|
|
$xml = $indent . $this->_tag_prefix . $this->_tag; |
94 |
|
|
|
95 |
|
|
if ($this->newline_after_opentag) { |
96 |
|
|
$xml .= "\n"; |
97 |
|
|
} |
98 |
|
|
return $xml; |
99 |
|
|
} |
100 |
|
|
|
101 |
|
|
function _render_close_tag($indent_level) { |
102 |
|
|
$indent = ""; |
103 |
|
|
if ($this->indent_flag && $this->newline_after_opentag) { |
104 |
|
|
$indent = $this->_render_indent($indent_level); |
105 |
|
|
} |
106 |
|
|
$str = $indent .$this->_tag_postfix; |
107 |
|
|
|
108 |
|
|
if ($this->newline_after_closetag) { |
109 |
|
|
$str .= "\n"; |
110 |
|
|
} |
111 |
|
|
return $str; |
112 |
|
|
} |
113 |
|
|
} |
114 |
|
|
|
115 |
|
|
?> |