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

返回介绍

get_allowed_http_origins()

发布于 2017-09-10 字数 1809 浏览 962 评论 0

get_allowed_http_origins()

Retrieve list of allowed HTTP origins.


描述


返回值

(array) Array of origin URLs.


源代码

File: wp-includes/http.php

function get_allowed_http_origins() {
	$admin_origin = parse_url( admin_url() );
	$home_origin = parse_url( home_url() );

	// @todo preserve port?
	$allowed_origins = array_unique( array(
		'http://' . $admin_origin[ 'host' ],
		'https://' . $admin_origin[ 'host' ],
		'http://' . $home_origin[ 'host' ],
		'https://' . $home_origin[ 'host' ],
	) );

	/**
	 * Change the origin types allowed for HTTP requests.
	 *
	 * @since 3.4.0
	 *
	 * @param array $allowed_origins {
	 *     Default allowed HTTP origins.
	 *     @type string Non-secure URL for admin origin.
	 *     @type string Secure URL for admin origin.
	 *     @type string Non-secure URL for home origin.
	 *     @type string Secure URL for home origin.
	 * }
	 */
	return apply_filters( 'allowed_http_origins' , $allowed_origins );
}

更新日志

Version 描述
3.4.0 Introduced.

相关函数

Uses

  • wp-includes/link-template.php:
    admin_url()
  • wp-includes/link-template.php:
    home_url()
  • wp-includes/http.php:
    allowed_http_origins
  • wp-includes/plugin.php:
    apply_filters()

Used By

  • wp-includes/http.php:
    is_allowed_http_origin()

User Contributed Notes

发布评论

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

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