Improved SSL (https) detection

Tracker item: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=30885

Some SSL (https) servers/setups do not have the $_SERVER['HTTPS'] variable to on.
But they do have a $_SERVER['HTTP_X_FORWARDED_PROTO'] value set to 'https'.

See for more details: https://github.com/puma/puma/pull/200

This PR adds a check for that variable to the isSSLConnection method.
It also adds a few more checks and makes the whole thing more solid.

Also I have replaced some inline checks in other code to use this isSSLConnection method instead (= DRY).

#### Test instructions
Test if the different JUri methods and other functionalities that rely on SSL still work. And more-so if they now work on setups that use that HTTP_X_FORWARDED_PROTO var.

Things you can check (on SLL urls):
```
<?php
$uri = JUri::getInstance();
echo '<p>JUri Scheme = ' . $uri->toString(array('scheme')) . '</p>' . "\n"; // should be 'https://'
echo '<p>JUri Root = ' . JUri::root() . '</p>' . "\n"; // should start with 'https://'
echo '<p>isSSLConnection = ' . (JFactory::getApplication()->isSSLConnection() ? 'true' : 'false') . '</p>' . "\n"; // should be 'true'
?>
```