aboutsummaryrefslogtreecommitdiff
path: root/app/model
diff options
context:
space:
mode:
authorThedro Neely <thedroneely@gmail.com>2019-04-21 14:27:13 -0400
committerThedro Neely <thedroneely@gmail.com>2019-04-21 14:27:13 -0400
commitcc434a53547a81eee5112b43683ee36bbf50b3a4 (patch)
tree85d2023bdc266d02ffdba718890d1dab7f2099b5 /app/model
parentfbc4094e47e4ac18da6afeefa85bd96f9488ab14 (diff)
downloadthedroneely.com-cc434a53547a81eee5112b43683ee36bbf50b3a4.tar.gz
thedroneely.com-cc434a53547a81eee5112b43683ee36bbf50b3a4.tar.bz2
thedroneely.com-cc434a53547a81eee5112b43683ee36bbf50b3a4.zip
app/model/Theme: Use the theme parameter
Diffstat (limited to 'app/model')
-rw-r--r--app/model/Theme.php31
1 files changed, 21 insertions, 10 deletions
diff --git a/app/model/Theme.php b/app/model/Theme.php
index 36a4c6f..f146a7c 100644
--- a/app/model/Theme.php
+++ b/app/model/Theme.php
@@ -2,30 +2,41 @@
class Theme
{
- public function dark()
+ public function color()
{
- return $darkTheme = $_COOKIE['darkTheme'] ?? null;
+ return $theme = $_COOKIE['theme'] ?? null;
+ }
+
+ public function option()
+ {
+ return $theme = $_GET['theme'] ?? null;
}
public function set($theme)
{
- $time = time()+3600*24*365*10;
+ $time = time() + 3600 * 24 * 365 * 10;
if ($theme === null) {
- setcookie('darkTheme', 'on', $time, '/');
- return $_COOKIE['darkTheme'] = 'on';
+ setcookie('theme', 'dark', $time, '/');
+ return $_COOKIE['theme'] = 'dark';
}
- setcookie('darkTheme', null, $time, '/');
- return $_COOKIE['darkTheme'] = null;
+ setcookie('theme', $theme, $time, '/');
+ return $_COOKIE['theme'] = $theme;
+
}
public function toggle()
{
- $toggle = $_GET['toggle'] ?? null;
+ $theme = $this->option();
+
+ if ($theme === 'dark') {
+ $theme = $this->set($this->option());
+ return;
+ }
- if ($toggle === 'theme') {
- $theme = $this->set($this->dark());
+ if ($theme === 'light') {
+ $theme = $this->set($this->option());
}
}
}