/[drupal]/contributions/sandbox/alex_b/mtk/helper/taxonomy.inc
ViewVC logotype

Contents of /contributions/sandbox/alex_b/mtk/helper/taxonomy.inc

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


Revision 1.2 - (show annotations) (download) (as text)
Thu Aug 7 17:25:18 2008 UTC (15 months, 2 weeks ago) by alexb
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +2 -0 lines
File MIME type: text/x-php
Add version string.
1 <?php
2 // $Id:$
3
4 /**
5 * @file
6 * Taxonomy helper functions.
7 */
8
9 /**
10 * Helper function for retrieving vid.
11 */
12 function _mtk_get_vid($vocabulary_name, $node_type) {
13 static $vocabularies;
14 if (isset($vocabularies[$vocabulary_name][$node_type])) {
15 return $vocabularies[$vocabulary_name][$node_type];
16 }
17 else if ($vid = db_result(db_query('SELECT v.vid FROM vocabulary v JOIN vocabulary_node_types vn ON vn.vid = v.vid WHERE v.name = "%s" AND vn.type = "%s"', $vocabulary_name, $node_type))) {
18 $vocabularies[$vocabulary_name][$node_type] = $vid;
19 return $vocabularies[$vocabulary_name][$node_type];
20 }
21 drupal_set_message(t('Error retrieving vocabulary id for !vname - vocabulary name changed?', array('!vname' => $vocabulary_name)), 'error');
22 return FALSE;
23 }
24
25 /**
26 * Clean taxonomy term tags.
27 */
28 function _mtk_clean_tag($tag) {
29 $tag = str_replace(',', ' - ', $tag);
30 return str_replace(' ', ' ', $tag);
31 }

  ViewVC Help
Powered by ViewVC 1.1.2