diff --git a/library/Application/Configuration.php b/library/Application/Configuration.php deleted file mode 100644 index 5dd3ce082..000000000 --- a/library/Application/Configuration.php +++ /dev/null @@ -1,313 +0,0 @@ -getConfig(); - - if (isset($config->name)) { - $name = $config->name; - } else { - $name = 'OPUS 4'; - } - - return $name; - } - - /** - * Liefert die Sprachen, die von OPUS unterstützt werden. - * - * @return array - */ - public function getSupportedLanguages() - { - if ($this->supportedLanguages === null) { - $config = $this->getConfig(); - if (isset($config->supportedLanguages)) { - $this->supportedLanguages = array_map('trim', explode(',', $config->supportedLanguages)); - /* TODO only used for debugging - remove? - $this->getLogger()->debug( - Zend_Debug::dump( - $this->_supportedLanguages, 'Supported languages (' - . count($this->_supportedLanguages) . ')', false - ) - );*/ - } - } - return $this->supportedLanguages; - } - - /** - * @return string[] - */ - public function getActivatedLanguages() - { - if ($this->activatedLanguages === null) { - $config = $this->getConfig(); - if (isset($config->activatedLanguages)) { - $this->activatedLanguages = explode(',', $config->activatedLanguages); - } else { - return $this->getSupportedLanguages(); - } - } - - return $this->activatedLanguages; - } - - /** - * Prüft, ob eine Sprache unterstützt wird. - * - * @param string $language Sprachcode (z.B. 'en') - * @return bool - */ - public function isLanguageSupported($language) - { - $languages = $this->getSupportedLanguages(); - return in_array($language, $languages); - } - - /** - * Liefert Defaultsprache für Userinterface. - * - * @return string - */ - public function getDefaultLanguage() - { - if ($this->defaultLanguage === null) { - $languages = $this->getSupportedLanguages(); - $this->defaultLanguage = $languages[0]; - - if ($this->isLanguageSelectionEnabled()) { - $locale = new Zend_Locale(); - $language = $locale->getDefault(); - if (is_array($language) && count($language) > 0) { - reset($language); - $language = key($language); - } else { - $language = self::DEFAULT_LANGUAGE; - } - - if ($this->isLanguageSupported($language)) { - $this->defaultLanguage = $language; - } - } - } - - return $this->defaultLanguage; - } - - /** - * Prüft, ob mehr als eine Sprache unterstützt wird. - * - * @return bool - */ - public function isLanguageSelectionEnabled() - { - if ($this->languageSelectionEnabled === null) { - $this->languageSelectionEnabled = count($this->getSupportedLanguages()) > 1; - } - return $this->languageSelectionEnabled; - } - - /** - * Returns path to files folder for document files. - * - * @return string Folder for storing document files - * @throws Application_Exception - */ - public function getFilesPath() - { - return $this->getWorkspacePath() . 'files' . DIRECTORY_SEPARATOR; - } - - /** - * Returns path to files folder for cached document files. - * - * @return string Folder for storing cached document files - * @throws Application_Exception - */ - public function getFilecachePath() - { - return $this->getWorkspacePath() . 'filecache' . DIRECTORY_SEPARATOR; - } - - /** - * Liest Inhalt von VERSION.txt um die installierte Opusversion zu ermitteln. - * - * @return string - */ - public static function getOpusVersion() - { - $config = Config::get(); - $localVersion = $config->version; - return $localVersion ?? 'unknown'; - } - - /** - * Liefert Informationen als Key -> Value Paare in einem Array. - * - * @return array - */ - public static function getOpusInfo() - { - return []; - } - - /** - * Saves configuration as XML file. - * - * @param Zend_Config $update - * @throws Zend_Config_Exception - */ - public static function save($update) - { - $config = self::load(); - - $config->merge($update); - - $writer = new Zend_Config_Writer_Xml(); - $writer->write(APPLICATION_PATH . '/application/configs/config.xml', $config); - } - - /** - * @return Zend_Config_Xml - * @throws Zend_Config_Exception - */ - public static function load() - { - return new Zend_Config_Xml(APPLICATION_PATH . '/application/configs/config.xml', null, true); - } - - /** - * Returns value for key in current configuration. - * - * @param string $key Name of option - * @return string - */ - public function getValue($key) - { - return $this->getValueFromConfig($this->getConfig(), $key); - } - - /** - * Removes instance. - * - * This is used to reset the configuration to defaults in ini files. - */ - public static function clearInstance() - { - self::$instance = null; - } - - /** - * Returns Zend_Translate instance for application. - * - * @return Zend_Translate - * @throws Zend_Exception - */ - public function getTranslate() - { - return Application_Translate::getInstance(); - } - - /** - * @return bool - */ - public static function isUpdateInProgress() - { - $config = Config::get(); - - return isset($config->updateInProgress) && filter_var($config->updateInProgress, FILTER_VALIDATE_BOOLEAN); - } -} diff --git a/library/Application/Exception.php b/library/Application/Exception.php deleted file mode 100644 index 811d0ea4e..000000000 --- a/library/Application/Exception.php +++ /dev/null @@ -1,57 +0,0 @@ -httpResponseCode = $code; - return $this; - } - - /** - * @return int - */ - public function getHttpResponseCode() - { - return $this->httpResponseCode; - } -}