From 4639dd1c469ef4ed235c824224dab561ede35d83 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Tue, 27 Sep 2016 09:00:02 -0400 Subject: [PATCH] Stub of Conf class; schema tweaks --- .gitignore | 2 +- bootstrap.php | 16 +++++++++++ schema.sql | 27 ++++++++++------- vendor/JKingWeb/NewsSync/Conf.php | 48 +++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 11 deletions(-) create mode 100644 bootstrap.php create mode 100644 vendor/JKingWeb/NewsSync/Conf.php diff --git a/.gitignore b/.gitignore index 1e729413..bacb72d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ #dependencies -inc/simplepie/* +vendor/simplepie/* #temp files cache/* diff --git a/bootstrap.php b/bootstrap.php new file mode 100644 index 00000000..1e026060 --- /dev/null +++ b/bootstrap.php @@ -0,0 +1,16 @@ +import($import_file); + } + + function import(string $file): bool { + $json = @file_get_contents($file); + if($json===false) return false; + $json = json_decode($json, true); + if(!is_array(json)) return false; + foreach($json as $key => $value) { + $this->$$key = $value; + } + return true; + } + + function export(string $file = ""): string { + return json_encode($this, JSON_PRETTY_PRINT); + } + + function __toString(): string { + return $this->export(); + } +} \ No newline at end of file