MagpieRSS::__construct()
PHP5 constructor.
Method of the class: MagpieRSS{}
No Hooks.
Return
null
. Nothing (null).
Usage
$MagpieRSS = new MagpieRSS(); $MagpieRSS->__construct( $source );
- $source (required)
- -
MagpieRSS::__construct() MagpieRSS:: construct code WP 6.6.2
function __construct( $source ) { # Check if PHP xml isn't compiled # if ( ! function_exists('xml_parser_create') ) { wp_trigger_error( '', "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ); return; } $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(); }