示例#1
0
 /**
  * setPubDate
  *
  * @author  Christopher M. Black <*****@*****.**>
  *
  * @param string|int $pubDate
  * @param boolean    $alsoSetHeaderPublishedDate
  *
  * @return Article
  */
 public function setPubDate($pubDate, $alsoSetHeaderPublishedDate = true)
 {
     if ($alsoSetHeaderPublishedDate) {
         $this->setPublishedDate($pubDate);
     } else {
         $this->_pubDate = Base::formatRSSDate($pubDate);
     }
     return $this;
 }
示例#2
0
 /**
  * setTags
  *
  * @author  Christopher M. Black <*****@*****.**>
  *
  * @param array|string $tags array of tags or comma separated strings
  * @param bool         $overwrite
  *
  * @return Head
  */
 public function setTags($tags, $overwrite = true)
 {
     $tags = Base::arrayOrSeparatedString($tags);
     if ($overwrite) {
         $this->_tags = $tags;
     } else {
         $this->_tags = array_unique(array_merge($this->_tags, $tags));
     }
     return $this;
 }
示例#3
0
 /**
  * setPublishedDate
  *
  * @author  Christopher M. Black <*****@*****.**>
  *
  * @param   string $publishedDate
  *
  * @return  Header
  */
 public function setPublishedDate($publishedDate)
 {
     $this->_publishedDate = Base::isTimestamp($publishedDate) ? $publishedDate : strtotime($publishedDate);
     if (is_null($this->_modifiedDate)) {
         $this->_modifiedDate = $this->_publishedDate;
     }
     return $this;
 }
示例#4
0
 /**
  * channel
  *
  * @since   0.1.1
  * @version 0.1.1
  *
  * @author  Christopher M. Black <*****@*****.**>
  *
  * @param   array $parameters           valid keys:
  *                                      - title (required)
  *                                      - link (required)
  *                                      - description (required)
  *                                      - language
  *                                      - lastBuildDate (autoadded if not passed)
  *
  * @return  \FBIARss
  * @throws  \Exception
  */
 public function channel($parameters)
 {
     if (!array_key_exists('title', $parameters) || !array_key_exists('description', $parameters) || !array_key_exists('link', $parameters)) {
         throw new \Exception('Required channel parameter missing : title, description or link');
     }
     if (array_key_exists('lastBuildDate', $parameters)) {
         if (!empty($parameters['lastBuildDate'])) {
             $parameters['lastBuildDate'] = BaseElement::formatRSSDate($parameters['lastBuildDate']);
         } else {
             $parameters['lastBuildDate'] = BaseElement::formatRSSDate();
         }
     } else {
         $parameters['lastBuildDate'] = BaseElement::formatRSSDate();
     }
     $this->channel = $parameters;
     return $this;
 }