startElement()
Starts a new XML tag.
Callback function for xml_set_element_handler().
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Return
null
. Nothing (null).
Usage
startElement( $parser, $tag_name, $attrs );
- $parser(resource) (required)
- XML Parser resource.
- $tag_name(string) (required)
- XML element name.
- $attrs(array) (required)
- XML element attributes.
Notes
- Global. Array. $names
- Global. Array. $urls
- Global. Array. $targets
- Global. Array. $descriptions
- Global. Array. $feeds
Changelog
Since 0.71 | Introduced. |
startElement() startElement code WP 6.5.2
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. }