Index: hcard.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/hcard/hcard.info,v
retrieving revision 1.1.4.1
diff -u -p -r1.1.4.1 hcard.info
--- hcard.info	21 Dec 2008 01:12:39 -0000	1.1.4.1
+++ hcard.info	11 Jan 2011 22:25:15 -0000
@@ -1,4 +1,7 @@
 ; $Id: hcard.info,v 1.1.4.1 2008/12/21 01:12:39 shawndearmond Exp $
 name = hCard
 description = Creates a site-wide hcard block.
-core = 6.x
\ No newline at end of file
+core = 7.x
+files[] = hcard.install
+files[] = hcard.module
+files[] = hcard.tpl.php
Index: hcard.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/hcard/Attic/hcard.install,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 hcard.install
--- hcard.install	4 Jun 2010 02:25:56 -0000	1.1.2.2
+++ hcard.install	11 Jan 2011 22:25:15 -0000
@@ -7,7 +7,7 @@
  */
 
 /**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
  */
 function hcard_uninstall() {
   variable_del('hcard');
@@ -24,8 +24,12 @@ function hcard_update_6100(&$sandbox) {
     $perm = explode(', ', $permission->perm);
     if (in_array('administer site configuration', $perm)) {
       $update_permissions = $permission->perm . ', administer hcard information';
-      $ret[] = update_sql("UPDATE {permission} SET perm = '$update_permissions' WHERE pid = {$permission->pid} AND rid = {$permission->rid}");
+      // TODO update_sql has been removed. Use the database API for any schema or data changes.
+      $ret[] = array() /* update_sql("UPDATE {permission} SET perm = '$update_permissions' WHERE pid = {$permission->pid} AND rid = {$permission->rid}") */;
     }
   }
-  return $ret;
+  // hook_update_N() no longer returns a $ret array. Instead, return
+  // nothing or a translated string indicating the update ran successfully.
+  // See http://drupal.org/node/224333#update_sql.
+  return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
 }
Index: hcard.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/hcard/hcard.module,v
retrieving revision 1.1.4.3
diff -u -p -r1.1.4.3 hcard.module
--- hcard.module	4 Jun 2010 02:25:56 -0000	1.1.4.3
+++ hcard.module	11 Jan 2011 22:25:16 -0000
@@ -7,50 +7,56 @@
  */
 
 /**
- * Implementation of hook_help().
+ * Implements hook_help().
  */
 function hcard_help($path, $arg) {
   switch ($path) {
     case 'admin/help#hcard':
-      $output = '<p>'. t("The hcard is a small bundle of code that you want to put on your web site so that Google Local (and other local search engines) can more easily index the site's location information.") .'</p>';
-      $output .= '<p>'. t('Configure your hcard block at the hcard settings page.') .'</p>';
+      $output = '<p>' . t("The hcard is a small bundle of code that you want to put on your web site so that Google Local (and other local search engines) can more easily index the site's location information.") . '</p>';
+      $output .= '<p>' . t('Configure your hcard block at the hcard settings page.') . '</p>';
       return $output;
-    case 'admin/settings/hcard':
-      return '<p>'. t('Enter your site\'s information into the appropriate fields.') .'</p>';
+
+    case 'admin/config/system/hcard':
+      return '<p>' . t('Enter your site\'s information into the appropriate fields.') . '</p>';
   }
 }
 
 /**
- * Implementation of hook_perm().
+ * Implements hook_permission().
  */
