diff --git a/jumpapp/classes/Pages/HomePage.php b/jumpapp/classes/Pages/HomePage.php index 99ecdbd..dbe359a 100644 --- a/jumpapp/classes/Pages/HomePage.php +++ b/jumpapp/classes/Pages/HomePage.php @@ -23,6 +23,8 @@ class HomePage extends AbstractPage { } $csrfsection = $this->session->getSection('csrf'); $unsplashdata = $this->cache->load('unsplash'); + $showsearch = $this->config->parse_bool($this->config->get('showsearch', false)); + $checkstatus = $this->config->parse_bool($this->config->get('checkstatus', false)); $templatecontext = [ 'csrftoken' => $csrfsection->get('token'), 'greeting' => $greeting, @@ -34,11 +36,9 @@ class HomePage extends AbstractPage { 'unsplash' => !!$this->config->get('unsplashapikey', false), 'unsplashcolor' => $unsplashdata?->color, 'wwwurl' => $this->config->get_wwwurl(), - 'checkstatus' => $this->config->parse_bool($this->config->get('checkstatus', false)), + 'checkstatus' => $checkstatus, ]; - $showsearch = $this->config->parse_bool($this->config->get('showsearch', false)); - $showstatus = $this->config->parse_bool($this->config->get('showsearch', false)); - if ($showsearch || $showstatus) { + if ($showsearch || $checkstatus) { $templatecontext['sitesjson'] = json_encode((new \Jump\Sites($this->config, $this->cache))->get_sites_for_frontend()); if ($showsearch) { $templatecontext['searchengines'] = json_encode((new \Jump\SearchEngines($this->config, $this->cache))->get_search_engines()); diff --git a/jumpapp/classes/Pages/TagPage.php b/jumpapp/classes/Pages/TagPage.php index 7ef1598..d3e2a3c 100644 --- a/jumpapp/classes/Pages/TagPage.php +++ b/jumpapp/classes/Pages/TagPage.php @@ -23,6 +23,8 @@ class TagPage extends AbstractPage { $title = 'Tag: '.$this->tagname; $csrfsection = $this->session->getSection('csrf'); $unsplashdata = $this->cache->load('unsplash'); + $showsearch = $this->config->parse_bool($this->config->get('showsearch', false)); + $checkstatus = $this->config->parse_bool($this->config->get('checkstatus', false)); $templatecontext = [ 'csrftoken' => $csrfsection->get('token'), 'greeting' => $this->tagname, @@ -34,12 +36,13 @@ class TagPage extends AbstractPage { 'unsplash' => !!$this->config->get('unsplashapikey', false), 'unsplashcolor' => $unsplashdata?->color, 'wwwurl' => $this->config->get_wwwurl(), + 'checkstatus' => $checkstatus, ]; - if ($this->config->parse_bool($this->config->get('showsearch', false))) { - $templatecontext = array_merge($templatecontext, [ - 'searchengines' => json_encode((new \Jump\SearchEngines($this->config, $this->cache))->get_search_engines()), - 'searchjson' => json_encode((new \Jump\Sites($this->config, $this->cache))->get_sites_for_search()), - ]); + if ($showsearch || $checkstatus) { + $templatecontext['sitesjson'] = json_encode((new \Jump\Sites($this->config, $this->cache))->get_sites_for_frontend()); + if ($showsearch) { + $templatecontext['searchengines'] = json_encode((new \Jump\SearchEngines($this->config, $this->cache))->get_search_engines()); + } } return $template->render($templatecontext); }