Created
September 10, 2013 03:43
-
-
Save PeloNZ/6504695 to your computer and use it in GitHub Desktop.
useful function from wordpress to determine if a page is using ssl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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