array('name' => 'English', 'code' => 'en_US', 'charset' => 'utf-8', 'exist' => '1'), 'nl_NL' => array('name' => 'Dutch', 'code' => 'nl_NL', 'charset' => 'utf-8', 'exist' => '0'), 'tr_TR' => array('name' => 'Turkisch', 'code' => 'tr_TR', 'charset' => 'utf-8', 'exist' => '0'), 'es_ES' => array('name' => 'Spanish', 'code' => 'es_ES', 'charset' => 'utf-8', 'exist' => '0'), 'es_CL' => array('name' => 'Chilean', 'code' => 'es_CL', 'charset' => 'utf-8', 'exist' => '0')); /* Class constructor */ function osC_LanguageInstall() { $language = (isset($_GET['language']) && !empty($_GET['language']) ? $_GET['language'] : ''); $this->set($language); $this->_definitions = $this->_parseIniFile(); $this->load(basename($_SERVER['SCRIPT_FILENAME'])); } /* Public methods */ function load($filename) { $this->_definitions = array_merge($this->_definitions, $this->_parseIniFile($filename)); } /* Private methods */ function _parseIniFile($filename = '', $comment = '#') { if (empty($filename)) { $contents = file('includes/languages/' . $this->getCode() . '.php'); } else { if (file_exists('includes/languages/' . $this->getCode() . '/' . $filename) === false) { return array(); } $contents = file('includes/languages/' . $this->getCode() . '/' . $filename); } $ini_array = array(); foreach ($contents as $line) { $line = trim($line); $firstchar = substr($line, 0, 1); if (!empty($line) && ($firstchar != $comment)) { $delimiter = strpos($line, '='); if ($delimiter !== false) { $key = trim(substr($line, 0, $delimiter)); $value = trim(substr($line, $delimiter + 1)); $ini_array[$key] = $value; } elseif (isset($key)) { $ini_array[$key] .= trim($line); } } } unset($contents); return $ini_array; } function _scanLanguage() { $osC_DirectoryListing = new osC_DirectoryListing('includes/languages'); $osC_DirectoryListing->setIncludeFiles(false); foreach ($osC_DirectoryListing->getFiles() as $directory) { if (array_key_exists($directory['name'], $this->_languages)) { $this->_languages[$directory['name']]['exist'] = 1; } } } } ?>