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

返回介绍

xfn_check()

发布于 2017-09-11 字数 2473 浏览 886 评论 0

xfn_check( string $class,  string $value = '',  mixed $deprecated = '' )

Display checked checkboxes attribute for xfn microformat options.


描述


参数

$class

(string)
(Required)

$value

(string)
(Optional)

Default value: ”

$deprecated

(mixed)
(Optional)
Never used.

Default value: ”


源代码

File: wp-admin/includes/meta-boxes.php

function xfn_check( $class, $value = '', $deprecated = '' ) {
	global $link;

	if ( ! empty( $deprecated ) ) {
		_deprecated_argument( __FUNCTION__, '2.5.0' ); // Never implemented
	}

	$link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
	$rels = preg_split('/\s+/', $link_rel);

	if ('' != $value && in_array($value, $rels) ) {
		echo ' checked="checked"';
	}

	if ('' == $value) {
		if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"';
		if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"';
		if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"';
		if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
	}
}

更新日志

Version 描述
1.0.1 Introduced.

相关函数

Uses

  • wp-includes/functions.php:
    _deprecated_argument()

Used By

  • wp-admin/includes/meta-boxes.php:
    link_xfn_meta_box()

User Contributed Notes

上一篇:wxr_term_name()

下一篇:xmlrpc_getpostcategory()

发布评论

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

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