WordPress.org

Make WordPress Core

Changeset 28709


Ignore:
Timestamp:
06/09/2014 10:02:50 PM (7 years ago)
Author:
johnbillion
Message:

Deprecate url_is_accessable_via_ssl(). Fixes #19555. Props jgadbois.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/deprecated.php

    r28679 r28709  
    34583458    return $content;
    34593459}
     3460
     3461/**
     3462 * Determines if the URL can be accessed over SSL.
     3463 *
     3464 * Determines if the URL can be accessed over SSL by using the WordPress HTTP API to access
     3465 * the URL using https as the scheme.
     3466 *
     3467 * @since 2.5.0
     3468 * @deprecated 4.0.0
     3469 *
     3470 * @param string $url The URL to test.
     3471 * @return bool Whether SSL access is available.
     3472 */
     3473function url_is_accessable_via_ssl( $url ) {
     3474    _deprecated_function( __FUNCTION__, '4.0', '' );
     3475
     3476    $response = wp_remote_get( set_url_scheme( $url, 'https' ) );
     3477
     3478    if ( !is_wp_error( $response ) ) {
     3479        $status = wp_remote_retrieve_response_code( $response );
     3480        if ( 200 == $status || 401 == $status ) {
     3481            return true;
     3482        }
     3483    }
     3484
     3485    return false;
     3486}
  • trunk/src/wp-includes/functions.php

    r28648 r28709  
    30033003
    30043004/**
    3005  * Determines if the blog can be accessed over SSL.
    3006  *
    3007  * Determines if blog can be accessed over SSL by using cURL to access the site
    3008  * using the https in the siteurl. Requires cURL extension to work correctly.
    3009  *
    3010  * @since 2.5.0
    3011  *
    3012  * @param string $url
    3013  * @return bool Whether SSL access is available
    3014  */
    3015 function url_is_accessable_via_ssl($url)
    3016 {
    3017     if ( in_array( 'curl', get_loaded_extensions() ) ) {
    3018         $ssl = set_url_scheme( $url, 'https' );
    3019 
    3020         $ch = curl_init();
    3021         curl_setopt($ch, CURLOPT_URL, $ssl);
    3022         curl_setopt($ch, CURLOPT_FAILONERROR, true);
    3023         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    3024         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    3025         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    3026 
    3027         curl_exec($ch);
    3028 
    3029         $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    3030         curl_close ($ch);
    3031 
    3032         if ($status == 200 || $status == 401) {
    3033             return true;
    3034         }
    3035     }
    3036     return false;
    3037 }
    3038 
    3039 /**
    30403005 * Marks a function as deprecated and informs when it has been used.
    30413006 *
Note: See TracChangeset for help on using the changeset viewer.