-
Alex Barth authored
#711664 neclimdul: guarantee compatibility with CTools 1.4 by declaring that Feeds uses hooks to define plugins via hook_ctools_plugin_plugins().
Alex Barth authored#711664 neclimdul: guarantee compatibility with CTools 1.4 by declaring that Feeds uses hooks to define plugins via hook_ctools_plugin_plugins().
feeds.module 22.23 KiB
<?php
// $Id$
/**
* @file
* Feeds - basic API functions and hook implementations.
*/
// Vague request time. Use as common point of reference and to avoid costly
// calls to time().
define('FEEDS_REQUEST_TIME', time());
// Do not schedule a feed for refresh.
define('FEEDS_SCHEDULE_NEVER', -1);
// Never expire feed items.
// @todo Use FEEDS_NEVER instead of FEEDS_SCHEDULE_NEVER and FEEDS_EXPIRE_NEVER.
define('FEEDS_EXPIRE_NEVER', -1);
// An object is not persistent at all. Compare to EXPORT_IN_DATABASE OR
// EXPORT_IN_CODE.
define('FEEDS_EXPORT_NONE', 0x0);
// The Drupal Queue FeedsScheduler may use for scheduling importing or expiry.
define('FEEDS_SCHEDULER_QUEUE', 'feeds_queue');
/**
* @defgroup hooks Hook and callback implementations
* @{
*/
/**
* Implementation of hook_cron().
*/
function feeds_cron() {
feeds_scheduler()->cron();
}
/**
* Implementation of hook_cron_queue_info().
* Invoked by drupal_queue module if present.
*/
function feeds_cron_queue_info() {
$queues = array();
$queues[FEEDS_SCHEDULER_QUEUE] = array(
'worker callback' => 'feeds_scheduler_work',
'time' => variable_get('feeds_worker_time', 15),
);
return $queues;
}
/**
* Implementation of hook_perm().
*/
function feeds_perm() {
$perms = array('administer feeds');
foreach (feeds_importer_load_all() as $importer) {
$perms[] = 'import '. $importer->id .' feeds';
$perms[] = 'clear '. $importer->id .' feeds';
}
return $perms;
}
/**
* Implementation of hook_forms().
*/
function feeds_forms() {
// Declare form callbacks for all known classes derived from FeedsConfigurable.
$forms = array();
$forms['FeedsImporter_feeds_config_form']['callback'] = 'feeds_config_form';
$plugins = feeds_get_plugins();
foreach ($plugins as $plugin) {
// See feeds_get_config_form().