From f7bfdf58def6aadc922e1632f407d1418269a0d7 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Sat, 9 Jul 2022 19:40:17 +0300 Subject: initial --- model/Page.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 model/Page.php (limited to 'model/Page.php') diff --git a/model/Page.php b/model/Page.php new file mode 100644 index 0000000..6711a2c --- /dev/null +++ b/model/Page.php @@ -0,0 +1,44 @@ +md) + $data['html'] = markup::markdownToHtml($data['md']); + parent::edit($data); + } + + public function isUpdated(): bool { + return $this->updateTs && $this->updateTs != $this->ts; + } + + public function getHtml(bool $retina): string { + $html = $this->html; + if ($retina) + $html = markup::htmlRetinaFix($html); + return $html; + } + + public function getUrl(): string { + return "/{$this->shortName}/"; + } + + public function updateHtml() { + $html = markup::markdownToHtml($this->md); + $this->html = $html; + getDb()->query("UPDATE pages SET html=? WHERE short_name=?", $html, $this->shortName); + } + +} -- cgit v1.2.3