function feedapi_get_settings in FeedAPI 5
Same name and namespace in other branches
- 6 feedapi.module \feedapi_get_settings()
Retrieve settings per content type or per node.
@todo: Use node type settings for pulling on/off and weight of parsers/processors, use per node settings to override their configuration, this allows us a more predictable presets/settings behaviour. See d. o. #191692 Watch out: cache permutations of node_type or node_type+nid or nid. Watch out: changes within page load likely.
Parameters
$node_type: Content type name or NULL if per node
$nid: Node nid or NULL if per content type
$reset: If TRUE, the data is returned from the database.
Return value
Associative array with feedapi settings
11 calls to feedapi_get_settings()
- FeedAPI_Aggregator_Tests::testFeedAPI_Aggregator_Refresh_Feed in feedapi_aggregator/
tests/ feedapi_aggregator.module.test - Add a content-type, create a feed and refresh it. Check if everything seems ok Delete the feed Check if the rubbish is purged as well. @todo currently it doesn't test the categorizing facility of feedapi_aggregator
- feedapi_create_node in ./
feedapi.module - Create a feedapi node programatically.
- feedapi_enabled_type in ./
feedapi.module - Determines wether feedapi is enabled for given node type. If parser or processor is passed in, this function determines wether given parser or processor is enabled for given node type.
- feedapi_expire in ./
feedapi.module - Delete expired items and return informations about the feed refreshing
- feedapi_form_alter in ./
feedapi.module - Implementation of hook_form_alter().
File
- ./
feedapi.module, line 1298 - Handle the submodules (for feed and item processing) Provide a basic management of feeds
Code
function feedapi_get_settings($node_type, $nid = FALSE, $reset = FALSE) {
static $node_settings;
if (is_numeric($nid)) {
if (!isset($node_settings[$nid]) || $reset) {
if ($settings = db_fetch_object(db_query('SELECT settings FROM {feedapi} WHERE nid = %d', $nid))) {
$settings = unserialize($settings->settings);
}
$node_settings[$nid] = is_array($settings) && !empty($settings) ? $settings : FALSE;
}
if (!is_array($node_settings[$nid])) {
if (empty($node_type)) {
// In normal case, this shouldn't happen. This is an emergency branch
$node_type = db_result(db_query("SELECT type FROM {node} WHERE nid = %d", $nid));
}
}
else {
return $node_settings[$nid];
}
}
// Fallback: node_type.
if (isset($node_type) && is_string($node_type)) {
if ($settings = variable_get('feedapi_settings_' . $node_type, FALSE)) {
return $settings;
}
}
return FALSE;
}