MagpieRSS::__construct() WordPress Method
The MagpieRSS::__construct() method is used to create a new MagpieRSS object. This object can then be used to parse RSS feeds.
MagpieRSS::__construct( $source ) #
PHP5 constructor.
Source
File: wp-includes/rss.php
function __construct( $source ) { # Check if PHP xml isn't compiled # if ( ! function_exists('xml_parser_create') ) { return trigger_error( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ); } $parser = xml_parser_create(); $this->parser = $parser; # pass in parser, and a reference to this object # set up handlers # xml_set_object( $this->parser, $this ); xml_set_element_handler($this->parser, 'feed_start_element', 'feed_end_element' ); xml_set_character_data_handler( $this->parser, 'feed_cdata' ); $status = xml_parse( $this->parser, $source ); if (! $status ) { $errorcode = xml_get_error_code( $this->parser ); if ( $errorcode != XML_ERROR_NONE ) { $xml_error = xml_error_string( $errorcode ); $error_line = xml_get_current_line_number($this->parser); $error_col = xml_get_current_column_number($this->parser); $errormsg = "$xml_error at line $error_line, column $error_col"; $this->error( $errormsg ); } } xml_parser_free( $this->parser ); unset( $this->parser ); $this->normalize(); }
Expand full source codeCollapse full source codeView on TracView on GitHub