Index: delicious.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/delicious/delicious.install,v
retrieving revision 1.1
diff -u -w -B -F^f -r1.1 delicious.install
--- delicious.install	24 Jul 2006 01:12:36 -0000	1.1
+++ delicious.install	14 Jun 2007 22:25:14 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: delicious.install,v 1.1 2006/07/24 01:12:36 eaton Exp $
+// $Id: delicious.install 130 2007-06-14 22:25:46Z ax $
 
 /**
  * Implementation of hook_install().
@@ -64,3 +64,20 @@ function delicious_install() {
       break;
   }
 }
\ No newline at end of file
+
+/**
+ * Add 'shared' column to 'delicious_link' table.
+ */
+function delicious_update_1050() {
+  $ret = array();
+  switch ($GLOBALS['db_type']) {
+    case 'mysql':
+    case 'mysqli':
+      $ret[] = update_sql('ALTER TABLE {delicious_link} ADD shared INT NOT NULL DEFAULT 1');
+      break;
+    case 'pgsql':
+      break;
+  }
+  return $ret;
+}
+
Index: delicious.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/delicious/delicious.module,v
retrieving revision 1.25
diff -u -w -B -F^f -r1.25 delicious.module
--- delicious.module	24 Jul 2006 01:12:36 -0000	1.25
+++ delicious.module	14 Jun 2007 22:25:52 -0000
@@ -1,58 +1,60 @@
 <?php
