40 $this -> items = array();
50 $vals = $ind = array();
52 $xml_parser = xml_parser_create(
'UTF-8' );
54 xml_parser_set_option ( $xml_parser, XML_OPTION_CASE_FOLDING, 0 );
55 xml_parser_set_option ( $xml_parser, XML_OPTION_SKIP_WHITE, 1 );
56 xml_parser_set_option ( $xml_parser, XML_OPTION_TARGET_ENCODING,
'UTF-8' );
58 xml_parse_into_struct( $xml_parser, $this -> sXmlText, $vals, $ind );
60 xml_parser_free( $xml_parser );
62 $this -> sXmlText =
'';
65 $this -> title = $vals[ $ind[
'title'][0] ][
'value'];
66 $this -> link = $vals[ $ind[
'link'][0] ][
'value'];
67 $this -> description = $vals[ $ind[
'description'][0] ][
'value'];
70 if( $ind[
'language']
and $vals[ $ind[
'language'][0] ][
'level'] == 3 )
71 $this -> language = $vals[ $ind[
'language'][0] ][
'value'];
73 if( $ind[
'copyright']
and $vals[ $ind[
'copyright'][0] ][
'level'] == 3 )
74 $this -> copyright = $vals[ $ind[
'copyright'][0] ][
'value'];
76 if( $ind[
'managingEditor']
and $vals[ $ind[
'managingEditor'][0] ][
'level'] == 3 )
77 $this -> managingEditor = $vals[ $ind[
'managingEditor'][0] ][
'value'];
79 if( $ind[
'webMaster']
and $vals[ $ind[
'webMaster'][0] ][
'level'] == 3 )
80 $this -> webMaster = $vals[ $ind[
'webMaster'][0] ][
'value'];
82 if( $ind[
'lastBuildDate']
and $vals[ $ind[
'lastBuildDate'][0] ][
'level'] == 3 )
83 $this -> lastBuildDate = $vals[ $ind[
'lastBuildDate'][0] ][
'value'];
85 if( $ind[
'generator']
and $vals[ $ind[
'generator'][0] ][
'level'] == 3 )
86 $this -> generator = $vals[ $ind[
'generator'][0] ][
'value'];
88 if( $ind[
'docs']
and $vals[ $ind[
'docs'][0] ][
'level'] == 3 )
89 $this -> docs = $vals[ $ind[
'docs'][0] ][
'value'];
91 if( $ind[
'cloud']
and $vals[ $ind[
'cloud'][0] ][
'level'] == 3 )
92 $this -> cloud = $vals[ $ind[
'cloud'][0] ][
'value'];
94 if( $ind[
'ttl']
and $vals[ $ind[
'ttl'][0] ][
'level'] == 3 )
95 $this -> ttl = $vals[ $ind[
'ttl'][0] ][
'value'];
97 if( $ind[
'image']
and $vals[ $ind[
'image'][0] ][
'level'] == 3 )
98 $this ->
image = $vals[ $ind[
'image'][0] ][
'value'];
100 if( $ind[
'rating']
and $vals[ $ind[
'rating'][0] ][
'level'] == 3 )
101 $this -> rating = $vals[ $ind[
'rating'][0] ][
'value'];
103 if( $ind[
'textInput']
and $vals[ $ind[
'textInput'][0] ][
'level'] == 3 )
104 $this -> textInput = $vals[ $ind[
'textInput'][0] ][
'value'];
106 if( $ind[
'skipHours']
and $vals[ $ind[
'skipHours'][0] ][
'level'] == 3 )
107 $this -> skipHours = $vals[ $ind[
'skipHours'][0] ][
'value'];
109 if( $ind[
'skipDays']
and $vals[ $ind[
'skipDays'][0] ][
'level'] == 3 )
110 $this -> skipDays = $vals[ $ind[
'skipDays'][0] ][
'value'];
112 if( $ind[
'pubDate']
and $vals[ $ind[
'pubDate'][0] ][
'level'] == 3 )
113 $this -> pubDate = $vals[ $ind[
'pubDate'][0] ][
'value'];
115 if( $ind[
'category']
and $vals[ $ind[
'category'][0] ][
'level'] == 3 )
116 $this -> category = $vals[ $ind[
'category'][0] ][
'value'];
119 if( $ind[
'cheetah']
and $vals[ $ind[
'cheetah'][0] ][
'level'] == 3 )
120 $this -> dolVersion = $vals[ $ind[
'cheetah'][0] ][
'value'];
123 if ($ind && $ind[
'item'])
124 foreach( $ind[
'item']
as $itemInd ) {
125 if( $vals[ $itemInd ][
'type'] ==
'close' )
129 $aItem[
'category'] = array();
131 while( $vals[ ++$itemInd ][
'level'] == 4 ) {
132 if( $vals[ $itemInd ][
'tag'] ==
'category' )
133 $aItem[
'category'][] = $vals[ $itemInd ];
135 $aItem[ $vals[ $itemInd ][
'tag'] ] = $vals[ $itemInd ];
137 $this -> items[] =
new ChRSSItem( $aItem );
165 $this -> title = $aItem[
'title'][
'value'];
166 $this -> link = $aItem[
'link'][
'value'];
167 $this -> description = $aItem[
'description'][
'value'];
168 $this -> author = $aItem[
'author'][
'value'];
169 $this -> comments = $aItem[
'comments'][
'value'];
170 $this -> pubDate = $aItem[
'pubDate'][
'value'];
172 $this -> source = $aItem[
'source'][
'value'];
173 $this -> source_url = $aItem[
'source'][
'attributes'][
'url'];
175 $this -> enclosure = $aItem[
'enclosure'][
'value'];
176 $this -> enclosure_url = $aItem[
'enclosure'][
'attributes'][
'url'];
177 $this -> enclosure_length = $aItem[
'enclosure'][
'attributes'][
'length'];
178 $this -> enclosure_type = $aItem[
'enclosure'][
'attributes'][
'type'];
180 $this -> guid = $aItem[
'guid'][
'value'];
182 if( $aItem[
'guid'][
'attributes'][
'isPermaLink'] ==
'false' )
183 $this -> guid_isPermaLink =
false;
185 $this -> guid_isPermaLink =
true;
187 $this -> category = array();