aboutsummaryrefslogtreecommitdiff
path: root/model/Page.php
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2024-01-31 06:11:00 +0300
committerEvgeny Zinoviev <me@ch1p.io>2024-01-31 20:45:40 +0300
commitc0dc531ebefd8912819f3b6c8bda1fed3c7e750c (patch)
tree2c75aa9df182260aef09faf4befd81a4c2b9c5e2 /model/Page.php
parent48d688cdf7f9eae1bf11b8a6f0e5b98687c604cb (diff)
make it simple, but not simpler
Diffstat (limited to 'model/Page.php')
-rw-r--r--model/Page.php43
1 files changed, 0 insertions, 43 deletions
diff --git a/model/Page.php b/model/Page.php
deleted file mode 100644
index f516836..0000000
--- a/model/Page.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-class Page extends Model {
-
- const DB_TABLE = 'pages';
- const DB_KEY = 'short_name';
-
- public string $title;
- public string $md;
- public string $html;
- public int $ts;
- public int $updateTs;
- public bool $visible;
- public string $shortName;
-
- public function edit(array $data) {
- $data['update_ts'] = time();
- if ($data['md'] != $this->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 $is_retina, string $user_theme): string {
- $html = $this->html;
- $html = markup::htmlImagesFix($html, $is_retina, $user_theme);
- 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);
- }
-
-}