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; } public static function addCSS($css_uri, $css_media_type = 'all') { global $css_files; if (is_array($css_uri)) { foreach ($css_uri as $file => $media_type){ self::addCSS(self::getShopDomain(true).$file, $media_type); } return true; } //overriding of modules css files $different = 0; $override_path = str_replace(__PS_BASE_URI__.'modules/', _PS_ROOT_DIR_.'/themes/'._THEME_NAME_.'/css/modules/', $css_uri, $different); if ($different && file_exists($override_path)) $css_uri = str_replace(__PS_BASE_URI__.'modules/', __PS_BASE_URI__.'themes/'._THEME_NAME_.'/css/modules/', $css_uri, $different); else { // remove PS_BASE_URI on _PS_ROOT_DIR_ for the following $url_data = parse_url($css_uri); $file_uri = _PS_ROOT_DIR_.self::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']); // check if css files exists if (!file_exists($file_uri)) return true; } // detect mass add $css_uri = array(self::getShopDomain(true).$css_uri => $css_media_type); // adding file to the big array... if (is_array($css_files)) $css_files = array_merge($css_files, $css_uri); else $css_files = $css_uri; return true; } public static function isMobile() { if (_PS_MOBILE_ == 1) { return true; } return false; } public static function isApi() { $subdomain = substr($_SERVER['HTTP_HOST'], 0, strpos($_SERVER['HTTP_HOST'], '.')); if ($subdomain == 'api') { return true; } return false; } public static function isCli() { return (PHP_SAPI === 'cli'); } }