Short description of method feed

@access public
@author Jerome Bogaerts, <jerome@taotesting.com>
@return mixed
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]);
            }
        }
    }
608584
public function getMenu()
    {
        $this->links->each(
            function ($link) {
                if (!$link->children->isEmpty()) {
                    $link->children = $link->children->sortBy('weight')->values();
                }
            }
        );
        return $this->links->sortBy('weight')->values();
    }
256438
public function disableFeeds()
    {
        if ($this->isActive() && !$this->allowFeeds()) {
            return collect([
                'do_feed',
                'do_feed_rdf',
                'do_feed_rss',
                'do_feed_rss2',
                'do_feed_atom'
            ])->map(function ($feed) {
                return add_action($feed, function () {
                    wp_die(sprintf(__('Feeds are not available for this site. Please visit the <a href="%s">website</a>.', 'app'), get_bloginfo('url')));
                }, 1);
            });
        }
    }
713073
public function run()
    {
        $this->renderChannel();
        if ($this->dataProvider->getCount() > 0) {
            $this->renderItems();
        }
        return $this->feed;
    }
1218702
public function getFeedRuleSet() : RuleSet
    {
        if (is_null($this->feedRuleSet)) {
            $this->feedRuleSet = $this->buildFeedRuleSet();
        }

        return $this->feedRuleSet;
    }
96615
function getDescription() {
		$descriptionField = new FeedHtmlField($this->description);
		$descriptionField->syndicateHtml = $this->descriptionHtmlSyndicated;
		$descriptionField->truncSize = $this->descriptionTruncSize;
		return $descriptionField->output();
	}
919474
public function feed_or_html()
	{
		$len = strlen($this->file->body);
		$pos = strspn($this->file->body, "\x09\x0A\x0D\x20\xEF\xBB\xBF");

		while ($pos < $len)
		{
			switch ($this->file->body[$pos])
			{
				case "\x09":
				case "\x0A":
				case "\x0D":
				case "\x20":
					$pos += strspn($this->file->body, "\x09\x0A\x0D\x20", $pos);
					continue 2;

				case '<':
					$pos++;
					break;

				default:
					return 'text/html';
			}

			if (substr($this->file->body, $pos, 3) === '!--')
			{
				$pos += 3;
				if ($pos < $len && ($pos = strpos($this->file->body, '-->', $pos)) !== false)
				{
					$pos += 3;
				}
				else
				{
					return 'text/html';
				}
			}
			elseif (substr($this->file->body, $pos, 1) === '!')
			{
				if ($pos < $len && ($pos = strpos($this->file->body, '>', $pos)) !== false)
				{
					$pos++;
				}
				else
				{
					return 'text/html';
				}
			}
			elseif (substr($this->file->body, $pos, 1) === '?')
			{
				if ($pos < $len && ($pos = strpos($this->file->body, '?>', $pos)) !== false)
				{
					$pos += 2;
				}
				else
				{
					return 'text/html';
				}
			}
			elseif (substr($this->file->body, $pos, 3) === 'rss'
				|| substr($this->file->body, $pos, 7) === 'rdf:RDF')
			{
				return 'application/rss+xml';
			}
			elseif (substr($this->file->body, $pos, 4) === 'feed')
			{
				return 'application/atom+xml';
			}
			else
			{
				return 'text/html';
			}
		}

		return 'text/html';
	}
669769
private function generateFeed($method)
    {
        $session = $this->session->get('news_feed_updater');

        if (!\is_array($session) || empty($session)) {
            return;
        }

        $feedGenerator = new FeedGenerator();

        foreach ($session as $id) {
            $feedGenerator->$method($id);
        }

        (new Automator())->generateSitemap();

        $this->session->set('news_feed_updater', null);
    }
310404
public static function import($uri)
    {
        $client = self::getHttpClient();
        $client->setUri($uri);
        $response = $client->request('GET');
        if ($response->getStatus() !== 200) {
            /**
             * @see Zend_Feed_Exception
             */
            require_once 'Zend/Feed/Exception.php';
            throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus());
        }
        $feed = $response->getBody();
        return self::importString($feed);
    }
73586
public function processFeed($url, $data)
    {
        $logger = $this->getLogger();
        $logger->info('Processing feed', array('url' => $url));
        $logger->debug('Received feed data', array('data' => $data));

        try {
            $new = iterator_to_array(FeedReader::importString($data));
            $old = isset($this->cache[$url]) ? $this->cache[$url] : array();
            $diff = $this->getNewFeedItems($new, $old);
            if ($old) {
                $this->syndicateFeedItems($diff);
            }
            $this->cache[$url] = $new;
        } catch (\Exception $e) {
            $logger->warning(
                'Failed to process feed',
                array(
                    'url' => $url,
                    'data' => $data,
                    'error' => $e,
                )
            );
        }

        $this->queuePoll($url);
    }
