Index: tagadelic.info
===================================================================
RCS file: /cvs/drupal/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 14:51:16 -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/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 14:53:25 -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.
Visit example.com/tagadelic/list/2,1,5 to get the vocabularies 2,1 and 5 listed as tag groups.
Visit example.com/tagadelic/chunk/2,1,5 to get a tag cloud of the terms in the vocabularies 2,1 and 5.
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' => t('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' => t('Tags'),
+ 'page callback' => 'tagadelic_page_chunk',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
+ 'type' => MENU_SUGGESTED_ITEM,
+ );
+ $items['tagadelic/list'] = array(
+ 'title' => t('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) {
@@ -183,11 +185,11 @@
function tagadelic_tags_lists($node) {
if (is_array($node->tags)) {
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);
}
@@ -211,7 +213,7 @@
// make sure cache has data
if ($cache->data) {
- $tags = unserialize($cache->data);
+ $tags = $cache->data;
}
else {
@@ -222,7 +224,7 @@
$tags = tagadelic_build_weighted_tags($result, $steps);
- cache_set($cache_name, 'cache', serialize($tags));
+ cache_set($cache_name, $tags);
}
return $tags;
@@ -300,7 +302,7 @@
*/
function theme_tagadelic_weighted($terms) {
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;
}
@@ -335,7 +337,7 @@
*/
function tagadelic_block($op = 'list', $delta = O, $edit = array()) {
if ($op == 'view') {
- if ($voc = taxonomy_get_vocabulary($delta)) {
+ 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);
@@ -354,7 +356,7 @@
$blocks[0]['info'] = t('tags for the current post');
}
elseif ($op == 'configure') {
- $voc = taxonomy_get_vocabulary($delta);
+ $voc = taxonomy_vocabulary_load($delta);
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Block title'),
@@ -378,3 +380,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))
+ );
+}