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

Diff of /contributions/modules/author_taxonomy/author_taxonomy.module

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

revision 1.1, Fri Apr 11 23:12:27 2008 UTC revision 1.2, Fri Aug 1 07:28:51 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id$  // $Id: author_taxonomy.module,v 1.1 2008/04/11 23:12:27 toddnienkerk Exp $
3    
4  /**  /**
5   * Implementation of hook_menu().   * Implementation of hook_menu().
# Line 112  function author_taxonomy_nodeapi(&$node, Line 112  function author_taxonomy_nodeapi(&$node,
112      case 'view' :      case 'view' :
113        $display = variable_get('author_taxonomy_prepend_node', TRUE);        $display = variable_get('author_taxonomy_prepend_node', TRUE);
114        if ($display && ($page || $teaser)) {        if ($display && ($page || $teaser)) {
115          $node->content['body']['#value'] = author_taxonomy_output($node) . "\n" . $node->content['body']['#value'];          $node->content['body']['#value'] = author_taxonomy_output($node) ."\n". $node->content['body']['#value'];
116        }        }
117        break;        break;
118    }    }
# Line 123  function author_taxonomy_nodeapi(&$node, Line 123  function author_taxonomy_nodeapi(&$node,
123   * Creates array of authors' names and prepares output for the theme functions   * Creates array of authors' names and prepares output for the theme functions
124   */   */
125  function author_taxonomy_output($node) {  function author_taxonomy_output($node) {
126          $author_tids = taxonomy_node_get_terms_by_vocabulary($node->nid, variable_get('author_taxonomy_vocab', 1));    $author_tids = taxonomy_node_get_terms_by_vocabulary($node->nid, variable_get('author_taxonomy_vocab', 1));
127          $author_names = array();    $author_names = array();
128          $author_links = variable_get('author_taxonomy_link_authors', TRUE);    $author_links = variable_get('author_taxonomy_link_authors', TRUE);
129    
130          if (!empty($author_tids)) {    if (!empty($author_tids)) {
131      foreach ($author_tids as $tid => $term) {      foreach ($author_tids as $tid => $term) {
132        if ($author_links) {        if ($author_links) {
133          $author_names[] = l($term->name, taxonomy_term_path($term), array('title' => t('See all stories by @author', array('@author' => $term->name))));          $author_names[] = l($term->name, taxonomy_term_path($term), array('title' => t('See all stories by @author', array('@author' => $term->name))));
# Line 136  function author_taxonomy_output($node) { Line 136  function author_taxonomy_output($node) {
136          $author_names[] = $term->name;          $author_names[] = $term->name;
137        }        }
138      }      }
139          }    }
140    
141          $show_timestamp = variable_get('author_taxonomy_timestamp_display', TRUE);    $show_timestamp = variable_get('author_taxonomy_timestamp_display', TRUE);
142    
143          return theme('author_taxonomy_output', $node, $author_names, $show_timestamp);    return theme('author_taxonomy_output', $node, $author_names, $show_timestamp);
144  }  }
145    
146    
# Line 152  function theme_author_taxonomy_output($n Line 152  function theme_author_taxonomy_output($n
152    
153    if ($show_timestamp) {    if ($show_timestamp) {
154      // Print timestamp      // Print timestamp
155      $output .= '<span class="timestamp">' . theme('author_taxonomy_timestamp', $node->created) . '</span>';      $output .= '<span class="timestamp">'. theme('author_taxonomy_timestamp', $node->created) .'</span>';
156    }    }
157    
158    if ($show_timestamp && !empty($author_names)) {    if ($show_timestamp && !empty($author_names)) {
# Line 162  function theme_author_taxonomy_output($n Line 162  function theme_author_taxonomy_output($n
162    
163    if (!empty($author_names)) {    if (!empty($author_names)) {
164      // Print authors      // Print authors
165      $output .= '<span class="authors">' . theme('author_taxonomy_authors', $author_names) . '</span>';      $output .= '<span class="authors">'. theme('author_taxonomy_authors', $author_names) .'</span>';
166    }    }
167    
168    // Wrap everything in div.submitted and return it    // Wrap everything in div.submitted and return it
169    return '<div class="submitted">' . $output . '</div>';    return '<div class="submitted">'. $output .'</div>';
170  }  }
171    
172    
# Line 194  function theme_author_taxonomy_authors($ Line 194  function theme_author_taxonomy_authors($
194        foreach ($author_names as $author_name) {        foreach ($author_names as $author_name) {
195          // If this is the last author          // If this is the last author
196          if ($i == $author_count) {          if ($i == $author_count) {
197            $output .= 'and ' . $author_name;            $output .= 'and '. $author_name;
198          }          }
199          else {          else {
200            $output .= $author_name . ', ';            $output .= $author_name .', ';
201          }          }
202          $i++;          $i++;
203        }        }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.2