Index: yahoo_terms.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/yahoo_terms/yahoo_terms.module,v retrieving revision 1.1.2.4 diff -u -r1.1.2.4 yahoo_terms.module --- yahoo_terms.module 11 May 2007 16:04:54 -0000 1.1.2.4 +++ yahoo_terms.module 15 May 2007 21:59:41 -0000 @@ -110,13 +110,13 @@ * Only use the current terms in the vocabulary or expand with the new terms, TRUE - not epxand, FALSE - expand. Default: FALSE */ function yahoo_terms_node_assign_keywords(&$node, $query = "", $blacklist, $vid, $static = FALSE) { - $text = $node->body; + $text = strip_tags($node->body); $limit = variable_get('yahoo_terms_taxonomy_limit_for_'. $node->type, FALSE); $limit = ($limit === FALSE) ? variable_get('yahoo_terms_taxonomy_limit', -1) : $limit; $terms = yahoo_terms_text_get_keywords($text, $query, $limit, $blacklist); $tids = _yahoo_terms_create_vocabulary_items($terms, $vid, $static); $node->taxonomy = array_merge($node->taxonomy, $tids); - taxonomy_node_save($node->nid, $node->taxonomy); + taxonomy_node_save($node->nid, $tids); } /** @@ -136,27 +136,31 @@ return FALSE; } $tids = array(); + // todo: pull blacklist from user input + $blacklist = array('nbsp', 'quot'); foreach ($keywords as $term) { - $curr_term = taxonomy_get_term_by_name($term); - if (count($curr_term) != 0) { - $curr_term = $curr_term[0]; - if ($curr_term->vid == $vid) { - $tids[] = $curr_term; - } else if ($static == FALSE) { - $new_term['name'] = $term; - $new_term['vid'] = $vid; - taxonomy_save_term($new_term); - $tids[] = taxonomy_get_term($new_term['tid']); - unset($new_term); + if (!in_array($term, $blacklist)) { + $curr_term = taxonomy_get_term_by_name($term); + if (count($curr_term) != 0) { + $curr_term = $curr_term[0]; + if ($curr_term->vid == $vid) { + $tids[] = $curr_term; + } else if ($static == FALSE) { + $new_term['name'] = $term; + $new_term['vid'] = $vid; + taxonomy_save_term($new_term); + $tids[] = taxonomy_get_term($new_term['tid']); + unset($new_term); + } } - } - else { - if ($static == FALSE) { - $new_term['name'] = $term; - $new_term['vid'] = $vid; - taxonomy_save_term($new_term); - $tids[] = taxonomy_get_term($new_term['tid']); - unset($new_term); + else { + if ($static == FALSE) { + $new_term['name'] = $term; + $new_term['vid'] = $vid; + taxonomy_save_term($new_term); + $tids[] = taxonomy_get_term($new_term['tid']); + unset($new_term); + } } } }