-function hcard_perm() {
-  return array('administer hcard information');
+function hcard_permission() {
+  return array(
+    'administer hcard information' => array(
+      'title' => t('Administer hcard information'),
+      'description' => t('Edit information presented in the hcard block.'),
+    ),
+  );
 }
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function hcard_menu() {
-    $items['admin/settings/hcard'] = array(
-      'title' => 'hCard',
-      'description' => 'Configure the hCard block.',
-      'page callback' => 'drupal_get_form',
-      'page arguments' => array('hcard_admin_settings'),
-      'access arguments' => array('administer hcard information'),
-    );
+  $items['admin/config/system/hcard'] = array(
+    'title' => 'hCard',
+    'description' => 'Configure the hCard block.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('hcard_admin_settings'),
+    'access arguments' => array('administer hcard information'),
+  );
   return $items;
 }
 
 /**
- * Implementation of hook_theme().
+ * Implements hook_theme().
  */
 function hcard_theme($existing, $type, $theme, $path) {
   return array(
     'hcard_admin_settings' => array(
-      'arguments' => array('form' => NULL),
+      'render element' => 'form',
     ),
     'hcard' => array(
-      'arguments' => array(
+      'variables' => array(
         'hcard' => NULL,
         'given_name' => NULL,
         'family_name' => NULL,
@@ -66,7 +72,7 @@ function hcard_theme($existing, $type, $
         'phones' => array(),
         'faxes' => array(),
         'category_links' => array(),
-        ),
+      ),
       'template' => 'hcard',
     ),
   );
@@ -78,16 +84,16 @@ function hcard_theme($existing, $type, $
  *        $variable['hcard'] is equivalent to variable_get('hcard', array())
  */
 function template_preprocess_hcard(&$variables) {
-// Creates a randomizer seed based on the month and the length of the current URL.
-// This is used to randomize the categories so that they're different on every page,
-// but the output on any particular display only changes once per month.
+  // Creates a randomizer seed based on the month and the length of the current URL.
+  // This is used to randomize the categories so that they're different on every page,
+  // but the output on any particular display only changes once per month.
   $month = date("n");
   $path = request_uri();
   $nid = is_numeric(arg(1)) ? arg(1) : 1;
   $seed = drupal_strlen($path) * $month * $nid;
   srand($seed);
 
-// Build $variables from scratch
+  // Build $variables from scratch
   $hcard = $variables['hcard'];
   $variables['given_name'] = $hcard['fn_n']['given-name'] ? l($hcard['fn_n']['given-name'], '<front>') : NULL;
   $variables['family_name'] = $hcard['fn_n']['family-name'] ? l($hcard['fn_n']['family-name'], '<front>') : NULL;
@@ -100,7 +106,7 @@ function template_preprocess_hcard(&$var
   $variables['longitude'] = check_plain($hcard['longitude']);
   $variables['latitude'] = check_plain($hcard['latitude']);
 
-// Generates the output for the 'tagline' variable.
+  // Generates the output for the 'tagline' variable.
   if ($hcard['tagline']['tag']) {
     $tag_list = check_plain($hcard['tagline']['tag_list']);
     $tag_list = explode(',', $tag_list);
@@ -109,27 +115,27 @@ function template_preprocess_hcard(&$var
     $tag_links = array();
     foreach ($tag_list as $tag) {
       $counter++;
-      $tag_links['!'. $counter] = l($tag, '<front>');
+      $tag_links['!' . $counter] = l($tag, '<front>');
     }
     $tag = check_plain($hcard['tagline']['tag']);
     $variables['tagline'] = t($tag, $tag_links);
   }
 
-// Generates the output for the 'phones' variable.
+  // Generates the output for the 'phones' variable.
   if ($hcard['phone']['voice']) {
     $phone_text = check_plain($hcard['phone']['voice']);
     $phones = explode(',', $phone_text);
     $variables['phones'] = array_map('trim', $phones);
   }
 
-// Generates the output for the 'faxes' variable.
+  // Generates the output for the 'faxes' variable.
   if ($hcard['phone']['fax']) {
     $fax_text = check_plain($hcard['phone']['fax']);
     $faxes = explode(',', $fax_text);
     $variables['faxes'] = array_map('trim', $faxes);
   }
 
-// Generates the output for the 'category_links' variable.
+  // Generates the output for the 'category_links' variable.
   if ($hcard['categories']) {
     $categories_text = check_plain($hcard['categories']);
     $categories = explode(',', $categories_text);
@@ -141,13 +147,44 @@ function template_preprocess_hcard(&$var
     shuffle($category_links);
     $variables['category_links'] = $category_links;
   }
+
+  // Generate ID
+  $id = 'hcard';
+  $id .= !empty($hcard['fn_n']['given-name']) ? '-' . check_plain($hcard['fn_n']['given-name']) : '';
+  $id .= !empty($hcard['fn_n']['family-name']) ? '-' . check_plain($hcard['fn_n']['family-name']) : '';
+  $variables['id'] = drupal_html_id($id);
 }
 
 /**
  * hCard settings form.
  */
-function hcard_admin_settings() {
-  $default_values = variable_get('hcard', array());
+function hcard_admin_settings($form, &$form_state) {
+  $default = array(
+    'fn_n' => array(
+      'given-name' => '',
+      'family-name' => '',
+    ),
+    'org' => '',
+    'tagline' => array(
+      'tag' => '',
+      'tag_list' => '',
+    ),
+    'adr' => array(
+      'street-address' => '',
+      'locality' => '',
+      'region' => '',
+      'postal-code' => '',
+      'country-name' => '',
+    ),
+    'longitude' => '',
+    'latitude' => '',
+    'phone' => array(
+      'voice' => '',
+      'fax' => '',
+    ),
+    'categories' => '',
+  );
+  $default_values = variable_get('hcard', $default);
   $form = array();
   $form['#tree'] = TRUE;
   $form['hcard']['fn_n'] = array(
@@ -180,7 +217,7 @@ function hcard_admin_settings() {
     '#title' => t('Tagline'),
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
-    '#description' => t('(Examples below will produce: "Locally owned and serving !1, !2, and all of !3.")', array('!1' => l('Woodland', '<front>'), '!2' => l('the community', '<front>'), '!3' => l('Yolo County CA', '<front>'), )),
+    '#description' => t('(Examples below will produce: "Locally owned and serving !1, !2, and all of !3.")', array('!1' => l('Woodland', '<front>'), '!2' => l('the community', '<front>'), '!3' => l('Yolo County CA', '<front>'))),
   );
   $form['hcard']['tagline']['tag'] = array(
     '#type' => 'textfield',
@@ -281,41 +318,43 @@ function hcard_admin_settings() {
 }
 
 /**
- * Implementation of hook_block().
+ * Implements hook_block_info().
  */
-function hcard_block($op = 'list', $delta = 0, $edit = array()) {
-  switch ($op) {
-    case 'list':
-      $blocks[0] = array(
-        'info' => 'hCard',
-        'weight' => 10,
-        'enabled' => 1,
-        'region' => 'footer'
-      );
-      return $blocks;
-    case 'view':
-      $block = array();
-      switch ($delta) {
-        case 0:
-          $hcard = variable_get('hcard', array());
-          if ($hcard) {
-            $block = array(
-              'subject' => '',
-              'content' => theme('hcard', $hcard),
-            );
-          }
-        return $block;
+function hcard_block_info() {
+  $blocks['hcard'] = array(
+    'info' => 'hCard',
+    'weight' => 10,
+    'enabled' => 1,
+    'region' => 'footer',
+  );
+  return $blocks;
+}
+
+/**
+ * Implements hook_block_view().
+ */
+function hcard_block_view($delta) {
+  $block = array();
+  switch ($delta) {
+    case 'hcard':
+      $hcard = variable_get('hcard', array());
+      if ($hcard) {
+        $block = array(
+          'subject' => '',
+          'content' => theme('hcard', array('hcard' => $hcard)),
+        );
       }
+      return $block;
   }
-
 }
 
 /**
  * Theme function for the hcard system settings form.
  * It's just a wrapper so that themers can do what they want with this form.
  */
-function theme_hcard_admin_settings($form) {
-  return drupal_render($form);
+function theme_hcard_admin_settings($variables) {
+  $form = $variables['form'];
+  return drupal_render_children($form);
 }
 
 /**
@@ -347,5 +386,5 @@ function hcard_coord_convert($decimal, $
   $coord_degrees = intval($decimal);
   $coord_minutes = abs(fmod($decimal, 1) * 60);
 
-  return $coord_direction .' '. $coord_degrees .'° '. $coord_minutes .'"';
-}
\ No newline at end of file
+  return $coord_direction . ' ' . $coord_degrees . '° ' . $coord_minutes . '"';
+}
Index: hcard.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/hcard/Attic/hcard.tpl.php,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 hcard.tpl.php
--- hcard.tpl.php	18 Jan 2009 07:06:02 -0000	1.1.2.1
+++ hcard.tpl.php	11 Jan 2011 22:25:16 -0000
@@ -34,7 +34,7 @@
 
   drupal_add_css(drupal_get_path('module', 'hcard') .'/hcard.css');
 ?>
-<div id="hcard<?php if ($given_name || $family_name) print "-". check_plain($hcard['given_name']) ."-". check_plain($hcard['family_name']); ?>" class="vcard">
+<div id="<?php print $id; ?>" class="vcard">
 
   <div class="fn n">
     <?php if ($given_name): ?>
