You are here

function feedapi_invoke in FeedAPI 6

Same name and namespace in other branches
  1. 5 feedapi.module \feedapi_invoke()

Invoke feedapi API callback functions.

Parameters

$op: "load" Load the feed items basic data into the $feed->items[] "refresh" Re-download the feed and process newly arrived item "purge" Delete all the feed items

$feed: A feed object. If only the ID is known, you should pass something like this: $feed->nid = X

$param: Depends on the $op value.

5 calls to feedapi_invoke()
feedapi_cron in ./feedapi.module
Implementation of hook_cron().
feedapi_drush_refresh in ./feedapi.drush.inc
Refreshes a feed. When the feed URL is not enough to exactly define a feed, use the nid
feedapi_purge_confirm_submit in ./feedapi.module
Submitted items purging form. Drop all the items.
feedapi_refresh in ./feedapi.module
Refresh a feed node (= run enabled processors on it).
_feedapi_insert in ./feedapi.module
Insert feedapi data to the DB when it's a new for for FeedAPI
1 string reference to 'feedapi_invoke'
feedapi_menu in ./feedapi.module
Implementation of hook_menu().

File

./feedapi.module, line 270
Handle the submodules (for feed and item processing) Provide a basic management of feeds

Code

function feedapi_invoke($op, &$feed, $param = NULL) {
  if (!is_object($feed)) {
    return FALSE;
  }

  // The node is passed.
  if (isset($feed->feed) && is_object($feed->feed)) {
    $feed = $feed->feed;
  }
  if (!isset($feed->processors)) {
    $node = node_load($feed->nid);
    if (!isset($node->feed)) {
      return FALSE;
    }
    $feed = $node->feed;
  }
  _feedapi_sanitize_processors($feed);
  switch ($op) {
    case 'refresh':
      return _feedapi_invoke_refresh($feed, $param);
    case 'purge':
      return _feedapi_invoke_purge($feed, $param);
    default:

      // Other operations
      return _feedapi_invoke($op, $feed, $param);
  }
}