Add messagebox, bugfixes

This commit is contained in:
2024-10-02 00:53:11 +02:00
parent 24f569070f
commit f23c378020
6 changed files with 239 additions and 5 deletions

32
src/Settings.php Normal file
View File

@ -0,0 +1,32 @@
<?php
namespace NoccyLabs\JEdit;
class Settings
{
public static bool $editorQuotedKeys = false;
public static function load(string $filename): void
{
if (file_exists($filename) && is_readable($filename)) {
$data = json_decode(file_get_contents($filename));
self::$editorQuotedKeys = $data->editorQuotedKeys ?? false;
}
}
public static function save(string $filename): void
{
$data = json_encode([
'editorQuotedKeys' => self::$editorQuotedKeys
], JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT)."\n";
@file_put_contents($filename, $data);
}
public static function set(string $key, mixed $value): void
{
switch ($key) {
case 'editorQuotedKeys':
self::$editorQuotedKeys = (bool)$value; break;
}
}
}