Index: technorati.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/technorati/technorati.install,v
retrieving revision 1.2
diff -u -r1.2 technorati.install
--- technorati.install	27 Jul 2008 16:28:34 -0000	1.2
+++ technorati.install	27 Jul 2008 20:51:38 -0000
@@ -31,6 +31,9 @@
 
   // delete variables
   variable_del('technorati_display_type');
+  variable_del('technorati_unify_tags');
+  variable_del('technorati_sort_tags');
+  variable_del('technorati_hide_notags');
   foreach (node_get_types() as $node_type => $node_name) {
     variable_del('technorati_node_type_'. $node_type);
   }
Index: technorati.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/technorati/technorati.module,v
retrieving revision 1.11
diff -u -r1.11 technorati.module
--- technorati.module	27 Jul 2008 16:28:34 -0000	1.11
+++ technorati.module	27 Jul 2008 20:51:39 -0000
@@ -27,6 +27,10 @@
 define('TECHNORATI_DISPLAY_FULL',    2);
 define('TECHNORATI_DISPLAY_BOTH',    3);
 
+define('TECHNORATI_UNIFY_TAGS',      'technorati_unify_tags');
+define('TECHNORATI_SORT_TAGS',       'technorati_sort_tags');
+define('TECHNORATI_HIDE_NOTAGS',     'technorati_hide_notags');
+
 /**
  * Implementation of hook_help().
  */
@@ -78,7 +82,12 @@
     TECHNORATI_MODE_BOTH     => t('Both'),
   );
 
-  $form[TECHNORATI_DISPLAY_TYPE] = array(
+  $form['display'] = array(
+    '#type'          => 'fieldset',
+    '#title'         => t('Technorati tag display settings'),
+  );
+
+  $form['display'][TECHNORATI_DISPLAY_TYPE] = array(
     '#type'          => 'select',
     '#title'         => t('How to display the technorati tags'),
     '#default_value' => variable_get(TECHNORATI_DISPLAY_TYPE, TECHNORATI_DISPLAY_FULL),
@@ -86,6 +95,27 @@
     '#description' => t('Select how to display the tags.<ul><li>None: means that the module will not display the tags. The theme can use the $node->technorati object to display the tags anywhere.</li><li>Teaser: means that the tags will only be displayed when the node is in teaser view.</li><li>Full page: means that the tags will only be displayed when the node is in full page view.</li><li>Both: means the tags will be displayed in both teaser and full view.</li></ul>'),
   );
 
+  $form['display'][TECHNORATI_UNIFY_TAGS] = array(
+    '#type'          => 'checkbox',
+    '#title'         => t('Unify technorati tags'),
+    '#default_value' => variable_get(TECHNORATI_UNIFY_TAGS, 0),
+    '#description'   => t('Use this option if you want to have only one occurrence of each choosen tag.'),
+  );
+
+  $form['display'][TECHNORATI_SORT_TAGS] = array(
+    '#type'          => 'checkbox',
+    '#title'         => t('Sort technorati tags'),
+    '#default_value' => variable_get(TECHNORATI_SORT_TAGS, 0),
+    '#description'   => t('Sort the tags when displaying Technorati links.'),
+  );
+
+  $form['display'][TECHNORATI_HIDE_NOTAGS] = array(
+    '#type'          => 'checkbox',
+    '#title'         => t('Hide technorati display if empty'),
+    '#default_value' => variable_get(TECHNORATI_HIDE_NOTAGS, 0),
+    '#description'   => t('Hide the display of the Technorati icon and the Technorati Tags label, if there are no tags assigned to a node.'),
+  );
+
   $form['types'] = array(
     '#type' => 'fieldset',
     '#title' => t('Content types'),
@@ -159,7 +189,7 @@
 function technorati_theme() {
   return array(
     'technorati_tags' => array(
-                               'arguments' => array('tags' => NULL),
+      'arguments' => array('tags' => NULL),
     ),
   );
 }
@@ -235,6 +265,9 @@
  * Theme function for registered theme 'technorati_tags'.
  */
 function theme_technorati_tags($tags) {
+  if (empty($tags) && variable_get(TECHNORATI_HIDE_NOTAGS, 0)) {
+    return '';
+  }
   $path = base_path() . drupal_get_path('module', 'technorati') .'/technobubble.gif';
   $output = '<div class="technorati_tags">';
   $output .= '<img src="'. $path .'"/>';
@@ -253,14 +286,24 @@
   $mode = variable_get(TECHNORATI_NODE_TYPE . $node->type, TECHNORATI_MODE_NONE);
   switch ($mode) {
     case TECHNORATI_MODE_MANUAL:
-      return _technorati_manual($node);
-
+      $tags = _technorati_manual($node);
+      break;
     case TECHNORATI_MODE_TAXONOMY:
-      return _technorati_taxonomy($node);
-
+      $tags = _technorati_taxonomy($node);
+      break;
     case TECHNORATI_MODE_BOTH:
-      return array_merge(_technorati_taxonomy($node),  _technorati_manual($node));
+      $tags = array_merge(_technorati_taxonomy($node),  _technorati_manual($node));
+      break;
+    default:
+      return;
+  }
+  if (variable_get(TECHNORATI_UNIFY_TAGS, 0)) {
+    $tags = array_unique($tags);
   }
+  if (variable_get(TECHNORATI_SORT_TAGS, 0)) {
+    natcasesort($tags);
+  }
+  return $tags;
 }
 
 /**
@@ -272,7 +315,9 @@
   $links = array();
   if (is_array($node->technorati_tags)) {
     foreach ($node->technorati_tags as $tag) {
-      $links[] = _technorati_link($tag);
+      if (!empty($tag)) {
+        $links[] = _technorati_link($tag);
+      }
     }
   }
   return $links;
