summaryrefslogtreecommitdiff
path: root/src/web/_model/blog.php
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-07-08 17:22:30 -0400
committerFreya Murphy <freya@freyacat.org>2024-07-08 17:22:30 -0400
commit8a2c577823b69117af8eda9b1a46bfbcae8153c6 (patch)
treee89dee0f77377a665c78d8a3cea6012888d9af73 /src/web/_model/blog.php
parentfix2 (diff)
downloadwebsite-8a2c577823b69117af8eda9b1a46bfbcae8153c6.tar.gz
website-8a2c577823b69117af8eda9b1a46bfbcae8153c6.tar.bz2
website-8a2c577823b69117af8eda9b1a46bfbcae8153c6.zip
a few fixes, just a few....
Diffstat (limited to 'src/web/_model/blog.php')
-rw-r--r--src/web/_model/blog.php42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/web/_model/blog.php b/src/web/_model/blog.php
index 42cee97..52fb97c 100644
--- a/src/web/_model/blog.php
+++ b/src/web/_model/blog.php
@@ -7,8 +7,11 @@ class Blog_model extends Model {
parent::__construct($load);
$this->markdown = new MarkdownParser();
}
-
- private function load_blog(&$data) {
+ /**
+ * @param mixed $data
+ * @return void
+ */
+ private function load_blog(&$data): void {
$blog = array();
$dir = $GLOBALS['assetroot'] . '/blog';
if ($handle = opendir($dir)) {
@@ -32,44 +35,55 @@ class Blog_model extends Model {
$data['desc'] = lang('blog_short_desc');
return $data;
}
-
- private function load_post($name) {
+ /**
+ * @param mixed $name
+ * @return bool|<missing>
+ */
+ private function load_post($name): ?array {
$dir = $GLOBALS['assetroot'] . '/blog';
$path = $dir . '/' . $name;
if(!file_exists($path)) {
- return FALSE;
+ return NULL;
}
$md = $this->markdown->parse($path);
return $md;
}
-
- public function get_post($name) {
+ /**
+ * @param mixed $name
+ * @return bool|null|array
+ */
+ public function get_post($name): ?array {
$data = parent::get_data();
$post = $this->load_post($name);
if (!$post) {
- return FALSE;
+ return NULL;
}
$data['title'] = $post['meta']['name'];
$data['desc'] = $post['meta']['desc'];
$data['post'] = $post;
return $data;
}
-
- private function load_writeup($name) {
+ /**
+ * @param mixed $name
+ */
+ private function load_writeup($name): ?string {
$dir = $GLOBALS['assetroot'] . '/writeup';
$path = $dir . '/' . $name;
if(!file_exists($path)) {
- return FALSE;
+ return NULL;
}
$md = $this->markdown->parse($path);
return $md;
}
-
- public function get_writeup($name) {
+ /**
+ * @param mixed $name
+ * @return bool|null|array
+ */
+ public function get_writeup($name): ?array {
$data = parent::get_data();
$writeup = $this->load_writeup($name);
if (!$writeup) {
- return FALSE;
+ return NULL;
}
$data['title'] = $writeup['meta']['name'];
$data['desc'] = $writeup['meta']['desc'];