AtomParser
- Source
wp-includes/atomlib.php:65
AtomLib Atom Parser API
Compatibility
- WordPress
- core
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Properties · 22
$NSpublic$ATOM_CONTENT_ELEMENTSpublic$ATOM_SIMPLE_ELEMENTSpublic$debugpublic$depthpublic$indentpublic$in_contentpublic$ns_contextspublic$ns_declspublic$content_ns_declspublic$content_ns_contextspublic$is_xhtmlpublic$is_htmlpublic$is_textpublic$skipped_divpublic$FILEpublic$feedpublic$currentpublic$map_attrs_funcpublic$map_xmlns_funcpublic$errorpublic$contentpublic
Methods · 16
- __construct()PHP5 constructor.
- AtomParser()PHP4 constructor.
- map_attrs()Map attributes to key="val"
- map_xmlns()Map XML namespace to string.
- _p()
- error_handler()
- parse()
- start_element()
- end_element()
- start_ns()
- end_ns()
- cdata()
- _default()
- ns_to_prefix()
- is_declared_content_ns()
- xml_escape()
Source code
class AtomParser { var $NS = 'http://www.w3.org/2005/Atom'; var $ATOM_CONTENT_ELEMENTS = array('content','summary','title','subtitle','rights'); var $ATOM_SIMPLE_ELEMENTS = array('id','updated','published','draft'); var $debug = false; var $depth = 0; var $indent = 2; var $in_content; var $ns_contexts = array(); var $ns_decls = array(); var $content_ns_decls = array(); var $content_ns_contexts = array(); var $is_xhtml = false; var $is_html = false; var $is_text = true; var $skipped_div = false; var $FILE = "php://input"; var $feed; var $current; var $map_attrs_func; var $map_xmlns_func; var $error; var $content; /** * PHP5 constructor. */ function __construct() { $this->feed = new AtomFeed(); $this->current = null; $this->map_attrs_func = array( __CLASS__, 'map_attrs' ); $this->map_xmlns_func = array( __CLASS__, 'map_xmlns' ); } /** * PHP4 constructor. */ public function AtomParser() { self::__construct(); } /** * Map attributes to key="val" * * @param string $k Key * @param string $v Value * @return string */ public static function map_attrs($k, $v) { return "$k=\"$v\""; } /** * Map XML namespace to string. * * @param indexish $p XML Namespace element index * @param array $n Two-element array pair. [ 0 => {namespace}, 1 => {url} ] * @return string 'xmlns="{url}"' or 'xmlns:{namespace}="{url}"' */ public static function map_xmlns($p, $n) { $xd = "xmlns"; if( 0 < strlen($n[0]) ) { $xd .= ":{$n[0]}"; } return "{$xd}=\"{$n[1]}\""; } function _p($msg) { if($this->debug) { print str_repeat(" ", $this->depth * $this->indent) . $msg ."\n"; } } function error_handler($log_level, $log_text, $error_file, $error_line) {Changelog
Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, from
src/wp-includes/atomlib.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.