RSS Feed for the blog
@return void
190559
public function rss()
    {
        if (!appSetting('rss_enabled', 'blog-' . $this->oBlog->id)) {

            show404();
        }

        // --------------------------------------------------------------------------

        //  Get posts
        $data                    = array();
        $data['include_body']    = true;
        $data['include_gallery'] = appSetting('home_show_gallery', 'blog-' . $this->oBlog->id);
        $data['sort']            = array('bp.published', 'desc');

        //  Only published items which are not schduled for the future
        $data['where']   = array();
        $data['where'][] = array('column' => 'blog_id',      'value' => $this->oBlog->id);
        $data['where'][] = array('column' => 'is_published', 'value' => true);
        $data['where'][] = array('column' => 'published <=', 'value' => 'NOW()', 'escape' => false);

        $this->data['posts'] = $this->blog_post_model->getAll(null, null, $data);
        $this->data['isRss'] = true;

        //  Set Output
        $oOutput = Factory::service('Output');
        $oOutput->set_content_type('text/xml; charset=UTF-8');

        $this->loadView('rss', $this->data);
    }
974535
private function generateItems()
	{
		$out = '';
		foreach ($this->items as $item)
		{
			$thisItems = $item->getElements();

			//the argument is printed as rdf:about attribute of item in rss 1.0
			$out .= $this->startItem($thisItems['link']['content']);

			foreach ($thisItems as $feedItem )
			{
				$out .= $this->makeNode($feedItem['name'], $feedItem['content'], $feedItem['attributes']);
			}
			$out .= $this->endItem();
		}
		return $out;
	}
757521
public function run()
    {
        $request = $this->getRequest();
        $factory = $this->getFactory();
        $iterator = $this->getIterator();
        $latest = $iterator->getLatest();
        try {
            $blog = $factory->factory($request->getData());
        } catch (\InvalidArgumentException $exception) {
            $request = $this->getNewRequest(['q' => '404']);
            $blog = $factory->factory($request->getData());
        }

        $vars = [
            'content'     => $blog->getContent(),
            'title'       => $blog->getTitle(),
            'keywords'    => $blog->getKeywords(),
            'description' => $blog->getDescription(),
            'latest'      => $factory->massFactory($latest),
            'blog_title'  => $this->get('blog_title'),
            'time'        => $blog->getTime(),
        ];

        include __DIR__ . '/../web/layout.php';

        return $this;
    }
884904
public function generateFeed()
    {
        if ($this->version != Feed::ATOM && !array_key_exists('link', $this->channels))
            throw new InvalidOperationException('RSS1 & RSS2 feeds need a link element. Call the setLink method before this method.');

        return $this->makeHeader()
            . $this->makeChannels()
            . $this->makeItems()
            . $this->makeFooter();
    }
857041
public function rss()
    {
        /** @var RSSFeed $rss */
        $rss = RSSFeed::create(
            $list = $this->getRSSFeed(), $link = $this->Link('rss'), $title = _t('News.RSSFEED', 'News feed')
        );

        return $rss->outputToBrowser();
    }
886261
protected function loadCommonStandards() : FeedIo
    {
        $standards = $this->getCommonStandards();
        foreach ($standards as $name => $standard) {
            $this->addStandard($name, $standard);
        }

        return $this;
    }
256247
public function tag()
    {
        $tag = $this->getCurrentTag();

        if ($tag) {
            $this->blogPosts = $tag->BlogPosts();

            if ($this->isRSS()) {
                return $this->rssFeed($this->blogPosts, $tag->getLink());
            } else {
                return $this->render();
            }
        }

        $this->httpError(404, 'Not Found');

        return null;
    }
