wishthis/includes/classes/options.php

39 lines
687 B
PHP
Raw Normal View History

2022-01-14 09:50:48 +00:00
<?php
/**
* options.php
*
* Store and retrieve application options.
*
* @author Jay Trees <github.jay@grandel.anonaddy.me>
*/
namespace wishthis;
class Options
{
2022-01-14 13:13:07 +00:00
public bool $updateAvailable = false;
2022-01-14 09:50:48 +00:00
public function __construct(private Database $database)
{
}
public function getOption(string $key): string
{
2022-01-14 15:18:54 +00:00
$value = '';
2022-01-14 09:50:48 +00:00
2022-01-14 15:18:54 +00:00
try {
$option = $this->database->query(
'SELECT * FROM `options`
WHERE `key` = "' . $key . '";'
)->fetch();
$value = $option['value'] ?? '';
} catch (\Throwable $th) {
//throw $th;
}
return $value;
2022-01-14 09:50:48 +00:00
}
}