-// delicious.module for drupal 4.6
-// originally by: Benjamin Grant (bgrant@1361b.net)
-// maintained by: Earl Miles (merlin@logrus.com)
-// $Id
-
-// contributions:
-//
-// patch from mark leicester implementing /delicious module page
-// "smart tagging" ported from jonathan deutsch's wordpress plugin
-//
-// Significant rewrites by Earl Miles (merlinofchaos) to allow multiple
-// users, database the tags, make the code conform to coding conventions
-// and finished a bunch of todo items that were listed in the code.
-
-// ----------------------------------------------------------------------------
-// Defines
-
-// SET up AS a define because the API docs say this is likely to change at some point.
-define(DELICIOUS_BASE_URL, 'http://del.icio.us/');
-define(DELICIOUS_API_URL, 'http://del.icio.us/api/');
-define(DELICIOUS_UPDATE_URL, 'posts/update');
-define(DELICIOUS_POSTS_URL, 'posts/all');
-
-// ----------------------------------------------------------------------------
-// Drupal hooks
-
-//
-//  _help() hook
-//
-function delicious_help($section = "admin/help#delicious") {
-  $output = "";
+// $Id: delicious.module 130 2007-06-14 22:25:46Z ax $
 
-  if (substr($section, 0, 4) == 'user' && substr($section, -9) == 'delicious')
-  {
+/** 
+ * @file
+ *
+ * delicious.module for Drupal
+ *
+ * originally by: Benjamin Grant (bgrant@1361b.net)
+ * maintained by: Earl Miles (merlin@logrus.com)
+ *
+ * contributions:
+ *
+ * patch from mark leicester implementing /delicious module page
+ * "smart tagging" ported from jonathan deutsch's wordpress plugin
+ *
+ * Significant rewrites by Earl Miles (merlinofchaos) to allow multiple
+ * users, database the tags, make the code conform to coding conventions
+ * and finished a bunch of todo items that were listed in the code.
+ */
+
+/**
+ * @name Defines
+ * 
+ * SET up AS a define because the API docs say this is likely to change at some point.
+ * 
+ * @{
+ */
+define('DELICIOUS_BASE_URL', 'http://del.icio.us/');
+define('DELICIOUS_API_URL', 'https://api.del.icio.us/v1/');
+define('DELICIOUS_UPDATE_URL', 'posts/update');
+define('DELICIOUS_POSTS_URL', 'posts/all');
+// @} End of @name Defines
+
+/**
+ * @name Drupal hooks
+ * 
+ * @{
+ */
+
+/**
+ * Implementation of hook_help().
+ */
+function delicious_help($section = "admin/help#delicious") {
+  if (substr($section, 0, 4) == 'user' && substr($section, -9) == 'delicious') {
       return t('Enabling the delicious module and providing a valid username and password will allow this site to synchronize your del.icio.us bookmarks once an hour (or whenever cron is run).');
   }
-
-  switch ($section) {
-    case 'admin/help#delicious':
-      $output = t("Provides integration with del.icio.us REST web services");
-      break;
-
-    case 'admin/modules#description':
-      $output = t("Provides integration with del.icio.us REST web services");
-      break;
+  if ($section == 'admin/help#delicious') {
+    return t("Provides integration with del.icio.us REST web services");
   }
-
-  return $output;
 }
 
-//
-// _link() hook
-//
-// Add a link, if necessary, to the links section of a node
+/**
+ * Implementation of hook_link().
+ *
+ * Add a link, if necessary, to the links section of a node.
+ */
 function delicious_link($type, $node = 0, $main) {
   global $user;
 
@@ -63,20 +65,20 @@ function delicious_link($type, $node = 0
 
   if ($type == 'node' && _delicious_nodetype_applicable($node->type)) {
     if (variable_get("delicious_crosslink", 0)) {
-      $links[] = '<a href="' . _delicious_term_link($node) . 'del.icio.us links</a>';
+      $links['delicious'] = array('title' => 'find similar content on del.icio.us','href' =>  _delicious_term_link($node)); 
     }
   }
 
   return $links;
 }
 
-//
-// _settings() hook
-//
-function delicious_settings() {
+/**
+ * Implementation of hook_settings().
+ */
+function delicious_admin_settings() {  
 
   // Build a list of node types
-  foreach (node_list() AS $type) {
+    foreach (node_get_types() AS $type => $name) { 
     $node_type = node_invoke($type, 'node_name');
     $nodes[$type] = $node_type ? $node_type : $type;
   }
@@ -101,19 +103,19 @@ function delicious_settings() {
     '#options' => $nodes,
     '#description' => t('SELECT all node types that allow crosslinking and/or smarttagging.'),
   );
-  return $form;
+  return system_settings_form($form);
 }
 
-//
-// _perm() hook
-//
+/**
+ * Implementation of hook_perm().
+ */
 function delicious_perm() {
   return array ('view delicious links', 'create delicious links', 'administer delicious');
 }
 
-//
-// _menu() hook
-//
+/**
+ * Implementation of hook_menu().
+ */
 function delicious_menu($may_cache) {
   $items = array();
   global $user;
@@ -144,9 +146,12 @@ function delicious_menu($may_cache) {
     $items[] = array(
       'path' => 'admin/settings/delicious',
       'title' => t('delicious settings'),
-      'access' => user_access('administer delicious'),
-      'callback' => 'delicious_settings',
-      'type' => MENU_ITEM
+      'description' => t('Delicious Mmmm.'),
+      'access' => user_access('administer site configuration'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('delicious_admin_settings'),
+      'type' => MENU_NORMAL_ITEM
+
     );
     $items[] = array(
       'path' => 'admin/delicious',
@@ -211,16 +216,16 @@ function delicious_menu($may_cache) {
 
 	  // provide CSS information about actuators (stolen from taxonomy_dhtml basically)
 	  $module = drupal_get_path('module', 'delicious');
-	  theme_add_style($module . '/delicious.css');
+	  drupal_add_css($module . '/delicious.css');
 	  drupal_add_js($module . '/delicious.js');
   }
   
   return $items;
 }
  
-//
-// _nodeapi() hook
-//
+/**
+ * Implementation of hook_nodeapi().
+ */
 // Smart-tag nodes if that functionality is turned on.
 function delicious_nodeapi(&$node, $op, $arg = 0) {
   if (!_delicious_nodetype_applicable($node->type))
@@ -235,8 +240,12 @@ function delicious_nodeapi(&$node, $op, 
           $uname = db_result(db_query("SELECT user FROM {delicious_user} WHERE uid=$node->uid"));
         }
         if ($uname) {
-          $node->body = _delicious_tag_text($node->body, $uname);
-          $node->teaser = _delicious_tag_text($node->teaser, $uname);
+          if ($node->content['teaser']) {
+            $node->content['teaser'] = array('#value' => _delicious_tag_text($node->teaser, $uname), '#weight' => 10);
+          }
+          if ($node->content['body']) {
+            $node->content['body'] = array('#value' => _delicious_tag_text($node->body, $uname), '#weight' => 10 );
+          }
         }
       } 
       break;
@@ -245,9 +254,9 @@ function delicious_nodeapi(&$node, $op, 
   return;
 }
 
-//
-// _cron() hook
-//
+/**
+ * Implementation of hook_cron().
+ */
 function delicious_cron() {
   $result = db_query("SELECT DISTINCT(u.uid), u.name, d.user, d.pass, d.lastupdate, d.lastcode FROM {users} u INNER JOIN {delicious_user} d ON u.uid = d.uid");
   while ($u = db_fetch_object($result)) {
@@ -261,9 +270,9 @@ function delicious_cron() {
 
 }
 
-//
-// _block() hook
-//
+/**
+ * Implementation of hook_block().
+ */
 function delicious_block($op = 'list', $delta = 0) {
   if (!user_access('view delicious links'))
     return;
@@ -282,14 +291,17 @@ function delicious_block($op = 'list', $
     return $block;
   }
 }
+// @} End of @name Drupal hooks
 
-// ----------------------------------------------------------------------------
-// callbacks (and support), mostly for displaying information
-//
-
-//
-// Display delicious overview (a page of all users with delicious tags)
-//
+/**
+ * @name callbacks (and support), mostly for displaying information
+ *
+ * @{
+ */
+
+/**
+ * Display delicious overview (a page of all users with delicious tags)
+ */
 function delicious_page() {
   $result = pager_query("SELECT u.name, du.uid, COUNT(dt.uid) AS linkcount FROM {delicious_user} du LEFT JOIN {delicious_tag} dt ON du.uid = dt.uid LEFT JOIN {users} u on du.uid = u.uid GROUP BY dt.uid ORDER BY u.name", 20, $count_query="select count(distinct(uid)) from {delicious_user}");
 
@@ -316,9 +328,9 @@ function delicious_page() {
   return $output;
 }
 
-//
-// render a list of all user's links for a given tag
-//
+/**
+ * render a list of all user's links for a given tag
+ */
 function delicious_page_tag($tag = "", $uid = "") {
   if (!$tag) {
     return delicious_page();
@@ -369,14 +381,14 @@ function delicious_page_tag($tag = "", $
     $output = "<p>" . l(t('View "%n" for all users', array('%n' => $tag)), "delicious/tag/$tag") . "</p>";
 
   $output .= theme('table', $header, $rows);
-  $output = "<div class=delicious-tag>$output</div>\n";
+  $output = "<div class=\"delicious-tag\">$output</div>\n";
 
   return $output;
 }
 
-//
-// Render a user's tag and links with javascript actuators
-//
+/**
+ * Render a user's tag and links with javascript actuators
+ */
 function delicious_page_user($uid = 0) {
   $output = theme('delicious_user', $uid);
   if (!$output)
@@ -385,18 +397,18 @@ function delicious_page_user($uid = 0) {
   return $output;
 }
 
-//
-// render/handle user specific settings page
-//
+/**
+ * render/handle user specific settings page
+ */
 function delicious_page_settings() {
   $uid = arg(1);
-  $output = delicious_page_settings_form($uid, $existence);
+  $output = drupal_get_form('delicious_page_settings_form',$uid);  
   return $output;
 }
 
-//
-// render user specific delicious settings form
-//
+/**
+ * render user specific delicious settings form
+ */
 function delicious_page_settings_form($uid) {
   // Check to see if a delicious_user entry exists
   $result = db_query("SELECT * FROM {delicious_user} WHERE uid = %d", $uid);
@@ -467,10 +479,13 @@ function delicious_page_settings_form($u
     );
   }
   
-  return drupal_get_form('delicious_page_settings', $form);
+  return $form;
 }
 
-function delicious_page_settings_submit($form_id, $form_values) {
+/**
+ * submission handling for delicious_page_settings_form()
+ */
+function delicious_page_settings_form_submit($form_id, $form_values) {
   if ($_POST['op'] == t('Enable')) {
     // create a delicious_user entry
     $result = db_query("INSERT INTO {delicious_user} (uid) VALUES (%d)", $form_values['uid']);
@@ -486,14 +501,17 @@ function delicious_page_settings_submit(
     drupal_set_message(t("Settings updated."));
   }
 }
+// @} End of @name callbacks (and support), mostly for displaying information
 
-// ----------------------------------------------------------------------------
-// block admin, support and render
-// 
-
-//
-// render admin page
-//
+/**
+ * @name block admin, support and render
+ *
+ * @{
+ */
+
+/**
+ * render admin page
+ */
 function delicious_admin() {
   $result = pager_query("SELECT dbid, title, maxentries FROM {delicious_block} ORDER BY title", 20);
 
@@ -520,44 +538,56 @@ function delicious_admin() {
   return $output;
 }
 
-//
-// render block add or edit page, and/or handle results
-//
+/**
+ * render block add or edit page, and/or handle results
+ */
 function delicious_admin_edit($block = 0) {
   if (arg(2) == 'edit' && (!is_numeric($block) || $block == 0))  {
     return drupal_access_denied();
   }
 
-  $output = delicious_block_form($block);
+  $output = drupal_get_form('delicious_block_form',$block);
 
   return $output;
 }
 
+
+function delicious_admin_delete_confirm_submit($form_id, $form_values) {
+  if ($form_values['confirm']) {
+    delicious_delete_block($form_values['block']);
+  }
+  return 'admin/delicious';
+}
+
 function delicious_admin_delete($dbid = 0) {
   $block = delicious_load_block($dbid);
   if ($block['title'] == '') {
     return drupal_access_denied();
   }
 
+  return drupal_get_form('delicious_admin_delete_confirm', $dbid);
+}
+
+function delicious_admin_delete_confirm_page() {
+  return drupal_get_form('delicious_admin_delete_confirm', arg(1));
+}
+
+function delicious_admin_delete_confirm($dbid){
+
+
   $form['block'] = array('#type' => 'value', '#value' => $dbid);
-  return confirm_form('delicious_admin_delete_confirm', $form,
+  return confirm_form($form,
     t('Are you sure you want to delete %title?', array('%title' => $block['title'])), 
     $_GET['destination'] ? $_GET['destination'] : 'admin/delicious', 
     t('This action cannot be undone.'),
     t('Delete'), t('Cancel')  
   );
-}
 
-function delicious_admin_delete_confirm_submit($form_id, $form_values) {
-  if ($form_values['confirm']) {
-    delicious_delete_block($form_values['block']);
-  }
-  return 'admin/delicious';
 }
 
-//
-// display add/edit block form
-//
+/**
+ * display add/edit block form
+ */
 function delicious_block_form($dbid = 0) {
   $block = delicious_load_block($dbid);
 
@@ -605,13 +635,13 @@ function delicious_block_form($dbid = 0)
     );
   }
 
-  return drupal_get_form('delicious_block_edit', $form);
+  return $form ; 
 }
 
-//
-// save block to db
-//
-function delicious_block_edit_submit($form_id, $form_values) {
+/**
+ * save block to db
+ */
+function delicious_block_form_submit($form_id, $form_values) {
   if ($form_values['dbid']) {
     db_query("UPDATE {delicious_block} SET title='%s', users='%s', tags='%s', maxentries=%d WHERE dbid=%d", $form_values['title'], $form_values['users'], $form_values['tags'], $form_values['maxentries'], $form_values['dbid']);
   }
@@ -622,24 +652,25 @@ function delicious_block_edit_submit($fo
   return 'admin/delicious';
 }
 
-//
-// load block from db
-//
+/**
+ * load block from db
+ */
 function delicious_load_block($block) {
   $obj = db_fetch_array(db_query("SELECT * FROM {delicious_block} WHERE dbid=%d", $block));
   return $obj;
 }
 
-//
-// delete a block from db
-//
+/**
+ * delete a block from db
+ */
 function delicious_delete_block($block) {
   db_query("DELETE FROM {delicious_block} WHERE dbid=%d", $block);
 }
 
-//
-// render recent links for _block() hook
-//
+/**
+ * render recent links for _block() hook
+ * TODO: make this themeable
+ */
 function delicious_recent($id) {
 
   $block = db_fetch_object(db_query("SELECT * FROM {delicious_block} WHERE dbid=%d", $id));
@@ -648,7 +679,7 @@ function delicious_recent($id) {
     $ulist = explode(',', $block->users);
     foreach ($ulist AS $user) {
       if (!$users) {
-        $users = "u.name in (";
+        $users = "u.name IN (";
       } 
       else {
         $users .= ", ";
@@ -662,7 +693,7 @@ function delicious_recent($id) {
     $ulist = explode(',', $block->tags);
     foreach ($ulist AS $tag) {
       if (!$tags) {
-        $tags = "dt.name in (";
+        $tags = "dt.name IN (";
       } 
       else {
         $tags .= ", ";
@@ -674,19 +705,28 @@ function delicious_recent($id) {
 
   if ($users || $tags)
   {
-    $where = "where ";
+    $where = "WHERE ";
     if ($users)
       $where .= "$users ";
     if ($users && $tags)
-      $where .= "and ";
+      $where .= "AND ";
     if ($tags)
       $where .= "$tags ";
   }
 
-  $result = db_query_range("SELECT distinct(dl.description), dl.href FROM {delicious_link} dl LEFT JOIN {delicious_tag} dt ON dl.lid = dt.lid LEFT JOIN {users} u ON dl.uid = u.uid $where ORDER BY dl.linktime desc", 0, intval($block->maxentries));
+	// show private links only to owners
+	$where .= " AND (shared OR dl.uid = {$GLOBALS[user]->uid})";
 
+  $result = db_query_range("SELECT distinct(dl.description), dl.href, dl.linktime FROM {delicious_link} dl LEFT JOIN {delicious_tag} dt ON dl.lid = dt.lid LEFT JOIN {users} u ON dl.uid = u.uid $where ORDER BY dl.linktime desc", 0, intval($block->maxentries));
+
+  $output = '';
+  $day = '';
   while ($link = db_fetch_object($result)) {
-    $output .= "<li> " . _delicious_get_link($link) . "</li>";
+    if (($day_new = strftime('%x', $link->linktime)) != $day) {
+      $day = $day_new;
+      $output .= "\n$day\n"; // todo: make this valid html, ie. a nested ul list
+    }
+    $output .= "<li> " . _delicious_get_link($link) . "</li>\n";
   }
 
   if ($output) {
@@ -694,14 +734,19 @@ function delicious_recent($id) {
   }
   return array("content" => $output, "subject" => $block->title);
 }
+// @} End of @name block admin, support and render
 
-// ----------------------------------------------------------------------------
-// REST calls to del.icio.us API
-//
-
-//
-// drupal_http_support etc FROM alastair tse
-//
+/**
+ * @name REST calls to del.icio.us API
+ *
+ * @{
+ */
+
+/**
+ * drupal_http_support etc FROM alastair tse
+ *
+ * @private
+ */
 function _delicious_make_auth_header($username, $password) {
   $realm = "del.icio.us API";
   $user_agent = "drupal.contributions.delicious.module/1.0";
@@ -714,9 +759,11 @@ function _delicious_make_auth_header($us
   return $headers;
 }
 
-//
-// get a page FROM the delicious API
-//
+/**
+ * get a page FROM the delicious API
+ *
+ * @private
+ */
 function _delicious_get_page($page, $user, $pass) {
   // Force 1 second throttle.
   global $lastDeliciousHit;
@@ -728,9 +775,11 @@ function _delicious_get_page($page, $use
     _delicious_make_auth_header($user, $pass));
 }
 
-//
-// cron support: update all users who have Delicious Links
-//
+/**
+ * cron support: update all users who have Delicious Links
+ *
+ * @private
+ */
 function _delicious_update_user($user) {
   $resp = _delicious_get_page(DELICIOUS_UPDATE_URL, $user->user, $user->pass);
   $resp->code = intval($resp->code);
@@ -760,16 +809,22 @@ function _delicious_update_user($user) {
 
   return 0;
 }
+// @} End of@name REST calls to del.icio.us API
 
-// ----------------------------------------------------------------------------
-// XML parsing objects
-//
-// If another object gets created, refactor some of the code into a base object
-// and inherit
-
-//
-// parse the update string
-//
+/**
+ * @name XML parsing objects
+ *
+ * If another object gets created, refactor some of the code into a base object
+ * and inherit
+ *
+ * @{
+ */
+
+/**
+ * parse the update string
+ *
+ * @private
+ */
 class _delicious_update_parser {
 
   function parse($data) {
@@ -801,10 +856,12 @@ function _delicious_update_user($user) {
 
 }
 
-//
-// parse all posts, and write them to the database; delete all unsynced
-// posts for that user.
-//
+/**
+ * parse all posts, and write them to the database; delete all unsynced
+ * posts for that user.
+ *
+ * @private
+ */
 class _delicious_post_parser {
 
   function _delicious_post_parser($uid = 0) {
@@ -841,11 +898,12 @@ function _delicious_update_user($user) {
       }
       $hash = $attrs["HASH"];
       $time = _delicious_date_parse($attrs["TIME"]); // yay we gotta parse this don't we?
+			$shared = !isset($attrs["SHARED"]);
 
       $obj = db_fetch_object(db_query("SELECT * FROM {delicious_link} WHERE hash='%s'", $hash));
       if ($obj)
       {
-        db_query("UPDATE {delicious_link} SET synced=1, description='%s', extended='%s', href='%s', linktime='%s' WHERE hash='%s'", $desc, $extended, $href, $time, $hash);
+        db_query("UPDATE {delicious_link} SET synced=1, description='%s', extended='%s', href='%s', linktime='%s', shared=%d WHERE hash='%s'", $desc, $extended, $href, $time, $hash, $shared);
         foreach($tags AS $tag)
         {
           $tagobj = db_fetch_object(db_query("SELECT * FROM {delicious_tag} WHERE lid=$obj->lid and name='$tag'"));
@@ -858,7 +916,7 @@ function _delicious_update_user($user) {
       else
       {
         $lid = db_next_id("{delicious_link}_lid");
-        db_query("INSERT INTO {delicious_link} (lid, uid, href, description, extended, linktime, hash, synced) VALUES (%d, %d, '%s', '%s', '%s', %d, '%s', 1)", $lid, $this->uid, $href, $desc, $extended, $time, $hash);
+        db_query("INSERT INTO {delicious_link} (lid, uid, href, description, extended, linktime, hash, synced, shared) VALUES (%d, %d, '%s', '%s', '%s', %d, '%s', 1, %d)", $lid, $this->uid, $href, $desc, $extended, $time, $hash, $shared);
         
         foreach($tags AS $tag)
         {
@@ -872,12 +930,19 @@ function _delicious_update_user($user) {
   }
 }
 
-// ----------------------------------------------------------------------------
-// smart/crosslinking stuff and general support
+// @} End of @name XML parsing objects
 
-//
-// render a link to the node's first term if present for crosslinking
-//
+/**
+ * @name smart/crosslinking stuff and general support
+ *
+ * @{
+ */
+
+/**
+ * render a link to the node's first term if present for crosslinking
+ *
+ * @private
+ */
 function _delicious_term_link(&$node) {
   $terms = taxonomy_node_get_terms($node->nid);
   $term = $terms[0]->name;
@@ -899,35 +964,27 @@ function _delicious_term_link(&$node) {
   return $url;
 }
 
-//
-// smart-tagging support
-//
+/**
+ * smart-tagging support
+ *
+ * @private
+ */
 function _delicious_tag_string($text, $tags, $username) {
-
-  if (!$tags)
-    return $text;
-
-  // error, it must start with a tag... :-(
-  foreach ($tags AS $tag) {
-    if (!empty($tag) && $tag != ' ') {
-      $path = DELICIOUS_BASE_URL . urlencode($username) . '/' .urlencode($tag);
+  // TODO: url checking
+  // TODO: cache this! what about a filter?
       $modulepath = drupal_get_path('module', 'delicious');
-      $deliciousLink = "<a href='$path'><img src='$modulepath/deliciousIcon.gif' class='delicious-icon'></a>";
-      
-      if (!preg_match('/<.+>/',$text)) {
-        $text = preg_replace('/(\b'.$tag.'\b)/i','$1'.$deliciousLink,$text);
-      } else {
-        $text = preg_replace('/(?<=>)([^<]+)?(\b'.$tag.'\b)/i','$1$2'.$deliciousLink,$text);
-      }
-    } 
-  }
-
-  return $text;
+  return preg_replace(
+    '/\b('. implode('|', array_map('preg_quote', $tags)) .')\b/',
+    '<a href="'. DELICIOUS_BASE_URL . $username .'/$1'.'"><img src="'. $modulepath .'/deliciousIcon.gif" class="delicious-icon">$1</a>',
+    $text
+  );
 }
 
-//
-// support function for tagged text
-//
+/**
+ * support function for tagged text
+ *
+ * @private
+ */
 function _delicious_tag_text($text, $name) {
   $result = db_query("SELECT distinct(name) FROM {delicious_tag}");
   while ($tag = db_fetch_object($result)) {
@@ -936,9 +993,11 @@ function _delicious_tag_text($text, $nam
   return _delicious_tag_string($text, $tags, $name);
 }
 
-//
-// General configuration support
-//
+/**
+ * General configuration support
+ *
+ * @private
+ */
 function _delicious_nodetype_applicable($type) {
   $del = variable_get('delicious_node_types', array('blog', 'story', 'page'));
   if (!is_array($del))
@@ -947,16 +1006,30 @@ function _delicious_nodetype_applicable(
     return in_array($type, $del);
 }
 
-// Translate delicious dates into normal dates
+/**
+ * Translate delicious dates into normal dates
+ *
+ * @private
+ */
 function _delicious_date_parse($date) {
     $date = str_replace('T', ' ', $date);
     $date = str_replace('Z', ' ', $date);
     return strtotime($date);
 }
 
-//
-// theming function
-//
+/**
+ * @private
+ */
+function _delicious_get_link($obj) {
+  return l($obj->description, $obj->href, array ('title' => format_date($obj->linktime), 'class' => 'delicious_node'), NULL, NULL, TRUE);
+}
+// @} End of @name smart/crosslinking stuff and general support
+
+/**
+ * theming function
+ *
+ * @ingroup themeable
+ */
 function theme_delicious_user($uid) {
   global $numActuators;
 
@@ -1023,7 +1096,3 @@ function theme_delicious_user($uid) {
 
   return $output;
 }
-
-function _delicious_get_link($obj) {
-  return "<a href='$obj->href' title='$obj->extended' class='delicious_node'>$obj->description</a>";
-}
Index: delicious.info
===================================================================
RCS file: delicious.info
diff -u -w -B -F^f -N delicious.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ delicious.info	2007-06-03 17:01:53.000000000 +0000
@@ -0,0 +1,4 @@
+; $Id$
+name = delicious
+description = "Provides integration with <a href="http://del.icio.us/help/api/">del.icio.us REST web services</a>"
+version = "$Name$"