928260
public function parse()
    {
        foreach ($this->parsedMail->getAttachments() as $attachment) {
            // Only use the Abusehub formatted reports, skip all others
            if (preg_match(config("{$this->configBase}.parser.report_file"), $attachment->filename)) {
                // Create temporary working environment for the parser ($this->tempPath, $this->fs)
                $this->createWorkingDir();
                file_put_contents($this->tempPath . $attachment->filename, $attachment->getContent());

                $csvReader = new Reader\CsvReader(new SplFileObject($this->tempPath . $attachment->filename));
                $csvReader->setHeaderRowNumber(0);

                // Loop through all csv reports
                foreach ($csvReader as $report) {
                    if (!empty($report['report_type'])) {
                        $this->feedName = $report['report_type'];

                        // If feed is known and enabled, validate data and save report
                        if ($this->isKnownFeed() && $this->isEnabledFeed()) {
                            // Sanity check
                            if ($this->hasRequiredFields($report) === true) {
                                // incident has all requirements met, filter and add!
                                $report = $this->applyFilters($report);

                                $incident = new Incident();
                                $incident->source      = config("{$this->configBase}.parser.name");
                                $incident->source_id   = false;
                                $incident->ip          = $report['src_ip'];
                                $incident->domain      = false;
                                $incident->class       = config("{$this->configBase}.feeds.{$this->feedName}.class");
                                $incident->type        = config("{$this->configBase}.feeds.{$this->feedName}.type");
                                $incident->timestamp   = strtotime($report['event_date'] .' '. $report['event_time']);
                                $incident->information = json_encode($report);

                                $this->incidents[] = $incident;
                            }
                        }
                    } else {
                        // We cannot parse this report, since we haven't detected a report_type.
                        $this->warningCount++;
                    }
                } // end foreach: loop through csv lines
            } // end if: found report file to parse
        } // end foreach: loop through attachments

        return $this->success();
    }
151702
public function feedAction(Request $request, Blog $blog)
    {
        $articles = $blog->getPublishedArticles();
        if ($categoryId = $request->query->get('category')) {
            $entityManager = $this->getDoctrine()->getManager();
            /** @var Category $category */
            $category = $entityManager->getRepository('VictoireBlogBundle:BlogCategory')->find($categoryId);
            $categoryIds = [];

            function findIds(BlogCategory $category, &$categoryIds)
            {
                $categoryIds[] = $category->getId();

                foreach ($category->getChildren() as $childCategory) {
                    findIds($childCategory, $categoryIds);
                }
            }

            findIds($category, $categoryIds);

            $articles = $articles->filter(function ($article) use ($categoryIds) {
                /* @var Article $article */
                return $article->getCategory() && in_array($article->getCategory()->getId(), $categoryIds, true);
            });
        }

        return $this->render('VictoireBlogBundle:Blog:feed.rss.twig', [
            'blog'     => $blog,
            'articles' => $articles,
        ]);
    }
