function get_template_data() { $file = file_get_contents($this->module->current->get_js_file()); $data = json_decode($file) ?: []; if ($data === []) { error_handler::debug('Json decode error', ['message' => json_last_error_msg()]); } return (array) $data; }
public function exec($id, $data) { $file = root . '/.cache/' . $id . '/track.json'; $this->id = $id; chdir(root . '/igc_parser'); error_handler::debug('IGC Parser call', $data); $res = exec("igc_parser '" . json_encode($data) . "'"); chdir(root); if (!$res) { return false; } file_put_contents($file, $res); $this->data = json_decode($res); return true; }