From b82babc08be00bf5c595ab6900bfdc91ccf28696 Mon Sep 17 00:00:00 2001 From: vSchoener Date: Tue, 6 Dec 2011 14:22:03 +0000 Subject: [PATCH] // Add getShopProtocol to have the current protocol use by the current shop --- classes/Tools.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/classes/Tools.php b/classes/Tools.php index 123d71a58..bd30defc6 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -132,6 +132,20 @@ class ToolsCore exit; } + /** + * getShopProtocol return the available protocol for the current shop in use + * SSL if Configuration is set on and available for the server + * @static + * @return String + */ + public static function getShopProtocol() + { + $id_shop = Context::getContext()->shop()->id; + $protocol = (Configuration::get('PS_SSL_ENABLED', null, null, $id_shop) || (!empty($_SERVER['HTTPS']) + && strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://'; + return $protocol; + } + /** * getProtocol return the set protocol according to configuration (http[s]) * @param Boolean true if require ssl