Piwik\SettingsPiwik::isHttpsForced PHP Method

isHttpsForced() public static method

public static isHttpsForced ( ) : boolean
return boolean
    public static function isHttpsForced()
    {
        if (!SettingsPiwik::isPiwikInstalled()) {
            // Only enable this feature after Piwik is already installed
            return false;
        }
        return Config::getInstance()->General['force_ssl'] == 1;
    }

Usage Example

 protected function handleSSLRedirection()
 {
     // Specifically disable for the opt out iframe
     if (Piwik::getModule() == 'CoreAdminHome' && Piwik::getAction() == 'optOut') {
         return;
     }
     // Disable Https for VisitorGenerator
     if (Piwik::getModule() == 'VisitorGenerator') {
         return;
     }
     if (Common::isPhpCliMode()) {
         return;
     }
     // Only enable this feature after Piwik is already installed
     if (!SettingsPiwik::isPiwikInstalled()) {
         return;
     }
     // proceed only when force_ssl = 1
     if (!SettingsPiwik::isHttpsForced()) {
         return;
     }
     Url::redirectToHttps();
 }
All Usage Examples Of Piwik\SettingsPiwik::isHttpsForced