1013110
protected function isEnabledFeed()
    {
        if (config("{$this->configBase}.feeds.{$this->feedName}.enabled") !== true) {
            Log::warning(
                get_class($this) . ': ' .
                "The feed '{$this->feedName}' is disabled in the configuration of parser " .
                config("{$this->configBase}.parser.name") .
                ' therefore skipping processing of this e-mail'
            );
            return false;
        }
        return true;
    }
686339
protected function uriToFeedComponent(): Uri
    {
        $uri = new Uri(static::BASE_URL.$this->account->getPid().'/'.$this->feedConfig->getPid());

        if ($this->feedTypeSubFeed) {
            $uri = $uri->withPath($uri->getPath().'/'.$this->feedTypeSubFeed->getFeedType());
        }

        if ($this->isReturnsFeed()) {
            $uri = $uri->withPath($uri->getPath().'/feed');
        }

        return $uri;
    }
1157492
private void doFeed() {
    if (fed && !output.sendQueueFull()) {
      fed = false;
      vertx.runOnContext(feedRunner);
    } else {
      feedTimer = vertx.setTimer(feedDelay, recursiveRunner);
    }
  }
1201864
public function parse()
    {
        try {
            $xml       = simplexml_load_string($this->parsedMail->getMessageBody());
        } catch(\Exception $e) {
            $this->warningCount++;

            return $this->failed('XML expected, but got something else. Make sure google is set to send XML based reports!');
        }


        $timestamp = strtotime($xml->attributes()->date);

        foreach ($xml->list as $reports) {
            $this->feedName = (string)$reports->attributes()->type;

            // If feed is known and enabled, validate data and save report
            if ($this->isKnownFeed() && $this->isEnabledFeed()) {
                foreach ($reports->url_info as $url_info) {
                    $url = (string)$url_info->attributes()->url;
                    $ip = (string)$url_info->attributes()->ip;

                    $urlData = getUrlData($url);

                    if (filter_var($ip, FILTER_VALIDATE_IP) === false) {
                        // No IP supplied by Google
                        if (!empty($urlData['host']) &&
                            !filter_var($urlData['host'], FILTER_VALIDATE_IP) === false
                        ) {
                            // Hostname is an IP address
                            $ip = $urlData['host'];
                        } else {
                            // We have no IP address, try to get the IP address by resolving the domain
                            $ip = @gethostbyname($urlData['host']);

                            // If it fails, set to localhost
                            $ip = ($ip == $urlData['host']) ? '127.0.0.1' : $ip;
                        }
                    }

                    $report = [
                        'domain'    => getDomain($url),
                        'uri'       => getUri($url),
                        'category'  => config("{$this->configBase}.feeds.{$this->feedName}.category"),
                    ];

                    // 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          = $ip;
                        $incident->domain      = $report['domain'];
                        $incident->class       = config("{$this->configBase}.feeds.{$this->feedName}.class");
                        $incident->type        = config("{$this->configBase}.feeds.{$this->feedName}.type");
                        $incident->timestamp   = $timestamp;
                        $incident->information = json_encode(array_merge($urlData, $report));

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

        return $this->success();
    }
287828
function rssXmlContent()
    {
        try
        {
            switch ( $this->attribute( 'rss_version' ) )
            {
                case '1.0':
                {
                    return $this->generateFeed( 'rss1' );
                } break;

                case '2.0':
                {
                    return $this->generateFeed( 'rss2' );
                } break;

                case 'ATOM':
                {
                    return $this->generateFeed( 'atom' );
                } break;

                default:
                {
                    return null;
                } break;
            }
        }
        catch ( ezcFeedException $e )
        {
            return '<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang=""><title>The RSS feed you were trying to access contains some errors and cannot be generated: ' . $e->getMessage() . ' Please contact the webmaster.</title></feed>';
        }

        return null;
    }
1003297
public function index()
    {
        return Admin::content(function (Content $content) {
            $content->header(trans('admin.menu'));
            $content->description(trans('admin.list'));

            $content->row(function (Row $row) {
                $row->column(6, $this->treeView()->render());

                $row->column(6, function (Column $column) {
                    $form = new \Encore\Admin\Widgets\Form();
                    $form->action(admin_base_path('auth/menu'));

                    $form->select('parent_id', trans('admin.parent_id'))->options(Menu::selectOptions());
                    $form->text('title', trans('admin.title'))->rules('required');
                    $form->icon('icon', trans('admin.icon'))->default('fa-bars')->rules('required')->help($this->iconHelp());
                    $form->text('uri', trans('admin.uri'));
                    $form->multipleSelect('roles', trans('admin.roles'))->options(Role::all()->pluck('name', 'id'));
                    $form->radio('blank', '加载方式')->options(['0' => 'pjax', '1'=>'no-pjax' ])->default('0');
                    $form->hidden('_token')->default(csrf_token());

                    $column->append((new Box(trans('admin.new'), $form))->style('success'));
                });
            });
        });
    }
1162678
public function getMenuInfo()
    {
        $result = $this->httpGet(self::WECHAT_MENU_INFO_GET_PREFIX, [
            'access_token' => $this->getAccessToken()
        ]);
        return !array_key_exists('errcode', $result) ? $result : false;
    }