diff -up -r facebook_status.author-pane.inc facebook_status.author-pane.inc
--- facebook_status.author-pane.inc	2011-07-24 17:13:08.000000000 -0400
+++ facebook_status.author-pane.inc	2011-07-24 17:13:22.000000000 -0400
@@ -7,7 +7,7 @@
  */
 
 /**
- * Implementation of hook_preprocess_author_pane().
+ * Implements hook_preprocess_author_pane().
  */
 function facebook_status_preprocess_author_pane(&$variables) {
   $variables += array(
@@ -26,6 +26,6 @@ function facebook_status_preprocess_auth
     //Just the status, safe but with no filters run over it.
     $variables['facebook_status_status'] = check_plain($status->message);
     //The formatted time the status was submitted.
-    $variables['facebook_status_time'] = theme('facebook_status_time', $status->created);
+    $variables['facebook_status_time'] = theme('facebook_status_time', array('time' => $status->created));
   }
 }
diff -up -r facebook_status.info facebook_status.info
--- facebook_status.info	2011-07-24 17:13:08.000000000 -0400
+++ facebook_status.info	2011-07-24 17:13:30.000000000 -0400
@@ -2,4 +2,49 @@ name = Facebook-style Statuses
 description = "Creates context-sensitive social streams."
 package = Facebook-style Statuses
 dependencies[] = views
