This repository has been archived on 2024-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
epubreader/lib/config.php

64 lines
1.6 KiB
PHP
Raw Normal View History

2020-04-21 20:37:42 +00:00
<?php
/**
* ownCloud - Epubreader App
2020-04-21 20:37:42 +00:00
*
* @author Frank de Lange
* @copyright 2014,2018 Frank de Lange
*
* This file is licensed under the Affero General Public License version 3 or
* later.
*/
namespace OCA\Epubreader;
2020-04-21 20:37:42 +00:00
/**
* Config class for Reader
*/
2023-06-16 14:58:23 +00:00
class Config {
2023-06-16 19:20:03 +00:00
2020-04-21 20:37:42 +00:00
/**
* @brief get user config value
*
* @param string $key value to retrieve
* @param string $default default value to use
* @return string retrieved value or default
*/
2023-06-16 19:20:03 +00:00
public static function get(string $key, string $default): string {
return \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), 'epubreader', $key, $default);
2020-04-21 20:37:42 +00:00
}
/**
* @brief set user config value
*
* @param string $key key for value to change
* @param string $value value to use
* @return bool success
*/
2023-06-16 19:20:03 +00:00
public static function set(string $key, string $value): bool {
return \OC::$server->getConfig()->setUserValue(\OC_User::getUser(), 'epubreader', $key, $value);
2020-04-21 20:37:42 +00:00
}
/**
* @brief get app config value
*
* @param string $key value to retrieve
* @param string $default default value to use
* @return string retrieved value or default
*/
2023-06-16 19:20:03 +00:00
public static function getApp(string $key, string $default): string {
return \OC::$server->getConfig()->getAppValue('epubreader', $key, $default);
2020-04-21 20:37:42 +00:00
}
/**
* @brief set app config value
*
* @param string $key key for value to change
* @param string $value value to use
* @return bool success
*/
2023-06-16 19:20:03 +00:00
public static function setApp(string $key, string $value): bool {
return \OC::$server->getConfig()->setAppValue('epubreader', $key, $value);
2020-04-21 20:37:42 +00:00
}
}