wpseek.com
A WordPress-centric search engine for devs and theme authors



startelement › WordPress Function

Since0.71
Deprecatedn/a
startelement ( $parser, $tag_name, $attrs )
Access:
  • private
Parameters: (3)
  • (resource) $parser XML Parser resource.
    Required: Yes
  • (string) $tag_name XML element name.
    Required: Yes
  • (array) $attrs XML element attributes.
    Required: Yes
Defined at:
Codex:

Starts a new XML tag.

Callback function for xml_set_element_handler().


Source

function startElement( $parser, $tag_name, $attrs ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
	global $names, $urls, $targets, $descriptions, $feeds;

	if ( 'OUTLINE' === $tag_name ) {
		$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.
}