Index: tagadelic.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/tagadelic/tagadelic.info,v
retrieving revision 1.1
diff -u -r1.1 tagadelic.info
--- tagadelic.info	16 Nov 2006 16:54:17 -0000	1.1
+++ tagadelic.info	13 Feb 2008 18:57:10 -0000
@@ -1,5 +1,6 @@
 ; $Id: tagadelic.info,v 1.1 2006/11/16 16:54:17 ber Exp $
 name = Tagadelic
 description = Tagadelic makes weighted tag clouds from your taxonomy terms.
-dependencies = taxonomy
-package = "Taxonomy"
\ No newline at end of file
+core = 6.x
+dependencies[] = taxonomy
+package = "Taxonomy"
Index: tagadelic.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/tagadelic/tagadelic.module,v
retrieving revision 1.39
diff -u -r1.39 tagadelic.module
--- tagadelic.module	10 Feb 2008 19:38:27 -0000	1.39
+++ tagadelic.module	13 Feb 2008 19:19:01 -0000
@@ -4,51 +4,53 @@
 /**
  * Implementation of hook_help
  */
-function tagadelic_help($section) {
-  switch ($section) {
+function tagadelic_help($path, $arg) {
+  switch ($path) {
    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.');
   }
 }
 
+function tagadelic_init() {
+  drupal_add_css(drupal_get_path('module','tagadelic') .'/tagadelic.css', 'all');
+}
+
 /**
  * Implementation of hook_menu
  */
-function tagadelic_menu($may_cache) {
+function tagadelic_menu() {
   $items = array();
 
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/settings/tagadelic',
-      'title' => t('Tagadelic configuration'),
-      'description' => t('Configure the tag clouds. Set the order, the number of tags, and the depth of the clouds.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => 'tagadelic_settings',
-      'access' => user_access('administer site configuration'));
-    $items[] = array(
-      'title' => t('Tags'),
-      'path' => "tagadelic",
-      'callback' => 'tagadelic_page_chunk',
-      'access' => user_access('access content'),
-      'type' => MENU_SUGGESTED_ITEM);
-    $items[] = array(
-      'title' => t('Tags'),
-      'path' => "tagadelic/list",
-      'callback' => 'tagadelic_page_list',
-      'access' => user_access('access content'),
-      'type' => MENU_CALLBACK);
-    foreach (taxonomy_get_vocabularies($type = NULL) as $vocabulary) {
-      $items[] = array(
-        'title' => $vocabulary->name,
-        'path' => "tagadelic/chunk/$vocabulary->vid",
-        'callback' => 'tagadelic_page_chunk',
-        'access' => user_access('access content'),
-        'type' => MENU_SUGGESTED_ITEM);
-    }
-  }      
-  else {
-    // We put this in !$may_cache so it's only added once per request
-    drupal_add_css(drupal_get_path('module','tagadelic') .'/tagadelic.css');
+  $items['admin/settings/tagadelic'] = array(
+    'title' => 'Tagadelic configuration',
+    'description' => t('Configure the tag clouds. Set the order, the number of tags, and the depth of the clouds.'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('tagadelic_settings'),
+    'access callback' => 'user_access',
+    'access arguments' => array('administer site configuration'),
+  );
+  $items['tagadelic'] = array(
+    'title' => 'Tags',
+    'page callback' => 'tagadelic_page_chunk',
+    'access callback' => 'user_access',      
+    'access arguments' => array('access content'),
+    'type' => MENU_SUGGESTED_ITEM,
+  );
+  $items['tagadelic/list'] = array(
+    'title' => 'Tags',
+    'page callback' => 'tagadelic_page_list',
+    'access callback' => 'user_access',
+    'access arguments' => array('access content'),
+    'type' => MENU_CALLBACK,
+  );
+  foreach (taxonomy_get_vocabularies($type = NULL) as $vocabulary) {
+    $items["tagadelic/chunk/$vocabulary->vid"] = array(
+      'title' => $vocabulary->name,
+      'page callback' => 'tagadelic_page_chunk',
+      'access callback' => 'user_access',
+      'access arguments' => array('access content'),
+      'type' => MENU_SUGGESTED_ITEM,
+    );
   }
   return $items;
 }
@@ -140,7 +142,7 @@
   }
 
   foreach ($vocs as $vid) {
-    $vocabulary = taxonomy_get_vocabulary($vid);
+    $vocabulary = taxonomy_vocabulary_load($vid);
 
     $tags = tagadelic_get_weighted_tags(array($vocabulary->vid), variable_get('tagadelic_levels', 6), variable_get('tagadelic_page_amount', '60'));
     $tags = tagadelic_sort_tags($tags);
@@ -164,7 +166,7 @@
  * @param $node. A node object.
  */
 function tagadelic_node_get_terms($node) {
-  if ($terms = taxonomy_node_get_terms($node->nid, 'tid')) {
+  if ($terms = taxonomy_node_get_terms($node, 'tid')) {
     $vocs = taxonomy_get_vocabularies($node->type);
     foreach ($terms as $tid => $term) {
       if ($vocs[$term->vid]->tags) {
@@ -182,12 +184,13 @@
  */
 function tagadelic_tags_lists($node) {
   if (is_array($node->tags)) {
+    $output = '';
     foreach($node->tags as $vid => $terms) {
-      $vocabulary = taxonomy_get_vocabulary($vid);
+      $vocabulary = taxonomy_vocabulary_load($vid);
       $title = l($vocabulary->name, "tagadelic/chunk/$vid");
       $items = array();
       foreach ($terms as $term) {
-        $items[] = l($term->name, taxonomy_term_path($term), array('title' => t('view all posts tagged with "@tag"', array('@tag' => $term->name))));
+        $items[] = l($term->name, taxonomy_term_path($term), array('attributes' => array('title' => t('view all posts tagged with "@tag"', array('@tag' => $term->name)))));
       }
       $output .= theme('item_list', $items, $title);
     }
@@ -210,8 +213,8 @@
   $cache = cache_get($cache_name);
   
   // make sure cache has data
-  if ($cache->data) {
-    $tags = unserialize($cache->data);
+  if (isset($cache->data)) {
+    $tags = $cache->data;
   }
   else {
   
@@ -222,7 +225,7 @@
     
     $tags = tagadelic_build_weighted_tags($result, $steps);
 
-    cache_set($cache_name, 'cache', serialize($tags));
+    cache_set($cache_name, $tags);
   }
   
   return $tags;
@@ -299,8 +302,9 @@
  * @ingroup themable
  */
 function theme_tagadelic_weighted($terms) {
+  $output = '';
   foreach ($terms as $term) {
-    $output .= l($term->name, taxonomy_term_path($term), array('class'=>"tagadelic level$term->weight", 'rel'=>'tag')) ." \n";
+    $output .= l($term->name, taxonomy_term_path($term), array('attributes' => array('class'=>"tagadelic level$term->weight", 'rel'=>'tag'))) ." \n";
   }
   return $output;
 }
@@ -333,32 +337,35 @@
 /**
  * implementation of hook_block
  */
-function tagadelic_block($op = 'list', $delta = O, $edit = array()) {
+function tagadelic_block($op = 'list', $delta = 0, $edit = array()) {
+  $blocks = array();
   if ($op == 'view') {
-    if ($voc = taxonomy_get_vocabulary($delta)) {
-      $blocks['subject'] = variable_get('tagadelic_block_title_'. $delta, t('tags in @voc', array('@voc' => $voc->name)));
+    if ($voc = taxonomy_vocabulary_load($delta)) {
+      $blocks['subject'] = variable_get('tagadelic_block_title_'. $delta, t('Tags in @voc', array('@voc' => $voc->name)));
       $tags = tagadelic_get_weighted_tags(array($voc->vid), variable_get('tagadelic_levels', 6), variable_get('tagadelic_block_tags_'. $delta, 12));
       $tags = tagadelic_sort_tags($tags);
       $blocks['content'] = theme('tagadelic_weighted', $tags);//return a chunk of 12 tags
       $blocks['content'] .= theme('tagadelic_more', $voc->vid);//add more link
     }
     elseif(arg(0) == 'node' && is_numeric(arg(1)) && $node = node_load(arg(1))) {
-      $blocks['subject'] = t('tags for @title', array('@title' => $node->title));
+      $blocks['subject'] = t('Tags for @title', array('@title' => $node->title));
       $blocks['content'] = tagadelic_tags_lists($node);
     }
   }
   elseif ($op == 'list') {
     foreach(taxonomy_get_vocabularies() as $voc) {
-      $blocks[$voc->vid]['info'] = variable_get('tagadelic_block_title_'. $voc->vid, t('tags in @voc', array('@voc' => $voc->name)));
+      $blocks[$voc->vid]['info'] = variable_get('tagadelic_block_title_'. $voc->vid, t('Tags in @voc', array('@voc' => $voc->name)));
+      $blocks[0]['cache'] = BLOCK_CACHE_GLOBAL;
     }
-    $blocks[0]['info'] = t('tags for the current post');
+    $blocks[0]['info'] = t('Tags for the current post');
+    $blocks[0]['cache'] = BLOCK_CACHE_PER_PAGE;
   }
   elseif ($op == 'configure') {
-    $voc = taxonomy_get_vocabulary($delta);
+    $voc = taxonomy_vocabulary_load($delta);
     $form['title'] = array(
       '#type' => 'textfield',
       '#title' => t('Block title'),
-      '#default_value' => variable_get('tagadelic_block_title_'. $delta, t('tags in @voc', array('@voc' => $voc->name))),
+      '#default_value' => variable_get('tagadelic_block_title_'. $delta, t('Tags in @voc', array('@voc' => $voc->name))),
       '#maxlength' => 64,
       '#description' => t('The title of the block as shown to the user.'),
     );
@@ -378,3 +385,14 @@
   }
   return $blocks;
 }
+
+/**
+ * Implementation of hook_theme
+ */
+function tagadelic_theme() {
+  return array (
+    'tagadelic_list_box' => array('arguments' => array('vocabulary' => NULL, 'tags' => NULL)),
+    'tagadelic_more' => array('arguments' => array('vid' => NULL)),
+    'tagadelic_weighted' => array('arguments' => array('terms' => NULL))
+  );
+}

