WordPress at a glance
function is not described

startElement() WP 0.71

XML callback function for the start of a new XML tag.

  • Global. Array. $names
  • Global. Array. $urls
  • Global. Array. $targets
  • Global. Array. $descriptions
  • Global. Array. $feeds

No Hooks.

Return

Nothing (null).

Usage

startElement( $parser, $tagName, $attrs );
$parser(mixed) (required)
XML Parser resource.
$tagName(string) (required)
XML element name.
$attrs(array) (required)
XML element attributes.

Code of startElement: wp-admin/link-parse-opml.php VER 5.0.3

<?php
function startElement($parser, $tagName, $attrs) {
	global $names, $urls, $targets, $descriptions, $feeds;

	if ( 'OUTLINE' === $tagName ) {
		$name = '';
		if ( isset( $attrs['TEXT'] ) ) {
			$name = $attrs['TEXT'];
		}
		if ( isset( $attrs['TITLE'] ) ) {
			$name = $attrs['TITLE'];
		}
		$url = '';
		if ( isset( $attrs['URL'] ) ) {
			$url = $attrs['URL'];
		}
		if ( isset( $attrs['HTMLURL'] ) ) {
			$url = $attrs['HTMLURL'];
		}

		// Save the data away.
		$names[] = $name;
		$urls[] = $url;
		$targets[] = isset( $attrs['TARGET'] ) ? $attrs['TARGET'] :  '';
		$feeds[] = isset( $attrs['XMLURL'] ) ? $attrs['XMLURL'] :  '';
		$descriptions[] = isset( $attrs['DESCRIPTION'] ) ? $attrs['DESCRIPTION'] :  '';
	} // End if outline.
}