| 1 |
<?php |
<?php |
| 2 |
// $Id: syndication.module,v 1.58.2.7 2009/03/13 23:47:17 aaron1234nz Exp $ |
// $Id: syndication.module,v 1.58.2.8 2009/03/23 19:56:01 aaron1234nz Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 83 |
} |
} |
| 84 |
|
|
| 85 |
//taxonomy |
//taxonomy |
| 86 |
if (module_exists('taxonomy') && user_access('access content') && !empty($syndication_vocab)) { |
if (module_exists('taxonomy') && user_access('access content')) { |
| 87 |
$syndication_vocab = variable_get('syndication_vocabularies', array()); |
$syndication_vocab = variable_get('syndication_vocabularies', array()); |
| 88 |
foreach ($syndication_vocab as $key => $value) { |
foreach ($syndication_vocab as $key => $value) { |
| 89 |
// Throw away the vids that aren't enabled. |
// Throw away the vids that aren't enabled. |
| 210 |
* Helper function for syndication_taxonomy. |
* Helper function for syndication_taxonomy. |
| 211 |
*/ |
*/ |
| 212 |
function syndication_taxonomy_build_list_items(&$index, $tree) { |
function syndication_taxonomy_build_list_items(&$index, $tree) { |
| 213 |
|
$show_unused_terms = variable_get('syndication_vocabularies_empty', 0); |
| 214 |
$items = array(); |
$items = array(); |
| 215 |
$current_depth = $tree[$index]->depth; |
$current_depth = $tree[$index]->depth; |
| 216 |
while ($index < count($tree) && $tree[$index]->depth >= $current_depth) { |
while ($index < count($tree) && $tree[$index]->depth >= $current_depth) { |
| 217 |
$term = $tree[$index]; |
$term = $tree[$index]; |
| 218 |
$count = taxonomy_term_count_nodes($term->tid); |
$count = taxonomy_term_count_nodes($term->tid); |
| 219 |
if ($count) { |
if ($count || $show_unused_terms) { |
| 220 |
$child_tids = _taxonomy_term_children($term->tid); |
$child_tids = _taxonomy_term_children($term->tid); |
| 221 |
if (count($child_tids) > 0) { |
if (count($child_tids) > 0) { |
| 222 |
$tid_list = $term->tid .'+'. implode('+', $child_tids); |
$tid_list = $term->tid .'+'. implode('+', $child_tids); |
| 247 |
* Menu callback for syndication_taxonomy_builder. |
* Menu callback for syndication_taxonomy_builder. |
| 248 |
*/ |
*/ |
| 249 |
function syndication_taxonomy_builder() { |
function syndication_taxonomy_builder() { |
| 250 |
|
$show_unused_terms = variable_get('syndication_vocabularies_empty', 0); |
| 251 |
|
|
| 252 |
$form['intro'] = array( |
$form['intro'] = array( |
| 253 |
'#type' => 'markup', |
'#type' => 'markup', |
| 254 |
'#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.'), |
| 255 |
); |
); |
| 256 |
|
|
| 257 |
foreach (variable_get('syndication_vocabularies', array()) as $vid) { |
foreach (variable_get('syndication_vocabularies', array()) as $vid) { |
| 258 |
$vocab = taxonomy_vocabulary_load($vid); |
$vocab = taxonomy_vocabulary_load($vid); |
| 259 |
$tree = taxonomy_get_tree($vid); |
$tree = taxonomy_get_tree($vid); |
| 271 |
while ($index < count($tree) && $tree[$index]->depth >= $current_depth) { |
while ($index < count($tree) && $tree[$index]->depth >= $current_depth) { |
| 272 |
$term = $tree[$index]; |
$term = $tree[$index]; |
| 273 |
$count = taxonomy_term_count_nodes($term->tid); |
$count = taxonomy_term_count_nodes($term->tid); |
| 274 |
if ($count) { |
if ($count || $show_unused_terms) { |
| 275 |
$options[$term->tid] = $term->name; |
$options[$term->tid] = $term->name; |
| 276 |
$index++; |
$index++; |
| 277 |
} |
} |
| 437 |
} |
} |
| 438 |
|
|
| 439 |
//taxonomy |
//taxonomy |
| 440 |
foreach (taxonomy_get_vocabularies() as $vid => $vocab) { |
if (module_exists('taxonomy')) { |
| 441 |
$options[$vid] = $vocab->name; |
foreach (taxonomy_get_vocabularies() as $vid => $vocab) { |
| 442 |
|
$options[$vid] = $vocab->name; |
| 443 |
|
} |
| 444 |
|
$form['syndication_vocabularies'] = array( |
| 445 |
|
'#type' => 'checkboxes', |
| 446 |
|
'#title' => t('Vocabularies'), |
| 447 |
|
'#options' => $options, |
| 448 |
|
'#default_value' => variable_get('syndication_vocabularies', array()), |
| 449 |
|
'#description' => t('Select the vocabularies which should appear in the <em>Categories</em> block on the <a href="@syndication">syndication page</a>', array('@syndication' => url('syndication'))), |
| 450 |
|
); |
| 451 |
|
$form['syndication_vocabularies_empty'] = array( |
| 452 |
|
'#type' => 'radios', |
| 453 |
|
'#title' => t('Taxonomy terms with no nodes'), |
| 454 |
|
'#options' => array(0 => t('Do not show terms which are not used by any nodes'), 1 => t('Show terms which are not used by any nodes')), |
| 455 |
|
'#default_value' => variable_get('syndication_vocabularies_empty', 0), |
| 456 |
|
); |
| 457 |
} |
} |
| 458 |
$form['syndication_vocabularies'] = array( |
|
|
'#type' => 'checkboxes', |
|
|
'#title' => t('Vocabularies'), |
|
|
'#options' => $options, |
|
|
'#default_value' => variable_get('syndication_vocabularies', array()), |
|
|
'#description' => t('Select the vocabularies which should appear in the <em>Categories</em> block on the <a href="@syndication">syndication page</a>', array('@syndication' => url('syndication'))), |
|
|
); |
|
|
|
|
| 459 |
//views |
//views |
| 460 |
if (module_exists('views')) { |
if (module_exists('views')) { |
| 461 |
$options = array(); |
$options = array(); |
| 616 |
$output .= '<div class="syndication-clear"></div>'; |
$output .= '<div class="syndication-clear"></div>'; |
| 617 |
return $output; |
return $output; |
| 618 |
} |
} |
| 619 |
|
|
| 620 |
|
|