963598
public function rssAction()
    {
        $rssDocumentNode = $this->request->getInternalArgument('__documentNode');
        if ($rssDocumentNode === null) {
            return 'Error: The Blog Post Plugin cannot determine the current document node. Please make sure to include this plugin only by inserting it into a page / document.';
        }

        /** @var NodeInterface $postsNode */
        $postsNode = $this->request->getInternalArgument('__postsNode');

        $uriBuilder = new UriBuilder();
        $uriBuilder->setRequest($this->request->getMainRequest());
        $uriBuilder->setCreateAbsoluteUri(true);

        $feedTitle = $this->request->getInternalArgument('__feedTitle');
        $feedDescription = $this->request->getInternalArgument('__feedDescription');
        $includeContent = $this->request->getInternalArgument('__includeContent');

        if ($this->request->getInternalArgument('__feedUri')) {
            $feedUri = $this->request->getInternalArgument('__feedUri');
        } else {
            $uriBuilder->setFormat('xml');
            $feedUri = $uriBuilder->uriFor('show', ['node' => $rssDocumentNode], 'Frontend\Node', 'Neos.Neos');
        }

        $channel = new Channel();
        $channel->setTitle($feedTitle);
        $channel->setDescription($feedDescription);
        $channel->setFeedUri($feedUri);
        $channel->setWebsiteUri($this->request->getHttpRequest()->getBaseUri());
        $channel->setLanguage((string)$this->i18nService->getConfiguration()->getCurrentLocale());

        /* @var $postNode NodeInterface */
        foreach ($postsNode->getChildNodes('RobertLemke.Plugin.Blog:Post') as $postNode) {

            $uriBuilder->setFormat('html');
            $postUri = $uriBuilder->uriFor('show', ['node' => $postNode], 'Frontend\Node', 'Neos.Neos');

            $item = new Item();
            $item->setTitle($postNode->getProperty('title'));
            $item->setGuid($postNode->getIdentifier());
            $item->setPublicationDate($postNode->getProperty('datePublished'));
            $item->setItemLink((string)$postUri);
            $item->setCommentsLink((string)$postUri . '#comments');

            $author = $postNode->getProperty('author');
            if ($author instanceof NodeInterface) {
                $author = $author->getLabel();
            }
            $item->setCreator($author);

            if ($postNode->getProperty('categories')) {
                $categories = [];
                /** @var NodeInterface $categoryNode */
                foreach ($postNode->getProperty('categories') as $categoryNode) {
                    $categories[] = [
                        'category' => $categoryNode->getProperty('title'),
                        'domain' => $categoryNode->getProperty('domain')
                    ];
                }
                $item->setCategories($categories);
            }

            $description = $this->contentService->renderTeaser($postNode);
            $item->setDescription($description);

            if ($includeContent) {
                $item->setContent($this->contentService->renderContent($postNode));
            }

            $channel->addItem($item);
        }

        $headers = $this->response->getHeaders();
        $headers->setCacheControlDirective('s-max-age', 3600);
        $headers->set('Content-Type', 'application/rss+xml');

        $feed = new Feed();
        $feed->addChannel($channel);

        return $feed->render();
    }
806261
public function feedAction($_format)
    {
        $format   = $_format == 'xml' ? 'rss' : $_format;
        $articles = $this->get('vince_cms.repository.article')->findAllPublishedIndexableOrdered();

        return $this->render(sprintf('VinceCmsBundle:Templates:feed.%s.twig', $format), array(
                'articles' => $articles,
                'id'       => sha1($this->get('router')->generate('cms_feed', array('_format' => $format), true)),
            )
        );
    }
624742
def set_rss_element(self):
        """"""
        self.set_author()
        self.set_categories()
        self.set_comments()
        self.set_creative_commons()
        self.set_description()
        self.set_enclosure()
        self.set_guid()
        self.set_link()
        self.set_published_date()
        self.set_title()
