Make WordPress Core

Ticket #28487: 28487.is_ssl.diff

File 28487.is_ssl.diff, 1.1 KB (added by georgestephanis, 11 years ago)
  • src/wp-includes/functions.php

     
    33603360}
    33613361
    33623362/**
    3363  * Determine if SSL is used.
     3363 * Determine if SSL is used for either the current request or the provided URL.
    33643364 *
    33653365 * @since 2.6.0
    33663366 *
    3367  * @return bool True if SSL, false if not used.
     3367 * @param string $url Optional.
     3368 * @return bool True if the $url param or current request is SSL, false if not used.
    33683369 */
    3369 function is_ssl() {
     3370function is_ssl( $url = null ) {
     3371        if ( ! empty( $url ) ) {
     3372                return ( 'https' === @parse_url( $url, PHP_URL_SCHEME ) );
     3373        }
     3374
    33703375        if ( isset($_SERVER['HTTPS']) ) {
    3371                 if ( 'on' == strtolower($_SERVER['HTTPS']) )
     3376                if ( 'on' == strtolower( $_SERVER['HTTPS'] ) ) {
    33723377                        return true;
    3373                 if ( '1' == $_SERVER['HTTPS'] )
     3378                }
     3379                if ( '1' == $_SERVER['HTTPS'] ) {
    33743380                        return true;
    3375         } elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
     3381                }
     3382        } elseif ( isset( $_SERVER['SERVER_PORT'] ) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
    33763383                return true;
    33773384        }
     3385
    33783386        return false;
    33793387}
    33803388