| 1 |
<?php |
<?php |
| 2 |
// $Id: syndication.module,v 1.58.2.9 2009/04/03 23:41:14 aaron1234nz Exp $ |
// $Id: syndication.module,v 1.58.2.10 2009/04/09 06:10:07 aaron1234nz Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 13 |
* Implementation of hook_menu(). |
* Implementation of hook_menu(). |
| 14 |
*/ |
*/ |
| 15 |
function syndication_menu() { |
function syndication_menu() { |
| 16 |
$items['syndication'] = array( |
$items['syndication'] = array( |
| 17 |
'title' => 'RSS feeds', |
'title' => 'RSS feeds', |
| 18 |
'access arguments' => array('access content'), |
'access arguments' => array('access content'), |
| 19 |
'page callback' => 'syndication_page', |
'page callback' => 'syndication_page', |
| 20 |
'weight' => 6 |
'weight' => 6 |
| 21 |
); |
); |
| 22 |
$items['admin/content/syndication'] = array( |
$items['admin/content/syndication'] = array( |
| 23 |
'title' => 'RSS feed syndication', |
'title' => 'RSS feed syndication', |
| 24 |
'access arguments' => array('access administration pages'), |
'access arguments' => array('access administration pages'), |
| 25 |
'page callback' => 'drupal_get_form', |
'page callback' => 'drupal_get_form', |
| 26 |
'page arguments' => array('syndication_admin_settings'), |
'page arguments' => array('syndication_admin_settings'), |
| 27 |
); |
); |
| 28 |
$items['syndication/builder'] = array( |
$items['syndication/builder'] = array( |
| 29 |
'title' => 'RSS feed builder', |
'title' => 'RSS feed builder', |
| 30 |
'access arguments' => array('access content'), |
'access arguments' => array('access content'), |
| 31 |
'page callback' => 'drupal_get_form', |
'page callback' => 'drupal_get_form', |
| 32 |
'page arguments' => array('syndication_taxonomy_builder'), |
'page arguments' => array('syndication_taxonomy_builder'), |
| 33 |
); |
); |
| 34 |
|
$items['syndication/all'] = array( |
| 35 |
|
'title' => 'All feeds', |
| 36 |
|
'access arguments' => array('access content'), |
| 37 |
|
'page callback' => 'syndication_taxonomy_all_feeds', |
| 38 |
|
'type' => MENU_CALLBACK |
| 39 |
|
); |
| 40 |
return $items; |
return $items; |
| 41 |
} |
} |
| 42 |
|
|
| 259 |
'#type' => 'markup', |
'#type' => 'markup', |
| 260 |
'#value' => t('You can subscribe to more than one category in a single RSS feed. Please select the RSS feeds you would like to subscribe to then press the "Generate feed" button.'), |
'#value' => t('You can subscribe to more than one category in a single RSS feed. Please select the RSS feeds you would like to subscribe to then press the "Generate feed" button.'), |
| 261 |
); |
); |
| 262 |
|
$form['all_feeds'] = array( |
| 263 |
|
'#type' => 'markup', |
| 264 |
|
'#value' => ' '. l(t('You may also subscribe all terms on this site.'), 'syndication/all'), |
| 265 |
|
); |
| 266 |
|
|
| 267 |
foreach (variable_get('syndication_vocabularies', array()) as $vid) { |
foreach (variable_get('syndication_vocabularies', array()) as $vid) { |
| 268 |
$vocab = taxonomy_vocabulary_load($vid); |
$vocab = taxonomy_vocabulary_load($vid); |
| 298 |
); |
); |
| 299 |
} |
} |
| 300 |
} |
} |
| 301 |
|
|
| 302 |
$form['submit'] = array( |
$form['submit'] = array( |
| 303 |
'#type' => 'submit', |
'#type' => 'submit', |
| 304 |
'#value' => t('Generate feed'), |
'#value' => t('Generate feed'), |
| 325 |
} |
} |
| 326 |
|
|
| 327 |
/** |
/** |
| 328 |
|
* Build a fresh feed containing all enabled terms |
| 329 |
|
*/ |
| 330 |
|
function syndication_taxonomy_all_feeds() { |
| 331 |
|
foreach (variable_get('syndication_vocabularies', array()) as $vid) { |
| 332 |
|
$tree = taxonomy_get_tree($vid); |
| 333 |
|
$index = 0; |
| 334 |
|
$options = array(); |
| 335 |
|
$current_depth = $tree[$index]->depth; |
| 336 |
|
while ($index < count($tree) && $tree[$index]->depth >= $current_depth) { |
| 337 |
|
$term = $tree[$index]; |
| 338 |
|
$feed[] = $term->tid; |
| 339 |
|
$index++; |
| 340 |
|
} |
| 341 |
|
} |
| 342 |
|
drupal_goto("taxonomy/term/". implode("+", $feed) ."/0/feed"); |
| 343 |
|
} |
| 344 |
|
|
| 345 |
|
/** |
| 346 |
* Validates user blog feed search form. |
* Validates user blog feed search form. |
| 347 |
*/ |
*/ |
| 348 |
function syndication_users_validate($form, &$form_state) { |
function syndication_users_validate($form, &$form_state) { |