wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_http_supports › WordPress Function

Since3.2.0
Deprecatedn/a
wp_http_supports ( $capabilities = array(), $url = null )
Parameters: (2)
  • (array) $capabilities Array of capabilities to test or a wp_remote_request() $args array.
    Required: No
    Default: array()
  • (string) $url Optional. If given, will check if the URL requires SSL and adds that requirement to the capabilities array.
    Required: No
    Default: null
Returns:
  • (bool)
Defined at:
Codex:

Determines if there is an HTTP Transport that can process this request.



Source

function wp_http_supports( $capabilities = array(), $url = null ) {
	$capabilities = wp_parse_args( $capabilities );

	$count = count( $capabilities );

	// If we have a numeric $capabilities array, spoof a wp_remote_request() associative $args array.
	if ( $count && count( array_filter( array_keys( $capabilities ), 'is_numeric' ) ) === $count ) {
		$capabilities = array_combine( array_values( $capabilities ), array_fill( 0, $count, true ) );
	}

	if ( $url && ! isset( $capabilities['ssl'] ) ) {
		$scheme = parse_url( $url, PHP_URL_SCHEME );
		if ( 'https' === $scheme || 'ssl' === $scheme ) {
			$capabilities['ssl'] = true;
		}
	}

	return WpOrg\Requests\Requests::has_capabilities( $capabilities );
}