Short description of method feed

@access public
@author Joel Bout, <joel.bout@tudor.lu>
@return mixed
516247
public function feed()
    {
        
    	$values = array();
    	$prefix = preg_quote($this->getPrefix(), '/');
    	foreach($_POST as $key => $value){
    		if(preg_match("/^$prefix/", $key)){
    			$values[str_replace($this->getPrefix(), '', $key)] = $value;
    		}
    	}
    	$this->setValues($values);
        
    }
134618
public function getUserFeed($limit = 0)
    {
        $params = array();
        if ($limit > 0) {
            $params['count'] = $limit;
        }

        return $this->_makeCall('users/self/feed', true, $params);
    }
1021302
public function getItemsCount()
    {
        $count = 0;
        foreach ($this->feeds_registry as $feed) {
            $count += $feed->getItemsCount();
        }
        return $count;
    }
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();
    }
105600
public function add_to_feed( array $vars ) : array {

		# If it's not a feed, we're not interested:
		if ( ! isset( $vars['feed'] ) ) {
			return $vars;
		}

		if ( ! isset( $vars['post_type'] ) ) {
			$vars['post_type'] = [
				'post',
				$this->post_type,
			];
		} elseif ( is_array( $vars['post_type'] ) && ( count( $vars['post_type'] ) > 1 ) ) {
			$vars['post_type'][] = $this->post_type;
		}

		return $vars;

	}
854284
public function parse()
    {
        if (empty($this->key) || strlen($this->key) < 10) {
            return $this->failed("Invalid SNDS key: {$this->key}");
        }

        if (!filter_var($this->url, FILTER_VALIDATE_URL) === true) {
            return $this->failed("Invalid URL configured: {$this->url}");
        }

        if (!$this->createWorkingDir()) {
            return $this->failed(
                "Unable to create working directory"
            );
        }
        $tempFile = "{$this->tempPath}/snds.csv";

        $client = new GuzzleHttp\Client();

        $res = $client->request(
            'GET',
            "{$this->url}?key={$this->key}",
            [
                'http_errors' => false,
                'save_to' => $tempFile
            ]
        );
        if ($res->getStatusCode() !== 200) {
            return $this->failed("URL collection from {$this->url} resulted in a {$res->getStatusCode()}");
        }

        $csvReports = new Reader\CsvReader(new SplFileObject($tempFile));
        $csvReports->setColumnHeaders(
            [
                'first_ip',
                'last_ip',
                'blocked',
                'feed',
            ]
        );


        foreach ($csvReports as $report) {
            $this->feedName = 'unknown';

            // If report type is an alias, get the real type
            foreach (config("{$this->configBase}.collector.aliasses") as $alias => $real) {
                if ($report['feed'] == $alias) {
                    $this->feedName = $real;
                }
            }

            if ($this->isKnownFeed() && $this->isEnabledFeed()) {

                $firstIP = inetPtoi($report['first_ip']);
                $lastIP = inetPtoi($report['last_ip']);

                if (!empty($firstIP) && !empty($lastIP) && $firstIP <= $lastIP) {
                    for ($x = $firstIP; $x <= $lastIP; $x++) {
                        $report['ip'] = inetItop($x);

                        if ($this->hasRequiredFields($report) === true) {
                            $report = $this->applyFilters($report);

                            $incident = new Incident();
                            $incident->source      = config("{$this->configBase}.collector.name");
                            $incident->source_id   = false;
                            $incident->ip          = $report['ip'];
                            $incident->domain      = false;
                            $incident->class       = config(
                                "{$this->configBase}.feeds.{$this->feedName}.class"
                            );
                            $incident->type        = config(
                                "{$this->configBase}.feeds.{$this->feedName}.type"
                            );
                            /*
                             * This prevents multiple incidents on the same day. So info
                             * blob has a scan time and this a report time
                             */
                            $incident->timestamp   = strtotime('0:00');
                            $incident->information = json_encode($report);

                            $this->incidents[] = $incident;
                        }
                    }
                }
            }
        }

        return $this->success();
    }
