94 lines
3.5 KiB
PHP
Executable File
94 lines
3.5 KiB
PHP
Executable File
<?php
|
|
class Tools extends ToolsCore {
|
|
|
|
public static function getShopDomain($http=FALSE, $entities=FALSE) {
|
|
global $site_version;
|
|
|
|
if(!($domain = (isset($site_version)
|
|
? str_replace('bebeboutik.com', 'bebeboutik.'.$site_version, Configuration::get(_PS_MOBILE_? 'PS_MOBILE_DOMAIN': (_PS_OPEN_SHOP_? 'PS_OPEN_SHOP_DOMAIN': 'PS_SHOP_DOMAIN')))
|
|
: Configuration::get(_PS_MOBILE_? 'PS_MOBILE_DOMAIN': (_PS_OPEN_SHOP_? 'PS_OPEN_SHOP_DOMAIN': 'PS_SHOP_DOMAIN'))
|
|
))) {
|
|
$domain = self::getHttpHost();
|
|
}
|
|
|
|
if($entities) {
|
|
$domain = htmlspecialchars($domain, ENT_COMPAT, 'UTF-8');
|
|
}
|
|
if($http) {
|
|
$domain = (($_SERVER['SERVER_PORT'] == _PS_SSL_PORT_ || !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' || Configuration::get('PS_SSL_ENABLED'))? 'https://': 'http://').$domain;
|
|
}
|
|
|
|
return $domain;
|
|
|
|
// if(!($domain = Configuration::get( _PS_MOBILE_ ? 'PS_MOBILE_DOMAIN' : 'PS_SHOP_DOMAIN'))) {
|
|
// $domain = self::getHttpHost();
|
|
// }
|
|
// if($entities) {
|
|
// $domain = htmlspecialchars($domain, ENT_COMPAT, 'UTF-8');
|
|
// }
|
|
// if($http) {
|
|
// $domain = (($_SERVER['SERVER_PORT'] == _PS_SSL_PORT_ || !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' || Configuration::get('PS_SSL_ENABLED'))? 'https://': 'http://').$domain;
|
|
// }
|
|
// return $domain;
|
|
|
|
}
|
|
|
|
public static function getShopDomainSsl($http=FALSE, $entities=FALSE) {
|
|
global $site_version;
|
|
|
|
if(!($domain = (isset($site_version)
|
|
? str_replace('bebeboutik.com', 'bebeboutik.'.$site_version, Configuration::get(_PS_MOBILE_? 'PS_MOBILE_DOMAIN': (_PS_OPEN_SHOP_? 'PS_OPEN_SHOP_DOMAIN': 'PS_SHOP_DOMAIN')))
|
|
: Configuration::get(_PS_MOBILE_? 'PS_MOBILE_DOMAIN': (_PS_OPEN_SHOP_? 'PS_OPEN_SHOP_DOMAIN': 'PS_SHOP_DOMAIN'))
|
|
))) {
|
|
$domain = self::getHttpHost();
|
|
}
|
|
if($entities) {
|
|
$domain = htmlspecialchars($domain, ENT_COMPAT, 'UTF-8');
|
|
}
|
|
if($http) {
|
|
$domain = (($_SERVER['SERVER_PORT'] == _PS_SSL_PORT_ || !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' || Configuration::get('PS_SSL_ENABLED'))? 'https://': 'http://').$domain;
|
|
}
|
|
return $domain;
|
|
|
|
// } else {
|
|
// if(!($domain = Configuration::get( _PS_MOBILE_ ? 'PS_MOBILE_DOMAIN' : 'PS_SHOP_DOMAIN_SSL'))) {
|
|
// $domain = self::getHttpHost();
|
|
// }
|
|
// if($entities) {
|
|
// $domain = htmlspecialchars($domain, ENT_COMPAT, 'UTF-8');
|
|
// }
|
|
// if($http) {
|
|
// $domain = (($_SERVER['SERVER_PORT'] == _PS_SSL_PORT_ || !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' || Configuration::get('PS_SSL_ENABLED'))? 'https://': 'http://').$domain;
|
|
// }
|
|
// return $domain;
|
|
// }
|
|
}
|
|
|
|
|
|
public static function getProtocol($use_ssl=NULL) {
|
|
return (!is_null($use_ssl) && $use_ssl || $_SERVER['SERVER_PORT'] == _PS_SSL_PORT_ || !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' || Configuration::get('PS_SSL_ENABLED')? 'https://': 'http://');
|
|
}
|
|
|
|
public static function setCookieLanguage() {
|
|
global $cookie;
|
|
|
|
/* If language does not exist or is disabled, erase it */
|
|
if($cookie->id_lang) {
|
|
$lang = new Language((int)$cookie->id_lang);
|
|
if(!Validate::isLoadedObject($lang)) {
|
|
$cookie->id_lang = NULL;
|
|
}
|
|
}
|
|
|
|
/* If language file not present, you must use default language file */
|
|
if(!$cookie->id_lang OR !Validate::isUnsignedId($cookie->id_lang))
|
|
$cookie->id_lang = (int) Configuration::get('PS_LANG_DEFAULT');
|
|
|
|
$iso = Language::getIsoById((int) $cookie->id_lang);
|
|
@include_once(_PS_THEME_DIR_.'lang/'.$iso.'.php');
|
|
|
|
return $iso;
|
|
}
|
|
|
|
}
|