WordPress.org

Make WordPress Core

Ticket #19555: 19555.patch

File 19555.patch, 2.3 KB (added by jgadbois, 6 years ago)
  • wp-includes/functions.php

     
    26702670}
    26712671
    26722672/**
    2673  * Determines if the blog can be accessed over SSL.
    2674  *
    2675  * Determines if blog can be accessed over SSL by using cURL to access the site
    2676  * using the https in the siteurl. Requires cURL extension to work correctly.
    2677  *
    2678  * @since 2.5.0
    2679  *
    2680  * @param string $url
    2681  * @return bool Whether SSL access is available
    2682  */
    2683 function url_is_accessable_via_ssl($url)
    2684 {
    2685         if (in_array('curl', get_loaded_extensions())) {
    2686                 $ssl = preg_replace( '/^http:\/\//', 'https://',  $url );
    2687 
    2688                 $ch = curl_init();
    2689                 curl_setopt($ch, CURLOPT_URL, $ssl);
    2690                 curl_setopt($ch, CURLOPT_FAILONERROR, true);
    2691                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    2692                 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    2693                 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    2694 
    2695                 curl_exec($ch);
    2696 
    2697                 $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    2698                 curl_close ($ch);
    2699 
    2700                 if ($status == 200 || $status == 401) {
    2701                         return true;
    2702                 }
    2703         }
    2704         return false;
    2705 }
    2706 
    2707 /**
    27082673 * Marks a function as deprecated and informs when it has been used.
    27092674 *
    27102675 * There is a hook deprecated_function_run that will be called that can be used
  • wp-includes/deprecated.php

     
    28662866
    28672867        return is_user_member_of_blog( get_current_user_id(), $blog_id );
    28682868}
     2869
     2870/**
     2871 * Determines if the blog can be accessed over SSL.
     2872 *
     2873 * Determines if blog can be accessed over SSL by using cURL to access the site
     2874 * using the https in the siteurl. Requires cURL extension to work correctly.
     2875 *
     2876 * @since 2.5.0
     2877 * @deprecated 3.3
     2878 *
     2879 * @param string $url
     2880 * @return bool Whether SSL access is available
     2881 */
     2882function url_is_accessable_via_ssl($url)
     2883{
     2884        _deprecated_function( __FUNCTION__, '3.3', '' );
     2885        $ssl = preg_replace( '/^http:\/\//', 'https://',  $url );
     2886
     2887        $response = wp_remote_get( $ssl );
     2888
     2889        if( !is_wp_error( $response ) ) {
     2890                $status = $response['response']['code'];
     2891                if ($status == 200 || $status == 401) {
     2892                        return true;
     2893                }
     2894        }
     2895
     2896        return false;
     2897}