You are here

public static function Feed::isFeed in Feeds 8.3

Returns if the provided $content_type is a feed.

Parameters

string $data: The actual HTML or XML document from the HTTP request.

Return value

bool Returns true if this is a parsable feed, false if not.

1 call to Feed::isFeed()
Feed::getCommonSyndication in src/Utility/Feed.php
Discovers RSS or Atom feeds from a document.

File

src/Utility/Feed.php, line 46

Class

Feed
Helper functions for dealing with feeds.

Namespace

Drupal\feeds\Utility

Code

public static function isFeed($data) {
  Reader::setExtensionManager(\Drupal::service('feed.bridge.reader'));
  try {
    $feed_type = Reader::detectType($data);
  } catch (\Exception $e) {
    return FALSE;
  }
  return $feed_type != Reader::TYPE_ANY;
}