2020-11-17 23:27:25 +01:00
|
|
|
<?php
|
2021-03-29 00:22:00 +02:00
|
|
|
use function _\find;
|
2020-11-17 23:27:25 +01:00
|
|
|
class Settings
|
|
|
|
{
|
2021-03-25 22:05:32 +01:00
|
|
|
private $folks;
|
|
|
|
private $tags;
|
|
|
|
private $settings;
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
//gets all settings files and converts to php objects
|
2021-03-29 00:22:00 +02:00
|
|
|
$this->folks = json_decode(file_get_contents("../config/folks.json"), true);
|
|
|
|
$this->tags = json_decode(file_get_contents("../config/tags.json"), true);
|
2021-03-25 22:05:32 +01:00
|
|
|
$this->settings = json_decode(
|
2021-03-29 00:22:00 +02:00
|
|
|
file_get_contents("../config/settings.json"),
|
2021-03-25 22:05:32 +01:00
|
|
|
true
|
|
|
|
);
|
|
|
|
}
|
2021-03-27 21:59:44 +01:00
|
|
|
|
2021-03-29 00:22:00 +02:00
|
|
|
public function getFolks($key)
|
2021-03-27 21:59:44 +01:00
|
|
|
{
|
2021-03-29 00:22:00 +02:00
|
|
|
if (isset($key)) {
|
|
|
|
$member = Session::get("member");
|
|
|
|
$found = find($this->folks, ["handle" => $member["handle"]]);
|
|
|
|
return $found[$key];
|
|
|
|
} else {
|
|
|
|
return $this->folks;
|
|
|
|
}
|
2021-03-27 21:59:44 +01:00
|
|
|
}
|
2021-03-25 22:05:32 +01:00
|
|
|
}
|