Un motore di ricerca WordPress per sviluppatori e autori di temi



ms_allowed_http_request_hosts ›

Da3.6.0
Deprecaton/a
ms_allowed_http_request_hosts ( $is_external, $host )
Parametri: (2)
  • (bool) $is_external
    Richiesto:
  • (string) $host
    Richiesto:
Ritorna:
  • (bool)
Definito a:
Codex:

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

Attached to the {@see 'http_request_host_is_external'} filter.



Sorgenti

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 ];
}