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

返回介绍

update_nag()

发布于 2017-09-11 字数2281 浏览 842 评论 0

update_nag()

描述


返回值

(false|void)


源代码

File: wp-admin/includes/update.php

function update_nag() {
	if ( is_multisite() && !current_user_can('update_core') )
		return false;

	global $pagenow;

	if ( 'update-core.php' == $pagenow )
		return;

	$cur = get_preferred_from_update_core();

	if ( ! isset( $cur->response ) || $cur->response != 'upgrade' )
		return false;

	if ( current_user_can( 'update_core' ) ) {
		$msg = sprintf(
			/* translators: 1: Codex URL to release notes, 2: new WordPress version, 3: URL to network admin, 4: accessibility text */
			__( '<a href="%1$s">WordPress %2$s</a> is available! <a href="%3$s" aria-label="%4$s">Please update now</a>.' ),
			sprintf(
				/* translators: %s: WordPress version */
				esc_url( __( 'https://codex.wordpress.org/Version_%s' ) ),
				$cur->current
			),
			$cur->current,
			network_admin_url( 'update-core.php' ),
			esc_attr__( 'Please update WordPress now' )
		);
	} else {
		$msg = sprintf(
			/* translators: 1: Codex URL to release notes, 2: new WordPress version */
			__( '<a href="%1$s">WordPress %2$s</a> is available! Please notify the site administrator.' ),
			sprintf(
				/* translators: %s: WordPress version */
				esc_url( __( 'https://codex.wordpress.org/Version_%s' ) ),
				$cur->current
			),
			$cur->current
		);
	}
	echo "<div class='update-nag'>$msg</div>";
}

Collapse full 源代码 code

View on Trac


相关函数

Uses

  • wp-admin/includes/update.php:
    get_preferred_from_update_core()
  • wp-includes/capabilities.php:
    current_user_can()
  • wp-includes/l10n.php:
    __()
  • wp-includes/l10n.php:
    esc_attr__()
  • wp-includes/formatting.php:
    esc_url()
  • wp-includes/load.php:
    is_multisite()
  • wp-includes/link-template.php:
    network_admin_url()
  • Show 2 more uses
    Hide more uses


User Contributed Notes

发布评论

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

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