public static function FeedImport::loadFeeds in Feed Import 7.2
Same name and namespace in other branches
- 7 feed_import.inc.php \FeedImport::loadFeeds()
Feed import load feeds settings
Parameters
bool $enabled: Load only enabled feeds
mixed $id: Load feed by id or machine name
Return value
array Feeds info
13 calls to FeedImport::loadFeeds()
- feed_import_add_new_feed_form_validate in ./
feed_import.module - Add new feed form validate
- feed_import_cron in ./
feed_import.module - Implements hook_cron().
- feed_import_delete_feed_form in ./
feed_import.module - Feed delete form
- feed_import_edit_feed_form in ./
feed_import.module - Edit feed form
- feed_import_edit_feed_form_submit in ./
feed_import.module - Edit feed form submit
File
- ./
feed_import.inc.php, line 30 - Feed import class for parsing and processing content.
Class
- FeedImport
- @file Feed import class for parsing and processing content.
Code
public static function loadFeeds($enabled = FALSE, $id = NULL) {
static $feeds = NULL;
static $enabled_feeds = NULL;
if ($id == NULL) {
if ($feeds != NULL) {
return $enabled ? $enabled_feeds : $feeds;
}
$feeds = db_select('feed_import_settings', 'f')
->fields('f', array(
'name',
'machine_name',
'url',
'time',
'entity_info',
'xpath',
'id',
'enabled',
))
->orderBy('enabled', 'DESC')
->execute()
->fetchAllAssoc('machine_name');
foreach ($feeds as $name => &$feed) {
$feed = (array) $feed;
$feed['entity_info'] = unserialize($feed['entity_info']);
$feed['xpath'] = unserialize($feed['xpath']);
if ($feed['enabled']) {
$enabled_feeds[$name] =& $feed;
}
}
return $enabled ? $enabled_feeds : $feeds;
}
else {
$feed = db_select('feed_import_settings', 'f')
->fields('f', array(
'name',
'machine_name',
'url',
'time',
'entity_info',
'xpath',
'id',
'enabled',
))
->condition((int) $id ? 'id' : 'machine_name', $id, '=')
->range(0, 1)
->execute()
->fetchAll();
if ($feed) {
$feed = (array) reset($feed);
$feed['entity_info'] = unserialize($feed['entity_info']);
$feed['xpath'] = unserialize($feed['xpath']);
return $feed;
}
else {
return NULL;
}
}
}