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

返回介绍

ms_allowed_http_request_hosts()

发布于 2017-09-11 字数1597 浏览 868 评论 0

ms_allowed_http_request_hosts( bool $is_external,  string $host )

Whitelists any domain in a multisite installation for safe HTTP requests.


描述

Attached to the ‘http_request_host_is_external’ filter.


参数

$is_external

(bool)
(Required)

$host

(string)
(Required)


返回值

(bool)


源代码

File: wp-includes/http.php

function ms_allowed_http_request_hosts( $is_external, $host ) {
	global $wpdb;
	static $queried = array();
	if ( $is_external )
		return $is_external;
	if ( $host === get_network()->domain )
		return true;
	if ( isset( $queried[ $host ] ) )
		return $queried[ $host ];
	$queried[ $host ] = (bool) $wpdb->get_var( $wpdb->prepare( "SELECT domain FROM $wpdb->blogs WHERE domain = %s LIMIT 1", $host ) );
	return $queried[ $host ];
}

更新日志

Version 描述
3.6.0 Introduced.

相关函数

Uses

  • wp-includes/ms-blogs.php:
    get_network()
  • wp-includes/wp-db.php:
    wpdb::get_var()
  • wp-includes/wp-db.php:
    wpdb::prepare()

User Contributed Notes

上一篇:meta_form()

下一篇:ms_cookie_constants()

发布评论

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

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