You are here

function _feedapi_insert in FeedAPI 5

Same name and namespace in other branches
  1. 6 feedapi.module \_feedapi_insert()

Insert feedapi data to the DB when it's a new for for FeedAPI

2 calls to _feedapi_insert()
feedapi_nodeapi in ./feedapi.module
Implementation of hook_nodeapi().
_feedapi_update in ./feedapi.module
Update feed data of an existing feed

File

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

Code

function _feedapi_insert(&$node, $teaser, $page) {
  if (isset($node->feed->url) && isset($node->feed->feed_type)) {
    db_query("INSERT INTO {feedapi} (\n            nid, url, link, feed_type, processors,\n            parsers, checked, settings) VALUES\n            (%d, '%s', '%s', '%s', '%s', '%s', %d, '%s')", $node->nid, $node->feed->url, $node->feed->options->link, $node->feed->feed_type, serialize($node->feed->processors), serialize($node->feed->parsers), 0, serialize(array()));

    // Store add on module's settings if user has permission to do so.
    if (user_access('advanced feedapi options')) {
      _feedapi_store_settings(array(
        'nid' => $node->nid,
      ), $node->feedapi);
    }

    // Refresh feed if the user would like to do that
    if ($node->feedapi['refresh_on_create'] == TRUE) {
      $node->feed->nid = $node->nid;
      $node->feed->settings = feedapi_get_settings(NULL, $node->nid);
      feedapi_invoke('refresh', $node->feed);
    }
  }
}