Example #1
0
 /**
  * Sets the URL to https or http, depending on availability and related WP config settings/APIs.
  *
  * @since 4.2
  *
  * @param $url string
  *
  * @return string
  */
 public function set_url_scheme($url)
 {
     $current_user = get_current_user();
     if (function_exists('force_ssl_admin') && force_ssl_admin() || function_exists('force_ssl_login') && force_ssl_login() || function_exists('force_ssl_content') && force_ssl_content() || function_exists('is_ssl') && is_ssl() || !empty($current_user->use_ssl)) {
         return set_url_scheme($url, 'https');
     }
     return set_url_scheme($url, 'http');
 }
Example #2
0
/**
 * Formats an String URL to use HTTPS if HTTP is found.
 * Useful as a filter.
 *
 * @since 2.8.5
 **/
function filter_SSL($url)
{
    if (!is_string($url)) {
        return get_bloginfo('url');
    }
    //return home blog url with proper scheme
    $arrURL = parse_url($url);
    if (force_ssl_content() && is_ssl()) {
        if ('http' === $arrURL['scheme'] && 'https' !== $arrURL['scheme']) {
            $url = str_replace($arrURL['scheme'], 'https', $url);
        }
    }
    return $url;
}
Example #3
0
/**
 * Formats a URL to use https.
 *
 * Useful as a filter.
 *
 * @since 2.8.5
 *
 * @param string URL
 * @return string URL with https as the scheme
 */
function filter_SSL($url)
{
    if (!is_string($url)) {
        return get_bloginfo('url');
    }
    // Return home blog url with proper scheme
    if (force_ssl_content() && is_ssl()) {
        $url = set_url_scheme($url, 'https');
    }
    return $url;
}