There is a new function in core/Common.php called `is_https()` -- should use it instead of repeating the code here. :)