Frontend\Core\Engine\RssItem::setAuthor PHP Method

setAuthor() public method

Set the author.
public setAuthor ( string $author )
$author string The author to use.
    public function setAuthor($author)
    {
        // remove special chars
        $author = (string) \SpoonFilter::htmlspecialcharsDecode($author);
        // add fake-emailaddress
        if (!\SpoonFilter::isEmail($author)) {
            $author = CommonUri::getUrl($author) . '@example.com (' . $author . ')';
        }
        // add fake email address
        if (!\SpoonFilter::isEmail($author)) {
            $author = \SpoonFilter::urlise($author) . '@example.com (' . $author . ')';
        }
        // set author
        parent::setAuthor($author);
    }

Usage Example

示例#1
0
 /**
  * Parse the data into the template
  */
 private function parse()
 {
     // get vars
     $title = \SpoonFilter::ucfirst(FL::msg('BlogAllComments'));
     $link = SITE_URL . FrontendNavigation::getURLForBlock('Blog');
     $detailLink = SITE_URL . FrontendNavigation::getURLForBlock('Blog', 'Detail');
     $description = null;
     // create new rss instance
     $rss = new FrontendRSS($title, $link, $description);
     // loop articles
     foreach ($this->items as $item) {
         // init vars
         $title = $item['author'] . ' ' . FL::lbl('On') . ' ' . $item['post_title'];
         $link = $detailLink . '/' . $item['post_url'] . '/#comment-' . $item['id'];
         $description = $item['text'];
         // create new instance
         $rssItem = new FrontendRSSItem($title, $link, $description);
         // set item properties
         $rssItem->setPublicationDate($item['created_on']);
         $rssItem->setAuthor($item['author']);
         // add item
         $rss->addItem($rssItem);
     }
     $rss->parse();
 }
All Usage Examples Of Frontend\Core\Engine\RssItem::setAuthor