From 33ee6b119062ab31ba2bdbc0dd63aba7d488fe19 Mon Sep 17 00:00:00 2001
From: Dan Chadwick <dan899@gmail.com>
Date: Tue, 12 May 2015 21:32:46 -0400
Subject: [PATCH] Issue #2487748 by DanChadwick: Coder review reveals
 whitespace and other style imperfections.

---
 components/file.inc                                |    2 +-
 components/grid.inc                                |    2 +-
 components/number.inc                              |   20 ++++++++++----------
 includes/exporters/webform_exporter.inc            |    3 +++
 includes/exporters/webform_exporter_delimited.inc  |    3 +++
 .../exporters/webform_exporter_excel_delimited.inc |    3 +++
 includes/exporters/webform_exporter_excel_xlsx.inc |    3 +++
 includes/webform.admin.inc                         |    2 +-
 includes/webform.conditionals.inc                  |    2 +-
 includes/webform.emails.inc                        |    6 +++---
 includes/webform.pages.inc                         |    2 +-
 includes/webform.report.inc                        |    6 +++---
 includes/webform.submissions.inc                   |    2 +-
 js/node-type-form.js                               |    5 +++++
 js/select-admin.js                                 |    1 -
 js/webform-admin.js                                |    5 +++--
 js/webform.js                                      |    2 +-
 tests/conditionals.test                            |    2 +-
 views/webform.views.inc                            |    2 +-
 views/webform_handler_field_node_link_results.inc  |    2 +-
 webform.drush.inc                                  |    2 ++
 webform.install                                    |    8 ++++----
 webform.module                                     |    2 +-
 23 files changed, 53 insertions(+), 34 deletions(-)

diff --git a/components/file.inc b/components/file.inc
index 6ec752c..3d80d7a 100644
--- a/components/file.inc
+++ b/components/file.inc
@@ -161,7 +161,7 @@ function _webform_edit_file($component) {
       '#type' => 'textfield',
       '#title' => t('Rename files'),
       '#default_value' => $component['extra']['rename'],
-      '#description' => t('You may optionally use tokens to create a pattern used to rename files upon submission. Omit the extension; it will be added automatically.').' '.theme('webform_token_help', array('groups' => array('node', 'submission'))),
+      '#description' => t('You may optionally use tokens to create a pattern used to rename files upon submission. Omit the extension; it will be added automatically.') . ' ' . theme('webform_token_help', array('groups' => array('node', 'submission'))),
       '#weight' => 6,
       '#element_validate' => array('_webform_edit_file_rename_validate'),
     );
