diff --git a/includes/simplenews.admin.inc b/includes/simplenews.admin.inc
index c670315..80002e7 100644
--- a/includes/simplenews.admin.inc
+++ b/includes/simplenews.admin.inc
@@ -31,8 +31,8 @@ function simplenews_issue_filters() {
   $filters['category'] = array(
     'title' => t('Subscribed to'),
     'options' => array(
-      'all'   => t('All newsletters'),
-      'tid-0'    => t('Unassigned newsletters'),
+      'all' => t('All newsletters'),
+      'tid-0' => t('Unassigned newsletters'),
     ),
   );
   foreach (simplenews_category_list() as $tid => $name) {
@@ -138,10 +138,7 @@ function simplenews_admin_issues() {
 
   if (variable_get('simplenews_last_cron', '')) {
     $form['last_sent'] = array(
-      '#value' => '<p>' . format_plural(variable_get('simplenews_last_sent', 0),
-                                        'Last batch: 1 mail sent at !time.',
-                                        'Last batch: !count mails sent at !time.',
-                                        array('!time' => format_date(variable_get('simplenews_last_cron', ''), 'small'), '!count' => variable_get('simplenews_last_sent', 0))) . "</p>\n",
+      '#markup' => '<p>' . format_plural(variable_get('simplenews_last_sent', 0), 'Last batch: 1 mail sent at !time.', 'Last batch: !count mails sent at !time.', array('!time' => format_date(variable_get('simplenews_last_cron', ''), 'small'), '!count' => variable_get('simplenews_last_sent', 0))) . "</p>\n",
     );
   }
   // Table header. Used as tablesort default
@@ -397,7 +394,7 @@ function theme_simplenews_admin_categories($variables) {
  */
 function simplenews_admin_category_form($form, &$form_state, $edit = array()) {
   if (!is_array($edit)) {
-    $edit = (array)$edit;
+    $edit = (array) $edit;
   }
   $edit += array(
     'tid' => 0,
@@ -631,15 +628,15 @@ function simplenews_admin_category_form_submit($form, &$form_state) {
     return;
   }
 
-  $category = (object)$form_state['values'];
+  $category = (object) $form_state['values'];
 
   // Create or update taxonomy term.
   $term = new stdClass();
-  $term->tid          = $form_state['values']['tid'];
-  $term->vid          = variable_get('simplenews_vid', 0);
-  $term->name         = $form_state['values']['name'];
-  $term->description  = $form_state['values']['description'];
-  $term->weight       = $form_state['values']['weight'];
+  $term->tid = $form_state['values']['tid'];
+  $term->vid = variable_get('simplenews_vid', 0);
+  $term->name = $form_state['values']['name'];
+  $term->description = $form_state['values']['description'];
+  $term->weight = $form_state['values']['weight'];
   taxonomy_term_save($term);
   $category->tid = $term->tid;
 
@@ -675,12 +672,7 @@ function simplenews_admin_category_delete($form, &$form_state, $category) {
     '#markup' => '<p><strong>' . t('Note: All subscriptions associated with this newsletter will be lost.') . '</strong></p>',
   );
 
-  return confirm_form($form,
-    t('Are you sure you want to delete category %name?', array('%name' => _simplenews_newsletter_name($category))),
-    'admin/config/services/simplenews',
-    t('This action cannot be undone.'),
-    t('Delete'),
-    t('Cancel')
+  return confirm_form($form, t('Are you sure you want to delete category %name?', array('%name' => _simplenews_newsletter_name($category))), 'admin/config/services/simplenews', t('This action cannot be undone.'), t('Delete'), t('Cancel')
   );
 }
 
@@ -723,13 +715,13 @@ function simplenews_subscription_list_add($form, &$form_state) {
     '#type' => 'fieldset',
     '#description' => t('Subscribe to'),
     '#tree' => TRUE,
-   );
+  );
 
   foreach (simplenews_categories_load_multiple() as $list) {
     $form['newsletters'][$list->tid] = array(
       '#type' => 'checkbox',
       '#title' => check_plain(_simplenews_newsletter_name($list)),
-      '#description'  => _simplenews_newsletter_description($list),
+      '#description' => _simplenews_newsletter_description($list),
     );
   }
 
@@ -966,7 +958,7 @@ function simplenews_subscription_list_remove($form, &$form_state) {
     $form['newsletters'][$category->tid] = array(
       '#type' => 'checkbox',
       '#title' => check_plain(_simplenews_newsletter_name($category)),
-      '#description'  => _simplenews_newsletter_description($category),
+      '#description' => _simplenews_newsletter_description($category),
     );
   }
 
@@ -1251,10 +1243,10 @@ function simplenews_admin_settings_newsletter($form, &$form_state) {
   $form['simplenews_default_options']['simplenews_send'] = array(
     '#type' => 'radios',
     '#title' => t('Default send action'),
-    '#options' =>  array(
+    '#options' => array(
       SIMPLENEWS_COMMAND_SEND_TEST => t('Send one test newsletter to the test address'),
       SIMPLENEWS_COMMAND_SEND_NOW => t('Send newsletter'),
-     ),
+    ),
     '#default_value' => variable_get('simplenews_send', 0),
   );
   $form['simplenews_test_address'] = array(
@@ -1559,7 +1551,7 @@ function simplenews_subscription_filters() {
   $filters['list'] = array(
     'title' => t('Subscribed to'),
     'options' => array(
-      'all'   => t('All newsletters'),
+      'all' => t('All newsletters'),
     ),
   );
   foreach (simplenews_categories_load_multiple() as $list) {
@@ -1767,7 +1759,7 @@ function theme_simplenews_status($variables) {
 function theme_simplenews_filter_form($variables) {
   $form = $variables['form'];
 
-  $output  = '<div id="simplenews-admin-filter">';
+  $output = '<div id="simplenews-admin-filter">';
   $output .= drupal_render($form['filters']);
   $output .= '</div>';
   $output .= drupal_render_children($form);
@@ -1782,7 +1774,7 @@ function theme_simplenews_filter_form($variables) {
 function theme_simplenews_subscription_filter_form($variables) {
   $form = $variables['form'];
 
-  $output  = '<div id="simplenews-subscription-filter">';
+  $output = '<div id="simplenews-subscription-filter">';
   $output .= drupal_render($form['filters']);
   $output .= '</div>';
   $output .= drupal_render_children($form);
@@ -1803,11 +1795,10 @@ function simplenews_get_priority() {
   );
 }
 
-
 /**
  * Menu callback; Newsletter tab page.
  */
-function simplenews_node_tab_page($node){
+function simplenews_node_tab_page($node) {
   drupal_set_title(t('<em>Newsletter</em> @title', array('@title' => $node->title)), PASS_THROUGH);
   return drupal_get_form('simplenews_node_tab_send_form', $node);
 }
@@ -1815,18 +1806,18 @@ function simplenews_node_tab_page($node){
 /**
  * @todo
  */
-function simplenews_node_tab_send_form($form, &$form_state, $node){
+function simplenews_node_tab_send_form($form, &$form_state, $node) {
   // First check if there already is a loaded simplenews object.
   if (!empty($node->simplenews)) {
     $simplenews_values = $node->simplenews;
   }
   // If not, try to load it based on the node id.
-  else if ($loaded = simplenews_newsletter_load($node->nid)) {
+  elseif ($loaded = simplenews_newsletter_load($node->nid)) {
     $simplenews_values = $loaded;
   }
   // If that fails too, fall back to the defaults.
   else {
-    $simplenews_values = (object)_simplenews_get_node_form_defaults($node);
+    $simplenews_values = (object) _simplenews_get_node_form_defaults($node);
   }
 
   $form = array();
@@ -1934,7 +1925,7 @@ function simplenews_node_tab_send_form_validate($form, &$form_state) {
   $default_address = variable_get('simplenews_test_address', variable_get('site_mail', ini_get('sendmail_from')));
   $mails = array($default_address);
   if (isset($values['simplenews']['send']) && $values['simplenews']['send'] == SIMPLENEWS_COMMAND_SEND_TEST && variable_get('simplenews_test_address_override', 0)) {
-   // @todo Can we simplify and use only two kind of messages?
+    // @todo Can we simplify and use only two kind of messages?
     if (!empty($values['simplenews']['test_address'])) {
       $mails = explode(',', $values['simplenews']['test_address']);
       foreach ($mails as $mail) {
diff --git a/includes/simplenews.mail.inc b/includes/simplenews.mail.inc
index 663c55b..7935ea6 100644
--- a/includes/simplenews.mail.inc
+++ b/includes/simplenews.mail.inc
@@ -398,7 +398,7 @@ function simplenews_get_spool($limit = SIMPLENEWS_UNLIMITED, $conditions = array
       $query->range(0, $limit);
     }
     foreach ($query->execute() as $message) {
-      if (strlen($message->data)) {
+      if (drupal_strlen($message->data)) {
         $message->data = unserialize($message->data);
       }
       else {
@@ -596,7 +596,7 @@ function _simplenews_set_from() {
   $name = variable_get('simplenews_from_name', $name_default);
 
   // Windows based PHP systems don't accept formatted emails.
-  $formatted_address = substr(PHP_OS, 0, 3) == 'WIN' ? $address : '"' . $name . '" <' . $address . '>';
+  $formatted_address = drupal_substr(PHP_OS, 0, 3) == 'WIN' ? $address : '"' . $name . '" <' . $address . '>';
 
   return array(
     'address' => $address,
@@ -654,9 +654,9 @@ function _simplenews_absolute_mail_urls($match) {
 
     // If the link is formed by Drupal's URL filter, we only return the URL.
     // The URL filter generates a label out of the original URL.
-    if (strpos($label, '...') === strlen($label) - 3) {
+    if (strpos($label, '...') === drupal_strlen($label) - 3) {
       // Remove ellipsis from end of label.
-      $label = substr($label, 0, strlen($label) - 3);
+      $label = drupal_substr($label, 0, drupal_strlen($label) - 3);
     }
     if (strpos($url, $label) !== FALSE) {
       return $url;
diff --git a/includes/simplenews.subscription.inc b/includes/simplenews.subscription.inc
index 8d0219f..13f770a 100644
--- a/includes/simplenews.subscription.inc
+++ b/includes/simplenews.subscription.inc
@@ -74,10 +74,9 @@ function simplenews_subscriptions_account_form(&$form, &$form_state, $subscriber
     '#default_value' => $default_value,
   );
 
-  $form['subscriptions']['#title'] =  t('Current newsletter subscriptions');
+  $form['subscriptions']['#title'] = t('Current newsletter subscriptions');
 
   // if we don't override #validate, see user_profile_form_validate
-
   // adding an own #submit leads to the situation where drupal omits execution of user_profile_form_submit completely
   $form['#submit'][] = 'simplenews_subscriptions_account_form_submit';
 }
@@ -161,6 +160,7 @@ function simplenews_block_form($form, &$form_state, $tid) {
 /*
  * FAPI BLOCK subscription form_validate.
  */
+
 function simplenews_block_form_validate($form, &$form_state) {
   if (!valid_email_address($form_state['values']['mail'])) {
     form_set_error('mail', t("The e-mail address you supplied is not valid."));
@@ -170,6 +170,7 @@ function simplenews_block_form_validate($form, &$form_state) {
 /*
  * FAPI BLOCK subscription form_submit.
  */
+
 function simplenews_block_form_submit($form, &$form_state) {
   $tid = $form['#tid'];
   $account = simplenews_load_user_by_mail($form_state['values']['mail']);
@@ -213,7 +214,7 @@ function simplenews_subscriptions_page_form($form, &$form_state, $code = NULL) {
     $mail = $user->mail;
   }
   // If a hash is provided, try to load the corresponding subscriber.
-  else if ($code) {
+  elseif ($code) {
     if (!$subscriber = simplenews_subscriber_load_by_hash($code)) {
       drupal_not_found();
       return;
@@ -466,6 +467,7 @@ function simplenews_subscriptions_multi_block_form($form, &$form_state) {
  * @see simplenews_confirm_add_form()
  * @see simplenews_confirm_removal_form()
  */
+
 /**
  * Menu callback: confirm the user's (un)subscription request
  *
@@ -513,7 +515,7 @@ function simplenews_confirm_subscription() {
         drupal_set_message(t('%user was unsubscribed from the %newsletter mailing list.', array('%user' => $subscriber->mail, '%newsletter' => _simplenews_newsletter_name($category))));
         drupal_goto(variable_get('site_frontpage', 'node'));
       }
-      else if ($op == 'add') {
+      elseif ($op == 'add') {
         simplenews_subscribe_user($subscriber->mail, $tid, FALSE, 'website');
         if ($path = variable_get('simplenews_confirm_subscribe_page', '')) {
           $path = $path . '/' . implode('/', $arguments);
@@ -522,12 +524,12 @@ function simplenews_confirm_subscription() {
         drupal_set_message(t('%user was added to the %newsletter mailing list.', array('%user' => $subscriber->mail, '%newsletter' => _simplenews_newsletter_name($category))));
         drupal_goto(variable_get('site_frontpage', 'node'));
       }
-      else if ($op == 'combined' && !empty($subscriber->changes)) {
+      elseif ($op == 'combined' && !empty($subscriber->changes)) {
         foreach ($subscriber->changes as $tid => $action) {
           if ($action == 'subscribe') {
             simplenews_subscribe_user($subscriber->mail, $tid, FALSE, 'website');
           }
-          else if ($action == 'unsubscribe') {
+          elseif ($action == 'unsubscribe') {
             simplenews_unsubscribe_user($subscriber->mail, $tid, FALSE, 'website');
           }
         }
@@ -566,19 +568,14 @@ function simplenews_confirm_add_form($form, &$form_state, $mail, $newsletter) {
     '#value' => $newsletter,
   );
 
-  return confirm_form($form,
-    t('Confirm subscription'),
-    '',
-    t('You can always unsubscribe later.'),
-    t('Subscribe'),
-    t('Cancel')
+  return confirm_form($form, t('Confirm subscription'), '', t('You can always unsubscribe later.'), t('Subscribe'), t('Cancel')
   );
 }
 
 function simplenews_confirm_add_form_submit($form, &$form_state) {
   simplenews_subscribe_user($form_state['values']['mail'], $form_state['values']['newsletter']->tid, FALSE, 'website');
 
-  if (!$path =  variable_get('simplenews_confirm_subscribe_page', '')){
+  if (!$path = variable_get('simplenews_confirm_subscribe_page', '')) {
     $path = variable_get('site_frontpage', 'node');
     drupal_set_message(t('%user was added to the %newsletter mailing list.', array('%user' => $form_state['values']['mail'], '%newsletter' => _simplenews_newsletter_name($form_state['values']['newsletter']))));
   }
@@ -607,12 +604,7 @@ function simplenews_confirm_multi_form($form, &$form_state, $subscriber) {
     '#value' => $subscriber,
   );
 
-  return confirm_form($form,
-    t('Confirm subscription'),
-    '',
-    t('You can always change your subscriptions later.'),
-    t('Confirm'),
-    t('Cancel')
+  return confirm_form($form, t('Confirm subscription'), '', t('You can always change your subscriptions later.'), t('Confirm'), t('Cancel')
   );
 }
 
@@ -622,7 +614,7 @@ function simplenews_confirm_multi_form_submit($form, &$form_state) {
     if ($action == 'subscribe') {
       simplenews_subscribe_user($subscriber->mail, $tid, FALSE, 'website');
     }
-    else if ($action == 'unsubscribe') {
+    elseif ($action == 'unsubscribe') {
       simplenews_unsubscribe_user($subscriber->mail, $tid, FALSE, 'website');
     }
   }
@@ -654,19 +646,14 @@ function simplenews_confirm_removal_form($form, &$form_state, $mail, $newsletter
     '#value' => $newsletter,
   );
 
-  return confirm_form($form,
-    t('Confirm remove subscription'),
-    '',
-    t('This action will unsubscribe you from the newsletter mailing list.'),
-    t('Unsubscribe'),
-    t('Cancel')
+  return confirm_form($form, t('Confirm remove subscription'), '', t('This action will unsubscribe you from the newsletter mailing list.'), t('Unsubscribe'), t('Cancel')
   );
 }
 
 function simplenews_confirm_removal_form_submit($form, &$form_state) {
   simplenews_unsubscribe_user($form_state['values']['mail'], $form_state['values']['newsletter']->tid, FALSE, 'website');
 
-  if (!$path =  variable_get('simplenews_confirm_unsubscribe_page', '')){
+  if (!$path = variable_get('simplenews_confirm_unsubscribe_page', '')) {
     $path = variable_get('site_frontpage', 'node');
     drupal_set_message(t('%user was unsubscribed from the %newsletter mailing list.', array('%user' => $form_state['values']['mail'], '%newsletter' => _simplenews_newsletter_name($form_state['values']['newsletter']))));
   }
@@ -720,15 +707,11 @@ function simplenews_subscriptions_admin_form($form, &$form_state, $snid) {
   );
 
   if ((variable_get('language_count', 1) > 1)) {
-    // @todo we could allow to switch back to "default", but user_load
-    //$language_options[''] = t('Site default language');
     $languages = language_list('enabled');
     foreach ($languages[1] as $langcode => $item) {
       $name = t($item->name);
-      $language_options[$langcode] = $name . ($item->native != $name ? ' ('. $item->native .')' : '');
+      $language_options[$langcode] = $name . ($item->native != $name ? ' (' . $item->native . ')' : '');
     }
-    // std users have language in profile. disable
-    $disabled = $subscriber->uid ? TRUE : FALSE;
     $form['language'] = array(
       '#type' => 'fieldset',
       '#title' => 'Preferred language',
@@ -736,10 +719,12 @@ function simplenews_subscriptions_admin_form($form, &$form_state, $snid) {
       '#disabled' => FALSE,
     );
     if ($subscriber->uid) {
-      // fapi error: disabled not supported for select type. workaround: output markup
+      // Fallback if user has not defined a language.
+      $language_default = t('Site default language (@name)', array('@name' => $language_options[language_default()->language]));
       $form['language']['language'] = array(
-        '#type' => 'markup',
-        '#value' => $language_options[$subscriber->language],
+        '#type' => 'item',
+        '#title' => t('User language'),
+        '#markup' => isset($language_options[$subscriber->language]) ? $language_options[$subscriber->language] : $language_default,
       );
     }
     else {
diff --git a/includes/views/handlers/simplenews_handler_field_newsletter_send.inc b/includes/views/handlers/simplenews_handler_field_newsletter_send.inc
index 3412d2c..f2605e1 100644
--- a/includes/views/handlers/simplenews_handler_field_newsletter_send.inc
+++ b/includes/views/handlers/simplenews_handler_field_newsletter_send.inc
@@ -1,6 +1,12 @@
 <?php
 /**
- * Field handler to present a link to close or open commenting on a node.
+ * @file
+ *
+ * Views handler that displays a link to send a newsletter.
+ */
+
+/**
+ * Views handler that displays a link to send a newsletter.
  */
 class simplenews_handler_field_newsletter_send extends views_handler_field_node_link {
 
diff --git a/includes/views/simplenews.views.inc b/includes/views/simplenews.views.inc
index 9741eb8..7bbedfe 100644
--- a/includes/views/simplenews.views.inc
+++ b/includes/views/simplenews.views.inc
@@ -10,7 +10,7 @@
  */
 function simplenews_views_data() {
 
-/* ------------ Definitions for Simplenews mailspool ----------------------*/
+  /* ------------ Definitions for Simplenews mailspool ---------------------- */
 
   $data['simplenews_mail_spool']['table'] = array(
     'base' => array(
@@ -212,7 +212,7 @@ function simplenews_views_data() {
     ),
   );
 
-/* ------------ Definitions for Simplenews issue ----------------------*/
+  /* ------------ Definitions for Simplenews issue ---------------------- */
 
   $data['simplenews_newsletter']['table'] = array(
     // Define the base group of this table. Fields that don't
@@ -268,7 +268,7 @@ function simplenews_views_data() {
       'handler' => 'simplenews_handler_filter_newsletter_status',
     ),
     'argument' => array(
-        'handler' => 'views_handler_argument_numeric',
+      'handler' => 'views_handler_argument_numeric',
     ),
     'sort' => array(
       'handler' => 'views_handler_sort',
@@ -302,7 +302,7 @@ function simplenews_views_data() {
     ),
   );
 
-/* ------------ Definitions for Simplenews subscriber ----------------------*/
+  /* ------------ Definitions for Simplenews subscriber ---------------------- */
 
   $data['simplenews_subscriber']['table'] = array(
     'base' => array(
@@ -443,17 +443,17 @@ function simplenews_views_data() {
     ),
   );
 
-/* ------------ Definitions for Simplenews subscription ----------------------*/
+  /* ------------ Definitions for Simplenews subscription ---------------------- */
 
   $data['simplenews_subscription']['table'] = array(
     'base' => array(
-       'field' => 'snid',
-       'title' => t('Simplenews subscription'),
-       'help' => t('Contains all Subscriptions of every Simplenews Newsletters.'),
-       'weight' => 10,
-       'database' => 'default',
-     ),
-     'group' => t('Simplenews subscription'),
+      'field' => 'snid',
+      'title' => t('Simplenews subscription'),
+      'help' => t('Contains all Subscriptions of every Simplenews Newsletters.'),
+      'weight' => 10,
+      'database' => 'default',
+    ),
+    'group' => t('Simplenews subscription'),
   );
 
   $data['simplenews_subscription']['table']['join'] = array(
@@ -575,7 +575,7 @@ function simplenews_views_data() {
     ),
   );
 
-/* ------------ Definitions for Simplenews category ----------------------*/
+  /* ------------ Definitions for Simplenews category ---------------------- */
 
   // Define the base group of this table. Fields that don't
   // have a group defined will go into this field by default.
diff --git a/simplenews.drush.inc b/simplenews.drush.inc
index 45d773a..32f6a14 100644
--- a/simplenews.drush.inc
+++ b/simplenews.drush.inc
@@ -1,5 +1,9 @@
 <?php
-
+/**
+ * @file
+ *
+ * Drush commands for administer Simplenews.
+ */
 
 /**
  * Implements hook_drush_command().
diff --git a/simplenews.module b/simplenews.module
index 369caf8..1b33fb6 100644
--- a/simplenews.module
+++ b/simplenews.module
@@ -5,7 +5,6 @@
  * Enable nodes to be used as newsletter, manage subscriptions and sent
  * email newsletter to subscribers.
  */
-
 /**
  * @file
  * Simplenews node handling, sent email, newsletter block and general hooks
@@ -18,7 +17,6 @@
  * @todo Separate token function into simplenews.tokens.inc
  * @todo Consider using hook_hook_info() to move hooks out of .module. http://drupal.org/update/modules/6/7#new_hook_hook_info
  */
-
 /**
  * NEWSLETTER MAIL PRIORITY
  */
@@ -123,7 +121,7 @@ function simplenews_init() {
  * Implements hook_menu().
  */
 function simplenews_menu() {
-    $items['admin/content/simplenews'] = array(
+  $items['admin/content/simplenews'] = array(
     'title' => 'Newsletters',
     'description' => 'List newsletters and newsletter sent status.',
     'type' => MENU_LOCAL_TASK,
@@ -144,8 +142,8 @@ function simplenews_menu() {
 
   $items['admin/config/services/simplenews/categories'] = array(
     'title' => 'Newsletters',
-     'type' => MENU_DEFAULT_LOCAL_TASK,
-   );
+    'type' => MENU_DEFAULT_LOCAL_TASK,
+  );
 
   $items['admin/config/services/simplenews/categories/%simplenews_category/edit'] = array(
     'title' => 'Newsletters',
@@ -398,7 +396,7 @@ function simplenews_get_term_values($node) {
   }
 
   $term = current($taxonomy);
-  return ($term)? $term : FALSE;
+  return ($term) ? $term : FALSE;
 }
 
 /**
@@ -439,7 +437,7 @@ function simplenews_node_presave($node) {
     $node->simplenews = simplenews_newsletter_load($node->nid);
   }
   if (empty($node->simplenews)) {
-    $newsletter = (object)simplenews_newsletter_defaults($node);
+    $newsletter = (object) simplenews_newsletter_defaults($node);
   }
 }
 
@@ -451,7 +449,7 @@ function simplenews_node_insert($node) {
     return;
   }
 
-  $node->simplenews = (object)simplenews_newsletter_defaults($node);
+  $node->simplenews = (object) simplenews_newsletter_defaults($node);
   simplenews_newsletter_save($node->simplenews);
 }
 
@@ -485,7 +483,7 @@ function simplenews_node_update($node) {
 
   $node->simplenews = simplenews_newsletter_load($node->nid);
   if (!$node->simplenews) {
-    $node->simplenews = (object)simplenews_newsletter_defaults($node);
+    $node->simplenews = (object) simplenews_newsletter_defaults($node);
   }
   else {
     // Update tid.
@@ -518,13 +516,13 @@ function simplenews_node_delete($node) {
   $count = simplenews_delete_spool(array('nid' => $node->nid));
   if ($count) {
     drupal_set_message(t('Newsletter %title was deleted but had @count pending emails. They can no longer be sent.', array(
-      '%title' => $node->title,
-      '@count' => $count,
-     )), 'warning');
+        '%title' => $node->title,
+        '@count' => $count,
+      )), 'warning');
     watchdog('simplenews', 'Newsletter %title deleted with @count pending emails. Emails can no longer be sent.', array(
       '%title' => $node->title,
       '@count' => $count,
-     ), WATCHDOG_ALERT);
+      ), WATCHDOG_ALERT);
   }
   drupal_set_message(t('Newsletter %title was deleted.', array('%title' => $node->title)));
 }
@@ -553,7 +551,7 @@ function simplenews_node_load($nodes, $types) {
       $newsletter = $newsletters[$nid];
     }
     if (!$newsletter) {
-      $newsletter = (object)simplenews_newsletter_defaults($node);
+      $newsletter = (object) simplenews_newsletter_defaults($node);
     }
     $nodes[$nid]->simplenews = $newsletter;
   }
@@ -750,7 +748,7 @@ function simplenews_taxonomy_term_delete($term) {
   // will also delete the subscriptions to the category.
   if ($term->vid == variable_get('simplenews_vid', 0)) {
     // Make sure we only try to delete if not already deleted.
-    if (($category = simplenews_category_load($term->tid)) !== false) {
+    if (($category = simplenews_category_load($term->tid)) !== FALSE) {
       // Add name and description from $term object.
       $category->name = $term->name;
       $category->description = $term->description;
@@ -881,7 +879,6 @@ function simplenews_form_user_register_form_alter(&$form, &$form_state) {
   }
 }
 
-
 /**
  * Implements hook_user_insert().
  *
@@ -937,7 +934,7 @@ function simplenews_user_insert(&$edit, $account, $category) {
 function simplenews_user_login(&$edit, $account) {
   // Subscriptions of users that did sign up by themselves have to be
   // activated first at their first login (-> account::access = 0)
-  if ($account->access == 0){
+  if ($account->access == 0) {
     $query = db_update('simplenews_subscriber')
       ->fields(array('activated' => SIMPLENEWS_SUBSCRIPTION_ACTIVE))
       ->condition('uid', $account->uid)
@@ -951,7 +948,7 @@ function simplenews_user_login(&$edit, $account) {
  * User data (mail, status, language) is synchronized with subscriber.
  * This function handles existing user account, simplenews_user_insert takes
  * care of new accounts.
- * @see simplenews_user_insert
+ * @see simplenews_user_insert()
  */
 function simplenews_user_presave(&$edit, $account, $category) {
   switch ($category) {
@@ -981,7 +978,7 @@ function simplenews_user_presave(&$edit, $account, $category) {
  * Implements hook_user_cancel().
  */
 function simplenews_user_cancel($edit, $account, $method) {
- // Deactivate subscriber when account is disabled via cancel user.
+  // Deactivate subscriber when account is disabled via cancel user.
 
   if ($account) {
     $query = db_update('simplenews_subscriber')
@@ -1021,7 +1018,7 @@ function simplenews_user_categories() {
 function simplenews_subscription_edit_access($account) {
   global $user;
   // Disallow anonymous.
-  if (!$account || $account->uid==0) {
+  if (!$account || $account->uid == 0) {
     return FALSE;
   }
   // Allow edit own subscription.
@@ -1047,7 +1044,7 @@ function simplenews_form_user_profile_form_alter(&$form, &$form_state) {
     $subscription = simplenews_subscriber_load_by_mail($form['#user']->mail);
     module_load_include('inc', 'simplenews', 'includes/simplenews.subscription');
     simplenews_subscriptions_account_form($form, $form_state, $subscription);
-    $form['subscriptions']['#title'] =  t('Newsletter subscriptions');
+    $form['subscriptions']['#title'] = t('Newsletter subscriptions');
     unset($form['update'], $form['subscriptions']['mail']);
   }
 }
@@ -1240,7 +1237,7 @@ function simplenews_forms($form_id, $args) {
   $match = preg_match('/simplenews_block_form_(\d+)/', $form_id, $matches);
   if ($match) {
     module_load_include('inc', 'simplenews', 'includes/simplenews.subscription');
-    $forms['simplenews_block_form_'. $matches[1]] = array(
+    $forms['simplenews_block_form_' . $matches[1]] = array(
       'callback' => 'simplenews_block_form',
       'callback arguments' => array($matches[1]),
     );
@@ -1680,7 +1677,7 @@ function simplenews_subscriber_save(&$subscriber) {
       ->condition('snid', $subscriber->snid)
       ->fields(array(
         'snid' => $subscriber->snid,
-        'activated' => (int)$subscriber->activated,
+        'activated' => (int) $subscriber->activated,
         'mail' => $subscriber->mail,
         'uid' => $subscriber->uid,
         'language' => $subscriber->language,
@@ -1692,12 +1689,12 @@ function simplenews_subscriber_save(&$subscriber) {
   elseif (empty($subscriber->snid)) {
     $query = db_insert('simplenews_subscriber')
       ->fields(array(
-        'activated' => $subscriber->activated,
-        'mail' => $subscriber->mail,
-        'uid' => $subscriber->uid,
-        'language' => $subscriber->language,
-        'changes' => serialize(isset($subscriber->changes) ? $subscriber->changes : array()),
-        'created' => REQUEST_TIME,
+      'activated' => $subscriber->activated,
+      'mail' => $subscriber->mail,
+      'uid' => $subscriber->uid,
+      'language' => $subscriber->language,
+      'changes' => serialize(isset($subscriber->changes) ? $subscriber->changes : array()),
+      'created' => REQUEST_TIME,
       ));
     $last_insert_id = $query->execute();
     if ($last_insert_id !== FALSE) {
@@ -1798,12 +1795,12 @@ function simplenews_mail($key, &$message, $params) {
 }
 
 /**
- * Implementation of hook_views_api().
+ * Implements hook_views_api().
  */
 function simplenews_views_api() {
   return array(
-  'api' => 3,
-  'path' => drupal_get_path('module', 'simplenews') . '/includes/views'
+    'api' => 3,
+    'path' => drupal_get_path('module', 'simplenews') . '/includes/views'
   );
 }
 
@@ -1894,17 +1891,17 @@ function simplenews_category_save($category) {
   db_merge('simplenews_category')
     ->key(array('tid' => $category->tid))
     ->fields(array(
-      'tid'           => $category->tid,
-      'format'        => $category->format,
-      'priority'      => $category->priority,
-      'receipt'       => $category->receipt,
-      'from_name'     => $category->from_name,
-      'from_address'  => $category->from_address,
+      'tid' => $category->tid,
+      'format' => $category->format,
+      'priority' => $category->priority,
+      'receipt' => $category->receipt,
+      'from_name' => $category->from_name,
+      'from_address' => $category->from_address,
       'email_subject' => $category->email_subject,
-      'hyperlinks'    => $category->hyperlinks,
-      'new_account'   => $category->new_account,
-      'opt_inout'     => $category->opt_inout,
-      'block'         => $category->block,
+      'hyperlinks' => $category->hyperlinks,
+      'new_account' => $category->new_account,
+      'opt_inout' => $category->opt_inout,
+      'block' => $category->block,
     ))
     ->execute();
   module_invoke_all('simplenews_category_update', $category);
@@ -2134,7 +2131,7 @@ function simplenews_tokens($type, $tokens, $data = array(), $options = array())
       if (isset($subscriber->snid) && isset($category->tid)) {
         $hash = simplenews_generate_hash($subscriber->mail, $subscriber->snid, $category->tid);
       }
-      else if (isset($subscriber->snid)) {
+      elseif (isset($subscriber->snid)) {
         $combined_hash = simplenews_generate_hash($subscriber->mail, $subscriber->snid, 0);
       }
 
@@ -2223,7 +2220,7 @@ function simplenews_private_key() {
 function simplenews_help($path, $arg) {
   switch ($path) {
     case 'admin/help#simplenews':
-      $help  = "<p>" . t('Simplenews publishes and sends newsletters to lists of subscribers. Both anonymous and authenticated users can opt-in to different mailing lists.') . "</p>\n";
+      $help = "<p>" . t('Simplenews publishes and sends newsletters to lists of subscribers. Both anonymous and authenticated users can opt-in to different mailing lists.') . "</p>\n";
       $help .= "<p>" . t('Simplenews uses nodes for <strong>newsletter issues</strong>. Newsletter issues are grouped by a <strong>newsletter taxonomy term</strong>. Node type and vocabulary are selectable. A newsletter is send to all email addresses which are subscribed to the newsletter. Newsletter issues can be sent only once. Large mailings should be sent by cron to balance the mailserver load.') . "</p>\n";
       $help .= "<p>" . t('Simplenews adds elements to the newsletter node add/edit form to manage newsletter format and sending of the newsletter issue. A newsletter issue can be sent for test before sending officially.') . "</p>\n";
       $help .= "<p>" . t('Both anonymous and authenticated users can <strong>opt-in and opt-out</strong> to a newsletter. A confirmation message is sent to anonymous users when they (un)subscribe. Users can (un)subscribe using a form and a block. A <strong>subscription block</strong> is available for each newsletter offering a subscription form, a link to recent newsletters and RSS feed. Email addresses can also be imported and exported via the subscription administration pages.') . "</p>\n";
@@ -2246,7 +2243,7 @@ function simplenews_help($path, $arg) {
       $help .= "<p>" . t('For more information, see the online handbook entry for <a href="@handbook">Simplenews</a>.', array('@handbook', 'http://drupal.org/node/197057')) . "</p>\n";
       return $help;
     case 'node/add/simplenews':
-      $help  = '<ul>';
+      $help = '<ul>';
       $help .= '<li>' . t('Add this newsletter issue to a newsletter by selecting a newsletter from the select list. To send this newsletter issue, first save the node, then use the "Newsletter" tab.') . "</li>\n";
       if (user_access('administer simplenews settings')) {
         $help .= '<li>' . t('Set default send options at <a href="@configuration">Administration > Configuration > Web services > Newsletters</a>.', array('@configuration' => url('admin/config/services/simplenews'))) . "</li>\n";
@@ -2295,7 +2292,6 @@ function _simplenews_newsletter_name($newsletter, $langcode = NULL) {
   return $newsletter->name;
 }
 
-
 /**
  * Helper function to translate a newsletter description if required.
  *
@@ -2481,7 +2477,7 @@ function simplenews_theme() {
     ),
     'simplenews_status' => array(
       'file' => 'simplenews.admin.inc',
-      'path' => $path  . '/includes',
+      'path' => $path . '/includes',
       'variables' => array(
         'source' => NULL,
         'status' => NULL,
@@ -2527,10 +2523,7 @@ function simplenews_theme() {
  *
  * Collect data and apply access restrictions.
  *
- * $variables
- *
  * @see simplenews-block.tpl.php
- * @see theme_simplenews-block()
  *
  * @ingroup theming
  */
@@ -2592,7 +2585,7 @@ function template_preprocess_simplenews_multi_block(&$variables) {
  * @todo
  *
  * @see template_preprocess_field()
- * @see theme_simplenews_field().
+ * @see theme_simplenews_field()
  */
 function template_preprocess_simplenews_field(&$variables, $hook) {
   $element = $variables['element'];
@@ -2620,7 +2613,7 @@ function template_preprocess_simplenews_field(&$variables, $hook) {
 /**
  * @todo
  *
- * @see theme_field().
+ * @see theme_field()
  *
  * @ingroup theming
  */
@@ -2767,7 +2760,7 @@ function simplenews_newsletter_update_sent_status($node, $status = SIMPLENEWS_ST
     $newsletter = simplenews_newsletter_load($node->nid);
   }
   if (!$newsletter) {
-    $newsletter = (object)simplenews_newsletter_defaults($node);
+    $newsletter = (object) simplenews_newsletter_defaults($node);
   }
   $newsletter->status = $status;
   simplenews_newsletter_save($newsletter);
@@ -2789,7 +2782,6 @@ function simplenews_field_extra_fields() {
   return $return;
 }
 
-
 /**
  * Implements hook_node_access().
  *
@@ -2818,7 +2810,7 @@ function simplenews_node_access($node, $op, $account) {
  *
  * As initiated by elysia_cron.
  * http://drupal.org/project/elysia_cron
- **/
+ * */
 function simplenews_cronapi($op) {
 
   switch ($op) {
@@ -2880,7 +2872,6 @@ function simplenews_simplenews_source_cache_info() {
   );
 }
 
-
 /**
  * Impersonates another user.
  *
@@ -3100,7 +3091,7 @@ function simplenews_confirmation_get_changes_list($subscriber, &$changes = NULL,
     $changes = $subscriber->changes;
   }
 
-  $changes_list= array();
+  $changes_list = array();
   foreach ($changes as $tid => $action) {
     $subscribed = simplenews_user_is_subscribed($subscriber->mail, $tid);
 
@@ -3108,13 +3099,13 @@ function simplenews_confirmation_get_changes_list($subscriber, &$changes = NULL,
     if ($action == 'subscribe' && !$subscribed) {
       $line = simplenews_subscription_confirmation_text('combined_line_subscribe_unsubscribed', $langcode);
     }
-    else if ($action == 'subscribe' && $subscribed) {
+    elseif ($action == 'subscribe' && $subscribed) {
       $line = simplenews_subscription_confirmation_text('combined_line_subscribe_subscribed', $langcode);
     }
-    else if ($action == 'unsubscribe' && !$subscribed) {
+    elseif ($action == 'unsubscribe' && !$subscribed) {
       $line = simplenews_subscription_confirmation_text('combined_line_unsubscribe_unsubscribed', $langcode);
     }
-    else if ($action == 'unsubscribe' && $subscribed) {
+    elseif ($action == 'unsubscribe' && $subscribed) {
       $line = simplenews_subscription_confirmation_text('combined_line_unsubscribe_subscribed', $langcode);
     }
     $category_context = array(
diff --git a/tests/simplenews.test b/tests/simplenews.test
index 0fbd776..f88d11e 100644
--- a/tests/simplenews.test
+++ b/tests/simplenews.test
@@ -6,7 +6,6 @@
  *
  * @ingroup simplenews
  */
-
 class SimplenewsTestCase extends DrupalWebTestCase {
 
   // Use testing profile to speed up tests.
@@ -69,7 +68,7 @@ class SimplenewsTestCase extends DrupalWebTestCase {
   function randomEmail($number = 4, $prefix = 'simpletest_', $domain = 'example.com') {
     $mail = '';
     do {
-      $mail = strtolower($this->randomName($number, $prefix) . '@' . $domain);
+      $mail = drupal_strtolower($this->randomName($number, $prefix) . '@' . $domain);
     } while (in_array($mail, $this->mailadress_cache));
     $this->mailadress_cache[] = $mail;
     return $mail;
@@ -92,7 +91,6 @@ class SimplenewsTestCase extends DrupalWebTestCase {
     return 0;
   }
 
-
   /**
    * Enable newsletter subscription block.
    *
@@ -164,9 +162,11 @@ class SimplenewsTestCase extends DrupalWebTestCase {
     );
     $this->drupalPost(NULL, $edit, t('Subscribe'));
   }
+
 }
 
 class SimplenewsSubscribeTestCase extends SimplenewsTestCase {
+
   /**
    * Implement getInfo().
    */
@@ -282,7 +282,7 @@ class SimplenewsSubscribeTestCase extends SimplenewsTestCase {
     // Unsubscribe from two of the three enabled newsletters.
     $disable = array_rand(array_flip($enable), 2);
 
-     $edit = array(
+    $edit = array(
       'mail' => $mail,
     );
     foreach ($disable as $tid) {
@@ -350,7 +350,7 @@ class SimplenewsSubscribeTestCase extends SimplenewsTestCase {
     $body = $mails[3]['body'];
 
     $pattern = '@newsletter/confirm/add/[0-9,a-f]+t[0-9]+@';
-    $found= preg_match($pattern, $body, $match);
+    $found = preg_match($pattern, $body, $match);
     $confirm_url = $match[0];
     $this->assertTrue($found, t('Single add confirmation URL found: @url', array('@url' => $confirm_url)));
 
@@ -365,7 +365,7 @@ class SimplenewsSubscribeTestCase extends SimplenewsTestCase {
     $body = $mails[4]['body'];
 
     $pattern = '@newsletter/confirm/combined/[0-9,a-f]+t0@';
-    $found= preg_match($pattern, $body, $match);
+    $found = preg_match($pattern, $body, $match);
     $confirm_url = $match[0];
     $this->assertTrue($found, t('Multi confirmation URL found: @url', array('@url' => $confirm_url)));
 
@@ -384,7 +384,7 @@ class SimplenewsSubscribeTestCase extends SimplenewsTestCase {
       $body = $mails[$id]['body'];
 
       $pattern = '@newsletter/confirm/add/[0-9,a-f]+t[0-9]+@';
-      $found= preg_match($pattern, $body, $match);
+      $found = preg_match($pattern, $body, $match);
       $confirm_url = $match[0];
       $this->assertTrue($found, t('Single add confirmation URL found: @url', array('@url' => $confirm_url)));
     }
@@ -451,7 +451,6 @@ class SimplenewsSubscribeTestCase extends SimplenewsTestCase {
     $this->drupalLogout();
 
     //file_put_contents('output.html', $this->drupalGetContent());
-
     // 1. Subscribe anonymous via block
     // Subscribe + submit
     // Assert confirmation message
@@ -477,7 +476,7 @@ class SimplenewsSubscribeTestCase extends SimplenewsTestCase {
 
     $pattern = '@newsletter/confirm/add/[0-9,a-f]+t[0-9]+@';
     preg_match($pattern, $body, $match);
-    $found= preg_match($pattern, $body, $match);
+    $found = preg_match($pattern, $body, $match);
     $confirm_url = $match[0];
     $this->assertTrue($found, t('Confirmation URL found: @url', array('@url' => $confirm_url)));
 
@@ -534,7 +533,7 @@ class SimplenewsSubscribeTestCase extends SimplenewsTestCase {
     $body = $mails[2]['body'];
     $pattern = '@newsletter/confirm/add/[0-9,a-f]+t[0-9]+@';
     preg_match($pattern, $body, $match);
-    $found= preg_match($pattern, $body, $match);
+    $found = preg_match($pattern, $body, $match);
     $confirm_url = $match[0];
     $this->assertTrue($found, t('Confirmation URL found: @url', array('@url' => $confirm_url)));
 
@@ -579,7 +578,7 @@ class SimplenewsSubscribeTestCase extends SimplenewsTestCase {
     $body = $mails[3]['body'];
     $pattern = '@newsletter/confirm/add/[0-9,a-f]+t[0-9]+@';
     preg_match($pattern, $body, $match);
-    $found= preg_match($pattern, $body, $match);
+    $found = preg_match($pattern, $body, $match);
     $confirm_url = $match[0];
     $this->assertTrue($found, t('Confirmation URL found: @url', array('@url' => $confirm_url)));
 
@@ -721,7 +720,6 @@ class SimplenewsSubscribeTestCase extends SimplenewsTestCase {
     $this->assertTrue(strpos($body, 'is not subscribed to this mailing list') !== FALSE);
   }
 
-
   /**
    * Test anonymous subscription with single opt in.
    *
@@ -968,7 +966,6 @@ class SimplenewsSubscribeTestCase extends SimplenewsTestCase {
  * @todo:
  * Newsletter node create, send draft, send final
  */
-
 class SimpleNewsAdministrationTestCase extends SimplenewsTestCase {
 
   /**
@@ -1068,7 +1065,7 @@ class SimpleNewsAdministrationTestCase extends SimplenewsTestCase {
       if ($category->new_account == 'on' && $category->opt_inout != 'hidden') {
         $this->assertFieldChecked('edit-newsletters-' . $category->tid);
       }
-      else if ($category->new_account == 'off' && $category->opt_inout != 'hidden') {
+      elseif ($category->new_account == 'off' && $category->opt_inout != 'hidden') {
         $this->assertNoFieldChecked('edit-newsletters-' . $category->tid);
       }
       else {
@@ -1123,7 +1120,7 @@ class SimpleNewsAdministrationTestCase extends SimplenewsTestCase {
         if ($category->opt_inout == 'hidden') {
           $this->assertNoField('newsletters[' . $category->tid . ']', t('Hidden newsletter category is not shown.'));
         }
-        else if ($category->new_account == 'on' || $category->name == 'off-double-block' || $category->new_account == 'silent') {
+        elseif ($category->new_account == 'on' || $category->name == 'off-double-block' || $category->new_account == 'silent') {
           // All on, silent and the explicitly selected category should be checked.
           $this->assertFieldChecked('edit-newsletters-' . $category->tid);
         }
@@ -1243,7 +1240,7 @@ class SimpleNewsAdministrationTestCase extends SimplenewsTestCase {
     $mail_addresses = $this->xpath('//tr/td[2]');
     $this->assertEqual(15, count($mail_addresses));
     foreach ($mail_addresses as $mail_address) {
-      $mail_address = (string)$mail_address;
+      $mail_address = (string) $mail_address;
       $this->assertTrue(isset($subscribers_flat[$mail_address]));
       unset($subscribers_flat[$mail_address]);
     }
@@ -1265,7 +1262,7 @@ class SimpleNewsAdministrationTestCase extends SimplenewsTestCase {
     $mail_addresses = $this->xpath('//tr/td[2]');
     $this->assertEqual(10, count($mail_addresses));
     foreach ($mail_addresses as $mail_address) {
-      $mail_address = (string)$mail_address;
+      $mail_address = (string) $mail_address;
       $this->assertTrue(isset($subscribers_flat[$mail_address]));
       unset($subscribers_flat[$mail_address]);
     }
@@ -1274,14 +1271,14 @@ class SimpleNewsAdministrationTestCase extends SimplenewsTestCase {
 
     // Filter a single mail address, the one assigned to a user.
     $edit = array(
-      'email' => substr(current($subscribers['all']), 0, 4)
+      'email' => drupal_substr(current($subscribers['all']), 0, 4)
     );
     $this->drupalPost(NULL, $edit, t('Filter'));
 
     $rows = $this->xpath('//tbody/tr');
     $this->assertEqual(1, count($rows));
-    $this->assertEqual(current($subscribers['all']), (string)$rows[0]->td[1]);
-    $this->assertEqual($user->name, (string)$rows[0]->td[2]->a);
+    $this->assertEqual(current($subscribers['all']), (string) $rows[0]->td[1]);
+    $this->assertEqual($user->name, (string) $rows[0]->td[2]->a);
 
     // Reset the filter.
     $this->drupalPost(NULL, array(), t('Reset'));
@@ -1317,7 +1314,7 @@ class SimpleNewsAdministrationTestCase extends SimplenewsTestCase {
     $this->clickLink(t('Export'));
     $this->drupalPost(NULL, array('newsletters[' . $first . ']' => TRUE), t('Export'));
     $export_field = $this->xpath($this->constructFieldXpath('name', 'emails'));
-    $exported_mails = (string)$export_field[0];
+    $exported_mails = (string) $export_field[0];
     foreach ($subscribers[$first] as $mail) {
       $this->assertTrue(strpos($exported_mails, $mail) !== FALSE, t('Mail address exported correctly.'));
     }
@@ -1339,7 +1336,7 @@ class SimpleNewsAdministrationTestCase extends SimplenewsTestCase {
     $this->drupalPost(NULL, $edit, t('Export'));
 
     $export_field = $this->xpath($this->constructFieldXpath('name', 'emails'));
-    $exported_mails = (string)$export_field[0];
+    $exported_mails = (string) $export_field[0];
     $exported_mails = explode(', ', $exported_mails);
     $this->assertEqual(2, count($exported_mails));
     $this->assertTrue(in_array($all_mail, $exported_mails));
@@ -1364,7 +1361,7 @@ class SimpleNewsAdministrationTestCase extends SimplenewsTestCase {
     $this->drupalPost(NULL, $edit, t('Export'));
 
     $export_field = $this->xpath($this->constructFieldXpath('name', 'emails'));
-    $exported_mails = (string)$export_field[0];
+    $exported_mails = (string) $export_field[0];
     $exported_mails = explode(', ', $exported_mails);
     $this->assertEqual(2, count($exported_mails));
     $this->assertTrue(in_array($unconfirmed[0], $exported_mails));
@@ -1462,7 +1459,7 @@ class SimpleNewsAdministrationTestCase extends SimplenewsTestCase {
     $this->clickLink(t('Add content type'));
     $edit = array(
       'name' => $name = $this->randomName(),
-      'type' => $type = strtolower($name),
+      'type' => $type = drupal_strtolower($name),
       'simplenews_content_type' => TRUE,
     );
     $this->drupalPost(NULL, $edit, t('Save content type'));
@@ -1501,11 +1498,11 @@ class SimpleNewsAdministrationTestCase extends SimplenewsTestCase {
     $this->assertText(t('Newsletter category'));
 
     // @todo: Test node update/delete.
-
     // Delete content type.
     // @todo: Add assertions.
     $this->drupalPost('admin/structure/types/manage/' . $type . '/delete', array(), t('Delete'));
   }
+
 }
 
 /**
@@ -1743,16 +1740,18 @@ class SimpleNewsI18nTestCase extends SimplenewsTestCase {
     drupal_static_reset('locale_url_outbound_alter');
     drupal_static_reset('language_list');
   }
+
 }
 
 /**
  * Upgrade test from 6.x-1.x
  */
 class SimpleNewsUpgradePath61TestCase extends UpgradePathTestCase {
+
   public static function getInfo() {
     return array(
-      'name'  => 'Simplenews 6.x-1.x upgrade path',
-      'description'  => 'Simplenews 6.x-1.x upgrade path tests.',
+      'name' => 'Simplenews 6.x-1.x upgrade path',
+      'description' => 'Simplenews 6.x-1.x upgrade path tests.',
       'group' => 'Simplenews',
     );
   }
@@ -1797,16 +1796,18 @@ class SimpleNewsUpgradePath61TestCase extends UpgradePathTestCase {
     $this->drupalGet('admin/people/simplenews');
     $this->assertText('another@example.org');
   }
+
 }
 
 /**
  * Upgrade test from 6.x-2.x
  */
 class SimpleNewsUpgradePath62TestCase extends UpgradePathTestCase {
+
   public static function getInfo() {
     return array(
-      'name'  => 'Simplenews 6.x-2.x upgrade path',
-      'description'  => 'Simplenews 6.x-2.x upgrade path tests.',
+      'name' => 'Simplenews 6.x-2.x upgrade path',
+      'description' => 'Simplenews 6.x-2.x upgrade path tests.',
       'group' => 'Simplenews',
     );
   }
@@ -1851,13 +1852,14 @@ class SimpleNewsUpgradePath62TestCase extends UpgradePathTestCase {
     $this->drupalGet('admin/people/simplenews');
     $this->assertText('another@example.org');
   }
-}
 
+}
 
 /**
  * Test cases for creating and sending newsletters.
  */
 class SimplenewsSendTestCase extends SimplenewsTestCase {
+
   /**
    * Implementation of getInfo().
    */
@@ -1955,8 +1957,6 @@ class SimplenewsSendTestCase extends SimplenewsTestCase {
     $this->assertEqual(0, count($this->subscribers), t('all subscribers have been received a mail'));
   }
 
-
-
   /**
    * Send a newsletter using cron.
    */
@@ -1989,7 +1989,7 @@ class SimplenewsSendTestCase extends SimplenewsTestCase {
 
     $edit = array(
       'issues[' . $first->nid . ']' => $first->nid,
-      'issues[' . $unpublished->nid . ']' => $unpublished->nid  ,
+      'issues[' . $unpublished->nid . ']' => $unpublished->nid,
       'operation' => 'activate',
     );
     $this->drupalPost('admin/content/simplenews', $edit, t('Update'));
@@ -2207,7 +2207,6 @@ class SimplenewsSendTestCase extends SimplenewsTestCase {
     $newsletter = simplenews_newsletter_load($node->nid);
     $this->assertEqual(SIMPLENEWS_STATUS_SEND_READY, $newsletter->status, t('Newsletter sending finished'));
     // @todo test sent subscriber count.
-
     // Verify mails.
     $mails = $this->drupalGetMails();
     $this->assertEqual(5, count($mails), t('All mails were sent.'));
@@ -2258,7 +2257,6 @@ class SimplenewsSendTestCase extends SimplenewsTestCase {
     $this->assertEqual(2, $newsletter->tid, t('Newsletter has tid 2.'));
   }
 
-
   /**
    * Create a newsletter, send mails and then delete.
    */
@@ -2344,14 +2342,15 @@ class SimplenewsSendTestCase extends SimplenewsTestCase {
     $this->assertFalse($newsletter);
     $spooled = db_query('SELECT COUNT(*) FROM {simplenews_mail_spool} WHERE nid = :nid', array(':nid' => $node->nid))->fetchField();
     $this->assertEqual(0, $spooled, t('No mails remaining in spool.'));
-
   }
+
 }
 
 /**
  * Test cases for creating and sending newsletters.
  */
 class SimplenewsSourceTestCase extends SimplenewsTestCase {
+
   /**
    * Implementation of getInfo().
    */
@@ -2664,4 +2663,5 @@ class SimplenewsSourceTestCase extends SimplenewsTestCase {
     // Report time. @todo: Find a way to actually do some assertions here.
     $this->pass(t('Mails have been sent in @sec seconds with caching disabled.', array('@sec' => round($after - $before, 3))));
   }
+
 }