64702
public function parse()
    {
        if ($this->arfMail !== true) {
            $this->feedName = 'default';

            // As this is a generic FBL parser we need to see which was the source and add the name
            // to the report, so its origin is clearly shown.
            $source = $this->parsedMail->getHeader('from');
            foreach (config("{$this->configBase}.parser.aliases") as $from => $alias) {
                if (preg_match($from, $source)) {
                    // If there is an alias, prefer that name instead of the from address
                    $source = $alias;

                    // If there is an more specific feed configuration prefer that config over the default
                    if (!empty(config("{$this->configBase}.feeds.{$source}"))) {
                        $this->feedName = $source;
                    }
                }
            }

            // If feed is known and enabled, validate data and save report
            if ($this->isKnownFeed() && $this->isEnabledFeed()) {
                // To get some more consitency, remove "\r" from the report.
                $this->arfMail['report'] = str_replace("\r", "", $this->arfMail['report']);

                // Build up the report
                preg_match_all(
                    "/([\w\-]+): (.*)[ ]*\n/m",
                    $this->arfMail['report'],
                    $matches
                );

                $report = array_combine($matches[1], $matches[2]);

                if (empty($report['Received-Date'])) {
                    if (!empty($report['Arrival-Date'])) {
                        $report['Received-Date'] = $report['Arrival-Date'];
                        unset($report['Arrival-Date']);
                    }
                }

                // Now parse the headers from the spam messages and add it to the report
                if (!empty($this->arfMail['evidence'])) {
                    $spamMessage = new MimeParser();
                    $spamMessage->setText($this->arfMail['evidence']);
                    $report['headers'] = $spamMessage->getHeaders();
                } else {
                    $this->failed(
                        'The e-mail received at the parser is not RFC822 compliant, and therefor not a FBL message'
                    );
                }

                // Also add the spam message body to the report
                $report['body'] = $spamMessage->getMessageBody();

                // Sanity check
                if ($this->hasRequiredFields($report) === true) {

                    // incident has all requirements met, filter and add!
                    $report = $this->applyFilters($report);

                    $incident = new Incident();
                    $incident->source      = $source; // FeedName
                    $incident->source_id   = false;
                    $incident->ip          = $report['Source-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['Received-Date']);
                    $incident->information = json_encode($report);

                    $this->incidents[] = $incident;

                }
            }
        }

        return $this->success();
    }
82780
public function feed()
    {
        if (isset( $_POST[$this->name] )
            && $this->name !== 'uri' && $this->name !== 'classUri'
        ) {
            $this->setValue( tao_helpers_Uri::decode( $_POST[$this->name] ) );
        }
    }
1254912
protected function determineFeedType()
    {
        $feedType = strtolower($this->getRoutedParameter('feedType', static::TYPE_JSON));

        if ($feedType == static::TYPE_JSON) {
            $this->displayResolver = static::RESOLVER_JSON;
            if (empty($this->callback))
            {
                $this->contentType = static::CONTENT_TYPE_JSON;
            }
            else
            {
                $this->contentType = static::CONTENT_TYPE_JSONP;
            }
            return;
        }

        if ($feedType == static::TYPE_XML)
        {
            $this->displayResolver = static::RESOLVER_XML;
            $this->contentType = static::CONTENT_TYPE_XML;
            return;
        }

        $this->setNotReady("Please specify a valid feed type in the parameter feedType.");
    }
1156888
public function getAllFeeds(){
        $rest = $this->getService( self::API_DOWNLOAD_FEEDS);
        $rest->GET();

        return $rest->getResultAsArray( models\Download\Feed\DownloadFeed::class);
    }
735539
public function consume()
	{
		if (isset($this->data[$this->position]))
		{
			$this->consumed .= $this->data[$this->position];
			return $this->data[$this->position++];
		}
		else
		{
			return false;
		}
	}
582528
function it_should_return_feed($post1, $post2) {

        $postData1 = ['foo' => 'bar'];
        $postData2 = ['foo' => 'baz'];

        $this->client->get(Argument::any(), Argument::any())->willReturn([
            'data' => array(
                0 => $postData1,
                1 => $postData2
            ),
            'paging' => array(
                "previous" => "https://graph.facebook.com/page_id/posts?since=1433776347&limit=25&__paging_token=enc_AdBJBmZACKRKhWZCfUEwnRGw8jGfFZCGl2EiYxebr461J81BIsIRwu69lD0DmRZCix9Pj5ULR0SdfOu16UkN5ZAQB9xJl&__previous=1",
                "next" => "https://graph.facebook.com/page_id/posts?until=1433776347&limit=25&__paging_token=enc_AdBJBmZACKRKhWZCfUEwnRGw8jGfFZCGl2EiYxebr461J81BIsIRwu69lD0DmRZCix9Pj5ULR0SdfOu16UkN5ZAQB9xJl"
            )
        ]);

        $this->factory->create($postData1)->willReturn($post1);
        $this->factory->create($postData2)->willReturn($post2);

        $this->get(array(
            'page_id' => '12334533434'
        ))->shouldHaveType('Lns\SocialFeed\Model\ResultSet');
    }
1105701
protected function outputRss($feed)
    {
        // Send XML/no cache headers
        header('Content-Type: application/xml; charset=utf-8');
        header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');

        echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
        echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' . "\n";
        echo "\t" . '<channel>' . "\n";
        echo "\t\t" . '<atom:link href="' .
            Utils::escape(Url::current()) . '" rel="self" type="application/rss+xml" />' . "\n";
        echo "\t\t" . '<title><![CDATA[' . $this->escapeCdata($feed['title']) . ']]></title>' . "\n";
        echo "\t\t" . '<link>' . Utils::escape($feed['link']) . '</link>' . "\n";
        echo "\t\t" . '<description><![CDATA[' .
            $this->escapeCdata($feed['description']) . ']]></description>' . "\n";
        echo "\t\t" . '<lastBuildDate>' . gmdate('r', count($feed['items']) ? $feed['items'][0]['pubdate'] :
                time()) . '</lastBuildDate>' . "\n";

        if (ForumSettings::get('o_show_version') == '1') {
            echo "\t\t" . '<generator>RunBB ' . ForumSettings::get('o_cur_version') . '</generator>' . "\n";
        } else {
            echo "\t\t" . '<generator>RunBB</generator>' . "\n";
        }

        foreach ($feed['items'] as $item) {
            echo "\t\t" . '<item>' . "\n";
            echo "\t\t\t" . '<title><![CDATA[' . $this->escapeCdata($item['title']) . ']]></title>' . "\n";
            echo "\t\t\t" . '<link>' . Utils::escape($item['link']) . '</link>' . "\n";
            echo "\t\t\t" . '<description><![CDATA[' .
                $this->escapeCdata($item['description']) . ']]></description>' . "\n";
            echo "\t\t\t" . '<author><![CDATA[' . (isset($item['author']['email']) ?
                    $this->escapeCdata($item['author']['email']) : 'dummy@example.com') . ' (' .
                $this->escapeCdata($item['author']['name']) . ')]]></author>' . "\n";
            echo "\t\t\t" . '<pubDate>' . gmdate('r', $item['pubdate']) . '</pubDate>' . "\n";
            echo "\t\t\t" . '<guid>' . Utils::escape($item['link']) . '</guid>' . "\n";

            echo "\t\t" . '</item>' . "\n";
        }

        echo "\t" . '</channel>' . "\n";
        echo '</rss>' . "\n";
    }
102817
def feeds(self):
        
        if self._feed_manager is None:
            self._feed_manager = FeedManager(session=self._session)
        return self._feed_manager
713073
public function run()
    {
        $this->renderChannel();
        if ($this->dataProvider->getCount() > 0) {
            $this->renderItems();
        }
        return $this->feed;
    }
1253238
public function getRssFeed()
  {

    if ($this->has('rss-feed')) {
      return $this->get('rss-feed');
    }

    $rss = $this->buildRssFeed();

    $this->add('rss-feed', $rss, $this->getCacheTime());

    return $rss;

  }
554433
public function feed()
    {
        if (isset($_POST[$this->name])) {
            
            $structure = json_decode($_POST[$this->name], true);
            if ($structure !== false) {
                $description = new tao_helpers_form_data_UploadFileDescription(array_key_exists('name',
                    $structure) ? $structure['name'] : null,
                    array_key_exists('size', $structure) ? $structure['size'] : null,
                    array_key_exists('type', $structure) ? $structure['type'] : null,
                    array_key_exists('uploaded_file', $structure) ? $structure['uploaded_file'] : null,
                    array_key_exists('action', $structure) ? $structure['action'] : null);
                $this->setValue($description);
            } else {
                // else, no file was selected by the end user.
                // set the value as empty in order
                $this->setValue($_POST[$this->name]);
            }
        }
    }