Skip to content

Instantly share code, notes, and snippets.

@PeloNZ
Created September 10, 2013 03:43
Show Gist options
  • Select an option

  • Save PeloNZ/6504695 to your computer and use it in GitHub Desktop.

Select an option

Save PeloNZ/6504695 to your computer and use it in GitHub Desktop.
useful function from wordpress to determine if a page is using ssl
/**
* Determine if SSL is used.
*
* @since 2.6.0
* @link http://core.trac.wordpress.org/browser/tags/3.3.2/wp-includes/functions.php#L0
*
* @return bool True if SSL, false if not used.
* @license GPL
*/
public static function is_ssl() {
if (isset($_SERVER['HTTPS'])) {
if ('on' == strtolower($_SERVER['HTTPS']))
return true;
if ('1' == $_SERVER['HTTPS'])
return true;
} elseif (isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] )) {
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment