A week ago, I would have just checked the changes in. But it's an acknowledgment to Paul that he's now the maintainer of the module, that he's been actively maintaining the module, and that he should have a look at these before they go in.

The attached patch should be three patches. But given that I almost just checked it in, I'm also lazy enough to not break this out into three patches. So here it is. The patch includes:

  • A change to use placeholders instead of db_escape_string. The use of placeholders is more compact code, and while it is no more secure, it is the current best-practice secure way of doing this.
  • A change to all the list to be themed
  • A few minor code style changes: (a) SQL keywords should be all CAPS, (b) foreach should be followed by a space before the left parenthesis, (c) the php keyword "as" should be lowercase, (d) added a few comments
CommentFileSizeAuthor
#2 195401.patch5.73 KBdouggreen
#1 195401.patch5.14 KBdouggreen
delicious.patch5.14 KBdouggreen

Comments

douggreen’s picture

StatusFileSize
new5.14 KB

minor fix of SQL quotes

douggreen’s picture

StatusFileSize
new5.73 KB

The attached patch fixes an array problem with block->users and block->tags in the re-worked delicious_recent(). It also adds a feature that allows module developers to extend the users and tags at run time by adding a callback to hook_delicious.

douggreen’s picture

And yet another update so that the newly implemented hook_delicious returns the values.

Below is an example of how to use this. It implements two different scenarios in a custom module. The first scenario (the first case statement) alters the block on a node page to display only the delicious tags associated with node's taxonomy. The second scenario (case statement) alters the block on the search page to only display the delicious tags associated with the current search terms.

function example_delicious($op, &$items) {
  if ($op == 'tags') {
    switch (arg(0)) {
      case 'node':
        $tags = array();
        if (($nid = arg(1)) && !arg(2)) {
          $node = node_load($nid);
          foreach ($node->taxonomy as $tid => $term) {
            $tags[$term->name] = $term->name;
          }
        }
        return $tags;
      case 'search':
        $query = search_parse_query(search_get_keys());
        return $query[3];
    }
  }
}
douggreen’s picture

Assigned: Unassigned » douggreen
Status: Reviewed & tested by the community » Fixed

@paul, I went ahead and checked these in. Sorry for not waiting for your review on this. I'm on a tight client deadline, and I had some other patches to check in that are related. I hope that this issue is cleanly documented for you, and that all these changes are acceptable for you.

Anonymous’s picture

Hi Doug ,

I appreciate the gestures here but I think someone with your background and experience there is no problem for me in you documenting your changes and commiting straight away.

Regards Paul

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.