bludit/bl-kernel/post.class.php

42 lines
844 B
PHP
Raw Permalink Normal View History

2015-05-05 03:00:01 +02:00
<?php defined('BLUDIT') or die('Bludit CMS.');
2015-03-08 18:02:59 +01:00
2016-01-12 03:18:20 +01:00
class Post extends Content {
2015-06-30 05:23:29 +02:00
function __construct($key)
2015-03-08 18:02:59 +01:00
{
2015-06-30 05:23:29 +02:00
// Database Key
$this->setField('key', $key);
2015-03-08 18:02:59 +01:00
2016-01-12 03:18:20 +01:00
// Set filterType
$this->setField('filterType', 'post');
2015-06-28 01:28:22 +02:00
2016-01-12 03:18:20 +01:00
parent::__construct(PATH_POSTS.$key.DS);
2015-03-08 18:02:59 +01:00
}
2015-05-05 03:00:01 +02:00
public function key()
2015-03-08 18:02:59 +01:00
{
2015-05-05 03:00:01 +02:00
return $this->getField('key');
2015-03-08 18:02:59 +01:00
}
2016-01-12 03:18:20 +01:00
public function slug()
2015-07-07 03:05:17 +02:00
{
2016-01-12 03:18:20 +01:00
return $this->getField('key');
2015-08-26 05:42:32 +02:00
}
// Returns TRUE if the post is scheduled, FALSE otherwise.
public function scheduled()
{
2015-09-02 02:42:21 +02:00
return ($this->getField('status')==='scheduled');
2015-07-07 03:05:17 +02:00
}
2016-05-29 19:21:11 +02:00
public function json()
{
$tmp['key'] = $this->key();
$tmp['title'] = $this->title();
$tmp['content'] = $this->content(); // Markdown parsed
$tmp['contentRaw'] = $this->contentRaw(); // No Markdown parsed
$tmp['description'] = $this->description();
return json_encode($tmp);
}
2016-01-12 03:18:20 +01:00
}