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 6 Jun 2007 20:53:05 -0000 @@ -1,24 +1,30 @@ type)) { if (variable_get("delicious_crosslink", 0)) { - $links[] = '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; @@ -369,7 +370,7 @@ function delicious_page_tag($tag = "", $ $output = "

" . l(t('View "%n" for all users', array('%n' => $tag)), "delicious/tag/$tag") . "

"; $output .= theme('table', $header, $rows); - $output = "
$output
\n"; + $output = "
$output
\n"; return $output; } @@ -390,7 +391,7 @@ function delicious_page_user($uid = 0) { // 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; } @@ -467,10 +468,10 @@ 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) { +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']); @@ -528,31 +529,43 @@ function delicious_admin_edit($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'; } // @@ -605,13 +618,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) { +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']); } @@ -903,26 +916,14 @@ function _delicious_term_link(&$node) { // smart-tagging support // 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 = "
"; - - 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/', + '$1', + $text + ); } // @@ -1025,5 +1026,5 @@ function theme_delicious_user($uid) { } function _delicious_get_link($obj) { - return "$obj->description"; + return l($obj->description, $obj->href, array ('title' => $obj->extended, 'class' => 'delicious_node'), NULL, NULL, TRUE); } 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 del.icio.us REST web services" +version = "$Name$"