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.6 2003/03/17 19:43:16 hemna Exp $ |
8 |
* |
9 |
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
10 |
* @package phpHtmlLib |
11 |
* |
12 |
*/ |
13 |
|
14 |
|
15 |
/** |
16 |
* xml tag class |
17 |
* @package phpHtmlLib |
18 |
*/ |
19 |
class XMLtag extends XMLTagClass { |
20 |
var $_tag = "xml"; |
21 |
var $_tag_prefix = "<?"; |
22 |
var $_tag_postfix = " ?>"; |
23 |
|
24 |
function XMLtag( $attributes=array() ) { |
25 |
$this->XMLTagClass( $this->get_tag_name(), |
26 |
$attributes); |
27 |
|
28 |
$num_args = func_num_args(); |
29 |
for ($i=1;$i<$num_args;$i++) { |
30 |
$this->add(func_get_arg($i)); |
31 |
} |
32 |
$this->_set_flags(); |
33 |
} |
34 |
function _set_flags() { |
35 |
parent::_set_flags(); |
36 |
$this->_flags &= ~(_CONTENTREQUIRED | _CLOSETAGREQUIRED); |
37 |
$this->_flags |= _ALWAYS_LOWERCASE | _NOFINISHSLASHXHTML; |
38 |
} |
39 |
} // XMLtag |
40 |
|
41 |
/** |
42 |
* xml-stylesheet tag class |
43 |
* @package phpHtmlLib |
44 |
*/ |
45 |
class XMLSTYLESHEETtag extends XMLtag { |
46 |
var $_tag = "xml-stylesheet"; |
47 |
} // XMLSTYLESHEETtag |
48 |
|
49 |
|
50 |
/** |
51 |
* A simple wrapper for standard XML |
52 |
* CDATA section data |
53 |
* @package phpHtmlLib |
54 |
*/ |
55 |
class CDATAtag extends XMLtag { |
56 |
var $_tag = "CDATA["; |
57 |
var $_tag_prefix = "<!["; |
58 |
var $_tag_postfix = "]]>"; |
59 |
|
60 |
function CDATAtag() { |
61 |
$this->XMLTagClass($this->get_tag_name()); |
62 |
|
63 |
$num_args = func_num_args(); |
64 |
for ($i=0;$i<$num_args;$i++) { |
65 |
$this->add(func_get_arg($i)); |
66 |
} |
67 |
$this->_set_flags(); |
68 |
} |
69 |
|
70 |
function _set_flags() { |
71 |
parent::_set_flags(); |
72 |
$this->_flags &= ~_CLOSETAGREQUIRED; |
73 |
$this->_flags |= _NOFINISHSLASHXHTML; |
74 |
} |
75 |
|
76 |
|
77 |
function _render_open_tag( $indent_level, $finish_slash=FALSE ) { |
78 |
//get the indent level |
79 |
$indent = $this->_render_indent( $indent_level ); |
80 |
|
81 |
$xml = $indent . $this->_tag_prefix . $this->_tag; |
82 |
|
83 |
if ($this->_flags & _NEWLINEAFTEROPENTAG) { |
84 |
$xml .= "\n"; |
85 |
} |
86 |
return $xml; |
87 |
} |
88 |
|
89 |
function _render_close_tag($indent_level) { |
90 |
$indent = ""; |
91 |
if (($this->_flags & _INDENT) && ($this->_flags & _NEWLINEAFTEROPENTAG)) { |
92 |
$indent = $this->_render_indent($indent_level); |
93 |
} |
94 |
$str = $indent .$this->_tag_postfix; |
95 |
|
96 |
if ($this->_flags & _NEWLINEAFTERCLOSETAG) { |
97 |
$str .= "\n"; |
98 |
} |
99 |
return $str; |
100 |
} |
101 |
} |
102 |
|
103 |
?> |