WpOrg\Requests\Transport

Fsockopen::test │ public static │ WP 1.0

Self-test whether the transport can be used.

The available capabilities to test for can be found in Capability{}.

Метод класса: Fsockopen{}

Хуков нет.

Возвращает

bool. Whether the transport can be used.

Использование

$result = Fsockopen::test( $capabilities );
$capabilities(array<string, bool>)
Associative array of capabilities to test against, i.e. ['<capability>' => true].
По умолчанию: []

Код Fsockopen::test() WP 7.1.3

public static function test($capabilities = []) {
	if (!function_exists('fsockopen')) {
		return false;
	}

	// If needed, check that streams support SSL
	if (isset($capabilities[Capability::SSL]) && $capabilities[Capability::SSL]) {
		if (!extension_loaded('openssl') || !function_exists('openssl_x509_parse')) {
			return false;
		}
	}

	return true;
}