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

返回介绍

wp_auth_check_html()

发布于 2017-09-11 字数2815 浏览 929 评论 0

wp_auth_check_html()

Output the HTML that shows the wp-login dialog when the user is no longer logged in.


描述


源代码

File: wp-includes/functions.php

function wp_auth_check_html() {
	$login_url = wp_login_url();
	$current_domain = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'];
	$same_domain = ( strpos( $login_url, $current_domain ) === 0 );

	/**
	 * Filters whether the authentication check originated at the same domain.
	 *
	 * @since 3.6.0
	 *
	 * @param bool $same_domain Whether the authentication check originated at the same domain.
	 */
	$same_domain = apply_filters( 'wp_auth_check_same_domain', $same_domain );
	$wrap_class = $same_domain ? 'hidden' : 'hidden fallback';

	?>
	<div id="wp-auth-check-wrap" class="<?php echo $wrap_class; ?>">
	<div id="wp-auth-check-bg"></div>
	<div id="wp-auth-check">
	<button type="button" class="wp-auth-check-close button-link"><span class="screen-reader-text"><?php _e( 'Close dialog' ); ?></span></button>
	<?php

	if ( $same_domain ) {
		?>
		<div id="wp-auth-check-form" class="loading" data-src="<?php echo esc_url( add_query_arg( array( 'interim-login' => 1 ), $login_url ) ); ?>"></div>
		<?php
	}

	?>
	<div class="wp-auth-fallback">
		<p><b class="wp-auth-fallback-expired" tabindex="0"><?php _e('Session expired'); ?></b></p>
		<p><a href="<?php echo esc_url( $login_url ); ?>" target="_blank"><?php _e('Please log in again.'); ?></a>
		<?php _e('The login page will open in a new window. After logging in you can close it and return to this page.'); ?></p>
	</div>
	</div>
	</div>
	<?php
}

更新日志

Version 描述
3.6.0 Introduced.

相关函数

Uses

  • wp-includes/l10n.php:
    _e()
  • wp-includes/formatting.php:
    esc_url()
  • wp-includes/general-template.php:
    wp_login_url()
  • wp-includes/functions.php:
    wp_auth_check_same_domain
  • wp-includes/load.php:
    is_ssl()
  • wp-includes/functions.php:
    add_query_arg()
  • wp-includes/plugin.php:
    apply_filters()
  • Show 2 more uses
    Hide more uses


User Contributed Notes

上一篇:wp_auth_check()

下一篇:wp_auth_check_load()

发布评论

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

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