startElement() - WordPress 函数参考中文文档

返回介绍

startElement()

发布于 2017-09-11 字数1811 浏览 934 评论 0

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( mixed $parser,  string $tagName,  array $attrs )

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


描述


参数

$parser

(mixed)
(Required)
XML Parser re源代码.

$tagName

(string)
(Required)
XML element name.

$attrs

(array)
(Required)
XML element attributes.


源代码

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

function startElement($parser, $tagName, $attrs) {
	global $names, $urls, $targets, $描述s, $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'] :  '';
		$描述s[] = isset( $attrs['描述'] ) ? $attrs['描述'] :  '';
	} // End if outline.
}

更新日志

Version 描述
0.71 Introduced.

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!