function yandex_turbo_page_rss in Yandex.Turbo 7.2
Same name and namespace in other branches
- 7.4 yandex_turbo.pages.inc \yandex_turbo_page_rss()
- 7 yandex_turbo.pages.inc \yandex_turbo_page_rss()
- 7.3 yandex_turbo.pages.inc \yandex_turbo_page_rss()
Page callback: Generates an Yandex Turbo RSS
Return value
string An XML formatted string.
1 string reference to 'yandex_turbo_page_rss'
- yandex_turbo_menu in ./
yandex_turbo.module - Implements hook_menu().
File
- ./
yandex_turbo.pages.inc, line 9
Code
function yandex_turbo_page_rss() {
$feeds = array();
$settings = variable_get('yandex_turbo_node_types');
$node_types = !empty($settings) ? array_keys(array_filter($settings)) : array();
$orderBy = variable_get('yandex_turbo_order_by', 'created');
$order = variable_get('yandex_turbo_order', 'DESC');
$source = variable_get('yandex_turbo_body', 'value');
if ($node_types) {
$query = db_select('node', 'n')
->fields('n', array(
'nid',
'title',
'created',
))
->condition('status', NODE_PUBLISHED)
->condition('type', $node_types, 'IN');
$query
->leftJoin('field_data_body', 'd', '(d.entity_id = n.nid AND d.entity_type = :node)', array(
':node' => 'node',
));
$query
->addField('d', 'body_' . $source, 'body');
$query
->leftjoin('url_alias', 'ua', 'ua.source = CONCAT(:str, n.nid)', array(
':str' => 'node/',
));
$query
->fields('ua', array(
'alias',
));
if ('Yes' == variable_get('yandex_turbo_sticky', 'No')) {
$query
->orderBy('n.sticky', 'DESC');
}
if ('Yes' == variable_get('yandex_turbo_promoted', 'No')) {
$query
->orderBy('n.promote', 'DESC');
}
$query
->orderBy('n.' . $orderBy, $order)
->range(0, 1000);
$query
->where('d.body_' . $source . ' != :empty', array(
':empty' => '',
));
$feeds = $query
->execute()
->fetchAllAssoc('nid', PDO::FETCH_ASSOC);
}
return theme('yandex_turbo_page_rss', array(
'feeds' => $feeds,
));
}