From 7a220d7e95bbddd3c953faa98b55d6f6edbd58f6 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 9 Jun 2014 22:02:50 +0000 Subject: [PATCH] Deprecate `url_is_accessable_via_ssl()`. Fixes #19555. Props jgadbois. git-svn-id: https://develop.svn.wordpress.org/trunk@28709 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/deprecated.php | 27 ++++++++++++++++++++++++++ src/wp-includes/functions.php | 35 ---------------------------------- 2 files changed, 27 insertions(+), 35 deletions(-) diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php index 5e5c19f17c..dbdc7217bf 100644 --- a/src/wp-includes/deprecated.php +++ b/src/wp-includes/deprecated.php @@ -3457,3 +3457,30 @@ function format_to_post( $content ) { _deprecated_function( __FUNCTION__, '3.9' ); return $content; } + +/** + * Determines if the URL can be accessed over SSL. + * + * Determines if the URL can be accessed over SSL by using the WordPress HTTP API to access + * the URL using https as the scheme. + * + * @since 2.5.0 + * @deprecated 4.0.0 + * + * @param string $url The URL to test. + * @return bool Whether SSL access is available. + */ +function url_is_accessable_via_ssl( $url ) { + _deprecated_function( __FUNCTION__, '4.0', '' ); + + $response = wp_remote_get( set_url_scheme( $url, 'https' ) ); + + if ( !is_wp_error( $response ) ) { + $status = wp_remote_retrieve_response_code( $response ); + if ( 200 == $status || 401 == $status ) { + return true; + } + } + + return false; +} diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 512d5c4baa..ee1bca2172 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -3001,41 +3001,6 @@ function absint( $maybeint ) { return abs( intval( $maybeint ) ); } -/** - * Determines if the blog can be accessed over SSL. - * - * Determines if blog can be accessed over SSL by using cURL to access the site - * using the https in the siteurl. Requires cURL extension to work correctly. - * - * @since 2.5.0 - * - * @param string $url - * @return bool Whether SSL access is available - */ -function url_is_accessable_via_ssl($url) -{ - if ( in_array( 'curl', get_loaded_extensions() ) ) { - $ssl = set_url_scheme( $url, 'https' ); - - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $ssl); - curl_setopt($ch, CURLOPT_FAILONERROR, true); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); - - curl_exec($ch); - - $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); - curl_close ($ch); - - if ($status == 200 || $status == 401) { - return true; - } - } - return false; -} - /** * Marks a function as deprecated and informs when it has been used. *