? 302440-2.patch
? taxonomy_list_plus_test.patch
? taxonomy_term_load.patch
? term.patch
? term_edit.patch
? unappaproved.patch
? sites/default/files
? sites/default/settings.php
Index: modules/forum/forum.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.admin.inc,v
retrieving revision 1.12
diff -u -p -r1.12 forum.admin.inc
--- modules/forum/forum.admin.inc	16 Jul 2008 21:59:26 -0000	1.12
+++ modules/forum/forum.admin.inc	9 Sep 2008 21:03:56 -0000
@@ -160,7 +160,7 @@ function forum_form_container(&$form_sta
  * @param $tid ID of the term to be deleted
  */
 function forum_confirm_delete(&$form_state, $tid) {
-  $term = taxonomy_get_term($tid);
+  $term = taxonomy_term_load($tid);
 
   $form['tid'] = array('#type' => 'value', '#value' => $tid);
   $form['name'] = array('#type' => 'value', '#value' => $term->name);
Index: modules/taxonomy/taxonomy.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v
retrieving revision 1.27
diff -u -p -r1.27 taxonomy.admin.inc
--- modules/taxonomy/taxonomy.admin.inc	16 Jul 2008 21:59:28 -0000	1.27
+++ modules/taxonomy/taxonomy.admin.inc	9 Sep 2008 21:03:56 -0000
@@ -233,9 +233,9 @@ function taxonomy_admin_vocabulary_edit(
 /**
  * Page to edit a vocabulary term.
  */
-function taxonomy_admin_term_edit($tid) {
-  if ($term = (array)taxonomy_get_term($tid)) {
-    return drupal_get_form('taxonomy_form_term', taxonomy_vocabulary_load($term['vid']), $term);
+function taxonomy_admin_term_edit($term) {
+  if (isset($term)) {
+    return drupal_get_form('taxonomy_form_term', taxonomy_vocabulary_load($term->vid), (array)$term);
   }
   return drupal_not_found();
 }
@@ -835,7 +835,7 @@ function taxonomy_term_confirm_parents(&
  * @see taxonomy_term_confirm_delete_submit()
  */
 function taxonomy_term_confirm_delete(&$form_state, $tid) {
-  $term = taxonomy_get_term($tid);
+  $term = taxonomy_term_load($tid);
 
   $form['type'] = array('#type' => 'value', '#value' => 'term');
   $form['name'] = array('#type' => 'value', '#value' => $term->name);
Index: modules/taxonomy/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v
retrieving revision 1.425
diff -u -p -r1.425 taxonomy.module
--- modules/taxonomy/taxonomy.module	24 Jul 2008 16:25:19 -0000	1.425
+++ modules/taxonomy/taxonomy.module	9 Sep 2008 21:03:56 -0000
@@ -142,9 +142,10 @@ function taxonomy_menu() {
     'type' => MENU_CALLBACK,
   );
 
-  $items['admin/content/taxonomy/edit/term'] = array(
+  $items['admin/content/taxonomy/edit/term/%taxonomy_term'] = array(
     'title' => 'Edit term',
     'page callback' => 'taxonomy_admin_term_edit',
+    'page arguments' => array(5),
     'access arguments' => array('administer taxonomy'),
     'type' => MENU_CALLBACK,
   );
@@ -156,6 +157,18 @@ function taxonomy_menu() {
     'access arguments' => array('access content'),
     'type' => MENU_CALLBACK,
   );
+  $items['taxonomy/term/%/view'] = array(
+    'title' => 'View',
+    'type' => MENU_DEFAULT_LOCAL_TASK,
+  );
+  $items['taxonomy/term/%taxonomy_term/edit'] = array(
+    'title' => 'Edit term',
+    'page callback' => 'taxonomy_admin_term_edit',
+    'page arguments' => array(2),
+    'access arguments' => array('administer taxonomy'),
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 10,
+  );
 
   $items['taxonomy/autocomplete'] = array(
     'title' => 'Autocomplete taxonomy',
@@ -386,7 +399,7 @@ function taxonomy_del_term($tid) {
         }
       }
 
-      $term = (array) taxonomy_get_term($tid);
+      $term = (array) taxonomy_term_load($tid);
 
       db_query('DELETE FROM {term_data} WHERE tid = %d', $tid);
       db_query('DELETE FROM {term_hierarchy} WHERE tid = %d', $tid);
@@ -1005,16 +1018,76 @@ function taxonomy_vocabulary_load($vid) 
  * @return Object
  *   A term object. Results are statically cached.
  */
+function taxonomy_term_load($tid) {
+  static $terms = array();
+  // Ensure numeric tid to avoid loading the first term on 1+2 URLs.
+  // The db layer casts '1 2' to '1', so doesn't help here.
+  if (!is_numeric($tid)) {
+    return FALSE;
+  }
+
+  if (!isset($terms[$tid])) {
+    $terms[$tid] = db_fetch_object(db_query('SELECT * FROM {term_data} WHERE tid = :tid', array(':tid' => $tid)));
+  }
+
+  if ($modules = taxonomy_invoke_taxonomy_term_load(&$terms[$tid], 'load')) {
+    foreach ($modules as $key => $value) {
+      $terms[$tid]->$key = $value;
+    }
+  }
+
+  return $terms[$tid];
+}
+
+/**
+ * Return a term object with name and description.
+ * @param $tid
+ *   A term's ID
+ * @return Object
+ *  A term object. Results are statically cached.
+ */
 function taxonomy_get_term($tid) {
   static $terms = array();
+  // Ensure numeric tid to avoid loading the first term on 1+2 URLs.
+  // The db layer casts '1 2' to '1', so doesn't help here.
+  if (!is_numeric($tid)) {
+    return FALSE;
+  }
 
   if (!isset($terms[$tid])) {
-    $terms[$tid] = db_fetch_object(db_query('SELECT * FROM {term_data} WHERE tid = %d', $tid));
+    $terms[$tid] = db_fetch_object(db_query('SELECT * FROM {term_data} WHERE tid = :tid', array(':tid' => $tid)));
   }
 
   return $terms[$tid];
 }
 
+/**
+ * Invoke a hook_taxonomy_term_load() operation in all modules.
+ *
+ * @param &$term
+ *   A node object.
+ * @param $op
+ *   A string containing the name of the nodeapi operation.
+ * @return
+ *   The returned value of the invoked hooks.
+ */
+function taxonomy_invoke_taxonomy_term_load(&$term) {
+  $return = array();
+
+  foreach (module_implements('taxonomy_term_load') as $name) {
+    $function = $name .'_taxonomy_term_load';
+    $result = $function($term);
+    if (isset($result) && is_array($result)) {
+      $return = array_merge($return, $result);
+    }
+    else if (isset($result)) {
+      $return[] = $result;
+    }
+  }
+  return $return;
+
+}
+
 function _taxonomy_term_select($title, $name, $value, $vocabulary_id, $description, $multiple, $blank, $exclude = array()) {
   $tree = taxonomy_get_tree($vocabulary_id);
   $options = array();
Index: modules/taxonomy/taxonomy.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.pages.inc,v
retrieving revision 1.12
diff -u -p -r1.12 taxonomy.pages.inc
--- modules/taxonomy/taxonomy.pages.inc	21 Aug 2008 19:36:38 -0000	1.12
+++ modules/taxonomy/taxonomy.pages.inc	9 Sep 2008 21:03:56 -0000
@@ -51,7 +51,7 @@ function taxonomy_term_page($str_tids = 
           $channel['title'] = variable_get('site_name', 'Drupal') . ' - ' . $title;
           // Only display the description if we have a single term, to avoid clutter and confusion.
           if (count($tids) == 1) {
-            $term = taxonomy_get_term($tids[0]);
+            $term = taxonomy_term_load($tids[0]);
             // HTML will be removed from feed description, so no need to filter here.
             $channel['description'] = $term->description;
           }
@@ -92,7 +92,7 @@ function theme_taxonomy_term_page($tids,
 
   // Only display the description if we have a single term, to avoid clutter and confusion.
   if (count($tids) == 1) {
-    $term = taxonomy_get_term($tids[0]);
+    $term = taxonomy_term_load($tids[0]);
     $description = $term->description;
 
     // Check that a description is set.
