/[drupal]/contributions/modules/syndication/syndication.module
ViewVC logotype

Diff of /contributions/modules/syndication/syndication.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.58.2.8, Mon Mar 23 19:56:01 2009 UTC revision 1.58.2.9, Fri Apr 3 23:41:14 2009 UTC
# Line 1  Line 1 
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
# Line 83  function syndication_page() { Line 83  function syndication_page() {
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.
# Line 210  function syndication_vocabularies() { Line 210  function syndication_vocabularies() {
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);
# Line 246  function syndication_taxonomy_build_list Line 247  function syndication_taxonomy_build_list
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);
# Line 267  function syndication_taxonomy_builder() Line 271  function syndication_taxonomy_builder()
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          }          }
# Line 433  function syndication_admin_settings() { Line 437  function syndication_admin_settings() {
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();
# Line 604  function theme_syndication_columns($data Line 616  function theme_syndication_columns($data
616    $output .= '<div class="syndication-clear"></div>';    $output .= '<div class="syndication-clear"></div>';
617    return $output;    return $output;
618  }  }
619    
620    

Legend:
Removed from v.1.58.2.8  
changed lines
  Added in v.1.58.2.9

  ViewVC Help
Powered by ViewVC 1.1.2