Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

startElement() WordPress Function

The startElement() function is used to start an element in a WordPress document. It takes two arguments: the element name and an array of attributes. The function outputs a start tag for the element with the specified attributes.

startElement( resource $parser, string $tag_name, array $attrs ) #

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


Parameters

$parser

(resource)(Required)XML Parser resource.

$tag_name

(string)(Required)XML element name.

$attrs

(array)(Required)XML element attributes.


Top ↑

Source

File: wp-admin/link-parse-opml.php

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.
}

Top ↑

Changelog

Changelog
VersionDescription
0.71Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.