Index: tagadelic.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/tagadelic/tagadelic.module,v
retrieving revision 1.40.2.10
diff -u -r1.40.2.10 tagadelic.module
--- tagadelic.module	14 Sep 2009 20:26:06 -0000	1.40.2.10
+++ tagadelic.module	6 Oct 2009 14:27:50 -0000
@@ -2,24 +2,31 @@
 // $Id: tagadelic.module,v 1.40.2.10 2009/09/14 20:26:06 ber Exp $
 
 /**
- * Implementation of hook_help
+ * @file
+ * Tagedelic module.
+ *
+ * Generates a page and blocks with weighted tags (tag clouds).
+ */
+
+/**
+ * Implementation of hook_help().
  */
 function tagadelic_help($path, $arg) {
   switch ($path) {
-   case 'admin/help#tagadelic':
+    case 'admin/help#tagadelic':
       return t('Tagadelic offers dynamic urls. <br/>Visit example.com/tagadelic/list/2,1,5 to get the vocabularies 2,1 and 5 listed as tag groups. <br/>Visit example.com/tagadelic/chunk/2,1,5 to get a tag cloud of the terms in the vocabularies 2,1 and 5.<br/> Note that we limit to five vocabularies.');
   }
 }
 
 /**
- * Implementation of hook_init
+ * Implementation of hook_init().
  */
 function tagadelic_init() {
   drupal_add_css(drupal_get_path('module', 'tagadelic') .'/tagadelic.css');
 }
 
 /**
- * Implementation of hook_menu
+ * Implementation of hook_menu().
  */
 function tagadelic_menu() {
   $items = array();
@@ -36,7 +43,7 @@
     'title' => 'Tags',
     'page callback' => 'tagadelic_page_chunk',
     'page arguments' => array(NULL),
-    'access callback' => 'user_access',      
+    'access callback' => 'user_access',
     'access arguments' => array('access content'),
     'type' => MENU_SUGGESTED_ITEM,
   );
@@ -60,12 +67,12 @@
 }
 
 /**
- * Implementation of hook_nodeapi
+ * Implementation of hook_nodeapi().
  * You will have a nice variable in $node available for processing tags!
  */
 function tagadelic_nodeapi(&$node, $op, $teaser, $page) {
   if ($op == 'load') {
-     $node->tags = tagadelic_node_get_terms($node);
+    $node->tags = tagadelic_node_get_terms($node);
   }
 }
 
@@ -214,27 +221,27 @@
 function tagadelic_get_weighted_tags($vids, $steps = 6, $size = 60) {
   // build the options so we can cache multiple versions
   global $language;
-  $options = implode('_',$vids) .'_'. $language->language .'_'. $steps .'_'. $size;
+  $options = implode('_', $vids) .'_'. $language->language .'_'. $steps .'_'. $size;
   // Check if the cache exists
   $cache_name = 'tagadelic_cache_'. $options;
   $cache = cache_get($cache_name, 'cache_page');
-  
+
   // make sure cache has data
   if (isset($cache->data)) {
     $tags = $cache->data;
   }
   else {
-  
+
     if (!is_array($vids) || count($vids) == 0) {
       return array();
     }
-    $result = db_query_range(db_rewrite_sql('SELECT COUNT(*) AS count, td.tid, td.vid, td.name, td.description FROM {term_data} td INNER JOIN {term_node} tn ON td.tid = tn.tid INNER JOIN {node} n ON tn.vid = n.vid WHERE td.vid IN ('. db_placeholders($vids) .') GROUP BY td.tid, td.vid, td.name, td.description HAVING COUNT(*) > 0 ORDER BY count DESC'), $vids, 0, $size);
-    
+    $result = db_query_range(db_rewrite_sql('SELECT COUNT(*) AS count, td.tid, td.vid, td.name, td.description FROM {term_data} td INNER JOIN {term_node} tn ON td.tid = tn.tid INNER JOIN {node} n ON tn.vid = n.vid WHERE td.vid IN ('. db_placeholders($vids) .') AND n.status = 1 GROUP BY td.tid, td.vid, td.name, td.description HAVING COUNT(*) > 0 ORDER BY count DESC'), $vids, 0, $size);
+
     $tags = tagadelic_build_weighted_tags($result, $steps);
 
     cache_set($cache_name, $tags, 'cache_page', CACHE_TEMPORARY);
   }
-  
+
   return $tags;
 }
 
@@ -270,7 +277,7 @@
 /**
  * API funtion to order a set of tags.
  * @todo If you feel like making this more modular, please send me patches.
- **/
+ */
 function tagadelic_sort_tags($tags) {
   list($sort, $order) = explode(',', variable_get('tagadelic_sort_order', 'title,asc'));
   switch ($sort) {
@@ -353,7 +360,7 @@
 }
 
 /**
- * implementation of hook_block
+ * Implementation of hook_block().
  */
 function tagadelic_block($op = 'list', $delta = 0, $edit = array()) {
   $blocks = array();
@@ -368,7 +375,8 @@
       }
 
     }
-    elseif (arg(0) == 'node' && is_numeric(arg(1)) && $node = node_load(arg(1))) {
+    // elseif (arg(0) == 'node' && is_numeric(arg(1)) && $node = node_load(arg(1))) {
+    elseif ($node = menu_get_object())  {
       $blocks['subject'] = t('Tags for @title', array('@title' => $node->title));
       $blocks['content'] = tagadelic_tags_lists($node);
     }
@@ -402,7 +410,7 @@
 }
 
 /**
- * Implementation of hook_theme
+ * Implementation of hook_theme().
  */
 function tagadelic_theme() {
   return array(