-core = 6.x
+core = 7.x
+
+files[] = api.php
+files[] = facebook_status.author-pane.inc
+files[] = facebook_status.install
+files[] = facebook_status.module
+files[] = views-view-row-rss.tpl.php
+files[] = includes/facebook_status.preprocess.inc
+files[] = content_types/facebook_status_stream.inc
+files[] = utility/facebook_status.access.inc
+files[] = utility/facebook_status.admin.inc
+files[] = utility/facebook_status.ahah.inc
+files[] = utility/facebook_status.announce.inc
+files[] = utility/facebook_status.contexts.inc
+files[] = utility/facebook_status.conversation.inc
+files[] = utility/facebook_status.edit.inc
+files[] = utility/facebook_status.form.inc
+files[] = utility/facebook_status.generate.inc
+files[] = views/facebook_status.views.inc
+files[] = views/facebook_status.views_default.inc
+files[] = views/fbss_user_relationships.views_default.inc
+files[] = handlers/facebook_status_plugin_argument_validate.inc
+files[] = handlers/facebook_status_views_handler_argument_communicated.inc
+files[] = handlers/facebook_status_views_handler_argument_participant.inc
+files[] = handlers/facebook_status_views_handler_argument_rels_and_me.inc
+files[] = handlers/facebook_status_views_handler_field_created.inc
+files[] = handlers/facebook_status_views_handler_field_cross.inc
+files[] = handlers/facebook_status_views_handler_field_cross_pic.inc
+files[] = handlers/facebook_status_views_handler_field_current_uid.inc
+files[] = handlers/facebook_status_views_handler_field_delete.inc
+files[] = handlers/facebook_status_views_handler_field_edit.inc
+files[] = handlers/facebook_status_views_handler_field_last.inc
+files[] = handlers/facebook_status_views_handler_field_message.inc
+files[] = handlers/facebook_status_views_handler_field_recipient.inc
+files[] = handlers/facebook_status_views_handler_field_recipient_pic.inc
+files[] = handlers/facebook_status_views_handler_field_repost.inc
+files[] = handlers/facebook_status_views_handler_field_respond.inc
+files[] = handlers/facebook_status_views_handler_filter_autotype.inc
+files[] = handlers/facebook_status_views_handler_filter_communicated.inc
+files[] = handlers/facebook_status_views_handler_filter_latest_only.inc
+files[] = handlers/facebook_status_views_handler_filter_not_own.inc
+files[] = handlers/facebook_status_views_handler_filter_own.inc
+files[] = handlers/facebook_status_views_handler_filter_participant.inc
+files[] = handlers/facebook_status_views_handler_filter_type.inc
+files[] = handlers/facebook_status_views_plugin_row_rss.inc
+files[] = templates/facebook-status-item.tpl.php
diff -up -r facebook_status.install facebook_status.install
--- facebook_status.install	2011-07-24 17:13:08.000000000 -0400
+++ facebook_status.install	2011-07-24 17:13:23.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_schema().
+ * Implements hook_schema().
  */
 function facebook_status_schema() {
   $schema = array();
@@ -103,7 +103,7 @@ function _facebook_status_contexts_schem
         'not null' => TRUE,
         'default' => -1,
         'size' => 'tiny',
-        'description' => 'Flag to indicate how to apply contexts on pages. '.
+        'description' => 'Flag to indicate how to apply contexts on pages. ' .
           '(-1 = Use module default settings, 0 = Show on all pages except listed pages, 1 = Show only on listed pages, 2 = Use custom PHP code to determine visibility, 3 = use a Context)',
       ),
       'pages' => array(
@@ -128,14 +128,15 @@ function _facebook_status_contexts_schem
 }
 
 /**
- * Implementation of hook_install().
+ * Implements hook_install().
  */
 function facebook_status_install() {
-  drupal_install_schema('facebook_status');
+  // TODO The drupal_(un)install_schema functions are called automatically in D7.
+  // drupal_install_schema('facebook_status')
 }
 
 /**
- * Implementation of hook_update_N().
+ * Implements hook_update_N().
  */
 function facebook_status_update_6300() {
   // Remove old variables.
@@ -156,38 +157,38 @@ function facebook_status_update_6300() {
   $ret = array();
 
   // Drop current indexes.
-  db_drop_index($ret, 'facebook_status', 'uid');
-  db_drop_index($ret, 'facebook_status', 'pid');
-  db_drop_index($ret, 'facebook_status', 'status_time');
+  db_drop_index('facebook_status', 'uid');
+  db_drop_index('facebook_status', 'pid');
+  db_drop_index('facebook_status', 'status_time');
 
   // Rename fields and add 'type'.
-  db_change_field($ret, 'facebook_status', 'uid', 'recipient', array(
+  db_change_field('facebook_status', 'uid', 'recipient', array(
     'type' => 'int',
     'unsigned' => TRUE,
     'not null' => TRUE,
     'default' => 0,
     'description' => 'The ID of the entity that received the status message.',
   ));
-  db_change_field($ret, 'facebook_status', 'pid', 'sender', array(
+  db_change_field('facebook_status', 'pid', 'sender', array(
     'type' => 'int',
     'unsigned' => TRUE,
     'not null' => TRUE,
     'default' => 0,
     'description' => 'The User ID of the user who created the status message.',
   ));
-  db_change_field($ret, 'facebook_status', 'status_time', 'created', array(
+  db_change_field('facebook_status', 'status_time', 'created', array(
     'type' => 'int',
     'unsigned' => TRUE,
     'not null' => TRUE,
     'default' => 0,
     'description' => 'The time the status message was saved.',
   ));
-  db_change_field($ret, 'facebook_status', 'status', 'message', array(
+  db_change_field('facebook_status', 'status', 'message', array(
     'type' => 'text',
     'not null' => TRUE,
     'description' => 'The status message.',
   ));
-  db_add_field($ret, 'facebook_status', 'type', array(
+  db_add_field('facebook_status', 'type', array(
     'type' => 'varchar',
     'length' => 255,
     'not null' => TRUE,
@@ -196,18 +197,19 @@ function facebook_status_update_6300() {
   ));
 
   // Add indexes again.
-  db_add_index($ret, 'facebook_status', 'recipient', array('recipient'));
-  db_add_index($ret, 'facebook_status', 'sender', array('sender'));
-  db_add_index($ret, 'facebook_status', 'created', array('created'));
-  db_add_index($ret, 'facebook_status', 'type', array('type'));
+  db_add_index('facebook_status', 'recipient', array('recipient'));
+  db_add_index('facebook_status', 'sender', array('sender'));
+  db_add_index('facebook_status', 'created', array('created'));
+  db_add_index('facebook_status', 'type', array('type'));
 
   // Update the type field in existing records.
-  $ret[] = update_sql("UPDATE {facebook_status} SET type = 'user'");
+  // TODO update_sql has been removed. Use the database API for any schema or data changes.
+  $ret[] = array() /* update_sql("UPDATE {facebook_status} SET type = 'user'") */;
 
   // Create the contexts table.
   if (!db_table_exists('facebook_status_contexts')) {
     $schema = _facebook_status_contexts_schema();
-    db_create_table($ret, 'facebook_status_contexts', $schema['facebook_status_contexts']);
+    db_create_table('facebook_status_contexts', $schema['facebook_status_contexts']);
   }
 
   // Update tokens used in Pathauto.
@@ -247,8 +249,9 @@ function facebook_status_update_6300() {
     '[status-delete]',
     '[created]',
   );
+  // TODO Please convert this statement to the D7 database API syntax.
   $result = db_query("SELECT name FROM {variable} WHERE name LIKE 'pathauto\\_facebook\\_status\\_%%'");
-  while ($variable = db_fetch_object($result)) { 
+  while ($variable = db_fetch_object($result)) {
     $name = $variable->name;
     if ($value = variable_get($name, NULL)) {
       $value = str_replace($old, $new, $value);
@@ -267,7 +270,7 @@ function facebook_status_update_6300() {
   $modules_to_install = array();
   // If the Activity integration was in use in the 2.x branch, enable the fbss_activity submodule.
   if (module_exists('activity') && !module_exists('fbss_activity')) {
-    $count = db_result(db_query("SELECT COUNT(*) FROM {activity} WHERE type = 'facebook_status'"));
+    $count = db_query("SELECT COUNT(*) FROM {activity} WHERE type = :type", array(':type' => 'facebook_status'))->fetchField();
     if ($count > 0) {
       $modules_to_install[] = 'fbss_activity';
     }
@@ -275,7 +278,7 @@ function facebook_status_update_6300() {
 
   // If the Flag integration was in use in the 2.x branch, enable the fbss_flag submodule.
   if (module_exists('flag') && !module_exists('fbss_flag')) {
-    $count = db_result(db_query("SELECT COUNT(*) FROM {flags} WHERE content_type = 'facebook_status'"));
+    $count = db_query("SELECT COUNT(*) FROM {flags} WHERE content_type = :content_type", array(':content_type' => 'facebook_status'))->fetchField();
     if ($count > 0) {
       $modules_to_install[] = 'fbss_flag';
     }
@@ -283,7 +286,7 @@ function facebook_status_update_6300() {
 
   // If the Mollom integration was in use in the 2.x branch, enable the fbss_mollom submodule.
   if (module_exists('mollom') && db_table_exists('mollom_form') && !module_exists('fbss_mollom')) {
-    $count = db_result(db_query("SELECT COUNT(*) FROM {mollom_form} WHERE module = 'facebook_status'"));
+    $count = db_query("SELECT COUNT(*) FROM {mollom_form} WHERE module = :module", array(':module' => 'facebook_status'))->fetchField();
     if ($count > 0) {
       $modules_to_install[] = 'fbss_mollom';
     }
@@ -292,7 +295,8 @@ function facebook_status_update_6300() {
   // If the Pathauto integration was in use in the 2.x branch, enable the fbss_pathauto submodule.
   if (module_exists('pathauto') && !module_exists('fbss_pathauto')) {
     // We check variables named with "fbss_pathauto" instead of "facebook_status" because we already converted them above.
-    $count = db_result(db_query("SELECT COUNT(*) FROM {variable} WHERE name LIKE 'pathauto\\_fbss\\_pathauto\\_%%'"));
+    // TODO Please convert this statement to the D7 database API syntax.
+    $count = db_query("SELECT COUNT(*) FROM {variable} WHERE name LIKE 'pathauto\\_fbss\\_pathauto\\_%%'")->fetchField();
     if ($count > 0) {
       $modules_to_install[] = 'fbss_pathauto';
     }
@@ -300,8 +304,10 @@ function facebook_status_update_6300() {
 
   // If the Rules integration was in use in the 2.x branch, enable the fbss_rules submodule.
   if (module_exists('rules') && !module_exists('fbss_rules')) {
-    $count = (int) db_result(db_query("SELECT COUNT(*) FROM {rules_rules} WHERE name LIKE 'facebook\\_status%%'"));
-    $count += (int) db_result(db_query("SELECT COUNT(*) FROM {rules_sets} WHERE name LIKE 'facebook\\_status%%'"));
+    // TODO Please convert this statement to the D7 database API syntax.
+    $count = (int) db_query("SELECT COUNT(*) FROM {rules_rules} WHERE name LIKE 'facebook\\_status%%'")->fetchField();
+    // TODO Please convert this statement to the D7 database API syntax.
+    $count += (int) db_query("SELECT COUNT(*) FROM {rules_sets} WHERE name LIKE 'facebook\\_status%%'")->fetchField();
     if ($count > 0) {
       $modules_to_install[] = 'fbss_rules';
     }
@@ -315,33 +321,40 @@ function facebook_status_update_6300() {
 
   // If the Userpoints integration was in use in the 2.x branch, enable the fbss_userpoints submodule.
   if (module_exists('userpoints') && !module_exists('fbss_userpoints')) {
-    $count = db_result(db_query("SELECT COUNT(*) FROM {userpoints_txn} WHERE operation LIKE 'facebook\\_status%%'"));
+    // TODO Please convert this statement to the D7 database API syntax.
+    $count = db_query("SELECT COUNT(*) FROM {userpoints_txn} WHERE operation LIKE 'facebook\\_status%%'")->fetchField();
     if ($count > 0) {
       $modules_to_install[] = 'fbss_userpoints';
     }
   }
 
   drupal_install_modules($modules_to_install);
-  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 */;
 }
 
 /**
- * Implementation of hook_update_N().
+ * Implements hook_update_N().
  */
 function facebook_status_update_6301() {
   $text = variable_get('facebook_status_repost', 'Re: @name @message ');
   $text = str_replace('@status', '@message', $text);
   variable_set('facebook_status_repost', $text);
-  return array();
+  // 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.') /* array() */;
 }
 
 /**
- * Implementation of hook_update_N().
+ * Implements hook_update_N().
  */
 function facebook_status_update_6302() {
   $ret = array();
-  if (!db_column_exists('facebook_status_contexts', 'visibility')) {
-    db_add_field($ret, 'facebook_status_contexts', 'visibility', array(
+  if (!db_field_exists('facebook_status_contexts', 'visibility')) {
+    db_add_field('facebook_status_contexts', 'visibility', array(
       'type' => 'int',
       'not null' => TRUE,
       'default' => -1,
@@ -349,23 +362,26 @@ function facebook_status_update_6302() {
       'description' => 'Flag to indicate how to apply contexts on pages. (-1 = Use module default settings, 0 = Show on all pages except listed pages, 1 = Show only on listed pages, 2 = Use custom PHP code to determine visibility)',
     ));
   }
-  if (!db_column_exists('facebook_status_contexts', 'pages')) {
-    db_add_field($ret, 'facebook_status_contexts', 'pages', array(
+  if (!db_field_exists('facebook_status_contexts', 'pages')) {
+    db_add_field('facebook_status_contexts', 'pages', array(
       'type' => 'text',
       'not null' => TRUE,
       'description' => 'Contains either a list of paths on which to include/exclude the context or PHP code, depending on "visibility" setting.',
     ));
   }
-  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 */;
 }
 
 /**
- * Implementation of hook_update_N().
+ * Implements hook_update_N().
  */
 function facebook_status_update_6303() {
   $ret = array();
-  if (!db_column_exists('facebook_status_contexts', 'context')) {
-    db_add_field($ret, 'facebook_status_contexts', 'context', array(
+  if (!db_field_exists('facebook_status_contexts', 'context')) {
+    db_add_field('facebook_status_contexts', 'context', array(
       'description' => 'The primary identifier for a context.',
       'type' => 'varchar',
       'length' => 255,
@@ -373,14 +389,18 @@ function facebook_status_update_6303() {
       'default' => '',
     ));
   }
-  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 */;
 }
 
 /**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
  */
 function facebook_status_uninstall() {
-  drupal_uninstall_schema('facebook_status');
+  // TODO The drupal_(un)install_schema functions are called automatically in D7.
+  // drupal_uninstall_schema('facebook_status')
   variable_del('facebook_status_imagecache_preset');
   variable_del('facebook_status_user_other_view');
   variable_del('facebook_status_default_text');
diff -up -r facebook_status.module facebook_status.module
--- facebook_status.module	2011-07-24 17:13:08.000000000 -0400
+++ facebook_status.module	2011-07-24 17:13:23.000000000 -0400
@@ -17,26 +17,26 @@ define("FACEBOOK_STATUS_OVERRIDE_TIMER",
 //===============
 
 /**
- * Implementation of hook_help().
+ * Implements hook_help().
  */
 function facebook_status_help($path, $arg) {
   if ($path == 'admin/help#facebook_status') {
-    return t('Creates social streams of "status updates" for users or other entities.') .' '.
+    return t('Creates social streams of "status updates" for users or other entities.') . ' ' .
       t('Please see the <a href="@project">Project page</a> or <a href="@docs">documentation</a> for more information.',
         array(
-          '@project' => 'http://drupal.org/project/facebook_status',
-          '@docs' => 'http://drupal.org/node/421128',
-        )
+      '@project' => 'http://drupal.org/project/facebook_status',
+      '@docs' => 'http://drupal.org/node/421128',
+    )
       );
   }
 }
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function facebook_status_menu() {
   $items = array();
-  $items['admin/settings/facebook_status'] = array(
+  $items['admin/config/facebook_status'] = array(
     'title' => 'Facebook-style Statuses',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('facebook_status_admin'),
@@ -44,13 +44,13 @@ function facebook_status_menu() {
     'description' => 'Allows administrators to adjust settings for Facebook-style Statuses.',
     'file' => 'includes/utility/facebook_status.admin.inc',
   );
-  $items['admin/settings/facebook_status/basic'] = array(
+  $items['admin/config/facebook_status/basic'] = array(
     'title' => 'Basic',
     'type' => MENU_DEFAULT_LOCAL_TASK,
     'access arguments' => array('administer Facebook-style Statuses settings'),
     'weight' => -1,
   );
-  $items['admin/settings/facebook_status/advanced'] = array(
+  $items['admin/config/facebook_status/advanced'] = array(
     'title' => 'Advanced',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('facebook_status_admin_advanced'),
@@ -59,7 +59,7 @@ function facebook_status_menu() {
     'type' => MENU_LOCAL_TASK,
     'file' => 'includes/utility/facebook_status.admin.inc',
   );
-  $items['admin/settings/facebook_status/contexts'] = array(
+  $items['admin/config/facebook_status/contexts'] = array(
     'title' => 'Contexts',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('facebook_status_admin_contexts'),
@@ -68,7 +68,7 @@ function facebook_status_menu() {
     'type' => MENU_LOCAL_TASK,
     'file' => 'includes/utility/facebook_status.admin.inc',
   );
-  $items['admin/settings/facebook_status/contexts/%facebook_status_context'] = array(
+  $items['admin/config/facebook_status/contexts/%facebook_status_context'] = array(
     'title' => 'Context settings',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('facebook_status_admin_context_settings', 4),
@@ -154,30 +154,42 @@ function facebook_status_menu() {
  */
 function facebook_status_share_page() {
   $view = variable_get('facebook_status_share_view', 'facebook_status');
-  return theme('facebook_status_form_display', $GLOBALS['user'], 'user', $view);
+  return theme('facebook_status_form_display', array('recipient' => $GLOBALS['user'], 'type' => 'user', 'view' => $view));
 }
 
 /**
- * Implementation of hook_block().
+ * Implements hook_block_info().
  */
-function facebook_status_block($op = 'list', $delta = 0, $edit = NULL) {
-  if ($op == 'list') {
+function facebook_status_block_info() {
+  if (TRUE) {
     $block['facebook_status']['info'] = t('Facebook-style Statuses');
     $block['facebook_status']['visibility'] = 0;
     $block['facebook_status']['pages'] = 'statuses/share';
     return $block;
   }
-  elseif ($op == 'view' && $delta == 'facebook_status') {
+}
+
+/**
+ * Implements hook_block_view().
+ */
+function facebook_status_block_view($delta) {
+  if (TRUE && $delta == 'facebook_status') {
     $context = facebook_status_determine_context();
     $view = FALSE;
     if (!variable_get('facebook_status_block_view', 0) && !empty($context['view'])) {
       unset($context['view']);
     }
     $block['subject'] = '';
-    $block['content'] = theme('facebook_status_form_display', $context);
+    $block['content'] = theme('facebook_status_form_display', array('recipient' => $context));
     return $block;
   }
-  elseif ($op == 'configure' && $delta == 'facebook_status') {
+}
+
+/**
+ * Implements hook_block_configure().
+ */
+function facebook_status_block_configure($delta) {
+  if (TRUE && $delta == 'facebook_status') {
     $form['facebook_status'] = array(
       '#type' => 'fieldset',
       '#title' => t('Facebook-style Statuses Settings'),
@@ -193,7 +205,13 @@ function facebook_status_block($op = 'li
     );
     return $form;
   }
-  elseif ($op == 'save' && $delta == 'facebook_status') {
+}
+
+/**
+ * Implements hook_block_save().
+ */
+function facebook_status_block_save($delta, $edit) {
+  if (TRUE && $delta == 'facebook_status') {
     if (isset($edit['facebook_status'])) {
       variable_set('facebook_status_block_view', $edit['facebook_status']['facebook_status_block_view']);
     }
@@ -201,32 +219,77 @@ function facebook_status_block($op = 'li
 }
 
 /**
- * Implementation of hook_perm().
+ * Implements hook_block().
  */
-function facebook_status_perm() {
+function facebook_status_block_OLD($op = 'list', $delta = 0, $edit = NULL) { }
+
+/**
+ * Implements hook_permission().
+ */
+function facebook_status_permission() {
   return array(
-    'administer Facebook-style Statuses settings',
-    'delete all statuses',
-    'delete own statuses',
-    'delete status messages on own profile',
-    'delete status messages on own nodes',
-    'edit all statuses',
-    'edit own statuses',
-    'post status messages to other streams',
-    'send messages to all users at once',
-    'update and view own stream',
-    'use PHP for context visibility',
-    'view all statuses',
+    'administer Facebook-style Statuses settings' => array(
+      'title' => t('administer Facebook-style Statuses settings'),
+      'description' => t('TODO Add a description for \'administer Facebook-style Statuses settings\''),
+    ),
+    'delete all statuses' => array(
+      'title' => t('delete all statuses'),
+      'description' => t('TODO Add a description for \'delete all statuses\''),
+    ),
+    'delete own statuses' => array(
+      'title' => t('delete own statuses'),
+      'description' => t('TODO Add a description for \'delete own statuses\''),
+    ),
+    'delete status messages on own profile' => array(
+      'title' => t('delete status messages on own profile'),
+      'description' => t('TODO Add a description for \'delete status messages on own profile\''),
+    ),
+    'delete status messages on own nodes' => array(
+      'title' => t('delete status messages on own nodes'),
+      'description' => t('TODO Add a description for \'delete status messages on own nodes\''),
+    ),
+    'edit all statuses' => array(
+      'title' => t('edit all statuses'),
+      'description' => t('TODO Add a description for \'edit all statuses\''),
+    ),
+    'edit own statuses' => array(
+      'title' => t('edit own statuses'),
+      'description' => t('TODO Add a description for \'edit own statuses\''),
+    ),
+    'post status messages to other streams' => array(
+      'title' => t('post status messages to other streams'),
+      'description' => t('TODO Add a description for \'post status messages to other streams\''),
+    ),
+    'send messages to all users at once' => array(
+      'title' => t('send messages to all users at once'),
+      'description' => t('TODO Add a description for \'send messages to all users at once\''),
+    ),
+    'update and view own stream' => array(
+      'title' => t('update and view own stream'),
+      'description' => t('TODO Add a description for \'update and view own stream\''),
+    ),
+    'use PHP for context visibility' => array(
+      'title' => t('use PHP for context visibility'),
+      'description' => t('TODO Add a description for \'use PHP for context visibility\''),
+    ),
+    'view all statuses' => array(
+      'title' => t('view all statuses'),
+      'description' => t('TODO Add a description for \'view all statuses\''),
+    ),
   );
 }
 
 /**
- * Implementation of hook_user().
+ * Implements hook_user_cancel().
  */
-function facebook_status_user($op, &$edit, &$account, $category = NULL) {
-  if ($op == 'delete') {
+function facebook_status_user_cancel($edit, $account, $method) {
+  if (TRUE) {
     // Remove abandoned statuses from the database on user account deletion.
-    db_query("DELETE FROM {facebook_status} WHERE sender = %d OR (recipient = %d AND type = 'user')", $account->uid, $account->uid);
+    // TODO Please review the conversion of this statement to the D7 database API syntax.
+    /* db_query("DELETE FROM {facebook_status} WHERE sender = %d OR (recipient = %d AND type = 'user')", $account->uid, $account->uid) */
+    db_delete('facebook_status')
+    ->where('sender = %d OR (recipient = %d AND type = ' user ')',  )
+  ->execute();
     // NOTE: modules that integrate with FBSS should implement hook_user()
     // themselves instead of relying on hook_facebook_status_delete().
     // Administrators who use the interface to create actions that occur when a
@@ -236,8 +299,14 @@ function facebook_status_user($op, &$edi
     // API function instead of a direct database call by utilizing the Queue
     // API.
   }
-  elseif ($op == 'view' && variable_get('facebook_status_profile', 1)) {
-    $value = theme('facebook_status_form_display', $account, 'user');
+}
+
+/**
+ * Implements hook_user_view().
+ */
+function facebook_status_user_view($account, $view_mode) {
+  if (TRUE && variable_get('facebook_status_profile', 1)) {
+    $value = theme('facebook_status_form_display', array('recipient' => $account, 'type' => 'user'));
     // Don't show this section if there's nothing there or the user doesn't have permission to see it.
     if (empty($value)) {
       return;
@@ -261,7 +330,12 @@ function facebook_status_user($op, &$edi
 }
 
 /**
- * Implementation of hook_init().
+ * Implements hook_user().
+ */
+function facebook_status_user_OLD($op, &$edit, &$account, $category = NULL) { }
+
+/**
+ * Implements hook_init().
  */
 function facebook_status_init() {
   // Don't clear the default text on first focus if the default text was manually set in the URL.
@@ -271,23 +345,23 @@ function facebook_status_init() {
     $undefault = $undefault || ($rs->sender != $GLOBALS['user']->uid && $rs->message);
   }
   drupal_add_js(array('facebook_status' => array(
-    'autofocus' => (
+      'autofocus' => (
       (arg(0) == 'statuses' && arg(1) == 'share') ||
       (arg(0) == 'statuses' && is_numeric(arg(1)) && arg(2) == 'edit') ||
       (arg(0) == 'statuses' && arg(1) == 'conversation')
     ),
-    'noautoclear' => (
+      'noautoclear' => (
       $undefault ||
       (arg(0) == 'statuses' && is_numeric(arg(1)) && arg(2) == 'edit')
     ),
-    'maxlength' => variable_get('facebook_status_length', 140),
-    'hideLength' => variable_get('facebook_status_hide_length', 0),
-    'refreshLink' => (bool) variable_get('facebook_status_refresh', 0)
-  )), 'setting');
+      'maxlength' => variable_get('facebook_status_length', 140),
+      'hideLength' => variable_get('facebook_status_hide_length', 0),
+      'refreshLink' => (bool) variable_get('facebook_status_refresh', 0),
+    )), array('type' => 'setting', 'scope' => JS_DEFAULT));
 }
 
 /**
- * Implementation of hook_link().
+ * Implements hook_link().
  */
 function facebook_status_link($type, $status) {
   if ($type != 'facebook_status') {
@@ -297,7 +371,7 @@ function facebook_status_link($type, $st
   $links = array();
   if (facebook_status_user_access('edit', $status)) {
     $links['edit'] = array(
-      'href' => 'statuses/'. $status->sid .'/edit',
+      'href' => 'statuses/' . $status->sid . '/edit',
       'title' => t('edit'),
       'attributes' => array('class' => 'facebook-status-edit facebook-status-action-link'),
       'weight' => -5,
@@ -305,7 +379,7 @@ function facebook_status_link($type, $st
   }
   if (facebook_status_user_access('delete', $status)) {
     $links['delete'] = array(
-      'href' => 'statuses/'. $status->sid .'/delete',
+      'href' => 'statuses/' . $status->sid . '/delete',
       'title' => t('delete'),
       'attributes' => array('class' => 'facebook-status-delete facebook-status-action-link'),
       'weight' => -4,
@@ -330,7 +404,7 @@ function facebook_status_link($type, $st
         $second_uid = $status->recipient;
       }
       $links['respond'] = array(
-        'href' => 'statuses/conversation/'. $status->sender .','. $second_uid,
+        'href' => 'statuses/conversation/' . $status->sender . ',' . $second_uid,
         'title' => $title,
         'attributes' => array('class' => 'facebook-status-respond facebook-status-action-link'),
         'weight' => 3,
@@ -341,7 +415,10 @@ function facebook_status_link($type, $st
     $links['share'] = array(
       'href' => 'statuses/share',
       'title' => t('share'),
-      'query' => array('sid' => $status->mid, 'destination' => $_GET['q']),
+      'query' => array(
+        'sid' => $status->mid,
+        'destination' => $_GET['q'],
+      ),
       'attributes' => array('class' => 'facebook-status-share facebook-status-action-link'),
       'weight' => 5,
     );
@@ -350,12 +427,12 @@ function facebook_status_link($type, $st
 }
 
 /**
- * Implementation of hook_theme().
+ * Implements hook_theme().
  */
 function facebook_status_theme($existing, $type, $theme, $path) {
   return array(
     'facebook_status_item' => array(
-      'arguments' => array(
+      'variables' => array(
         'status' => NULL,
         'options' => array(),
       ),
@@ -363,7 +440,7 @@ function facebook_status_theme($existing
       'file' => 'includes/facebook_status.preprocess.inc',
     ),
     'facebook_status_form_display' => array(
-      'arguments' => array(
+      'variables' => array(
         'recipient' => NULL,
         'type' => 'user',
         'view' => NULL,
@@ -371,14 +448,12 @@ function facebook_status_theme($existing
       'file' => 'includes/utility/facebook_status.form.inc',
     ),
     'facebook_status_time' => array(
-      'arguments' => array(
-        'time' => time(),
+      'variables' => array(
+        'time' => REQUEST_TIME,
       ),
     ),
     'facebook_status_admin_contexts' => array(
-      'arguments' => array(
-        'form' => NULL,
-      ),
+      'render element' => 'form',
       'file' => 'includes/utility/facebook_status.admin.inc',
     ),
   );
@@ -418,18 +493,19 @@ function facebook_status_show($status, $
  *   If the status was submitted within the last 3 days, returns a "time ago"
  *   date. If not, returns a normal (small) date. If zero, returns FALSE.
  */
-function theme_facebook_status_time($time) {
+function theme_facebook_status_time($variables) {
+  $time = $variables['time'];
   if (!$time) {
     return FALSE;
   }
-  if (time() - $time < 60) {
+  if (REQUEST_TIME - $time < 60) {
     return t('a moment ago');
   }
-  elseif (time() - $time < 60 * 60 * 24 * 3) {
-    return t('!time ago', array('!time' => format_interval(time() - $time, 1)));
+  elseif (REQUEST_TIME - $time < 60 * 60 * 24 * 3) {
+    return t('!time ago', array('!time' => format_interval(REQUEST_TIME - $time, 1)));
   }
   else {
-    return format_date($time, 'small');
+    return format_date($time, 'short');
   }
 }
 
@@ -505,13 +581,13 @@ function facebook_status_get_statuses($s
   $args = array_merge(array($type), $senders, $recipients);
   $query = "SELECT * FROM {facebook_status} WHERE created <> 0 AND type = '%s'";
   if (!empty($senders)) {
-    $query .= " AND sender IN (". db_placeholders($senders) .")";
+    $query .= " AND sender IN (" . db_placeholders($senders) . ")";
   }
   if (!empty($recipients)) {
-    $query .= " AND recipient IN (". db_placeholders($recipients) .")";
+    $query .= " AND recipient IN (" . db_placeholders($recipients) . ")";
   }
   $query .= " ORDER BY created DESC, sid DESC";
-  $result = ($total > 0 ? db_query_range($query, $args, 0, $total) : db_query($query, $args));
+  $result = ($total > 0 ? db_query_range($query, $args) : db_query($query, $args));
   while ($status = db_fetch_object($result)) {
     $statuses[] = $status;
   }
@@ -536,9 +612,9 @@ function facebook_status_has_status($rec
   global $user;
   $recipient_id = (empty($recipient_id) ? $user->uid : $recipient_id);
   if (!empty($sender_id)) {
-    return db_result(db_query("SELECT COUNT(sid) FROM {facebook_status} WHERE type = '%s' AND recipient = %d AND sender = %d", $type, $recipient_id, $sender_id));
+    return db_query("SELECT COUNT(sid) FROM {facebook_status} WHERE type = :type AND recipient = :recipient AND sender = :sender", array(':type' => $type, ':recipient' => $recipient_id, ':sender' => $sender_id))->fetchField();
   }
-  return db_result(db_query("SELECT COUNT(sid) FROM {facebook_status} WHERE type = '%s' AND recipient = %d", $type, $recipient_id));
+  return db_query("SELECT COUNT(sid) FROM {facebook_status} WHERE type = :type AND recipient = :recipient", array(':type' => $type, ':recipient' => $recipient_id))->fetchField();
 }
 
 /**
@@ -549,8 +625,13 @@ function facebook_status_has_status($rec
  * @return
  *   A status object containing sid, sender, recipient, type, created, message.
  */
-function facebook_status_load($sid) {
-  return db_fetch_object(db_query("SELECT * FROM {facebook_status} WHERE sid = %d", $sid));
+function facebook_status_load($sids) {
+  foreach ($sids as $nid => &$sid) {
+    $node_additions = db_fetch_object(db_query("SELECT * FROM {facebook_status} WHERE sid = :sid", array(':sid' => $sid)));
+    foreach ($node_additions as $property => &$value) {
+      $sid->$property = $value;
+    }
+  }
 }
 
 /**
@@ -608,7 +689,7 @@ function facebook_status_determine_conte
     // The user context is our base case, so we never end up with no context.
     foreach ($contexts as $context) {
       if (!empty($context['file']) && file_exists($context['file'])) {
-        require_once $context['file'];
+        require_once DRUPAL_ROOT . '/' . $context['file'];
       }
       // Make sure the parent class is always loaded.
       if (empty($context['parent'])) {
@@ -626,7 +707,7 @@ function facebook_status_determine_conte
   elseif (isset($contexts[$type])) {
     $context = $contexts[$type];
     if (!empty($context['file']) && file_exists($context['file'])) {
-      require_once $context['file'];
+      require_once DRUPAL_ROOT . '/' . $context['file'];
     }
     // Make sure the parent class is always loaded.
     if (empty($context['parent'])) {
@@ -715,10 +796,14 @@ function facebook_status_delete_status($
     if ($type == 'user') {
       $type .= ($status->sender == $status->recipient ? '_self' : '_other');
     }
-    module_invoke_all('facebook_status', 'fbss_deleted_'. $type, $status);
+    module_invoke_all('facebook_status', 'fbss_deleted_' . $type, $status);
   }
   module_invoke_all('facebook_status_delete', $status, $meta);
-  db_query("DELETE FROM {facebook_status} WHERE sid = %d", $status->sid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {facebook_status} WHERE sid = %d", $status->sid) */
+  db_delete('facebook_status')
+  ->condition('sid', $status->sid)
+  ->execute();
 }
 
 /**
@@ -748,7 +833,7 @@ function facebook_status_save_status($re
   $sender = (empty($sender) ? $GLOBALS['user'] : $sender);
   $context = facebook_status_determine_context($type);
   $recipient_id = $context['handler']->recipient_id($recipient);
-  $time = time();
+  $time = REQUEST_TIME;
   $message = trim($message);
   if (module_exists('og') && arg(0) == 'facebook_status' && arg(1) == 'js') {
     og_set_group_context($recipient);
@@ -778,7 +863,16 @@ function facebook_status_save_status($re
     // we assume the user didn't mean to post the first one.
     if ($time - $status->created < FACEBOOK_STATUS_OVERRIDE_TIMER && $type = 'user' && $sender->uid == $recipient_id && $options['timed override']) {
       $sql = "UPDATE {facebook_status} SET message = '%s', created = %d WHERE sid = %d ORDER BY sid DESC";
-      db_query($sql, $message, $time, $status->sid);
+      // TODO Please review the conversion of this statement to the D7 database API syntax.
+      /* db_query($sql, $message, $time, $status->sid) */
+      db_update('facebook_status')
+  ->fields(array(
+        'message' => $message,
+        'created' => $time,
+      ))
+  ->condition('sid', $status->sid)
+  ->condition('DER BY sid DESC', '')
+  ->execute();
       $object->sid = $status->sid;
       $edit = TRUE;
     }
@@ -794,7 +888,7 @@ function facebook_status_save_status($re
     // Don't call if the status is blank because usually nothing interesting is happening.
     // Also don't call if there is an attachment (from the FBSMP module) because there is a separate trigger for that.
     if (module_exists('trigger') && !empty($message) && empty($options['has attachment'])) {
-      $op = 'fbss_submitted_'. $type;
+      $op = 'fbss_submitted_' . $type;
       if ($type == 'user') {
         $op .= ($recipient_id == $sender->uid ? '_self' : '_other');
       }
@@ -840,18 +934,33 @@ function facebook_status_edit_status($st
   );
   // Calls hook_facebook_status_save_options_alter(&$options, $edit).
   drupal_alter('facebook_status_save_options', $options, TRUE);
-  $time = time();
+  $time = REQUEST_TIME;
   global $user;
   // Pretend to have set a new status if the submitted status is exactly the same as the old one.
   if ($new_message != $status->message) {
     if ($options['update timestamp']) {
       $sql = "UPDATE {facebook_status} SET message = '%s', created = %d WHERE sid = %d";
-      db_query($sql, $new_message, $time, $status->sid);
+      // TODO Please review the conversion of this statement to the D7 database API syntax.
+      /* db_query($sql, $new_message, $time, $status->sid) */
+      db_update('facebook_status')
+  ->fields(array(
+        'message' => $new_message,
+        'created' => $time,
+      ))
+  ->condition('sid', $status->sid)
+  ->execute();
       $status->created = $time;
     }
     else {
       $sql = "UPDATE {facebook_status} SET message = '%s' WHERE sid = %d";
-      db_query($sql, $new_message, $status->sid);
+      // TODO Please review the conversion of this statement to the D7 database API syntax.
+      /* db_query($sql, $new_message, $status->sid) */
+      db_update('facebook_status')
+  ->fields(array(
+        'message' => $new_message,
+      ))
+  ->condition('sid', $status->sid)
+  ->execute();
     }
     $status->message = $new_message;
     // Invokes hook_facebook_status_save($status, $context, $edit, $options).
@@ -861,7 +970,7 @@ function facebook_status_edit_status($st
   // Don't call if the status is blank because usually nothing interesting is happening.
   // Also don't call if there is an attachment (from the FBSMP module) because there is a separate trigger for that.
   if (module_exists('trigger') && !empty($new_message) && empty($options['has attachment'])) {
-    $op = 'fbss_edited_'. $status->type;
+    $op = 'fbss_edited_' . $status->type;
     if ($status->type == 'user') {
       $op .= ($status->recipient == $status->sender ? '_self' : '_other');
     }
@@ -893,7 +1002,7 @@ function _facebook_status_element_sort($
  */
 function _facebook_status_run_filter($status) {
   if (variable_get('facebook_status_filter', 'none') != 'none') {
-    return check_markup($status, variable_get('facebook_status_filter', 'none'), FALSE);
+    return check_markup($status, variable_get('facebook_status_filter', 'none'), $langcode = '' /* TODO Set this variable. */, FALSE);
   }
   return check_plain($status);
 }
@@ -907,9 +1016,15 @@ function _facebook_status_run_filter($st
  *   A status object.
  */
 function _facebook_status_get_status_fast($uid) {
-  $status = db_fetch_object(db_query("SELECT * FROM {facebook_status} WHERE sender = %d AND recipient = %d AND type = 'user' ORDER BY sid DESC", $uid, $uid));
+  $status = db_fetch_object(db_query("SELECT * FROM {facebook_status} WHERE sender = :sender AND recipient = :recipient AND type = :type ORDER BY sid DESC", array(':sender' => $uid, ':recipient' => $uid, ':type' => 'user')));
   if (!$status) {
-    $status = (object) array('sender' => $uid, 'recipient' => $uid, 'message' => '', 'created' => 0, 'type' => 'user');
+    $status = (object) array(
+      'sender' => $uid,
+      'recipient' => $uid,
+      'message' => '',
+      'created' => 0,
+      'type' => 'user',
+    );
   }
   return $status;
 }
@@ -925,7 +1040,7 @@ function _facebook_status_get_status_fas
 function _facebook_status_user_load($uid) {
   static $accounts = array();
   if (!isset($accounts[$uid])) {
-    $accounts[$uid] = user_load(array('uid' => $uid));
+    $accounts[$uid] = user_load($uid);
   }
   return $accounts[$uid];
 }
@@ -941,7 +1056,7 @@ function _facebook_status_user_load($uid
 function _facebook_status_user_load_by_name($name) {
   static $accounts = array();
   if (!isset($accounts[$name])) {
-    $accounts[$name] = user_load(array('name' => $name));
+    $accounts[$name] = array_shift(user_load_multiple(array(), array('name' => $name)));
   }
   return $accounts[$name];
 }
@@ -982,7 +1097,10 @@ function _facebook_status_context_applie
       return !($context['visibility'] xor $page_match);
     }
     else {
-      return drupal_eval($context['pages']);
+      if (module_exists('php')) {
+        return php_eval($context['pages']);
+
+      }
     }
   }
   else {
@@ -995,19 +1113,19 @@ function _facebook_status_context_applie
 //==========================
 
 /**
- * Implementation of hook_facebook_status_context_info().
+ * Implements hook_facebook_status_context_info().
  */
 function facebook_status_facebook_status_context_info() {
   $path = drupal_get_path('module', 'facebook_status');
   return array(
     'user' => array(
       'title' => t('User profiles'),
-      'description' => t('If a profile is currently being viewed, then the stream belongs to the owner of that profile.') .' '.
+      'description' => t('If a profile is currently being viewed, then the stream belongs to the owner of that profile.') . ' ' .
         t('Otherwise, the stream belongs to the current user.'),
       'handler' => 'facebook_status_user_context',
       'view' => module_exists('activity_log') ? 'activity_log_stream' : (module_exists('user_relationships_api') ? 'fbss_ur_stream' : 'facebook_status_stream'),
       'weight' => 999,
-      'file' => $path .'/includes/utility/facebook_status.contexts.inc',
+      'file' => $path . '/includes/utility/facebook_status.contexts.inc',
     ),
     'node' => array(
       'title' => t('Nodes'),
@@ -1015,7 +1133,7 @@ function facebook_status_facebook_status
       'handler' => 'facebook_status_node_context',
       'view' => 'facebook_status_stream',
       'weight' => -1,
-      'file' => $path .'/includes/utility/facebook_status.contexts.inc',
+      'file' => $path . '/includes/utility/facebook_status.contexts.inc',
     ),
     'og' => array(
       'title' => t('Organic Groups'),
@@ -1025,7 +1143,7 @@ function facebook_status_facebook_status
       'dependencies' => array('og'),
       'view' => module_exists('activity_log') ? 'activity_log_stream' : 'facebook_status_stream',
       'weight' => -50,
-      'file' => $path .'/includes/utility/facebook_status.contexts.inc',
+      'file' => $path . '/includes/utility/facebook_status.contexts.inc',
     ),
     'term' => array(
       'title' => t('Taxonomy terms'),
@@ -1034,7 +1152,7 @@ function facebook_status_facebook_status
       'dependencies' => array('taxonomy'),
       'view' => 'facebook_status_stream',
       'weight' => 1000, // heavier than the user context, therefore disabled by default
-      'file' => $path .'/includes/utility/facebook_status.contexts.inc',
+      'file' => $path . '/includes/utility/facebook_status.contexts.inc',
     ),
   );
 }
@@ -1044,51 +1162,49 @@ function facebook_status_facebook_status
 //======================
 
 /**
- * Implementation of hook_hook_info().
+ * Implements hook_trigger_info().
  */
-function facebook_status_hook_info() {
+function facebook_status_trigger_info() {
   $info = array(
     'facebook_status' => array(
-      'facebook_status' => array(
-        'fbss_deleted' => array(
-          'runs when' => t('A status has been deleted'),
-        ),
-        'fbss_deleted_user_self' => array(
-          'runs when' => t('A user has deleted their status'),
-        ),
-        'fbss_deleted_user_other' => array(
-          'runs when' => t('A user has deleted a status message to another user'),
-        ),
-        'fbss_edited' => array(
-          'runs when' => t('A status has been edited'),
-        ),
-        'fbss_edited_user_self' => array(
-          'runs when' => t('A user has edited their own status'),
-        ),
-        'fbss_edited_user_other' => array(
-          'runs when' => t('A user has edited a status message to another user'),
-        ),
-        'fbss_submitted' => array(
-          'runs when' => t('A status has been submitted'),
-        ),
-        'fbss_submitted_user_self' => array(
-          'runs when' => t('A user has updated their own status'),
-        ),
-        'fbss_submitted_user_other' => array(
-          'runs when' => t('A user has posted a status message to another user'),
-        ),
+      'facebook_status_fbss_deleted' => array(
+        'label' => t('A status has been deleted'),
+      ),
+      'facebook_status_fbss_deleted_user_self' => array(
+        'label' => t('A user has deleted their status'),
+      ),
+      'facebook_status_fbss_deleted_user_other' => array(
+        'label' => t('A user has deleted a status message to another user'),
+      ),
+      'facebook_status_fbss_edited' => array(
+        'label' => t('A status has been edited'),
+      ),
+      'facebook_status_fbss_edited_user_self' => array(
+        'label' => t('A user has edited their own status'),
+      ),
+      'facebook_status_fbss_edited_user_other' => array(
+        'label' => t('A user has edited a status message to another user'),
+      ),
+      'facebook_status_fbss_submitted' => array(
+        'label' => t('A status has been submitted'),
+      ),
+      'facebook_status_fbss_submitted_user_self' => array(
+        'label' => t('A user has updated their own status'),
+      ),
+      'facebook_status_fbss_submitted_user_other' => array(
+        'label' => t('A user has posted a status message to another user'),
       ),
     ),
   );
   foreach (facebook_status_all_contexts() as $type => $details) {
     if ($type != 'user') {
-      $info['facebook_status']['facebook_status']['fbss_deleted_'. $type] = array(
+      $info['facebook_status']['facebook_status']['fbss_deleted_' . $type] = array(
         'runs when' => t('A user has deleted a status message to a stream of type %type', array('%type' => $type)),
       );
-      $info['facebook_status']['facebook_status']['fbss_edited_'. $type] = array(
+      $info['facebook_status']['facebook_status']['fbss_edited_' . $type] = array(
         'runs when' => t('A user has edited a status message to a stream of type %type', array('%type' => $type)),
       );
-      $info['facebook_status']['facebook_status']['fbss_submitted_'. $type] = array(
+      $info['facebook_status']['facebook_status']['fbss_submitted_' . $type] = array(
         'runs when' => t('A user has posted a new status to a stream of type %type', array('%type' => $type)),
       );
     }
@@ -1097,9 +1213,9 @@ function facebook_status_hook_info() {
 }
 
 /**
- * Implementation of hook_facebook_status().
+ * Implements hook_facebook_status().
  * or
- * Implementation of hook_trigger_name().
+ * Implements hook_trigger_name().
  */
 function facebook_status_facebook_status($op, $status, $context = NULL) {
   if (strpos($op, 'fbss_deleted') !== 0 && strpos($op, 'fbss_submitted') !== 0 && strpos($op, 'fbss_edited') !== 0) {
@@ -1131,7 +1247,7 @@ function facebook_status_facebook_status
 //====================
 
 /**
- * Implementation of hook_token_list().
+ * Implements hook_token_list().
  */
 function facebook_status_token_list($type = 'all') {
   if ($type == 'facebook_status') {
@@ -1165,7 +1281,7 @@ function facebook_status_token_list($typ
 }
 
 /**
- * Implementation of hook_token_values().
+ * Implements hook_token_values().
  */
 function facebook_status_token_values($type, $data = NULL, $options = array()) {
   if ($type != 'facebook_status' || empty($data)) {
@@ -1181,15 +1297,15 @@ function facebook_status_token_values($t
   $edit = '';
   $delete = '';
   if (facebook_status_user_access('edit', $status)) {
-    $edit = '<span class="facebook-status-edit-link facebook-status-action-link">'. l(t('Edit'), 'statuses/'. $status->sid .'/edit') .'</span>';
+    $edit = '<span class="facebook-status-edit-link facebook-status-action-link">' . l(t('Edit'), 'statuses/' . $status->sid . '/edit') . '</span>';
   }
   if (facebook_status_user_access('delete', $status)) {
-    $delete = '<span class="facebook-status-delete-link facebook-status-action-link">'.  l(t('Delete'), 'statuses/'. $status->sid .'/delete') .'</span>';
+    $delete = '<span class="facebook-status-delete-link facebook-status-action-link">' .  l(t('Delete'), 'statuses/' . $status->sid . '/delete') . '</span>';
   }
   $sender = _facebook_status_user_load($status->sender);
   $recipient = $context['handler']->load_recipient($status->recipient);
   $values = array(
-    'sender-themed' => theme('username', $sender),
+    'sender-themed' => theme('username', array('account' => $sender)),
     'sender-name' => check_plain($sender->name),
     'sender-name-raw' => $sender->name,
     'sender-uid' => $sender->uid,
@@ -1204,11 +1320,11 @@ function facebook_status_token_values($t
     'message-raw' => $status->message,
     'status-themed' => facebook_status_show($status),
     'status-id' => $status->sid,
-    'status-url' => url('statuses/'. $status->sid, array('absolute' => TRUE)),
+    'status-url' => url('statuses/' . $status->sid, array('absolute' => TRUE)),
     'status-edit' => $edit,
     'status-delete' => $delete,
     'status-comment-count' => (module_exists('fbss_comments')) ? fbss_comments_count_comments($status->sid) : 0,
-    'created' => format_date($status->created, 'small'),
+    'created' => format_date($status->created, 'short'),
   );
   $values += token_get_date_token_values($status->created, 'created-');
   return $values;
@@ -1219,12 +1335,12 @@ function facebook_status_token_values($t
 //====================
 
 /**
- * Implementation of hook_views_api().
+ * Implements hook_views_api().
  */
 function facebook_status_views_api() {
   return array(
     'api' => 2,
-    'path' => drupal_get_path('module', 'facebook_status') .'/includes/views',
+    'path' => drupal_get_path('module', 'facebook_status') . '/includes/views',
   );
 }
 
@@ -1233,18 +1349,18 @@ function facebook_status_views_api() {
  * and other themes.
  */
 function facebook_status_display_user_picture($account) {
-  drupal_add_css(drupal_get_path('module', 'facebook_status') .'/resources/facebook_status.css');
-  return theme('user_picture', $account);
+  drupal_add_css(drupal_get_path('module', 'facebook_status') . '/resources/facebook_status.css');
+  return theme('user_picture', array('account' => $account));
 }
 
 /**
- * Implementation of hook_views_query_alter().
+ * Implements hook_views_query_alter().
  */
 function facebook_status_views_query_alter(&$view, &$query) {
   if ($view->base_table == 'users') {
     foreach ($query->table_queue as $alias => $info) {
       if ($info['table'] == 'facebook_status') {
-        $query->add_groupby($info['alias'] .'.sid');
+        $query->add_groupby($info['alias'] . '.sid');
         return;
       }
     }
@@ -1256,7 +1372,7 @@ function facebook_status_views_query_alt
 //============================
 
 /**
- * Implementation of hook_sms_incoming().
+ * Implements hook_sms_incoming().
  */
 function facebook_status_sms_incoming($op, $number, $message, $options = NULL) {
   global $user;
@@ -1264,7 +1380,7 @@ function facebook_status_sms_incoming($o
     $maxlen = variable_get('facebook_status_length', 140);
     $message = drupal_substr($message, 3);
     if (drupal_strlen($message) > $maxlen && $maxlen > 0) {
-      $message = drupal_substr($message, 0, $maxlen - 3) .'...';
+      $message = drupal_substr($message, 0, $maxlen - 3) . '...';
     }
     facebook_status_save_status($user, 'user', $message);
   }
@@ -1275,7 +1391,7 @@ function facebook_status_sms_incoming($o
 //====================================
 
 /**
- * Implementation of hook_views_bulk_operations_object_info().
+ * Implements hook_views_bulk_operations_object_info().
  */
 function facebook_status_views_bulk_operations_object_info() {
   return array(
@@ -1293,10 +1409,10 @@ function facebook_status_views_bulk_oper
 //=====================
 
 /**
- * Implementation of hook_ctools_plugin_directory().
+ * Implements hook_ctools_plugin_directory().
  */
 function facebook_status_ctools_plugin_directory($module, $plugin) {
   if ($module == 'ctools') {
-    return 'includes/ctools/'. $plugin;
+    return 'includes/ctools/' . $plugin;
   }
 }
diff -up -r includes/ctools/content_types/facebook_status_stream.inc includes/ctools/content_types/facebook_status_stream.inc
--- includes/ctools/content_types/facebook_status_stream.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/ctools/content_types/facebook_status_stream.inc	2011-07-24 17:13:23.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_ctools_content_types().
+ * Implements hook_ctools_content_types().
  */
 function facebook_status_facebook_status_stream_ctools_content_types() {
   return array(
@@ -20,21 +20,22 @@ function facebook_status_facebook_status
 }
 
 /**
- * Implementation of hook_content_type_render().
+ * Implements hook_content_type_render().
  */
 function facebook_status_facebook_status_stream_content_type_render($subtype, $conf, $panel_args, $context) {
-  $account = isset($context->data) ? drupal_clone($context->data) : NULL;
+  $account = isset($context->data) ? clone $context->data : NULL;
   $block = new stdClass();
   $block->content = t('User information is currently unavailable.');
   if ($account) {
     $block->title = t("Stream");
+    // TODO Please change this theme call to use an associative array for the $variables parameter.
     $block->content = theme('facebook_status_form_display');
   }
   return $block;
 }
 
 /**
- * Implementation of hook_content_type_admin_title().
+ * Implements hook_content_type_admin_title().
  */
 function facebook_status_facebook_status_stream_content_type_admin_title($subtype, $conf, $context) {
   return t('Stream');
diff -up -r includes/facebook_status.preprocess.inc includes/facebook_status.preprocess.inc
--- includes/facebook_status.preprocess.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/facebook_status.preprocess.inc	2011-07-24 17:13:23.000000000 -0400
@@ -18,8 +18,11 @@ function template_preprocess_facebook_st
     $vars['message'] = nl2br($vars['message']);
   }
   $vars += array(
-    'recipient' => '', 'recipient_name' => '', 'recipient_picture' => '',
-    'meta' => '', 'links' => '',
+    'recipient' => '',
+    'recipient_name' => '',
+    'recipient_picture' => '',
+    'meta' => '',
+    'links' => '',
   );
   if (module_exists('imagecache_profiles')) {
     $preset = variable_get('facebook_status_imagecache_preset', variable_get('user_picture_imagecache_profiles_default', ''));
@@ -31,20 +34,20 @@ function template_preprocess_facebook_st
     if (isset($preset)) {
       $vars['recipient']->imagecache_preset = $preset;
     }
-    $vars['recipient_picture'] = theme('user_picture', $vars['recipient']);
+    $vars['recipient_picture'] = theme('user_picture', array('account' => $vars['recipient']));
   }
   $vars['sender'] = _facebook_status_user_load($status->sender);
   if (isset($preset)) {
     $vars['sender']->imagecache_preset = $preset;
   }
   $vars['sender_name'] = check_plain($vars['sender']->name);
-  $vars['sender_link'] = theme('username', $vars['sender']);
-  $vars['sender_picture'] = theme('user_picture', $vars['sender']);
+  $vars['sender_link'] = theme('username', array('account' => $vars['sender']));
+  $vars['sender_picture'] = theme('user_picture', array('account' => $vars['sender']));
   if ($options['cacheable']) {
-    $vars['created'] = format_date($status->created, 'small');
+    $vars['created'] = format_date($status->created, 'short');
   }
   else {
-    $vars['created'] = theme('facebook_status_time', $status->created);
+    $vars['created'] = theme('facebook_status_time', array('time' => $status->created));
     if ($status->type == 'user') {
       if ($status->sender != $status->recipient) {
         $vars['meta'] = t('to !recipient', array('!recipient' => $vars['recipient_link']));
@@ -54,7 +57,7 @@ function template_preprocess_facebook_st
       $vars['meta'] = t('on !entity', array('!entity' => $vars['recipient_link']));
     }
     if ($options['links']) {
-      $vars['links'] = !empty($status->links) ? theme('links', $status->links, array('class' => 'links inline')) : '';
+      $vars['links'] = !empty($status->links) ? theme('links', array('links' => $status->links, 'attributes' => array('class' => 'links inline'))) : '';
     }
   }
 }
@@ -100,12 +103,12 @@ function _facebook_status_show($status, 
     }
     if (drupal_strlen($title) > 80) {
       //"\xE2\x80\xA6" is the unicode escape sequence for the HTML entity &hellip; (an ellipsis)
-      $title = drupal_substr($title, 0, 79) ."\xE2\x80\xA6";
+      $title = drupal_substr($title, 0, 79) . "\xE2\x80\xA6";
     }
     drupal_set_title($title);
   }
-  drupal_add_css(drupal_get_path('module', 'facebook_status') .'/resources/facebook_status.css');
-  return theme('facebook_status_item', $status, $options);
+  drupal_add_css(drupal_get_path('module', 'facebook_status') . '/resources/facebook_status.css');
+  return theme('facebook_status_item', array('status' => $status, 'options' => $options));
 }
 
 /**
diff -up -r includes/utility/facebook_status.admin.inc includes/utility/facebook_status.admin.inc
--- includes/utility/facebook_status.admin.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/utility/facebook_status.admin.inc	2011-07-24 17:13:24.000000000 -0400
@@ -19,7 +19,8 @@ function facebook_status_admin($form_sta
     '#required' => TRUE,
     '#weight' => -40,
   );
-  $formats = filter_formats();
+  global $user;
+  $formats = filter_formats($user);
   $options = array('none' => t('None (HTML escaped)'));
   foreach ($formats as $format) {
     $options[$format->format] = check_plain($format->name);
@@ -27,7 +28,7 @@ function facebook_status_admin($form_sta
   $form['facebook_status_filter'] = array(
     '#type' => 'select',
     '#title' => t('Input filter'),
-    '#description' => '<strong>'. t('This input filter will run on all your statuses AND ACCESS TO IT IS NOT CHECKED, so make sure it is secure.') .'</strong>',
+    '#description' => '<strong>' . t('This input filter will run on all your statuses AND ACCESS TO IT IS NOT CHECKED, so make sure it is secure.') . '</strong>',
     '#default_value' => variable_get('facebook_status_filter', 'none'),
     '#options' => $options,
     '#weight' => -30,
@@ -35,7 +36,7 @@ function facebook_status_admin($form_sta
   $form['facebook_status_repost'] = array(
     '#type' => 'textfield',
     '#title' => t('Re-post format'),
-    '#description' => t('The format of the default message when users click a link to re-post a status.') .' '.
+    '#description' => t('The format of the default message when users click a link to re-post a status.') . ' ' .
       t("@name will be replaced with the poster's name and @message will be replaced with the status text."),
     '#default_value' => variable_get('facebook_status_repost', 'Re: @name @message '),
     '#weight' => -20,
@@ -86,8 +87,8 @@ function facebook_status_admin_advanced(
     '#type' => 'textfield',
     '#title' => t('Show "Read more" after'),
     '#field_suffix' => t('characters'),
-    '#description' => t('If a status message is longer than this number of characters and the viewing user has JavaScript enabled, the message will be truncated to this length and a "Read more" link will be appended.') .' '.
-      t('When clicked, the "Read more" link will reveal the rest of the status message.') .' '.
+    '#description' => t('If a status message is longer than this number of characters and the viewing user has JavaScript enabled, the message will be truncated to this length and a "Read more" link will be appended.') . ' ' .
+      t('When clicked, the "Read more" link will reveal the rest of the status message.') . ' ' .
       t('Must be a positive integer less than the maximum status message length, or zero to ignore this option.'),
     '#default_value' => variable_get('facebook_status_hide_length', 0),
     '#size' => 3,
@@ -98,8 +99,8 @@ function facebook_status_admin_advanced(
   $form['facebook_status_nl2br'] = array(
     '#type' => 'checkbox',
     '#title' => t('Convert line breaks'),
-    '#description' => t('By default, line breaks in the status update form are ignored.') .' '.
-      t('If you use an input filter to fix that, the status text will appear on a different line than the username and other information.') .' '.
+    '#description' => t('By default, line breaks in the status update form are ignored.') . ' ' .
+      t('If you use an input filter to fix that, the status text will appear on a different line than the username and other information.') . ' ' .
       t('Enabling this setting allows line breaks to appear without the side-effect of the input filter.'),
     '#default_value' => variable_get('facebook_status_nl2br', 0),
     '#weight' => -60,
@@ -107,9 +108,9 @@ function facebook_status_admin_advanced(
   $form['facebook_status_refresh'] = array(
     '#type' => 'checkbox',
     '#title' => t('Show AJAX "Refresh" link after status update views'),
-    '#description' => t('Display a "Refresh" link under content that will be automatically refreshed when the status update form is submitted.') .' '.
-      t('Clicking the link will similarly update the related content via JavaScript, without refreshing the page.') .' '.
-      t('Obviously, the "Refresh" link will only appear when there is something that can be refreshed.') .' '.
+    '#description' => t('Display a "Refresh" link under content that will be automatically refreshed when the status update form is submitted.') . ' ' .
+      t('Clicking the link will similarly update the related content via JavaScript, without refreshing the page.') . ' ' .
+      t('Obviously, the "Refresh" link will only appear when there is something that can be refreshed.') . ' ' .
       t('If you disable AHAH refreshing below or if you have no views attached to your status update forms, this setting is useless.'),
     '#default_value' => variable_get('facebook_status_refresh', 0),
     '#weight' => -50,
@@ -117,7 +118,7 @@ function facebook_status_admin_advanced(
   $form['facebook_status_profile'] = array(
     '#type' => 'checkbox',
     '#title' => t('Show the status stream on the default user profiles'),
-    '#description' => t('If enabled, the status update form and view will appear on default user profiles.') .' '.
+    '#description' => t('If enabled, the status update form and view will appear on default user profiles.') . ' ' .
       t('This setting should only matter if you have not overridden the default user profile.'),
     '#default_value' => variable_get('facebook_status_profile', 1),
     '#weight' => -40,
@@ -125,7 +126,7 @@ function facebook_status_admin_advanced(
   $form['facebook_status_default_text'] = array(
     '#type' => 'textfield',
     '#title' => t('Default text'),
-    '#description' => t('The text that appears by default in the status update box.') .' '.
+    '#description' => t('The text that appears by default in the status update box.') . ' ' .
       t('This will be automatically cleared when a user clicks in (or focuses on) the status update box.'),
     '#default_value' => variable_get('facebook_status_default_text', ''),
     '#weight' => -30,
@@ -196,7 +197,7 @@ function facebook_status_admin_contexts(
   }
   foreach ($data as $type => $values) {
     $form['components'][$type]['title'] = array(
-      '#prefix' => '<div title="'. (isset($values['description']) ? $values['description'] : '') .'">',
+      '#prefix' => '<div title="' . (isset($values['description']) ? $values['description'] : '') . '">',
       '#value' => $values['title'],
       '#suffix' => '</div>',
     );
@@ -208,8 +209,8 @@ function facebook_status_admin_contexts(
     $form['components'][$type]['link'] = array(
       '#value' => l(
         t('Configure'),
-        'admin/settings/facebook_status/contexts/'. $type,
-        array('query' => array('destination' => 'admin/settings/facebook_status/contexts'))
+        'admin/config/facebook_status/contexts/' . $type,
+        array('query' => array('destination' => 'admin/config/facebook_status/contexts'))
       ),
     );
     $form['components'][$type]['weight'] = array(
@@ -281,7 +282,8 @@ function facebook_status_admin_contexts_
 /**
  * Themes the stream context configuration form in a draggable table.
  */
-function theme_facebook_status_admin_contexts($form) {
+function theme_facebook_status_admin_contexts($variables) {
+  $form = $variables['form'];
   drupal_add_tabledrag('facebook-status-admin-contexts-table', 'order', 'sibling', 'weight-group');
   $header = array(t('Title'), t('View'), t('Actions'), t('Weight'), '', '');
   $rows = array();
@@ -300,11 +302,14 @@ function theme_facebook_status_admin_con
     $row[] = drupal_render($element['weight']);
     $row[] = drupal_render($element['type']);
     $row[] = drupal_render($element['already_saved']);
-    $rows[] = array('data' => $row, 'class' => 'draggable');
+    $rows[] = array(
+      'data' => $row,
+      'class' => 'draggable',
+    );
   }
-  $output = '<p>'. t('The view assigned to the "User profiles" context does not affect the view shown on conversation pages.') .'</p>';
-  $output .= theme('table', $header, $rows, array('id' => 'facebook-status-admin-contexts-table'));
-  $output .= drupal_render($form);
+  $output = '<p>' . t('The view assigned to the "User profiles" context does not affect the view shown on conversation pages.') . '</p>';
+  $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'facebook-status-admin-contexts-table')));
+  $output .= drupal_render_children($form);
   return $output;
 }
 
@@ -318,7 +323,7 @@ function facebook_status_admin_context_s
 
   if ($type == 'user') {
     $form['notice'] = array(
-      '#value' => '<p>'. t('The view assigned to the "User profiles" context does not affect the view shown on conversation pages.') .'</p>',
+      '#value' => '<p>' . t('The view assigned to the "User profiles" context does not affect the view shown on conversation pages.') . '</p>',
     );
   }
 
@@ -332,17 +337,17 @@ function facebook_status_admin_context_s
   $form['view'] = array(
     '#type' => 'select',
     '#title' => t('View'),
-    '#description' => t('Show this view for !type streams.', array('@type' => $context['title'])) .' '. t('The "default" display will be used.'),
+    '#description' => t('Show this view for !type streams.', array('@type' => $context['title'])) . ' ' . t('The "default" display will be used.'),
     '#default_value' => isset($context['view']) ? $context['view'] : '',
     '#options' => $options,
   );
   if ($type == 'user') {
     $form['view']['#title'] = t('View for "my stream"');
-    $form['view']['#description'] = t('Show this view for user streams when a user is looking at their own stream.') .' '. t('The "default" display will be used.');
+    $form['view']['#description'] = t('Show this view for user streams when a user is looking at their own stream.') . ' ' . t('The "default" display will be used.');
     $form['other_view'] = array(
       '#type' => 'select',
       '#title' => t("View for others users' streams"),
-      '#description' => t("Show this view for user streams when a user is looking at another user's stream.") .' '. t('The "default" display will be used.'),
+      '#description' => t("Show this view for user streams when a user is looking at another user's stream.") . ' ' . t('The "default" display will be used.'),
       '#default_value' => variable_get('facebook_status_user_other_view', 'facebook_status_stream'),
       '#options' => $options,
     );
@@ -353,18 +358,18 @@ function facebook_status_admin_context_s
     '#rows' => 2,
     '#default_value' => isset($context['selectors']) ? $context['selectors'] : '',
     '#title' => t('Refreshable DOM selectors'),
-    '#description' => '<p>'.
-      t('Enter CSS selectors that specify sections of the page that should be automatically refreshed via AJAX when a status of that type is submitted.') .' '.
-      t('For example, to automatically update all &lt;div&gt; elements with class "myclass", enter "div.myclass" in the box (without the quotes).') .' '.
-      t('Do not include selectors that include the status update form.') .' '.
+    '#description' => '<p>' .
+      t('Enter CSS selectors that specify sections of the page that should be automatically refreshed via AJAX when a status of that type is submitted.') . ' ' .
+      t('For example, to automatically update all &lt;div&gt; elements with class "myclass", enter "div.myclass" in the box (without the quotes).') . ' ' .
+      t('Do not include selectors that include the status update form.') . ' ' .
       t('Enter each selector on a separate line.') .
       '</p>',
   );
 
   // adapted from block_admin_configure()
   $form['page_vis_settings'] = array(
-    '#type' => 'fieldset', 
-    '#title' => t('Advanced: change where this context applies'), 
+    '#type' => 'fieldset',
+    '#title' => t('Advanced: change where this context applies'),
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
   );
@@ -382,25 +387,29 @@ function facebook_status_admin_context_s
   }
   else {
     $form['page_vis_settings']['warning'] = array(
-      '#value' => '<p><strong>'. t('Changing these values could break your site. Only change these settings if you know what you are doing.') .'</strong></p>
-        <p>'. t('Specifically, most contexts make assumptions about what pages they are enabled on in order to identify the correct recipient of status messages.') .' '.
-          t('Enabling a context on an unsupported page will cause that context to fail.') .' '.
-          t('Additionally, the User context should apply on all pages as a fallback. If no context applies on a given page, errors will occur.') .'</p>',
+      '#value' => '<p><strong>' . t('Changing these values could break your site. Only change these settings if you know what you are doing.') . '</strong></p>
+        <p>' . t('Specifically, most contexts make assumptions about what pages they are enabled on in order to identify the correct recipient of status messages.') . ' ' .
+          t('Enabling a context on an unsupported page will cause that context to fail.') . ' ' .
+          t('Additionally, the User context should apply on all pages as a fallback. If no context applies on a given page, errors will occur.') . '</p>',
+    );
+    $options = array(
+      -1 => t('Use module default settings.'),
+      0 => t('Show on every page except the listed pages.'),
+      1 => t('Show on only the listed pages.'),
     );
-    $options = array(-1 => t('Use module default settings.'), 0 => t('Show on every page except the listed pages.'), 1 => t('Show on only the listed pages.'));
     $description = t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>'));
     if ($access) {
       $options[2] = t('Show if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).');
-      $description .= ' '. t('If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.', array('%php' => '<?php ?>'));
+      $description .= ' ' . t('If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.', array('%php' => '<?php ?>'));
     }
     if (module_exists('context')) {
       $options[3] = t('Use the conditions from a Context from the Context module');
-      drupal_add_js(drupal_get_path('module', 'facebook_status') .'/resources/facebook_status_admin.js');
+      drupal_add_js(drupal_get_path('module', 'facebook_status') . '/resources/facebook_status_admin.js');
     }
     $form['page_vis_settings']['visibility'] = array(
       '#type' => 'radios',
-      '#title' => t('Apply context on specific pages'), 
-      '#options' => $options, 
+      '#title' => t('Apply context on specific pages'),
+      '#options' => $options,
       '#default_value' => isset($context['visibility']) ? ($context['visibility'] == 3 && !module_exists('context') ? -1 : $context['visibility']) : -1,
     );
     if (module_exists('context')) {
@@ -419,9 +428,9 @@ function facebook_status_admin_context_s
       );
     }
     $form['page_vis_settings']['pages'] = array(
-      '#type' => 'textarea', 
-      '#title' => t('Pages'), 
-      '#default_value' => isset($context['pages']) ? $context['pages'] : '', 
+      '#type' => 'textarea',
+      '#title' => t('Pages'),
+      '#default_value' => isset($context['pages']) ? $context['pages'] : '',
       '#description' => $description,
     );
   }
diff -up -r includes/utility/facebook_status.ahah.inc includes/utility/facebook_status.ahah.inc
--- includes/utility/facebook_status.ahah.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/utility/facebook_status.ahah.inc	2011-07-24 17:13:24.000000000 -0400
@@ -11,11 +11,14 @@
 function facebook_status_save_js() {
   //Make sure we have form stuff available.
   module_load_include('inc', 'facebook_status', 'includes/utility/facebook_status.form');
-  $form_state = array('storage' => NULL, 'submitted' => FALSE);
+  $form_state = array(
+    'storage' => NULL,
+    'submitted' => FALSE,
+  );
   $form_build_id = $_POST['form_build_id'];
   $form = form_get_cache($form_build_id, $form_state);
   $form_state['post'] = $form['#post'] = $_POST;
-  $form['#programmed'] = $form['#redirect'] = FALSE;
+  $form['#programmed'] = $form_state['#redirect'] = FALSE;
   $args = $form['#parameters'];
   //This happens if someone goes directly to the JS processing page.
   if (!is_array($args) && !$args) {
@@ -39,6 +42,7 @@ function facebook_status_save_js() {
   //If the $form['fbss-submit']['#ahah']['wrapper'] div was found in a #prefix or #suffix of a form element that we re-rendered here,
   //then we would have to unset() it to prevent duplicate wrappers. However, we have a somewhat unique implementation in which the wrappers
   //are actually their own elements, so this is not an issue.
+  // TODO Please change this theme call to use an associative array for the $variables parameter.
   $output = theme('status_messages') . drupal_render($new_form);
 
   //Return the results.
@@ -47,9 +51,9 @@ function facebook_status_save_js() {
   //This version does work for these things.
   //From the AHAH Helper module, see http://drupal.org/node/331941
   //And from the Filefield module.
-  $javascript = drupal_add_js(NULL, NULL, 'header');
+  $javascript = drupal_add_js(NULL, array('type' => NULL));
   $GLOBALS['devel_shutdown'] = FALSE; //Still not really sure what the point of this is.
-  echo drupal_to_js(array(
+  echo drupal_json_encode(array(
     'status' => TRUE,
     'data' => $output,
     'settings' => call_user_func_array('array_merge_recursive', $javascript['setting']),
diff -up -r includes/utility/facebook_status.announce.inc includes/utility/facebook_status.announce.inc
--- includes/utility/facebook_status.announce.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/utility/facebook_status.announce.inc	2011-07-24 17:13:24.000000000 -0400
@@ -24,14 +24,14 @@ function facebook_status_announce_admin(
     '#required' => TRUE,
   );
   /*
-  // Unfortunately we have to use the default format because we don't have any
-  // way to keep track of which format to use at display time.
-  $formats = filter_formats();
-  $f = array();
-  foreach ($formats as $format) {
-    $f[$format->format] = filter_xss($format->name);
-  }
-  $form['format'] = filter_form();
+   // Unfortunately we have to use the default format because we don't have any
+   // way to keep track of which format to use at display time.
+   $formats = filter_formats();
+   $f = array();
+   foreach ($formats as $format) {
+   $f[$format->format] = filter_xss($format->name);
+   }
+   $form['format'] = filter_form();
    */
   $form['send'] = array(
     '#type' => 'submit',
@@ -53,14 +53,14 @@ function facebook_status_announce_admin_
     $v['format'] = NULL;
   }
 
-  $count = db_result(db_query("SELECT COUNT(*) FROM {users} WHERE status = 1"));
+  $count = db_query("SELECT COUNT(*) FROM {users} WHERE status = :status", array(':status' => 1))->fetchField();
   $batch = array(
     'operations' => array(
       array('facebook_status_announce_generate_status', array($v['message'], $from, $count, $v['format'])),
     ),
     'finished' => 'facebook_status_announce_batch_finished',
     'title' => t('Sending message to all users'),
-    'file' => drupal_get_path('module', 'facebook_status') .'/facebook_status.announce.inc',
+    'file' => drupal_get_path('module', 'facebook_status') . '/facebook_status.announce.inc',
   );
   batch_set($batch);
 }
@@ -81,10 +81,10 @@ function facebook_status_announce_genera
   if (!isset($context['sandbox']['progress'])) {
     $context['sandbox']['progress'] = 0;
   }
-  $uid = db_result(db_query_range("SELECT uid FROM {users} WHERE status = 1", $context['sandbox']['progress'], 1));
+  $uid = db_query_range("SELECT uid FROM {users} WHERE status = :status", array(':status' => 1))->fetchField();
   // Caching here is actually slower than not caching because we should only load each user once.
   // So we use user_load() instead of _facebook_status_user_load().
-  $to = user_load(array('uid' => $uid));
+  $to = user_load($uid);
   facebook_status_save_status($to, 'user', $message, $from);
   $context['message'] = t('Sending message to %user (@current of @total)',
     array('%user' => $to->name, '@current' => $context['sandbox']['progress'], '@total' => $count));
@@ -103,7 +103,7 @@ function facebook_status_announce_batch_
       drupal_set_message(format_plural(count($results),
         'Sent message to 1 user: !list',
         'Sent message to @count users: !list',
-        array('!list' => theme('item_list', $results))
+        array('!list' => theme('item_list', array('items' => $results)))
       ));
     }
     else {
@@ -114,9 +114,9 @@ function facebook_status_announce_batch_
     $error_operation = reset($operations);
     drupal_set_message(t('An error occurred while processing %error_operation with arguments: @arguments',
       array(
-        '%error_operation' => $error_operation[0],
-        '@arguments' => print_r($error_operation[1], TRUE)
-      )
+      '%error_operation' => $error_operation[0],
+      '@arguments' => print_r($error_operation[1], TRUE),
+    )
     ));
   }
 }
diff -up -r includes/utility/facebook_status.contexts.inc includes/utility/facebook_status.contexts.inc
--- includes/utility/facebook_status.contexts.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/utility/facebook_status.contexts.inc	2011-07-24 17:13:24.000000000 -0400
@@ -40,7 +40,7 @@ class facebook_status_context {
    * Returns an object representing the recipient given the recipient's ID.
    */
   function load_recipient($id) {
-    return call_user_func($this->type() .'_load', $id);
+    return call_user_func($this->type() . '_load', $id);
   }
 
   /**
@@ -72,7 +72,7 @@ class facebook_status_context {
    * Returns a URL to the recipient given an object representing the recipient.
    */
   function recipient_url($recipient) {
-    return $this->type() .'/'. $this->recipient_id($recipient);
+    return $this->type() . '/' . $this->recipient_id($recipient);
   }
 
   /**
@@ -160,11 +160,11 @@ class facebook_status_user_context exten
     return _facebook_status_user_load($id);
   }
   function load_random_recipient() {
-    $uid = db_result(db_query_range("SELECT uid FROM {users} WHERE status = 1 ORDER BY RAND() ASC", 0, 1));
+    $uid = db_query_range("SELECT uid FROM {users} WHERE status = :status ORDER BY RAND() ASC", array(':status' => 1))->fetchField();
     return $this->load_recipient($uid);
   }
   function recipient_link($recipient) {
-    return theme('username', $recipient);
+    return theme('username', array('account' => $recipient));
   }
   function access_add($recipient, $sender) {
     return ($sender->uid == $recipient->uid && user_access('update and view own stream', $sender)) ||
@@ -194,8 +194,8 @@ class facebook_status_node_context exten
     return isset($recipient->nid) ? $recipient->nid : 0;
   }
   function load_random_recipient() {
-    $nid = db_result(db_query_range("SELECT nid FROM {node} ORDER BY RAND() ASC", 0, 1));
-    return node_load(array('nid' => $nid));
+    $nid = db_query_range("SELECT nid FROM {node} ORDER BY RAND() ASC")->fetchField();
+    return node_load($nid);
   }
   function access_add($recipient, $sender) {
     return parent::access_add($recipient, $sender) || $sender->uid == $recipient->uid;
@@ -231,7 +231,7 @@ class facebook_status_og_context extends
     return node_load($id);
   }
   function recipient_url($recipient) {
-    return 'node/'. $recipient->nid;
+    return 'node/' . $recipient->nid;
   }
   function access_add($recipient, $sender) {
     // Only group members can add content of any kind.
@@ -265,20 +265,20 @@ class facebook_status_term_context exten
     return arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2));
   }
   function find_recipient() {
-    return $this->is_applicable() ? taxonomy_get_term(arg(2)) : new stdClass();
+    return $this->is_applicable() ? taxonomy_term_load(arg(2)) : new stdClass();
   }
   function load_recipient($id) {
-    return taxonomy_get_term($id);
+    return taxonomy_term_load($id);
   }
   function load_random_recipient() {
-    $tid = db_result(db_query_range("SELECT tid FROM {term_data} ORDER BY RAND() ASC", 0, 1));
-    return taxonomy_get_term($tid);
+    $tid = db_query_range("SELECT tid FROM {taxonomy_term_data} ORDER BY RAND() ASC")->fetchField();
+    return taxonomy_term_load($tid);
   }
   function recipient_id($recipient) {
     return isset($recipient->tid) ? $recipient->tid : 0;
   }
   function recipient_url($recipient) {
-    return 'taxonomy/term/'. $this->recipient_id($recipient);
+    return 'taxonomy/term/' . $this->recipient_id($recipient);
   }
   function recipient_name($recipient) {
     return isset($recipient->name) ? $recipient->name : '';
diff -up -r includes/utility/facebook_status.conversation.inc includes/utility/facebook_status.conversation.inc
--- includes/utility/facebook_status.conversation.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/utility/facebook_status.conversation.inc	2011-07-24 17:13:24.000000000 -0400
@@ -54,7 +54,7 @@ function _facebook_status_conversation()
   $key = $key ? 0 : 1; //The recipient is not the current user.
   $recipient = _facebook_status_user_load($args[$key]);
   if (facebook_status_user_access('converse') && !empty($recipient->uid)) {
-    return theme('facebook_status_form_display', $recipient, 'user');
+    return theme('facebook_status_form_display', array('recipient' => $recipient, 'type' => 'user'));
   }
   drupal_not_found();
 }
diff -up -r includes/utility/facebook_status.edit.inc includes/utility/facebook_status.edit.inc
--- includes/utility/facebook_status.edit.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/utility/facebook_status.edit.inc	2011-07-24 17:13:24.000000000 -0400
@@ -11,9 +11,9 @@
 function facebook_status_edit(&$form_state, $status) {
   $context = facebook_status_determine_context($status->type);
   $maxlength = variable_get('facebook_status_length', 140);
-  $path = drupal_get_path('module', 'facebook_status') .'/resources';
-  drupal_add_js($path .'/facebook_status.js');
-  drupal_add_css($path .'/facebook_status.css');
+  $path = drupal_get_path('module', 'facebook_status') . '/resources';
+  drupal_add_js($path . '/facebook_status.js');
+  drupal_add_css($path . '/facebook_status.css');
   if (module_exists('modalframe')) {
     modalframe_child_js();
   }
@@ -24,8 +24,8 @@ function facebook_status_edit(&$form_sta
   }
   $form = array('#cache' => TRUE);
   $form['intro'] = array(
-    '#value' => '<div class="clear-block facebook-status-update facebook-status-form-type-'. $status->type . $self .'">'.
-      '<span class="facebook-status-intro">'. $intro .'</span>',
+    '#value' => '<div class="clear-block facebook-status-update facebook-status-form-type-' . $status->type . $self . '">' .
+      '<span class="facebook-status-intro">' . $intro . '</span>',
     '#weight' => -45,
   );
   $form['fbss-status'] = array(
@@ -38,7 +38,7 @@ function facebook_status_edit(&$form_sta
   );
   if ($maxlength > 0) {
     $form['chars'] = array(
-      '#value' => '<span class="facebook-status-chars">'. t('%chars characters allowed', array('%chars' => $maxlength)) .'</span>',
+      '#value' => '<span class="facebook-status-chars">' . t('%chars characters allowed', array('%chars' => $maxlength)) . '</span>',
       '#weight' => -38,
     );
   }
@@ -85,11 +85,11 @@ function facebook_status_edit_submit($fo
 /**
  * The delete status confirmation form.
  */
-function _facebook_status_delete(&$form_state, $status) {
+function _facebook_status_delete($form, &$form_state, $status) {
   if (module_exists('modalframe')) {
     modalframe_child_js();
   }
-  $form['infotext'] = array('#value' => '<p>'. t('Are you sure you want to permanently delete the status %status?', array('%status' => $status->message)) .'</p>');
+  $form['infotext'] = array('#value' => '<p>' . t('Are you sure you want to permanently delete the status %status?', array('%status' => $status->message)) . '</p>');
   $form['confirm'] = array(
     '#type' => 'submit',
     '#value' => t('Confirm'),
@@ -156,47 +156,47 @@ function _facebook_status_get_edit_intro
   $orig = nl2br(check_plain($status->message));
   if ($status->type == 'user') {
     if ($user->uid == $status->sender && $status->sender == $status->recipient) {
-      $intro = '<strong>'. t('Original status: !status', array('!status' => $orig)) .' </strong>';
+      $intro = '<strong>' . t('Original status: !status', array('!status' => $orig)) . ' </strong>';
     }
     elseif ($user->uid == $status->sender) {
-      $intro = '<strong>'. t('Original message from you to !recipient: !status', array(
-        '!recipient' => theme('username', _facebook_status_user_load($status->recipient)),
-        '!status' => $orig
-      )) .'</strong>';
+      $intro = '<strong>' . t('Original message from you to !recipient: !status', array(
+        '!recipient' => theme('username', array('account' => _facebook_status_user_load($status->recipient))),
+        '!status' => $orig,
+      )) . '</strong>';
     }
     elseif ($user->uid == $status->recipient) {
-      $intro = '<strong>'. t('Original message from !sender to you: !status', array(
-        '!sender' => theme('username', _facebook_status_user_load($status->sender)),
-        '!status' => $orig
-      )) .'</strong>';
+      $intro = '<strong>' . t('Original message from !sender to you: !status', array(
+        '!sender' => theme('username', array('account' => _facebook_status_user_load($status->sender))),
+        '!status' => $orig,
+      )) . '</strong>';
     }
     elseif ($status->sender == $status->recipient) {
-      $intro = '<strong>'. t('Original status by !creator: !status', array(
-        '!creator' => theme('username', _facebook_status_user_load($status->sender)),
-        '!status' => $orig
-      )) .'</strong>';
+      $intro = '<strong>' . t('Original status by !creator: !status', array(
+        '!creator' => theme('username', array('account' => _facebook_status_user_load($status->sender))),
+        '!status' => $orig,
+      )) . '</strong>';
     }
     else {
-      $intro = '<strong>'. t('Original message from !sender to !recipient: !status', array(
-        '!sender' => theme('username', _facebook_status_user_load($status->sender)),
-        '!recipient' => theme('username', _facebook_status_user_load($status->recipient)),
-        '!status' => $orig
-      )) .'</strong>';
+      $intro = '<strong>' . t('Original message from !sender to !recipient: !status', array(
+        '!sender' => theme('username', array('account' => _facebook_status_user_load($status->sender))),
+        '!recipient' => theme('username', array('account' => _facebook_status_user_load($status->recipient))),
+        '!status' => $orig,
+      )) . '</strong>';
     }
   }
   else {
     if ($status->sender == $user->uid) {
-      $intro = '<strong>'. t('Original message from you to !recipient: !status', array(
+      $intro = '<strong>' . t('Original message from you to !recipient: !status', array(
         '!recipient' => $context['handler']->recipient_link($context['handler']->load_recipient($status->recipient)),
-        '!status' => $orig
-      )) .'</strong>';
+        '!status' => $orig,
+      )) . '</strong>';
     }
     else {
-      $intro = '<strong>'. t('Original message from !sender to !recipient: !status', array(
-        '!sender' => theme('username', _facebook_status_user_load($status->sender)),
+      $intro = '<strong>' . t('Original message from !sender to !recipient: !status', array(
+        '!sender' => theme('username', array('account' => _facebook_status_user_load($status->sender))),
         '!recipient' => $context['handler']->recipient_link($context['handler']->load_recipient($status->recipient)),
-        '!status' => $orig
-      )) .'</strong>';
+        '!status' => $orig,
+      )) . '</strong>';
     }
   }
   return $intro;
diff -up -r includes/utility/facebook_status.form.inc includes/utility/facebook_status.form.inc
--- includes/utility/facebook_status.form.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/utility/facebook_status.form.inc	2011-07-24 17:13:24.000000000 -0400
@@ -32,7 +32,11 @@
  *   - There are no relevant status messages and the current user does not
  *     have access to use the form
  */
-function theme_facebook_status_form_display($context = NULL, $type = NULL, $view = NULL, $display = 'default') {
+function theme_facebook_status_form_display($variables) {
+  $context = $variables['recipient'];
+  $type = $variables['type'];
+  $view = $variables['view'];
+  // TODO Number of parameters in this theme funcion does not match number of parameters found in hook_theme.
   global $user;
   // $context is NULL, so find everything.
   if (empty($context)) {
@@ -69,8 +73,8 @@ function theme_facebook_status_form_disp
     if ($conversation) {
       $converse = ' facebook-status-conversation-form';
     }
-    $output .= '<div class="clear-block facebook-status-update facebook-status-update-main facebook-status-form-type-'. $type . $self . $converse .'">'.
-      drupal_get_form('facebook_status_box', $recipient, $type) .'</div>';
+    $output .= '<div class="clear-block facebook-status-update facebook-status-update-main facebook-status-form-type-' . $type . $self . $converse . '">' .
+      drupal_get_form('facebook_status_box', $recipient, $type) . '</div>';
   }
   if ($conversation) {
     $args = explode(',', arg(2));
@@ -91,13 +95,13 @@ function theme_facebook_status_form_disp
     else {
       $output .= views_embed_view($view, $display, $context['handler']->recipient_id($recipient), $type);
     }
-    $selectors[] = '.view-id-'. $view;
+    $selectors[] = '.view-id-' . $view;
   }
   if (!empty($selectors)) {
     drupal_alter('facebook_status_refresh_selectors', $selectors, $recipient, $type);
     drupal_add_js(array('facebook_status' => array(
-      'refreshIDs' => array_unique($selectors)
-    )), 'setting');
+        'refreshIDs' => array_unique($selectors),
+      )), array('type' => 'setting', 'scope' => JS_DEFAULT));
   }
   return $output;
 }
@@ -112,7 +116,7 @@ function theme_facebook_status_form_disp
  * @return
  *   A $form array.
  */
-function facebook_status_box(&$form_state, $recipient, $type = 'user') {
+function facebook_status_box($form, &$form_state, $recipient, $type = 'user') {
   global $user;
   _facebook_status_use_autogrow();
   if (isset($form_state['facebook_status'])) {
@@ -144,10 +148,10 @@ function facebook_status_box(&$form_stat
     $rs = facebook_status_load($_GET['sid']);
     $sender = _facebook_status_user_load($rs->sender);
     if ($sender->uid != $user->uid && $rs->message) {
-      $name = '@'. $sender->name;
+      $name = '@' . $sender->name;
       // Properly reference tags with word-break characters in them.
       if (preg_match('/.+\b.+/', $sender->name)) {
-        $name = '['. $name .']';
+        $name = '[' . $name . ']';
       }
       $default = str_replace(array('@name', '@message'), array($name, $rs->message), variable_get('facebook_status_repost', 'Re: @name @message '));
       $intro = '';
@@ -156,23 +160,23 @@ function facebook_status_box(&$form_stat
   elseif (isset($_GET['rsid']) && is_numeric($_GET['rsid'])) {
     $status = facebook_status_load($_GET['rsid']);
     if ($status->sid) {
-      $sender = user_load(array('uid' => $status->sender));
+      $sender = user_load($status->sender);
       if ($sender->uid != $user->uid) {
-        $name = '@'. $sender->name;
+        $name = '@' . $sender->name;
         // Properly reference tags with word-break characters in them.
         if (preg_match('/.+\b.+/', $sender->name)) {
-          $name = '['. $name .']';
+          $name = '[' . $name . ']';
         }
-        $default = $name .' ';
+        $default = $name . ' ';
       }
       $intro = t('In response to: !status', array('!status' => facebook_status_show($status, array('links' => FALSE, 'extras' => FALSE))));
     }
   }
 
-  $path = drupal_get_path('module', 'facebook_status') .'/resources';
-  drupal_add_js($path .'/facebook_status.js');
-  drupal_add_js($path .'/facebook_status_ahah.js', 'module', 'footer');
-  drupal_add_css($path .'/facebook_status.css');
+  $path = drupal_get_path('module', 'facebook_status') . '/resources';
+  drupal_add_js($path . '/facebook_status.js');
+  drupal_add_js($path . '/facebook_status_ahah.js', array('scope' => 'footer'));
+  drupal_add_css($path . '/facebook_status.css');
   $form = array('#cache' => TRUE);
   // Form elements between ['opendiv'] and ['closediv'] will be refreshed via AHAH on form submission.
   $form['opendiv'] = array(
@@ -181,13 +185,13 @@ function facebook_status_box(&$form_stat
   );
   if (!empty($intro)) {
     $form['intro'] = array(
-      '#value' => '<span class="facebook-status-intro">'. $intro .'</span>',
+      '#value' => '<span class="facebook-status-intro">' . $intro . '</span>',
       '#weight' => -45,
     );
   }
   if (variable_get('facebook_status_length', 140) > 0) {
     $form['chars'] = array(
-      '#value' => '<span class="facebook-status-chars">'. t('%chars characters allowed', array('%chars' => variable_get('facebook_status_length', 140))) .'</span>',
+      '#value' => '<span class="facebook-status-chars">' . t('%chars characters allowed', array('%chars' => variable_get('facebook_status_length', 140))) . '</span>',
       '#weight' => module_exists('fbss_privacy') ? -41 : -24,
     );
   }
@@ -295,7 +299,7 @@ function _facebook_status_use_autogrow()
     return;
   }
   if (module_exists('libraries')) {
-    $path = libraries_get_path('autogrow') .'/jquery.autogrow.js';
+    $path = libraries_get_path('autogrow') . '/jquery.autogrow.js';
     if (file_exists($path)) {
       drupal_add_js($path);
       cache_set('fbss:autogrow', $path);
@@ -311,7 +315,7 @@ function _facebook_status_use_autogrow()
     cache_set('fbss:autogrow', 'libraries/jquery.autogrow.js');
   }
   else {
-    $path = drupal_get_path('profile', $GLOBALS['profile']) .'/libraries/jquery.autogrow.js';
+    $path = drupal_get_path('profile', $GLOBALS['profile']) . '/libraries/jquery.autogrow.js';
     if (file_exists($path)) {
       drupal_add_js($path);
       cache_set('fbss:autogrow', $path);
diff -up -r includes/utility/facebook_status.generate.inc includes/utility/facebook_status.generate.inc
--- includes/utility/facebook_status.generate.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/utility/facebook_status.generate.inc	2011-07-24 17:13:24.000000000 -0400
@@ -83,7 +83,7 @@ function facebook_status_generate_form_s
       'title' => t('Generating statuses'),
       'operations' => $operations,
       'finished' => 'facebook_status_generate_finished',
-      'file' => drupal_get_path('module', 'facebook_status') .'/includes/utility/facebook_status.generate.inc',
+      'file' => drupal_get_path('module', 'facebook_status') . '/includes/utility/facebook_status.generate.inc',
     ));
   }
   else {
@@ -127,7 +127,7 @@ function facebook_status_generate_status
  */
 function facebook_status_generate_status($time, $types, $tags, &$context) {
   module_load_include('inc', 'devel', 'devel_generate');
-  $stime = time() - mt_rand(0, $time);
+  $stime = REQUEST_TIME - mt_rand(0, $time);
   $uids = devel_get_users();
   $uid = 0;
   while ($uid == 0) {
@@ -159,9 +159,9 @@ function facebook_status_generate_status
       $rid = $uids[array_rand($uids)];
     }
     $person = _facebook_status_user_load($rid);
-    $text .= '@'. $person->name .' ';
+    $text .= '@' . $person->name . ' ';
     if (preg_match('/.+\b.+/', $person->name)) {
-      $text .= '[@'. $person->name .'] ';
+      $text .= '[@' . $person->name . '] ';
     }
   }
 
@@ -171,12 +171,12 @@ function facebook_status_generate_status
   if (module_exists('facebook_status_tags') && $tags && variable_get('facebook_status_tags_vid', -1) != -1 && mt_rand(0, 2) > 0) {
     $word = devel_generate_word(mt_rand(3, 7));
     if (drupal_strlen($text . $word) + 2 <= variable_get('facebook_status_length', 140)) {
-      $text .= ' #'. $word;
+      $text .= ' #' . $word;
     }
     $word = devel_generate_word(mt_rand(3, 5));
     $word2 = devel_generate_word(mt_rand(3, 5));
     if (drupal_strlen($text . $word . $word2) + 5 <= variable_get('facebook_status_length', 140)) {
-      $text .= ' [#'. $word .' '. $word2 .']';
+      $text .= ' [#' . $word . ' ' . $word2 . ']';
     }
   }
 
diff -up -r includes/views/facebook_status.views.inc includes/views/facebook_status.views.inc
--- includes/views/facebook_status.views.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/views/facebook_status.views.inc	2011-07-24 17:13:24.000000000 -0400
@@ -344,7 +344,7 @@ function facebook_status_views_data() {
 function facebook_status_views_handlers() {
   return array(
     'info' => array(
-      'path' => drupal_get_path('module', 'facebook_status') .'/includes/views/handlers',
+      'path' => drupal_get_path('module', 'facebook_status') . '/includes/views/handlers',
     ),
     'handlers' => array(
       'facebook_status_views_handler_argument_communicated' => array(
@@ -428,7 +428,7 @@ function facebook_status_views_plugins()
         'help' => t('Displays statuses as RSS items.'),
         'handler' => 'facebook_status_views_plugin_row_rss',
         'parent' => 'fields',
-        'path' => drupal_get_path('module', 'facebook_status') .'/includes/views/handlers',
+        'path' => drupal_get_path('module', 'facebook_status') . '/includes/views/handlers',
         'theme' => 'views_view_row_rss',
         'base' => array('facebook_status'),
         'uses fields' => FALSE,
diff -up -r includes/views/handlers/facebook_status_plugin_argument_validate.inc includes/views/handlers/facebook_status_plugin_argument_validate.inc
--- includes/views/handlers/facebook_status_plugin_argument_validate.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/views/handlers/facebook_status_plugin_argument_validate.inc	2011-07-24 17:13:25.000000000 -0400
@@ -11,6 +11,6 @@
 class facebook_status_plugin_argument_validate extends views_plugin_argument_validate {
   var $option_name = 'validate_argument_status';
   function validate_argument($argument) {
-    return (bool) db_result(db_query("SELECT COUNT(sid) FROM {facebook_status} WHERE sid = %d", $argument));
+    return (bool) db_query("SELECT COUNT(sid) FROM {facebook_status} WHERE sid = :sid", array(':sid' => $argument))->fetchField();
   }
 }
diff -up -r includes/views/handlers/facebook_status_views_handler_field_created.inc includes/views/handlers/facebook_status_views_handler_field_created.inc
--- includes/views/handlers/facebook_status_views_handler_field_created.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/views/handlers/facebook_status_views_handler_field_created.inc	2011-07-24 17:13:25.000000000 -0400
@@ -28,10 +28,11 @@ class facebook_status_views_handler_fiel
       $custom_format = $this->options['custom_date_format'];
     }
     if (!$value) {
+      // TODO Please change this theme call to use an associative array for the $variables parameter.
       $output .= theme('views_nodate');
     }
     else {
-      $time_diff = time() - $value; // will be positive for a datetime in the past (ago), and negative for a datetime in the future (hence)
+      $time_diff = REQUEST_TIME - $value; // will be positive for a datetime in the past (ago), and negative for a datetime in the future (hence)
       switch ($format) {
         case 'raw time ago':
           $output .= format_interval($time_diff, is_numeric($custom_format) ? $custom_format : 2);
@@ -54,13 +55,13 @@ class facebook_status_views_handler_fiel
           $output .= format_date($value, $format, $custom_format);
           break;
         case 'themed':
-          $output .= theme('facebook_status_time', $value);
+          $output .= theme('facebook_status_time', array('time' => $value));
           break;
         default:
           $output .= format_date($value, $format);
           break;
       }
     }
-    return $output .'</span>';
+    return $output . '</span>';
   }
 }
diff -up -r includes/views/handlers/facebook_status_views_handler_field_cross.inc includes/views/handlers/facebook_status_views_handler_field_cross.inc
--- includes/views/handlers/facebook_status_views_handler_field_cross.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/views/handlers/facebook_status_views_handler_field_cross.inc	2011-07-24 17:13:25.000000000 -0400
@@ -20,14 +20,14 @@ class facebook_status_views_handler_fiel
     $recipient_id = $values->{$this->aliases['recipient']};
     $sender_id = $values->{$this->field_alias};
     if ($sender_id == $recipient_id && $type == 'user') {
-      return theme('username', _facebook_status_user_load($sender_id));
+      return theme('username', array('account' => _facebook_status_user_load($sender_id)));
     }
     else {
       $context = facebook_status_determine_context($type);
       $recipient = $context['handler']->load_recipient($recipient_id);
       $args = array(
-        '!sender' => '<span class="facebook-status-sender">'. theme('username', _facebook_status_user_load($sender_id)) .'</span>',
-        '!recipient' => '<span class="facebook-status-recipient">'. $context['handler']->recipient_link($recipient) .'</span>',
+        '!sender' => '<span class="facebook-status-sender">' . theme('username', array('account' => _facebook_status_user_load($sender_id))) . '</span>',
+        '!recipient' => '<span class="facebook-status-recipient">' . $context['handler']->recipient_link($recipient) . '</span>',
       );
       return t('!sender &raquo; !recipient', $args);
     }
diff -up -r includes/views/handlers/facebook_status_views_handler_field_cross_pic.inc includes/views/handlers/facebook_status_views_handler_field_cross_pic.inc
--- includes/views/handlers/facebook_status_views_handler_field_cross_pic.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/views/handlers/facebook_status_views_handler_field_cross_pic.inc	2011-07-24 17:13:25.000000000 -0400
@@ -32,7 +32,7 @@ class facebook_status_views_handler_fiel
       $options = $this->options;
       $form['imagecache_preset'] = array(
         '#title' => t('Imagecache preset'),
-        '#type'  => 'select',
+        '#type' => 'select',
         '#options' => $opt,
         '#default_value' => $options['imagecache_preset'],
       );
@@ -54,8 +54,8 @@ class facebook_status_views_handler_fiel
         $sender->imagecache_preset = $options['imagecache_preset'];
       }
       return t('!picture !user', array(
-        '!picture' => '<span class="facebook-status-sender-picture">'. facebook_status_display_user_picture($sender) .'</span>',
-        '!user' => '<span class="facebook-status-sender">'. theme('username', $sender) .'</span>'
+        '!picture' => '<span class="facebook-status-sender-picture">' . facebook_status_display_user_picture($sender) . '</span>',
+        '!user' => '<span class="facebook-status-sender">' . theme('username', array('account' => $sender)) . '</span>',
       ));
     }
     elseif ($type == 'user') {
@@ -65,10 +65,10 @@ class facebook_status_views_handler_fiel
         $recipient->imagecache_preset = $options['imagecache_preset'];
       }
       $args = array(
-        '!sender' => '<span class="facebook-status-sender">'. theme('username', $sender) .'</span>',
-        '!recipient' => '<span class="facebook-status-recipient">'. theme('username', $recipient) .'</span>',
-        '!sender-picture' => '<span class="facebook-status-sender-picture">'. facebook_status_display_user_picture($sender) .'</span>',
-        '!recipient-picture' => '<span class="facebook-status-recipient-picture">'. facebook_status_display_user_picture($recipient) .'</span>',
+        '!sender' => '<span class="facebook-status-sender">' . theme('username', array('account' => $sender)) . '</span>',
+        '!recipient' => '<span class="facebook-status-recipient">' . theme('username', array('account' => $recipient)) . '</span>',
+        '!sender-picture' => '<span class="facebook-status-sender-picture">' . facebook_status_display_user_picture($sender) . '</span>',
+        '!recipient-picture' => '<span class="facebook-status-recipient-picture">' . facebook_status_display_user_picture($recipient) . '</span>',
       );
       return t('!sender-picture !sender &raquo; !recipient-picture !recipient', $args);
     }
@@ -80,9 +80,9 @@ class facebook_status_views_handler_fiel
         $recipient->imagecache_preset = $options['imagecache_preset'];
       }
       $args = array(
-        '!sender' => '<span class="facebook-status-sender">'. theme('username', $sender) .'</span>',
-        '!recipient' => '<span class="facebook-status-recipient">'. $context['handler']->recipient_link($recipient) .'</span>',
-        '!sender-picture' => '<span class="facebook-status-sender-picture">'. facebook_status_display_user_picture($sender) .'</span>',
+        '!sender' => '<span class="facebook-status-sender">' . theme('username', array('account' => $sender)) . '</span>',
+        '!recipient' => '<span class="facebook-status-recipient">' . $context['handler']->recipient_link($recipient) . '</span>',
+        '!sender-picture' => '<span class="facebook-status-sender-picture">' . facebook_status_display_user_picture($sender) . '</span>',
       );
       return t('!sender-picture !sender &raquo; !recipient', $args);
     }
diff -up -r includes/views/handlers/facebook_status_views_handler_field_delete.inc includes/views/handlers/facebook_status_views_handler_field_delete.inc
--- includes/views/handlers/facebook_status_views_handler_field_delete.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/views/handlers/facebook_status_views_handler_field_delete.inc	2011-07-24 17:13:25.000000000 -0400
@@ -25,12 +25,12 @@ class facebook_status_views_handler_fiel
       if (module_exists('modalframe')) {
         modalframe_parent_js();
       }
-      drupal_add_css(drupal_get_path('module', 'facebook_status') .'/resources/facebook_status.css');
+      drupal_add_css(drupal_get_path('module', 'facebook_status') . '/resources/facebook_status.css');
       $q = $_GET['q'];
       if ($q == 'facebook_status/js') {
         $q = 'user';
       }
-      return '<span class="facebook-status-delete">'. l(t('Delete'), 'statuses/'. $status->sid .'/delete', array('query' => array('destination' => $q))) .'</span>';
+      return '<span class="facebook-status-delete">' . l(t('Delete'), 'statuses/' . $status->sid . '/delete', array('query' => array('destination' => $q))) . '</span>';
     }
   }
 }
diff -up -r includes/views/handlers/facebook_status_views_handler_field_edit.inc includes/views/handlers/facebook_status_views_handler_field_edit.inc
--- includes/views/handlers/facebook_status_views_handler_field_edit.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/views/handlers/facebook_status_views_handler_field_edit.inc	2011-07-24 17:13:25.000000000 -0400
@@ -25,12 +25,12 @@ class facebook_status_views_handler_fiel
       if (module_exists('modalframe')) {
         modalframe_parent_js();
       }
-      drupal_add_css(drupal_get_path('module', 'facebook_status') .'/resources/facebook_status.css');
+      drupal_add_css(drupal_get_path('module', 'facebook_status') . '/resources/facebook_status.css');
       $q = $_GET['q'];
       if ($q == 'facebook_status/js') {
         $q = 'user';
       }
-      return '<span class="facebook-status-edit">'. l(t('Edit'), 'statuses/'. $status->sid .'/edit', array('query' => array('destination' => $q))) .'</span>';
+      return '<span class="facebook-status-edit">' . l(t('Edit'), 'statuses/' . $status->sid . '/edit', array('query' => array('destination' => $q))) . '</span>';
     }
   }
 }
diff -up -r includes/views/handlers/facebook_status_views_handler_field_last.inc includes/views/handlers/facebook_status_views_handler_field_last.inc
--- includes/views/handlers/facebook_status_views_handler_field_last.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/views/handlers/facebook_status_views_handler_field_last.inc	2011-07-24 17:13:25.000000000 -0400
@@ -12,13 +12,13 @@ class facebook_status_views_handler_fiel
   function render($values) {
     global $user;
     $uid = $values->{$this->field_alias};
-    $message = db_result(db_query_range("SELECT message FROM {facebook_status} WHERE type = 'user' AND message <> '' AND
-      ((sender = %d AND recipient = %d) OR (sender = %d AND recipient = %d))
-    ORDER BY sid DESC", $user->uid, $uid, $uid, $user->uid, 0, 1));
+    $message = db_query_range("SELECT message FROM {facebook_status} WHERE type = :type AND message <> :message AND
+      ((sender = :((sender AND recipient = :recipient) OR (sender = :(sender AND recipient = :recipient))
+    ORDER BY sid DESC", array(':type' => 'user', ':message' => '', ':((sender' => $user->uid, ':recipient' => $uid, ':(sender' => $uid, ':recipient' => $user->uid))->fetchField();
     $message = _facebook_status_run_filter($message);
     if (variable_get('facebook_status_nl2br', 0)) {
       $message = nl2br($message);
     }
-    return '<span class="facebook-status-content">'. $message .'</span>';
+    return '<span class="facebook-status-content">' . $message . '</span>';
   }
 }
diff -up -r includes/views/handlers/facebook_status_views_handler_field_message.inc includes/views/handlers/facebook_status_views_handler_field_message.inc
--- includes/views/handlers/facebook_status_views_handler_field_message.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/views/handlers/facebook_status_views_handler_field_message.inc	2011-07-24 17:13:25.000000000 -0400
@@ -14,6 +14,6 @@ class facebook_status_views_handler_fiel
     if (variable_get('facebook_status_nl2br', 0)) {
       $message = nl2br($message);
     }
-    return '<span class="facebook-status-content">'. $message .'</span>';
+    return '<span class="facebook-status-content">' . $message . '</span>';
   }
 }
diff -up -r includes/views/handlers/facebook_status_views_handler_field_recipient.inc includes/views/handlers/facebook_status_views_handler_field_recipient.inc
--- includes/views/handlers/facebook_status_views_handler_field_recipient.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/views/handlers/facebook_status_views_handler_field_recipient.inc	2011-07-24 17:13:25.000000000 -0400
@@ -34,8 +34,8 @@ class facebook_status_views_handler_fiel
     $context = facebook_status_determine_context($type);
     $recipient = $context['handler']->load_recipient($recipient_id);
     if (!empty($this->options['link_to'])) {
-      return '<span class="facebook-status-recipient">'. $context['handler']->recipient_link($recipient) .'</span>';
+      return '<span class="facebook-status-recipient">' . $context['handler']->recipient_link($recipient) . '</span>';
     }
-    return '<span class="facebook-status-recipient">'. check_plain($context['handler']->recipient_name($recipient)) .'</span>';
+    return '<span class="facebook-status-recipient">' . check_plain($context['handler']->recipient_name($recipient)) . '</span>';
   }
 }
diff -up -r includes/views/handlers/facebook_status_views_handler_field_recipient_pic.inc includes/views/handlers/facebook_status_views_handler_field_recipient_pic.inc
--- includes/views/handlers/facebook_status_views_handler_field_recipient_pic.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/views/handlers/facebook_status_views_handler_field_recipient_pic.inc	2011-07-24 17:13:25.000000000 -0400
@@ -30,7 +30,7 @@ class facebook_status_views_handler_fiel
       $options = $this->options;
       $form['imagecache_preset'] = array(
         '#title' => t('Imagecache preset'),
-        '#type'  => 'select',
+        '#type' => 'select',
         '#options' => $opt,
         '#default_value' => $options['imagecache_preset'],
       );
@@ -48,7 +48,7 @@ class facebook_status_views_handler_fiel
       if (isset($options['imagecache_preset']) && $options['imagecache_preset']) {
         $account->imagecache_preset = $options['imagecache_preset'];
       }
-      return '<span class="facebook-status-recipient-picture">'. facebook_status_display_user_picture($account) .'</span>';
+      return '<span class="facebook-status-recipient-picture">' . facebook_status_display_user_picture($account) . '</span>';
     }
   }
 }
diff -up -r includes/views/handlers/facebook_status_views_handler_field_repost.inc includes/views/handlers/facebook_status_views_handler_field_repost.inc
--- includes/views/handlers/facebook_status_views_handler_field_repost.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/views/handlers/facebook_status_views_handler_field_repost.inc	2011-07-24 17:13:25.000000000 -0400
@@ -21,7 +21,7 @@ class facebook_status_views_handler_fiel
     parent::options_form($form, $form_state);
     $form['repost_text'] = array(
       '#title' => t('Re-post text'),
-      '#type'  => 'textfield',
+      '#type' => 'textfield',
       '#description' => t('The text that will display for the "Re-post this" link.'),
       '#default_value' => $this->options['repost_text'],
     );
@@ -34,10 +34,13 @@ class facebook_status_views_handler_fiel
     $sender_uid = $values->{$this->aliases['sender']};
     // Don't allow sharing your own status.
     if (facebook_status_user_access('add') && $sender_uid != $GLOBALS['user']->uid) {
-      drupal_add_css(drupal_get_path('module', 'facebook_status') .'/resources/facebook_status.css');
+      drupal_add_css(drupal_get_path('module', 'facebook_status') . '/resources/facebook_status.css');
       $options = array(
         'attributes' => array('class' => 'facebook-status-repost'),
-        'query' => array('sid' => $values->{$this->field_alias}, 'destination' => $_GET['q'])
+        'query' => array(
+          'sid' => $values->{$this->field_alias},
+          'destination' => $_GET['q'],
+        ),
       );
       return l($this->options['repost_text'], 'statuses/share', $options);
     }
diff -up -r includes/views/handlers/facebook_status_views_handler_field_respond.inc includes/views/handlers/facebook_status_views_handler_field_respond.inc
--- includes/views/handlers/facebook_status_views_handler_field_respond.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/views/handlers/facebook_status_views_handler_field_respond.inc	2011-07-24 17:13:25.000000000 -0400
@@ -20,27 +20,31 @@ class facebook_status_views_handler_fiel
     $recipient = _facebook_status_user_load($values->{$this->aliases['recipient']});
     $sender = _facebook_status_user_load($values->{$this->field_alias});
     $type = $values->{$this->aliases['type']};
-    drupal_add_css(drupal_get_path('module', 'facebook_status') .'/resources/facebook_status.css');
+    drupal_add_css(drupal_get_path('module', 'facebook_status') . '/resources/facebook_status.css');
     $options = array('attributes' => array('class' => 'facebook-status-respond'));
     if ($type == 'user' && $sender->uid != $recipient->uid && facebook_status_user_access('view_stream', $recipient) && facebook_status_user_access('view_stream', $sender)) {
       $title = t('View conversation');
       if ($recipient->uid == $user->uid) {
         $title = t('Reply');
       }
-      return l($title, 'statuses/conversation/'. $sender->uid .','. $recipient->uid, $options);
+      return l($title, 'statuses/conversation/' . $sender->uid . ',' . $recipient->uid, $options);
     }
     elseif ($type != 'user' || ($sender->uid == $recipient->uid && $sender->uid != $user->uid)) {
-      $s = '@'. $sender->name .' ';
+      $s = '@' . $sender->name . ' ';
       // Properly reference tags with word-break characters in them.
       if (preg_match('/.+\b.+/', $sender->name)) {
-        $s = '[@'. $sender->name .'] ';
+        $s = '[@' . $sender->name . '] ';
       }
       if (variable_get('facebook_status_reply_type', 'at') == 'at') {
         // Evidently url() sanitizes query strings itself, so we don't have to use check_plain() here.
-        $options['query'] = array('s' => $s, 'rsid' => $values->{$this->aliases['sid']}, 'destination' => $_GET['q']);
+        $options['query'] = array(
+          's' => $s,
+          'rsid' => $values->{$this->aliases['sid']},
+          'destination' => $_GET['q'],
+        );
         return l(t('Respond'), 'statuses/share', $options);
       }
-      return l(t('Respond'), 'statuses/conversation/'. $sender->uid .','. $user->uid, $options);
+      return l(t('Respond'), 'statuses/conversation/' . $sender->uid . ',' . $user->uid, $options);
     }
   }
 }
diff -up -r includes/views/handlers/facebook_status_views_handler_filter_own.inc includes/views/handlers/facebook_status_views_handler_filter_own.inc
--- includes/views/handlers/facebook_status_views_handler_filter_own.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/views/handlers/facebook_status_views_handler_filter_own.inc	2011-07-24 17:13:25.000000000 -0400
@@ -22,4 +22,4 @@ class facebook_status_views_handler_filt
       $this->query->add_where(0, db_prefix_tables("($this->table_alias.type = 'user' AND $this->table_alias.sender = $this->table_alias.recipient)"));
     }
   }
-}
\ No newline at end of file
+}
diff -up -r includes/views/handlers/facebook_status_views_handler_filter_participant.inc includes/views/handlers/facebook_status_views_handler_filter_participant.inc
--- includes/views/handlers/facebook_status_views_handler_filter_participant.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/views/handlers/facebook_status_views_handler_filter_participant.inc	2011-07-24 17:13:25.000000000 -0400
@@ -16,7 +16,7 @@ class facebook_status_views_handler_filt
       '#default_value' => isset($this->value) ? $this->value : '',
       '#required' => TRUE,
     );
-  } 
+  }
   function value_validate($form, &$form_state) {
     if (!is_numeric($form_state['values']['options']['value'])) {
       form_set_error('options][value', t('The specified user ID must be numeric.'));
diff -up -r includes/views/handlers/facebook_status_views_plugin_row_rss.inc includes/views/handlers/facebook_status_views_plugin_row_rss.inc
--- includes/views/handlers/facebook_status_views_plugin_row_rss.inc	2011-07-24 17:13:08.000000000 -0400
+++ includes/views/handlers/facebook_status_views_plugin_row_rss.inc	2011-07-24 17:13:25.000000000 -0400
@@ -46,7 +46,10 @@ class facebook_status_views_plugin_row_r
     $item->description = $message;
 
     $item->elements = array(
-      array('key' => 'pubDate', 'value' => gmdate('r', $status->created)),
+      array(
+        'key' => 'pubDate',
+        'value' => gmdate('r', $status->created),
+      ),
       array(
         'key' => 'dc:creator',
         'value' => check_plain($sender->name),
@@ -55,7 +58,7 @@ class facebook_status_views_plugin_row_r
       array(
         'key' => 'guid',
         'value' => $status->sid . ' at ' . $base_url,
-        'attributes' => array('isPermaLink' => 'false')
+        'attributes' => array('isPermaLink' => 'false'),
       ),
     );
 
@@ -65,6 +68,7 @@ class facebook_status_views_plugin_row_r
       }
     }
 
+    // TODO Please change this theme call to use an associative array for the $variables parameter.
     return theme($this->theme_functions(), $this->view, $this->options, $item);
   }
 }
diff -up -r submodules/facebook_status_tags/facebook_status_tags.info submodules/facebook_status_tags/facebook_status_tags.info
--- submodules/facebook_status_tags/facebook_status_tags.info	2011-07-24 17:13:08.000000000 -0400
+++ submodules/facebook_status_tags/facebook_status_tags.info	2011-07-24 17:13:30.000000000 -0400
@@ -2,4 +2,18 @@ name = Facebook-style Statuses Tags
 description = "Converts @usernames to themed usernames and #hashtags to themed taxonomy terms on Facebook-style Statuses."
 dependencies[] = facebook_status
 package = Facebook-style Statuses
-core = 6.x
+core = 7.x
+
+files[] = facebook_status_tags.install
+files[] = facebook_status_tags.module
+files[] = facebook_status_tags.rules.inc
+files[] = views/facebook_status_tags.views.inc
+files[] = views/facebook_status_tags.views_default.inc
+files[] = views/facebook_status_tags_views_handler_argument_has_this_tag.inc
+files[] = views/facebook_status_tags_views_handler_argument_has_this_tag_id.inc
+files[] = views/facebook_status_tags_views_handler_field_all_terms.inc
+files[] = views/facebook_status_tags_views_handler_field_message.inc
+files[] = views/facebook_status_tags_views_handler_field_name.inc
+files[] = views/facebook_status_tags_views_handler_filter_has_tag.inc
+files[] = views/facebook_status_tags_views_handler_filter_has_this_tag.inc
+files[] = views/facebook_status_tags_views_handler_filter_string_type.inc
diff -up -r submodules/facebook_status_tags/facebook_status_tags.install submodules/facebook_status_tags/facebook_status_tags.install
--- submodules/facebook_status_tags/facebook_status_tags.install	2011-07-24 17:13:08.000000000 -0400
+++ submodules/facebook_status_tags/facebook_status_tags.install	2011-07-24 17:13:25.000000000 -0400
@@ -7,7 +7,7 @@
  */
 
 /**
- * Implementation of hook_schema().
+ * Implements hook_schema().
  */
 function facebook_status_tags_schema() {
   $schema = array();
@@ -52,14 +52,15 @@ function facebook_status_tags_schema() {
 }
 
 /**
- * Implementation of hook_install().
+ * Implements hook_install().
  */
 function facebook_status_tags_install() {
-  drupal_install_schema('facebook_status_tags');
+  // TODO The drupal_(un)install_schema functions are called automatically in D7.
+  // drupal_install_schema('facebook_status_tags')
 
   if (module_exists('taxonomy')) {
     // Check to see if the vocabulary already existed (i.e. from a previous installation).
-    $already_exists = db_fetch_object(db_query("SELECT vid, name FROM {vocabulary} WHERE module = 'facebook_status_tags'"));
+    $already_exists = db_fetch_object(db_query("SELECT vid, name FROM {taxonomy_vocabulary} WHERE module = :module", array(':module' => 'facebook_status_tags')));
     if ($already_exists !== FALSE) {
       variable_set('facebook_status_tags_vid', $already_exists->vid);
       drupal_set_message(st('The vocabulary "@name" has been configured for use with the Facebook-style Statuses Tags module.', array('@name' => $already_exists->name)));
@@ -77,8 +78,8 @@ function facebook_status_tags_install() 
       'module' => 'facebook_status_tags',
       'help' => '',
     );
-    taxonomy_save_vocabulary($vocab);
-    $vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE name = '%s' AND module = 'facebook_status_tags'", st('Hashtags')));
+    taxonomy_vocabulary_save($vocabulary /* TODO Vocabulary object replaces array $vocab */);
+    $vid = db_query("SELECT vid FROM {taxonomy_vocabulary} WHERE name = :name AND module = :module", array(':name' => st('Hashtags'), ':module' => 'facebook_status_tags'))->fetchField();
     variable_set('facebook_status_tags_vid', $vid);
     drupal_set_message(st('The vocabulary "Hashtags" has been created and configured for use with the Facebook-style Statuses Tags module.'));
   }
@@ -88,23 +89,24 @@ function facebook_status_tags_install() 
 }
 
 /**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
  */
 function facebook_status_tags_uninstall() {
-  drupal_uninstall_schema('facebook_status_tags');
+  // TODO The drupal_(un)install_schema functions are called automatically in D7.
+  // drupal_uninstall_schema('facebook_status_tags')
 
   if (variable_get('facebook_status_tags_vid', -1) != -1) {
     $vocabulary = taxonomy_vocabulary_load(variable_get('facebook_status_tags_vid', -1));
     if (isset($vocabulary->nodes) && count($vocabulary->nodes) == 0) {
       drupal_set_message(
-        st('The Facebook-style Statuses Tags module has been uninstalled.') .' '.
+        st('The Facebook-style Statuses Tags module has been uninstalled.') . ' ' .
         st(
           'However, the vocabulary "@name," which was used to store #hashtags for the Facebook-style Statuses Tags module, has not been deleted.',
           array('@name' => $vocabulary->name)
-        ) .' '.
+        ) . ' ' .
         st(
           'This vocabulary was not used for any other purpose, so <a href="!delete_url">deleting it</a> is recommended.',
-          array('!delete_url' => url('admin/content/taxonomy/edit/vocabulary/2', array('absolute' => TRUE)))
+          array('!delete_url' => url('admin/structure/taxonomy/edit/vocabulary/2', array('absolute' => TRUE)))
         )
       );
     }
diff -up -r submodules/facebook_status_tags/facebook_status_tags.module submodules/facebook_status_tags/facebook_status_tags.module
--- submodules/facebook_status_tags/facebook_status_tags.module	2011-07-24 17:13:08.000000000 -0400
+++ submodules/facebook_status_tags/facebook_status_tags.module	2011-07-24 17:13:26.000000000 -0400
@@ -17,29 +17,42 @@
 //===============
 
 /**
- * Implementation of hook_help().
+ * Implements hook_help().
  */
 function facebook_status_tags_help($path, $arg) {
   if ($path == 'admin/help#facebook_status_tags') {
-    return t('Modifies Facebook-style Statuses on display to replace @mentions with the themed username and #hashtags with taxonomy terms.') .' '.
+    return t('Modifies Facebook-style Statuses on display to replace @mentions with the themed username and #hashtags with taxonomy terms.') . ' ' .
       t('Please see the <a href="http://drupal.org/project/facebook_status" rel="nofollow">Facebook-style Statuses project page</a> for more information.');
   }
 }
 
 /**
- * Implementation of hook_block().
+ * Implements hook_block_info().
  */
-function facebook_status_tags_block($op = 'list', $delta = 0, $edit = NULL) {
-  if ($op == 'list') {
+function facebook_status_tags_block_info() {
+  if (TRUE) {
     $block['facebook_status_popular_tags']['info'] = t('Facebook-style Statuses Popular Tags');
     return $block;
   }
-  elseif ($op == 'view' && $delta == 'facebook_status_popular_tags') {
+}
+
+/**
+ * Implements hook_block_view().
+ */
+function facebook_status_tags_block_view($delta) {
+  if (TRUE && $delta == 'facebook_status_popular_tags') {
     $block['subject'] = t('Popular tags');
+    // TODO Please change this theme call to use an associative array for the $variables parameter.
     $block['content'] = theme('facebook_status_popular_tags');
     return $block;
   }
-  elseif ($op == 'configure' && $delta == 'facebook_status_popular_tags') {
+}
+
+/**
+ * Implements hook_block_configure().
+ */
+function facebook_status_tags_block_configure($delta) {
+  if (TRUE && $delta == 'facebook_status_popular_tags') {
     $form['facebook_status'] = array(
       '#type' => 'fieldset',
       '#title' => t('Facebook-style Statuses Settings'),
@@ -65,13 +78,24 @@ function facebook_status_tags_block($op 
     );
     return $form;
   }
-  elseif ($op == 'save' && $delta == 'facebook_status_popular_tags') {
+}
+
+/**
+ * Implements hook_block_save().
+ */
+function facebook_status_tags_block_save($delta, $edit) {
+  if (TRUE && $delta == 'facebook_status_popular_tags') {
     variable_set('facebook_status_tags_count', $edit['facebook_status']['facebook_status_tags_count']);
     variable_set('facebook_status_tags_time', $edit['facebook_status']['facebook_status_tags_time']);
   }
 }
 
 /**
+ * Implements hook_block().
+ */
+function facebook_status_tags_block_OLD($op = 'list', $delta = 0, $edit = NULL) { }
+
+/**
  * The validate function for the settings on the block form.
  */
 function facebook_status_tags_block_validate($form, &$form_state) {
@@ -82,13 +106,13 @@ function facebook_status_tags_block_vali
 }
 
 /**
- * Implementation of hook_form_FORM_ID_alter().
+ * Implements hook_form_FORM_ID_alter().
  */
 function facebook_status_tags_form_facebook_status_admin_alter(&$form, &$form_state) {
   if (module_exists('taxonomy')) {
     if (variable_get('facebook_status_tags_vid', -1) == -1) {
       drupal_set_message(
-        t('You have the Taxonomy and Facebook-style Statuses Tags modules enabled, but you have not set them up to work together!') .' '.
+        t('You have the Taxonomy and Facebook-style Statuses Tags modules enabled, but you have not set them up to work together!') . ' ' .
         t('You must set a vocabulary for #hashtags below in order for the #hashtags feature to work.'),
         'error');
     }
@@ -102,7 +126,7 @@ function facebook_status_tags_form_faceb
     if (count($options) < 2) {
       drupal_set_message(
         t('You must <a href="!vocab">create a free-tagging vocabulary</a> for use with #hashtags in order to take advantage of that feature.',
-          array('!vocab' => url('admin/content/taxonomy/add/vocabulary'))),
+          array('!vocab' => url('admin/structure/taxonomy/add/vocabulary'))),
         'error');
     }
     $form['facebook_status_tags_vid'] = array(
@@ -116,21 +140,21 @@ function facebook_status_tags_form_faceb
   }
   elseif (!module_exists('taxonomy')) {
     drupal_set_message(
-      t('You have the Facebook-style Statuses Tags module enabled.') .' '.
+      t('You have the Facebook-style Statuses Tags module enabled.') . ' ' .
       t('However, you will not be able to use #hashtags unless you <a href="!enable">enable</a> the core Taxonomy module.',
-        array('!enable' => url('admin/build/modules'))) .' '.
+        array('!enable' => url('admin/modules'))) . ' ' .
       t('Return here after enabling the Taxonomy module to configure it to accept #hashtags.')
     );
   }
 }
 
 /**
- * Implementation of hook_theme().
+ * Implements hook_theme().
  */
 function facebook_status_tags_theme($existing, $type, $theme, $path) {
   return array(
     'facebook_status_popular_tags' => array(
-      'arguments' => array(
+      'variables' => array(
         'count' => NULL,
         'time' => NULL,
       ),
@@ -149,7 +173,9 @@ function facebook_status_tags_theme($exi
  * @return
  *   An HTML representation of a list of tags.
  */
-function theme_facebook_status_popular_tags($count = NULL, $time = NULL) {
+function theme_facebook_status_popular_tags($variables) {
+  $count = $variables['count'];
+  $time = $variables['time'];
   if (!$count) {
     $count = variable_get('facebook_status_tags_count', 5);
   }
@@ -163,7 +189,7 @@ function theme_facebook_status_popular_t
     $items[] = t('!term (@count)', array('!term' => $term_link, '@count' => $term->popularity));
   }
   if (!empty($items)) {
-    return theme('item_list', $items);
+    return theme('item_list', array('items' => $items));
   }
 }
 
@@ -199,9 +225,9 @@ function facebook_status_tags_get_status
   elseif (is_string($tag)) {
     $rid = "name = '%s'";
   }
-  $sql = "SELECT fbst.sid FROM {facebook_status_tags} fbst INNER JOIN {facebook_status} fb ON fbst.sid = fb.sid WHERE fbst.". $rid ." AND fbst.type = '%s' AND ";
+  $sql = "SELECT fbst.sid FROM {facebook_status_tags} fbst INNER JOIN {facebook_status} fb ON fbst.sid = fb.sid WHERE fbst." . $rid . " AND fbst.type = '%s' AND ";
   if ($sender == 0) {
-    $sql = "SELECT sid FROM {facebook_status_tags} WHERE ". $rid ." AND type = '%s'";
+    $sql = "SELECT sid FROM {facebook_status_tags} WHERE " . $rid . " AND type = '%s'";
   }
   elseif (is_numeric($sender)) {
     $params[] = $sender;
@@ -209,7 +235,7 @@ function facebook_status_tags_get_status
   }
   elseif (is_array($sender)) {
     $params = array_merge($params, $sender);
-    $sql .= 'fb.sender IN ('. db_placeholders($sender) .')';
+    $sql .= 'fb.sender IN (' . db_placeholders($sender) . ')';
   }
   else {
     // Something unexpected happened; abort.
@@ -217,9 +243,11 @@ function facebook_status_tags_get_status
   }
 
   if ($count) {
-    $result = db_query_range($sql, $params, 0, $count);
+    // TODO Please convert this statement to the D7 database API syntax.
+    $result = db_query_range($sql, $params);
   }
   else {
+    // TODO Please convert this statement to the D7 database API syntax.
     $result = db_query($sql, $params);
   }
   $statuses = array();
@@ -248,11 +276,12 @@ function facebook_status_tags_has_tags($
       $args[] = $type;
     }
     elseif (is_array($type)) {
-      $sql .= " AND TYPE IN (". db_placeholders($type, 'text') .")";
+      $sql .= " AND TYPE IN (" . db_placeholders($type, 'text') . ")";
       $args = array_merge($args, $type);
     }
   }
-  return db_result(db_query($sql, $args));
+  // TODO Please convert this statement to the D7 database API syntax.
+  return db_query($sql, $args)->fetchField();
 }
 
 /**
@@ -268,7 +297,7 @@ function facebook_status_tags_has_tags($
  *   1 if the status has the reference or 0 if it does not.
  */
 function facebook_status_tags_status_has_tag($sid, $rid, $type = 'term') {
-  return db_result(db_query("SELECT COUNT(*) FROM {facebook_status_tags} WHERE sid = %d AND rid = %d AND type = '%s'", $sid, $rid, $type));
+  return db_query("SELECT COUNT(*) FROM {facebook_status_tags} WHERE sid = :sid AND rid = :rid AND type = :type", array(':sid' => $sid, ':rid' => $rid, ':type' => $type))->fetchField();
 }
 
 /**
@@ -284,7 +313,7 @@ function facebook_status_tags_status_has
  *   1 if the status has the reference or 0 if it does not.
  */
 function facebook_status_tags_status_has_tag_by_name($sid, $tag, $type = 'term') {
-  return db_result(db_query("SELECT COUNT(*) FROM {facebook_status_tags} WHERE sid = %d AND name = '%s' AND type = '%s'", $sid, $tag, $type));
+  return db_query("SELECT COUNT(*) FROM {facebook_status_tags} WHERE sid = :sid AND name = :name AND type = :type", array(':sid' => $sid, ':name' => $tag, ':type' => $type))->fetchField();
 }
 
 /**
@@ -298,11 +327,11 @@ function facebook_status_tags_status_has
  *   An array of term objects or user objects.
  */
 function facebook_status_tags_get_status_tags($sid, $type = 'term') {
-  $result = db_query("SELECT rid FROM {facebook_status_tags} WHERE sid = %d AND type = '%s'", $sid, $type);
+  $result = db_query("SELECT rid FROM {facebook_status_tags} WHERE sid = :sid AND type = :type", array(':sid' => $sid, ':type' => $type));
   $rids = array();
   while ($rid = db_fetch_object($result)) {
     if ($type == 'term') {
-      $rids[] = taxonomy_get_term($rid->rid);
+      $rids[] = taxonomy_term_load($rid->rid);
     }
     elseif ($type == 'user') {
       $rids[] = _facebook_status_user_load($rid->rid);
@@ -358,7 +387,7 @@ function facebook_status_tags_popular_us
  *   popular first) and with the property "popularity" added to each object.
  */
 function facebook_status_tags_popular($type = 'term', $count = 5, $time = 'all', $options = array()) {
-  $now = time();
+  $now = REQUEST_TIME;
   if (is_numeric($time)) {
     if ($time < 0) {
       $time = $now + $time;
@@ -366,11 +395,11 @@ function facebook_status_tags_popular($t
   }
   else {
     $times = array(
-      'day'   => $now -    86400,
-      'week'  => $now -   604800,
+      'day' => $now -    86400,
+      'week' => $now -   604800,
       'month' => $now -  2592000,
-      'year'  => $now - 31449600,
-      'all'   => 0,
+      'year' => $now - 31449600,
+      'all' => 0,
     );
     $time = $times[$time];
   }
@@ -402,13 +431,14 @@ function facebook_status_tags_popular($t
   }
   $args[] = $type;
   $args[] = $time;
+  // TODO Please convert this statement to the D7 database API syntax.
   $result = db_query_range("SELECT COUNT(t.sid) count, t.rid FROM {facebook_status_tags} t INNER JOIN {facebook_status} f ON t.sid = f.sid
-    WHERE ". $restrict ."t.type = '%s' AND f.created > %d GROUP BY t.rid ORDER BY count DESC, t.sid DESC", $args, 0, $count);
+    WHERE " . $restrict . "t.type = '%s' AND f.created > %d GROUP BY t.rid ORDER BY count DESC, t.sid DESC", $args);
   $tags = array();
   while ($tag = db_fetch_object($result)) {
     $c = $tag->count;
     if ($type == 'term') {
-      $tag = taxonomy_get_term($tag->rid);
+      $tag = taxonomy_term_load($tag->rid);
     }
     elseif ($type == 'user') {
       $tag = _facebook_status_user_load($tag->rid);
@@ -468,7 +498,10 @@ function _facebook_status_tags_filter($s
   uasort($words, '_facebook_status_tags_sort');
   $search = array();
   $replace = array();
-  $items = array('@' => array(), '#' => array());
+  $items = array(
+    '@' => array(),
+    '#' => array(),
+  );
   foreach ($words as $word) {
     $sb = FALSE;
     if (strpos($word, '[') === 0) {
@@ -482,7 +515,7 @@ function _facebook_status_tags_filter($s
       if ($op == '@') {
         $account = _facebook_status_user_load_by_name($match);
         if ($account->uid) {
-          $link = $op . theme('username', $account);
+          $link = $op . theme('username', array('account' => $account));
           $items['@'][] = $account;
         }
       }
@@ -494,7 +527,7 @@ function _facebook_status_tags_filter($s
             'vid' => variable_get('facebook_status_tags_vid', -1),
             'name' => $match,
           );
-          taxonomy_save_term($term);
+          taxonomy_term_save($term /* TODO Term object replaces array $term */);
         }
         $dest = _facebook_status_tags_resolve($term);
         $link = $op . l($term->name, $dest);
@@ -502,7 +535,7 @@ function _facebook_status_tags_filter($s
       }
       if ($link) {
         if ($sb) {
-          $word = '['. $word .']';
+          $word = '[' . $word . ']';
         }
         $search[] = $word;
         $replace[] = $link;
@@ -563,7 +596,7 @@ function _facebook_status_tags_resolve($
  * Gets a taxonomy term by name.
  */
 function _facebook_status_tags_get_term($name) {
-  return db_fetch_object(db_query("SELECT tid, name FROM {term_data} WHERE LOWER(name) = LOWER('%s') AND vid = %d", $name, variable_get('facebook_status_tags_vid', -1)));
+  return db_fetch_object(db_query("SELECT tid, name FROM {taxonomy_term_data} WHERE LOWER(name) = :LOWER(name) AND vid = :vid", array(':LOWER(name)' => LOWER('%s'), ':vid' => $name, '' => variable_get('facebook_status_tags_vid', - 1))));
 }
 
 //===================
@@ -571,7 +604,7 @@ function _facebook_status_tags_get_term(
 //===================
 
 /**
- * Implementation of hook_preprocess_facebook_status_item().
+ * Implements hook_preprocess_facebook_status_item().
  */
 function facebook_status_tags_preprocess_facebook_status_item(&$vars) {
   $message = $vars['message'];
@@ -582,12 +615,16 @@ function facebook_status_tags_preprocess
 }
 
 /**
- * Implementation of hook_facebook_status_save().
+ * Implements hook_facebook_status_save().
  */
 function facebook_status_tags_facebook_status_save($status, $edit = FALSE) {
   // If the status was just edited, the tags could have changed, so we flush them.
   if ($edit) {
-    db_query("DELETE FROM {facebook_status_tags} WHERE sid = %d", $status->sid);
+    // TODO Please review the conversion of this statement to the D7 database API syntax.
+    /* db_query("DELETE FROM {facebook_status_tags} WHERE sid = %d", $status->sid) */
+    db_delete('facebook_status_tags')
+  ->condition('sid', $status->sid)
+  ->execute();
   }
   $matches = _facebook_status_tags_filter($status->message, TRUE);
   // Users.
@@ -611,7 +648,7 @@ function facebook_status_tags_facebook_s
       module_invoke_all('facebook_status_tags_user_was_tagged', $status, $account);
     }
   }
-  
+
   // Terms.
   if (!module_exists('taxonomy') || variable_get('facebook_status_tags_vid', -1) == -1) {
     return;
@@ -633,13 +670,17 @@ function facebook_status_tags_facebook_s
 }
 
 /**
- * Implementation of hook_facebook_status_delete().
+ * Implements hook_facebook_status_delete().
  */
 function facebook_status_tags_facebook_status_delete($status) {
-  db_query("DELETE FROM {facebook_status_tags} WHERE sid = %d", $status->sid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {facebook_status_tags} WHERE sid = %d", $status->sid) */
+  db_delete('facebook_status_tags')
+  ->condition('sid', $status->sid)
+  ->execute();
 
   if (module_exists('activity')) {
-    $result = db_query("SELECT aid FROM {activity} WHERE type = 'facebook_status_tags' AND eid = %d", $status->sid);
+    $result = db_query("SELECT aid FROM {activity} WHERE type = :type AND eid = :eid", array(':type' => 'facebook_status_tags', ':eid' => $status->sid));
     $records = array();
     while ($record = db_fetch_object($result)) {
       $records[] = $record->aid;
@@ -655,17 +696,17 @@ function facebook_status_tags_facebook_s
 //=====================
 
 /**
- * Implementation of hook_views_api().
+ * Implements hook_views_api().
  */
 function facebook_status_tags_views_api() {
   return array(
     'api' => 2,
-    'path' => drupal_get_path('module', 'facebook_status_tags') .'/views',
+    'path' => drupal_get_path('module', 'facebook_status_tags') . '/views',
   );
 }
 
 /**
- * Implementation of hook_views_data_alter().
+ * Implements hook_views_data_alter().
  *
  * Overrides message handler to convert tags to links.
  */
@@ -674,52 +715,68 @@ function facebook_status_tags_views_data
 }
 
 /**
- * Implementation of hook_taxonomy().
+ * Implements hook_taxonomy().
  */
 function facebook_status_tags_taxonomy($op, $type, $array = NULL) {
   if ($op != 'delete') {
     return;
   }
   if ($type == 'term') {
-    db_query("DELETE FROM {facebook_status_tags} WHERE rid = %d AND type = 'term'", $array['tid']);
+    // TODO Please review the conversion of this statement to the D7 database API syntax.
+    /* db_query("DELETE FROM {facebook_status_tags} WHERE rid = %d AND type = 'term'", $array['tid']) */
+    db_delete('facebook_status_tags')
+  ->condition('rid', $array['tid'])
+  ->condition('type', 'term')
+  ->execute();
   }
-  elseif ($type == 'vocabulary') {
+  elseif ($type == 'taxonomy_vocabulary') {
     if ($array['vid'] === variable_get('facebook_status_tags_vid', -1)) {
       // If the vocabulary is deleted, all the tags will no longer exist, so the references are invalid.
-      db_query("DELETE FROM {facebook_status_tags} WHERE type = 'term'");
+      // TODO Please review the conversion of this statement to the D7 database API syntax.
+      /* db_query("DELETE FROM {facebook_status_tags} WHERE type = 'term'") */
+      db_delete('facebook_status_tags')
+  ->condition('type', 'term')
+  ->execute();
       variable_set('facebook_status_tags_vid', -1);
     }
   }
 }
 
 /**
- * Implementation of hook_user().
+ * Implements hook_user_cancel().
  */
-function facebook_status_tags_user($op, &$edit, &$account, $category = NULL) {
-  if ($op == 'delete') {
-    db_query("DELETE FROM {facebook_status_tags} WHERE rid = %d and type = 'user'", $account->uid);
+function facebook_status_tags_user_cancel($edit, $account, $method) {
+  if (TRUE) {
+    // TODO Please review the conversion of this statement to the D7 database API syntax.
+    /* db_query("DELETE FROM {facebook_status_tags} WHERE rid = %d and type = 'user'", $account->uid) */
+    db_delete('facebook_status_tags')
+  ->condition('rid', $account->uid)
+  ->execute();
   }
 }
 
 /**
- * Implementation of hook_hook_info().
+ * Implements hook_user().
+ */
+function facebook_status_tags_user_OLD($op, &$edit, &$account, $category = NULL) { }
+
+/**
+ * Implements hook_trigger_info().
  */
-function facebook_status_tags_hook_info() {
+function facebook_status_tags_trigger_info() {
   return array(
     'facebook_status_tags' => array(
-      'facebook_status_tags' => array(
-        'fbsst_user_tagged' => array(
-          'runs when' => t('A user has been mentioned in a status message'),
-        ),
+      'facebook_status_tags_fbsst_user_tagged' => array(
+        'label' => t('A user has been mentioned in a status message'),
       ),
     ),
   );
 }
 
 /**
- * Implementation of hook_facebook_status().
+ * Implements hook_facebook_status().
  * or
- * Implementation of hook_trigger_name().
+ * Implements hook_trigger_name().
  */
 function facebook_status_tags_facebook_status_tags($op, $status, $account) {
   if ($op != 'fbsst_user_tagged') {
@@ -740,7 +797,7 @@ function facebook_status_tags_facebook_s
 //=======================
 
 /**
- * Implementation of hook_activity_info().
+ * Implements hook_activity_info().
  */
 function facebook_status_tags_activity_info() {
   $info = new stdClass();
@@ -755,12 +812,12 @@ function facebook_status_tags_activity_i
 }
 
 /**
- * Implementation of hook_activity_grants().
+ * Implements hook_activity_grants().
  */
 function facebook_status_tags_activity_grants($activity) {
   $realms = array();
   if ($activity->type == 'facebook_status_tags') {
-    $result = db_query("SELECT rid FROM {facebook_status_tags} WHERE type = 'user' AND sid = %d", $activity->eid);
+    $result = db_query("SELECT rid FROM {facebook_status_tags} WHERE type = :type AND sid = :sid", array(':type' => 'user', ':sid' => $activity->eid));
     while ($account = db_fetch_object($result)) {
       $realms['facebook_status_tags_mentioned'][] = $account->rid;
     }
@@ -769,7 +826,7 @@ function facebook_status_tags_activity_g
 }
 
 /**
- * Implementation of hook_activity_access_grants().
+ * Implements hook_activity_access_grants().
  */
 function facebook_status_tags_activity_access_grants($account) {
   return array(
@@ -778,18 +835,18 @@ function facebook_status_tags_activity_a
 }
 
 /**
- * Implementation of hook_list_activity_actions().
+ * Implements hook_list_activity_actions().
  */
 function facebook_status_tags_list_activity_actions($hook, $op, $max_age) {
   $actions = array();
   if (!empty($max_age)) {
-    $min_time = time() - $max_age;
+    $min_time = REQUEST_TIME - $max_age;
   }
   else {
     $min_time = 0;
   }
 
-  $result = db_query("SELECT f.sid as id, f.created, t.rid as actor FROM {facebook_status_tags} t INNER JOIN {facebook_status} f ON t.sid = f.sid WHERE t.type = 'user' AND created > %d", $min_time);
+  $result = db_query("SELECT f.sid as id, f.created, t.rid as actor FROM {facebook_status_tags} t INNER JOIN {facebook_status} f ON t.sid = f.sid WHERE t.type = :t.type AND created > :created", array(':t.type' => 'user', ':created' => $min_time));
   while ($row = db_fetch_array($result)) {
     $actions[] = $row;
   }
@@ -798,7 +855,7 @@ function facebook_status_tags_list_activ
 }
 
 /**
- * Implementation of hook_load_activity_context().
+ * Implements hook_load_activity_context().
  */
 function facebook_status_tags_load_activity_context($hook, $op, $id) {
   $staus = facebook_status_load($id);
diff -up -r submodules/facebook_status_tags/facebook_status_tags.rules.inc submodules/facebook_status_tags/facebook_status_tags.rules.inc
--- submodules/facebook_status_tags/facebook_status_tags.rules.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/facebook_status_tags/facebook_status_tags.rules.inc	2011-07-24 17:13:26.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_rules_event_info().
+ * Implements hook_rules_event_info().
  */
 function facebook_status_tags_rules_event_info() {
   return array(
@@ -14,22 +14,31 @@ function facebook_status_tags_rules_even
       'label' => t('User was tagged in a status'),
       'module' => 'Facebook-style Statuses',
       'arguments' => array(
-        'status' => array('type' => 'facebook_status', 'label' => t('The status.')),
-        'account' => array('type' => 'user', 'label' => t('The user who was tagged in the status.')),
+        'status' => array(
+          'type' => 'facebook_status',
+          'label' => t('The status.'),
+        ),
+        'account' => array(
+          'type' => 'user',
+          'label' => t('The user who was tagged in the status.'),
+        ),
       ),
     ),
   );
 }
 
 /**
- * Implementation of hook_rules_condition_info().
+ * Implements hook_rules_condition_info().
  */
 function facebook_status_tags_rules_condition_info() {
   return array(
     'facebook_status_tags_has_tags_condition' => array(
       'label' => t('Status has tags'),
       'arguments' => array(
-        'status' => array('type' => 'facebook_status', 'label' => t('The status')),
+        'status' => array(
+          'type' => 'facebook_status',
+          'label' => t('The status'),
+        ),
       ),
       'module' => 'Facebook-style Statuses',
       'eval input' => array('type'),
@@ -37,7 +46,10 @@ function facebook_status_tags_rules_cond
     'facebook_status_tags_has_specific_tag_condition' => array(
       'label' => t('Status has specific tag'),
       'arguments' => array(
-        'status' => array('type' => 'facebook_status', 'label' => t('The status')),
+        'status' => array(
+          'type' => 'facebook_status',
+          'label' => t('The status'),
+        ),
       ),
       'module' => 'Facebook-style Statuses',
       'eval input' => array('type', 'tag'),
@@ -79,7 +91,10 @@ function facebook_status_tags_has_specif
  * Builds the form for the "status has specific tag" condition.
  */
 function facebook_status_tags_has_specific_tag_condition_form($settings, &$form) {
-  $settings += array('type' => '', 'tag' => '');
+  $settings += array(
+    'type' => '',
+    'tag' => '',
+  );
   $form['settings']['type'] = array(
     '#type' => 'select',
     '#title' => t('Tag type'),
diff -up -r submodules/facebook_status_tags/views/facebook_status_tags.views.inc submodules/facebook_status_tags/views/facebook_status_tags.views.inc
--- submodules/facebook_status_tags/views/facebook_status_tags.views.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/facebook_status_tags/views/facebook_status_tags.views.inc	2011-07-24 17:13:26.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_views_data().
+ * Implements hook_views_data().
  */
 function facebook_status_tags_views_data() {
   $data['facebook_status_tags']['table']['group']  = t('Facebook-style Statuses Tags');
@@ -130,12 +130,12 @@ function facebook_status_tags_views_data
 }
 
 /**
- * Implementation of hook_views_handlers().
+ * Implements hook_views_handlers().
  */
 function facebook_status_tags_views_handlers() {
   return array(
     'info' => array(
-      'path' => drupal_get_path('module', 'facebook_status_tags') .'/views',
+      'path' => drupal_get_path('module', 'facebook_status_tags') . '/views',
     ),
     'handlers' => array(
       'facebook_status_tags_views_handler_argument_has_this_tag' => array(
diff -up -r submodules/facebook_status_tags/views/facebook_status_tags.views_default.inc submodules/facebook_status_tags/views/facebook_status_tags.views_default.inc
--- submodules/facebook_status_tags/views/facebook_status_tags.views_default.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/facebook_status_tags/views/facebook_status_tags.views_default.inc	2011-07-24 17:13:26.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_views_default_views().
+ * Implements hook_views_default_views().
  */
 function facebook_status_tags_views_default_views() {
   $view = new view;
@@ -215,7 +215,7 @@ function facebook_status_tags_views_defa
       'label' => '',
       'alter' => array(
         'text' => '<div>[user_contextual_pic] [message]</div>
-  
+
   <div class="facebook-status-details">[created] [edit] [delete] [repost]</div>',
         'make_link' => 0,
         'path' => '',
@@ -587,7 +587,7 @@ function facebook_status_tags_views_defa
       'label' => '',
       'alter' => array(
         'text' => '<div>[user_contextual_pic] [message]</div>
-  
+
   <div class="facebook-status-details">[created] [edit] [delete] [repost]</div>',
         'make_link' => 0,
         'path' => '',
diff -up -r submodules/facebook_status_tags/views/facebook_status_tags_views_handler_argument_has_this_tag.inc submodules/facebook_status_tags/views/facebook_status_tags_views_handler_argument_has_this_tag.inc
--- submodules/facebook_status_tags/views/facebook_status_tags_views_handler_argument_has_this_tag.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/facebook_status_tags/views/facebook_status_tags_views_handler_argument_has_this_tag.inc	2011-07-24 17:13:26.000000000 -0400
@@ -30,7 +30,7 @@ class facebook_status_tags_views_handler
     );
     $form['facebook_status_tags_type'] = array(
       '#title' => t('Tag types'),
-      '#type'  => 'checkboxes',
+      '#type' => 'checkboxes',
       '#required' => TRUE,
       '#options' => $opt,
       '#default_value' => $options['facebook_status_tags_type'],
@@ -67,7 +67,7 @@ class facebook_status_tags_views_handler
           $types[] = $type;
         }
       }
-      $where .= implode("' OR type = '", $types) ."')";
+      $where .= implode("' OR type = '", $types) . "')";
     }
     $query = "$field IN (SELECT sid FROM {facebook_status_tags} WHERE name = '%s' $where)";
     $this->query->add_where(0, db_prefix_tables($query), $argument);
diff -up -r submodules/facebook_status_tags/views/facebook_status_tags_views_handler_argument_has_this_tag_id.inc submodules/facebook_status_tags/views/facebook_status_tags_views_handler_argument_has_this_tag_id.inc
--- submodules/facebook_status_tags/views/facebook_status_tags_views_handler_argument_has_this_tag_id.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/facebook_status_tags/views/facebook_status_tags_views_handler_argument_has_this_tag_id.inc	2011-07-24 17:13:26.000000000 -0400
@@ -30,7 +30,7 @@ class facebook_status_tags_views_handler
     );
     $form['facebook_status_tags_type'] = array(
       '#title' => t('Tag types'),
-      '#type'  => 'checkboxes',
+      '#type' => 'checkboxes',
       '#required' => TRUE,
       '#options' => $opt,
       '#default_value' => $options['facebook_status_tags_type'],
@@ -54,49 +54,49 @@ class facebook_status_tags_views_handler
           $types[] = $type;
         }
       }
-      $where .= implode("' OR type = '", $types) ."')";
+      $where .= implode("' OR type = '", $types) . "')";
     }
     //if ($this->operator == 'or') {
-      if (count($this->value) > 2) {
-        $operator = empty($this->options['not']) ? 'IN' : 'NOT IN';
-        $placeholders = implode(', ', array_fill(0, sizeof($this->value), '%d'));
-        $query = "$this->table_alias.$this->real_field IN (SELECT sid FROM {facebook_status_tags} WHERE rid $operator ($placeholders) $where)";
-        $this->query->add_where(0, db_prefix_tables($query), $this->value);
-      }
-      // If there are exactly 2 users specified, show the exchange between them.
-      if (count($this->value) == 2) {
-        $operator = empty($this->options['not']) ? 'IN' : 'NOT IN';
-        $placeholders = implode(', ', array_fill(0, sizeof($this->value), '%d'));
-        $query = "$this->table_alias.$this->real_field IN (SELECT sid FROM {facebook_status_tags} WHERE rid $operator ($placeholders) $where)";
-        $query .= "AND $this->table_alias.pid IN (%d, %d)";
-        $this->query->add_where(0, db_prefix_tables($query), array_merge($this->value, $this->value));
-      }
-      else {
-        $operator = empty($this->options['not']) ? '=' : '!=';
-        $query = "$this->table_alias.$this->real_field IN (SELECT sid FROM {facebook_status_tags} WHERE rid $operator %d $where)";
-        $this->query->add_where(0, db_prefix_tables($query), $this->argument);
-      }
+    if (count($this->value) > 2) {
+      $operator = empty($this->options['not']) ? 'IN' : 'NOT IN';
+      $placeholders = implode(', ', array_fill(0, sizeof($this->value), '%d'));
+      $query = "$this->table_alias.$this->real_field IN (SELECT sid FROM {facebook_status_tags} WHERE rid $operator ($placeholders) $where)";
+      $this->query->add_where(0, db_prefix_tables($query), $this->value);
+    }
+    // If there are exactly 2 users specified, show the exchange between them.
+    if (count($this->value) == 2) {
+      $operator = empty($this->options['not']) ? 'IN' : 'NOT IN';
+      $placeholders = implode(', ', array_fill(0, sizeof($this->value), '%d'));
+      $query = "$this->table_alias.$this->real_field IN (SELECT sid FROM {facebook_status_tags} WHERE rid $operator ($placeholders) $where)";
+      $query .= "AND $this->table_alias.pid IN (%d, %d)";
+      $this->query->add_where(0, db_prefix_tables($query), array_merge($this->value, $this->value));
+    }
+    else {
+      $operator = empty($this->options['not']) ? '=' : '!=';
+      $query = "$this->table_alias.$this->real_field IN (SELECT sid FROM {facebook_status_tags} WHERE rid $operator %d $where)";
+      $this->query->add_where(0, db_prefix_tables($query), $this->argument);
+    }
     //}
     /*
      * Default to the "OR" behavior because it's more useful.
      * We can never actually allow either to happen because modern browsers
      * convert "+" to " " so we can't parse for the operator.
-    else { //$this->operator == 'and'
-      $operator = empty($this->options['not']) ? '=' : '!=';
-      if (count($this->value) > 1) {
-        //This causes the query to be pretty slow.
-        $subquery = array();
-        foreach ($this->value as $value) {
-          $subquery[] = "$this->table_alias.$this->real_field IN (SELECT sid FROM {facebook_status_tags} WHERE rid $operator %d $where)";
-        }
-        $query = '('. implode(' AND ', $subquery) .')';
-        $this->query->add_where(0, db_prefix_tables($query), $this->value);
-      }
-      else {
-        $query = "$this->table_alias.$this->real_field IN (SELECT sid FROM {facebook_status_tags} WHERE rid $operator %d $where)";
-        $this->query->add_where(0, db_prefix_tables($query), $this->argument);
-      }
-    }
+     else { //$this->operator == 'and'
+     $operator = empty($this->options['not']) ? '=' : '!=';
+     if (count($this->value) > 1) {
+     //This causes the query to be pretty slow.
+     $subquery = array();
+     foreach ($this->value as $value) {
+     $subquery[] = "$this->table_alias.$this->real_field IN (SELECT sid FROM {facebook_status_tags} WHERE rid $operator %d $where)";
+     }
+     $query = '('. implode(' AND ', $subquery) .')';
+     $this->query->add_where(0, db_prefix_tables($query), $this->value);
+     }
+     else {
+     $query = "$this->table_alias.$this->real_field IN (SELECT sid FROM {facebook_status_tags} WHERE rid $operator %d $where)";
+     $this->query->add_where(0, db_prefix_tables($query), $this->argument);
+     }
+     }
      */
   }
   function default_actions($which = NULL) {
diff -up -r submodules/facebook_status_tags/views/facebook_status_tags_views_handler_field_all_terms.inc submodules/facebook_status_tags/views/facebook_status_tags_views_handler_field_all_terms.inc
--- submodules/facebook_status_tags/views/facebook_status_tags_views_handler_field_all_terms.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/facebook_status_tags/views/facebook_status_tags_views_handler_field_all_terms.inc	2011-07-24 17:13:26.000000000 -0400
@@ -34,7 +34,7 @@ class facebook_status_tags_views_handler
     $options = $this->options;
     $form['facebook_status_tags_type'] = array(
       '#title' => t('Tag types'),
-      '#type'  => 'checkboxes',
+      '#type' => 'checkboxes',
       '#description' => t('Which tag types should be shown in this field?'),
       '#required' => TRUE,
       '#options' => $opt,
@@ -63,7 +63,7 @@ class facebook_status_tags_views_handler
           $types[] = $type;
         }
       }
-      $query .= implode("' OR type = '", $types) ."')";
+      $query .= implode("' OR type = '", $types) . "')";
     }
     $query .= " ORDER BY type ASC, name ASC";
     $result = db_query($query, $sid);
@@ -83,7 +83,7 @@ class facebook_status_tags_views_handler
           $tags[] = $prefix . l($tag->name, _facebook_status_tags_resolve($tag));
         }
         elseif ($tag->type == 'user') {
-          $tags[] = $prefix . theme('username', _facebook_status_user_load($tag->tid));
+          $tags[] = $prefix . theme('username', array('account' => _facebook_status_user_load($tag->tid)));
         }
         else {
           $tags[] = check_plain($tag->name);
diff -up -r submodules/facebook_status_tags/views/facebook_status_tags_views_handler_field_message.inc submodules/facebook_status_tags/views/facebook_status_tags_views_handler_field_message.inc
--- submodules/facebook_status_tags/views/facebook_status_tags_views_handler_field_message.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/facebook_status_tags/views/facebook_status_tags_views_handler_field_message.inc	2011-07-24 17:13:26.000000000 -0400
@@ -14,6 +14,6 @@ class facebook_status_tags_views_handler
     if (variable_get('facebook_status_nl2br', 0)) {
       $message = nl2br($message);
     }
-    return '<span class="facebook-status-content">'. facebook_status_tags_process_message($message) .'</span>';
+    return '<span class="facebook-status-content">' . facebook_status_tags_process_message($message) . '</span>';
   }
 }
diff -up -r submodules/facebook_status_tags/views/facebook_status_tags_views_handler_field_name.inc submodules/facebook_status_tags/views/facebook_status_tags_views_handler_field_name.inc
--- submodules/facebook_status_tags/views/facebook_status_tags_views_handler_field_name.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/facebook_status_tags/views/facebook_status_tags_views_handler_field_name.inc	2011-07-24 17:13:26.000000000 -0400
@@ -61,7 +61,7 @@ class facebook_status_tags_views_handler
         $tags[] = $prefix . l($tag->name, _facebook_status_tags_resolve($tag));
       }
       elseif ($tag->type == 'user') {
-        $tags[] = $prefix . theme('username', _facebook_status_user_load($tag->tid));
+        $tags[] = $prefix . theme('username', array('account' => _facebook_status_user_load($tag->tid)));
       }
       else {
         $tags[] = check_plain($tag->name);
diff -up -r submodules/facebook_status_tags/views/facebook_status_tags_views_handler_filter_has_tag.inc submodules/facebook_status_tags/views/facebook_status_tags_views_handler_filter_has_tag.inc
--- submodules/facebook_status_tags/views/facebook_status_tags_views_handler_filter_has_tag.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/facebook_status_tags/views/facebook_status_tags_views_handler_filter_has_tag.inc	2011-07-24 17:13:27.000000000 -0400
@@ -37,7 +37,7 @@ class facebook_status_tags_views_handler
     );
     $form['facebook_status_tags_type'] = array(
       '#title' => t('Tag types'),
-      '#type'  => 'checkboxes',
+      '#type' => 'checkboxes',
       '#required' => TRUE,
       '#options' => $opt,
       '#default_value' => $options['facebook_status_tags_type'],
@@ -55,7 +55,7 @@ class facebook_status_tags_views_handler
           $types[] = $type;
         }
       }
-      $query .= implode("' OR type = '", $types) ."'";
+      $query .= implode("' OR type = '", $types) . "'";
     }
     $query .= ')';
     $this->query->add_where(0, db_prefix_tables($query));
diff -up -r submodules/facebook_status_tags/views/facebook_status_tags_views_handler_filter_has_this_tag.inc submodules/facebook_status_tags/views/facebook_status_tags_views_handler_filter_has_this_tag.inc
--- submodules/facebook_status_tags/views/facebook_status_tags_views_handler_filter_has_this_tag.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/facebook_status_tags/views/facebook_status_tags_views_handler_filter_has_this_tag.inc	2011-07-24 17:13:27.000000000 -0400
@@ -30,7 +30,7 @@ class facebook_status_tags_views_handler
     );
     $form['facebook_status_tags_type'] = array(
       '#title' => t('Tag types'),
-      '#type'  => 'checkboxes',
+      '#type' => 'checkboxes',
       '#required' => TRUE,
       '#options' => $opt,
       '#default_value' => $options['facebook_status_tags_type'],
@@ -39,7 +39,7 @@ class facebook_status_tags_views_handler
   function value_form(&$form, &$form_state) {
     parent::value_form($form, $form_state);
     if (variable_get('facebook_status_tags_vid', -1) != -1) {
-      $form['value']['#autocomplete_path'] = 'taxonomy/autocomplete/'. variable_get('facebook_status_tags_vid', -1);
+      $form['value']['#autocomplete_path'] = 'taxonomy/autocomplete/' . variable_get('facebook_status_tags_vid', -1);
     }
   }
   function query() {
@@ -56,7 +56,7 @@ class facebook_status_tags_views_handler
           $types[] = $type;
         }
       }
-      $where .= implode("' OR type = '", $types) ."')";
+      $where .= implode("' OR type = '", $types) . "')";
     }
     $info = $this->operators();
     if (!empty($info[$this->operator]['method'])) {
diff -up -r submodules/fbss_activity/fbss_activity.info submodules/fbss_activity/fbss_activity.info
--- submodules/fbss_activity/fbss_activity.info	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_activity/fbss_activity.info	2011-07-24 17:13:30.000000000 -0400
@@ -3,4 +3,5 @@ description = "Integrates Activity 2 wit
 package = Facebook-style Statuses
 dependencies[] = facebook_status
 dependencies[] = activity
-core = 6.x
\ No newline at end of file
+core = 7.x
+files[] = fbss_activity.module
diff -up -r submodules/fbss_activity/fbss_activity.module submodules/fbss_activity/fbss_activity.module
--- submodules/fbss_activity/fbss_activity.module	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_activity/fbss_activity.module	2011-07-24 17:13:27.000000000 -0400
@@ -6,10 +6,10 @@
  */
 
 /**
- * Implementation of hook_facebook_status_delete().
+ * Implements hook_facebook_status_delete().
  */
 function fbss_activity_facebook_status_delete($status) {
-  $result = db_query("SELECT aid FROM {activity} WHERE type = 'facebook_status' AND op NOT LIKE 'fbss_deleted%' AND eid = %d", $status->sid);
+  $result = db_query("SELECT aid FROM {activity} WHERE type = :type AND op NOT LIKE 'fbss_deleted%' AND eid = :eid", array(':type' => 'facebook_status', ':eid' => $status->sid));
   $records = array();
   while ($record = db_fetch_object($result)) {
     $records[] = $record->aid;
@@ -32,7 +32,10 @@ function facebook_status_activity_info()
   $info->name = 'facebook_status';
   $info->object_type = 'facebook_status';
   $info->eid_field = 'sid';
-  $info->objects = array('Recipient' => 'facebook_status', 'Sender' => 'sender');
+  $info->objects = array(
+    'Recipient' => 'facebook_status',
+    'Sender' => 'sender',
+  );
   $hooks = array(
     'fbss_deleted',
     'fbss_deleted_user_self',
@@ -42,18 +45,21 @@ function facebook_status_activity_info()
     'fbss_edited_user_other',
     'fbss_submitted',
     'fbss_submitted_user_self',
-    'fbss_submitted_user_other'
+    'fbss_submitted_user_other',
   );
   foreach (facebook_status_all_contexts() as $type => $details) {
     if ($type != 'user') {
-      $hooks[] = 'fbss_deleted_'. $type;
-      $hooks[] = 'fbss_edited_'. $type;
-      $hooks[] = 'fbss_submitted_'. $type;
+      $hooks[] = 'fbss_deleted_' . $type;
+      $hooks[] = 'fbss_edited_' . $type;
+      $hooks[] = 'fbss_submitted_' . $type;
     }
   }
   sort($hooks);
   $info->hooks = array('facebook_status' => $hooks);
-  $info->realms = array('facebook_status_sender' => 'Facebook-style Statuses Sender', 'facebook_status_recipient' => 'Facebook-style Statuses Recipient');
+  $info->realms = array(
+    'facebook_status_sender' => 'Facebook-style Statuses Sender',
+    'facebook_status_recipient' => 'Facebook-style Statuses Recipient',
+  );
   return $info;
 }
 
@@ -64,7 +70,7 @@ function facebook_status_activity_grants
   $realms = array();
   if ($activity->type == 'facebook_status') {
     $realms['facebook_status_sender'] = array($activity->uid);
-    $result = db_fetch_object(db_query("SELECT recipient FROM {facebook_status} WHERE sid = %d", $activity->eid));
+    $result = db_fetch_object(db_query("SELECT recipient FROM {facebook_status} WHERE sid = :sid", array(':sid' => $activity->eid)));
     $realms['facebook_status_recipient'] = array($result->recipient);
   }
   return $realms;
@@ -86,32 +92,22 @@ function facebook_status_activity_access
 function facebook_status_list_activity_actions($hook, $op, $max_age) {
   $actions = array();
   if (!empty($max_age)) {
-    $min_time = time() - $max_age;
+    $min_time = REQUEST_TIME - $max_age;
   }
   else {
     $min_time = 0;
   }
 
   if ($op == 'fbss_submitted_user_self') {
-    $result = db_query(
-      "SELECT sid as id, created, sender as actor FROM {facebook_status} WHERE created > %d AND type = 'user' AND sender = recipient",
-      $min_time
-    );
+    $result = db_query("SELECT sid as id, created, sender as actor FROM {facebook_status} WHERE created > :created AND type = :type AND sender = :sender", array(':created' => $min_time, ':type' => 'user', ':sender' => recipient));
   }
   elseif ($op == 'fbss_submitted_user_other') {
-    $result = db_query(
-      "SELECT sid as id, created, sender as actor FROM {facebook_status} WHERE created > %d AND type = 'user' AND sender <> recipient",
-      $min_time
-    );
+    $result = db_query("SELECT sid as id, created, sender as actor FROM {facebook_status} WHERE created > :created AND type = :type AND sender <> :sender", array(':created' => $min_time, ':type' => 'user', ':sender' => recipient));
   }
   elseif (strpos($op, 'fbss_submitted_') === 0) {
     foreach (facebook_status_all_contexts() as $type => $details) {
-      if ($op == 'fbss_submitted_'. $type) {
-        $result = db_query(
-          "SELECT sid as id, created, sender as actor FROM {facebook_status} WHERE created > %d AND type = '%s'",
-          $min_time,
-          $type
-        );
+      if ($op == 'fbss_submitted_' . $type) {
+        $result = db_query("SELECT sid as id, created, sender as actor FROM {facebook_status} WHERE created > :created AND type = :type", array(':created' => $min_time, ':type' => $type));
         break;
       }
     }
@@ -159,14 +155,14 @@ function facebook_status_load_activity_c
 /**
  * Implementation of hook_form_FORM_ID_alter().
  * Activity 2.
-*/
+ */
 function facebook_status_form_activity_form_alter(&$form, &$form_state) {
   if ($form_state['storage']['values']['triggers']['hook'] == 'facebook_status') {
     $op = $form_state['storage']['values']['operations']['operation'];
     // Remove the "Recipient" field unless this is for a user posting a message to another user.
     if ($op != 'fbss_submitted_user_other' && $op != 'fbss_edited_user_other' && $op != 'fbss_deleted_user_other') {
       foreach (activity_enabled_languages() as $id => $language) {
-        unset($form[$id .'_fieldset']['facebook_status-pattern-'. $id]);
+        unset($form[$id . '_fieldset']['facebook_status-pattern-' . $id]);
       }
     }
   }
diff -up -r submodules/fbss_comments/fbss_comments.generate.inc submodules/fbss_comments/fbss_comments.generate.inc
--- submodules/fbss_comments/fbss_comments.generate.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments.generate.inc	2011-07-24 17:13:27.000000000 -0400
@@ -8,7 +8,7 @@
 /**
  * The Generate status comments form.
  */
-function fbss_comments_generate_form($form_state) {
+function fbss_comments_generate_form($form, $form_state) {
   $form['killswitch'] = array(
     '#type' => 'checkbox',
     '#title' => t('<strong>Delete all status comments</strong> before generating new content'),
@@ -57,7 +57,7 @@ function fbss_comments_generate_form_sub
       'title' => t('Generating status comments'),
       'operations' => $operations,
       'finished' => 'fbss_comments_generate_finished',
-      'file' => drupal_get_path('module', 'fbss_comments') .'/fbss_comments.generate.inc',
+      'file' => drupal_get_path('module', 'fbss_comments') . '/fbss_comments.generate.inc',
     ));
   }
   else {
@@ -94,7 +94,7 @@ function fbss_comments_generate_status_c
 function fbss_comments_generate_status_comment(&$context) {
   module_load_include('inc', 'devel', 'devel_generate');
 
-  $sid = db_result(db_query_range("SELECT sid FROM {facebook_status} ORDER BY RAND()", 0, 1));
+  $sid = db_query_range("SELECT sid FROM {facebook_status} ORDER BY RAND()")->fetchField();
 
   $mtext = devel_create_greeking(mt_rand(2, variable_get('facebook_status_length', 140) / 7));
   $text = drupal_substr($mtext, 0, variable_get('facebook_status_length', 140));
diff -up -r submodules/fbss_comments/fbss_comments.info submodules/fbss_comments/fbss_comments.info
--- submodules/fbss_comments/fbss_comments.info	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments.info	2011-07-24 17:13:30.000000000 -0400
@@ -2,4 +2,16 @@ name = Facebook-style Statuses Comments
 description = "Allows comments on Facebook-style Statuses."
 dependencies[] = facebook_status
 package = Facebook-style Statuses
-core = 6.x
+core = 7.x
+
+files[] = api.php
+files[] = fbss_comments.generate.inc
+files[] = fbss_comments.install
+files[] = fbss_comments.module
+files[] = fbss_comments.pages.inc
+files[] = fbss_comments.views.inc
+files[] = fbss_comments_views_handler_field_cc.inc
+files[] = fbss_comments_views_handler_field_cc2.inc
+files[] = fbss_comments_views_handler_field_comment_box.inc
+files[] = fbss_comments_views_handler_field_delete.inc
+files[] = fbss_comments_views_handler_field_edit.inc
diff -up -r submodules/fbss_comments/fbss_comments.install submodules/fbss_comments/fbss_comments.install
--- submodules/fbss_comments/fbss_comments.install	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments.install	2011-07-24 17:13:27.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_schema().
+ * Implements hook_schema().
  */
 function fbss_comments_schema() {
   $schema = array();
@@ -56,13 +56,14 @@ function fbss_comments_schema() {
 }
 
 /**
- * Implementation of hook_install().
+ * Implements hook_install().
  */
 function fbss_comments_install() {
   if (module_exists('fbssc')) {
     module_disable(array('fbssc'));
   }
-  drupal_install_schema('fbss_comments');
+  // TODO The drupal_(un)install_schema functions are called automatically in D7.
+  // drupal_install_schema('fbss_comments')
   if (db_table_exists('fbssc')) {
     db_query("
       INSERT INTO {fbss_comments} (cid, sid, uid, created, comment)
@@ -70,18 +71,19 @@ function fbss_comments_install() {
       FROM {fbssc} as old
       ORDER BY old.cid ASC
     ");
-    drupal_uninstall_module('fbssc');
-    drupal_set_message(st('The Facebook-style Statuses Comments module has been upgraded.') .' '.
+    drupal_uninstall_modules(array('fbssc'));
+    drupal_set_message(st('The Facebook-style Statuses Comments module has been upgraded.') . ' ' .
       st('You should remove the "fbssc" folder from your modules directory to ensure you do not confuse it with the new version, which is part of the main Facebook-style Statuses package.')
     );
   }
 }
 
 /**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
  */
 function fbss_comments_uninstall() {
-  drupal_uninstall_schema('fbss_comments');
+  // TODO The drupal_(un)install_schema functions are called automatically in D7.
+  // drupal_uninstall_schema('fbss_comments')
   variable_del('fbss_comments_user_pictures');
   variable_del('fbss_comments_hide_small');
   variable_del('fbss_comments_show_all');
diff -up -r submodules/fbss_comments/fbss_comments.module submodules/fbss_comments/fbss_comments.module
--- submodules/fbss_comments/fbss_comments.module	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments.module	2011-07-24 17:13:27.000000000 -0400
@@ -23,11 +23,11 @@
 //===============
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function fbss_comments_menu() {
   $items = array();
-  $items['admin/settings/facebook_status/fbss_comments'] = array(
+  $items['admin/config/facebook_status/fbss_comments'] = array(
     'title' => 'Comments',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('fbss_comments_admin'),
@@ -82,52 +82,88 @@ function fbss_comments_menu() {
 }
 
 /**
- * Implementation of hook_user().
+ * Implements hook_user_cancel().
  */
-function fbss_comments_user($op, &$edit, &$account, $category = NULL) {
-  if ($op == 'delete') {
-    db_query("DELETE FROM {fbss_comments} WHERE uid = %d", $account->uid);
+function fbss_comments_user_cancel($edit, $account, $method) {
+  if (TRUE) {
+    // TODO Please review the conversion of this statement to the D7 database API syntax.
+    /* db_query("DELETE FROM {fbss_comments} WHERE uid = %d", $account->uid) */
+    db_delete('fbss_comments')
+  ->condition('uid', $account->uid)
+  ->execute();
   }
 }
 
 /**
- * Implementation of hook_perm().
+ * Implements hook_user().
  */
-function fbss_comments_perm() {
+function fbss_comments_user_OLD($op, &$edit, &$account, $category = NULL) { }
+
+/**
+ * Implements hook_permission().
+ */
+function fbss_comments_permission() {
   return array(
-    'delete all status comments',
-    'delete own status comments',
-    'delete comments on own statuses',
-    'edit all status comments',
-    'edit own status comments',
-    'edit comments on own statuses',
-    'post status comment',
-    'view all status comments',
-    'view own status comments',
+    'delete all status comments' => array(
+      'title' => t('delete all status comments'),
+      'description' => t('TODO Add a description for \'delete all status comments\''),
+    ),
+    'delete own status comments' => array(
+      'title' => t('delete own status comments'),
+      'description' => t('TODO Add a description for \'delete own status comments\''),
+    ),
+    'delete comments on own statuses' => array(
+      'title' => t('delete comments on own statuses'),
+      'description' => t('TODO Add a description for \'delete comments on own statuses\''),
+    ),
+    'edit all status comments' => array(
+      'title' => t('edit all status comments'),
+      'description' => t('TODO Add a description for \'edit all status comments\''),
+    ),
+    'edit own status comments' => array(
+      'title' => t('edit own status comments'),
+      'description' => t('TODO Add a description for \'edit own status comments\''),
+    ),
+    'edit comments on own statuses' => array(
+      'title' => t('edit comments on own statuses'),
+      'description' => t('TODO Add a description for \'edit comments on own statuses\''),
+    ),
+    'post status comment' => array(
+      'title' => t('post status comment'),
+      'description' => t('TODO Add a description for \'post status comment\''),
+    ),
+    'view all status comments' => array(
+      'title' => t('view all status comments'),
+      'description' => t('TODO Add a description for \'view all status comments\''),
+    ),
+    'view own status comments' => array(
+      'title' => t('view own status comments'),
+      'description' => t('TODO Add a description for \'view own status comments\''),
+    ),
   );
 }
 
 /**
- * Implementation of hook_theme().
+ * Implements hook_theme().
  */
 function fbss_comments_theme($existing, $type, $theme, $path) {
   return array(
     'fbss_comments_item' => array(
-      'arguments' => array(
+      'variables' => array(
         'comment' => NULL,
         'classes' => array(),
         'destination' => '',
       ),
     ),
     'fbss_comments_items' => array(
-      'arguments' => array(
+      'variables' => array(
         'comments' => array(),
         'delay_load' => TRUE,
         'destination' => '',
       ),
     ),
     'fbss_comments_form_display' => array(
-      'arguments' => array(
+      'variables' => array(
         'sid' => NULL,
         'delay_load_form' => TRUE,
         'delay_load_comments' => TRUE,
@@ -154,24 +190,27 @@ function fbss_comments_theme($existing, 
  *   The fully themed status comment or FALSE if the current user does not have
  *   permission to view the comment.
  */
-function theme_fbss_comments_item($comment, $classes = array(), $destination = '') {
+function theme_fbss_comments_item($variables) {
+  $comment = $variables['comment'];
+  $classes = $variables['classes'];
+  $destination = $variables['destination'];
   if (!fbss_comments_can('view', $comment)) {
-      return FALSE;
+    return FALSE;
   }
-  drupal_add_css(drupal_get_path('module', 'fbss_comments') .'/fbss_comments.css');
+  drupal_add_css(drupal_get_path('module', 'fbss_comments') . '/fbss_comments.css');
   $author = _facebook_status_user_load($comment->uid);
   array_unshift($classes, 'fbss-comments-comment');
   $classes = implode(' ', $classes);
-  $output = '<div class="'. $classes .'">';
+  $output = '<div class="' . $classes . '">';
   if (variable_get('fbss_comments_user_pictures', 0)) {
-    $output .= '<div class="fbss-comments-author-picture">'. _fbss_comments_user_picture($author) .'</div>';
+    $output .= '<div class="fbss-comments-author-picture">' . _fbss_comments_user_picture($author) . '</div>';
   }
-  $output .= '<div class="fbss-comments-author">'. theme('username', $author) .'</div>';
+  $output .= '<div class="fbss-comments-author">' . theme('username', array('account' => $author)) . '</div>';
   $comment_text = _facebook_status_run_filter($comment->comment);
   $comment_text = nl2br($comment_text);
-  $output .= '<div class="fbss-comments-text">'. $comment_text .'</div>';
+  $output .= '<div class="fbss-comments-text">' . $comment_text . '</div>';
   $output .= '<div class="fbss-comments-closure">';
-  $output .= '<span class="fbss-comments-created">'. theme('facebook_status_time', $comment->created) .'</span>';
+  $output .= '<span class="fbss-comments-created">' . theme('facebook_status_time', array('time' => $comment->created)) . '</span>';
   $q = $_GET['q'];
   if ($destination) {
     $q = $destination;
@@ -180,14 +219,14 @@ function theme_fbss_comments_item($comme
     $q = '<front>';
   }
   if (fbss_comments_can('edit', $comment)) {
-    $output .= '<span class="fbss-comments-edit-delete">'.
-      l(t('Edit'), 'statuses/comment/'. $comment->cid .'/edit', array('query' => array('destination' => $q)))
-      .'</span>';
+    $output .= '<span class="fbss-comments-edit-delete">' .
+      l(t('Edit'), 'statuses/comment/' . $comment->cid . '/edit', array('query' => array('destination' => $q)))
+      . '</span>';
   }
   if (fbss_comments_can('delete', $comment)) {
-    $output .= '<span class="fbss-comments-edit-delete">'.
-      l(t('Delete'), 'statuses/comment/'. $comment->cid .'/delete', array('query' => array('destination' => $q)))
-      .'</span>';
+    $output .= '<span class="fbss-comments-edit-delete">' .
+      l(t('Delete'), 'statuses/comment/' . $comment->cid . '/delete', array('query' => array('destination' => $q)))
+      . '</span>';
   }
   if (module_exists('fbss_comments_flag')) {
     foreach (flag_get_flags() as $name => $info) {
@@ -221,19 +260,25 @@ function theme_fbss_comments_item($comme
  * @return
  *   Themed HTML for the status comments.
  */
-function theme_fbss_comments_items($comments, $delay_load = TRUE, $destination = '') {
+function theme_fbss_comments_items($variables) {
+  $comments = $variables['comments'];
+  $delay_load = $variables['delay_load'];
+  $destination = $variables['destination'];
   $count = count($comments);
   if (!$count) {
     return;
   }
-  drupal_add_js(drupal_get_path('module', 'fbss_comments') .'/fbss_comments.js');
+  drupal_add_js(drupal_get_path('module', 'fbss_comments') . '/fbss_comments.js');
   $output = '<div class="fbss-comments">';
   if ($count > variable_get('fbss_comments_hide_small', 3) && $delay_load) {
-    $options = array('attributes' => array('class' => 'fbss-comments-show-comments-link fbss-comments-show-comments', 'id' => 'fbss-comments-toggle-'. $comments[0]->sid));
+    $options = array('attributes' => array(
+        'class' => 'fbss-comments-show-comments-link fbss-comments-show-comments',
+        'id' => 'fbss-comments-toggle-' . $comments[0]->sid,
+      ));
     if ($count >= variable_get('fbss_comments_show_all', 10)) {
       $options['attributes']['class'] = 'fbss-comments-show-comments-link';
     }
-    $output .= l(t('Show all @count comments', array('@count' => $count)), 'statuses/'. $comments[0]->sid, $options);
+    $output .= l(t('Show all @count comments', array('@count' => $count)), 'statuses/' . $comments[0]->sid, $options);
   }
   $rendered = 0;
   foreach ($comments as $key => $comment) {
@@ -254,7 +299,7 @@ function theme_fbss_comments_items($comm
       $classes[] = 'fbss-comments-hide';
     }
     if (!$delay_load || $count < variable_get('fbss_comments_show_all', 10) || $key > $count - variable_get('fbss_comments_hide_small', 3)) {
-      $result = theme('fbss_comments_item', $comment, $classes, $destination);
+      $result = theme('fbss_comments_item', array('comment' => $comment, 'classes' => $classes, 'destination' => $destination));
       if (!empty($result)) {
         $output .= $result;
         $rendered++;
@@ -290,19 +335,22 @@ function theme_fbss_comments_items($comm
  *   The themed HTML for the status form, or if the user does not have
  *   permission to post a comment, then the list of comments.
  */
-function theme_fbss_comments_form_display($sid, $delay_load_form = TRUE, $delay_load_comments = TRUE) {
+function theme_fbss_comments_form_display($variables) {
+  $sid = $variables['sid'];
+  $delay_load_form = $variables['delay_load_form'];
+  $delay_load_comments = $variables['delay_load_comments'];
   if (fbss_comments_can('post', facebook_status_load($sid))) {
     $output = '';
     if ($delay_load_form && !fbss_comments_count_comments($sid, TRUE)) {
-      $output = '<span class="fbss-comments-show-comment-form" id="fbss-comments-toggle-'. $sid .'">'.
-        l(t('Comment'), 'statuses/'. $sid, array('attributes' => array('class' => 'fbss-comments-show-comment-form-link')))
-        .'</span>';
-        return $output .'<div class="fbss-comments-hide fbss-comments-form">'. drupal_get_form('fbss_comments_box_'. $sid, $sid, $delay_load_comments) .'</div>';
+      $output = '<span class="fbss-comments-show-comment-form" id="fbss-comments-toggle-' . $sid . '">' .
+        l(t('Comment'), 'statuses/' . $sid, array('attributes' => array('class' => 'fbss-comments-show-comment-form-link')))
+        . '</span>';
+      return $output . '<div class="fbss-comments-hide fbss-comments-form">' . drupal_get_form('fbss_comments_box_' . $sid, $sid, $delay_load_comments) . '</div>';
     }
-    return '<div class="fbss-comments-form">'. drupal_get_form('fbss_comments_box_'. $sid, $sid, $delay_load_comments, $delay_load_form) .'</div>';
+    return '<div class="fbss-comments-form">' . drupal_get_form('fbss_comments_box_' . $sid, $sid, $delay_load_comments, $delay_load_form) . '</div>';
   }
   else if (user_access('view all status comments')) {
-    return theme('fbss_comments_items', fbss_comments_get_comments($sid, TRUE), $delay_load_comments, $_GET['q']);
+    return theme('fbss_comments_items', array('comments' => fbss_comments_get_comments($sid, TRUE), 'delay_load' => $delay_load_comments, 'destination' => $_GET['q']));
   }
 }
 
@@ -318,11 +366,16 @@ function theme_fbss_comments_form_displa
  * @return
  *   A full status comment object.
  */
-function fbss_comments_load($cid) {
-  if (!is_numeric($cid)) {
-    return;
+function fbss_comments_load($cids) {
+  foreach ($cids as $nid => &$cid) {
+    if (!is_numeric($cid)) {
+      return;
+    }
+    $node_additions = db_fetch_object(db_query("SELECT * FROM {fbss_comments} WHERE cid = :cid", array(':cid' => $cid)));
+    foreach ($node_additions as $property => &$value) {
+      $cid->$property = $value;
+    }
   }
-  return db_fetch_object(db_query("SELECT * FROM {fbss_comments} WHERE cid = %d", $cid));
 }
 
 /**
@@ -337,7 +390,7 @@ function fbss_comments_load($cid) {
  *   An array of comment objects for the relative thread.
  */
 function fbss_comments_get_comments($sid, $filter_view_access = FALSE) {
-  $result = db_query("SELECT * FROM {fbss_comments} WHERE sid = %d ORDER BY created ASC, cid ASC", $sid);
+  $result = db_query("SELECT * FROM {fbss_comments} WHERE sid = :sid ORDER BY created ASC, cid ASC", array(':sid' => $sid));
   $results = array();
   while ($comment = db_fetch_object($result)) {
     if (!$filter_view_access || fbss_comments_can('view', $comment)) {
@@ -363,7 +416,12 @@ function fbss_comments_save_comment($sid
   if (!$uid) {
     $uid = $GLOBALS['user']->uid;
   }
-  $c = (object) array('sid' => $sid, 'uid' => $uid, 'created' => time(), 'comment' => $comment);
+  $c = (object) array(
+    'sid' => $sid,
+    'uid' => $uid,
+    'created' => REQUEST_TIME,
+    'comment' => $comment,
+  );
   drupal_write_record('fbss_comments', $c);
   module_invoke_all('fbss_comments_after_save', $c, FALSE);
   if (module_exists('trigger')) {
@@ -383,7 +441,11 @@ function fbss_comments_delete_comment($c
   if (module_exists('trigger')) {
     module_invoke_all('fbss_comments', 'fbss_comments_deleted', fbss_comments_load($comment));
   }
-  db_query("DELETE FROM {fbss_comments} WHERE cid = %d", $cid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {fbss_comments} WHERE cid = %d", $cid) */
+  db_delete('fbss_comments')
+  ->condition('cid', $cid)
+  ->execute();
 }
 
 /**
@@ -399,7 +461,7 @@ function fbss_comments_delete_comment($c
  */
 function fbss_comments_count_comments($sid, $filter_view_access = FALSE) {
   if ($filter_view_access) {
-    $result = db_query("SELECT * FROM {fbss_comments} WHERE sid = %d", $sid);
+    $result = db_query("SELECT * FROM {fbss_comments} WHERE sid = :sid", array(':sid' => $sid));
     $count = 0;
     while ($comment = db_fetch_object($result)) {
       if (fbss_comments_can('view', $comment)) {
@@ -408,7 +470,7 @@ function fbss_comments_count_comments($s
     }
     return $count;
   }
-  return db_result(db_query("SELECT COUNT(cid) FROM {fbss_comments} WHERE sid = %d", $sid));
+  return db_query("SELECT COUNT(cid) FROM {fbss_comments} WHERE sid = :sid", array(':sid' => $sid))->fetchField();
 }
 
 /**
@@ -426,7 +488,7 @@ function fbss_comments_has_commented($si
   if (!$uid) {
     $uid = $GLOBALS['user']->uid;
   }
-  $result = db_result(db_query("SELECT COUNT(cid) FROM {fbss_comments} WHERE sid = %d and uid = %d", $sid, $uid));
+  $result = db_query("SELECT COUNT(cid) FROM {fbss_comments} WHERE sid = :sid and uid = :uid", array(':sid' => $sid, ':uid' => $uid))->fetchField();
   return $result > 0;
 }
 
@@ -447,7 +509,7 @@ function fbss_comments_can($op, $comment
   if (empty($account)) {
     $account = $GLOBALS['user'];
   }
-  $result = call_user_func('_fbss_comments_can_'. $op, $comment, $account);
+  $result = call_user_func('_fbss_comments_can_' . $op, $comment, $account);
   $allow = TRUE;
   drupal_alter('fbss_comments_has_permission', $allow, $op, $comment, $account);
   return $allow && $result;
@@ -532,7 +594,7 @@ function _fbss_comments_can_delete($comm
  *   The User ID of the author of the relevant status.
  */
 function _fbss_comments_get_thread_author($sid) {
-  return db_result(db_query("SELECT sender FROM {facebook_status} WHERE sid = %d", $sid));
+  return db_query("SELECT sender FROM {facebook_status} WHERE sid = :sid", array(':sid' => $sid))->fetchField();
 }
 
 /**
@@ -550,7 +612,7 @@ function _fbss_comments_use_autogrow() {
  */
 function _fbss_comments_user_picture($account) {
   if (!module_exists('imagecache_profiles')) {
-    return theme('user_picture', $account);
+    return theme('user_picture', array('account' => $account));
   }
   $output = '';
   if (variable_get('user_pictures', 0)) {
@@ -562,6 +624,7 @@ function _fbss_comments_user_picture($ac
     }
     if (isset($picture)) {
       $alt = t("@user's picture", array('@user' => $account->name ? $account->name : variable_get('anonymous', t('Anonymous'))));
+      // TODO Please change this theme call to use an associative array for the $variables parameter.
       $output = theme('imagecache', variable_get('fbss_comments_user_pictures', 0), $picture, $alt, $alt, NULL, FALSE);
       if (!empty($account->uid) && user_access('access user profiles')) {
         $attributes = array(
@@ -580,7 +643,7 @@ function _fbss_comments_user_picture($ac
 //=================
 
 /**
- * Implementation of hook_forms().
+ * Implements hook_forms().
  */
 function fbss_comments_forms($form_id, $args) {
   if (strpos($form_id, 'fbss_comments_box') === 0) {
@@ -607,16 +670,16 @@ function fbss_comments_forms($form_id, $
  */
 function fbss_comments_box(&$form_state, $sid, $delay_load = TRUE, $hide_submit = TRUE) {
   $path = drupal_get_path('module', 'fbss_comments');
-  drupal_add_css($path .'/fbss_comments.css');
-  drupal_add_js($path .'/fbss_comments.js');
+  drupal_add_css($path . '/fbss_comments.css');
+  drupal_add_js($path . '/fbss_comments.js');
   // Defer execution so that it runs after ajax_view.js
-  drupal_add_js($path .'/fbss_comments_views_ahah.js', 'module', 'header', TRUE);
+  drupal_add_js($path . '/fbss_comments_views_ahah.js', array('defer' => TRUE));
   if (variable_get('fbss_comments_enter', 0)) {
-    drupal_add_js($path .'/fbss_comments_enter.js');
+    drupal_add_js($path . '/fbss_comments_enter.js');
   }
   drupal_add_js(array('fbss_comments' => array(
-    'ahah_enabled' => (bool) variable_get('fbss_comments_ahah', 1)
-  )), 'setting');
+      'ahah_enabled' => (bool) variable_get('fbss_comments_ahah', 1),
+    )), array('type' => 'setting', 'scope' => JS_DEFAULT));
   _fbss_comments_use_autogrow();
   $form = array();
   if (!isset($form_state['fbss_comments']['q'])) {
@@ -630,12 +693,12 @@ function fbss_comments_box(&$form_state,
     //$form['#action'] = url($_GET['view_path']);
   }
   $comments = fbss_comments_get_comments($sid, TRUE);
-  $form['before'] = array('#value' => '<div id="fbss-comments-replace-'. $sid .'">');
-  $form['comments'] = array('#value' => theme('fbss_comments_items', $comments, $delay_load, $form['#qu']));
+  $form['before'] = array('#value' => '<div id="fbss-comments-replace-' . $sid . '">');
+  $form['comments'] = array('#value' => theme('fbss_comments_items', array('comments' => $comments, 'delay_load' => $delay_load, 'destination' => $form['#qu'])));
   if (count($comments) && $hide_submit) {
-    $form['start-hide'] = array('#value' => '<div class="fbss-comments-show-comment-form-inner" id="fbss-comments-inner-toggle-'. $sid .'">'.
-      l(t('Comment'), 'statuses/'. $sid, array('attributes' => array('class' => 'fbss-comments-show-comment-inner-form-link')))
-      .'</div><div class="fbss-comments-hide fbss-comments-replace-'. $sid .'-inner">');
+    $form['start-hide'] = array('#value' => '<div class="fbss-comments-show-comment-form-inner" id="fbss-comments-inner-toggle-' . $sid . '">' .
+      l(t('Comment'), 'statuses/' . $sid, array('attributes' => array('class' => 'fbss-comments-show-comment-inner-form-link')))
+      . '</div><div class="fbss-comments-hide fbss-comments-replace-' . $sid . '-inner">');
   }
   $form['status-comment'] = array(
     '#type' => 'textarea',
@@ -647,18 +710,18 @@ function fbss_comments_box(&$form_state,
     $form['end-hide'] = array('#value' => '</div>');
   }
   $form['after'] = array('#value' => '</div>');
-  $form['save-'. $sid] = array(
+  $form['save-' . $sid] = array(
     '#type' => 'submit',
     '#value' => t('Comment'),
     '#attributes' => array('class' => 'fbss-comments-submit'),
-    '#prefix' => '<div class="'. ($hide_submit ? 'fbss-comments-hide' : '') .' fbss-comments-replace-'. $sid .'-inner">',
+    '#prefix' => '<div class="' . ($hide_submit ? 'fbss-comments-hide' : '') . ' fbss-comments-replace-' . $sid . '-inner">',
     '#suffix' => '<div class="clearfix"></div></div>',
     '#submit' => array('fbss_comments_box_submit'),
   );
   if (variable_get('fbss_comments_ahah', 1)) {
-    $form['save-'. $sid]['#ahah'] = array(
+    $form['save-' . $sid]['#ahah'] = array(
       'path' => 'fbss_comments/js/refresh',
-      'wrapper' => 'fbss-comments-replace-'. $sid,
+      'wrapper' => 'fbss-comments-replace-' . $sid,
       'effect' => 'fade',
       'method' => 'replace',
     );
@@ -690,11 +753,14 @@ function fbss_comments_box_submit($form,
  * Saves status comments via AHAH.
  */
 function fbss_comments_save_js() {
-  $form_state = array('storage' => NULL, 'submitted' => FALSE);
+  $form_state = array(
+    'storage' => NULL,
+    'submitted' => FALSE,
+  );
   $form_build_id = $_POST['form_build_id'];
   $form = form_get_cache($form_build_id, $form_state);
   $form_state['post'] = $form['#post'] = $_POST;
-  $form['#programmed'] = $form['#redirect'] = FALSE;
+  $form['#programmed'] = $form_state['#redirect'] = FALSE;
   $args = $form['#parameters'];
   // This happens if someone goes directly to the JS processing page.
   if (!is_array($args) && !$args) {
@@ -710,9 +776,10 @@ function fbss_comments_save_js() {
   $new_form['comments']       = $form['comments'];
   $new_form['status-comment'] = $form['status-comment'];
   //$new_form['save']           = $form['save'];
+  // TODO Please change this theme call to use an associative array for the $variables parameter.
   $output = theme('status_messages') . drupal_render($new_form);
   // Return the results.
-  drupal_json(array('status' => TRUE, 'data' => $output));
+  drupal_json_output(array('status' => TRUE, 'data' => $output));
 }
 
 //===============
@@ -720,13 +787,17 @@ function fbss_comments_save_js() {
 //===============
 
 /**
- * Implementation of hook_facebook_status_delete().
+ * Implements hook_facebook_status_delete().
  */
 function fbss_comments_facebook_status_delete($status) {
-  db_query("DELETE FROM {fbss_comments} WHERE sid = %d", $status->sid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {fbss_comments} WHERE sid = %d", $status->sid) */
+  db_delete('fbss_comments')
+  ->condition('sid', $status->sid)
+  ->execute();
 
   if (module_exists('activity')) {
-    $result = db_query("SELECT aid FROM {activity} WHERE type = 'fbss_comments' AND eid IN (SELECT sid FROM {fbss_comments} WHERE cid = %d)", $status->sid);
+    $result = db_query("SELECT aid FROM {activity} WHERE type = :type AND eid IN (SELECT sid FROM {fbss_comments} WHERE cid = :cid)", array(':type' => 'fbss_comments', ':cid' => $status->sid));
     $records = array();
     while ($record = db_fetch_object($result)) {
       $records[] = $record->aid;
@@ -738,32 +809,32 @@ function fbss_comments_facebook_status_d
 }
 
 /**
- * Implementation of hook_preprocess_facebook_status_item().
+ * Implements hook_preprocess_facebook_status_item().
  */
 function fbss_comments_preprocess_facebook_status_item(&$vars) {
   if ($vars['options']['extras']) {
-    $vars['comments'] = theme('fbss_comments_form_display', $vars['status']->sid, !$vars['options']['page'], !$vars['options']['page']);
+    $vars['comments'] = theme('fbss_comments_form_display', array('sid' => $vars['status']->sid, 'delay_load_form' => !$vars['options']['page'], 'delay_load_comments' => !$vars['options']['page']));
   }
 }
 
 /**
- * Implementation of hook_form_FORM_ID_alter().
+ * Implements hook_form_FORM_ID_alter().
  */
 function fbss_comments_form_facebook_status_box_alter(&$form) {
   // Add the comments JS when the status form is displayed so that all the necessary resources are loaded when the first status is submitted on a page.
   $path = drupal_get_path('module', 'fbss_comments');
-  drupal_add_css($path .'/fbss_comments.css');
-  drupal_add_js($path .'/fbss_comments.js');
+  drupal_add_css($path . '/fbss_comments.css');
+  drupal_add_js($path . '/fbss_comments.js');
   // Defer execution so that it runs after ajax_view.js
-  drupal_add_js($path .'/fbss_comments_views_ahah.js', 'module', 'header', TRUE);
+  drupal_add_js($path . '/fbss_comments_views_ahah.js', array('defer' => TRUE));
   if (variable_get('fbss_comments_enter', 0)) {
-    drupal_add_js($path .'/fbss_comments_enter.js');
+    drupal_add_js($path . '/fbss_comments_enter.js');
   }
   /*
-  // Don't add settings twice (it merges recursively, so we'll end up with an array, which messes things up).
-  drupal_add_js(array('fbss_comments' => array(
-    'ahah_enabled' => (bool) variable_get('fbss_comments_ahah', 1)
-  )), 'setting');
+   // Don't add settings twice (it merges recursively, so we'll end up with an array, which messes things up).
+   drupal_add_js(array('fbss_comments' => array(
+   'ahah_enabled' => (bool) variable_get('fbss_comments_ahah', 1)
+   )), 'setting');
    */
   _fbss_comments_use_autogrow();
 }
@@ -772,12 +843,12 @@ function fbss_comments_form_facebook_sta
  * The JS callback for the Modalframe submit callback.
  */
 function fbss_comments_modalframe_refresh($sid) {
-  drupal_set_header('Content-Type: text/html; charset: utf-8');
-  echo theme('fbss_comments_items', fbss_comments_get_comments($sid, TRUE));
+  drupal_add_http_header('Content-Type', 'text/html; charset');
+  echo theme('fbss_comments_items', array('comments' => fbss_comments_get_comments($sid, TRUE)));
 }
 
 /**
- * Implementation of hook_views_bulk_operations_object_info().
+ * Implements hook_views_bulk_operations_object_info().
  */
 function fbss_comments_views_bulk_operations_object_info() {
   return array(
@@ -795,14 +866,14 @@ function fbss_comments_views_bulk_operat
 //====================
 
 /**
- * Implementation of hook_views_api().
+ * Implements hook_views_api().
  */
 function fbss_comments_views_api() {
   return array('api' => 2);
 }
 
 /**
- * Implementation of hook_views_default_views_alter().
+ * Implements hook_views_default_views_alter().
  */
 function fbss_comments_views_default_views_alter(&$views) {
   foreach ($views as $view) {
@@ -862,30 +933,28 @@ function fbss_comments_views_default_vie
 //======================
 
 /**
- * Implementation of hook_hook_info().
+ * Implements hook_trigger_info().
  */
-function fbss_comments_hook_info() {
+function fbss_comments_trigger_info() {
   return array(
     'fbss_comments' => array(
-      'fbss_comments' => array(
-        'fbss_comments_deleted' => array(
-          'runs when' => t('A status comment has been deleted'),
-        ),
-        'fbss_comments_edited' => array(
-          'runs when' => t('A user has edited a status comment'),
-        ),
-        'fbss_comments_saved' => array(
-          'runs when' => t('A user has saved a new status comment'),
-        ),
+      'fbss_comments_fbss_comments_deleted' => array(
+        'label' => t('A status comment has been deleted'),
+      ),
+      'fbss_comments_fbss_comments_edited' => array(
+        'label' => t('A user has edited a status comment'),
+      ),
+      'fbss_comments_fbss_comments_saved' => array(
+        'label' => t('A user has saved a new status comment'),
       ),
     ),
   );
 }
 
 /**
- * Implementation of hook_facebook_status().
+ * Implements hook_facebook_status().
  * or
- * Implementation of hook_trigger_name().
+ * Implements hook_trigger_name().
  */
 function fbss_comments_fbss_comments($op, $comment, $account = NULL) {
   if (strpos($op, 'fbss_comments_') !== 0) {
@@ -907,7 +976,7 @@ function fbss_comments_fbss_comments($op
 //====================
 
 /**
- * Implementation of hook_token_list().
+ * Implements hook_token_list().
  */
 function fbss_comments_token_list($type = 'all') {
   if ($type == 'fbss_comment') {
@@ -933,7 +1002,7 @@ function fbss_comments_token_list($type 
 }
 
 /**
- * Implementation of hook_token_values().
+ * Implements hook_token_values().
  */
 function fbss_comments_token_values($type, $data = NULL, $options = array()) {
   if ($type != 'fbss_comment' || empty($data)) {
@@ -944,30 +1013,30 @@ function fbss_comments_token_values($typ
   $edit = '';
   $delete = '';
   if (fbss_comments_can('edit', $comment)) {
-    $edit = '<span class="fbss-comments-edit-delete">'.
-      l(t('Edit'), 'statuses/comment/'. $comment->cid .'/edit', array('query' => array('destination' => $_GET['q'])))
-      .'</span>';
+    $edit = '<span class="fbss-comments-edit-delete">' .
+      l(t('Edit'), 'statuses/comment/' . $comment->cid . '/edit', array('query' => array('destination' => $_GET['q'])))
+      . '</span>';
   }
   if (fbss_comments_can('delete', $comment)) {
-    $delete = '<span class="fbss-comments-edit-delete">'.
-      l(t('Delete'), 'statuses/comment/'. $comment->cid .'/delete', array('query' => array('destination' => $_GET['q'])))
-      .'</span>';
+    $delete = '<span class="fbss-comments-edit-delete">' .
+      l(t('Delete'), 'statuses/comment/' . $comment->cid . '/delete', array('query' => array('destination' => $_GET['q'])))
+      . '</span>';
   }
   $values = array(
-    'commenter-themed' => theme('username', $account),
+    'commenter-themed' => theme('username', array('account' => $account)),
     'commenter-name' => check_plain($account->name),
     'commenter-name-raw' => $account->name,
     'commenter-uid' => $account->uid,
     'message-unformatted' => check_plain($comment->comment),
     'message-formatted' => nl2br(_facebook_status_run_filter($comment->comment)),
     'message-raw' => $comment->comment,
-    'comment-themed' => theme('fbss_comments_item', $comment, array(), $_GET['q']),
+    'comment-themed' => theme('fbss_comments_item', array('comment' => $comment, 'classes' => array(), 'destination' => $_GET['q'])),
     'comment-id' => $comment->cid,
     'comment-status-id' => $comment->sid,
-    'comment-status-url' => url('statuses/'. $comment->sid, array('absolute' => TRUE)),
+    'comment-status-url' => url('statuses/' . $comment->sid, array('absolute' => TRUE)),
     'comment-edit' => $edit,
     'comment-delete' => $delete,
-    'comment-created' => format_date($comment->created, 'small'),
+    'comment-created' => format_date($comment->created, 'short'),
   );
   $values += token_get_date_token_values($comment->created, 'created-');
   return $values;
@@ -978,11 +1047,11 @@ function fbss_comments_token_values($typ
 //=======================
 
 /**
- * Implementation of hook_fbss_comments_delete().
+ * Implements hook_fbss_comments_delete().
  */
 function fbss_comments_fbss_comments_delete($cid) {
   if (module_exists('activity')) {
-    $result = db_query("SELECT aid FROM {activity} WHERE type = 'fbss_comments' AND op <> 'fbss_comments_deleted' AND eid = %d", $cid);
+    $result = db_query("SELECT aid FROM {activity} WHERE type = :type AND op <> :op AND eid = :eid", array(':type' => 'fbss_comments', ':op' => 'fbss_comments_deleted', ':eid' => $cid));
     $records = array();
     while ($record = db_fetch_object($result)) {
       $records[] = $record->aid;
@@ -994,7 +1063,7 @@ function fbss_comments_fbss_comments_del
 }
 
 /**
- * Implementation of hook_activity_info().
+ * Implements hook_activity_info().
  */
 function fbss_comments_activity_info() {
   $info = new stdClass();
@@ -1009,7 +1078,7 @@ function fbss_comments_activity_info() {
 }
 
 /**
- * Implementation of hook_activity_grants().
+ * Implements hook_activity_grants().
  */
 function fbss_comments_activity_grants($activity) {
   $realms = array();
@@ -1020,7 +1089,7 @@ function fbss_comments_activity_grants($
 }
 
 /**
- * Implementation of hook_activity_access_grants().
+ * Implements hook_activity_access_grants().
  */
 function fbss_comments_activity_access_grants($account) {
   return array(
@@ -1029,18 +1098,18 @@ function fbss_comments_activity_access_g
 }
 
 /**
- * Implementation of hook_list_activity_actions().
+ * Implements hook_list_activity_actions().
  */
 function fbss_comments_list_activity_actions($hook, $op, $max_age) {
   $actions = array();
   if (!empty($max_age)) {
-    $min_time = time() - $max_age;
+    $min_time = REQUEST_TIME - $max_age;
   }
   else {
     $min_time = 0;
   }
 
-  $result = db_query("SELECT cid as id, created, uid as actor FROM {fbss_comments} WHERE created > %d", $min_time);
+  $result = db_query("SELECT cid as id, created, uid as actor FROM {fbss_comments} WHERE created > :created", array(':created' => $min_time));
   while ($row = db_fetch_array($result)) {
     $actions[] = $row;
   }
@@ -1049,7 +1118,7 @@ function fbss_comments_list_activity_act
 }
 
 /**
- * Implementation of hook_load_activity_context().
+ * Implements hook_load_activity_context().
  */
 function fbss_comments_load_activity_context($hook, $op, $id) {
   $comment = fbss_comments_load($id);
diff -up -r submodules/fbss_comments/fbss_comments.pages.inc submodules/fbss_comments/fbss_comments.pages.inc
--- submodules/fbss_comments/fbss_comments.pages.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments.pages.inc	2011-07-24 17:13:27.000000000 -0400
@@ -8,7 +8,7 @@
 /**
  * The administrative settings form.
  */
-function fbss_comments_admin() {
+function fbss_comments_admin($form, &$form_state) {
   $form = array();
   $form['fbss_comments_hide_small'] = array(
     '#type' => 'textfield',
@@ -34,7 +34,7 @@ function fbss_comments_admin() {
     }
     $form['fbss_comments_user_pictures'] = array(
       '#title' => t('Imagecache preset for user pictures in comments'),
-      '#type'  => 'select',
+      '#type' => 'select',
       '#options' => $opt,
       '#default_value' => variable_get('fbss_comments_user_pictures', 0),
     );
@@ -49,14 +49,14 @@ function fbss_comments_admin() {
   $form['fbss_comments_enter'] = array(
     '#type' => 'checkbox',
     '#title' => t('Submit the comment form when pressing Enter'),
-    '#description' => t('If enabled, the comment form will be submitted when the user presses Enter.') .' '.
+    '#description' => t('If enabled, the comment form will be submitted when the user presses Enter.') . ' ' .
       t('Users can still create line breaks by pressing Shift+Enter.'),
     '#default_value' => variable_get('fbss_comments_enter', 0),
   );
   $form['fbss_comments_ahah'] = array(
     '#type' => 'checkbox',
     '#title' => t('Use AHAH to refresh status comment forms without refreshing the page'),
-    '#description' => '<strong>'. t('Disable this if comments are being loaded onto the page via AJAX by a module other than FBSS or Views.') .'</strong>',
+    '#description' => '<strong>' . t('Disable this if comments are being loaded onto the page via AJAX by a module other than FBSS or Views.') . '</strong>',
     '#default_value' => variable_get('fbss_comments_ahah', 1),
   );
   return system_settings_form($form);
@@ -84,7 +84,7 @@ function fbss_comments_admin_validate($f
  * @param $comment
  *   The comment object for the status comment being edited.
  */
-function fbss_comments_edit($form_state, $comment) {
+function fbss_comments_edit($form, $form_state, $comment) {
   $form = array();
   $form['status-comment-edit'] = array(
     '#type' => 'textarea',
@@ -107,7 +107,14 @@ function fbss_comments_edit($form_state,
  * The submit handler for the edit form for status comments.
  */
 function fbss_comments_edit_submit($form, &$form_state) {
-  db_query("UPDATE {fbss_comments} SET comment = '%s' WHERE cid = %d", $form_state['values']['status-comment-edit'], $form['#cid']);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("UPDATE {fbss_comments} SET comment = '%s' WHERE cid = %d", $form_state['values']['status-comment-edit'], $form['#cid']) */
+  db_update('fbss_comments')
+  ->fields(array(
+    'comment' => $form_state['values']['status-comment-edit'],
+  ))
+  ->condition('cid', $form['#cid'])
+  ->execute();
   $c = fbss_comments_load($form['#cid']);
   module_invoke_all('fbss_comments_after_save', $c, TRUE);
   if (module_exists('trigger')) {
@@ -131,11 +138,11 @@ function fbss_comments_edit_submit($form
  * @param $comment
  *   The comment object for the status comment being deleted.
  */
-function fbss_comments_delete($form_state, $comment) {
+function fbss_comments_delete($form, $form_state, $comment) {
   $form = array();
   $form['infotext'] = array(
-    '#value' => '<p>'. t('Are you sure you want to permanently delete the status comment %comment?',
-      array('%comment' => $comment->comment)) .'</p>'
+    '#value' => '<p>' . t('Are you sure you want to permanently delete the status comment %comment?',
+      array('%comment' => $comment->comment)) . '</p>',
   );
   $form['confirm'] = array(
     '#type' => 'submit',
diff -up -r submodules/fbss_comments/fbss_comments.views.inc submodules/fbss_comments/fbss_comments.views.inc
--- submodules/fbss_comments/fbss_comments.views.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments.views.inc	2011-07-24 17:13:27.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_views_data().
+ * Implements hook_views_data().
  */
 function fbss_comments_views_data() {
   // Basic table information.
@@ -174,7 +174,7 @@ function fbss_comments_views_data() {
 }
 
 /**
- * Implementation of hook_views_data_alter().
+ * Implements hook_views_data_alter().
  */
 function fbss_comments_views_data_alter(&$data) {
   $data['fbss_comments']['users'] = array(
@@ -208,7 +208,7 @@ function fbss_comments_views_data_alter(
 }
 
 /**
- * Implementation of hook_views_handlers().
+ * Implements hook_views_handlers().
  */
 function fbss_comments_views_handlers() {
   return array(
diff -up -r submodules/fbss_comments/fbss_comments_flag/fbss_comments_flag.flag.inc submodules/fbss_comments/fbss_comments_flag/fbss_comments_flag.flag.inc
--- submodules/fbss_comments/fbss_comments_flag/fbss_comments_flag.flag.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments_flag/fbss_comments_flag.flag.inc	2011-07-24 17:13:28.000000000 -0400
@@ -63,7 +63,7 @@ class fbss_comments_flag extends flag_fl
     $flag_action = parent::get_flag_action($content_id);
     $comment = $this->fetch_content($content_id);
     $flag_action->content_title = $comment->comment;
-    $flag_action->content_url = 'statuses/'. $comment->sid;
+    $flag_action->content_url = 'statuses/' . $comment->sid;
     return $flag_action;
   }
   function rules_get_event_arguments_definition() {
diff -up -r submodules/fbss_comments/fbss_comments_flag/fbss_comments_flag.info submodules/fbss_comments/fbss_comments_flag/fbss_comments_flag.info
--- submodules/fbss_comments/fbss_comments_flag/fbss_comments_flag.info	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments_flag/fbss_comments_flag.info	2011-07-24 17:13:30.000000000 -0400
@@ -3,4 +3,7 @@ description = "Integrates Flag with Face
 package = Facebook-style Statuses
 dependencies[] = fbss_comments
 dependencies[] = flag
-core = 6.x
\ No newline at end of file
+core = 7.x
+files[] = fbss_comments_flag.flag.inc
+files[] = fbss_comments_flag.install
+files[] = fbss_comments_flag.module
diff -up -r submodules/fbss_comments/fbss_comments_flag/fbss_comments_flag.install submodules/fbss_comments/fbss_comments_flag/fbss_comments_flag.install
--- submodules/fbss_comments/fbss_comments_flag/fbss_comments_flag.install	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments_flag/fbss_comments_flag.install	2011-07-24 17:13:28.000000000 -0400
@@ -6,11 +6,18 @@
  */
 
 /**
- * Implementation of hook_install().
+ * Implements hook_install().
  */
 function fbss_comments_flag_install() {
   // Lower weight so that the Flag module's classes are available to us.
   // We take precautions in fbss_flag.inc to make sure this isn't strictly
   // necessary, but it (probably) doesn't hurt.
-  db_query("UPDATE {system} SET weight = 2 WHERE name = 'fbss_comments_flag'");
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("UPDATE {system} SET weight = 2 WHERE name = 'fbss_comments_flag'") */
+  db_update('system')
+  ->fields(array(
+    'weight' =>  2,
+  ))
+  ->condition('name', 'fbss_comments_flag')
+  ->execute();
 }
diff -up -r submodules/fbss_comments/fbss_comments_flag/fbss_comments_flag.module submodules/fbss_comments/fbss_comments_flag/fbss_comments_flag.module
--- submodules/fbss_comments/fbss_comments_flag/fbss_comments_flag.module	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments_flag/fbss_comments_flag.module	2011-07-24 17:13:28.000000000 -0400
@@ -6,23 +6,41 @@
  */
 
 /**
- * Implementation of hook_facebook_status_delete().
+ * Implements hook_facebook_status_delete().
  */
 function fbss_comments_flag_facebook_status_delete($status) {
-  db_query("DELETE FROM {flag_content} WHERE content_type = 'fbss_comment' AND content_id IN (SELECT cid FROM {fbss_comments} WHERE sid = %d)", $status->sid);
-  db_query("DELETE FROM {flag_counts} WHERE content_type = 'fbss_comment' AND content_id IN (SELECT cid FROM {fbss_comments} WHERE sid = %d)", $status->sid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {flag_content} WHERE content_type = 'fbss_comment' AND content_id IN (SELECT cid FROM {fbss_comments} WHERE sid = %d)", $status->sid) */
+  db_delete('flag_content')
+    ->where('content_type = ' fbss_comment ' AND content_id IN (SELECT cid FROM {fbss_comments} WHERE sid = %d)',  )
+  ->execute();
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {flag_counts} WHERE content_type = 'fbss_comment' AND content_id IN (SELECT cid FROM {fbss_comments} WHERE sid = %d)", $status->sid) */
+  db_delete('flag_counts')
+    ->where('content_type = ' fbss_comment ' AND content_id IN (SELECT cid FROM {fbss_comments} WHERE sid = %d)',  )
+  ->execute();
 }
 
 /**
- * Implementation of hook_fbss_comments_delete().
+ * Implements hook_fbss_comments_delete().
  */
 function fbss_comments_flag_fbss_comments_delete($cid) {
-  db_query("DELETE FROM {flag_content} WHERE content_type = 'fbss_comment' AND content_id = %s", $cid);
-  db_query("DELETE FROM {flag_counts} WHERE content_type = 'fbss_comment' AND content_id = %s", $cid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {flag_content} WHERE content_type = 'fbss_comment' AND content_id = %s", $cid) */
+  db_delete('flag_content')
+  ->condition('content_type', 'fbss_comment')
+  ->condition('content_id', $cid)
+  ->execute();
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {flag_counts} WHERE content_type = 'fbss_comment' AND content_id = %s", $cid) */
+  db_delete('flag_counts')
+  ->condition('content_type', 'fbss_comment')
+  ->condition('content_id', $cid)
+  ->execute();
 }
 
 /**
- * Implementation of hook_flag_definitions().
+ * Implements hook_flag_definitions().
  */
 function fbss_comments_flag_flag_definitions() {
   return array(
@@ -35,7 +53,7 @@ function fbss_comments_flag_flag_definit
 }
 
 /**
- * Implementation of hook_flag_default_flags().
+ * Implements hook_flag_default_flags().
  */
 function fbss_comments_flag_flag_default_flags() {
   $flags = array();
diff -up -r submodules/fbss_comments/fbss_comments_rules/fbss_comments_rules.info submodules/fbss_comments/fbss_comments_rules/fbss_comments_rules.info
--- submodules/fbss_comments/fbss_comments_rules/fbss_comments_rules.info	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments_rules/fbss_comments_rules.info	2011-07-24 17:13:30.000000000 -0400
@@ -3,4 +3,7 @@ description = "Integrates Rules with Fac
 dependencies[] = fbss_comments
 dependencies[] = rules
 package = Facebook-style Statuses
-core = 6.x
+core = 7.x
+
+files[] = fbss_comments_rules.module
+files[] = fbss_comments_rules.rules.inc
diff -up -r submodules/fbss_comments/fbss_comments_rules/fbss_comments_rules.module submodules/fbss_comments/fbss_comments_rules/fbss_comments_rules.module
--- submodules/fbss_comments/fbss_comments_rules/fbss_comments_rules.module	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments_rules/fbss_comments_rules.module	2011-07-24 17:13:28.000000000 -0400
@@ -8,6 +8,10 @@
 /*
  * Implementation of hook_fbss_comments_after_save().
  */
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_comments_rules_fbss_comments_after_save($comment, $edit) {
   if ($edit) {
     rules_invoke_event('fbss_comments_edit', $comment);
@@ -20,6 +24,10 @@ function fbss_comments_rules_fbss_commen
 /*
  * Implementation of hook_fbss_comments_delete().
  */
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_comments_rules_fbss_comments_delete($cid) {
   $comment = fbss_comments_load($cid);
   rules_invoke_event('fbss_comments_delete', $comment);
diff -up -r submodules/fbss_comments/fbss_comments_rules/fbss_comments_rules.rules.inc submodules/fbss_comments/fbss_comments_rules/fbss_comments_rules.rules.inc
--- submodules/fbss_comments/fbss_comments_rules/fbss_comments_rules.rules.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments_rules/fbss_comments_rules.rules.inc	2011-07-24 17:13:28.000000000 -0400
@@ -1,7 +1,7 @@
 <?php
 
 /**
- * Implementation of hook_rules_event_info().
+ * Implements hook_rules_event_info().
  */
 function fbss_comments_rules_rules_event_info() {
   return array(
@@ -9,35 +9,47 @@ function fbss_comments_rules_rules_event
       'label' => t('User saves a new comment on a status'),
       'module' => 'Facebook-style Statuses Comments',
       'arguments' => array(
-        'comment' => array('type' => 'fbss_comment', 'label' => t('The status comment.')),
+        'comment' => array(
+          'type' => 'fbss_comment',
+          'label' => t('The status comment.'),
+        ),
       ),
     ),
     'fbss_comments_edit' => array(
       'label' => t('User edits a comment on a status'),
       'module' => 'Facebook-style Statuses Comments',
       'arguments' => array(
-        'comment' => array('type' => 'fbss_comment', 'label' => t('The status comment.')),
+        'comment' => array(
+          'type' => 'fbss_comment',
+          'label' => t('The status comment.'),
+        ),
       ),
     ),
     'fbss_comments_delete' => array(
       'label' => t('User deletes a comment on a status'),
       'module' => 'Facebook-style Statuses Comments',
       'arguments' => array(
-        'comment' => array('type' => 'fbss_comment', 'label' => t('The status comment.')),
+        'comment' => array(
+          'type' => 'fbss_comment',
+          'label' => t('The status comment.'),
+        ),
       ),
     ),
   );
 }
 
 /**
- * Implementation of hook_rules_condition_info().
+ * Implements hook_rules_condition_info().
  */
 function fbss_comments_rules_rules_condition_info() {
   return array(
     'fbss_comments_rules_on_own' => array(
       'label' => t('Comment was posted on own status'),
       'arguments' => array(
-        'comment' => array('type' => 'fbss_comment', 'label' => t('The status comment.')),
+        'comment' => array(
+          'type' => 'fbss_comment',
+          'label' => t('The status comment.'),
+        ),
       ),
       'module' => 'Facebook-style Statuses Comments',
     ),
@@ -49,14 +61,20 @@ function fbss_comments_rules_rules_condi
     'fbss_comments_rules_can_edit' => array(
       'label' => t('User has permission to edit a status comment'),
       'arguments' => array(
-        'comment' => array('type' => 'fbss_comment', 'label' => t('The status comment.')),
+        'comment' => array(
+          'type' => 'fbss_comment',
+          'label' => t('The status comment.'),
+        ),
       ),
       'module' => 'Facebook-style Statuses Comments',
     ),
     'fbss_comments_rules_can_delete' => array(
       'label' => t('User has permission to delete a status comment'),
       'arguments' => array(
-        'comment' => array('type' => 'fbss_comment', 'label' => t('The status comment.')),
+        'comment' => array(
+          'type' => 'fbss_comment',
+          'label' => t('The status comment.'),
+        ),
       ),
       'module' => 'Facebook-style Statuses Comments',
     ),
@@ -93,14 +111,17 @@ function fbss_comments_rules_can_delete(
 }
 
 /**
- * Implementation of hook_rules_action_info().
+ * Implements hook_rules_action_info().
  */
 function fbss_comments_rules_rules_action_info() {
   return array(
     'fbss_comments_rules_load_action' => array(
       'label' => t('Load a status comment'),
       'new variables' => array(
-        'comment_loaded' => array('type' => 'fbss_comment', 'label' => t('Loaded status comment')),
+        'comment_loaded' => array(
+          'type' => 'fbss_comment',
+          'label' => t('Loaded status comment'),
+        ),
       ),
       'help' => t('Enter the Comment ID of a status comment to load.'),
       'module' => 'Facebook-style Statuses Comments',
@@ -151,7 +172,10 @@ function fbss_comments_rules_load_action
  * Builds the form for editing a status comment.
  */
 function fbss_comments_rules_edit_action_form($settings, &$form) {
-  $settings += array('cid' => '', 'message' => '');
+  $settings += array(
+    'cid' => '',
+    'message' => '',
+  );
   $form['settings']['cid'] = array(
     '#type' => 'textfield',
     '#title' => t('Status Comment ID'),
@@ -170,7 +194,14 @@ function fbss_comments_rules_edit_action
  * Edits a status.
  */
 function fbss_comments_rules_edit_action($settings) {
-  db_query("UPDATE {fbss_comments} SET comment = '%s' WHERE cid = %d", $settings['message'], $settings['cid']);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("UPDATE {fbss_comments} SET comment = '%s' WHERE cid = %d", $settings['message'], $settings['cid']) */
+  db_update('fbss_comments')
+  ->fields(array(
+    'comment' => $settings['message'],
+  ))
+  ->condition('cid', $settings['cid'])
+  ->execute();
   $c = fbss_comments_load($settings['cid']);
   module_invoke_all('fbss_comments_after_save', $c, TRUE);
   if (module_exists('trigger')) {
@@ -202,7 +233,11 @@ function fbss_comments_rules_delete_acti
  * Builds the form for adding a status.
  */
 function fbss_comments_rules_add_action_form($settings, &$form) {
-  $settings += array('sid' => '', 'message' => '', 'uid' => '');
+  $settings += array(
+    'sid' => '',
+    'message' => '',
+    'uid' => '',
+  );
   $form['settings']['sid'] = array(
     '#type' => 'textfield',
     '#title' => t('Status ID'),
@@ -233,7 +268,7 @@ function fbss_comments_rules_add_action(
 }
 
 /**
- * Implementation of hook_rules_data_type_info().
+ * Implements hook_rules_data_type_info().
  */
 function fbss_comments_rules_rules_data_type_info() {
   return array(
diff -up -r submodules/fbss_comments/fbss_comments_views_handler_field_cc.inc submodules/fbss_comments/fbss_comments_views_handler_field_cc.inc
--- submodules/fbss_comments/fbss_comments_views_handler_field_cc.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments_views_handler_field_cc.inc	2011-07-24 17:13:28.000000000 -0400
@@ -11,7 +11,7 @@
 class fbss_comments_views_handler_field_cc extends views_handler_field {
   function render($values) {
     $sid = $values->{$this->field_alias};
-    $count = db_result(db_query("SELECT COUNT(cid) FROM {fbss_comments} WHERE sid = %d", $sid));
+    $count = db_query("SELECT COUNT(cid) FROM {fbss_comments} WHERE sid = :sid", array(':sid' => $sid))->fetchField();
     return $count;
   }
 }
diff -up -r submodules/fbss_comments/fbss_comments_views_handler_field_cc2.inc submodules/fbss_comments/fbss_comments_views_handler_field_cc2.inc
--- submodules/fbss_comments/fbss_comments_views_handler_field_cc2.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments_views_handler_field_cc2.inc	2011-07-24 17:13:28.000000000 -0400
@@ -11,7 +11,7 @@
 class fbss_comments_views_handler_field_cc2 extends views_handler_field {
   function render($values) {
     $sid = $values->{$this->field_alias};
-    $count = db_result(db_query("SELECT COUNT(cid) FROM {fbss_comments} WHERE sid = %d", $sid));
+    $count = db_query("SELECT COUNT(cid) FROM {fbss_comments} WHERE sid = :sid", array(':sid' => $sid))->fetchField();
     return format_plural($count, '1 comment', '@count comments');
   }
 }
diff -up -r submodules/fbss_comments/fbss_comments_views_handler_field_comment_box.inc submodules/fbss_comments/fbss_comments_views_handler_field_comment_box.inc
--- submodules/fbss_comments/fbss_comments_views_handler_field_comment_box.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments_views_handler_field_comment_box.inc	2011-07-24 17:13:28.000000000 -0400
@@ -10,6 +10,6 @@
  */
 class fbss_comments_views_handler_field_comment_box extends views_handler_field {
   function render($values) {
-    return theme('fbss_comments_form_display', $values->{$this->field_alias}, TRUE, TRUE);
+    return theme('fbss_comments_form_display', array('sid' => $values->{$this->field_alias}, 'delay_load_form' => TRUE, 'delay_load_comments' => TRUE));
   }
 }
diff -up -r submodules/fbss_comments/fbss_comments_views_handler_field_delete.inc submodules/fbss_comments/fbss_comments_views_handler_field_delete.inc
--- submodules/fbss_comments/fbss_comments_views_handler_field_delete.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments_views_handler_field_delete.inc	2011-07-24 17:13:28.000000000 -0400
@@ -27,8 +27,8 @@ class fbss_comments_views_handler_field_
       if (module_exists('modalframe')) {
         modalframe_parent_js();
       }
-      drupal_add_css(drupal_get_path('module', 'fbss_comments') .'/fbss_comments.css');
-      return '<span class="facebook-status-delete">'. l(t('Delete'), 'statuses/comment/'. $comment->cid .'/delete', array('query' => array('destination' => $_GET['q']))) .'</span>';
+      drupal_add_css(drupal_get_path('module', 'fbss_comments') . '/fbss_comments.css');
+      return '<span class="facebook-status-delete">' . l(t('Delete'), 'statuses/comment/' . $comment->cid . '/delete', array('query' => array('destination' => $_GET['q']))) . '</span>';
     }
   }
 }
diff -up -r submodules/fbss_comments/fbss_comments_views_handler_field_edit.inc submodules/fbss_comments/fbss_comments_views_handler_field_edit.inc
--- submodules/fbss_comments/fbss_comments_views_handler_field_edit.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_comments/fbss_comments_views_handler_field_edit.inc	2011-07-24 17:13:28.000000000 -0400
@@ -27,8 +27,8 @@ class fbss_comments_views_handler_field_
       if (module_exists('modalframe')) {
         modalframe_parent_js();
       }
-      drupal_add_css(drupal_get_path('module', 'fbss_comments') .'/fbss_comments.css');
-      return '<span class="facebook-status-edit">'. l(t('Edit'), 'statuses/comment/'. $comment->cid .'/edit', array('query' => array('destination' => $_GET['q']))) .'</span>';
+      drupal_add_css(drupal_get_path('module', 'fbss_comments') . '/fbss_comments.css');
+      return '<span class="facebook-status-edit">' . l(t('Edit'), 'statuses/comment/' . $comment->cid . '/edit', array('query' => array('destination' => $_GET['q']))) . '</span>';
     }
   }
 }
diff -up -r submodules/fbss_flag/fbss_flag.info submodules/fbss_flag/fbss_flag.info
--- submodules/fbss_flag/fbss_flag.info	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_flag/fbss_flag.info	2011-07-24 17:13:30.000000000 -0400
@@ -3,4 +3,11 @@ description = "Integrates Flag with Face
 package = Facebook-style Statuses
 dependencies[] = facebook_status
 dependencies[] = flag
-core = 6.x
\ No newline at end of file
+core = 7.x
+files[] = fbss_flag.flag.inc
+files[] = fbss_flag.install
+files[] = fbss_flag.module
+files[] = views/facebook_status_views_handler_argument_flagged_user.inc
+files[] = views/facebook_status_views_handler_filter_flagged_user.inc
+files[] = views/fbss_flag.views.inc
+files[] = views/fbss_flag.views_default.inc
diff -up -r submodules/fbss_flag/fbss_flag.install submodules/fbss_flag/fbss_flag.install
--- submodules/fbss_flag/fbss_flag.install	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_flag/fbss_flag.install	2011-07-24 17:13:28.000000000 -0400
@@ -6,11 +6,18 @@
  */
 
 /**
- * Implementation of hook_install().
+ * Implements hook_install().
  */
 function fbss_flag_install() {
   // Lower weight so that the Flag module's classes are available to us.
   // We take precautions in fbss_flag.inc to make sure this isn't strictly
   // necessary, but it (probably) doesn't hurt.
-  db_query("UPDATE {system} SET weight = 2 WHERE name = 'fbss_flag'");
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("UPDATE {system} SET weight = 2 WHERE name = 'fbss_flag'") */
+  db_update('system')
+  ->fields(array(
+    'weight' =>  2,
+  ))
+  ->condition('name', 'fbss_flag')
+  ->execute();
 }
diff -up -r submodules/fbss_flag/fbss_flag.module submodules/fbss_flag/fbss_flag.module
--- submodules/fbss_flag/fbss_flag.module	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_flag/fbss_flag.module	2011-07-24 17:13:28.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_link().
+ * Implements hook_link().
  */
 function fbss_flag_link($type, $status) {
   if ($type != 'facebook_status') {
@@ -14,7 +14,7 @@ function fbss_flag_link($type, $status) 
   }
   $links = array();
   foreach (flag_get_flags('facebook_status') as $flag) {
-    $links['flag-'. $flag->name] = array(
+    $links['flag-' . $flag->name] = array(
       'html' => TRUE,
       'title' => flag_create_link($flag->name, $status->sid),
     );
@@ -23,36 +23,46 @@ function fbss_flag_link($type, $status) 
 }
 
 /**
- * Implementation of hook_facebook_status_delete().
+ * Implements hook_facebook_status_delete().
  */
 function fbss_flag_facebook_status_delete($status) {
-  db_query("DELETE FROM {flag_content} WHERE content_type = 'facebook_status' AND content_id = %d", $status->sid);
-  db_query("DELETE FROM {flag_counts} WHERE content_type = 'facebook_status' AND content_id = %d", $status->sid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {flag_content} WHERE content_type = 'facebook_status' AND content_id = %d", $status->sid) */
+  db_delete('flag_content')
+  ->condition('content_type', 'facebook_status')
+  ->condition('content_id', $status->sid)
+  ->execute();
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {flag_counts} WHERE content_type = 'facebook_status' AND content_id = %d", $status->sid) */
+  db_delete('flag_counts')
+  ->condition('content_type', 'facebook_status')
+  ->condition('content_id', $status->sid)
+  ->execute();
 }
 
 /**
- * Implementation of hook_form_FORM_ID_alter().
+ * Implements hook_form_FORM_ID_alter().
  */
 function fbss_flag_form_facebook_status_box_alter(&$form, $form_state) {
   // Make sure the necessary resources are loaded when the list of status updates is empty.
   // Otherwise, when the first status is posted, flagging an item will refresh the page.
-  $path = drupal_get_path('module', 'flag') .'/theme';
-  drupal_add_css($path .'/flag.css');
-  drupal_add_js($path .'/flag.js');
+  $path = drupal_get_path('module', 'flag') . '/theme';
+  drupal_add_css($path . '/flag.css');
+  drupal_add_js($path . '/flag.js');
 }
 
 /**
- * Implementation of hook_views_api().
+ * Implements hook_views_api().
  */
 function fbss_flag_views_api() {
   return array(
     'api' => 2,
-    'path' => drupal_get_path('module', 'fbss_flag') .'/views',
+    'path' => drupal_get_path('module', 'fbss_flag') . '/views',
   );
 }
 
 /**
- * Implementation of hook_views_default_views_alter().
+ * Implements hook_views_default_views_alter().
  */
 function fbss_flag_views_default_views_alter(&$views) {
   // Add the "like" field to default Views.
@@ -120,7 +130,7 @@ function fbss_flag_views_default_views_a
 }
 
 /**
- * Implementation of hook_flag_definitions().
+ * Implements hook_flag_definitions().
  */
 function fbss_flag_flag_definitions() {
   return array(
@@ -133,7 +143,7 @@ function fbss_flag_flag_definitions() {
 }
 
 /**
- * Implementation of hook_flag_default_flags().
+ * Implements hook_flag_default_flags().
  */
 function fbss_flag_flag_default_flags() {
   $flags = array();
diff -up -r submodules/fbss_flag/views/fbss_flag.views.inc submodules/fbss_flag/views/fbss_flag.views.inc
--- submodules/fbss_flag/views/fbss_flag.views.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_flag/views/fbss_flag.views.inc	2011-07-24 17:13:28.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_views_data().
+ * Implements hook_views_data().
  */
 function fbss_flag_views_data() {
   $data = array();
@@ -32,12 +32,12 @@ function fbss_flag_views_data() {
 }
 
 /**
- * Implementation of hook_views_handlers().
+ * Implements hook_views_handlers().
  */
 function fbss_flag_views_handlers() {
   return array(
     'info' => array(
-      'path' => drupal_get_path('module', 'fbss_flag') .'/views',
+      'path' => drupal_get_path('module', 'fbss_flag') . '/views',
     ),
     'handlers' => array(
       'facebook_status_views_handler_filter_flagged_user' => array(
diff -up -r submodules/fbss_flag/views/fbss_flag.views_default.inc submodules/fbss_flag/views/fbss_flag.views_default.inc
--- submodules/fbss_flag/views/fbss_flag.views_default.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_flag/views/fbss_flag.views_default.inc	2011-07-24 17:13:28.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_views_default_views().
+ * Implements hook_views_default_views().
  */
 function fbss_flag_views_default_views() {
   $views = array();
diff -up -r submodules/fbss_mollom/fbss_mollom.info submodules/fbss_mollom/fbss_mollom.info
--- submodules/fbss_mollom/fbss_mollom.info	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_mollom/fbss_mollom.info	2011-07-24 17:13:30.000000000 -0400
@@ -3,4 +3,6 @@ description = "Integrates Mollom with Fa
 package = Facebook-style Statuses
 dependencies[] = facebook_status
 dependencies[] = mollom
-core = 6.x
+core = 7.x
+
+files[] = fbss_mollom.module
diff -up -r submodules/fbss_mollom/fbss_mollom.module submodules/fbss_mollom/fbss_mollom.module
--- submodules/fbss_mollom/fbss_mollom.module	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_mollom/fbss_mollom.module	2011-07-24 17:13:28.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_mollom_form_list().
+ * Implements hook_mollom_form_list().
  */
 function fbss_mollom_mollom_form_list() {
   return array(
@@ -34,7 +34,7 @@ function fbss_mollom_mollom_form_list() 
 }
 
 /**
- * Implementation of hook_mollom_form_info().
+ * Implements hook_mollom_form_info().
  */
 function fbss_mollom_mollom_form_info($form_id) {
   if ($form_id == 'facebook_status_box') {
diff -up -r submodules/fbss_notifications/fbss_notifications.info submodules/fbss_notifications/fbss_notifications.info
--- submodules/fbss_notifications/fbss_notifications.info	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_notifications/fbss_notifications.info	2011-07-24 17:13:30.000000000 -0400
@@ -4,4 +4,8 @@ package = Facebook-style Statuses
 dependencies[] = facebook_status
 dependencies[] = notifications
 dependencies[] = messaging
-core = 6.x
+core = 7.x
+
+files[] = fbss_notifications.install
+files[] = fbss_notifications.module
+files[] = fbss_notifications.pages.inc
diff -up -r submodules/fbss_notifications/fbss_notifications.install submodules/fbss_notifications/fbss_notifications.install
--- submodules/fbss_notifications/fbss_notifications.install	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_notifications/fbss_notifications.install	2011-07-24 17:13:28.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
  */
 function fbss_notifications_uninstall() {
   variable_del('fbss_notifications_type');
diff -up -r submodules/fbss_notifications/fbss_notifications.module submodules/fbss_notifications/fbss_notifications.module
--- submodules/fbss_notifications/fbss_notifications.module	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_notifications/fbss_notifications.module	2011-07-24 17:13:28.000000000 -0400
@@ -9,7 +9,7 @@
 define('FBSS_NOTIFICATIONS_PAGER', 20);
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function fbss_notifications_menu() {
   $items = array();
@@ -31,10 +31,10 @@ function fbss_notifications_menu() {
     'file' => 'fbss_notifications.pages.inc',
   );
   foreach (facebook_status_all_contexts() as $type => $info) {
-    $items['user/%user/notifications/'. $type .'-stream'] = array(
+    $items['user/%user/notifications/' . $type . '-stream'] = array(
       'type' => MENU_LOCAL_TASK,
       'access callback' => FALSE,
-      'title' => $info['title'] .' statuses',
+      'title' => $info['title'] . ' statuses',
       'page callback' => 'fbss_notifications_page_type',
       'pàge arguments' => array(1),
       'weight' => 30,
@@ -52,10 +52,15 @@ function fbss_notifications_menu() {
 }
 
 /**
- * Implementation of hook_perm().
+ * Implements hook_permission().
  */
-function fbss_notifications_perm() {
-  $perms = array('subscribe to a status stream');
+function fbss_notifications_permission() {
+  $perms = array(
+    'subscribe to a status stream' => array(
+      'title' => t('subscribe to a status stream'),
+      'description' => t('TODO Add a description for \'subscribe to a status stream\''),
+    ),
+  );
   if (module_exists('fbss_comments')) {
     $perms[] = 'subscribe to comments on a status';
   }
@@ -63,7 +68,7 @@ function fbss_notifications_perm() {
 }
 
 /**
- * Implementation of hook_facebook_status_delete().
+ * Implements hook_facebook_status_delete().
  */
 function fbss_notifications_facebook_status_delete($status) {
   db_query("
@@ -78,7 +83,7 @@ function fbss_notifications_facebook_sta
 }
 
 /**
- * Implementation of hook_facebook_status_save().
+ * Implements hook_facebook_status_save().
  */
 function fbss_notifications_facebook_status_save($status, $context, $edit, $options) {
   global $user;
@@ -94,7 +99,11 @@ function fbss_notifications_facebook_sta
             'oid' => $status->sid,
             'type' => $event_type,
             'action' => 'update-self',
-            'params' => array('sid' => $status->sid, 'recipient' => $status->recipient, 'type' => $status->type),
+            'params' => array(
+              'sid' => $status->sid,
+              'recipient' => $status->recipient,
+              'type' => $status->type,
+            ),
           );
           notifications_event($event);
         }
@@ -106,7 +115,11 @@ function fbss_notifications_facebook_sta
             'oid' => $status->sid,
             'type' => $event_type,
             'action' => 'update-other',
-            'params' => array('sid' => $status->sid, 'recipient' => $status->recipient, 'type' => $status->type),
+            'params' => array(
+              'sid' => $status->sid,
+              'recipient' => $status->recipient,
+              'type' => $status->type,
+            ),
           );
           notifications_event($event);
         }
@@ -134,7 +147,11 @@ function fbss_notifications_facebook_sta
             'oid' => $status->sid,
             'type' => $event_type,
             'action' => 'create-self',
-            'params' => array('sid' => $status->sid, 'recipient' => $status->recipient, 'type' => $status->type),
+            'params' => array(
+              'sid' => $status->sid,
+              'recipient' => $status->recipient,
+              'type' => $status->type,
+            ),
           );
           notifications_event($event);
         }
@@ -146,7 +163,11 @@ function fbss_notifications_facebook_sta
             'oid' => $status->sid,
             'type' => $event_type,
             'action' => 'create-other',
-            'params' => array('sid' => $status->sid, 'recipient' => $status->recipient, 'type' => $status->type),
+            'params' => array(
+              'sid' => $status->sid,
+              'recipient' => $status->recipient,
+              'type' => $status->type,
+            ),
           );
           notifications_event($event);
         }
@@ -156,7 +177,7 @@ function fbss_notifications_facebook_sta
 }
 
 /**
- * Implementation of hook_fbss_comments_after_save().
+ * Implements hook_fbss_comments_after_save().
  */
 function fbss_notifications_fbss_comments_after_save($comment, $edit) {
   if (!$edit) {
@@ -189,14 +210,14 @@ function fbss_notifications_fbss_comment
 }
 
 /**
- * Implementation of hook_notifications().
+ * Implements hook_notifications().
  */
 function fbss_notifications_notifications($op, &$arg0 = NULL, $arg1 = NULL, $arg2 = NULL) {
   switch ($op) {
     case 'subscription types': // Kinds of subscriptions a user can add, e.g. "Subscribe to thread" and "Subscribe to stream"
       $types = array();
       if (module_exists('fbss_comments')) {
-        $types['status'] = array( // 'status' is $subscription->type
+        $types['status'] = array(// 'status' is $subscription->type
           'event_type' => 'status', // 'status' is $subscription->event_type
           'title' => t('Status thread'),
           'access' => "subscribe to a user's status updates",
@@ -208,15 +229,15 @@ function fbss_notifications_notification
         );
       }
       foreach (facebook_status_all_contexts() as $type => $info) {
-        $types[$type .'-stream'] = array( // $type-stream is $subscription->type
+        $types[$type . '-stream'] = array(// $type-stream is $subscription->type
           'event_type' => 'stream', // 'stream' is $subscription->event_type
           'title' => t('!type status stream', array('!type' => $info['title'])),
           'access' => "subscribe to an entity's status stream",
           'page callback' => 'fbss_notifications_page_type',
-          'user page' => 'user/%user/notifications/'. $type .'-stream',
+          'user page' => 'user/%user/notifications/' . $type . '-stream',
           'fields' => array('recipient', 'fs_type'),
           'description' => t('Subscribe to this stream of statuses.'),
-          'disabled' => in_array($type .'-stream', array_values(variable_get('fbss_notifications_type', array()))),
+          'disabled' => in_array($type . '-stream', array_values(variable_get('fbss_notifications_type', array()))),
         );
       }
       return $types;
@@ -237,15 +258,15 @@ function fbss_notifications_notification
           // 100 is an arbitrary length.
           if (drupal_strlen($message) > 100) {
             // "\xE2\x80\xA6" is the unicode escape sequence for the HTML entity &hellip; (an ellipsis)
-            $message = drupal_substr($message, 0, 99) ."\xE2\x80\xA6";
+            $message = drupal_substr($message, 0, 99) . "\xE2\x80\xA6";
           }
           $subs->names['type'] = t('Status thread: @message', array('@message' => $message));
         }
       }
       break;
     case 'subscription fields': // Describe important properties of an object a subscription may be against.
-                                // Used to get info about the fields used in queries, not to actually build queries.
-                                // Also used to display options for adding an arbitrary subscription.
+      // Used to get info about the fields used in queries, not to actually build queries.
+      // Also used to display options for adding an arbitrary subscription.
       $fields = array();
       $fields['sid'] = array(
         'name' => t('Status ID'),
@@ -361,7 +382,10 @@ function fbss_notifications_notification
         $options[] = array(
           'name' => t('All status updates by @name', array('@name' => $arg1->name)),
           'type' => 'user-stream',
-          'fields' => array('recipient' => $arg1->uid, 'type' => 'user'),
+          'fields' => array(
+            'recipient' => $arg1->uid,
+            'type' => 'user',
+          ),
         );
       }
       return $options;
@@ -372,15 +396,21 @@ function fbss_notifications_notification
         $options[] = array(
           'name' => t('All status updates on %name', array('@name' => $arg1->title)),
           'type' => 'node-stream',
-          'fields' => array('recipient' => $arg1->nid, 'type' => 'node'),
+          'fields' => array(
+            'recipient' => $arg1->nid,
+            'type' => 'node',
+          ),
         );
       }
       elseif (module_exists('og') && in_array('og', array_values(variable_get('fbss_notifications_link', array('user' => 'user', 'node' => 0, 'og' => 'og'))))) {
-        if (db_result(db_query("SELECT nid FROM {og} WHERE nid = %d", $arg1->nid))) {
+        if (db_query("SELECT nid FROM {og} WHERE nid = :nid", array(':nid' => $arg1->nid))->fetchField()) {
           $options[] = array(
             'name' => t('All status updates on %name', array('@name' => $arg1->title)),
             'type' => 'node-stream',
-            'fields' => array('recipient' => $arg1->nid, 'type' => 'node'),
+            'fields' => array(
+              'recipient' => $arg1->nid,
+              'type' => 'node',
+            ),
           );
         }
       }
@@ -434,7 +464,7 @@ function fbss_notifications_notification
 }
 
 /**
- * Implementation of hook_messaging().
+ * Implements hook_messaging().
  */
 function fbss_notifications_messaging($op, $arg1 = NULL, $arg2 = NULL) {
   switch ($op) {
diff -up -r submodules/fbss_notifications/fbss_notifications.pages.inc submodules/fbss_notifications/fbss_notifications.pages.inc
--- submodules/fbss_notifications/fbss_notifications.pages.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_notifications/fbss_notifications.pages.inc	2011-07-24 17:13:29.000000000 -0400
@@ -23,7 +23,10 @@ function fbss_notifications_settings_for
     '#default_value' => variable_get('fbss_notifications_type', array()),
     '#description' => t('Define the available subscription types that will be enabled globally'),
   );
-  $options = array('user' => t('User profiles'), 'node' => t('Nodes'));
+  $options = array(
+    'user' => t('User profiles'),
+    'node' => t('Nodes'),
+  );
   if (module_exists('og')) {
     $options['og'] = t('Organic groups');
   }
@@ -76,19 +79,22 @@ function fbss_notifications_page_thread(
     // 100 is an arbitrary length.
     if (drupal_strlen($message) > 100) {
       // "\xE2\x80\xA6" is the unicode escape sequence for the HTML entity &hellip; (an ellipsis)
-      $message = drupal_substr($message, 0, 99) ."\xE2\x80\xA6";
+      $message = drupal_substr($message, 0, 99) . "\xE2\x80\xA6";
     }
-    $list[$sub->fs_sid] = '['. $content_types[$sub->fs_type]['title'] .'] '. l($message, 'statuses/'. $sub->fs_sid);
+    $list[$sub->fs_sid] = '[' . $content_types[$sub->fs_type]['title'] . '] ' . l($message, 'statuses/' . $sub->fs_sid);
   }
   if (empty($subscriptions)) {
     $output = t('You are not currently subscribed to any active threads');
   }
   else {
     $output = t('You are currently subscribed to the following threads:');
-    $defaults = array('type' => 'status', 'event_type' => 'status');
+    $defaults = array(
+      'type' => 'status',
+      'event_type' => 'status',
+    );
     $options = array('title' => t('Message'));
     $output .= drupal_get_form('notifications_user_form', $account, 'status', $subscriptions, $list, $defaults, $options);
-    $output .= theme('pager', NULL, FBSS_NOTIFICATIONS_PAGER);
+    $output .= theme('pager', array('tags' => NULL));
   }
   return $output;
 }
@@ -136,10 +142,13 @@ function fbss_notifications_page_type($a
     $output = t('There are no active !type subscriptions.', array('!type' => $context['title']));
   }
   else {
-    $defaults = array('type' => arg(3), 'event_type' => 'status');
+    $defaults = array(
+      'type' => arg(3),
+      'event_type' => 'status',
+    );
     $options = array('title' => t('Subscribed to'));
     $output = drupal_get_form('notifications_user_form', $account, arg(3), $subscriptions, $list, $defaults, $options);
-    $output .= theme('pager', NULL, FBSS_NOTIFICATIONS_PAGER);
+    $output .= theme('pager', array('tags' => NULL));
   }
   return $output;
 }
@@ -199,7 +208,7 @@ function fbss_notifications_autocomplete
       }
     }
   }
-  drupal_json($matches);
+  drupal_json_output($matches);
 }
 
 /**
@@ -239,12 +248,12 @@ function fbss_notifications_author_uid($
       switch ($type) {
         case 'og':
         case 'node':
-          return db_result(db_query_range("SELECT nid FROM {node} WHERE title = '%s'", $name, 0, 1));
+          return db_query_range("SELECT nid FROM {node} WHERE title = :title", array(':title' => $name))->fetchField();
         case 'user':
-          return db_result(db_query_range("SELECT uid FROM {users} WHERE name = '%s'", $name, 0, 1));
+          return db_query_range("SELECT uid FROM {users} WHERE name = :name", array(':name' => $name))->fetchField();
         case 'term':
           if (module_exists('taxonomy')) {
-            return db_result(db_query_range("SELECT tid FROM {term_data} WHERE name = '%s'", $name, 0, 1));
+            return db_query_range("SELECT tid FROM {taxonomy_term_data} WHERE name = :name", array(':name' => $name))->fetchField();
           }
       }
     }
@@ -259,7 +268,7 @@ function fbss_notifications_author_uid($
 //======================
 
 /**
- * Implementation of hook_fbss_notifications_autocomplete_recipient().
+ * Implements hook_fbss_notifications_autocomplete_recipient().
  */
 function fbss_notifications_fbss_notifications_autocomplete_recipient($string) {
   $orig_string = $string;
@@ -274,7 +283,8 @@ function fbss_notifications_fbss_notific
 
   // Users.
   $matches['user'] = array();
-  $result = db_query_range("SELECT name FROM {users} WHERE LOWER(name) LIKE LOWER('%s%%')", $string, 0, 10);
+  // TODO Please convert this statement to the D7 database API syntax.
+  $result = db_query_range("SELECT name FROM {users} WHERE LOWER(name) LIKE LOWER('%s%%')", $string);
   while ($account = db_fetch_object($result)) {
     $key = $prefix . _fbss_notifications_autocomplete_key_helper($account->name);
     $matches['user'][$key] = check_plain($account->name);
@@ -283,6 +293,7 @@ function fbss_notifications_fbss_notific
   // Organic groups.
   if (module_exists('og')) {
     $matches['og'] = array();
+    // TODO Please convert this statement to the D7 database API syntax.
     $result = db_query_range(db_rewrite_sql("
       SELECT n.nid, n.title
       FROM {og_uid} ou
@@ -294,7 +305,7 @@ function fbss_notifications_fbss_notific
         LOWER(n.title) LIKE LOWER('%s%%') AND
         (og.og_private = 0 OR ou.uid = %d) AND
         n.status = 1
-    "), $string, $user->uid, 0, 10);
+    "), $string, $user->uid);
     while ($node = db_fetch_object($result)) {
       $key = $prefix . _fbss_notifications_autocomplete_key_helper($node->title);
       $matches['og'][$key] = check_plain($node->title);
@@ -303,6 +314,7 @@ function fbss_notifications_fbss_notific
 
   $matches['node'] = array();
   if (module_exists('og')) {
+    // TODO Please convert this statement to the D7 database API syntax.
     $result = db_query_range(db_rewrite_sql("
       SELECT n.nid, n.title
       FROM {node} n
@@ -312,16 +324,17 @@ function fbss_notifications_fbss_notific
         og.nid IS NULL AND
         n.status = 1 AND
         LOWER(n.title) LIKE LOWER('%s%%')
-    "), $string, 0, 10);
+    "), $string);
   }
   else {
+    // TODO Please convert this statement to the D7 database API syntax.
     $result = db_query_range(db_rewrite_sql("
       SELECT nid, title
       FROM {node}
       WHERE
         status = 1 AND
         LOWER(title) LIKE LOWER('%s%%')
-    "), $string, 0, 10);
+    "), $string);
   }
   while ($node = db_fetch_object($result)) {
     $key = $prefix . _fbss_notifications_autocomplete_key_helper($node->title);
@@ -331,7 +344,8 @@ function fbss_notifications_fbss_notific
   // Taxonomy terms.
   if (module_exists('taxonomy') && module_exists('facebook_status_tags') && variable_get('facebook_status_tags_vid', -1) != -1) {
     $matches['term'] = array();
-    $result = db_query_range("SELECT name FROM {facebook_status_tags} WHERE LOWER(name) LIKE LOWER('%s%%')", $string, 0, 10);
+    // TODO Please convert this statement to the D7 database API syntax.
+    $result = db_query_range("SELECT name FROM {facebook_status_tags} WHERE LOWER(name) LIKE LOWER('%s%%')", $string);
     while ($term = db_fetch_object($result)) {
       $key = $prefix . _fbss_notifications_autocomplete_key_helper($term->name);
       $matches['node'][$key] = check_plain($term->name);
diff -up -r submodules/fbss_pathauto/fbss_pathauto.info submodules/fbss_pathauto/fbss_pathauto.info
--- submodules/fbss_pathauto/fbss_pathauto.info	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_pathauto/fbss_pathauto.info	2011-07-24 17:13:30.000000000 -0400
@@ -3,4 +3,5 @@ description = "Integrates Pathauto with 
 package = Facebook-style Statuses
 dependencies[] = facebook_status
 dependencies[] = pathauto
-core = 6.x
\ No newline at end of file
+core = 7.x
+files[] = fbss_pathauto.module
diff -up -r submodules/fbss_pathauto/fbss_pathauto.module submodules/fbss_pathauto/fbss_pathauto.module
--- submodules/fbss_pathauto/fbss_pathauto.module	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_pathauto/fbss_pathauto.module	2011-07-24 17:13:29.000000000 -0400
@@ -6,20 +6,24 @@
  */
 
 /**
- * Implementation of hook_facebook_status_delete().
+ * Implements hook_facebook_status_delete().
  */
 function fbss_pathauto_facebook_status_delete($status) {
-  db_query("DELETE FROM {url_alias} WHERE src = 'statuses/%d'", $status->sid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {url_alias} WHERE src = 'statuses/%d'", $status->sid) */
+  db_delete('url_alias')
+  ->condition('src', $status->sid)
+  ->execute();
 }
 
 /**
- * Implementation of hook_facebook_status_save().
+ * Implements hook_facebook_status_save().
  */
 function fbss_pathauto_facebook_status_save($status, $context, $edit = FALSE) {
   $op = $edit ? 'update' : 'insert';
   module_load_include('inc', 'pathauto');
   $placeholders = pathauto_get_placeholders('facebook_status', $status);
-  $src = 'statuses/'. $status->sid;
+  $src = 'statuses/' . $status->sid;
   if ($context['type'] == 'user') {
     $type = ($context['recipient']->{$context['recipient_id']} == $sender->uid) ? 'self' : 'other';
   }
@@ -30,7 +34,7 @@ function fbss_pathauto_facebook_status_s
 }
 
 /**
- * Implementation of hook_pathauto().
+ * Implements hook_pathauto().
  */
 function fbss_pathauto_pathauto($op) {
   if ($op != 'settings') {
@@ -67,7 +71,7 @@ function fbss_pathauto_pathauto($op) {
 }
 
 /**
- * Implementation of hook_pathauto_bulkupdate().
+ * Implements hook_pathauto_bulkupdate().
  * Inspired by the node implementation in pathauto_node.inc.
  */
 function fbss_pathauto_pathauto_bulkupdate() {
@@ -83,7 +87,7 @@ function fbss_pathauto_pathauto_bulkupda
   // Check for generic pattern.
   if (!trim(variable_get('pathauto_fbss_pathauto_pattern', ''))) {
     foreach ($pattern_types as $type) {
-      if (!trim(variable_get('pathauto_fbss_pathauto_'. $type .'_pattern', ''))) {
+      if (!trim(variable_get('pathauto_fbss_pathauto_' . $type . '_pattern', ''))) {
         unset($pattern_types[$type]);
       }
     }
@@ -95,12 +99,17 @@ function fbss_pathauto_pathauto_bulkupda
       LEFT JOIN {url_alias} alias
         ON CONCAT('statuses/', CAST(fbss.sid AS CHAR)) = alias.src
       WHERE alias.src IS NULL";
-    $result = db_query_range($query, 0, variable_get('pathauto_max_bulk_update', 50));
+    // TODO Please convert this statement to the D7 database API syntax.
+    $result = db_query_range("SELECT fbss.*, alias.src, alias.dst
+      FROM {facebook_status} fbss
+      LEFT JOIN {url_alias} alias
+        ON CONCAT('statuses/', CAST(fbss.sid AS CHAR)) = alias.src
+      WHERE alias.src IS NULL");
     $placeholders = array();
     while ($status = db_fetch_object($result)) {
       // pathauto.inc should already be included.
       $placeholders = pathauto_get_placeholders('facebook_status', $status);
-      $source = 'statuses/'. $status->sid;
+      $source = 'statuses/' . $status->sid;
       $type = ($status->type == 'user' ? (($status->sender == $status->recipient) ? 'self' : 'other') : $status->type);
       if (in_array($type, $pattern_types)) {
         if (pathauto_create_alias('fbss_pathauto', 'bulkupdate', $placeholders, $source, $type)) {
@@ -115,7 +124,7 @@ function fbss_pathauto_pathauto_bulkupda
 }
 
 /**
- * Implementation of hook_path_alias_types().
+ * Implements hook_path_alias_types().
  */
 function fbss_pathauto_path_alias_types() {
   return array(
diff -up -r submodules/fbss_privacy/fbss_privacy.info submodules/fbss_privacy/fbss_privacy.info
--- submodules/fbss_privacy/fbss_privacy.info	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_privacy/fbss_privacy.info	2011-07-24 17:13:30.000000000 -0400
@@ -2,4 +2,12 @@ name = Facebook-style Statuses Private S
 description = "Allows statuses between two users to be designated as private."
 dependencies[] = facebook_status
 package = Facebook-style Statuses
-core = 6.x
+core = 7.x
+
+files[] = fbss_privacy.install
+files[] = fbss_privacy.module
+files[] = fbss_privacy.views.inc
+files[] = fbss_privacy.views_default.inc
+files[] = fbss_privacy_views_handler_argument.inc
+files[] = fbss_privacy_views_handler_field.inc
+files[] = fbss_privacy_views_handler_filter.inc
diff -up -r submodules/fbss_privacy/fbss_privacy.install submodules/fbss_privacy/fbss_privacy.install
--- submodules/fbss_privacy/fbss_privacy.install	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_privacy/fbss_privacy.install	2011-07-24 17:13:29.000000000 -0400
@@ -6,11 +6,11 @@
  */
 
 /**
- * Implementation of hook_install().
+ * Implements hook_install().
  */
 function fbss_privacy_install() {
   $ret = array();
-  db_add_field($ret, 'facebook_status', 'private', array(
+  db_add_field('facebook_status', 'private', array(
     'type' => 'int',
     'size' => 'tiny',
     'unsigned' => TRUE,
@@ -21,9 +21,9 @@ function fbss_privacy_install() {
 }
 
 /**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
  */
 function fbss_privacy_uninstall() {
   $ret = array();
-  db_drop_field($ret, 'facebook_status', 'private');
+  db_drop_field('facebook_status', 'private');
 }
diff -up -r submodules/fbss_privacy/fbss_privacy.module submodules/fbss_privacy/fbss_privacy.module
--- submodules/fbss_privacy/fbss_privacy.module	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_privacy/fbss_privacy.module	2011-07-24 17:13:29.000000000 -0400
@@ -17,10 +17,19 @@
 //============
 
 /**
- * Implementation of hook_perm().
+ * Implements hook_permission().
  */
-function fbss_privacy_perm() {
-  return array('send private status messages', 'view all private status messages');
+function fbss_privacy_permission() {
+  return array(
+    'send private status messages' => array(
+      'title' => t('send private status messages'),
+      'description' => t('TODO Add a description for \'send private status messages\''),
+    ),
+    'view all private status messages' => array(
+      'title' => t('view all private status messages'),
+      'description' => t('TODO Add a description for \'view all private status messages\''),
+    ),
+  );
 }
 
 //============
@@ -28,13 +37,13 @@ function fbss_privacy_perm() {
 //============
 
 /**
- * Implementation of hook_form_FORM_ID_alter().
+ * Implements hook_form_FORM_ID_alter().
  */
 function fbss_privacy_form_facebook_status_box_alter(&$form, &$form_state) {
   if ($form['recipient']['#value'] == $GLOBALS['user']->uid || $form['type']['#value'] != 'user' || !user_access('send private status messages')) {
     return;
   }
-  drupal_add_css(drupal_get_path('module', 'fbss_privacy') .'/fbss_privacy.css');
+  drupal_add_css(drupal_get_path('module', 'fbss_privacy') . '/fbss_privacy.css');
   $form['private'] = array(
     '#type' => 'checkbox',
     '#title' => t('Private'),
@@ -51,19 +60,26 @@ function fbss_privacy_form_facebook_stat
  */
 function fbss_privacy_facebook_status_box_submit($form, $form_state) {
   if (!empty($form_state['values']['private']) && user_access('send private status messages')) {
-    db_query("UPDATE {facebook_status} SET private = %d WHERE sid = %d", $form_state['values']['private'], $form_state['facebook_status']['sid']);
+    // TODO Please review the conversion of this statement to the D7 database API syntax.
+    /* db_query("UPDATE {facebook_status} SET private = %d WHERE sid = %d", $form_state['values']['private'], $form_state['facebook_status']['sid']) */
+    db_update('facebook_status')
+  ->fields(array(
+    'private' => $form_state['values']['private'],
+  ))
+  ->condition('sid', $form_state['facebook_status']['sid'])
+  ->execute();
   }
 }
 
 /**
- * Implementation of hook_facebook_status_form_ahah_alter().
+ * Implements hook_facebook_status_form_ahah_alter().
  */
 function fbss_privacy_facebook_status_form_ahah_alter(&$new_form, $old_form) {
   $new_form['private'] = $old_form['private'];
 }
 
 /**
- * Implementation of hook_facebook_status_user_access_alter().
+ * Implements hook_facebook_status_user_access_alter().
  */
 function fbss_privacy_facebook_status_user_access_alter(&$allow, $op, $args) {
   if ($op == 'view') {
@@ -77,12 +93,12 @@ function fbss_privacy_facebook_status_us
 }
 
 /**
- * Implementation of hook_preprocess_facebook_status_item().
+ * Implements hook_preprocess_facebook_status_item().
  */
 function fbss_privacy_preprocess_facebook_status_item(&$vars) {
   $vars['private'] = (bool) $vars['status']->private;
   $vars['private_text'] = $vars['private'] ? t('(Private)') : t('Public');
-  drupal_add_css(drupal_get_path('module', 'fbss_privacy') .'/fbss_privacy.css');
+  drupal_add_css(drupal_get_path('module', 'fbss_privacy') . '/fbss_privacy.css');
 }
 
 //=============
@@ -90,7 +106,7 @@ function fbss_privacy_preprocess_faceboo
 //=============
 
 /**
- * Implementation of hook_views_api().
+ * Implements hook_views_api().
  */
 function fbss_privacy_views_api() {
   return array(
@@ -100,7 +116,7 @@ function fbss_privacy_views_api() {
 }
 
 /**
- * Implementation of hook_views_default_views_alter().
+ * Implements hook_views_default_views_alter().
  */
 function fbss_privacy_views_default_views_alter(&$views) {
   foreach ($views as $view) {
diff -up -r submodules/fbss_privacy/fbss_privacy.views.inc submodules/fbss_privacy/fbss_privacy.views.inc
--- submodules/fbss_privacy/fbss_privacy.views.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_privacy/fbss_privacy.views.inc	2011-07-24 17:13:29.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_views_query_alter().
+ * Implements hook_views_query_alter().
  */
 function fbss_privacy_views_query_alter(&$view, &$query) {
   global $user;
@@ -14,9 +14,9 @@ function fbss_privacy_views_query_alter(
   foreach ($query->table_queue as $table) {
     if ($table['table'] == 'facebook_status' && !isset($query->where['fbss_privacy']) && !user_access('view all private status messages')) {
       $query->add_where('fbss_privacy',
-        $table['alias'] .'.private = 0 OR '.
-        $table['alias'] .'.sender = %d OR ('.
-          $table['alias'] .".type = 'user' AND ". $table['alias'] .".recipient = %d)",
+        $table['alias'] . '.private = 0 OR ' .
+        $table['alias'] . '.sender = %d OR (' .
+          $table['alias'] . ".type = 'user' AND " . $table['alias'] . ".recipient = %d)",
         $user->uid, $user->uid);
       break;
     }
@@ -24,7 +24,7 @@ function fbss_privacy_views_query_alter(
 }
 
 /**
- * Implementation of hook_views_data().
+ * Implements hook_views_data().
  */
 function fbss_privacy_views_data() {
   $data = array();
@@ -52,7 +52,7 @@ function fbss_privacy_views_data() {
 }
 
 /**
- * Implementation of hook_views_handlers().
+ * Implements hook_views_handlers().
  */
 function fbss_privacy_views_handlers() {
   return array(
diff -up -r submodules/fbss_privacy/fbss_privacy.views_default.inc submodules/fbss_privacy/fbss_privacy.views_default.inc
--- submodules/fbss_privacy/fbss_privacy.views_default.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_privacy/fbss_privacy.views_default.inc	2011-07-24 17:13:29.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_views_default_views().
+ * Implements hook_views_default_views().
  */
 function fbss_privacy_views_default_views() {
   $views = array();
@@ -232,7 +232,7 @@ function fbss_privacy_views_default_view
       'label' => '',
       'alter' => array(
         'text' => '<div>[user_contextual_pic] [message]</div>
-  
+
   <div class="facebook-status-details">[created] [edit] [delete] [repost]</div>',
         'make_link' => 0,
         'path' => '',
diff -up -r submodules/fbss_privacy/fbss_privacy_views_handler_field.inc submodules/fbss_privacy/fbss_privacy_views_handler_field.inc
--- submodules/fbss_privacy/fbss_privacy_views_handler_field.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_privacy/fbss_privacy_views_handler_field.inc	2011-07-24 17:13:29.000000000 -0400
@@ -11,8 +11,8 @@
 class fbss_privacy_views_handler_field extends views_handler_field {
   function render($values) {
     if ($values->{$this->field_alias}) {
-      drupal_add_css(drupal_get_path('module', 'fbss_privacy') .'/fbss_privacy.css');
-      return '<span class="facebook-status-private-text">'. t('(Private)') .'</span>';
+      drupal_add_css(drupal_get_path('module', 'fbss_privacy') . '/fbss_privacy.css');
+      return '<span class="facebook-status-private-text">' . t('(Private)') . '</span>';
     }
   }
 }
diff -up -r submodules/fbss_privacy/fbss_privacy_views_handler_filter.inc submodules/fbss_privacy/fbss_privacy_views_handler_filter.inc
--- submodules/fbss_privacy/fbss_privacy_views_handler_filter.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_privacy/fbss_privacy_views_handler_filter.inc	2011-07-24 17:13:29.000000000 -0400
@@ -31,7 +31,7 @@ class fbss_privacy_views_handler_filter 
       $query = "{facebook_status}.private = %d";
       // If we're showing only private messages, only show the ones in which the current user participated, unless the current user has permission to see all private messages.
       if ($this->value && !user_access('view all private status messages')) {
-        $this->query->add_where('fbss_privacy', db_prefix_tables($query ." AND ($subquery)"), $this->value, $user->uid, $user->uid);
+        $this->query->add_where('fbss_privacy', db_prefix_tables($query . " AND ($subquery)"), $this->value, $user->uid, $user->uid);
       }
       else {
         $this->query->add_where('fbss_privacy', db_prefix_tables($query), $this->value);
diff -up -r submodules/fbss_rules/fbss_rules.info submodules/fbss_rules/fbss_rules.info
--- submodules/fbss_rules/fbss_rules.info	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_rules/fbss_rules.info	2011-07-24 17:13:30.000000000 -0400
@@ -3,4 +3,8 @@ description = "Integrates Rules with Fac
 package = Facebook-style Statuses
 dependencies[] = facebook_status
 dependencies[] = rules
-core = 6.x
+core = 7.x
+
+files[] = fbss_rules.module
+files[] = fbss_rules.rules.inc
+files[] = fbss_rules.rules_defaults.inc
diff -up -r submodules/fbss_rules/fbss_rules.module submodules/fbss_rules/fbss_rules.module
--- submodules/fbss_rules/fbss_rules.module	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_rules/fbss_rules.module	2011-07-24 17:13:29.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_facebook_status_delete().
+ * Implements hook_facebook_status_delete().
  */
 function fbss_rules_facebook_status_delete($status, $meta = array()) {
   if (empty($meta['has attachment'])) {
@@ -15,7 +15,7 @@ function fbss_rules_facebook_status_dele
 }
 
 /**
- * Implementation of hook_facebook_status_save().
+ * Implements hook_facebook_status_save().
  */
 function fbss_rules_facebook_status_save($status, $context, $edit, $options) {
   if (empty($options['has attachment'])) {
diff -up -r submodules/fbss_rules/fbss_rules.rules.inc submodules/fbss_rules/fbss_rules.rules.inc
--- submodules/fbss_rules/fbss_rules.rules.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_rules/fbss_rules.rules.inc	2011-07-24 17:13:29.000000000 -0400
@@ -7,7 +7,7 @@
  */
 
 /**
- * Implementation of hook_rules_event_info().
+ * Implements hook_rules_event_info().
  */
 function fbss_rules_rules_event_info() {
   return array(
@@ -15,14 +15,20 @@ function fbss_rules_rules_event_info() {
       'label' => t('User deletes a status'),
       'module' => 'Facebook-style Statuses',
       'arguments' => array(
-        'status' => array('type' => 'facebook_status', 'label' => t('The status.')),
+        'status' => array(
+          'type' => 'facebook_status',
+          'label' => t('The status.'),
+        ),
       ),
     ),
     'facebook_status_edit' => array(
       'label' => t('User edits a status'),
       'module' => 'Facebook-style Statuses',
       'arguments' => array(
-        'status' => array('type' => 'facebook_status', 'label' => t('The status.')),
+        'status' => array(
+          'type' => 'facebook_status',
+          'label' => t('The status.'),
+        ),
         //'context' => array('type' => 'value', 'label' => t('The status context.')),
       ),
     ),
@@ -30,7 +36,10 @@ function fbss_rules_rules_event_info() {
       'label' => t('User saves a status'),
       'module' => 'Facebook-style Statuses',
       'arguments' => array(
-        'status' => array('type' => 'facebook_status', 'label' => t('The status.')),
+        'status' => array(
+          'type' => 'facebook_status',
+          'label' => t('The status.'),
+        ),
         //'context' => array('type' => 'value', 'label' => t('The status context.')),
       ),
     ),
@@ -38,43 +47,61 @@ function fbss_rules_rules_event_info() {
 }
 
 /**
- * Implementation of hook_rules_condition_info().
+ * Implements hook_rules_condition_info().
  */
 function fbss_rules_rules_condition_info() {
   return array(
     'fbss_rules_is_self' => array(
       'label' => t('Status was posted to own profile'),
       'arguments' => array(
-        'status' => array('type' => 'facebook_status', 'label' => t('The status')),
+        'status' => array(
+          'type' => 'facebook_status',
+          'label' => t('The status'),
+        ),
       ),
       'module' => 'Facebook-style Statuses',
     ),
     'fbss_rules_can_post' => array(
       'label' => t('User has permission to send a status message'),
       'arguments' => array(
-        'recipient' => array('type' => 'number', 'label' => t('The ID of the object to which the status will be posted.')),
-        'sender' => array('type' => 'user', 'label' => t('Sender')),
+        'recipient' => array(
+          'type' => 'number',
+          'label' => t('The ID of the object to which the status will be posted.'),
+        ),
+        'sender' => array(
+          'type' => 'user',
+          'label' => t('Sender'),
+        ),
       ),
       'module' => 'Facebook-style Statuses',
     ),
     'fbss_rules_rules_condition_can_edit' => array(
       'label' => t('User has permission to edit a status'),
       'arguments' => array(
-        'status' => array('type' => 'facebook_status', 'label' => t('The status')),
+        'status' => array(
+          'type' => 'facebook_status',
+          'label' => t('The status'),
+        ),
       ),
       'module' => 'Facebook-style Statuses',
     ),
     'fbss_rules_rules_condition_can_delete' => array(
       'label' => t('User has permission to delete a status'),
       'arguments' => array(
-        'status' => array('type' => 'facebook_status', 'label' => t('The status')),
+        'status' => array(
+          'type' => 'facebook_status',
+          'label' => t('The status'),
+        ),
       ),
       'module' => 'Facebook-style Statuses',
     ),
     'fbss_rules_rules_condition_is_type' => array(
       'label' => t('Status recipient is a certain type'),
       'arguments' => array(
-        'status' => array('type' => 'facebook_status', 'label' => t('The status')),
+        'status' => array(
+          'type' => 'facebook_status',
+          'label' => t('The status'),
+        ),
       ),
       'module' => 'Facebook-style Statuses',
     ),
@@ -162,14 +189,17 @@ function fbss_rules_rules_condition_can_
 }
 
 /**
- * Implementation of hook_rules_action_info().
+ * Implements hook_rules_action_info().
  */
 function fbss_rules_rules_action_info() {
   return array(
     'fbss_rules_load_action' => array(
       'label' => t('Load a status'),
       'new variables' => array(
-        'status_loaded' => array('type' => 'facebook_status', 'label' => t('Loaded status')),
+        'status_loaded' => array(
+          'type' => 'facebook_status',
+          'label' => t('Loaded status'),
+        ),
       ),
       'help' => t('Enter the Status ID of a status to load.'),
       'module' => 'Facebook-style Statuses',
@@ -220,7 +250,10 @@ function fbss_rules_load_action($setting
  * Builds the form for editing a status.
  */
 function fbss_rules_edit_action_form($settings, &$form) {
-  $settings += array('sid' => '', 'message' => '');
+  $settings += array(
+    'sid' => '',
+    'message' => '',
+  );
   $form['settings']['sid'] = array(
     '#type' => 'textfield',
     '#title' => t('Status ID'),
@@ -266,7 +299,12 @@ function fbss_rules_delete_action($setti
  * Builds the form for adding a status.
  */
 function fbss_rules_add_action_form($settings, &$form) {
-  $settings += array('sender' => '', 'recipient' => '', 'type' => '', 'message' => '');
+  $settings += array(
+    'sender' => '',
+    'recipient' => '',
+    'type' => '',
+    'message' => '',
+  );
   $form['settings']['sender'] = array(
     '#type' => 'textfield',
     '#title' => t('Sender username'),
@@ -314,7 +352,7 @@ function fbss_rules_add_action($settings
 }
 
 /**
- * Implementation of hook_rules_data_type_info().
+ * Implements hook_rules_data_type_info().
  */
 function fbss_rules_rules_data_type_info() {
   return array(
diff -up -r submodules/fbss_rules/fbss_rules.rules_defaults.inc submodules/fbss_rules/fbss_rules.rules_defaults.inc
--- submodules/fbss_rules/fbss_rules.rules_defaults.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_rules/fbss_rules.rules_defaults.inc	2011-07-24 17:13:29.000000000 -0400
@@ -10,57 +10,44 @@
  */
 function facebook_status_rules_defaults() {
   $config = array(
-    'rules' =>
-    array(
-      'facebook_status_rules_update' =>
-      array(
+    'rules' => array(
+      'facebook_status_rules_update' => array(
         '#type' => 'rule',
         '#set' => 'event_facebook_status_save',
         '#label' => 'Submit Facebook-style Status',
         '#active' => 0,
         '#weight' => '0',
-        '#categories' =>
-        array(
+        '#categories' => array(
           0 => 'facebook_status',
         ),
         '#status' => 'default',
-        '#conditions' =>
-        array(
+        '#conditions' => array(
         ),
-        '#actions' =>
-        array(
-          0 =>
-          array(
+        '#actions' => array(
+          0 => array(
             '#type' => 'action',
-            '#settings' =>
-            array(
+            '#settings' => array(
               'severity' => '6',
               'type' => 'rules',
               'message' => '<?php echo check_plain($account->name); ?> submitted the status <?php echo $new_status; ?>.',
               'link' => '/user/<?php echo $account->uid; ?>',
-              '#eval input' =>
-              array(
-                'rules_input_evaluator_php' =>
-                array(
-                  'message' =>
-                  array(
+              '#eval input' => array(
+                'rules_input_evaluator_php' => array(
+                  'message' => array(
                     0 => 'account',
                     1 => 'new_status',
                   ),
-                  'link' =>
-                  array(
+                  'link' => array(
                     0 => 'account',
                   ),
                 ),
               ),
             ),
             '#name' => 'rules_action_watchdog',
-            '#info' =>
-            array(
+            '#info' => array(
               'label' => 'Log to watchdog',
               'module' => 'System',
-              'eval input' =>
-              array(
+              'eval input' => array(
                 0 => 'type',
                 1 => 'message',
                 2 => 'link',
@@ -70,38 +57,30 @@ function facebook_status_rules_defaults(
           ),
         ),
       ),
-      'facebook_status_rules_delete' =>
-      array(
+      'facebook_status_rules_delete' => array(
         '#type' => 'rule',
         '#set' => 'event_facebook_status_delete',
         '#label' => 'Delete Facebook-style Status',
         '#active' => 0,
         '#weight' => '0',
-        '#categories' =>
-        array(
+        '#categories' => array(
           0 => 'facebook_status',
         ),
         '#status' => 'default',
-        '#conditions' =>
-        array(
+        '#conditions' => array(
         ),
-        '#actions' =>
-        array(
-          0 =>
-          array(
+        '#actions' => array(
+          0 => array(
             '#type' => 'action',
-            '#settings' =>
-            array(
+            '#settings' => array(
               'message' => 'Status deleted.',
               'error' => 0,
             ),
             '#name' => 'rules_action_drupal_message',
-            '#info' =>
-            array(
+            '#info' => array(
               'label' => 'Show a configurable message on the site',
               'module' => 'System',
-              'eval input' =>
-              array(
+              'eval input' => array(
                 0 => 'message',
               ),
             ),
diff -up -r submodules/fbss_services/fbss_services.extended.inc submodules/fbss_services/fbss_services.extended.inc
--- submodules/fbss_services/fbss_services.extended.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_services/fbss_services.extended.inc	2011-07-24 17:13:29.000000000 -0400
@@ -11,13 +11,21 @@
 
 // ALL
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_all_access() {
   return user_access('view all statuses');
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_all($trim_user, $include_entities) {
   $statuses = array();
-  $result = db_query_range("SELECT * FROM {facebook_status} WHERE private = 0 ORDER BY sid DESC", 0, 20);
+  $result = db_query_range("SELECT * FROM {facebook_status} WHERE private = :private ORDER BY sid DESC", array(':private' => 0));
   while ($status = db_fetch_object($result)) {
     $statuses[] = fbss_services_get_rich_data($status, $include_entities, $trim_user);
   }
@@ -28,10 +36,18 @@ function fbss_services_all($trim_user, $
 
 // HOME_TIMELINE
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_home_timeline_access() {
   return user_access('update and view own stream');
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_home_timeline($since_id, $max_id, $count, $page, $include_entities) {
   global $user;
   $args = array($user->uid);
@@ -79,6 +95,7 @@ function fbss_services_home_timeline($si
     $args[] = $max_id;
   }
   $statuses = array();
+  // TODO Please convert this statement to the D7 database API syntax.
   $result = db_query_range("
     SELECT * FROM {facebook_status}
     WHERE $private ( /* message is not private OR involves you OR you have permission to see all private messages */
@@ -88,7 +105,7 @@ function fbss_services_home_timeline($si
       $tags /* messages mentioning you. TODO: only add if FBSST is installed. */
     ) AND sid > %d $max AND message <> ''
     ORDER BY sid DESC
-  ", $args, ($page-1)*$count, $count);
+  ", $args);
   while ($status = db_fetch_object($result)) {
     $statuses[] = fbss_services_get_rich_data($status, $include_entities);
   }
@@ -97,10 +114,18 @@ function fbss_services_home_timeline($si
 
 // MENTIONS
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_mentions_access() {
   return module_exists('facebook_status_tags') && user_access('view all statuses');
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_mentions($since_id, $max_id, $count, $page, $trim_user, $include_entities) {
   global $user;
   $args = array($user->uid, $since_id);
@@ -121,6 +146,7 @@ function fbss_services_mentions($since_i
     $args[] = $user->uid;
   }
   $statuses = array();
+  // TODO Please convert this statement to the D7 database API syntax.
   $result = db_query_range("
     SELECT f.* FROM {facebook_status_tags} t
     LEFT JOIN {facebook_status} f ON t.sid = f.sid
@@ -132,7 +158,7 @@ function fbss_services_mentions($since_i
       $private /* message is not private OR involves you OR you have permission to see all private messages */
       $og /* messages to your groups or public groups you don't belong to */
     ORDER BY f.sid DESC
-  ", $args, ($page-1)*$count, $count);
+  ", $args);
   while ($status = db_fetch_object($result)) {
     $statuses[] = fbss_services_get_rich_data($status, $include_entities, $trim_user);
   }
@@ -141,6 +167,10 @@ function fbss_services_mentions($since_i
 
 // USER_TIMELINE
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_user_timeline_access($args) {
   list($user_id, $screen_name) = $args;
   global $user;
@@ -150,11 +180,11 @@ function fbss_services_user_timeline_acc
   }
   // Probably only one parameter was set.
   if ($user->uid == $user_id) {
-    $account = user_load(array('name' => $screen_name));
+    $account = array_shift(user_load_multiple(array(), array('name' => $screen_name)));
     return !empty($account->uid) && facebook_status_user_access('view_stream', $account, 'user');
   }
   elseif ($user->name == $screen_name) {
-    $account = user_load(array('id' => $user_id));
+    $account = array_shift(user_load_multiple(array(), array('id' => $user_id)));
     return !empty($account->uid) && facebook_status_user_access('view_stream', $account, 'user');
   }
 
@@ -163,7 +193,7 @@ function fbss_services_user_timeline_acc
   if (!empty($id_account->uid)) {
     return facebook_status_user_access('view_stream', $id_account, 'user');
   }
-  $account = user_load(array('name' => $screen_name));
+  $account = array_shift(user_load_multiple(array(), array('name' => $screen_name)));
   if (!empty($account->uid)) {
     return facebook_status_user_access('view_stream', $account, 'user');
   }
@@ -171,10 +201,14 @@ function fbss_services_user_timeline_acc
   return FALSE;
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_user_timeline($user_id, $screen_name, $since_id, $max_id, $count, $page, $trim_user, $include_entities) {
   $account = _facebook_status_user_load($user_id);
   if ($account->name != $screen_name && $account->uid == $GLOBALS['user']->uid) {
-    $account = user_load(array('name' => $screen_name));
+    $account = array_shift(user_load_multiple(array(), array('name' => $screen_name)));
   }
   $args = array($account->uid, $since_id);
   $max = '';
@@ -182,6 +216,7 @@ function fbss_services_user_timeline($us
     $max = "AND sid <= %d";
     $args[] = $max_id;
   }
+  // TODO Please convert this statement to the D7 database API syntax.
   $result = db_query_range("
     SELECT *
     FROM {facebook_status}
@@ -192,7 +227,7 @@ function fbss_services_user_timeline($us
       AND sid > %d
       $max
     ORDER BY sid DESC
-  ", $args, ($page-1)*$count, $count);
+  ", $args);
   $statuses = array();
   while ($status = db_fetch_object($result)) {
     $statuses[] = fbss_services_get_rich_data($status, $include_entities, $trim_user);
@@ -204,6 +239,10 @@ function fbss_services_user_timeline($us
 // HELPER FUNCTIONS
 //==================
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_get_rich_data($status, $include_entities = TRUE, $trim_user = FALSE) {
   $object = array(
     'created_at' => fbss_services_get_date($status->created),
@@ -247,7 +286,7 @@ function fbss_services_get_rich_data($st
       'created_at' => fbss_services_get_date($account->created),
       'favourites_count' => fbss_services_count_user_flags($account->uid, 'like'),
       'utc_offset' => isset($account->timezone) ? $account->timezone : variable_get('date_default_timezone', 0),
-      'time_zone' => date('e', strtotime('Mon, Jun 13 2010 13:08:00 '. isset($account->timezone) ? $account->timezone : variable_get('date_default_timezone', 0))),
+      'time_zone' => date('e', strtotime('Mon, Jun 13 2010 13:08:00 ' . isset($account->timezone) ? $account->timezone : variable_get('date_default_timezone', 0))),
       'profile_background_image_url' => NULL, // We don't support tracking this.
       'profile_background_tile' => NULL, // We don't support tracking this.
       'profile_use_background_image' => 'false',
@@ -264,10 +303,14 @@ function fbss_services_get_rich_data($st
   return $object;
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_get_date($timestamp) {
-  $request_format = drupal_substr($_GET['q'], strrpos($_GET['q'], '.')+1);
+  $request_format = drupal_substr($_GET['q'], strrpos($_GET['q'], '.') + 1);
   $date_format = variable_get('date_format_medium', 'D, m/d/Y - H:i');
-  switch($request_format) {
+  switch ($request_format) {
     case 'xml':
     case 'json':
       $date_format = 'D M j H:i:s O Y'; // Thu Jul 15 23:26:04 +0000 2010
@@ -277,6 +320,10 @@ function fbss_services_get_date($timesta
   return date($date_format, $timestamp);
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_get_flagged($id, $flag_name) {
   if (module_exists('flag')) {
     if ($flag = flag_get_flag($flag_name)) {
@@ -286,6 +333,10 @@ function fbss_services_get_flagged($id, 
   return 'false';
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_find_attrs($account, $attrs = array()) {
   foreach ($attrs as $attr) {
     if ($value = fbss_services_find_attr($account, $attr)) {
@@ -294,6 +345,10 @@ function fbss_services_find_attrs($accou
   }
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_find_attr($account, $attr) {
   static $loaded = array();
   if (module_exists('profile')) {
@@ -302,7 +357,7 @@ function fbss_services_find_attr($accoun
       $loaded[$account->uid] = TRUE;
     }
     foreach ($account as $name => $property) {
-      if (strpos($name, 'profile_'. $attr) === 0) {
+      if (strpos($name, 'profile_' . $attr) === 0) {
         if (is_string($property)) {
           return check_plain($property);
         }
@@ -315,6 +370,10 @@ function fbss_services_find_attr($accoun
   return NULL;
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_get_image_url($account) {
   if (variable_get('user_pictures', 0)) {
     if (!empty($account->picture) && file_exists($account->picture)) {
@@ -327,6 +386,10 @@ function fbss_services_get_image_url($ac
   return NULL;
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_count_flags($id, $flag_name) {
   if (module_exists('flag')) {
     if ($flag = flag_get_flag($flag_name)) {
@@ -336,6 +399,10 @@ function fbss_services_count_flags($id, 
   return 0;
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_get_friends_count($uid) {
   if (module_exists('flag_friend')) {
     return fbss_services_count_flags($account->uid, 'friend');
@@ -346,6 +413,10 @@ function fbss_services_get_friends_count
   return 0;
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_count_user_flags($uid, $flag_name) {
   if (module_exists('flag') && $flag = flag_get_flag($flag_name)) {
     return $flag->get_user_count($uid);
diff -up -r submodules/fbss_services/fbss_services.inc submodules/fbss_services/fbss_services.inc
--- submodules/fbss_services/fbss_services.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_services/fbss_services.inc	2011-07-24 17:13:29.000000000 -0400
@@ -18,7 +18,7 @@
  * @return
  *   TRUE if access to the given action is permitted; FALSE otherwise.
  */
-function fbss_services_access($action) {
+function fbss_services_node_access($action) {
   $args = func_get_args();
   $args = $args[1];
   if ($action == 'create') {
@@ -55,7 +55,7 @@ function fbss_services_access($action) {
     }
     $status = facebook_status_load($args[0]);
     if (empty($status)) {
-      return services_error('Status sid '. $sid .' not found', 404);
+      return services_error('Status sid ' . $sid . ' not found', 404);
     }
     return facebook_status_user_access($action, $status);
   }
@@ -77,7 +77,7 @@ function fbss_services_access($action) {
 function fbss_services_create($recipient_id, $type, $message) {
   $maxlen = variable_get('facebook_status_length', 140);
   if (drupal_strlen($message) > $maxlen && $maxlen != 0) {
-    return services_error('The status must be no longer than '. $maxlen .' characters', 406);
+    return services_error('The status must be no longer than ' . $maxlen . ' characters', 406);
   }
   $context = facebook_status_determine_context($type);
   if (empty($context)) {
@@ -108,7 +108,7 @@ function fbss_services_retrieve($sid) {
     $status->uri = services_resource_uri(array('status', $status->sid));
     return $status;
   }
-  return services_error('Status sid '. $sid .' not found', 404);
+  return services_error('Status sid ' . $sid . ' not found', 404);
 }
 
 /**
@@ -125,11 +125,11 @@ function fbss_services_retrieve($sid) {
 function fbss_services_update($sid, $message) {
   $maxlen = variable_get('facebook_status_length', 140);
   if (drupal_strlen($message) > $maxlen && $maxlen != 0) {
-    return services_error('The status must be no longer than '. $maxlen .' characters', 406);
+    return services_error('The status must be no longer than ' . $maxlen . ' characters', 406);
   }
   $status = facebook_status_load($sid);
   if (empty($status)) {
-    return services_error('Status sid '. $sid .' not found', 404);
+    return services_error('Status sid ' . $sid . ' not found', 404);
   }
   $status = facebook_status_edit_status($status, $message);
   if ($uri = services_resource_uri(array('status', $sid))) {
@@ -192,7 +192,7 @@ function fbss_services_index($page, $par
     $args[] = $parameters['sender'];
   }
   $query .= " ORDER BY created DESC, sid DESC";
-  $result = db_query_range($query, $args, $page * 20, 20);
+  $result = db_query_range($query, $args);
   while ($status = db_fetch_object($result)) {
     if ($uri = services_resource_uri(array('status', $status->sid))) {
       $status->uri = $uri;
diff -up -r submodules/fbss_services/fbss_services.info submodules/fbss_services/fbss_services.info
--- submodules/fbss_services/fbss_services.info	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_services/fbss_services.info	2011-07-24 17:13:30.000000000 -0400
@@ -3,4 +3,9 @@ description = Integrates Services with F
 package = Facebook-style Statuses
 dependencies[] = facebook_status
 dependencies[] = services
-core = 6.x
+core = 7.x
+
+files[] = fbss_services.extended.inc
+files[] = fbss_services.inc
+files[] = fbss_services.module
+files[] = fbss_services.resources.inc
diff -up -r submodules/fbss_services/fbss_services.module submodules/fbss_services/fbss_services.module
--- submodules/fbss_services/fbss_services.module	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_services/fbss_services.module	2011-07-24 17:13:30.000000000 -0400
@@ -6,13 +6,16 @@
  */
 
 /**
- * Implementation of hook_services_resources().
+ * Implements hook_services_resources().
  */
 function fbss_services_services_resources() {
   module_load_include('inc', 'fbss_services', 'fbss_services.resources');
   $resources = array(
     'status' => array(
-      'file' => array('type' => 'inc', 'module' => 'fbss_services'),
+      'file' => array(
+        'type' => 'inc',
+        'module' => 'fbss_services',
+      ),
     ),
   );
   $resources['status'] += fbss_services_operations_resources();
@@ -43,7 +46,7 @@ function _fbss_services_access($action) 
 //===========================
 
 /**
- * Implementation of hook_services_resources_post_processing_alter().
+ * Implements hook_services_resources_post_processing_alter().
  *
  * Force Services to choose the right action instead of delegating to the
  * default operations based on the request method.
@@ -97,6 +100,10 @@ function fbss_services_get_resource_para
 }
 
 // @see rest_server_server()
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_get_canonical_path() {
   $endpoint_path = services_get_server_info('endpoint_path', 'services/rest');
   $canonical_path = trim(substr($_GET['q'], drupal_strlen($endpoint_path)), '/');
@@ -109,6 +116,10 @@ function fbss_services_get_canonical_pat
 }
 
 // @see RESTServer->handle()
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function fbss_services_get_method() {
   $method = $_SERVER['REQUEST_METHOD'];
   if ($method == 'POST' && isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) {
diff -up -r submodules/fbss_services/fbss_services.resources.inc submodules/fbss_services/fbss_services.resources.inc
--- submodules/fbss_services/fbss_services.resources.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_services/fbss_services.resources.inc	2011-07-24 17:13:30.000000000 -0400
@@ -157,7 +157,7 @@ function fbss_services_actions_resources
         ),
       ),
     ),
-  // TODO
+    // TODO
     'home_timeline' => array(
       'help' => 'Returns the most recent non-private statuses relevant to the authenticated user. This is supposed to be the "main" timeline.',
       'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'fbss_services.twitter'),
@@ -216,7 +216,7 @@ function fbss_services_actions_resources
       'access callback' => 'fbss_services_extended_access',
       'access arguments' => array('fbss_services_mentions_access'),
       'access arguments append' => TRUE,
-      'args' => array( // No include_rts parameter because FBSS doesn't support that kind of retweeting.
+      'args' => array(// No include_rts parameter because FBSS doesn't support that kind of retweeting.
         array(
           'name' => 'since_id',
           'type' => 'int',
@@ -275,7 +275,7 @@ function fbss_services_actions_resources
       'access callback' => 'fbss_services_extended_access',
       'access arguments' => array('fbss_services_user_timeline_access'),
       'access arguments append' => TRUE,
-      'args' => array( // No include_rts parameter because FBSS doesn't support that kind of retweeting.
+      'args' => array(// No include_rts parameter because FBSS doesn't support that kind of retweeting.
         array(
           'name' => 'user_id',
           'type' => 'int',
diff -up -r submodules/fbss_twitter/fbss_twitter.admin.inc submodules/fbss_twitter/fbss_twitter.admin.inc
--- submodules/fbss_twitter/fbss_twitter.admin.inc	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_twitter/fbss_twitter.admin.inc	2011-07-24 17:13:30.000000000 -0400
@@ -8,7 +8,7 @@
 /**
  * The administrative settings form.
  */
-function fbss_twitter_admin() {
+function fbss_twitter_admin($form, &$form_state) {
   $form = array();
   $form['fbss_twitter_default'] = array(
     '#type' => 'radios',
@@ -27,9 +27,9 @@ function fbss_twitter_admin() {
   $form['fbss_twitter_select_account'] = array(
     '#type' => 'checkbox',
     '#title' => t('Automatically set the first Twitter account added for use with status updates.'),
-    '#description' => t('With this setting disabled, users must explicitly select a Twitter account to which to post status updates after connecting their Twitter account to their Drupal account.') .' '.
-      t('With this setting enabled, the first Twitter account users connect to their Drupal account will be automatically chosen as the one to which status updates can be posted.') .' '.
-      t('Users can always change which Twitter account they want to use (including setting it back to "none").') .' '.
+    '#description' => t('With this setting disabled, users must explicitly select a Twitter account to which to post status updates after connecting their Twitter account to their Drupal account.') . ' ' .
+      t('With this setting enabled, the first Twitter account users connect to their Drupal account will be automatically chosen as the one to which status updates can be posted.') . ' ' .
+      t('Users can always change which Twitter account they want to use (including setting it back to "none").') . ' ' .
       t('Changing this setting will not affect users who have already connected at least one Twitter account to their Drupal account.'),
     '#default_value' => variable_get('fbss_twitter_select_account', 0),
     '#weight' => -30,
@@ -43,14 +43,14 @@ function fbss_twitter_admin() {
 function fbss_twitter_admin_validate(&$form, &$form_state) {
   $len = $form_state['values']['facebook_status_length'];
   if (($len > 140 || $len == 0) && variable_get('fbss_twitter_default', 'off') != 'disallow') {
-    $message = t('These settings could allow users to attempt to post messages to Twitter which are too long for Twitter to handle.') .' '.
-      t('In this situation, Facebook-style Statuses will attempt to truncate the tweet and include a link to view the full message on your site.') .' '.
+    $message = t('These settings could allow users to attempt to post messages to Twitter which are too long for Twitter to handle.') . ' ' .
+      t('In this situation, Facebook-style Statuses will attempt to truncate the tweet and include a link to view the full message on your site.') . ' ' .
       t('Occasionally it is not possible to get a link to the status message, in which case the tweet will simply be shortened to 140 characters by Twitter.');
     if ($len > 140) {
-      $message = t('The maximum number of characters allowed in a status is set to a number above 140, and users can post status updates to Twitter.') .' '. $message;
+      $message = t('The maximum number of characters allowed in a status is set to a number above 140, and users can post status updates to Twitter.') . ' ' . $message;
     }
     else {
-      $message = t('The maximum number of characters allowed in a status is set to 0 (unlimited), and users can post status updates to Twitter.') .' '. $message;
+      $message = t('The maximum number of characters allowed in a status is set to 0 (unlimited), and users can post status updates to Twitter.') . ' ' . $message;
     }
     drupal_set_message($message, 'warning');
   }
diff -up -r submodules/fbss_twitter/fbss_twitter.info submodules/fbss_twitter/fbss_twitter.info
--- submodules/fbss_twitter/fbss_twitter.info	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_twitter/fbss_twitter.info	2011-07-24 17:13:30.000000000 -0400
@@ -4,4 +4,8 @@ package = Facebook-style Statuses
 dependencies[] = facebook_status
 dependencies[] = twitter
 dependencies[] = oauth
-core = 6.x
+core = 7.x
+
+files[] = fbss_twitter.admin.inc
+files[] = fbss_twitter.install
+files[] = fbss_twitter.module
diff -up -r submodules/fbss_twitter/fbss_twitter.install submodules/fbss_twitter/fbss_twitter.install
--- submodules/fbss_twitter/fbss_twitter.install	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_twitter/fbss_twitter.install	2011-07-24 17:13:30.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
  */
 function fbss_twitter_uninstall() {
   variable_del('fbss_twitter_select_account');
diff -up -r submodules/fbss_twitter/fbss_twitter.module submodules/fbss_twitter/fbss_twitter.module
--- submodules/fbss_twitter/fbss_twitter.module	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_twitter/fbss_twitter.module	2011-07-24 17:13:30.000000000 -0400
@@ -6,11 +6,11 @@
  */
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function fbss_twitter_menu() {
   $items = array();
-  $items['admin/settings/facebook_status/twitter'] = array(
+  $items['admin/config/facebook_status/twitter'] = array(
     'title' => 'Twitter',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('fbss_twitter_admin'),
@@ -23,7 +23,7 @@ function fbss_twitter_menu() {
 }
 
 /**
- * Implementation of hook_form_FORM_ID_alter().
+ * Implements hook_form_FORM_ID_alter().
  */
 function fbss_twitter_form_facebook_status_box_alter(&$form, &$form_state) {
   $recipient = $form['recipient']['#value'];
@@ -31,7 +31,7 @@ function fbss_twitter_form_facebook_stat
   if ($recipient != $GLOBALS['user']->uid || $type != 'user') {
     return;
   }
-  drupal_add_css(drupal_get_path('module', 'fbss_twitter') .'/fbss_twitter.css');
+  drupal_add_css(drupal_get_path('module', 'fbss_twitter') . '/fbss_twitter.css');
   $context = facebook_status_determine_context($type);
   $recipient = $context['handler']->load_recipient($recipient);
   $data = $recipient->data;
@@ -68,7 +68,7 @@ function fbss_twitter_facebook_status_bo
 }
 
 /**
- * Implementation of hook_form_FORM_ID_alter().
+ * Implements hook_form_FORM_ID_alter().
  * No need to check permissions since the form is already restricted.
  */
 function fbss_twitter_form_twitter_account_list_form_alter(&$form, &$form_state) {
@@ -76,7 +76,7 @@ function fbss_twitter_form_twitter_accou
   if (!user_access('update and view own stream', $account)) {
     return;
   }
-  $result = db_query("SELECT screen_name FROM {twitter_account} WHERE uid = %d", arg(1));
+  $result = db_query("SELECT screen_name FROM {twitter_account} WHERE uid = :uid", array(':uid' => arg(1)));
   $options = array(0 => t('None'));
   while ($option = db_fetch_array($result)) {
     $options[$option['screen_name']] = $option['screen_name'];
@@ -122,7 +122,7 @@ function fbss_twitter_twitter_submit($fo
     $twitter_account = $form_state['values']['fbss_twitter_account'];
     // If we just added the first Twitter account, set it as the one to use with FBSS.
     if ($twitter_account == 0 && $form_state['#options_count'] === 1 && variable_get('fbss_twitter_select_account', 0)) {
-      $result = db_query("SELECT screen_name FROM {twitter_account} WHERE uid = %d", arg(1));
+      $result = db_query("SELECT screen_name FROM {twitter_account} WHERE uid = :uid", array(':uid' => arg(1)));
       $options = array();
       while ($option = db_fetch_array($result)) {
         $options[$option['screen_name']] = $option['screen_name'];
@@ -171,16 +171,16 @@ function fbss_twitter_post_to_twitter($a
   // Try to fit the message into a tweet.
   $message_length = drupal_strlen($message);
   if ((!empty($options['sid']) && $message_length > 140) || $options['add URL']) {
-    $url = url('statuses/'. $options['sid'], array('absolute' => TRUE));
+    $url = url('statuses/' . $options['sid'], array('absolute' => TRUE));
     if (module_exists('shorten')) {
       $url = shorten_url($url);
     }
     $url_length = drupal_strlen($url);
     if ($message_length + $url_length > 140) {
-      $message = drupal_substr($message, 0, 138 - $url_length) ."\xE2\x80\xA6 ". $url;
+      $message = drupal_substr($message, 0, 138 - $url_length) . "\xE2\x80\xA6 " . $url;
     }
     else {
-      $message .= ' '. $url;
+      $message .= ' ' . $url;
     }
   }
   module_load_include('inc', 'twitter');
@@ -217,7 +217,7 @@ function _fbss_twitter_get_default($acco
 }
 
 /**
- * Implementation of hook_facebook_status_form_ahah_alter().
+ * Implements hook_facebook_status_form_ahah_alter().
  */
 function fbss_twitter_facebook_status_form_ahah_alter(&$new_form, $form) {
   $new_form['twitter'] = $form['twitter'];
diff -up -r submodules/fbss_userpoints/fbss_userpoints.info submodules/fbss_userpoints/fbss_userpoints.info
--- submodules/fbss_userpoints/fbss_userpoints.info	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_userpoints/fbss_userpoints.info	2011-07-24 17:13:30.000000000 -0400
@@ -3,4 +3,7 @@ description = "Integrates Userpoints wit
 package = Facebook-style Statuses
 dependencies[] = facebook_status
 dependencies[] = userpoints
-core = 6.x
+core = 7.x
+
+files[] = fbss_userpoints.install
+files[] = fbss_userpoints.module
diff -up -r submodules/fbss_userpoints/fbss_userpoints.install submodules/fbss_userpoints/fbss_userpoints.install
--- submodules/fbss_userpoints/fbss_userpoints.install	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_userpoints/fbss_userpoints.install	2011-07-24 17:13:30.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
  */
 function fbss_userpoints_uninstall() {
   variable_del('facebook_status_userpoints_other');
diff -up -r submodules/fbss_userpoints/fbss_userpoints.module submodules/fbss_userpoints/fbss_userpoints.module
--- submodules/fbss_userpoints/fbss_userpoints.module	2011-07-24 17:13:08.000000000 -0400
+++ submodules/fbss_userpoints/fbss_userpoints.module	2011-07-24 17:13:30.000000000 -0400
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_userpoints().
+ * Implements hook_userpoints().
  */
 function fbss_userpoints_userpoints($op, $params = array()) {
   if ($op == 'setting') {
@@ -29,7 +29,7 @@ function fbss_userpoints_userpoints($op,
     $form['facebook_status']['facebook_status_userpoints_max'] = array(
       '#type' => 'textfield',
       '#title' => t('Maximum number of Userpoints from posting statuses per day'),
-      '#description' => t('Set to zero for no limit.') .' '.
+      '#description' => t('Set to zero for no limit.') . ' ' .
         t('Note that the actual number of points awarded per day could be higher than this if this value is not a multiple of the points given above.'),
       '#default_value' => variable_get('facebook_status_userpoints_max', 0),
     );
@@ -50,7 +50,7 @@ function fbss_userpoints_userpoints($op,
       $form['fbss_comments']['fbss_comments_userpoints_max'] = array(
         '#type' => 'textfield',
         '#title' => t('Maximum number of Userpoints from posting status comments per day'),
-        '#description' => t('Set to zero for no limit.') .' '.
+        '#description' => t('Set to zero for no limit.') . ' ' .
           t('Note that the actual number of points awarded per day could be higher than this if this value is not a multiple of the points given above.'),
         '#default_value' => variable_get('fbss_comments_userpoints_max', 0),
       );
@@ -90,7 +90,7 @@ function _fbss_comments_userpoints_valid
 }
 
 /**
- * Implementation of hook_facebook_status_save().
+ * Implements hook_facebook_status_save().
  */
 function fbss_userpoints_facebook_status_save($status, $context, $edit, $options) {
   // If the FBSMP module is enabled and there is an attachment on this status,
@@ -104,11 +104,10 @@ function fbss_userpoints_facebook_status
   }
   $sender = _facebook_status_user_load($status->sender);
   $recipient = $context['handler']->load_recipient($status->recipient);
-  $points_today = db_result(db_query("SELECT SUM(points) FROM {userpoints_txn}
-    WHERE uid = %d AND time_stamp > %d
-      AND (operation = 'facebook_status add own' OR operation = 'facebook_status add other')
-      AND expired = 0 AND status = 0",
-    $sender->uid, time() - 86400));
+  $points_today = db_query("SELECT SUM(points) FROM {userpoints_txn}
+    WHERE uid = :uid AND time_stamp > :time_stamp
+      AND (operation = :(operation OR operation = :operation)
+      AND expired = :expired AND status = :status", array(':uid' => $sender->uid, ':time_stamp' => REQUEST_TIME - 86400, ':(operation' => 'facebook_status add own', ':operation' => 'facebook_status add other', ':expired' => 0, ':status' => 0))->fetchField();
   if (variable_get('facebook_status_userpoints_max', 0) && $points_today >= variable_get('facebook_status_userpoints_max', 0)) {
     return;
   }
@@ -120,19 +119,19 @@ function fbss_userpoints_facebook_status
     //'entity_type' => 'facebook_status',
   );
   if ($status->sender == $status->recipient && $status->type == 'user') {
-    $params['description'] = t('!user posted a new status.', array('!user' => theme('username', $sender)));
+    $params['description'] = t('!user posted a new status.', array('!user' => theme('username', array('account' => $sender))));
     $params['points'] = variable_get('facebook_status_userpoints_own', 0);
     $params['operation'] = 'facebook_status add own';
   }
   elseif ($status->type == 'user') {
     $params['description'] = t('!sender wrote a message to !recipient',
-      array('!sender' => theme('username', $sender), '!recipient' => $context['handler']->recipient_link($recipient)));
+      array('!sender' => theme('username', array('account' => $sender)), '!recipient' => $context['handler']->recipient_link($recipient)));
     $params['points'] = variable_get('facebook_status_userpoints_other', 0);
     $params['operation'] = 'facebook_status add other';
   }
   else {
     $params['description'] = t('!sender wrote a message at !recipient',
-      array('!sender' => theme('username', $sender), '!recipient' => $context['handler']->recipient_link($recipient)));
+      array('!sender' => theme('username', array('account' => $sender)), '!recipient' => $context['handler']->recipient_link($recipient)));
     $params['points'] = variable_get('facebook_status_userpoints_other', 0);
     $params['operation'] = 'facebook_status add other';
   }
@@ -140,7 +139,7 @@ function fbss_userpoints_facebook_status
 }
 
 /**
- * Implementation of hook_facebook_status_delete().
+ * Implements hook_facebook_status_delete().
  */
 function fbss_userpoints_facebook_status_delete($status, $meta = array()) {
   // If the FBSMP module is enabled and there is an attachment on this status,
@@ -150,28 +149,24 @@ function fbss_userpoints_facebook_status
   }
   $sender = _facebook_status_user_load($status->sender);
   global $user;
-  $result = db_fetch_object(db_query(
-    "SELECT points FROM {userpoints_txn} WHERE operation LIKE 'facebook_status add%%' AND reference = %d AND uid = %d",
-    $status->sid,
-    $sender->uid
-  ));
+  $result = db_fetch_object(db_query("SELECT points FROM {userpoints_txn} WHERE operation LIKE 'facebook_status add%%' AND reference = :reference AND uid = :uid", array(':reference' => $status->sid, ':uid' => $sender->uid)));
   $params = array(
     'uid' => $sender->uid,
     'points' => 0 - $result->points,
     'operation' => 'facebook_status delete',
   );
   if ($user->uid == $sender->uid) {
-    $params['description'] = t('!user deleted a status message.', array('!user' => theme('username', $user)));
+    $params['description'] = t('!user deleted a status message.', array('!user' => theme('username', array('account' => $user))));
   }
   else {
     $params['description'] = t('!user deleted a message by !sender',
-      array('!user' => theme('username', $user), '!sender' => theme('username', $sender)));
+      array('!user' => theme('username', array('account' => $user)), '!sender' => theme('username', array('account' => $sender))));
   }
   userpoints_userpointsapi($params);
 }
 
 /**
- * Implementation of hook_fbss_comments_after_save().
+ * Implements hook_fbss_comments_after_save().
  */
 function fbss_userpoints_fbss_comments_after_save($comment, $edit) {
   // Don't give points for editing.
@@ -179,18 +174,17 @@ function fbss_userpoints_fbss_comments_a
     return;
   }
   $account = _facebook_status_user_load($comment->uid);
-  $points_today = db_result(db_query("SELECT SUM(points) FROM {userpoints_txn}
-    WHERE uid = %d AND time_stamp > %d
-      AND operation = 'fbss_comments add'
-      AND expired = 0 AND status = 0",
-    $comment->uid, time() - 86400));
+  $points_today = db_query("SELECT SUM(points) FROM {userpoints_txn}
+    WHERE uid = :uid AND time_stamp > :time_stamp
+      AND operation = :operation
+      AND expired = :expired AND status = :status", array(':uid' => $comment->uid, ':time_stamp' => REQUEST_TIME - 86400, ':operation' => 'fbss_comments add', ':expired' => 0, ':status' => 0))->fetchField();
   if (variable_get('fbss_comments_userpoints_max', 0) && $points_today >= variable_get('fbss_comments_userpoints_max', 0)) {
     return;
   }
   $params = array(
     'uid' => $comment->uid,
     'reference' => $comment->cid,
-    'description' => t('!user posted a new status comment.', array('!user' => theme('username', $account))),
+    'description' => t('!user posted a new status comment.', array('!user' => theme('username', array('account' => $account)))),
     'points' => variable_get('fbss_comments_userpoints', 0),
     'operation' => 'fbss_comments add',
     // Unknown purpose.
@@ -201,17 +195,17 @@ function fbss_userpoints_fbss_comments_a
 }
 
 /**
- * Implementation of hook_fbss_comments_delete().
+ * Implements hook_fbss_comments_delete().
  */
 function fbss_userpoints_fbss_comments_delete($cid) {
   $comment = fbss_comments_load($cid);
   $account = _facebook_status_user_load($comment->uid);
-  $result = db_fetch_object(db_query("SELECT points FROM {userpoints_txn} WHERE operation = 'fbss_comments add' AND reference = %d AND uid = %d", $cid, $comment->uid));
+  $result = db_fetch_object(db_query("SELECT points FROM {userpoints_txn} WHERE operation = :operation AND reference = :reference AND uid = :uid", array(':operation' => 'fbss_comments add', ':reference' => $cid, ':uid' => $comment->uid)));
   $params = array(
     'uid' => $comment->uid,
     'points' => 0 - $result->points,
     'operation' => 'fbss_comments delete',
-    'description' => t('!user deleted a status comment.', array('!user' => theme('username', $account))),
+    'description' => t('!user deleted a status comment.', array('!user' => theme('username', array('account' => $account)))),
   );
   userpoints_userpointsapi($params);
 }
