107 lines
No EOL
1.7 KiB
PHP
107 lines
No EOL
1.7 KiB
PHP
<?php
|
|
|
|
class BlogPost
|
|
{
|
|
protected $_id;
|
|
protected $_title;
|
|
protected $_content;
|
|
protected $_author;
|
|
protected $_pubDate;
|
|
protected $_isPublished = false;
|
|
|
|
|
|
public function getId()
|
|
{
|
|
return $this->_id;
|
|
}
|
|
|
|
public function setId($id)
|
|
{
|
|
if (is_numeric($id))
|
|
$this->_id = $id;
|
|
}
|
|
|
|
public function getTitle()
|
|
{
|
|
return $this->_title;
|
|
}
|
|
|
|
public function setTitle($title)
|
|
{
|
|
if (is_string($title) && null == $title[30]) {
|
|
|
|
$this->_title = $title;
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
|
|
public function getContent()
|
|
{
|
|
return $this->_content;
|
|
}
|
|
|
|
public function setContent($content)
|
|
{
|
|
if (is_string($content)) {
|
|
|
|
$this->_content = $content;
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
|
|
public function getAuthor()
|
|
{
|
|
return $this->_author;
|
|
}
|
|
|
|
public function setAuthor($author)
|
|
{
|
|
if ($author instanceof User) {
|
|
|
|
$this->_author = $author;
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
|
|
public function getPubDate()
|
|
{
|
|
return $this->_pubDate;
|
|
}
|
|
|
|
public function setPubDate($date)
|
|
{
|
|
|
|
if (Fiktiv_Date::isDate($date)) {
|
|
|
|
$this->_pubDate = new Fiktiv_Date($date);
|
|
|
|
} else if ($date instanceof Zend_Date) {
|
|
|
|
$this->_pubDate = $date;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public function isPublished($flag = null)
|
|
{
|
|
if (null === $flag) {
|
|
return $this->_isPublished;
|
|
}
|
|
|
|
$this->_isPublished = (boolean)$flag;
|
|
}
|
|
} |