public function __toString() { $this->data = data::load($this); $r = ''; if (isset($_GET['check'])) { $id = $_GET['check']; if (!$this->data->checks->has($id)) { wp_die('Invalid check ID!'); } $check = $this->data->checks->get($id); if (isset($_GET['action'])) { $action = $_GET['action']; $actions = $check->get_actions(); if (!isset($actions[$action])) { wp_die('Invalid check action!'); } return call_user_func([$check, $action]); } } if (isset($_GET['do_check'])) { $id = $_GET['do_check']; if ($this->data->checks->has($id)) { $check = $this->data->checks->get($id); if ($check->step == 'start') { $r .= $check->init(); } $r .= $check->step(); $this->data->save(); } else { wp_die(sprintf('Check %s does not exist!', $id)); } } else { $r = $this->get_table(); } return $r; }