phpDocumentor default
[ class tree: default ] [ index: default ] [ all elements ]

Class: MagpieRSS

Source Location: /lodel/scripts/magpierss/rss_parse.inc

Class MagpieRSS

Property Summary
mixed   $channel  
mixed   $current_item  
mixed   $current_namespace  
mixed   $encoding  
mixed   $ERROR  
mixed   $feed_type  
mixed   $feed_version  
mixed   $image  
mixed   $inchannel  
mixed   $incontent  
mixed   $inimage  
mixed   $initem  
mixed   $intextinput  
mixed   $items  
mixed   $parser  
mixed   $stack  
mixed   $textinput  
mixed   $WARNING  
mixed   $_CONTENT_CONSTRUCTS  
mixed   $_KNOWN_ENCODINGS  
mixed   $_source_encoding  

[ Top ]
Method Summary
MagpieRSS   MagpieRSS()   Set up XML parser, parse source, and return populated RSS object..
void   append()  
void   append_content()  
void   concat()  
void   create_parser()   return XML parser, and possibly re-encoded source
void   error()  
void   feed_cdata()  
void   feed_end_element()  
void   feed_start_element()  
void   is_atom()  
void   is_rss()  
void   known_encoding()  
void   normalize()  
void   php4_create_parser()   Instaniate an XML parser under PHP4
void   php5_create_parser()   Instantiate an XML parser under PHP5

[ Top ]
Properties
mixed   $channel = array() [line 39]

[ Top ]
mixed   $current_item = array() [line 37]

[ Top ]
mixed   $current_namespace = false [line 63]

[ Top ]
mixed   $encoding = '' [line 44]

[ Top ]
mixed   $ERROR = "" [line 48]

[ Top ]
mixed   $feed_type [line 42]

[ Top ]
mixed   $feed_version [line 43]

[ Top ]
mixed   $image = array() [line 41]

[ Top ]
mixed   $inchannel = false [line 58]

[ Top ]
mixed   $incontent = false [line 60]

[ Top ]
mixed   $inimage = false [line 62]

[ Top ]
mixed   $initem = false [line 59]

[ Top ]
mixed   $intextinput = false [line 61]

[ Top ]
mixed   $items = array() [line 38]

[ Top ]
mixed   $parser [line 35]

[ Top ]
mixed   $stack = array() [line 57]

[ Top ]
mixed   $textinput = array() [line 40]

[ Top ]
mixed   $WARNING = "" [line 49]

[ Top ]
mixed   $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright') [line 53]

[ Top ]
mixed   $_KNOWN_ENCODINGS = array('UTF-8', 'US-ASCII', 'ISO-8859-1') [line 54]

[ Top ]
mixed   $_source_encoding = '' [line 46]

[ Top ]
Methods
Constructor MagpieRSS  [line 94]

  MagpieRSS MagpieRSS( string $source, [string $output_encoding = 'ISO-8859-1'], [string $input_encoding = null], [bool $detect_encoding = true]  )

Set up XML parser, parse source, and return populated RSS object..

Parameters:
string   $source: 

string containing the RSS to be parsed

NOTE: Probably a good idea to leave the encoding options alone unless you know what you're doing as PHP's character set support is a little weird.

NOTE: A lot of this is unnecessary but harmless with PHP5

string   $output_encoding: 

output the parsed RSS in this character set defaults to ISO-8859-1 as this is PHP's default.

NOTE: might be changed to UTF-8 in future versions.

string   $input_encoding:  the character set of the incoming RSS source. Leave blank and Magpie will try to figure it out.
bool   $detect_encoding:  if false Magpie won't attempt to detect source encoding. (caveat emptor)


[ Top ]
append  [line 335]

  void append( $el, $text  )

Parameters:
   $el: 
   $text: 


[ Top ]
append_content  [line 325]

  void append_content( $text  )

Parameters:
   $text: 


[ Top ]
concat  [line 316]

  void concat( &$str1, [ $str2 = ""]  )

Parameters:
   &$str1: 
   $str2: 


[ Top ]
create_parser  [line 451]

  void create_parser( $source, $out_enc, $in_enc, $detect  )

return XML parser, and possibly re-encoded source

Parameters:
   $source: 
   $out_enc: 
   $in_enc: 
   $detect: 


[ Top ]
error  [line 559]

  void error( $errormsg, [ $lvl = E_USER_WARNING]  )

Parameters:
   $errormsg: 
   $lvl: 


[ Top ]
feed_cdata  [line 260]

  void feed_cdata( $p, $text  )

Parameters:
   $p: 
   $text: 


[ Top ]
feed_end_element  [line 271]

  void feed_end_element( $p, $el  )

Parameters:
   $p: 
   $el: 


[ Top ]
feed_start_element  [line 146]

  void feed_start_element( $p, $element, &$attrs  )

Parameters:
   $p: 
   $element: 
   &$attrs: 


[ Top ]
is_atom  [line 438]

  void is_atom( )



[ Top ]
is_rss  [line 429]

  void is_rss( )



[ Top ]
known_encoding  [line 549]

  void known_encoding( $enc  )

Parameters:
   $enc: 


[ Top ]
normalize  [line 379]

  void normalize( )



[ Top ]
php4_create_parser  [line 500]

  void php4_create_parser( $source, $in_enc, $detect  )

Instaniate an XML parser under PHP4

Unfortunately PHP4's support for character encodings and especially XML and character encodings sucks. As long as the documents you parse only contain characters from the ISO-8859-1 character set (a superset of ASCII, and a subset of UTF-8) you're fine. However once you step out of that comfy little world things get mad, bad, and dangerous to know.

The following code is based on SJM's work with FoF

Parameters:
   $source: 
   $in_enc: 
   $detect: 

API Tags:
See:  http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss


[ Top ]
php5_create_parser  [line 475]

  void php5_create_parser( $in_enc, $detect  )

Instantiate an XML parser under PHP5

PHP5 will do a fine job of detecting input encoding if passed an empty string as the encoding.

All hail libxml2!

Parameters:
   $in_enc: 
   $detect: 


[ Top ]

Documentation generated on Wed, 29 Aug 2007 14:29:59 +0200 by phpDocumentor 1.4.0a2