From bd108c7f1036858fc2b4293ee2bad0474129fab9 Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Tue, 11 Nov 2008 16:49:38 +0000
Subject: [PATCH] - Patch #299778 by hswong3i, Arancaytar, Dave Reid et al:
 code clean-up.

---
 includes/database/mysql/schema.inc     |  2 +-
 includes/install.inc                   | 22 +++++++++++-----------
 includes/locale.inc                    |  2 +-
 includes/menu.inc                      |  4 ++--
 includes/session.inc                   |  2 +-
 modules/aggregator/aggregator.module   |  4 ++--
 modules/aggregator/aggregator.test     |  4 ++--
 modules/blogapi/blogapi.module         |  2 +-
 modules/comment/comment.test           |  6 +++---
 modules/filter/filter.module           |  2 +-
 modules/forum/forum.module             |  8 ++++----
 modules/search/search.module           |  4 ++--
 modules/taxonomy/taxonomy.module       |  2 +-
 modules/translation/translation.module |  2 +-
 modules/trigger/trigger.module         | 20 ++++++++++----------
 scripts/run-tests.sh                   |  8 ++++----
 16 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/includes/database/mysql/schema.inc b/includes/database/mysql/schema.inc
index 33744a8c92fd..6318cd86815a 100644
--- a/includes/database/mysql/schema.inc
+++ b/includes/database/mysql/schema.inc
@@ -299,7 +299,7 @@ public function dropIndex(&$ret, $table, $name) {
   }
 
   public function changeField(&$ret, $table, $field, $field_new, $spec, $keys_new = array()) {
-    $sql = 'ALTER TABLE {' . $table . '} CHANGE `' . $field . '` ' . $this->createFieldSql($field_new, $this->processField($spec));
+    $sql = 'ALTER TABLE {' . $table . '} CHANGE `' . $field . '` ' . $this->createFieldSql($field_new, $this->processField($spec));
     if (count($keys_new)) {
       $sql .= ', ADD ' . implode(', ADD ', $this->createKeysSql($keys_new));
     }
diff --git a/includes/install.inc b/includes/install.inc
index c713036ffc53..fc802011b56a 100644
--- a/includes/install.inc
+++ b/includes/install.inc
@@ -88,7 +88,7 @@ function drupal_load_updates() {
  * @param $module
  *   A module name.
  * @return
- *   If the module has updates, an array of available updates sorted by version. 
+ *   If the module has updates, an array of available updates sorted by version.
  *   Otherwise, FALSE.
  */
 function drupal_get_schema_versions($module) {
@@ -105,10 +105,10 @@ function drupal_get_schema_versions($module) {
   if (count($updates) == 0) {
     return FALSE;
   }
-  
+
   // Make sure updates are run in numeric order, not in definition order.
   sort($updates, SORT_NUMERIC);
-  
+
   return $updates;
 }
 
@@ -213,8 +213,8 @@ function drupal_detect_database_types() {
   // file for the driver explicitly.
 
   foreach (file_scan_directory(DRUPAL_ROOT . '/includes/database', '/^[a-z]*$/i', array('.', '..', 'CVS'), 0, FALSE) as $file) {
-    include_once "{$file->filename}/install.inc";      
-    include_once "{$file->filename}/database.inc"; 
+    include_once "{$file->filename}/install.inc";
+    include_once "{$file->filename}/database.inc";
     $drivers[$file->basename] = $file->filename;
   }
 
@@ -232,7 +232,7 @@ function drupal_detect_database_types() {
     unset($databases['mysql']);
     $databases = array('mysql' => $mysql_database) + $databases;
   }
-  
+
   return $databases;
 }
 
@@ -466,7 +466,7 @@ function drupal_verify_profile($profile, $locale) {
   $missing_modules = array_diff($module_list, $present_modules);
 
   $requirements = array();
-  
+
   if (count($missing_modules)) {
     $modules = array();
     foreach ($missing_modules as $module) {
@@ -544,7 +544,7 @@ function _drupal_install_module($module) {
  */
 function drupal_install_init_database() {
   static $included = FALSE;
-  
+
   if (!$included) {
     $connection_info = Database::getConnectionInfo();
     $driver = $connection_info['default']['driver'];
@@ -568,7 +568,7 @@ function drupal_install_system() {
   require_once DRUPAL_ROOT . '/' . $system_path . '/system.install';
   drupal_install_init_database();
   module_invoke('system', 'install');
-  
+
   $system_versions = drupal_get_schema_versions('system');
   $system_version = $system_versions ? max($system_versions) : SCHEMA_INSTALLED;
   db_query("INSERT INTO {system} (filename, name, type, owner, status, bootstrap, schema_version) VALUES('%s', '%s', '%s', '%s', %d, %d, %d)", $system_path . '/system.module', 'system', 'module', '', 1, 0, $system_version);
@@ -828,7 +828,7 @@ function drupal_install_fix_file($file, $mask, $message = TRUE) {
 
 
 /**
- * Send the user to a different installer page. 
+ * Send the user to a different installer page.
  *
  * This issues an on-site HTTP redirect. Messages (and errors) are erased.
  *
@@ -927,7 +927,7 @@ function drupal_check_profile($profile) {
  * Extract highest severity from requirements array.
  *
  * @param $requirements
- *   An array of requirements, in the same format as is returned by 
+ *   An array of requirements, in the same format as is returned by
  *   hook_requirements().
  * @return
  *   The highest severity in the array.
diff --git a/includes/locale.inc b/includes/locale.inc
index 00db655f7f93..248731cbb2b1 100644
--- a/includes/locale.inc
+++ b/includes/locale.inc
@@ -97,7 +97,7 @@ function theme_locale_languages_overview_form($form) {
   $header = array(array('data' => t('English name')), array('data' => t('Native name')), array('data' => t('Code')), array('data' => t('Direction')), array('data' => t('Enabled')), array('data' => t('Default')), array('data' => t('Weight')), array('data' => t('Operations')));
   $output = theme('table', $header, $rows, array('id' => 'language-order'));
   $output .= drupal_render($form);
-  
+
   drupal_add_tabledrag('language-order', 'order', 'sibling', 'language-order-weight');
 
   return $output;
diff --git a/includes/menu.inc b/includes/menu.inc
index e5618304b838..f4f8ecd29403 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -1886,7 +1886,7 @@ function _menu_delete_item($item, $force = FALSE) {
  *   - plid        The mlid of the parent.
  *   - router_path The path of the relevant router item.
  * @return
- *   The mlid of the saved menu link, or FALSE if the menu link could not be 
+ *   The mlid of the saved menu link, or FALSE if the menu link could not be
  *   saved.
  */
 function menu_link_save(&$item) {
@@ -2040,7 +2040,7 @@ function menu_link_save(&$item) {
     if ($existing_item && $menu_name != $existing_item['menu_name']) {
       menu_cache_clear($existing_item['menu_name']);
     }
-  
+
     _menu_clear_page_cache();
   }
   return $item['mlid'];
diff --git a/includes/session.inc b/includes/session.inc
index b2b0ae65b746..c9113982fa80 100644
--- a/includes/session.inc
+++ b/includes/session.inc
@@ -229,7 +229,7 @@ function drupal_session_destroy_uid($uid) {
  *
  * @param int $lifetime
  *   The value of session.gc_maxlifetime, passed by PHP.
- *   Sessions not updated for more than $lifetime seconds will be removed.  
+ *   Sessions not updated for more than $lifetime seconds will be removed.
  */
 function _sess_gc($lifetime) {
   // Be sure to adjust 'php_value session.gc_maxlifetime' to a large enough
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index d918022ec1f0..1c76fbd9d724 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -469,7 +469,7 @@ function aggregator_save_feed($edit) {
         'image' => '',
       ))
       ->execute();
-    
+
   }
   if (!empty($edit['title'])) {
     // The feed is being saved, save the categories as well.
@@ -501,7 +501,7 @@ function aggregator_remove($feed) {
       ->condition('iid', $iids, 'IN')
       ->execute();
   }
-  
+
   db_delete('aggregator_item')
     ->condition('fid', $feed['fid'])
     ->execute();
diff --git a/modules/aggregator/aggregator.test b/modules/aggregator/aggregator.test
index 11fc75dcd12f..f595761133d8 100644
--- a/modules/aggregator/aggregator.test
+++ b/modules/aggregator/aggregator.test
@@ -279,7 +279,7 @@ class UpdateFeedTestCase extends AggregatorTestCase {
     $remamining_fields = array('title', 'url', '');
     foreach ($remamining_fields as $same_field) {
       $feed = $this->createFeed();
-      
+
       // Get new feed data array and modify newly created feed.
       $edit = $this->getFeedEditArray();
       $edit['refresh'] =  1800; // Change refresh value.
@@ -469,7 +469,7 @@ class CategorizeFeedItemTestCase extends AggregatorTestCase {
           ->countQuery()
           ->execute()
           ->fetchField();
-        
+
         $this->assertEqual($feed->item_count, $categorized_count, t('Total items in feed equal to the total categorized feed items in database'));
       }
     }
diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module
index 554245f5691a..db7f01ddc4ea 100644
--- a/modules/blogapi/blogapi.module
+++ b/modules/blogapi/blogapi.module
@@ -328,7 +328,7 @@ function blogapi_blogger_get_post($appkey, $postid, $username, $password) {
  *   TRUE if no error, or the blogapi_error().
  */
 function blogapi_status_error_check($node, $original_status) {
-  
+
   $node = (object) $node;
 
   $node_type_default = variable_get('node_options_'. $node->type, array('status', 'promote'));
diff --git a/modules/comment/comment.test b/modules/comment/comment.test
index c342a4baa800..70c6d6cbaf0c 100644
--- a/modules/comment/comment.test
+++ b/modules/comment/comment.test
@@ -321,7 +321,7 @@ class CommentInterfaceTest extends CommentHelperCase {
     $this->assertText('This discussion is closed', t('Posting to node with comments disabled'));
     $this->assertNoField('edit-comment', t('Comment body field found.'));
 
-    // Attempt to post to node with read-only comments.    
+    // Attempt to post to node with read-only comments.
     $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_READ_ONLY));
     $this->assertTrue($this->node, t('Article node created.'));
     $this->drupalGet('comment/reply/' . $this->node->nid);
@@ -462,14 +462,14 @@ class CommentAnonymous extends CommentHelperCase {
     $this->drupalLogin($this->admin_user);
     $this->setAnonymousUserComment(FALSE, FALSE);
 
-    // Attempt to view comments while disallowed. 
+    // Attempt to view comments while disallowed.
     // NOTE: if authenticated user has permission to post comments, then a
     // "Login or register to post comments" type link may be shown.
     $this->drupalLogout();
     $this->drupalGet('node/' . $this->node->nid);
     $this->assertNoRaw('<div id="comments">', t('Comments were not displayed.'));
     $this->assertNoLink('Add new comment', t('Link to add comment was found.'));
-    
+
     // Attempt to view node-comment form while disallowed.
     $this->drupalGet('comment/reply/' . $this->node->nid);
     $this->assertText('You are not authorized to view comments', t('Error attempting to post comment.'));
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index 7e21d5facb25..e2e2a20f120a 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -1031,7 +1031,7 @@ function _filter_xss_split($m, $store = FALSE) {
   // Is there a closing XHTML slash at the end of the attributes?
   $attrlist = preg_replace('%(\s?)/\s*$%', '\1', $attrlist, -1, $count);
   $xhtml_slash = $count ? ' /' : '';
-  
+
   // Clean up attributes
   $attr2 = implode(' ', _filter_xss_attributes($attrlist));
   $attr2 = preg_replace('/[<>]/', '', $attr2);
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index b73d426314a7..8473ddde5325 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -156,9 +156,9 @@ function forum_init() {
 }
 
 /**
- * _forum_nodeapi_check_node_type 
- * 
- * @param mixed $node 
+ * _forum_nodeapi_check_node_type
+ *
+ * @param mixed $node
  * @param mixed $vocabulary
  * @access protected
  * @return bool
@@ -235,7 +235,7 @@ function forum_nodeapi_prepare(&$node, $teaser, $page) {
 
 /**
  * Implementation of hook_nodeapi_validate().
- * 
+ *
  * Check in particular that only a "leaf" term in the associated taxonomy.
  */
 function forum_nodeapi_validate(&$node, $teaser, $page) {
diff --git a/modules/search/search.module b/modules/search/search.module
index 08af04d03246..924795dd3c5e 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -579,8 +579,8 @@ function search_index($sid, $type, $text) {
 
   // Insert results into search index
   foreach ($results[0] as $word => $score) {
-    // If a word already exists in the database, its score gets increased 
-    // appropriately.  If not, we create a new record with the appropriate 
+    // If a word already exists in the database, its score gets increased
+    // appropriately.  If not, we create a new record with the appropriate
     // starting score.
     db_merge('search_index')->key(array(
       'word' => $word,
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index ffb126e4af3a..2ed3de9df130 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -215,7 +215,7 @@ function taxonomy_vocabulary_save($vocabulary) {
   if (empty($vocabulary->nodes)) {
     $vocabulary->nodes = array();
   }
-  
+
   if (!empty($vocabulary->name)) {
     // Prevent leading and trailing spaces in vocabulary names.
     $vocabulary->name = trim($vocabulary->name);
diff --git a/modules/translation/translation.module b/modules/translation/translation.module
index 6a8c731517f4..984f12738b87 100644
--- a/modules/translation/translation.module
+++ b/modules/translation/translation.module
@@ -251,7 +251,7 @@ function translation_nodeapi_delete(&$node, $teaser, $page) {
     translation_remove_from_set($node);
   }
 }
- 
+
 /**
  * Remove a node from its translation set (if any)
  * and update the set accordingly.
diff --git a/modules/trigger/trigger.module b/modules/trigger/trigger.module
index b00cd358e15e..02568064ddcc 100644
--- a/modules/trigger/trigger.module
+++ b/modules/trigger/trigger.module
@@ -202,7 +202,7 @@ function _trigger_normalize_node_context($type, $node) {
 /**
  * Simple wrapper function to make user hooks work with new entry points.
  *
- * @TODO: Take advantage of the new API and reorganise/remove this function. 
+ * @TODO: Take advantage of the new API and reorganise/remove this function.
  */
 function _trigger_nodeapi(&$node, $op, $a3, $a4) {
   // Keep objects for reuse so that changes actions make to objects can persist.
@@ -241,7 +241,7 @@ function _trigger_nodeapi(&$node, $op, $a3, $a4) {
     }
   }
 }
- 
+
 /**
  * Implementation of hook_nodeapi_view().
  */
@@ -384,51 +384,51 @@ function _trigger_normalize_user_context($type, $account) {
 }
 
 /**
- * trigger_user_login 
+ * trigger_user_login
  */
 function trigger_user_login(&$edit, &$account, $category) {
-  _trigger_user('login', $edit, $account, $category); 
+  _trigger_user('login', $edit, $account, $category);
 }
 
 /**
  * Implementation of hook_user_logout().
  */
 function trigger_user_logout(&$edit, &$account) {
-  _trigger_user('logout', $edit, $account); 
+  _trigger_user('logout', $edit, $account);
 }
 
 /**
  * Implementation of hook_user_insert().
  */
 function trigger_user_insert(&$edit, &$account, $category) {
-  _trigger_user('insert', $edit, $account, $category); 
+  _trigger_user('insert', $edit, $account, $category);
 }
 
 /**
  * Implementation of hook_user_update().
  */
 function trigger_user_update(&$edit, &$account, $category) {
-  _trigger_user('update', $edit, $account, $category); 
+  _trigger_user('update', $edit, $account, $category);
 }
 
 /**
  * Implementation of hook_user_delete().
  */
 function trigger_user_delete(&$edit, &$account, $category) {
-  _trigger_user('delete', $edit, $account, $category); 
+  _trigger_user('delete', $edit, $account, $category);
 }
 
 /**
  * Implementation of hook_user_view().
  */
 function trigger_user_view(&$edit, &$account, $category) {
-  _trigger_user('view', $edit, $account, $category); 
+  _trigger_user('view', $edit, $account, $category);
 }
 
 /**
  * Simple wrapper function to make user hooks work with new entry points.
  *
- * @TODO: Take advantage of the new API and reorganise/remove this function. 
+ * @TODO: Take advantage of the new API and reorganise/remove this function.
  */
 function _trigger_user($op, &$edit, &$account, $category = NULL) {
   // Keep objects for reuse so that changes actions make to objects can persist.
diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh
index 2cb63310aede..f6486fd698a9 100755
--- a/scripts/run-tests.sh
+++ b/scripts/run-tests.sh
@@ -111,19 +111,19 @@ function simpletest_script_help() {
   --url       Immediately preceeds a URL to set the host and path. You will
               need this parameter if Drupal is in a subdirectory on your
               localhost and you have not set \$base_url in settings.php.
-              
+
   --php       The absolute path to the PHP executable. Usually not needed.
 
   --concurrency [num]
 
               Run tests in parallel, up to [num] tests at a time. This requires
-              the Process Control Extension (PCNTL) to be compiled in PHP, not 
+              the Process Control Extension (PCNTL) to be compiled in PHP, not
               supported under Windows.
 
   --all       Run all available tests.
 
   --class     Run tests identified by specific class names, instead of group names.
-  
+
   --file      Run tests identifiled by specific file names, instead of group names.
               Specify the path and the extension (i.e. 'modules/user/user.test').
 
@@ -391,7 +391,7 @@ function simpletest_script_get_test_list() {
       foreach ($args['test_names'] as $file) {
         $files[realpath($file)] = 1;
       }
-	  
+
       // Check for valid class names.
       foreach ($all_tests as $class_name => $instance) {
         $refclass = new ReflectionClass($class_name);
-- 
GitLab