2 class XML_HTMLSax3_Trim
{
5 function XML_HTMLSax3_Trim(&$orig_obj, $orig_method) {
6 $this->orig_obj
=& $orig_obj;
7 $this->orig_method
= $orig_method;
9 function trimData(&$parser, $data) {
12 $this->orig_obj
->{$this->orig_method
}($parser, $data);
16 class XML_HTMLSax3_CaseFolding
{
18 var $orig_open_method;
19 var $orig_close_method;
20 function XML_HTMLSax3_CaseFolding(&$orig_obj, $orig_open_method, $orig_close_method) {
21 $this->orig_obj
=& $orig_obj;
22 $this->orig_open_method
= $orig_open_method;
23 $this->orig_close_method
= $orig_close_method;
25 function foldOpen(&$parser, $tag, $attrs=array(), $empty = FALSE) {
26 $this->orig_obj
->{$this->orig_open_method
}($parser, strtoupper($tag), $attrs, $empty);
28 function foldClose(&$parser, $tag, $empty = FALSE) {
29 $this->orig_obj
->{$this->orig_close_method
}($parser, strtoupper($tag), $empty);
32 class XML_HTMLSax3_Linefeed
{
35 function XML_HTMLSax3_LineFeed(&$orig_obj, $orig_method) {
36 $this->orig_obj
=& $orig_obj;
37 $this->orig_method
= $orig_method;
39 function breakData(&$parser, $data) {
40 $data = explode("\n",$data);
41 foreach ( $data as $chunk ) {
42 $this->orig_obj
->{$this->orig_method
}($parser, $chunk);
46 class XML_HTMLSax3_Tab
{
49 function XML_HTMLSax3_Tab(&$orig_obj, $orig_method) {
50 $this->orig_obj
=& $orig_obj;
51 $this->orig_method
= $orig_method;
53 function breakData(&$parser, $data) {
54 $data = explode("\t",$data);
55 foreach ( $data as $chunk ) {
56 $this->orig_obj
->{$this->orig_method
}($this, $chunk);
60 class XML_HTMLSax3_Entities_Parsed
{
63 function XML_HTMLSax3_Entities_Parsed(&$orig_obj, $orig_method) {
64 $this->orig_obj
=& $orig_obj;
65 $this->orig_method
= $orig_method;
67 function breakData(&$parser, $data) {
68 $data = preg_split('/(&.+?;)/',$data,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
);
69 foreach ( $data as $chunk ) {
70 $chunk = html_entity_decode($chunk,ENT_NOQUOTES
);
71 $this->orig_obj
->{$this->orig_method
}($this, $chunk);
75 if (version_compare(phpversion(), '4.3', '<') && !function_exists('html_entity_decode') ) {
76 function html_entity_decode($str, $style=ENT_NOQUOTES
) {
78 array_flip(get_html_translation_table(HTML_ENTITIES
,$style)));
81 class XML_HTMLSax3_Entities_Unparsed
{
84 function XML_HTMLSax3_Entities_Unparsed(&$orig_obj, $orig_method) {
85 $this->orig_obj
=& $orig_obj;
86 $this->orig_method
= $orig_method;
88 function breakData(&$parser, $data) {
89 $data = preg_split('/(&.+?;)/',$data,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
);
90 foreach ( $data as $chunk ) {
91 $this->orig_obj
->{$this->orig_method
}($this, $chunk);
96 class XML_HTMLSax3_Escape_Stripper
{
99 function XML_HTMLSax3_Escape_Stripper(&$orig_obj, $orig_method) {
100 $this->orig_obj
=& $orig_obj;
101 $this->orig_method
= $orig_method;
103 function strip(&$parser, $data) {
104 if ( substr($data,0,2) == '--' ) {
106 '/^\-\-/', // Opening comment: --
107 '/\-\-$/', // Closing comment: --
109 $data = preg_replace($patterns,'',$data);
111 } else if ( substr($data,0,1) == '[' ) {
113 '/^\[.*CDATA.*\[/s', // Opening CDATA
114 '/\].*\]$/s', // Closing CDATA
116 $data = preg_replace($patterns,'',$data);
119 $this->orig_obj
->{$this->orig_method
}($this, $data);