From de664966b0899b67682227284d55a3afe162764c Mon Sep 17 00:00:00 2001 From: John Blackbourn <johnbillion@git.wordpress.org> Date: Sun, 29 Jun 2014 11:32:15 +0000 Subject: [PATCH] Introduce `is_https_url()` for testing whether the scheme for a given URL is `https`. See #28487. Built from https://develop.svn.wordpress.org/trunk@28894 git-svn-id: http://core.svn.wordpress.org/trunk@28693 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index d238e3c0b9..94d6de3eb5 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -3359,6 +3359,18 @@ function is_ssl() { return false; } +/** + * Determine if the scheme of the given URL is https. + * + * @since 4.0.0 + * + * @param string $url The URL + * @return boolean True if the given URL uses https, false if not (or if the URL is not valid). + */ +function is_https_url( $url ) { + return ( 'https' === parse_url( $url, PHP_URL_SCHEME ) ); +} + /** * Whether SSL login should be forced. *