/[drupal]/contributions/modules/taxonomy_theme/taxonomy_theme_taxonomy.inc
ViewVC logotype

Diff of /contributions/modules/taxonomy_theme/taxonomy_theme_taxonomy.inc

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

revision 1.4, Wed Oct 18 10:01:56 2006 UTC revision 1.5, Tue Aug 28 13:58:19 2007 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: taxonomy_theme_taxonomy.inc,v 1.3 2006/10/10 20:48:34 profix898 Exp $  // $Id: taxonomy_theme_taxonomy.inc,v 1.4 2006/10/18 10:01:56 profix898 Exp $
3    
4  define('TAXOTHEME_SKIP',     0);  define('TAXOTHEME_SKIP',     0);
5  define('TAXOTHEME_TERM',     1);  define('TAXOTHEME_TERM',     1);
# Line 45  function _taxonomy_theme_select_forum(&$ Line 45  function _taxonomy_theme_select_forum(&$
45   */   */
46  function _taxonomy_theme_select_term(&$theme_method, &$custom_theme, $default_theme, $uri) {  function _taxonomy_theme_select_term(&$theme_method, &$custom_theme, $default_theme, $uri) {
47    $selector_vid = variable_get('taxonomy_theme_selector', '');    $selector_vid = variable_get('taxonomy_theme_selector', '');
48    if ((arg(0) == 'node') && is_numeric(arg(1))) {    if ((arg(0) == 'node') && is_numeric($nid = arg(1))) {
     $nid = arg(1);  
49      $terms = taxonomy_node_get_terms_by_vocabulary($nid, $selector_vid);      $terms = taxonomy_node_get_terms_by_vocabulary($nid, $selector_vid);
50      if ($terms) {      if ($terms) {
51        $term = current($terms);        $term = current($terms);
# Line 57  function _taxonomy_theme_select_term(&$t Line 56  function _taxonomy_theme_select_term(&$t
56        $custom_theme = variable_get('taxonomy_theme_forum|'.$term->tid, $default_theme);        $custom_theme = variable_get('taxonomy_theme_forum|'.$term->tid, $default_theme);
57      }      }
58    }    }
59    else if ((arg(0) == 'taxonomy_menu') && is_numeric(arg(1)) && arg(2)) {    else if ((arg(0) == 'taxonomy_menu') && is_numeric($vid = arg(1)) && arg(2)) {
     $vid = arg(1);  
60      $tid = basename($uri);      $tid = basename($uri);
61      if ($theme_forums && ($vid == $forum_vid)) {      if ($theme_forums && ($vid == $forum_vid)) {
62        $custom_theme = variable_get('taxonomy_theme_forum|'.$tid, $default_theme);        $custom_theme = variable_get('taxonomy_theme_forum|'.$tid, $default_theme);
# Line 68  function _taxonomy_theme_select_term(&$t Line 66  function _taxonomy_theme_select_term(&$t
66      }      }
67    }    }
68    else if ((arg(0) == 'taxonomy') && (arg(1) == 'term')) {    else if ((arg(0) == 'taxonomy') && (arg(1) == 'term')) {
69      if (is_numeric(arg(2))) {      if (is_numeric($tid = arg(2))) {
       $tid = arg(2);  
70        $tobj = taxonomy_get_term($tid);        $tobj = taxonomy_get_term($tid);
71        if ($tobj->vid == $selector_vid) {        if ($tobj->vid == $selector_vid) {
72          $custom_theme = variable_get('taxonomy_theme_term|'.$tid, $default_theme);          $custom_theme = variable_get('taxonomy_theme_term|'.$tid, $default_theme);
# Line 79  function _taxonomy_theme_select_term(&$t Line 76  function _taxonomy_theme_select_term(&$t
76        }        }
77      }      }
78    }    }
79    else if ((arg(0) == 'forum') && is_numeric(arg(1)) && $theme_forums) {    else if ((arg(0) == 'forum') && is_numeric($tid = arg(1)) && $theme_forums) {
     $tid = arg(1);  
80      $custom_theme = variable_get('taxonomy_theme_forum|'.$tid, $default_theme);      $custom_theme = variable_get('taxonomy_theme_forum|'.$tid, $default_theme);
81    }    }
82  }  }
# Line 90  function _taxonomy_theme_select_term(&$t Line 86  function _taxonomy_theme_select_term(&$t
86   * (vocabulary-based theme selection)   * (vocabulary-based theme selection)
87   */   */
88  function _taxonomy_theme_select_vocabulary(&$theme_method, &$custom_theme, $default_theme, $uri) {  function _taxonomy_theme_select_vocabulary(&$theme_method, &$custom_theme, $default_theme, $uri) {
89    if ((arg(0) == 'node') && is_numeric(arg(1))) {    if (((arg(0) == 'node') && is_numeric($nid = arg(1))) || ((arg(0) == 'comment') && (arg(1) == 'reply') && ($nid = arg(2)))) {
     $nid = arg(1);  
90      $terms = taxonomy_node_get_terms($nid);      $terms = taxonomy_node_get_terms($nid);
91      $term = current($terms);      $term = current($terms);
92      $vid = $term->vid;      $vid = $term->vid;
# Line 101  function _taxonomy_theme_select_vocabula Line 96  function _taxonomy_theme_select_vocabula
96        $custom_theme = variable_get('taxonomy_theme_forum|'.$term->tid, $default_theme);        $custom_theme = variable_get('taxonomy_theme_forum|'.$term->tid, $default_theme);
97      }      }
98    }    }
99    else if ((arg(0) == 'taxonomy_menu') && is_numeric(arg(1))) {    else if ((arg(0) == 'taxonomy_menu') && is_numeric($vid = arg(1))) {
     $vid = arg(1);  
100      if ($theme_forums && ($vid == $forum_vid) && arg(2)) {      if ($theme_forums && ($vid == $forum_vid) && arg(2)) {
101        $tid = basename($uri);        $tid = basename($uri);
102        $custom_theme = variable_get('taxonomy_theme_forum|'.$tid, $default_theme);        $custom_theme = variable_get('taxonomy_theme_forum|'.$tid, $default_theme);
# Line 112  function _taxonomy_theme_select_vocabula Line 106  function _taxonomy_theme_select_vocabula
106      }      }
107    }    }
108    else if ((arg(0) == 'taxonomy')) {    else if ((arg(0) == 'taxonomy')) {
109      if (is_numeric(arg(2))) {      if (is_numeric($tid = arg(2))) {
       $tid = arg(2);  
110        $tobj = taxonomy_get_term($tid);        $tobj = taxonomy_get_term($tid);
111        $vid = $tobj->vid;        $vid = $tobj->vid;
112        if ($theme_forums && ($vid == $forum_vid)) {        if ($theme_forums && ($vid == $forum_vid)) {
# Line 124  function _taxonomy_theme_select_vocabula Line 117  function _taxonomy_theme_select_vocabula
117        }        }
118      }      }
119    }    }
120    else if ((arg(0) == 'forum') && is_numeric(arg(1)) && $theme_forums) {    else if ((arg(0) == 'forum') && is_numeric($tid = arg(1)) && $theme_forums) {
     $tid = arg(1);  
121      $custom_theme = variable_get('taxonomy_theme_forum|'.$tid, $default_theme);      $custom_theme = variable_get('taxonomy_theme_forum|'.$tid, $default_theme);
122    }    }
123  }  }
# Line 135  function _taxonomy_theme_select_vocabula Line 127  function _taxonomy_theme_select_vocabula
127   * (all-taxonomy theme selection = term-based + vocab-based)   * (all-taxonomy theme selection = term-based + vocab-based)
128   */   */
129  function _taxonomy_theme_select_alltaxonomy(&$theme_method, &$custom_theme, $default_theme, $uri) {  function _taxonomy_theme_select_alltaxonomy(&$theme_method, &$custom_theme, $default_theme, $uri) {
130    if ((arg(0) == 'node') && is_numeric(arg(1))) {    if (((arg(0) == 'node') && is_numeric($nid = arg(1))) || ((arg(0) == 'comment') && (arg(1) == 'reply') && ($nid = arg(2)))) {
     $nid = arg(1);  
131      $terms = taxonomy_node_get_terms($nid);      $terms = taxonomy_node_get_terms($nid);
132      $term = current($terms);      $term = current($terms);
133      $vid = $term->vid;      $vid = $term->vid;
# Line 146  function _taxonomy_theme_select_alltaxon Line 137  function _taxonomy_theme_select_alltaxon
137        $custom_theme = variable_get('taxonomy_theme_forum|'.$term->tid, $default_theme);        $custom_theme = variable_get('taxonomy_theme_forum|'.$term->tid, $default_theme);
138      }      }
139    }    }
140    else if ((arg(0) == 'taxonomy_menu') && is_numeric(arg(1)) && arg(2)) {    else if ((arg(0) == 'taxonomy_menu') && is_numeric($vid = arg(1)) && arg(2)) {
     $vid = arg(1);  
141      $tid = basename($uri);      $tid = basename($uri);
142      if ($theme_forums && ($vid == $forum_vid)) {      if ($theme_forums && ($vid == $forum_vid)) {
143        $custom_theme = variable_get('taxonomy_theme_forum|'.$tid, $default_theme);        $custom_theme = variable_get('taxonomy_theme_forum|'.$tid, $default_theme);
# Line 157  function _taxonomy_theme_select_alltaxon Line 147  function _taxonomy_theme_select_alltaxon
147      }      }
148    }    }
149    else if ((arg(0) == 'taxonomy')) {    else if ((arg(0) == 'taxonomy')) {
150      if (is_numeric(arg(2))) {      if (is_numeric($tid = arg(2))) {
       $tid = arg(2);  
151        $tobj = taxonomy_get_term($tid);        $tobj = taxonomy_get_term($tid);
152        $custom_theme = variable_get('taxonomy_theme_all|'.$tid, $default_theme);        $custom_theme = variable_get('taxonomy_theme_all|'.$tid, $default_theme);
153        if ($tobj->vid == $forum_vid) {        if ($tobj->vid == $forum_vid) {
# Line 166  function _taxonomy_theme_select_alltaxon Line 155  function _taxonomy_theme_select_alltaxon
155        }        }
156      }      }
157    }    }
158    else if ((arg(0) == 'forum') && is_numeric(arg(1)) && $theme_forums) {    else if ((arg(0) == 'forum') && is_numeric($tid = arg(1)) && $theme_forums) {
     $tid = arg(1);  
159      $custom_theme = variable_get('taxonomy_theme_forum|'.$tid, $default_theme);      $custom_theme = variable_get('taxonomy_theme_forum|'.$tid, $default_theme);
160    }    }
161  }  }
# Line 177  function _taxonomy_theme_select_alltaxon Line 165  function _taxonomy_theme_select_alltaxon
165   * (nodetype-based theme selection)   * (nodetype-based theme selection)
166   */   */
167  function _taxonomy_theme_select_nodetype(&$theme_method, &$custom_theme, $default_theme, $uri) {  function _taxonomy_theme_select_nodetype(&$theme_method, &$custom_theme, $default_theme, $uri) {
168    if ((arg(0) == 'node') && is_numeric(arg(1))) {    if (((arg(0) == 'node') && is_numeric($nid = arg(1))) || ((arg(0) == 'comment') && (arg(1) == 'reply') && ($nid = arg(2)))) {
     $nid = arg(1);  
169      $nodetype = db_fetch_object(db_query('SELECT type FROM {node} WHERE nid = %d', $nid));      $nodetype = db_fetch_object(db_query('SELECT type FROM {node} WHERE nid = %d', $nid));
170      if ($nodetype->type) {      if ($nodetype->type) {
171        $custom_theme = variable_get('taxonomy_theme_nodetype|'.$nodetype->type, $default_theme);        $custom_theme = variable_get('taxonomy_theme_nodetype|'.$nodetype->type, $default_theme);
# Line 188  function _taxonomy_theme_select_nodetype Line 175  function _taxonomy_theme_select_nodetype
175        }        }
176      }      }
177    }    }
178    else if ((arg(0) == 'forum') && is_numeric(arg(1)) && $theme_forums) {    else if ((arg(0) == 'forum') && is_numeric($tid = arg(1)) && $theme_forums) {
     $tid = arg(1);  
179      $custom_theme = variable_get('taxonomy_theme_forum|'.$tid, $default_theme);      $custom_theme = variable_get('taxonomy_theme_forum|'.$tid, $default_theme);
180    }    }
181  }  }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.2