diff --git a/components/grid.inc b/components/grid.inc
index 3e5bab8..60ae73a 100644
--- a/components/grid.inc
+++ b/components/grid.inc
@@ -104,7 +104,7 @@ function _webform_edit_grid($component) {
       '#type' => 'textarea',
       '#title' => t('Options'),
       '#default_value' => $component['extra']['options'],
-      '#description' => t('Options to select across the top. One option per line. <strong>Key-value pairs MUST be specified as "safe_key|Some readable option"</strong>. Use of only alphanumeric characters and underscores is recommended in keys.') . ' ' .theme('webform_token_help'),
+      '#description' => t('Options to select across the top. One option per line. <strong>Key-value pairs MUST be specified as "safe_key|Some readable option"</strong>. Use of only alphanumeric characters and underscores is recommended in keys.') . ' ' . theme('webform_token_help'),
       '#cols' => 60,
       '#rows' => 5,
       '#weight' => -3,
diff --git a/components/number.inc b/components/number.inc
index 9fe0bb5..6f90c36 100644
--- a/components/number.inc
+++ b/components/number.inc
@@ -477,7 +477,7 @@ function _webform_analysis_number($component, $sids = array(), $single = FALSE,
   if ($advanced_stats && $population_count && $sum != 0) {
     // Standard deviation.
     $stddev = 0;
-    foreach($population as $value) {
+    foreach ($population as $value) {
       // Obtain the total of squared variances.
       $stddev += pow(($value - $average), 2);
     }
@@ -522,21 +522,21 @@ function _webform_analysis_number($component, $sids = array(), $single = FALSE,
     $stddev = _webform_number_format($component, $stddev);
     $low = _webform_number_format($component, $population[0]);
     $high = _webform_number_format($component, end($population));
-    foreach($limit as $key => $value) {
+    foreach ($limit as $key => $value) {
       $limit[$key] = _webform_number_format($component, $value);
     }
 
     // Column headings (override potential theme uppercase, e.g. Seven in D7).
     $header = array(
       t('Normal Distribution'),
-      array('data' => '-4' . $sigma, 'style' => 'text-transform: lowercase;',),
-      array('data' => '-3' . $sigma, 'style' => 'text-transform: lowercase;',),
-      array('data' => '-2' . $sigma, 'style' => 'text-transform: lowercase;',),
-      array('data' => '-1' . $sigma, 'style' => 'text-transform: lowercase;',),
-      array('data' => '+1' . $sigma, 'style' => 'text-transform: lowercase;',),
-      array('data' => '+2' . $sigma, 'style' => 'text-transform: lowercase;',),
-      array('data' => '+3' . $sigma, 'style' => 'text-transform: lowercase;',),
-      array('data' => '+4' . $sigma, 'style' => 'text-transform: lowercase;',),
+      array('data' => '-4' . $sigma, 'style' => 'text-transform: lowercase;'),
+      array('data' => '-3' . $sigma, 'style' => 'text-transform: lowercase;'),
+      array('data' => '-2' . $sigma, 'style' => 'text-transform: lowercase;'),
+      array('data' => '-1' . $sigma, 'style' => 'text-transform: lowercase;'),
+      array('data' => '+1' . $sigma, 'style' => 'text-transform: lowercase;'),
+      array('data' => '+2' . $sigma, 'style' => 'text-transform: lowercase;'),
+      array('data' => '+3' . $sigma, 'style' => 'text-transform: lowercase;'),
+      array('data' => '+4' . $sigma, 'style' => 'text-transform: lowercase;'),
     );
 
     // Insert row labels.
diff --git a/includes/exporters/webform_exporter.inc b/includes/exporters/webform_exporter.inc
index 3de1396..de35630 100644
--- a/includes/exporters/webform_exporter.inc
+++ b/includes/exporters/webform_exporter.inc
@@ -1,7 +1,10 @@
 <?php
+
 /**
+ * @file
  * Base class defining the common methods available to exporters.
  */
+
 class webform_exporter {
   public $options = array();
   public $export_wordrap;
diff --git a/includes/exporters/webform_exporter_delimited.inc b/includes/exporters/webform_exporter_delimited.inc
index 1f523a3..b186cf0 100644
--- a/includes/exporters/webform_exporter_delimited.inc
+++ b/includes/exporters/webform_exporter_delimited.inc
@@ -1,7 +1,10 @@
 <?php
+
 /**
+ * @file
  * Webform exporter for creating CSV/TSV delimited files.
  */
+
 class webform_exporter_delimited extends webform_exporter {
   public $delimiter;
 
diff --git a/includes/exporters/webform_exporter_excel_delimited.inc b/includes/exporters/webform_exporter_excel_delimited.inc
index 963076a..9f77b89 100644
--- a/includes/exporters/webform_exporter_excel_delimited.inc
+++ b/includes/exporters/webform_exporter_excel_delimited.inc
@@ -1,7 +1,10 @@
 <?php
+
 /**
+ * @file
  * The Excel exporter currently is just a tab-delimited export.
  */
+
 class webform_exporter_excel_delimited extends webform_exporter_delimited {
   function __construct($options) {
     $options['delimiter'] = '\t';
diff --git a/includes/exporters/webform_exporter_excel_xlsx.inc b/includes/exporters/webform_exporter_excel_xlsx.inc
index dbdcaac..072a0b3 100644
--- a/includes/exporters/webform_exporter_excel_xlsx.inc
+++ b/includes/exporters/webform_exporter_excel_xlsx.inc
@@ -1,7 +1,10 @@
 <?php
+
 /**
+ * @file
  * This exporter creates an XLSX file readable by newer versions of Excel.
  */
+
 class webform_exporter_excel_xlsx extends webform_exporter {
   /**
    * Regular expression that checks for a valid ISO 8601 date/time.
diff --git a/includes/webform.admin.inc b/includes/webform.admin.inc
index 8306e87..e3cf957 100644
--- a/includes/webform.admin.inc
+++ b/includes/webform.admin.inc
@@ -241,7 +241,7 @@ function webform_admin_settings() {
     '#type' => 'textfield',
     '#title' => t("Select email mapping limit"),
     '#default_value' => webform_variable_get('webform_email_select_max'),
-    '#description' => t('When mapping emails addresses to a select component, limit the choice to components with less than the amount of options indicated. This is to avoid flooding the email settings form. '),
+    '#description' => t('When mapping emails addresses to a select component, limit the choice to components with less than the amount of options indicated. This is to avoid flooding the email settings form.'),
   );
 
   $form = system_settings_form($form);
diff --git a/includes/webform.conditionals.inc b/includes/webform.conditionals.inc
index 7578a7b..9da641e 100644
--- a/includes/webform.conditionals.inc
+++ b/includes/webform.conditionals.inc
@@ -277,7 +277,7 @@ function theme_webform_conditional_groups($variables) {
       }
       $even_odd = ($index + 1) % 2 ? 'odd' : 'even';
       $element[$key]['weight']['#attributes']['class'] = array('webform-conditional-weight');
-      $data = '<div class="webform-conditional-new">' . $data . t('Add a new condition: ') . drupal_render($element[$key]['new']) . '</div>';
+      $data = '<div class="webform-conditional-new">' . $data . t('Add a new condition:') . ' ' . drupal_render($element[$key]['new']) . '</div>';
       $output .= '<tr class="webform-conditional-new-row ' . $even_odd . '">';
       $output .= '<td>' . $data . '</td>';
       $output .= '<td>' . drupal_render($element[$key]['weight']) . '</td>';
diff --git a/includes/webform.emails.inc b/includes/webform.emails.inc
index 24f1f93..01c215c 100644
--- a/includes/webform.emails.inc
+++ b/includes/webform.emails.inc
@@ -436,10 +436,10 @@ function theme_webform_email_component_mapping($variables) {
   $table = theme('table', array('header' => $header, 'rows' => $rows, 'sticky' => FALSE, 'empty' => $empty));
   $description = t('The selected component %name has multiple options. You may enter an e-mail address for each choice.', array('%name' => $element['#title']));
   if ($element['#webform_allow_empty']) {
-    $description .= ' '. t('When that choice is selected, an e-mail will be sent to the corresponding address. If a field is left blank, no e-mail will be sent for that option.');
+    $description .= ' ' . t('When that choice is selected, an e-mail will be sent to the corresponding address. If a field is left blank, no e-mail will be sent for that option.');
   }
   else {
-    $description .= ' '. t('When that choice is selected, an e-mail will be sent from the corresponding address.');
+    $description .= ' ' . t('When that choice is selected, an e-mail will be sent from the corresponding address.');
   }
 
   $wrapper_element = array(
@@ -514,7 +514,7 @@ function webform_email_edit_form_submit($form, &$form_state) {
       // Merge the email mapping(s) into single value(s)
       $cid = $form_state['values'][$field . '_' . $option];
       if (is_numeric($cid) && isset($form_state['values'][$field . '_mapping'][$cid])) {
-        $email['extra'][$field .'_mapping'] = $form_state['values'][$field . '_mapping'][$cid];
+        $email['extra'][$field . '_mapping'] = $form_state['values'][$field . '_mapping'][$cid];
       }
     }
   }
diff --git a/includes/webform.pages.inc b/includes/webform.pages.inc
index 994a8ed..782dfb9 100644
--- a/includes/webform.pages.inc
+++ b/includes/webform.pages.inc
@@ -304,7 +304,7 @@ function webform_configure_form($form, &$form_state, $node) {
     '#title' => t('Preview message'),
     '#default_value' => $node->webform['preview_message'],
     '#format' => $node->webform['preview_message_format'],
-    '#description' => t('A message to be displayed on the preview page. If left blank, the message "!default" will be used. Supports Webform token replacements.', array('!default' => $preview_default_message))  . ' ' . theme('webform_token_help', array('groups' => array('node', 'submission'))),
+    '#description' => t('A message to be displayed on the preview page. If left blank, the message "!default" will be used. Supports Webform token replacements.', array('!default' => $preview_default_message)) . ' ' . theme('webform_token_help', array('groups' => array('node', 'submission'))),
   );
   $form['preview']['settings']['preview_components'] = array(
     '#type' => 'select',
diff --git a/includes/webform.report.inc b/includes/webform.report.inc
index c6b3e31..aa0633e 100644
--- a/includes/webform.report.inc
+++ b/includes/webform.report.inc
@@ -996,7 +996,7 @@ function webform_results_download_headers($node, $options) {
 function webform_results_download_rows($node, $options, $serial_start = 0, $last_sid = NULL) {
   // Get all the required submissions for the download.
   $filters['nid'] = $node->nid;
-  if (isset($options['sids'])){
+  if (isset($options['sids'])) {
     $filters['sid'] = $options['sids'];
   }
   elseif (!empty($options['completion_type']) && $options['completion_type'] !== 'all') {
@@ -1804,7 +1804,7 @@ function webform_download_sids_query($nid, $range_options, $uid = NULL) {
     case 'range':
       // Submissions Start-End.
       $query->condition('ws.sid', $range_options['start'], '>=');
-      if ($range_options['end']){
+      if ($range_options['end']) {
         $query->condition('ws.sid', $range_options['end'], '<=');
       }
       $query->orderBy('ws.sid', 'ASC');
@@ -1812,7 +1812,7 @@ function webform_download_sids_query($nid, $range_options, $uid = NULL) {
     case 'range_serial':
       // Submissions Start-End, using serial numbers.
       $query->condition('ws.serial', $range_options['start'], '>=');
-      if ($range_options['end']){
+      if ($range_options['end']) {
         $query->condition('ws.serial', $range_options['end'], '<=');
       }
       $query->orderBy('ws.serial', 'ASC');
diff --git a/includes/webform.submissions.inc b/includes/webform.submissions.inc
index 3c0fb59..02fb496 100644
--- a/includes/webform.submissions.inc
+++ b/includes/webform.submissions.inc
@@ -638,7 +638,7 @@ function webform_submission_render($node, $submission, $email, $format, $exclude
       unset($components[$cid]);
     }
     if ($email && $email['exclude_empty']) {
-      foreach($submission->data as $cid => $data) {
+      foreach ($submission->data as $cid => $data) {
         if (!isset($data[0]) || $data[0] == '') {
           unset($components[$cid]);
         }
diff --git a/js/node-type-form.js b/js/node-type-form.js
index 9310bb7..6a44fbe 100644
--- a/js/node-type-form.js
+++ b/js/node-type-form.js
@@ -1,3 +1,8 @@
+/**
+ * @file
+ * Enhancements for webform node type forms.
+ */
+
 (function ($) {
   Drupal.behaviors.webformContentTypes = {
     attach: function (context) {
diff --git a/js/select-admin.js b/js/select-admin.js
index f6cfcdd..29fdc2b 100644
--- a/js/select-admin.js
+++ b/js/select-admin.js
@@ -1,4 +1,3 @@
-
 /**
  * @file
  * Enhancements for select list configuration options.
diff --git a/js/webform-admin.js b/js/webform-admin.js
index 2050649..058e575 100644
--- a/js/webform-admin.js
+++ b/js/webform-admin.js
@@ -1,9 +1,10 @@
-(function ($) {
-
 /**
+ * @file
  * Webform node form interface enhancments.
  */
 
+(function ($) {
+
 Drupal.behaviors.webformAdmin = {};
 Drupal.behaviors.webformAdmin.attach = function(context) {
   // On click or change, make a parent radio button selected.
diff --git a/js/webform.js b/js/webform.js
index 887c821..af06bf8 100644
--- a/js/webform.js
+++ b/js/webform.js
@@ -1,5 +1,5 @@
-
 /**
+ * @file
  * JavaScript behaviors for the front-end display of webforms.
  */
 
diff --git a/tests/conditionals.test b/tests/conditionals.test
index 3f16049..a13b77a 100644
--- a/tests/conditionals.test
+++ b/tests/conditionals.test
@@ -89,7 +89,7 @@ class WebformConditionalsTestCase extends WebformTestCase {
     $match_string = (is_array($conditional_values) ? print_r($conditional_values, 1) : $conditional_values);
     $conditional_string = $should_match ? 'should' : 'should not';
     $settings = array(
-      'title' => 'Test conditional webform: ' . $component['type'] . ' "' . $input_string .'"' . $conditional_string . ' be ' . $operator . ' "' . $match_string . '"',
+      'title' => 'Test conditional webform: ' . $component['type'] . ' "' . $input_string . '"' . $conditional_string . ' be ' . $operator . ' "' . $match_string . '"',
       'type' => 'webform',
       'webform' => webform_node_defaults(),
     );
diff --git a/views/webform.views.inc b/views/webform.views.inc
index 9590ae5..79ac396 100644
--- a/views/webform.views.inc
+++ b/views/webform.views.inc
@@ -574,7 +574,7 @@ function webform_views_pre_view($view, $display_id, $args) {
         if (webform_component_implements($component['type'], 'view_field')) {
           $new_fields = webform_component_invoke($component['type'], 'view_field', $component, $new_fields);
         }
-        foreach($new_fields as $sub_id => $new_field) {
+        foreach ($new_fields as $sub_id => $new_field) {
           $field_id = $new_id . ($sub_id ? '_' . $sub_id : '');
           $fields[$field_id] = $new_field;
           $new_columns[$field_id] = $field_id;
diff --git a/views/webform_handler_field_node_link_results.inc b/views/webform_handler_field_node_link_results.inc
index 0102cc5..885bfc2 100644
--- a/views/webform_handler_field_node_link_results.inc
+++ b/views/webform_handler_field_node_link_results.inc
@@ -41,7 +41,7 @@ class webform_handler_field_node_link_results extends views_handler_field_node_l
     }
 
     $this->options['alter']['make_link'] = TRUE;
-    $this->options['alter']['path'] = "node/$node->nid/webform-results".
+    $this->options['alter']['path'] = "node/$node->nid/webform-results" .
                                       (strlen($this->options['subpath']) ? '/' . $this->options['subpath'] : '');
 
     $text = !empty($this->options['text']) ? $this->options['text'] : t('results');
diff --git a/webform.drush.inc b/webform.drush.inc
index 23f0ae5..19992d9 100644
--- a/webform.drush.inc
+++ b/webform.drush.inc
@@ -1,8 +1,10 @@
 <?php
 
 /**
+ * @file
  * Implementation of hook_drush_command().
  */
+
 function webform_drush_command() {
   $items = array();
 
diff --git a/webform.install b/webform.install
index 86f0761..65c5ac4 100644
--- a/webform.install
+++ b/webform.install
@@ -804,7 +804,7 @@ function webform_uninstall() {
   $query = new EntityFieldQuery();
   $results = $query->entityCondition('entity_type', 'node')
     ->entityCondition('bundle', 'webform')
-    ->range(0,1)
+    ->range(0, 1)
     ->execute();
   $instances = field_info_instances('node', 'webform');
   unset($instances['body']);
@@ -1053,7 +1053,7 @@ function webform_update_7314() {
  */
 function webform_update_7315() {
   if (!db_field_exists('webform_last_download', 'requested')) {
-    db_add_field('webform_last_download', 'requested', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0,));
+    db_add_field('webform_last_download', 'requested', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
   }
 }
 
@@ -1948,7 +1948,7 @@ function webform_update_7416() {
       ->execute();
   }
   // Commit the transaction
-  unset ($txn);
+  unset($txn);
 
   // Now that every submission has a serial number, make serial numbers required.
   $spec['not null'] = TRUE;
@@ -2023,7 +2023,7 @@ function webform_update_7421() {
                           FALSE);
   variable_set('webform_email_html_capable', $capable);
   return $capable
-            ? t('An HTML-capable module is installed. The option to send HTML e-mail is enabled. ')
+            ? t('An HTML-capable module is installed. The option to send HTML e-mail is enabled.')
             : t('No commonly-known HTML capable module is installed. The option to send HTML e-mail is disabled.');
 }
 
diff --git a/webform.module b/webform.module
index 1a5cb42..e31bca3 100644
--- a/webform.module
+++ b/webform.module
@@ -3436,7 +3436,7 @@ function template_preprocess_webform_confirmation(&$vars) {
 
   // URL back to form (or same page for in-block confirmations).
   $vars['url'] = empty($node->webform_block)
-                    ? url('node/'. $node->nid)
+                    ? url('node/' . $node->nid)
                     : url(current_path(), array('query' => drupal_get_query_parameters()));
 
   // Progress bar.
-- 
1.7.8.msysgit.0

