diff --git a/includes/handlers/pay.inc b/includes/handlers/pay.inc
index 8571dc6..0e6bc8b 100644
--- a/includes/handlers/pay.inc
+++ b/includes/handlers/pay.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
@@ -18,12 +19,12 @@ class pay {
   function __construct($values = NULL) {
     $current = (array) $this;
     if ($values) {
-      foreach ((array)$values as $name => $val) {
+      foreach ((array) $values as $name => $val) {
         if ($name == 'settings' && !empty($val) && is_scalar($val)) {
           $this->__construct(unserialize($val));
         }
         elseif (array_key_exists($name, $current) && !is_null($val)) {
-          $func = 'set_'. $name;
+          $func = 'set_' . $name;
           if (method_exists($this, $func)) {
             $this->$func($val);
           }
@@ -36,7 +37,7 @@ class pay {
     }
     // Set defaults if possible.
     foreach ($current as $name => $val) {
-      $func = 'set_'. $name;
+      $func = 'set_' . $name;
       if (method_exists($this, $func)) {
         $this->$func($this->$name);
       }
@@ -58,7 +59,9 @@ class pay {
   }
 
   function set_hostname($val = NULL) {
-    if (!$val) $val = ip_address();
+    if (!$val) {
+      $val = ip_address();
+    }
     $this->hostname = check_plain($val);
   }
 
@@ -83,9 +86,13 @@ class pay {
   }
 
   function timestamp_value($val = NULL) {
-    if (!$val) $val = time();
-    if (!is_numeric($val)) $val = strtotime($val);
-    return (int)$val;
+    if (!$val) {
+      $val = time();
+    }
+    if (!is_numeric($val)) {
+      $val = strtotime($val);
+    }
+    return (int) $val;
   }
 
   function set_created($val = NULL) {
@@ -107,11 +114,13 @@ class pay {
       global $user;
       $val = $user->uid;
     }
-    $this->uid = (int)$val;
+    $this->uid = (int) $val;
   }
 
   function set_mail($val = NULL) {
-    if (valid_email_address($val)) $this->mail = $val;
+    if (valid_email_address($val)) {
+      $this->mail = $val;
+    }
   }
 
   function set_handler() {
@@ -140,7 +149,9 @@ class pay {
   }
 
   function menu_path() {
-    if ($this->menu_path) return check_plain($this->menu_path);
+    if ($this->menu_path) {
+      return check_plain($this->menu_path);
+    }
   }
 
   function title() {
@@ -161,7 +172,7 @@ class pay {
       $total .= '.00';
     }
     if (strpos($total, '.') === 0) {
-      $total = '0.'. $total;
+      $total = '0.' . $total;
     }
     return $total;
   }
@@ -173,15 +184,21 @@ class pay {
   }
 
   function pay_form() {
-    if ($this->pfid) return pay_form_load($this->pfid);
+    if ($this->pfid) {
+      return pay_form_load($this->pfid);
+    }
   }
 
   function pay_transaction() {
-    if ($this->pxid) return pay_transaction_load($this->pxid);
+    if ($this->pxid) {
+      return pay_transaction_load($this->pxid);
+    }
   }
 
   function pay_activity() {
-    if ($this->paid) return pay_activity_load($this->paid);
+    if ($this->paid) {
+      return pay_activity_load($this->paid);
+    }
   }
 
   function form_setup(&$form, &$form_state, $form_type = 'form') {
@@ -194,7 +211,7 @@ class pay {
     // form). Set the POSTed values.
     if (!$form_state['submitted'] && isset($_REQUEST[$handler])) {
       foreach ($_REQUEST[$handler] as $posted_name => $posted_val) {
-        $func = 'set_'. $posted_name;
+        $func = 'set_' . $posted_name;
 
         // It is up to the handler to sanitize the value in its set_* functions.
         if (method_exists($this, $func)) {
@@ -215,9 +232,9 @@ class pay {
 
     $class = array(
       'pay',
-      'pay-'. $form_type,
-      'pay-'. $handler,
-      'pay-'. $form_type .'-'. $form_state['pay_form_type'],
+      'pay-' . $form_type,
+      'pay-' . $handler,
+      'pay-' . $form_type . '-' . $form_state['pay_form_type'],
     );
     $form['#attributes']['class'] = empty($form['#attributes']['class']) ? join(' ', $class) : $form['#attributes']['class'] . ' ' . join(' ', $class);
 
@@ -245,8 +262,7 @@ class pay {
     }
   }
 
-  function settings_form_validate($form, &$form_state) {
-  }
+  function settings_form_validate($form, &$form_state) { }
 
   function settings_form_submit($form, &$form_state) {
     $this->form_values($form_state);
@@ -258,11 +274,9 @@ class pay {
     $this->form_setup($form, $form_state);
   }
 
-  function form_validate($form, &$form_state) {
-  }
+  function form_validate($form, &$form_state) { }
 
-  function form_submit($form, &$form_state) {
-  }
+  function form_submit($form, &$form_state) { }
 
   function save($values = array()) {
     $this->__construct($values);
@@ -293,7 +307,9 @@ class pay {
 
   function permissions_settings($activity = 'view', $title = NULL) {
     $perm = $this->permissions[$activity];
-    if (!$title) $title = t('Permissions');
+    if (!$title) {
+      $title = t('Permissions');
+    }
 
     $element = array(
       '#type' => 'checkboxes',
@@ -322,21 +338,21 @@ class pay {
       'make payments on any form',
     );
     foreach (pay_handlers('pay_form') as $name => $info) {
-      $permissions[] = 'administer payments for '. $name .' forms';
-      $permissions[] = 'make payments on '. $name .' forms';
+      $permissions[] = 'administer payments for ' . $name . ' forms';
+      $permissions[] = 'make payments on ' . $name . ' forms';
     }
     foreach ($permissions as $name) {
-      $element['permission:'. $name] = array(
+      $element['permission:' . $name] = array(
         '#type' => 'checkbox',
         '#title' => t('Users of any role with the %perm permission', array('%perm' => $name)),
-        '#default_value' => $perm['permission:'. $name],
+        '#default_value' => $perm['permission:' . $name],
       );
     }
     foreach (user_roles() as $rid => $role) {
-      $element['role:'. $rid] = array(
+      $element['role:' . $rid] = array(
         '#type' => 'checkbox',
         '#title' => t('Members of the %role role', array('%role' => $role)),
-        '#default_value' => $perm['role:'. $rid],
+        '#default_value' => $perm['role:' . $rid],
       );
     }
 
@@ -350,28 +366,40 @@ class pay {
     }
 
     // In the absence of any permissions, default access to TRUE.
-    if (!is_array($this->permissions)) return TRUE;
+    if (!is_array($this->permissions)) {
+      return TRUE;
+    }
 
     if (is_array($this->permissions) && $perm = $this->permissions[$activity]) {
       foreach ($perm as $key => $status) {
-        if (!$status) continue;
+        if (!$status) {
+          continue;
+        }
 
         // The owner of this item.
         if ($key == 'owner' && $this->uid) {
-          if ($account->uid == $this->uid) return TRUE;
+          if ($account->uid == $this->uid) {
+            return TRUE;
+          }
         }
 
         // The 'Everyone' permission.
-        if ($key == 'all') return TRUE;
+        if ($key == 'all') {
+          return TRUE;
+        }
 
         // Any user with a named permission.
         if (substr($key, 0, 11) == 'permission:') {
-          if (user_access(substr($key, 11), $account)) return TRUE;
+          if (user_access(substr($key, 11), $account)) {
+            return TRUE;
+          }
         }
 
         // Any user with the defined role.
         if (substr($key, 0, 5) == 'role:') {
-          if (isset($account->roles[substr($key, 5)])) return TRUE;
+          if (isset($account->roles[substr($key, 5)])) {
+            return TRUE;
+          }
         }
       }
     }
@@ -386,7 +414,7 @@ class pay {
    */
   function drupal_invoke($hook, $values = array()) {
     foreach (module_implements($hook) as $name) {
-      $func = $name .'_'. $hook;
+      $func = $name . '_' . $hook;
       $func($this, $values);
     }
   }
diff --git a/includes/handlers/pay_activity.inc b/includes/handlers/pay_activity.inc
index 142cc77..6e50572 100644
--- a/includes/handlers/pay_activity.inc
+++ b/includes/handlers/pay_activity.inc
@@ -46,7 +46,7 @@ class pay_activity extends pay {
    * Set the $data value, which is stored as a serialized value in the database.
    */
   function set_data($value = NULL) {
-    if(!empty($value) && is_scalar($value)) {
+    if (!empty($value) && is_scalar($value)) {
       $this->data = unserialize($value);
     }
     else {
diff --git a/includes/handlers/pay_form.inc b/includes/handlers/pay_form.inc
index 324e2c2..c54b1d8 100644
--- a/includes/handlers/pay_form.inc
+++ b/includes/handlers/pay_form.inc
@@ -35,7 +35,9 @@ class pay_form extends pay {
   function set_transaction($values) {
     module_load_include('inc', 'pay', 'includes/handlers/pay_transaction');
     $this->transaction = New pay_transaction($values);
-    if (!$this->transaction->pfid) $this->transaction->pfid = $this->pfid;
+    if (!$this->transaction->pfid) {
+      $this->transaction->pfid = $this->pfid;
+    }
     $this->transaction->save($values);
     return $this->transaction;
   }
@@ -50,7 +52,7 @@ class pay_form extends pay {
    *  as needed.
    */
   function set_valid_actions($pay_transaction, &$actions) {
-    foreach($this->pay_methods() as $pay_method) {
+    foreach ($this->pay_methods() as $pay_method) {
       $pay_method->set_valid_actions($this, $actions);
     }
   }
@@ -71,9 +73,10 @@ class pay_form extends pay {
       // set this variable and deal with the conversion fallout responsibly.
       if (variable_get('pay_currency_multiple', FALSE)) {
         foreach ($this->pay_methods() as $method) {
-          foreach ($method->available_currencies() as $currency)
-          if (!isset($this->currency_list[$currency])) {
-            $this->currency_list[$currency] = $currency;
+          foreach ($method->available_currencies() as $currency) {
+            if (!isset($this->currency_list[$currency])) {
+              $this->currency_list[$currency] = $currency;
+            }
           }
         }
       }
@@ -93,14 +96,20 @@ class pay_form extends pay {
   }
 
   function currency() {
-    if (!isset($this->currency)) $this->set_currency();
+    if (!isset($this->currency)) {
+      $this->set_currency();
+    }
     return $this->currency;
   }
 
   function user_register() {
     global $user;
-    if ($user->uid) return FALSE;
-    if ($this->user_register == 'none') return FALSE;
+    if ($user->uid) {
+      return FALSE;
+    }
+    if ($this->user_register == 'none') {
+      return FALSE;
+    }
     return $this->user_register;
   }
 
@@ -141,7 +150,7 @@ class pay_form extends pay {
         '#title' => t('Title'),
         '#default_value' => $this->title,
         '#required' => TRUE,
-        '#description' => t('This title will appear as the title of the form page and in listings.')
+        '#description' => t('This title will appear as the title of the form page and in listings.'),
       );
     }
 
@@ -172,18 +181,18 @@ class pay_form extends pay {
     /**
      * @todo Disable this until it's ready for prime time.
      *
-    $form[$group]['user_register'] = array(
-      '#type' => 'radios',
-      '#title' => t('Provide a user registration form'),
-      '#description' => t('Allow users to register or login while making a payment.'),
-      '#options' => array(
-        'none' => t('No: Transactions will be recorded anonymously.'),
-        'optional' => t('Optional: If users do not register or login, their transaction will be recorded anonymously.'),
-        'required' => t('Required: Users must register or login and payments will be associated with their account.'),
-      ),
-      '#default_value' => $this->user_register,
-    );
-    */
+     $form[$group]['user_register'] = array(
+     '#type' => 'radios',
+     '#title' => t('Provide a user registration form'),
+     '#description' => t('Allow users to register or login while making a payment.'),
+     '#options' => array(
+     'none' => t('No: Transactions will be recorded anonymously.'),
+     'optional' => t('Optional: If users do not register or login, their transaction will be recorded anonymously.'),
+     'required' => t('Required: Users must register or login and payments will be associated with their account.'),
+     ),
+     '#default_value' => $this->user_register,
+     );
+     */
   }
 
   function pay_methods() {
@@ -212,7 +221,7 @@ class pay_form extends pay {
       // Make sure each payment method has a total.
       if (!isset($form[$group]['pay_method'][$pmid]['total'])) {
         $form[$group]['pay_method'][$pmid]['total'] = array(
-          '#type'  => 'value',
+          '#type' => 'value',
           '#value' => 0.00,
         );
       }
@@ -293,7 +302,9 @@ class pay_form extends pay {
         }
 
         // Keep track of any visible elements.
-        if ($form[$group][$key]['#access'] !== FALSE) $visible[] = $key;
+        if ($form[$group][$key]['#access'] !== FALSE) {
+          $visible[] = $key;
+        }
 
         // Change the 'action' to the ultimate destination for the form.
         $form['#action'] = url($this->menu_path());
@@ -338,12 +349,14 @@ class pay_form extends pay {
 
     // If there is no total value per payment method, set the global total.
     foreach ($values['pay_method']['selected'] as $pmid => $status) {
-      if (!$status) continue;
+      if (!$status) {
+        continue;
+      }
       $method_values = $values['pay_method'][$pmid];
       $method_values['pmid'] = $pmid;
       $method_element = $form[$group]['pay_method'][$pmid];
       if (!$method_values['total']) {
-        form_set_value($method_element['total'], (float)$total, $form_state);
+        form_set_value($method_element['total'], (float) $total, $form_state);
         $method_values['total'] = $total;
       }
       $pay_method = pay_method_load($method_values);
@@ -382,10 +395,14 @@ class pay_form extends pay {
 
     // Run payment activities for the 1 or more selected payment methods.
     $selected = $values['pay_method']['selected'];
-    if (!is_array($selected)) $selected = array($selected => 1);
+    if (!is_array($selected)) {
+      $selected = array($selected => 1);
+    }
 
     foreach ($selected as $pmid => $status) {
-      if (!$status) continue;
+      if (!$status) {
+        continue;
+      }
       $method_values = $values['pay_method'][$pmid];
       $method_values['pmid'] = $pmid;
       $pay_method = pay_method_load($method_values);
diff --git a/includes/handlers/pay_item.inc b/includes/handlers/pay_item.inc
index 574f65c..8a0ad32 100644
--- a/includes/handlers/pay_item.inc
+++ b/includes/handlers/pay_item.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
diff --git a/includes/handlers/pay_method.inc b/includes/handlers/pay_method.inc
index 662b51f..c8f68c9 100644
--- a/includes/handlers/pay_method.inc
+++ b/includes/handlers/pay_method.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
@@ -42,7 +43,7 @@ class pay_method extends pay {
    *  An array of default actions, passed by reference. Modify or augment this
    *  as needed.
    */
-  function set_valid_actions($pay_form, &$actions) {}
+  function set_valid_actions($pay_form, &$actions) { }
 
   /**
    * Determine whether an action is valid and appropraite for a transaction.
diff --git a/includes/handlers/pay_method_direct.inc b/includes/handlers/pay_method_direct.inc
index 74c3e3d..1879358 100644
--- a/includes/handlers/pay_method_direct.inc
+++ b/includes/handlers/pay_method_direct.inc
@@ -12,16 +12,14 @@ class pay_method_direct extends pay_method {
    * This method will be called when the user needs to be sent to the gateway
    * provider for processing.  Override it to include valid request values.
    */
-  function direct_request() {
-  }
+  function direct_request() { }
 
   /**
    * This method will be called on a return response (e.g. PayPal IPN)
    * including an unfiltered version of the $_REQUEST array.  This method must
    * be extended in order for your direct method to work!
    */
-  function direct_response($response = array()) {
-  }
+  function direct_response($response = array()) { }
 
   /**
    * Augment the available payment actions for transactions that include
@@ -117,33 +115,33 @@ class pay_method_direct extends pay_method {
     }
     $method_form = array();
     $method_form['first_name'] = array(
-      '#type'       => 'textfield',
-      '#title'      => t('First name'),
-      '#required'   => TRUE,
+      '#type' => 'textfield',
+      '#title' => t('First name'),
+      '#required' => TRUE,
     );
     $method_form['last_name'] = array(
-      '#type'       => 'textfield',
-      '#title'      => t('Last name'),
-      '#required'   => TRUE,
+      '#type' => 'textfield',
+      '#title' => t('Last name'),
+      '#required' => TRUE,
     );
     if ($user->uid) {
       $method_form['mail'] = array(
-        '#type'       => 'value',
-        '#value'      => $user->mail,
+        '#type' => 'value',
+        '#value' => $user->mail,
       );
     }
     else {
       $method_form['mail'] = array(
-        '#type'       => 'textfield',
-        '#title'      => t('E-mail'),
-        '#required'   => TRUE,
+        '#type' => 'textfield',
+        '#title' => t('E-mail'),
+        '#required' => TRUE,
       );
     }
     $method_form['billto'] = array(
-      '#type'       => 'postal',
+      '#type' => 'postal',
       '#postal_user' => $user,
-      '#title'      => t('Billing address'),
-      '#required'   => TRUE,
+      '#title' => t('Billing address'),
+      '#required' => TRUE,
     );
 
     // Add this method_form to the expected place on the parent form.
diff --git a/includes/handlers/pay_method_gateway.inc b/includes/handlers/pay_method_gateway.inc
index 5d036c2..6d324d4 100644
--- a/includes/handlers/pay_method_gateway.inc
+++ b/includes/handlers/pay_method_gateway.inc
@@ -65,7 +65,9 @@ class pay_method_gateway extends pay_method {
     $result = $this->execute($this->activity);
 
     // If successful, increase the 'captured' balance.
-    if ($result) $this->activity->set_transaction_total($this->activity->total);
+    if ($result) {
+      $this->activity->set_transaction_total($this->activity->total);
+    }
 
     // If the transaction's state is 'pending', this is an auth_capture
     // action. We don't have enough to complete it, so return a failed state.
@@ -83,8 +85,7 @@ class pay_method_gateway extends pay_method {
   /**
    * Refund a transaction.
    */
-  function refund_action() {
-  }
+  function refund_action() { }
 
   /**
    * Cancel a transaction.
@@ -100,7 +101,7 @@ class pay_method_gateway extends pay_method {
    * Returning NULL prevents anything from executing. Subclasses are responsible
    * for returning a responsible url.
    */
-  function gateway_url() {}
+  function gateway_url() { }
 
   /**
    * The request data that will be sent to your gatway provider.
@@ -108,7 +109,7 @@ class pay_method_gateway extends pay_method {
    * Returning NULL prevents anything from executing. Subclasses are responsible
    * for returning responsible request data.
    */
-  function gateway_request() {}
+  function gateway_request() { }
 
   /**
    * HTTP headers that should be sent to the gateway provider.
@@ -123,7 +124,7 @@ class pay_method_gateway extends pay_method {
     return array();
   }
 
-  function gateway_response() {}
+  function gateway_response() { }
 
   function execute($activity) {
     if ($request = $this->gateway_request()) {
@@ -186,65 +187,99 @@ class pay_method_gateway extends pay_method {
     $prefix5 = substr($this->cc_number, 0, 5);
     $prefix6 = substr($this->cc_number, 0, 6);
 
-   /**
-    * References: http://www.beachnet.com/~hstiles/cardtype.html
-    */
+    /**
+     * References: http://www.beachnet.com/~hstiles/cardtype.html
+     */
     switch ($prefix1) {
       case 1:
         // JCB: prefix 1800, length 15
-        if ($prefix4 == 1800) $this->cc_type = 'jcb';
+        if ($prefix4 == 1800) {
+          $this->cc_type = 'jcb';
+        }
         break;
 
       case 2:
         // JCB: prefix 2131, length 15
-        if ($prefix4 == 2131) $this->cc_type = 'jcb';
+        if ($prefix4 == 2131) {
+          $this->cc_type = 'jcb';
+        }
 
         // enRoute: prefix 2014, 2149 length 15
-        elseif ($prefix4 == 2014) $this->cc_type = 'enroute';
-        elseif ($prefix4 == 2149) $this->cc_type = 'enroute';
+        elseif ($prefix4 == 2014) {
+          $this->cc_type = 'enroute';
+        }
+        elseif ($prefix4 == 2149) {
+          $this->cc_type = 'enroute';
+        }
         break;
 
       case 3:
         // Diners Club: prefix 300-305, length 14
-        if (in_array($prefix3, array(300, 301, 302, 303, 304, 305))) $this->cc_type = 'diners';
+        if (in_array($prefix3, array(300, 301, 302, 303, 304, 305))) {
+          $this->cc_type = 'diners';
+        }
 
         // AmEX: prefix 34, 37, length 15
-        elseif (in_array($prefix2, array(34, 37))) $this->cc_type = 'amex';
+        elseif (in_array($prefix2, array(34, 37))) {
+          $this->cc_type = 'amex';
+        }
 
         // Diners Club: prefix 36, 38, length 14
-        elseif (in_array($prefix2, array(36, 38))) $this->cc_type = 'diners';
+        elseif (in_array($prefix2, array(36, 38))) {
+          $this->cc_type = 'diners';
+        }
 
         // JCB: prefix 3, length 16
-        else $this->cc_type = 'jcb';
+        else {
+          $this->cc_type = 'jcb';
+        }
         break;
 
       case 4:
         // Visa: prefix 4, length 13, 16
         $this->cc_type = 'visa';
         // Switch: prefix 4903, 4905, 4911, 4936
-        if (in_array($prefix4, array(4903, 4905, 4911, 4936))) $this->cc_type = 'switch';
+        if (in_array($prefix4, array(4903, 4905, 4911, 4936))) {
+          $this->cc_type = 'switch';
+        }
         break;
 
       case 5:
         // Mastercard: prefix 51-55, length 16
-        if (in_array($prefix2, array(51, 52, 53, 54, 55))) $this->cc_type = 'mc';
+        if (in_array($prefix2, array(51, 52, 53, 54, 55))) {
+          $this->cc_type = 'mc';
+        }
         // Switch: prefix 564182
-        if ($prefix6 == 564182) $this->cc_type = 'switch';
+        if ($prefix6 == 564182) {
+          $this->cc_type = 'switch';
+        }
         // Maestro: prefix 5018, 5020, 5038
-        if (in_array($prefix4, array(5018, 5020, 5038))) $this->cc_type = 'maestro';
+        if (in_array($prefix4, array(5018, 5020, 5038))) {
+          $this->cc_type = 'maestro';
+        }
         break;
 
       case 6:
         // Discover: prefix 6011, length 16
-        if ($prefix4 == 6011) $this->cc_type = 'discover';
+        if ($prefix4 == 6011) {
+          $this->cc_type = 'discover';
+        }
         // Laser: prefix 6304 or 6706 or 6709 or 6771, length 19
-        if ($prefix4 == 6304 || $prefix4 == 6706 || $prefix4 == 6709 || $prefix4 == 6771) $this->cc_type = 'laser';
+        if ($prefix4 == 6304 || $prefix4 == 6706 || $prefix4 == 6709 || $prefix4 == 6771) {
+          $this->cc_type = 'laser';
+        }
         // Switch: prefix 633110, 6333, 6759,
-        if ($prefix6 == 633110 || $prefix4 == 6333) $this->cc_type = 'switch';
+        if ($prefix6 == 633110 || $prefix4 == 6333) {
+          $this->cc_type = 'switch';
+        }
         // Maestro: prefix 6759, 6761, 6763
-        if (in_array($prefix4, array(6759, 6761, 6763))) $this->cc_type = 'maestro';
+        if (in_array($prefix4, array(6759, 6761, 6763))) {
+          $this->cc_type = 'maestro';
+        }
         // Solo: prefix 6334 or 6767
-        if ($prefix4 == 6334 || $prefix4 == 6767) $this->cc_type = 'solo';
+        if ($prefix4 == 6334 || $prefix4 == 6767) {
+          $this->cc_type = 'solo';
+        }
         break;
     }
     // Only if we still fail to determine card type, reset it to user supplied
@@ -297,7 +332,7 @@ class pay_method_gateway extends pay_method {
   }
 
   function cc_issue_number_validate() {
-    if ($this->cc_issue_number_required($this->cc_type) && (strlen($this->cc_issue_number) != 2|| !is_numeric($this->cc_issue_number))) {
+    if ($this->cc_issue_number_required($this->cc_type) && (strlen($this->cc_issue_number) != 2 || !is_numeric($this->cc_issue_number))) {
       $this->error_message = t('Invalid issue number.');
       return FALSE;
     }
@@ -326,7 +361,7 @@ class pay_method_gateway extends pay_method {
     if ($this->gateway_supports_cc) {
       $payment_types = array(
         'visa' => t('Visa'),
-        'mc'   => t('Mastercard'),
+        'mc' => t('Mastercard'),
         'amex' => t('American Express'),
         'discover' => t('Discover'),
         'diners' => t("Diner's Club"),
@@ -345,7 +380,9 @@ class pay_method_gateway extends pay_method {
 
     if ($filter) {
       foreach ($payment_types as $key => $label) {
-        if (!$filter[$key]) unset($payment_types[$key]);
+        if (!$filter[$key]) {
+          unset($payment_types[$key]);
+        }
       }
     }
     return $payment_types;
@@ -391,73 +428,75 @@ class pay_method_gateway extends pay_method {
     $method_form['#theme'] = 'pay_cc_form';
 
     $options = array();
-    if ($this->gateway_supports_cc) $options['cc'] = t('Credit or debit card');
+    if ($this->gateway_supports_cc) {
+      $options['cc'] = t('Credit or debit card');
+    }
     // TODO should reflect 'bank account' input here, but it's unsupported.
 
     $method_form['payment_type'] = array(
-      '#type'       => 'select',
-      '#title'      => t('Payment type'),
-      '#options'    => $options,
-      '#required'   => TRUE,
+      '#type' => 'select',
+      '#title' => t('Payment type'),
+      '#options' => $options,
+      '#required' => TRUE,
       '#default_value' => 'cc',
-      '#access'     => count($options) > 1,
+      '#access' => count($options) > 1,
     );
 
     $method_form['first_name'] = array(
-      '#type'       => 'textfield',
-      '#title'      => t('First name'),
+      '#type' => 'textfield',
+      '#title' => t('First name'),
       '#pre_render' => array('pay_element_set_required'),
     );
     $method_form['last_name'] = array(
-      '#type'       => 'textfield',
-      '#title'      => t('Last name'),
+      '#type' => 'textfield',
+      '#title' => t('Last name'),
       '#pre_render' => array('pay_element_set_required'),
     );
     if ($user->uid) {
       $method_form['mail'] = array(
-        '#type'       => 'value',
-        '#value'      => $user->mail,
+        '#type' => 'value',
+        '#value' => $user->mail,
       );
     }
     else {
       $method_form['mail'] = array(
-        '#type'       => 'textfield',
-        '#title'      => t('E-mail'),
+        '#type' => 'textfield',
+        '#title' => t('E-mail'),
         '#pre_render' => array('pay_element_set_required'),
       );
     }
     $method_form['billto'] = array(
-      '#type'       => 'postal',
+      '#type' => 'postal',
       '#postal_user' => $user,
-      '#title'      => t('Billing address'),
+      '#title' => t('Billing address'),
       '#pre_render' => array('pay_element_set_required'),
     );
     $method_form['cc_type'] = array(
-      '#type'       => 'radios',
-      '#title'      => t('Card type'),
-      '#options'    => $this->payment_types($this->payment_types),
+      '#type' => 'radios',
+      '#title' => t('Card type'),
+      '#options' => $this->payment_types($this->payment_types),
     );
     $method_form['cc_number'] = array(
-      '#type'        => 'textfield',
-      '#title'      => t('Card number'),
-      '#size'        => 19,
-      '#maxlength'  => 19,
+      '#type' => 'textfield',
+      '#title' => t('Card number'),
+      '#size' => 19,
+      '#maxlength' => 19,
       '#pre_render' => array('pay_element_set_required'),
       '#attributes' => array('autocomplete' => 'off'),
     );
     $method_form['cc_ccv2'] = array(
-      '#type'        => 'textfield',
-      '#title'      => t('Security code'),
-      '#size'        => 4,
-      '#maxlength'  => 4,
+      '#type' => 'textfield',
+      '#title' => t('Security code'),
+      '#size' => 4,
+      '#maxlength' => 4,
       '#attributes' => array('autocomplete' => 'off'),
     );
     if ($this->cc_issue_number_required()) {
       $method_form['cc_issue_number'] = array(
-        '#type'       => 'textfield',
-        '#title'      => t('Issue number'),
-        '#size'       => 2,
-        '#maxlength'  => 2,
+        '#type' => 'textfield',
+        '#title' => t('Issue number'),
+        '#size' => 2,
+        '#maxlength' => 2,
         '#attributes' => array('autocomplete' => 'off'),
       );
     }
@@ -465,11 +504,11 @@ class pay_method_gateway extends pay_method {
     $months = array();
     foreach (range(1, 12) as $i) {
       $key = str_pad($i, 2, '0', STR_PAD_LEFT);
-      $months[$key] = $key .'- '. date('F', strtotime('1-'. $i .'-2000'));
+      $months[$key] = $key . '- ' . date('F', strtotime('1-' . $i . '-2000'));
     }
     $method_form['cc_exp_month'] = array(
-      '#type'       => 'select',
-      '#options'    => $months,
+      '#type' => 'select',
+      '#options' => $months,
       '#pre_render' => array('pay_element_set_required'),
       '#attributes' => array('title' => t('Expiration month')),
     );
@@ -480,8 +519,8 @@ class pay_method_gateway extends pay_method {
       $years[substr($year, 2)] = $year;
     }
     $method_form['cc_exp_year'] = array(
-      '#type'       => 'select',
-      '#options'    => $years,
+      '#type' => 'select',
+      '#options' => $years,
       '#pre_render' => array('pay_element_set_required'),
       '#attributes' => array('title' => t('Expiration year')),
     );
diff --git a/includes/handlers/pay_transaction.inc b/includes/handlers/pay_transaction.inc
index d5015f5..2abc7ed 100644
--- a/includes/handlers/pay_transaction.inc
+++ b/includes/handlers/pay_transaction.inc
@@ -52,7 +52,9 @@ class pay_transaction extends pay {
         'description' => t('The transaction has been refunded.'),
       ),
     );
-    if ($state) return $states[$state];
+    if ($state) {
+      return $states[$state];
+    }
     return $states;
   }
 
@@ -60,20 +62,26 @@ class pay_transaction extends pay {
    * Set the state of this transaction.
    */
   function set_state($state = 'pending') {
-    if (array_key_exists($state, $this->states())) $this->state = $state;
+    if (array_key_exists($state, $this->states())) {
+      $this->state = $state;
+    }
   }
 
   /**
    * Return the current state of this transaction.
    */
   function state($title = FALSE) {
-    if (!$this->state) $this->set_state();
+    if (!$this->state) {
+      $this->set_state();
+    }
 
     if ($title) {
       $info = $this->states($this->state);
       return $info['title'];
     }
-    else return $this->state;
+    else {
+      return $this->state;
+    }
   }
 
   /**
@@ -88,30 +96,30 @@ class pay_transaction extends pay {
   function valid_actions($name = NULL) {
     // Create a default list of potential payment actions.
     $actions = array(
-     'authorize' => array(
-       'title' => t('Authorize'),
-       'callback' => 'authorize_action',
-       'valid states' => array('pending'),
+      'authorize' => array(
+        'title' => t('Authorize'),
+        'callback' => 'authorize_action',
+        'valid states' => array('pending'),
       ),
-      'complete'  => array(
+      'complete' => array(
         'title' => t('Complete'),
         'message' => t('Transaction completed'),
         'callback' => 'complete_action',
         'valid states' => array('pending', 'active'),
       ),
-      'cancel'      => array(
+      'cancel' => array(
         'title' => t('Cancel'),
         'message' => t('Transaction cancelled'),
         'callback' => 'cancel_action',
         'valid states' => array('pending', 'active'),
       ),
-      'refund'      => array(
+      'refund' => array(
         'title' => t('Refund'),
         'message' => t('Transaction has been refunded'),
         'callback' => 'refund_action',
         'valid states' => array('complete'),
       ),
-      'delete'      => array(
+      'delete' => array(
         'title' => t('Delete'),
         'message' => t('Transaction has been deleted'),
       ),
@@ -121,7 +129,9 @@ class pay_transaction extends pay {
     // The pay_form handler also calls set_valid_actions for each pay_method.
     $this->pay_form()->set_valid_actions($this, $actions);
 
-    if ($name) return $actions[$name];
+    if ($name) {
+      return $actions[$name];
+    }
     return $actions;
   }
 
@@ -134,7 +144,9 @@ class pay_transaction extends pay {
   function available_actions() {
     $actions = $this->valid_actions();
     foreach ($actions as $action => $info) {
-      if (!$this->valid_action($action)) unset($actions[$action]);
+      if (!$this->valid_action($action)) {
+        unset($actions[$action]);
+      }
     }
     return $actions;
   }
@@ -146,18 +158,26 @@ class pay_transaction extends pay {
     $valid = TRUE;
 
     // Special-case 'delete' pseudo-action.
-    if ($action == 'delete') return user_access('administer pay');
+    if ($action == 'delete') {
+      return user_access('administer pay');
+    }
 
     // Is it defined in our list of valid_actions?
-    if (!$info = $this->valid_actions($action)) return FALSE;
+    if (!$info = $this->valid_actions($action)) {
+      return FALSE;
+    }
 
     // Is the current workflow state compatible with this action?
-    if (!in_array($this->state(), $info['valid states'])) return FALSE;
+    if (!in_array($this->state(), $info['valid states'])) {
+      return FALSE;
+    }
 
     // Query each payment method in this transaction's history for validity.
     foreach ($this->pay_method_activities() as $pmid => $history) {
       $pay_method = pay_method_load($pmid);
-      if (!method_exists($pay_method, $info['callback'])) $valid = FALSE;
+      if (!method_exists($pay_method, $info['callback'])) {
+        $valid = FALSE;
+      }
       $valid = $valid && $pay_method->valid_action($action, $this, $history);
     }
 
@@ -190,7 +210,9 @@ class pay_transaction extends pay {
 
   function set_title($value = NULL) {
     // This is likely a dummy transaction.
-    if (!$this->pay_form()) return;
+    if (!$this->pay_form()) {
+      return;
+    }
 
     if (!$value) {
       $values = array(
@@ -220,7 +242,9 @@ class pay_transaction extends pay {
   }
 
   function currency() {
-    if (!($this->currency)) $this->set_currency();
+    if (!($this->currency)) {
+      $this->set_currency();
+    }
     return $this->currency;
   }
 
@@ -235,7 +259,9 @@ class pay_transaction extends pay {
   }
 
   function update_status($state = NULL, $timestamp = NULL) {
-    if (!$timestamp) $timestamp = time();
+    if (!$timestamp) {
+      $timestamp = time();
+    }
 
     $this->total_paid = db_result(db_query("SELECT SUM(transaction_total)
       FROM {pay_activity} WHERE pxid = %d", $this->pxid));
@@ -297,7 +323,9 @@ class pay_transaction extends pay {
     foreach ($this->activity() as $activity) {
       $activities[$activity->pmid][$activity->paid] = $activity;
     }
-    if ($pmid) return $activities[$pmid];
+    if ($pmid) {
+      return $activities[$pmid];
+    }
     return $activities;
   }
 }
diff --git a/includes/pay.admin.inc b/includes/pay.admin.inc
index ecf8250..80913ce 100644
--- a/includes/pay.admin.inc
+++ b/includes/pay.admin.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
@@ -16,11 +17,13 @@ function pay_admin_overview() {
   $hdrs = array(t('Label'), t('Handler'), t('Operations'));
   $info = pay_handlers('pay_method');
   foreach (pay_form_load()->pay_method_list() as $pmid => $pay_method) {
-    if (!$pay_method = pay_method_load($pmid)) continue;
+    if (!$pay_method = pay_method_load($pmid)) {
+      continue;
+    }
     $rows[] = array(
       $pay_method->title(),
       $info[$pay_method->handler()]['title'],
-      l(t('edit'), 'admin/settings/pay/'. $pmid .'/edit'),
+      l(t('edit'), 'admin/settings/pay/' . $pmid . '/edit'),
     );
   }
   if ($rows) {
@@ -88,12 +91,30 @@ function pay_admin_settings_submit($form, &$form_state) {
 function pay_admin_pay_form_list($handler = NULL, $uid = NULL) {
 
   $hdrs = array(
-    array('data' => t('Title'), 'field' => 'Title'),
-    array('data' => t('Owner'), 'field' => 'uid'),
-    array('data' => t('Handler'), 'field' => 'handler'),
-    array('data' => t('Status'), 'field' => 'status'),
-    array('data' => t('Total'), 'field' => 'total'),
-    array('data' => t('Total paid'), 'field' => 'total_paid'),
+    array(
+      'data' => t('Title'),
+      'field' => 'Title',
+    ),
+    array(
+      'data' => t('Owner'),
+      'field' => 'uid',
+    ),
+    array(
+      'data' => t('Handler'),
+      'field' => 'handler',
+    ),
+    array(
+      'data' => t('Status'),
+      'field' => 'status',
+    ),
+    array(
+      'data' => t('Total'),
+      'field' => 'total',
+    ),
+    array(
+      'data' => t('Total paid'),
+      'field' => 'total_paid',
+    ),
     array(),
   );
 
@@ -112,11 +133,11 @@ function pay_admin_pay_form_list($handler = NULL, $uid = NULL) {
     }
     if ($subclasses) {
       $subclasses[] = $handler;
-      $subclasses = "'" . join("', '", $subclasses) ."'";
-      $sql .= " WHERE f.handler IN (". $subclasses .")";
+      $subclasses = "'" . join("', '", $subclasses) . "'";
+      $sql .= " WHERE f.handler IN (" . $subclasses . ")";
     }
     else {
-      $sql .= " WHERE f.handler = '". check_plain($handler) ."'";
+      $sql .= " WHERE f.handler = '" . check_plain($handler) . "'";
     }
     unset($hdrs[2]);
   }
@@ -136,12 +157,16 @@ function pay_admin_pay_form_list($handler = NULL, $uid = NULL) {
       $pay_form->status ? t('active') : t('disabled'),
       round($data->total),
       round($data->total_paid),
-      l(t('edit'), $path .'/'. $pay_form->pfid .'/edit', array('query' => 'destination='. $path)),
+      l(t('edit'), $path . '/' . $pay_form->pfid . '/edit', array('query' => 'destination=' . $path)),
     );
-    if ($handler) unset($row[2]);
+    if ($handler) {
+      unset($row[2]);
+    }
     $rows[] = $row;
   }
-  if (empty($rows)) $rows[] = array();
+  if (empty($rows)) {
+    $rows[] = array();
+  }
 
   return theme('table', $hdrs, $rows);
 }
@@ -155,7 +180,9 @@ function pay_admin_method_form(&$form_state, $pay_method = NULL) {
   }
   if ($pay_method) {
     $form = array();
-    if (!is_object($pay_method)) $pay_method = pay_method_load($pay_method);
+    if (!is_object($pay_method)) {
+      $pay_method = pay_method_load($pay_method);
+    }
     $pay_method->settings_form($form, $form_state);
     $pmid = isset($pay_method->pmid) ? $pay_method->pmid : get_class($pay_method);
     $form['#pay_method'] = $pmid;
@@ -166,7 +193,9 @@ function pay_admin_method_form(&$form_state, $pay_method = NULL) {
       '#title' => t('Payment handler'),
     );
     foreach (pay_handlers('pay_method') as $name => $info) {
-      if (!$info['title']) continue; // Exclude unnamed base classes.
+      if (!$info['title']) {
+        continue; // Exclude unnamed base classes.
+      }
       $form['pay_method'][$name] = array(
         '#type' => 'radio',
         '#name' => 'pay_method',
@@ -207,7 +236,9 @@ function pay_admin_method_form_submit($form, &$form_state) {
 }
 
 function pay_form_settings(&$form_state, $pay_form, $destination = NULL) {
-  if (!is_object($pay_form)) $pay_form = pay_form_load($pay_form);
+  if (!is_object($pay_form)) {
+    $pay_form = pay_form_load($pay_form);
+  }
 
   $pay_form->settings_form($form, $form_state);
 
diff --git a/includes/pay.handlers.inc b/includes/pay.handlers.inc
index 71f46b9..5106a1c 100644
--- a/includes/pay.handlers.inc
+++ b/includes/pay.handlers.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
@@ -9,7 +10,7 @@
  * Implementation of hook_pay_method_handler_info().
  */
 function pay_pay_method_handler_info() {
-  $path = drupal_get_path('module', 'pay') .'/includes/handlers';
+  $path = drupal_get_path('module', 'pay') . '/includes/handlers';
   return array(
     'pay_method_custom' => array(
       'title' => t('Custom payment'),
diff --git a/includes/pay.menu.inc b/includes/pay.menu.inc
index 22cb47e..a93653f 100644
--- a/includes/pay.menu.inc
+++ b/includes/pay.menu.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
@@ -15,7 +16,7 @@ function pay_menu_menu() {
       'page callback' => 'pay_admin_overview',
       'access arguments' => array('administer pay'),
       'file' => 'pay.admin.inc',
-      'file path' => drupal_get_path('module', 'pay') .'/includes',
+      'file path' => drupal_get_path('module', 'pay') . '/includes',
       'description' => 'Configure payment methods and administer payment settings.',
     ),
     'admin/settings/pay/overview' => array(
@@ -29,7 +30,7 @@ function pay_menu_menu() {
       'page arguments' => array('pay_admin_method_form'),
       'access arguments' => array('administer pay'),
       'file' => 'pay.admin.inc',
-      'file path' => drupal_get_path('module', 'pay') .'/includes',
+      'file path' => drupal_get_path('module', 'pay') . '/includes',
       'type' => MENU_LOCAL_TASK,
     ),
     'admin/settings/pay/%pay_method/edit' => array(
@@ -38,7 +39,7 @@ function pay_menu_menu() {
       'page arguments' => array('pay_admin_method_form', 3),
       'access arguments' => array('administer pay'),
       'file' => 'pay.admin.inc',
-      'file path' => drupal_get_path('module', 'pay') .'/includes',
+      'file path' => drupal_get_path('module', 'pay') . '/includes',
     ),
     'pay/transaction/%pay_transaction' => array(
       'title' => 'Transaction details',
diff --git a/includes/pay.token.inc b/includes/pay.token.inc
index 0a50f7d..b974bc7 100644
--- a/includes/pay.token.inc
+++ b/includes/pay.token.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
@@ -41,5 +42,4 @@ function pay_token_list($type = 'all') {
 /**
  * Implementation of hook_token_values().
  */
-function pay_token_values($type = 'all', $object = NULL) {
-}
+function pay_token_values($type = 'all', $object = NULL) { }
diff --git a/includes/pay.trigger.inc b/includes/pay.trigger.inc
index 8e4997d..7effdb6 100644
--- a/includes/pay.trigger.inc
+++ b/includes/pay.trigger.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
@@ -14,16 +15,16 @@ function pay_hook_info() {
   foreach (pay_handlers('pay_form') as $name => $info) {
     $replace = array('@type' => $info['title']);
 
-    $hooks['pay']['pay'][$name .'_transaction_create'] = array(
+    $hooks['pay']['pay'][$name . '_transaction_create'] = array(
       'runs when' => t('@type: A new payment transaction is created but no payment activites have been attempted', $replace),
     );
-    $hooks['pay']['pay'][$name .'_activity_create'] = array(
+    $hooks['pay']['pay'][$name . '_activity_create'] = array(
       'runs when' => t('@type: A payment activity has occurred, but the transaction is not yet complete', $replace),
     );
-    $hooks['pay']['pay'][$name .'_transaction_complete'] = array(
+    $hooks['pay']['pay'][$name . '_transaction_complete'] = array(
       'runs when' => t('@type: A payment transaction has been completed', $replace),
     );
-    $hooks['pay']['pay'][$name .'_goal'] = array(
+    $hooks['pay']['pay'][$name . '_goal'] = array(
       'runs when' => t('@type: The form has a goal amount and that goal has been reached', $replace),
     );
   }
@@ -63,7 +64,9 @@ function pay_actions_do($hook, &$object) {
   if (module_exists('trigger')) {
     $context = array();
     foreach (_trigger_get_hook_aids('pay', $hook) as $aid => $action_info) {
-      if ($aid) actions_do($aid, $object, $context);
+      if ($aid) {
+        actions_do($aid, $object, $context);
+      }
     }
   }
 }
diff --git a/includes/views/pay.views.inc b/includes/views/pay.views.inc
index f8b6295..0e39fad 100644
--- a/includes/views/pay.views.inc
+++ b/includes/views/pay.views.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
@@ -161,7 +162,7 @@ function pay_views_data() {
     'field' => array(
       'handler' => 'pay_handler_field_amount',
       'click sortable' => TRUE,
-     ),
+    ),
     'filter' => array(
       'handler' => 'pay_handler_filter_amount',
     ),
diff --git a/includes/views/pay.views_default.inc b/includes/views/pay.views_default.inc
index d2a3e35..703e026 100644
--- a/includes/views/pay.views_default.inc
+++ b/includes/views/pay.views_default.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
diff --git a/includes/views/pay_handler_argument_default_form.inc b/includes/views/pay_handler_argument_default_form.inc
index 072afdb..bed1864 100644
--- a/includes/views/pay_handler_argument_default_form.inc
+++ b/includes/views/pay_handler_argument_default_form.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 /**
  * @file
  * Contains the payment form from URL argument default plugin.
diff --git a/includes/views/pay_handler_field_amount.inc b/includes/views/pay_handler_field_amount.inc
index daf3a15..1b5fe3c 100644
--- a/includes/views/pay_handler_field_amount.inc
+++ b/includes/views/pay_handler_field_amount.inc
@@ -9,7 +9,7 @@ class pay_handler_field_amount extends views_handler_field_numeric {
     $join->construct('pay_transaction', 'pay_form', 'pfid', 'pfid');
     $pay_transaction_table = $this->query->ensure_table('pay_transaction', $this->table_alias, $join);
     $sum = 'SUM(' . $pay_transaction_table . '.' . $this->real_field . ')';
-    $field_alias = $this->query->add_field('', $sum, $this->real_field .'_amount');
+    $field_alias = $this->query->add_field('', $sum, $this->real_field . '_amount');
     $this->field_alias = $field = $field_alias;
 
     $this->add_additional_fields();
diff --git a/includes/views/pay_handler_field_count.inc b/includes/views/pay_handler_field_count.inc
index fa9b121..40b5f36 100644
--- a/includes/views/pay_handler_field_count.inc
+++ b/includes/views/pay_handler_field_count.inc
@@ -9,9 +9,9 @@ class pay_handler_field_count extends views_handler_field_numeric {
     $join->construct('pay_transaction', 'pay_form', 'pfid', 'pfid');
     $pay_transaction_table = $this->query->ensure_table('pay_transaction', $this->table_alias, $join);
     $count = 'COUNT(' . $pay_transaction_table . '.' . $this->real_field . ')';
-    $count = 'COUNT(' . $pay_transaction_table .'.uid)';
+    $count = 'COUNT(' . $pay_transaction_table . '.uid)';
 //    $this->query->add_groupby($pay_transaction_table .'.uid');
-    $field_alias = $this->query->add_field('', $count, $this->real_field .'_count');
+    $field_alias = $this->query->add_field('', $count, $this->real_field . '_count');
     $this->field_alias = $field = $field_alias;
 
     $this->add_additional_fields();
diff --git a/includes/views/pay_handler_field_handler.inc b/includes/views/pay_handler_field_handler.inc
index e1797bb..15a448f 100644
--- a/includes/views/pay_handler_field_handler.inc
+++ b/includes/views/pay_handler_field_handler.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
diff --git a/includes/views/pay_handler_field_pay_form.inc b/includes/views/pay_handler_field_pay_form.inc
index c17beda..ce17533 100644
--- a/includes/views/pay_handler_field_pay_form.inc
+++ b/includes/views/pay_handler_field_pay_form.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
@@ -26,13 +27,13 @@ class pay_handler_field_pay_form extends views_handler_field {
   function render(&$values) {
     $key = $this->definition['pay_key'];
     if ($this->table != $this->query->base_table) {
-      $key = $this->field_alias ? $this->field_alias : $this->table .'_'. $key;
+      $key = $this->field_alias ? $this->field_alias : $this->table . '_' . $key;
     }
     if ($pay = pay_load($this->definition['pay_type'], $values->$key)) {
 
       /* TODO this is an inappropriate hack that presumes that a missing
-         menu_path() should be node/XX/pay on node-based views. This case is
-         only true on pay_node forms. This should move to that module somehow.
+       menu_path() should be node/XX/pay on node-based views. This case is
+       only true on pay_node forms. This should move to that module somehow.
        */
       if (!$pay->menu_path() && ($nid = $values->nid)) {
         $pay->set_menu_path('node/' . $nid . '/pay');
diff --git a/includes/views/pay_handler_field_pay_form_link.inc b/includes/views/pay_handler_field_pay_form_link.inc
index cb80ff7..1cb85a8 100644
--- a/includes/views/pay_handler_field_pay_form_link.inc
+++ b/includes/views/pay_handler_field_pay_form_link.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
@@ -9,7 +10,10 @@ class pay_handler_field_pay_form_link extends views_handler_field {
   function option_definition() {
     $options = parent::option_definition();
 
-    $options['text'] = array('default' => '', 'translatable' => TRUE);
+    $options['text'] = array(
+      'default' => '',
+      'translatable' => TRUE,
+    );
 
     return $options;
   }
@@ -27,7 +31,7 @@ class pay_handler_field_pay_form_link extends views_handler_field {
     // Id field is either 'pfid' or 'pay_form_pfid', depending on view's base.
     $key = $this->definition['pay_key'];
     if ($this->table != $this->query->base_table) {
-      $key = $this->field_alias ? $this->field_alias : $this->table .'_'. $key;
+      $key = $this->field_alias ? $this->field_alias : $this->table . '_' . $key;
     }
 
     if ($pay_form = pay_form_load($values->$key)) {
diff --git a/includes/views/pay_handler_field_pay_transaction_link.inc b/includes/views/pay_handler_field_pay_transaction_link.inc
index 0abdc96..a0ac82a 100644
--- a/includes/views/pay_handler_field_pay_transaction_link.inc
+++ b/includes/views/pay_handler_field_pay_transaction_link.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
@@ -10,7 +11,10 @@ class pay_handler_field_pay_transaction_link extends views_handler_field {
   function option_definition() {
     $options = parent::option_definition();
 
-    $options['text'] = array('default' => '', 'translatable' => TRUE);
+    $options['text'] = array(
+      'default' => '',
+      'translatable' => TRUE,
+    );
 
     return $options;
   }
@@ -28,11 +32,11 @@ class pay_handler_field_pay_transaction_link extends views_handler_field {
     // Id field is either 'pfid' or 'pay_form_pfid', depending on view's base.
     $key = $this->definition['pay_key'];
     if ($this->table != $this->query->base_table) {
-      $key = $this->field_alias ? $this->field_alias : $this->table .'_'. $key;
+      $key = $this->field_alias ? $this->field_alias : $this->table . '_' . $key;
     }
 
     if (isset($values->$key)) {
-      $path = 'pay/transaction/'. $values->$key;
+      $path = 'pay/transaction/' . $values->$key;
       $text = !empty($this->options['text']) ? $this->options['text'] : t('Details');
       return l($text, $path);
     }
diff --git a/includes/views/pay_handler_filter_amount.inc b/includes/views/pay_handler_filter_amount.inc
index e4ee6b9..7b1e2d3 100644
--- a/includes/views/pay_handler_filter_amount.inc
+++ b/includes/views/pay_handler_filter_amount.inc
@@ -18,7 +18,7 @@ class pay_handler_filter_amount extends views_handler_filter_numeric {
 
     return $options;
   }
-  
+
   function value_form(&$form, &$form_state) {
     $form['value']['#tree'] = TRUE;
 
@@ -102,14 +102,17 @@ class pay_handler_filter_amount extends views_handler_filter_numeric {
         // Ensure there is something in the 'value'.
         $form['value'] = array(
           '#type' => 'value',
-          '#value' => NULL
+          '#value' => NULL,
         );
       }
 
       $form['value']['value_or_goal'] = array(
         '#type' => 'select',
         '#title' => 'Value',
-        '#options' => array('value' => t('Enter a value'), 'goal' => t('Payment form goal amount')),
+        '#options' => array(
+          'value' => t('Enter a value'),
+          'goal' => t('Payment form goal amount'),
+        ),
         '#weight' => -1,
         '#default_value' => $this->value['value_or_goal'],
         '#process' => array('views_process_dependency'),
@@ -120,14 +123,14 @@ class pay_handler_filter_amount extends views_handler_filter_numeric {
       $form['value']['value']['#dependency_count'] = 2;
     }
   }
-  
+
   function query() {
     $this->ensure_my_table();
     $field = "$this->table_alias.$this->real_field";
     $sql = "SELECT SUM($this->real_field) FROM {pay_transaction} px WHERE px.pfid = $this->table_alias.pfid";
-    $field_alias = $this->query->add_field('', "($sql)", $this->real_field .'_total_paid');
+    $field_alias = $this->query->add_field('', "($sql)", $this->real_field . '_total_paid');
     $this->field_alias = $field = $field_alias;
- 
+
     $info = $this->operators();
     if (!empty($info[$this->operator]['method'])) {
       $this->{$info[$this->operator]['method']}($field);
diff --git a/includes/views/pay_handler_filter_handler.inc b/includes/views/pay_handler_filter_handler.inc
index 21f579a..a8f37d4 100644
--- a/includes/views/pay_handler_filter_handler.inc
+++ b/includes/views/pay_handler_filter_handler.inc
@@ -10,7 +10,7 @@ class pay_handler_filter_handler extends views_handler_filter_in_operator {
     if (!isset($this->value_options)) {
       $this->value_options = array();
       // Provide a list of available handlers to select from.
-      foreach(pay_handlers($this->pay_type) as $name => $info) {
+      foreach (pay_handlers($this->pay_type) as $name => $info) {
         $this->value_options[$name] = $info['title'];
       }
     }
diff --git a/modules/pay_node/includes/pay_node.admin.inc b/modules/pay_node/includes/pay_node.admin.inc
index 3b25de2..15d62a1 100644
--- a/modules/pay_node/includes/pay_node.admin.inc
+++ b/modules/pay_node/includes/pay_node.admin.inc
@@ -50,16 +50,16 @@ function pay_node_admin_settings(&$form_state) {
   return system_settings_form($form);
 }
 
-function  pay_node_admin_node_type_form_alter(&$form, &$form_state) {
+function pay_node_admin_node_type_form_alter(&$form, &$form_state) {
   $models = array_keys(array_filter(variable_get('pay_node_models', array())));
   $forms  = array_keys(array_filter(variable_get('pay_node_forms', array())));
   $suffix = '_' . $form['#node_type']->type;
 
   $form['pay_node'] = array(
-    '#type' =>  'fieldset',
-    '#title' =>  t('Payment settings'),
-    '#collapsible' =>  TRUE,
-    '#collapsed' =>  !variable_get('pay_node_enabled'. $suffix, FALSE),
+    '#type' => 'fieldset',
+    '#title' => t('Payment settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => !variable_get('pay_node_enabled' . $suffix, FALSE),
   );
 
   // Don't do anything further if there are no payment forms or modes available.
@@ -75,7 +75,7 @@ function  pay_node_admin_node_type_form_alter(&$form, &$form_state) {
   $form['pay_node']['pay_node_enabled'] = array(
     '#type' => 'checkbox',
     '#title' => t('Enable payments on this content type'),
-    '#default_value' => variable_get('pay_node_enabled'. $suffix, FALSE),
+    '#default_value' => variable_get('pay_node_enabled' . $suffix, FALSE),
     '#disabled' => (!count($models) || !count($forms)),
   );
 
@@ -95,7 +95,7 @@ function  pay_node_admin_node_type_form_alter(&$form, &$form_state) {
         'form' => 'Node creation',
         'view' => 'Node display',
       ),
-      '#default_value' => variable_get('pay_node_model'. $suffix, NULL),
+      '#default_value' => variable_get('pay_node_model' . $suffix, NULL),
     );
   }
 
@@ -112,7 +112,7 @@ function  pay_node_admin_node_type_form_alter(&$form, &$form_state) {
       '#type' => 'checkbox',
       '#title' => t('Require payment forms on @type nodes', array('@type' => $form['#node_type']->name)),
       '#description' => t('Require linked or new payment forms when creating or editing content.'),
-      '#default_value' => variable_get('pay_node_view_required'. $suffix, 0),
+      '#default_value' => variable_get('pay_node_view_required' . $suffix, 0),
     );
 
     $form['pay_node']['view_form']['pay_node_method'] = array(
@@ -122,10 +122,10 @@ function  pay_node_admin_node_type_form_alter(&$form, &$form_state) {
         'create' => t('Create a new form for every node'),
         'select' => t('Link to an existing form'),
       ),
-      '#default_value' => variable_get('pay_node_method'. $suffix, 'create'),
+      '#default_value' => variable_get('pay_node_method' . $suffix, 'create'),
     );
 
-    $embeddable = array( '' => ' - None -');
+    $embeddable = array('' => ' - None -');
     foreach (pay_forms(NULL, TRUE) as $pay_form) {
       $embeddable[$pay_form->pfid] = $pay_form->title();
     }
@@ -136,47 +136,47 @@ function  pay_node_admin_node_type_form_alter(&$form, &$form_state) {
     );
 
     /*
-    $handler = 'pay_donate'; // TODO
-    $settings = variable_get($handler . $suffix, array());
-    $settings['handler'] = $handler;
-    $settings_form = array();
-    $pay_form = pay_form_load($settings);
-    $pay_form->settings_form($form, $form_state);
-    if (isset($form[$handler])) {
-      $form[$handler]['#type'] = 'fieldset';
-      $form[$handler]['#collapsible'] = TRUE;
-      $form[$handler]['#title'] = $pay_form->title();
-
-      $form['pay_node']['view_form'][$handler] = $form[$handler];
-      $form[$handler]['#access'] = FALSE;
-    }
-
-    $form['#submit'][] = 'pay_test_submit';
-    */
+     $handler = 'pay_donate'; // TODO
+     $settings = variable_get($handler . $suffix, array());
+     $settings['handler'] = $handler;
+     $settings_form = array();
+     $pay_form = pay_form_load($settings);
+     $pay_form->settings_form($form, $form_state);
+     if (isset($form[$handler])) {
+     $form[$handler]['#type'] = 'fieldset';
+     $form[$handler]['#collapsible'] = TRUE;
+     $form[$handler]['#title'] = $pay_form->title();
+
+     $form['pay_node']['view_form'][$handler] = $form[$handler];
+     $form[$handler]['#access'] = FALSE;
+     }
+
+     $form['#submit'][] = 'pay_test_submit';
+     */
     /*
-    $pay_form->settings_form($settings_form, $form_state);
-    unset($settings_form['submit']);
+     $pay_form->settings_form($settings_form, $form_state);
+     unset($settings_form['submit']);
 
-    $settings_form['#type'] = 'fieldset';
-    $settings_form['#collapsible'] = TRUE;
-    $settings_form['#title'] = t('Default form options');
-    $settings_form['#tree'] = TRUE;
+     $settings_form['#type'] = 'fieldset';
+     $settings_form['#collapsible'] = TRUE;
+     $settings_form['#title'] = t('Default form options');
+     $settings_form['#tree'] = TRUE;
 
-    $form['pay_node']['view_form']['pay_node_view_default_create'] = $settings_form;
-    */
+     $form['pay_node']['view_form']['pay_node_view_default_create'] = $settings_form;
+     */
 
     $form['pay_node']['view_form']['pay_node_view_default_select'] = array(
       '#type' => 'select',
       '#title' => t('Default form selection'),
       '#options' => $embeddable,
-      '#default_value' => variable_get('pay_node_view_default_select'. $suffix, ''),
+      '#default_value' => variable_get('pay_node_view_default_select' . $suffix, ''),
     );
 
     $form['pay_node']['view_form']['pay_node_view_override'] = array(
       '#type' => 'checkbox',
       '#title' => t('Allow administrators to override the default form selection'),
       '#description' => t('Use the selected value by default, but present the selection to administrators so that they can link different @type nodes to different payment forms.', array('@type' => $form['#node_type']->name)),
-      '#default_value' => variable_get('pay_node_view_override'. $suffix, ''),
+      '#default_value' => variable_get('pay_node_view_override' . $suffix, ''),
     );
 
     $form['pay_node']['view_display'] = array(
@@ -192,7 +192,7 @@ function  pay_node_admin_node_type_form_alter(&$form, &$form_state) {
       '#type' => 'select',
       '#title' => t('Teaser display'),
       '#options' => $display_options,
-      '#default_value' => variable_get('pay_node_display_teaser'. $suffix, ''),
+      '#default_value' => variable_get('pay_node_display_teaser' . $suffix, ''),
     );
 
     $display_options += array('tab' => t('As a menu tab'));
@@ -201,7 +201,7 @@ function  pay_node_admin_node_type_form_alter(&$form, &$form_state) {
       '#type' => 'select',
       '#title' => t('Full node display'),
       '#options' => $display_options,
-      '#default_value' => variable_get('pay_node_display'. $suffix, 'pay_form_default'),
+      '#default_value' => variable_get('pay_node_display' . $suffix, 'pay_form_default'),
     );
   }
 
@@ -217,34 +217,34 @@ function  pay_node_admin_node_type_form_alter(&$form, &$form_state) {
     $form['pay_node']['pay_node_form'] = array(
       '#type' => 'select',
       '#options' => $forms,
-      '#default_value' => variable_get('pay_node_form'. $suffix, NULL),
+      '#default_value' => variable_get('pay_node_form' . $suffix, NULL),
     );
   }
 
   // Handler-specific settings
-    /*
-  foreach ($forms as $handler) {
-    $settings = variable_get('pay_node_'. $handler . $suffix, array());
-
-    $pay_form = pay_form_load($handler);
-    $pay_form->settings_form($form, $form_state);
-
-    if (isset($form[$handler])) {
-      $form[$handler]['#type'] = 'fieldset';
-      $form[$handler]['#collapsible'] = TRUE;
-      $form[$handler]['#title'] = $pay_form->title();
-
-      $form['pay_node']['pay_node_'. $handler] = $form[$handler];
-      $form[$handler]['#access'] = FALSE;
-    }
-    if (isset($form['pay_node']['pay_form_settings'][$handler])) {
-      $form['pay_node']['pay_form_settings'][$handler]['#type'] = 'fieldset';
-      $form['pay_node']['pay_form_settings'][$handler]['#collapsible'] = TRUE;
-      $form['pay_node']['pay_form_settings'][$handler]['#title'] = $handler;
-      $form['pay_node']['pay_form_settings'][$handler]['#tree'] = TRUE;
-    }
-  }
-    */
+  /*
+   foreach ($forms as $handler) {
+   $settings = variable_get('pay_node_'. $handler . $suffix, array());
+
+   $pay_form = pay_form_load($handler);
+   $pay_form->settings_form($form, $form_state);
+
+   if (isset($form[$handler])) {
+   $form[$handler]['#type'] = 'fieldset';
+   $form[$handler]['#collapsible'] = TRUE;
+   $form[$handler]['#title'] = $pay_form->title();
+
+   $form['pay_node']['pay_node_'. $handler] = $form[$handler];
+   $form[$handler]['#access'] = FALSE;
+   }
+   if (isset($form['pay_node']['pay_form_settings'][$handler])) {
+   $form['pay_node']['pay_form_settings'][$handler]['#type'] = 'fieldset';
+   $form['pay_node']['pay_form_settings'][$handler]['#collapsible'] = TRUE;
+   $form['pay_node']['pay_form_settings'][$handler]['#title'] = $handler;
+   $form['pay_node']['pay_form_settings'][$handler]['#tree'] = TRUE;
+   }
+   }
+   */
 }
 
 /**
@@ -253,28 +253,32 @@ function  pay_node_admin_node_type_form_alter(&$form, &$form_state) {
 function pay_node_admin_node_form_alter(&$form, &$form_state) {
   // Settings variable suffix.
   $node = $form['#node'];
-  $suffix = '_'. $form['#node']->type;
+  $suffix = '_' . $form['#node']->type;
 
   // Don't continue if pay_node settings aren't enabled for this node type.
-  if (!variable_get('pay_node_enabled'. $suffix, FALSE)) return;
+  if (!variable_get('pay_node_enabled' . $suffix, FALSE)) {
+    return;
+  }
 
   // Determine the payment model and verify that it's currently valid.
-  $model = variable_get('pay_node_model'. $suffix, NULL);
-  if (!in_array($model, variable_get('pay_node_models', array()))) return;
+  $model = variable_get('pay_node_model' . $suffix, NULL);
+  if (!in_array($model, variable_get('pay_node_models', array()))) {
+    return;
+  }
 
   // Add payment form settings on the node form to control how it's displayed.
   if ($model == 'view') {
-    $visible  = variable_get('pay_node_view_override'. $suffix, FALSE);
-    $required = variable_get('pay_node_view_required'. $suffix, FALSE);
+    $visible  = variable_get('pay_node_view_override' . $suffix, FALSE);
+    $required = variable_get('pay_node_view_required' . $suffix, FALSE);
 
     // The default settings are overrideable, so present some settings.
     if ($visible) {
-      switch (variable_get('pay_node_method'. $suffix, '')) {
+      switch (variable_get('pay_node_method' . $suffix, '')) {
 
         // Create a new payment form for each node using default values.
         case 'create':
           if (!$pay_form = pay_node_form_load($node)) {
-            $pay_form = pay_form_load(variable_get('pay_node_form'. $suffix, ''));
+            $pay_form = pay_form_load(variable_get('pay_node_form' . $suffix, ''));
           }
 
           if ($pay_form) {
@@ -283,19 +287,21 @@ function pay_node_admin_node_form_alter(&$form, &$form_state) {
 
             // Do not allow menu_path to be specified.
             $form[$group][$group]['menu_path'] = array(
-              '#type' => 'value', '#value' => '');
+              '#type' => 'value',
+              '#value' => '',
+            );
 
             // Add an after_build handler to map the pay_form to its node.
             $form['#after_build'][] = 'pay_node_admin_node_form_after_build';
           }
           break;
 
-        // Link to an existing form.
+          // Link to an existing form.
         case 'select':
           $group = 'pay_node';
 
           // List of available forms.
-          $options = array( '' =>  ' - None -');
+          $options = array('' => ' - None -');
           foreach (pay_forms(NULL, TRUE) as $pay_form) {
             $options[$pay_form->pfid] = $pay_form->title();
           }
@@ -324,11 +330,11 @@ function pay_node_admin_node_form_alter(&$form, &$form_state) {
 
     // The settings are NOT visible, so silently set the defaults.
     else {
-      switch (variable_get('pay_node_method'. $suffix, '')) {
+      switch (variable_get('pay_node_method' . $suffix, '')) {
         case 'create':
           break;
 
-        // Store the default selected form for this node type.
+          // Store the default selected form for this node type.
         case 'select':
           $pay_form_default = pay_node_form_load($node);
           $form['pay_node'] = array(
@@ -341,32 +347,32 @@ function pay_node_admin_node_form_alter(&$form, &$form_state) {
   }
 
   /*
-  if ($pay_form = pay_node_form_load($form['#node'])) {
-    $model = variable_get('pay_node_model_'. $form['#node']->type, NULL);
-    $active_models = variable_get('pay_node_models', array());
-    if ($active_models[$model]) {
-      if ($model == 'form') {
-        $pay_form->form($form, $form_state);
-      }
-
-      // Embed payment form settings into the node editing form.
-      if ($model == 'view') {
-        $pay_form->settings_form($form, $form_state);
-
-        // Add an after_build handler to map the pay_form to its node.
-        $form['#after_build'][] = 'pay_node_admin_node_form_after_build';
-
-        // Add a fieldset to differentiate the settings form.
-        $group = $pay_form->handler();
-        if (isset($form[$group])) {
-          $form[$group]['#type'] = 'fieldset';
-          $form[$group]['#collapsible'] = TRUE;
-          $form[$group]['#title'] = t('Payment settings');
-        }
-      }
-    }
-  }
-  */
+   if ($pay_form = pay_node_form_load($form['#node'])) {
+   $model = variable_get('pay_node_model_'. $form['#node']->type, NULL);
+   $active_models = variable_get('pay_node_models', array());
+   if ($active_models[$model]) {
+   if ($model == 'form') {
+   $pay_form->form($form, $form_state);
+   }
+
+   // Embed payment form settings into the node editing form.
+   if ($model == 'view') {
+   $pay_form->settings_form($form, $form_state);
+
+   // Add an after_build handler to map the pay_form to its node.
+   $form['#after_build'][] = 'pay_node_admin_node_form_after_build';
+
+   // Add a fieldset to differentiate the settings form.
+   $group = $pay_form->handler();
+   if (isset($form[$group])) {
+   $form[$group]['#type'] = 'fieldset';
+   $form[$group]['#collapsible'] = TRUE;
+   $form[$group]['#title'] = t('Payment settings');
+   }
+   }
+   }
+   }
+   */
 }
 
 function pay_test_submit($form, $form_state) {
diff --git a/modules/pay_node/includes/views/pay_node.views.inc b/modules/pay_node/includes/views/pay_node.views.inc
index 9b3a3bf..a4b5818 100644
--- a/modules/pay_node/includes/views/pay_node.views.inc
+++ b/modules/pay_node/includes/views/pay_node.views.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
diff --git a/modules/pay_node/includes/views/pay_node_handler_field_pay_form_link.inc b/modules/pay_node/includes/views/pay_node_handler_field_pay_form_link.inc
index 435b248..1d4e984 100644
--- a/modules/pay_node/includes/views/pay_node_handler_field_pay_form_link.inc
+++ b/modules/pay_node/includes/views/pay_node_handler_field_pay_form_link.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
diff --git a/modules/pay_node/pay_node.install b/modules/pay_node/pay_node.install
index c593cc0..b7dcb04 100644
--- a/modules/pay_node/pay_node.install
+++ b/modules/pay_node/pay_node.install
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
@@ -46,7 +47,10 @@ function pay_node_uninstall() {
  * Add a "method" column to the pay_form_node table.
  */
 function pay_node_update_6001() {
-  $spec = array('type' => 'varchar', 'length' => 20);
+  $spec = array(
+    'type' => 'varchar',
+    'length' => 20,
+  );
   db_add_field($ret, 'pay_form_node', 'method', $spec);
   $ret[] = update_sql("UPDATE {pay_form_node} SET method = 'create'");
   return $ret;
@@ -58,8 +62,14 @@ function pay_node_update_6001() {
 function pay_node_update_6002() {
   $table = array(
     'fields' => array(
-      'pxid' => array('type' => 'int', 'unsigned' => TRUE),
-      'nid' => array('type' => 'int', 'unsigned' => TRUE),
+      'pxid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+      ),
+      'nid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+      ),
     ),
     'primary key' => array('pxid', 'nid'),
   );
diff --git a/modules/pay_node/pay_node.module b/modules/pay_node/pay_node.module
index aaa3eab..7f33baa 100644
--- a/modules/pay_node/pay_node.module
+++ b/modules/pay_node/pay_node.module
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * Implementation of hook_menu().
@@ -11,7 +12,7 @@ function pay_node_menu() {
       'page arguments' => array('pay_node_admin_settings'),
       'access arguments' => array('administer pay'),
       'file' => 'pay_node.admin.inc',
-      'file path' => drupal_get_path('module', 'pay_node') .'/includes',
+      'file path' => drupal_get_path('module', 'pay_node') . '/includes',
       'type' => MENU_LOCAL_TASK,
     ),
     'node/%node/pay' => array(
@@ -28,8 +29,12 @@ function pay_node_menu() {
  * An access callback for payment forms.
  */
 function pay_node_pay_form_access($node) {
-  if (!$pay_form = pay_node_form_load($node)) return FALSE;
-  if (!$pay_form->pay_methods()) return FALSE;
+  if (!$pay_form = pay_node_form_load($node)) {
+    return FALSE;
+  }
+  if (!$pay_form->pay_methods()) {
+    return FALSE;
+  }
   return TRUE;
 }
 
@@ -53,7 +58,10 @@ function pay_node_form_alter(&$form, &$form_state, $form_id) {
   if (isset($form_state['pay_node'])) {
     $node = $form_state['pay_node'];
     if (isset($form['#pay'])) {
-      $form['pay_node_nid'] = array('#type' => 'value', '#value' => $node->nid);
+      $form['pay_node_nid'] = array(
+        '#type' => 'value',
+        '#value' => $node->nid,
+      );
       return;
     }
   }
@@ -75,14 +83,16 @@ function pay_node_nodeapi(&$node, $op, $teaser = NULL, $a4 = NULL) {
 
     // Determine the selected theme function for this node type.
     if ($teaser) {
-      $theme = variable_get('pay_node_display_teaser_'. $node->type, '');
+      $theme = variable_get('pay_node_display_teaser_' . $node->type, '');
     }
     else {
-      $theme = variable_get('pay_node_display_'. $node->type, 'pay_form_default');
+      $theme = variable_get('pay_node_display_' . $node->type, 'pay_form_default');
     }
 
     // Do not include anything for 'tab' or empty functions (hidden).
-    if (in_array($theme, array('', 'tab'))) return;
+    if (in_array($theme, array('', 'tab'))) {
+      return;
+    }
 
     // Add the pay_form's content to the node display.
     if (isset($node->pay_form->pfid)) {
@@ -90,7 +100,9 @@ function pay_node_nodeapi(&$node, $op, $teaser = NULL, $a4 = NULL) {
       if (function_exists('content_extra_field_weight')) {
         $weight = content_extra_field_weight($node->type, 'pay_node');
       }
-      else $weight = 25;
+      else {
+        $weight = 25;
+      }
 
       $node->content['pay_node'] = array(
         '#type' => 'markup',
@@ -103,8 +115,11 @@ function pay_node_nodeapi(&$node, $op, $teaser = NULL, $a4 = NULL) {
   // Create a record that links this payment form to this node.
   if ($op == 'insert' || $op == 'update') {
     if ($node->nid && isset($node->pay_node)) {
-      $method = variable_get('pay_node_method_'. $node->type, '');
-      $record = array('nid' => $node->nid, 'method' => $method);
+      $method = variable_get('pay_node_method_' . $node->type, '');
+      $record = array(
+        'nid' => $node->nid,
+        'method' => $method,
+      );
 
       // Link to an existing pay_form using its id.
       if (is_scalar($node->pay_node) && $node->pay_node) {
@@ -149,7 +164,7 @@ function pay_node_nodeapi(&$node, $op, $teaser = NULL, $a4 = NULL) {
 function pay_node_views_api() {
   return array(
     'api' => 2,
-    'path' => drupal_get_path('module', 'pay_node') .'/includes/views',
+    'path' => drupal_get_path('module', 'pay_node') . '/includes/views',
   );
 }
 
@@ -157,7 +172,7 @@ function pay_node_views_api() {
  * Implementation of hook_content_extra_fields().
  */
 function pay_node_content_extra_fields($type_name) {
-  if (variable_get('pay_node_enabled_'. $type_name, FALSE)) {
+  if (variable_get('pay_node_enabled_' . $type_name, FALSE)) {
     return array(
       'pay_node' => array(
         'label' => t('Payment information'),
@@ -175,11 +190,18 @@ function pay_node_pay_transaction_create(&$transaction, $values = array()) {
   if (isset($values['pay_node_nid']) && $nid = $values['pay_node_nid']) {
 
     // Verify that this node actually has a pay form and is the correct one.
-    if (!$pay_form = pay_node_form_load($nid)) return;
-    if ($pay_form->pfid != $transaction->pfid) return;
+    if (!$pay_form = pay_node_form_load($nid)) {
+      return;
+    }
+    if ($pay_form->pfid != $transaction->pfid) {
+      return;
+    }
 
     // Store a relationship between the transaction and the node it came from.
-    $record = array('nid' => $nid, 'pxid' => $transaction->pxid);
+    $record = array(
+      'nid' => $nid,
+      'pxid' => $transaction->pxid,
+    );
     drupal_write_record('pay_transaction_node', $record);
   }
 }
@@ -209,17 +231,25 @@ function pay_node_pay_form(&$form_state, $node) {
  */
 function pay_node_form_load($node) {
   // Allow this to work if we only get a nid.
-  if (is_scalar($node)) $node = node_load($node);
+  if (is_scalar($node)) {
+    $node = node_load($node);
+  }
 
   // Don't continue if pay_node settings aren't enabled for this node type.
-  if (!variable_get('pay_node_enabled_'. $node->type, FALSE)) return;
+  if (!variable_get('pay_node_enabled_' . $node->type, FALSE)) {
+    return;
+  }
 
   // Determine the pay_form handler for this type, and verify that it's enabled.
-  if (!$handler = variable_get('pay_node_form_'. $node->type, NULL)) return;
-  if (!array_key_exists($handler, array_filter(variable_get('pay_node_forms', array())))) return;
+  if (!$handler = variable_get('pay_node_form_' . $node->type, NULL)) {
+    return;
+  }
+  if (!array_key_exists($handler, array_filter(variable_get('pay_node_forms', array())))) {
+    return;
+  }
 
   // The linking method (create, select, etc.)
-  $method = variable_get('pay_node_method_'. $node->type, '');
+  $method = variable_get('pay_node_method_' . $node->type, '');
 
   // Load the pay_form that is associated with this node, if one exists.
   if ($node->nid) {
@@ -231,7 +261,7 @@ function pay_node_form_load($node) {
 
       if ($pay_form = pay_form_load($pfid)) {
         // Hard-code the payment form's URL.
-        $pay_form->set_menu_path('node/'. $node->nid .'/pay');
+        $pay_form->set_menu_path('node/' . $node->nid . '/pay');
       }
     }
 
@@ -246,7 +276,7 @@ function pay_node_form_load($node) {
 
     // The node is linked to a form. Use the default value.
     if ($method = 'select') {
-      if ($pfid = variable_get('pay_node_view_default_select_'. $node->type, '')) {
+      if ($pfid = variable_get('pay_node_view_default_select_' . $node->type, '')) {
         $pay_form = pay_form_load($pfid);
       }
     }
diff --git a/modules/pay_progress/theme/pay_progress.theme.inc b/modules/pay_progress/theme/pay_progress.theme.inc
index b7c6552..ac5d8fd 100644
--- a/modules/pay_progress/theme/pay_progress.theme.inc
+++ b/modules/pay_progress/theme/pay_progress.theme.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
@@ -9,7 +10,7 @@
  * Implementation of hook_theme().
  */
 function pay_progress_theme_theme() {
-  $path = drupal_get_path('module', 'pay_progress') .'/theme';
+  $path = drupal_get_path('module', 'pay_progress') . '/theme';
   return array(
     'pay_progress' => array(
       'arguments' => array('pay_form' => NULL, 'progress_type' => 'total'),
@@ -41,7 +42,7 @@ function theme_pay_progress_total_paid($pay_form) {
  */
 function template_preprocess_pay_progress(&$variables, $hook) {
   // Add base CSS for progress bar theming
-  drupal_add_css(drupal_get_path('module', 'pay_progress') .'/theme/pay_progress.css');
+  drupal_add_css(drupal_get_path('module', 'pay_progress') . '/theme/pay_progress.css');
 
   $pay_form = $variables['pay_form'];
 
diff --git a/pay.install b/pay.install
index 0b97ab9..a046c2f 100644
--- a/pay.install
+++ b/pay.install
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
@@ -336,7 +337,11 @@ function pay_update_6002() {
  */
 function pay_update_6003() {
   $ret = array();
-  $spec = array('type' => 'int', 'size' => 'tiny', 'default' => 0);
+  $spec = array(
+    'type' => 'int',
+    'size' => 'tiny',
+    'default' => 0,
+  );
   db_add_field($ret, 'pay_form', 'embeddable', $spec);
   return $ret;
 }
diff --git a/pay.module b/pay.module
index 365f670..3f7c32d 100644
--- a/pay.module
+++ b/pay.module
@@ -10,13 +10,13 @@
  */
 function pay_init() {
   if (module_exists('trigger')) {
-    include_once dirname(__FILE__) .'/includes/pay.trigger.inc';
+    include_once dirname(__FILE__) . '/includes/pay.trigger.inc';
   }
   if (module_exists('token')) {
-    include_once dirname(__FILE__) .'/includes/pay.token.inc';
+    include_once dirname(__FILE__) . '/includes/pay.token.inc';
   }
 
-  include_once dirname(__FILE__) .'/includes/pay.action.inc';
+  include_once dirname(__FILE__) . '/includes/pay.action.inc';
 }
 
 /**
@@ -40,9 +40,9 @@ function pay_perm() {
   );
 
   foreach (pay_handlers('pay_form') as $name => $info) {
-    $permissions[] = 'administer payments for '. $name .' forms';
-    $permissions[] = 'make payments on '. $name .' forms';
-    $permissions[] = 'view reports for '. $name .' forms';
+    $permissions[] = 'administer payments for ' . $name . ' forms';
+    $permissions[] = 'make payments on ' . $name . ' forms';
+    $permissions[] = 'view reports for ' . $name . ' forms';
   }
 
   return $permissions;
@@ -64,7 +64,7 @@ function pay_user($op, &$edit, &$account, $category = NULL) {
     case 'categories':
       // Return only a modes 'category' entry - the real work happens in the
       // page callback for payment settings.  See also hook_menu.
-      return array(array( 'name' => 'pay' ));
+      return array(array('name' => 'pay'));
 
     case 'delete':
       // Deactivate any payment forms this user may have created.
@@ -85,7 +85,9 @@ function pay_user_settings_access($account) {
   // Permit access if any module returns TRUE in hook_pay_user_settings_access()
   foreach (module_implements('pay_user_settings_access') as $module) {
     $func = $module . '_pay_user_settings_access';
-    if ($func($account)) return TRUE;
+    if ($func($account)) {
+      return TRUE;
+    }
   }
 
   // Return FALSE by default, thus hiding the 'Payment settings' form.
@@ -128,7 +130,7 @@ function pay_user_settings_form(&$form_state, $account, $category = 'default') {
 function pay_views_api() {
   return array(
     'api' => 2,
-    'path' => drupal_get_path('module', 'pay') .'/includes/views',
+    'path' => drupal_get_path('module', 'pay') . '/includes/views',
   );
 }
 
@@ -136,16 +138,22 @@ function pay_views_api() {
  * API Function: All available payment handlers.
  */
 function pay_handlers($type, $handler_name = NULL, $refresh = FALSE) {
-  static $handlers = array();;
+  static $handlers = array();
   if ($refresh || !isset($handlers[$type])) {
     module_load_include('handlers.inc', 'pay', 'includes/pay');
-    $handlers[$type] = module_invoke_all($type .'_handler_info');
+    $handlers[$type] = module_invoke_all($type . '_handler_info');
     foreach ($handlers[$type] as $name => $info) {
-      if (!isset($info['module'])) $handlers[$type][$name]['module'] = $name;
-      if (!isset($info['handler'])) $handlers[$type][$name]['handler'] = $name;
+      if (!isset($info['module'])) {
+        $handlers[$type][$name]['module'] = $name;
+      }
+      if (!isset($info['handler'])) {
+        $handlers[$type][$name]['handler'] = $name;
+      }
     }
   }
-  if ($handler_name) return $handlers[$type][$handler_name];
+  if ($handler_name) {
+    return $handlers[$type][$handler_name];
+  }
 
   return $handlers[$type];
 }
@@ -159,23 +167,29 @@ function pay_load_handler($type, $name) {
   if (!isset($cache[$type])) {
     // Base classes for handlers.
     module_load_include('inc', 'pay', 'includes/handlers/pay');
-    module_load_include('inc', 'pay', 'includes/handlers/'. $type);
+    module_load_include('inc', 'pay', 'includes/handlers/' . $type);
     $cache[$type] = array();
   }
 
   // This is a pay primitive class, so we're done.
-  if ($type == $name) return TRUE;
+  if ($type == $name) {
+    return TRUE;
+  }
 
   // Already loaded.
-  if (isset($cache[$type][$name])) return $cache[$type][$name];
+  if (isset($cache[$type][$name])) {
+    return $cache[$type][$name];
+  }
 
   if ($name && $handler = pay_handlers($type, $name)) {
     // Ensure the parent is loaded.
-    if (isset($handler['parent'])) pay_load_handler($type, $handler['parent']);
+    if (isset($handler['parent'])) {
+      pay_load_handler($type, $handler['parent']);
+    }
 
     // Respect the 'path' element that may have been specified.
-    $file = isset($handler['path']) ? $handler['path'] .'/' : '';
-    $file .= $name .'.inc';
+    $file = isset($handler['path']) ? $handler['path'] . '/' : '';
+    $file .= $name . '.inc';
 
     // Require the file, if it exists.
     if ($cache[$type][$name] = is_file($file)) {
@@ -191,11 +205,21 @@ function pay_load_handler($type, $name) {
 function pay_load($type, $values = NULL) {
   if (is_scalar($values)) {
     if (is_numeric($values)) {
-      if ($type == 'pay_form') $key = 'pfid';
-      if ($type == 'pay_method') $key = 'pmid';
-      if ($type == 'pay_item') $key = 'piid';
-      if ($type == 'pay_transaction') $key = 'pxid';
-      if ($type == 'pay_activity') $key = 'paid';
+      if ($type == 'pay_form') {
+        $key = 'pfid';
+      }
+      if ($type == 'pay_method') {
+        $key = 'pmid';
+      }
+      if ($type == 'pay_item') {
+        $key = 'piid';
+      }
+      if ($type == 'pay_transaction') {
+        $key = 'pxid';
+      }
+      if ($type == 'pay_activity') {
+        $key = 'paid';
+      }
       if ($values = db_fetch_object(db_query("SELECT * from {%s}
         WHERE $key = %d", $type, $values))) {
 
@@ -219,7 +243,7 @@ function pay_load($type, $values = NULL) {
     elseif (isset($values->pmid)) {
       $handler_values = pay_load($type, $values->pmid);
       $handler = get_class($handler_values);
-      $values = array_merge((array)$handler_values, (array)$values);
+      $values = array_merge((array) $handler_values, (array) $values);
     }
     else {
       // Allow return of a generic object of the type requested.
@@ -276,7 +300,9 @@ function pay_activity_load($values = NULL) {
  * the code from this function in your form builder or form_alter code.
  */
 function pay_form(&$form_state, $pay, $type = NULL, $form_type = 'default') {
-  if ($type) $pay = pay_load($type, $pay);
+  if ($type) {
+    $pay = pay_load($type, $pay);
+  }
 
   // Add a "build mode" to $form_state so that the form handlers can render
   // forms differently based on user-defined context.
@@ -337,7 +363,7 @@ function pay_form_callback($callback, &$form, &$form_state) {
     foreach ($form['#pay'] as $key => $item) {
       if ($pay = pay_load($item['type'], $item)) {
         $func = isset($item['form']) ? $item['form'] : 'form';
-        $func .= '_'. $callback;
+        $func .= '_' . $callback;
         if (method_exists($pay, $func)) {
           $pay->$func($form, $form_state);
         }
@@ -410,14 +436,18 @@ function pay_forms($handler = NULL, $embeddable = NULL, $status = 1) {
     $args[]  = $embeddable;
   }
   $sql = "SELECT * FROM {pay_form}";
-  if ($where) $sql .= ' WHERE '. join(' AND ', $where);
+  if ($where) {
+    $sql .= ' WHERE ' . join(' AND ', $where);
+  }
   $sql .= " ORDER BY title";
 
   $forms = array();
   $res = db_query($sql, $args);
 
   while ($row = db_fetch_object($res)) {
-    if ($pay_form = pay_form_load($row)) $forms[$row->pfid] = $pay_form;
+    if ($pay_form = pay_form_load($row)) {
+      $forms[$row->pfid] = $pay_form;
+    }
   }
   return $forms;
 }
@@ -452,7 +482,9 @@ function pay_currency_list() {
     }
 
     // Create a sorted key => value array.
-    foreach ($currencies as $item) $list[$item] = $item;
+    foreach ($currencies as $item) {
+      $list[$item] = $item;
+    }
     ksort($list);
     drupal_alter('pay_currency_list', $list);
   }
@@ -480,7 +512,9 @@ function pay_transaction_states($state = NULL) {
     }
   }
 
-  if (isset($state)) return $states[$state];
+  if (isset($state)) {
+    return $states[$state];
+  }
   return $states;
 }
 
@@ -489,7 +523,9 @@ function pay_transaction_states($state = NULL) {
  */
 function pay_transaction_state_name($state) {
   // It's a transaction object?  Function as a wrapper for its state() method.
-  if (is_object($state)) return $state->state(TRUE);
+  if (is_object($state)) {
+    return $state->state(TRUE);
+  }
 
   // Or else just return the label based on this name.
   return pay_transaction_states($state);
@@ -500,12 +536,18 @@ function pay_transaction_state_name($state) {
  */
 function pay_transaction_valid_action($pay_transaction, $action) {
   // Not a valid action for this transaction.  Skip it and return FALSE.
-  if (!$pay_transaction->valid_action($action)) return FALSE;
+  if (!$pay_transaction->valid_action($action)) {
+    return FALSE;
+  }
 
   // Return TRUE for payment administrators for this/all forms.
-  if (user_access('administer payments for any form')) return TRUE;
+  if (user_access('administer payments for any form')) {
+    return TRUE;
+  }
   $handler = $pay_transaction->pay_form()->handler();
-  if (user_access('administer payments for ' . $handler .' forms')) return TRUE;
+  if (user_access('administer payments for ' . $handler . ' forms')) {
+    return TRUE;
+  }
 
   // Give up and return false.
   return FALSE;
@@ -517,14 +559,18 @@ function pay_transaction_valid_action($pay_transaction, $action) {
 function pay_transaction_do_action($transaction, $action, $path = FALSE) {
   if ($transaction->do_action($action)) {
     $info = $transaction->valid_actions[$action];
-    if ($info['message']) drupal_set_message($info['message']);
+    if ($info['message']) {
+      drupal_set_message($info['message']);
+    }
   }
 
   // Redirect to the transaction page or the front page if it has been deleted.
   if ($path) {
     if ($path === TRUE) {
       $path = 'pay/transaction/' . $transaction->pxid;
-      if ($action == 'delete') $path = '<front>';
+      if ($action == 'delete') {
+        $path = '<front>';
+      }
     }
     drupal_goto($path);
   }
diff --git a/theme/pay.theme.inc b/theme/pay.theme.inc
index 1566ae8..dd61235 100644
--- a/theme/pay.theme.inc
+++ b/theme/pay.theme.inc
@@ -1,4 +1,5 @@
-<?php // $Id$
+<?php
+// $Id$
 
 /**
  * @file
@@ -9,7 +10,7 @@
  * Implementation of hook_theme().
  */
 function pay_theme_theme() {
-  $path = drupal_get_path('module', 'pay') .'/theme';
+  $path = drupal_get_path('module', 'pay') . '/theme';
 
   return array(
     // The all-purpose form renderer for payment forms.
@@ -57,7 +58,7 @@ function pay_theme_theme() {
     ),
     'pay_activity_list' => array(
       'arguments' => array('activity' => array()),
-    )
+    ),
   );
 }
 
@@ -100,7 +101,10 @@ function template_preprocess_pay_transaction(&$variables) {
     $links = array();
     foreach ($actions as $name => $info) {
       $href = 'pay/transaction/' . $pay_transaction->pxid . '/' . $name;
-      $links[$name] = array('href' => $href, 'title' => t($info['title']));
+      $links[$name] = array(
+        'href' => $href,
+        'title' => t($info['title']),
+      );
     }
     $variables['actions'] = theme_links($links, array('class' => 'pay-transaction-links'));
   }
@@ -124,7 +128,7 @@ function template_preprocess_pay_cc_form(&$variables) {
   if ($variables['element']['cc_type']) {
     $path = drupal_get_path('module', 'pay') . '/theme/images/';
     foreach ($variables['element']['cc_type']['#options'] as $card => $label) {
-      $variables['element']['cc_type'][$card]['#title'] = theme('image', $path. $card .'.png', $label);
+      $variables['element']['cc_type'][$card]['#title'] = theme('image', $path . $card . '.png', $label);
     }
   }
 
@@ -157,7 +161,8 @@ function template_preprocess_pay_cc_form(&$variables) {
 
   if ($first_time) {
     $variables['setup'] = $first_time;
-    $first_time = FALSE;  }
+    $first_time = FALSE;
+  }
   else {
     $variables['setup'] = FALSE;
   }
@@ -193,7 +198,7 @@ function theme_pay_activity_list($activity_list) {
 
     $row = array(
       format_date($activity->timestamp, 'small'),
-      $account->uid ? l($account->name, 'user/'. $account->uid) : '-',
+      $account->uid ? l($account->name, 'user/' . $account->uid) : '-',
       $activity->pay_method()->title(),
       theme('pay_money', $activity->total, $currency),
       theme('pay_money', $activity->balance(), $currency),