477463
function render($rss)
	{
		if(!class_exists('UniversalFeedCreator'))
			bors_throw("Use:<br/>\ncomposer require openpsa/universalfeedcreator=*");

//		$type = "ATOM1.0";
		$type = "RSS2.0";

		$feed = new UniversalFeedCreator();
		$feed->useCached($type, '/tmp/bors-rss-'.md5($rss->url()).'.xml', config('rss_static_lifetime'));
		$feed->encoding = 'UTF-8';
		$feed->title = $rss->rss_title();
		$feed->description = $rss->rss_description();
		$feed->link = $rss->main_url();
		$feed->syndicationURL = $rss->url();

//		$feed->descriptionTruncSize = 500;
		$feed->descriptionHtmlSyndicated = true;

		if($xmlns = $rss->get('xmlns_append'))
			$feed->xmlns_append = $xmlns;

		if($img_url = $rss->get('rss_image_src'))
		{
			$image = new FeedImage();
			$image->title = $rss->get('rss_image_title');
			$image->url = $img_url;
			$image->link = $rss->get('rss_image_link', $rss->main_url());
			$image->description = $rss->get('rss_image_description');
			$feed->image = $image; 
		}

		foreach(explode(' ', 'copyright docs language') as $n)
			if($x = $rss->get($n))
				$feed->$n = $x;

		foreach($rss->rss_items() as $o)
		{
		    $item = new FeedItem();
	    	$item->title = $rss->item_rss_title($o);
		    $item->link = $rss->item_rss_url($o);
		    $item->guid = $rss->item_rss_guid($o);

//			$item->description = $rss->rss_body($o, $rss->rss_strip());
			if(($desc = $rss->item_rss_body($o, $rss)))
				$item->description = $desc;

			$item->descriptionHtmlSyndicated = true;
			$item->date = intval($o->create_time());//$rss->item_rss_gmtime($o);
			$item->source = $rss->rss_source_url();
			$owner = $o->get('owner');
			if($owner)
				$item->author = $owner->title();

			$item->category = $rss->item_rss_keywords_string($o);

			if($add = $rss->item_additional($o, $rss))
				$item->additionalElements = $add;

/*
			if($e = $rss->item_rss_enclosure($o))
			{
	 			$item->enclosure = new EnclosureItem();
				$item->enclosure->url = $e['url'];
				$item->enclosure->type = $e['type'];
				if($s = @$e['size'])
					$item->enclosure->length = $s;
			}
			if($image = $this->item_image($o, $rss))
			{
				print_dd($image);
				// <link rel="enclosure" type="image/jpeg" href="image_url_here" />
	 			$item->enclosure = new EnclosureItem();
	 			$thumb = $image->thumbnail('300x300');
				$item->enclosure->url = $thumb->url();
				$item->enclosure->length = $thumb->size();
				$item->enclosure->type = $image->mime_type();
			}
*/
			$feed->addItem($item); 
		}

		$result = $feed->createFeed($type);
		@header("Content-Type: ".$feed->contentType."; charset=".$feed->encoding);
		return $result;
	}
1069324
protected function addFeed()
	{
		if ($this->params->get('show_feed_link', 1) == 1)
		{
			$link    = '&format=feed&limitstart=';
			$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
			$this->document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
			$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
			$this->document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
		}
	}
1252951
public function index() {

        /**
         * set lastUpdatedPage
         */
        $query = TableRegistry::get('CmsContent')->find();
        $query->where(['content_type' => 'page']);
        $query->order(['modified' => 'DESC']);
        $this->set('last_page', $query);

        /**
         * set lastUpdatedNews
         */
        $query = TableRegistry::get('CmsContent')->find();
        $query->where(['content_type' => 'news']);
        $query->order(['modified' => 'DESC']);
        $this->set('last_news', $query);

        /**
         * set view
         */
        $this->viewBuilder()->template('dashboard');
    }
82780
public function feed()
    {
        if (isset( $_POST[$this->name] )
            && $this->name !== 'uri' && $this->name !== 'classUri'
        ) {
            $this->setValue( tao_helpers_Uri::decode( $_POST[$this->name] ) );
        }
    }
228912
private function createRSS()
    {
        $file = fopen($this->rssFile, "w+");

        $stmt = $this->db->prepare('SELECT * FROM ' . $this->table . ' ORDER BY CREATED DESC LIMIT ?');
        $stmt->execute([$this->newsCount]);
        $res = $stmt->fetchAll();

        $xmlVersion = '<?xml version="1.0" encoding="UTF-8" ?>';

        $startString = <<<EOD
{$xmlVersion}
<rss version="2.0">
<channel>
    <title>{$this->feedDescription['title']}</title>
    <link>{$this->feedDescription['link']}</link>
    <description>{$this->feedDescription['description']}</description>
EOD;
        fwrite($file, $startString);

        foreach ($res as $post) {
            $date = date("D, d M y H:i:s O", strtotime($post->CREATED));
            $string = <<<EOD

    <item>
        <title>{$post->TITLE}</title>
        <link>{$post->LINK}</link>
        <description>{$post->DESCRIPTION}</description>
        <pubDate>{$date}</pubDate>
    </item>
EOD;
            fwrite($file, $string);
        }

        fwrite($file, '
</channel>
</rss>');
    }