Commit eb9aefe8 authored by Dries's avatar Dries

- Patch #344361 by Rob Loach, recidive: remove some cruft left from the de-op nodeapi patch.

parent 8a48acb0
......@@ -653,31 +653,12 @@ function taxonomy_node_get_terms($node, $key = 'tid') {
return $terms[$node->vid][$key];
}
/**
* Make sure incoming vids are free tagging enabled.
*/
function taxonomy_node_validate(&$node) {
if (!empty($node->taxonomy)) {
$terms = $node->taxonomy;
if (!empty($terms['tags'])) {
foreach ($terms['tags'] as $vid => $vid_value) {
$vocabulary = taxonomy_vocabulary_load($vid);
if (empty($vocabulary->tags)) {
// see form_get_error $key = implode('][', $element['#parents']);
// on why this is the key
form_set_error("taxonomy][tags][$vid", t('The %name vocabulary can not be modified in this way.', array('%name' => $vocabulary->name)));
}
}
}
}
}
/**
* Save term associations for a given node.
*/
function taxonomy_node_save($node, $terms) {
taxonomy_node_delete_revision($node);
taxonomy_nodeapi_delete_revision($node);
// Free tagging vocabularies do not send their tids in the form,
// so we'll detect them here and process them independently.
......@@ -735,20 +716,6 @@ function taxonomy_node_save($node, $terms) {
}
}
/**
* Remove associations of a node to its terms.
*/
function taxonomy_node_delete($node) {
db_query('DELETE FROM {term_node} WHERE nid = %d', $node->nid);
}
/**
* Remove associations of a node to its terms.
*/
function taxonomy_node_delete_revision($node) {
db_query('DELETE FROM {term_node} WHERE vid = %d', $node->vid);
}
/**
* Implementation of hook_node_type().
*/
......@@ -1372,43 +1339,64 @@ function taxonomy_nodeapi_update($node) {
/**
* Implementation of hook_nodeapi_delete().
*
* Remove associations of a node to its terms.
*/
function taxonomy_nodeapi_delete($node) {
taxonomy_node_delete($node);
db_query('DELETE FROM {term_node} WHERE nid = %d', $node->nid);
}
/**
* Implementation of hook_nodeapi_delete_revision().
*
* Remove associations of a node to its terms.
*/
function taxonomy_nodeapi_delete_revision($node) {
taxonomy_node_delete_revision($node);
db_query('DELETE FROM {term_node} WHERE vid = %d', $node->vid);
}
/**
* Implementation of hook_nodeapi_validate().
*
* Make sure incoming vids are free tagging enabled.
*/
function taxonomy_nodeapi_validate($node, $form) {
taxonomy_node_validate($node);
if (!empty($node->taxonomy)) {
$terms = $node->taxonomy;
if (!empty($terms['tags'])) {
foreach ($terms['tags'] as $vid => $vid_value) {
$vocabulary = taxonomy_vocabulary_load($vid);
if (empty($vocabulary->tags)) {
// see form_get_error $key = implode('][', $element['#parents']);
// on why this is the key
form_set_error("taxonomy][tags][$vid", t('The %name vocabulary can not be modified in this way.', array('%name' => $vocabulary->name)));
}
}
}
}
}
/**
* Implementation of hook_nodeapi_rss_item().
*
* Provides category information for RSS feeds.
*/
function taxonomy_nodeapi_rss_item($node) {
return taxonomy_rss_item($node);
$output = array();
foreach ($node->taxonomy as $term) {
$output[] = array(
'key' => 'category',
'value' => check_plain($term->name),
'attributes' => array('domain' => url(taxonomy_term_path($term), array('absolute' => TRUE))),
);
}
return $output;
}
/**
* Implementation of hook_nodeapi_update_index().
*/
function taxonomy_nodeapi_update_index($node) {
return taxonomy_node_update_index($node);
}
/**
* Implementation of hook_nodeapi('update_index').
*/
function taxonomy_node_update_index($node) {
$output = array();
foreach ($node->taxonomy as $term) {
$output[] = $term->name;
......@@ -1444,19 +1432,6 @@ function taxonomy_terms_parse_string($str_tids) {
return $terms;
}
/**
* Provides category information for RSS feeds.
*/
function taxonomy_rss_item($node) {
$output = array();
foreach ($node->taxonomy as $term) {
$output[] = array('key' => 'category',
'value' => check_plain($term->name),
'attributes' => array('domain' => url(taxonomy_term_path($term), array('absolute' => TRUE))));
}
return $output;
}
/**
* Implementation of hook_help().
*/
......
......@@ -209,8 +209,7 @@ function _trigger_nodeapi($node, $op, $a3 = NULL, $a4 = NULL) {
static $objects;
// Prevent recursion by tracking which operations have already been called.
static $recursion;
// Support a subset of operations.
if (!in_array($op, array('view', 'update', 'presave', 'insert', 'delete')) || isset($recursion[$op])) {
if (isset($recursion[$op])) {
return;
}
$recursion[$op] = TRUE;
......@@ -433,10 +432,6 @@ function trigger_user_view(&$edit, &$account, $category) {
function _trigger_user($op, &$edit, &$account, $category = NULL) {
// Keep objects for reuse so that changes actions make to objects can persist.
static $objects;
// We support a subset of operations.
if (!in_array($op, array('login', 'logout', 'insert', 'update', 'delete', 'view'))) {
return;
}
$aids = _trigger_get_hook_aids('user', $op);
$context = array(
'hook' => 'user',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment