From 8e2beaa818c9595e233c52734849cbecbe1a412f Mon Sep 17 00:00:00 2001
From: Tim Rohaly <tr@202830.no-reply.drupal.org>
Date: Wed, 27 Apr 2011 13:19:21 -0700
Subject: [PATCH] Coder module changes for all examples. Some work on adhering to doxygen commenting standards.

---
 action_example/action_example.module               |   39 ++++++++++----------
 ajax_example/ajax_example.module                   |    8 ++--
 ajax_example/ajax_example_advanced.inc             |    8 +++--
 ajax_example/ajax_example_graceful_degradation.inc |    7 ++--
 ajax_example/ajax_example_misc.inc                 |    8 ++---
 batch_example/batch_example.install                |    4 +-
 batch_example/batch_example.module                 |    2 +-
 dbtng_example/dbtng_example.install                |    2 +-
 dbtng_example/dbtng_example.module                 |   11 +++---
 field_example/field_example.install                |    2 +-
 field_example/field_example.test                   |    6 ++--
 file_example/file_example.module                   |    7 ++--
 file_example/file_example_session_streams.inc      |    9 ++---
 form_example/form_example.module                   |    3 +-
 form_example/form_example.test                     |   14 ++++----
 form_example/form_example_elements.inc             |    2 +-
 form_example/form_example_tutorial.inc             |    6 ++--
 form_example/form_example_wizard.inc               |    2 +-
 image_example/image_example.install                |    2 +-
 image_example/image_example.pages.inc              |    5 +--
 js_example/js_example.module                       |   21 +++++++----
 menu_example/menu_example.module                   |    8 ++--
 node_access_example/node_access_example.install    |   11 +-----
 node_access_example/node_access_example.test       |   20 +++++-----
 node_example/node_example.install                  |   14 +++-----
 nodeapi_example/nodeapi_example.install            |   18 +---------
 nodeapi_example/nodeapi_example.module             |    2 +-
 page_example/page_example.module                   |    6 ++--
 render_example/render_example.install              |    7 ++--
 render_example/render_example.module               |   13 ++++---
 render_example/render_example.test                 |    6 ++--
 simpletest_example/simpletest_example.install      |    6 +---
 simpletest_example/simpletest_example.module       |    1 -
 token_example/token_example.module                 |    5 +++
 34 files changed, 130 insertions(+), 155 deletions(-)

diff --git a/action_example/action_example.module b/action_example/action_example.module
index e802cc7..20638cd 100644
--- a/action_example/action_example.module
+++ b/action_example/action_example.module
@@ -244,8 +244,8 @@ function action_example_basic_action(&$entity, $context = array()) {
  */
 function action_example_unblock_user_action(&$entity, $context = array()) {
 
-	// First we check that entity is a user object. If this is the case, then this
-	// is a user-type trigger.
+  // First we check that entity is a user object. If this is the case, then this
+  // is a user-type trigger.
   if (isset($entity->uid)) {
     $uid = $entity->uid;
   }
@@ -281,38 +281,39 @@ function action_example_unblock_user_action(&$entity, $context = array()) {
  * Generates settings form for action_example_node_sticky_action().
  *
  * @param array $context
- *  An array of options of this action (in case it is being edited)
+ *   An array of options of this action (in case it is being edited)
+ *
  * @return array $form
  *
  */
 function action_example_node_sticky_action_form($context) {
-	/*
-	 * We return a configuration form to set the requirements that will
-	 * match this action before being executed. This is a regular Drupal form and
-	 * may include any type of information you want, but all the fields of the
-	 * form will be saved into the $context variable.
-	 *
-	 * In this case we are promoting all content types submited by this user, but
-	 * it is possible to extend these conditions providing more options in the
-	 * settings form.
-	 */
+  /*
+  * We return a configuration form to set the requirements that will
+  * match this action before being executed. This is a regular Drupal form and
+  * may include any type of information you want, but all the fields of the
+  * form will be saved into the $context variable.
+  *
+  * In this case we are promoting all content types submited by this user, but
+  * it is possible to extend these conditions providing more options in the
+  * settings form.
+  */
   $form['author'] = array(
     '#title' => t('Author name'),
     '#type' => 'textfield',
     '#description' => t('Any content created, presaved or updated by this user will be promoted to front page and set as sticky.'),
     '#default_value' => isset($context['author']) ? $context['author'] : '',
   );
-	// Verify user permissions and provide an easier way to fill this field.
-	if (user_access('access user profiles')) {
+  // Verify user permissions and provide an easier way to fill this field.
+  if (user_access('access user profiles')) {
     $form['author']['#autocomplete_path'] = 'user/autocomplete';
-	}
-	// No more options, return the form.
+  }
+  // No more options, return the form.
   return $form;
 }
 
 /**
- * Validate settings form for action_example_node_sticky_action().
- * Verify that user exists before continuing.
+ * Validates settings form for action_example_node_sticky_action().
+ * Verifies that user exists before continuing.
  */
 function action_example_node_sticky_action_validate($form, $form_state) {
   if (! $account = user_load_by_name($form_state['values']['author']) ) {
diff --git a/ajax_example/ajax_example.module b/ajax_example/ajax_example.module
index 0b29ad0..ca842d3 100644
--- a/ajax_example/ajax_example.module
+++ b/ajax_example/ajax_example.module
@@ -3,7 +3,6 @@
 /**
  * @file
  * AJAX Examples module file with basic examples.
- *
  */
 
 /**
@@ -20,9 +19,10 @@
 */
 
 /**
- * Set up calls to drupal_get_form() for all our example cases.
- *
  * Implements hook_menu().
+ *
+ * Sets up calls to drupal_get_form() for all our example cases.
+ *
  * See @link menu_example.module Menu Example @endlink for more details on
  * hook_menu().
  */
@@ -248,7 +248,7 @@ function ajax_example_simplest($form, &$form_state) {
   // An AJAX request calls the form builder function for every change.
   // We can change how we build the form based on $form_state.
   if (!empty($form_state['values']['changethis'])) {
-    $form['replace_textfield']['#description'] = t("Say why you chose") .  " '{$form_state['values']['changethis']}'";
+    $form['replace_textfield']['#description'] = t("Say why you chose '@value'", array('@value' => $form_state['values']['changethis']));
   }
   return $form;
 }
diff --git a/ajax_example/ajax_example_advanced.inc b/ajax_example/ajax_example_advanced.inc
index 8b12c71..182465d 100644
--- a/ajax_example/ajax_example_advanced.inc
+++ b/ajax_example/ajax_example_advanced.inc
@@ -196,7 +196,7 @@ function ajax_example_advanced_commands($form, &$form_state) {
   $form['restripe_command_example_fieldset']['restripe_num_rows'] = array(
     '#type' => 'select',
     '#default_value' => !empty($form_state['values']['restripe_num_rows']) ? $form_state['values']['restripe_num_rows'] : 1,
-    '#options' => drupal_map_assoc(array(1,2,3,4,5,6,7,8,9,10)),
+    '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)),
     '#ajax' => array(
       'callback' => 'ajax_example_advanced_commands_restripe_num_rows',
       'method' => 'replace',
@@ -285,7 +285,8 @@ function ajax_example_advanced_commands_changed_callback($form, $form_state) {
   $commands = array();
   if ($checkbox_value) {
     $commands[] = ajax_command_changed( '#changed_div', '#changed_div_mark_this');
-  } else {
+  }
+  else {
     $commands[] = ajax_command_replace('#changed_div', "<div id='changed_div'> <div id='changed_div_mark_this'>This div can be marked as changed or not.</div></div>");
   }
   $commands[] = ajax_command_replace("#changed_status", "<div id='changed_status'>Updated changed_command_example to $checkbox_value_string: " . date('r') . "</div>");
@@ -355,7 +356,8 @@ function ajax_example_advanced_commands_remove_callback($form, $form_state) {
   $should_remove_string = $should_remove ? 'TRUE' : 'FALSE';
   if ($should_remove) {
     $commands[] = ajax_command_remove('#remove_text');
-  } else {
+  }
+  else {
     $commands[] = ajax_command_html('#remove_div', "<div id='remove_text'>text to be removed</div>");
   }
   $commands[] = ajax_command_replace("#remove_status", "<div id='remove_status'>Updated remove_command_example (value={$should_remove_string} " . date('r') . "</div>");
diff --git a/ajax_example/ajax_example_graceful_degradation.inc b/ajax_example/ajax_example_graceful_degradation.inc
index 205b785..aa2a9ee 100644
--- a/ajax_example/ajax_example_graceful_degradation.inc
+++ b/ajax_example/ajax_example_graceful_degradation.inc
@@ -3,7 +3,6 @@
 /**
  * @file
  * Demonstrations of AJAX with graceful degradation.
- *
  */
 
 /**
@@ -137,7 +136,7 @@ function ajax_example_dependent_dropdown_degrades_submit($form, &$form_state) {
 
   // Now handle the case of the next, previous, and submit buttons.
   // only submit will result in actual submission, all others rebuild.
-  switch($form_state['triggering_element']['#value']) {
+  switch ($form_state['triggering_element']['#value']) {
     case t('OK'): // Submit: We're done.
       drupal_set_message(t('Your values have been submitted. dropdown_first=@first, dropdown_second=@second', array('@first' => $form_state['values']['dropdown_first'], '@second' => $form_state['values']['dropdown_second'])));
       return;
@@ -291,7 +290,7 @@ function ajax_example_dynamic_sections_submit($form, &$form_state) {
   // select is changed.
   // Now handle the case of the next, previous, and submit buttons.
   // Only submit will result in actual submission, all others rebuild.
-  switch($form_state['triggering_element']['#value']) {
+  switch ($form_state['triggering_element']['#value']) {
     case t('Submit your answer'): // Submit: We're done.
       $form_state['rebuild'] = FALSE;
       $answer = $form_state['values']['question'];
@@ -488,7 +487,7 @@ function ajax_example_wizard_submit($form, &$form_state) {
 
   // If they're done, submit.
   if ($form_state['triggering_element']['#value'] == t('Submit your information')) {
-    $value_message = t("Your information has been submitted: ");
+    $value_message = t('Your information has been submitted:') . ' ';
     foreach ($form_state['storage']['values'] as $step => $values) {
       $value_message .= "$step: ";
       foreach ($values as $key => $value) {
diff --git a/ajax_example/ajax_example_misc.inc b/ajax_example/ajax_example_misc.inc
index e0deb07..d7d1b16 100644
--- a/ajax_example/ajax_example_misc.inc
+++ b/ajax_example/ajax_example_misc.inc
@@ -3,9 +3,7 @@
 /**
  * @file
  * AJAX Miscellaneous Topics.
- *
- *
-*/
+ */
 
 /**
  * Demonstrates a clickable AJAX-enabled link using the 'use-ajax' class.
@@ -28,7 +26,7 @@ javascript is enabled, ajax.js will try to submit it via an AJAX call instead
 of a normal page load. The URL also contains the '/nojs/' magic string, which
 is stripped if javascript is enabled, allowing the server code to tell by the
 URL whether JS was enabled or not, letting it do different things based on that.";
-  $output = "<div>" . t($explanation) ."</div>";
+  $output = "<div>" . t($explanation) . "</div>";
   // The use-ajax class is special, so that the link will call without causing
   // a page reload. Note the /nojs portion of the path - if javascript is
   // enabled, this part will be stripped from the path before it is called.
@@ -59,7 +57,7 @@ of a normal page load. The URL also contains the '/nojs/' magic string, which
 is stripped if javascript is enabled, allowing the server code to tell by the
 URL whether JS was enabled or not, letting it do different things based on that.";
   $build['my_div'] = array(
-    '#markup' => $explanation .'<div id="myDiv"></div>',
+    '#markup' => $explanation . '<div id="myDiv"></div>',
   );
   $build['ajax_link'] = array(
     '#type' => 'link',
diff --git a/batch_example/batch_example.install b/batch_example/batch_example.install
index ec8e60c..af015be 100644
--- a/batch_example/batch_example.install
+++ b/batch_example/batch_example.install
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Install/Update/Uninstall functions for batch_example module
+ * Install, update, and uninstall functions for the batch_example module.
  */
 
 /**
@@ -74,6 +74,6 @@ function batch_example_update_7100(&$sandbox) {
     // hook_update_N() may optionally return a string which will be displayed
     // to the user.
     $final_message = '<ul><li>' . implode('</li><li>', $sandbox['messages']) . "</li></ul>";
-    return t('The batch_example demonstration update did what it was supposed to do: ') . $final_message;
+    return t('The batch_example demonstration update did what it was supposed to do: @message', array('@message' => $final_message));
   }
 }
diff --git a/batch_example/batch_example.module b/batch_example/batch_example.module
index 9cc8dfc..e44169d 100644
--- a/batch_example/batch_example.module
+++ b/batch_example/batch_example.module
@@ -30,7 +30,7 @@ function batch_example_menu() {
   $items = array();
   $items['examples/batch_example'] = array(
     'title' => 'Batch example',
-    'description' => t("Example of Drupal batch processing"),
+    'description' => 'Example of Drupal batch processing',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('batch_example_simple_form'),
     'access callback' => TRUE,
diff --git a/dbtng_example/dbtng_example.install b/dbtng_example/dbtng_example.install
index 5f314b3..588b0bd 100644
--- a/dbtng_example/dbtng_example.install
+++ b/dbtng_example/dbtng_example.install
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Install, update and uninstall functions for the dbtng example module.
+ * Install, update and uninstall functions for the dbtng_example module.
  */
 
 /**
diff --git a/dbtng_example/dbtng_example.module b/dbtng_example/dbtng_example.module
index 6aee7ac..352d2d6 100644
--- a/dbtng_example/dbtng_example.module
+++ b/dbtng_example/dbtng_example.module
@@ -10,7 +10,6 @@
  * General documentation is available at
  * @link database Database abstraction layer documentation @endlink and
  * at @link http://drupal.org/node/310069 @endlink.
- *
  */
 
 /**
@@ -138,7 +137,7 @@ function dbtng_example_entry_update($entry) {
               ->condition('pid', $entry['pid'])
               ->execute();
   }
-  catch(Exception $e) {
+  catch (Exception $e) {
     drupal_set_message(t('db_update failed. Message = %message, query= %query',
       array('%message' => $e->getMessage(), '%query' => $e->query_string)), 'error');
   }
@@ -281,7 +280,7 @@ function dbtng_example_entry_load($entry = array()) {
  *  e.name = 'John' AND e.age > 18
  *
  * @see db_select()
- * @seeW http://drupal.org/node/310075
+ * @see http://drupal.org/node/310075
  */
 function dbtng_example_advanced_list() {
   $output = '';
@@ -338,7 +337,7 @@ function dbtng_example_help($path) {
       $output = t('Generate a list of all entries in the database. There is no filter in the query.');
       break;
     case 'examples/dbtng/advanced':
-      $output  = t('A more complex list of entries in the database. ');
+      $output  = t('A more complex list of entries in the database.') . ' ';
       $output .= t('Only the entries with name = "John" and age older than 18 years are shown, the username of the person who created the entry is also shown.');
       break;
     case 'examples/dbtng/update':
@@ -455,7 +454,7 @@ function dbtng_example_form_add($form, &$form_state) {
 /**
  * Submit handler for 'add entry' form.
  */
-function dbtng_example_form_add_submit($form, $form_state){
+function dbtng_example_form_add_submit($form, $form_state) {
   global $user;
 
   // Save the submitted entry.
@@ -555,7 +554,7 @@ function dbtng_example_form_update_callback($form, $form_state) {
 /**
  * Submit handler for 'update entry' form.
  */
-function dbtng_example_form_update_submit($form, $form_state){
+function dbtng_example_form_update_submit($form, $form_state) {
   global $user;
 
   // Save the submitted entry.
diff --git a/field_example/field_example.install b/field_example/field_example.install
index e6917b7..7a1e18c 100644
--- a/field_example/field_example.install
+++ b/field_example/field_example.install
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Install/Update/Uninstall functions for field_example module
+ * Install, update, and uninstall functions for the field_example module.
  */
 
 /**
diff --git a/field_example/field_example.test b/field_example/field_example.test
index a138fbd..76ad9d4 100644
--- a/field_example/field_example.test
+++ b/field_example/field_example.test
@@ -47,7 +47,7 @@ class FieldExampleTest extends DrupalWebTestCase {
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_machine = strtolower($this->randomName(10));
 
-    $edit = array (
+    $edit = array(
       'name' => $content_type_friendly,
       'type' => $content_type_machine,
     );
@@ -55,7 +55,7 @@ class FieldExampleTest extends DrupalWebTestCase {
     $this->assertText(t('The content type @name has been added.', array('@name' => $content_type_friendly)));
 
     // Now add a singleton field.
-    $edit = array (
+    $edit = array(
       'fields[_add_new_field][label]' => $single_field_name_friendly,
       'fields[_add_new_field][field_name]' => $single_field_name_machine,
       'fields[_add_new_field][type]' => 'field_example_rgb',
@@ -75,7 +75,7 @@ class FieldExampleTest extends DrupalWebTestCase {
     // Now add a multivalued field.
     $multivalue_field_name_friendly = $this->randomName(20);
     $multivalue_field_name_machine = strtolower($this->randomName(10));
-    $edit = array (
+    $edit = array(
       'fields[_add_new_field][label]' => $multivalue_field_name_friendly,
       'fields[_add_new_field][field_name]' => $multivalue_field_name_machine,
       'fields[_add_new_field][type]' => 'field_example_rgb',
diff --git a/file_example/file_example.module b/file_example/file_example.module
index c7e0224..d704722 100644
--- a/file_example/file_example.module
+++ b/file_example/file_example.module
@@ -3,7 +3,6 @@
 /**
  * @file
  * Examples demonstrating the Drupal File API (and Stream Wrappers).
- *
  */
 
 /**
@@ -274,10 +273,10 @@ function file_example_unmanaged_php_submit($form, &$form_state) {
   // fwrite($fp, $data).
   $length = strlen($data);
   $write_size = 5;
-  for ($i=0; $i < $length; $i += $write_size) {
+  for ($i = 0; $i < $length; $i += $write_size) {
     $result = fwrite($fp, substr($data, $i, $write_size));
     if ($result === FALSE) {
-      drupal_set_message(t('Failed writing to the file; '), 'error');
+      drupal_set_message(t('Failed writing to the file %file', array('%file' => $destination)), 'error');
       fclose($fp);
       return;
     }
@@ -517,6 +516,6 @@ function file_example_session_contents() {
   $path_components = func_get_args();
   $session_path = join('/', $path_components);
   $content = file_get_contents('session://' . $session_path);
-  return t('Contents of ') . check_plain($session_path) . ': ' . print_r($content, TRUE);
+  return t('Contents of @path:', array('@path' => check_plain($session_path))) . ' ' . print_r($content, TRUE);
 }
 
diff --git a/file_example/file_example_session_streams.inc b/file_example/file_example_session_streams.inc
index 4c2e1f6..1d29034 100644
--- a/file_example/file_example_session_streams.inc
+++ b/file_example/file_example_session_streams.inc
@@ -1,8 +1,8 @@
 <?php
 
 /**
- * @file file_example_session_streams.inc
- * Implement DrupalStreamWrapperInterface to provide a demonstration session://
+ * @file
+ * Implements DrupalStreamWrapperInterface to provide a demonstration session://
  * streamwrapper. This example is nearly fully functional, but has no known
  * practical use. It's an example and demonstration only.
  */
@@ -477,8 +477,7 @@ class FileExampleSessionStreamWrapper implements DrupalStreamWrapperInterface {
     if (strpos($target, '/')) {
       $dirname = preg_replace('@/[^/]*$@', '', $target);
     }
-    else
-    {
+    else {
       $dirname = '';
     }
     return $scheme . '://' . $dirname;
@@ -575,7 +574,7 @@ class FileExampleSessionStreamWrapper implements DrupalStreamWrapperInterface {
     if (is_array($key) && array_key_exists('.isadir.txt', $key)) {
       $mode = 0040000; // S_IFDIR means it's a directory.
     }
-    else if ($key !== FALSE) {
+    elseif ($key !== FALSE) {
       $mode = 0100000; // S_IFREG, means it's a file.
     }
 
diff --git a/form_example/form_example.module b/form_example/form_example.module
index c002e34..1824f29 100644
--- a/form_example/form_example.module
+++ b/form_example/form_example.module
@@ -3,7 +3,6 @@
 /**
  * @file
  * Examples demonstrating the Drupal Form API.
- *
  */
 
 /**
@@ -123,7 +122,7 @@ function form_example_menu() {
     'page callback' => 'drupal_get_form',
     'page arguments' => array('form_example_tutorial_10'),
     'access callback' => TRUE,
-    'description' => t('Tutorial 11: Form with file upload'),
+    'description' => 'Tutorial 11: Form with file upload',
     'type' => MENU_LOCAL_TASK,
     'file' => 'form_example_tutorial.inc',
     'weight' => 10,
diff --git a/form_example/form_example.test b/form_example/form_example.test
index 634f98d..bcaa297 100644
--- a/form_example/form_example.test
+++ b/form_example/form_example.test
@@ -159,7 +159,7 @@ class FormExampleTestCase extends DrupalWebTestCase {
     $this->drupalPost(NULL, array('city' => $city), t('Next'));
 
     // Enter the Aunt's name, but then the previous button.
-    $this->drupalPost(NULL, array('aunts_name'=> $aunts_name), t('Previous'));
+    $this->drupalPost(NULL, array('aunts_name' => $aunts_name), t('Previous'));
     $this->assertFieldByName('city', $city);
 
     // Now go forward and then press finish; check for correct values.
@@ -181,12 +181,12 @@ class FormExampleTestCase extends DrupalWebTestCase {
     $edit = array(
       'a_form_example_textfield' => $this->randomName(),
       'a_form_example_checkbox' => TRUE,
-      'a_form_example_element_discrete[areacode]' => sprintf('%03d', rand(0,999)),
-      'a_form_example_element_discrete[prefix]' => sprintf('%03d', rand(0,999)),
-      'a_form_example_element_discrete[extension]' => sprintf('%04d', rand(0,9999)),
-      'a_form_example_element_combined[areacode]' => sprintf('%03d', rand(0,999)),
-      'a_form_example_element_combined[prefix]' => sprintf('%03d', rand(0,999)),
-      'a_form_example_element_combined[extension]' => sprintf('%04d', rand(0,9999)),
+      'a_form_example_element_discrete[areacode]' => sprintf('%03d', rand(0, 999)),
+      'a_form_example_element_discrete[prefix]' => sprintf('%03d', rand(0, 999)),
+      'a_form_example_element_discrete[extension]' => sprintf('%04d', rand(0, 9999)),
+      'a_form_example_element_combined[areacode]' => sprintf('%03d', rand(0, 999)),
+      'a_form_example_element_combined[prefix]' => sprintf('%03d', rand(0, 999)),
+      'a_form_example_element_combined[extension]' => sprintf('%04d', rand(0, 9999)),
     );
     $this->drupalPost('examples/form_example/element_example', $edit, t('Submit'));
     $this->assertText(t('a_form_example_textfield has value @value', array('@value' => $edit['a_form_example_textfield'])));
diff --git a/form_example/form_example_elements.inc b/form_example/form_example_elements.inc
index a143172..0a153a4 100644
--- a/form_example/form_example_elements.inc
+++ b/form_example/form_example_elements.inc
@@ -253,7 +253,7 @@ function form_example_phonenumber_discrete_process($element, &$form_state, $comp
  * Using regular expressions, we check that:
  *  - the area code is a three digit number
  *  - the prefix is numeric 3-digit number
- *	- the extension is a numeric 4-digit number
+ *  - the extension is a numeric 4-digit number
  *
  * Any problems are shown on the form element using form_error().
  */
diff --git a/form_example/form_example_tutorial.inc b/form_example/form_example_tutorial.inc
index 07cd448..1d31361 100644
--- a/form_example/form_example_tutorial.inc
+++ b/form_example/form_example_tutorial.inc
@@ -704,8 +704,8 @@ function form_example_tutorial_10($form_state) {
 
   $form['file'] = array(
     '#type' => 'file',
-  	'#title' => t('Image'),
-  	'#description' => t('Upload a file, allowed extensions: jpg, jpeg, png, gif'),
+    '#title' => t('Image'),
+    '#description' => t('Upload a file, allowed extensions: jpg, jpeg, png, gif'),
   );
 
   $form['submit'] = array(
@@ -720,7 +720,7 @@ function form_example_tutorial_10($form_state) {
  * Validate handler for form_example_tutorial_10().
  */
 function form_example_tutorial_10_validate($form, &$form_state) {
-	$file = file_save_upload('file', array(
+  $file = file_save_upload('file', array(
     'file_validate_is_image' => array(), // Validates file is really an image.
     'file_validate_extensions' => array('png gif jpg jpeg'), // Validate extensions.
   ));
diff --git a/form_example/form_example_wizard.inc b/form_example/form_example_wizard.inc
index 9c59b5b..38fa77b 100644
--- a/form_example/form_example_wizard.inc
+++ b/form_example/form_example_wizard.inc
@@ -268,7 +268,7 @@ function form_example_wizard_submit($form, &$form_state) {
   // In this case we've completed the final page of the wizard, so process the
   // submitted information.
   drupal_set_message(t('This information was collected by this wizard:'));
-  foreach($form_state['step_information'] as $index => $value) {
+  foreach ($form_state['step_information'] as $index => $value) {
     // Remove FAPI fields included in the values (form_token, form_id and form_build_id
     // This is not required, you may access the values using $value['stored_values']
     // but I'm removing them to make a more clear representation of the collected
diff --git a/image_example/image_example.install b/image_example/image_example.install
index 926d6da..395720a 100644
--- a/image_example/image_example.install
+++ b/image_example/image_example.install
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Installation and update functions for image_example.module.
+ * Install, update, and uninstall functions for the image_example module.
  */
 
 /**
diff --git a/image_example/image_example.pages.inc b/image_example/image_example.pages.inc
index 6c7cc43..6f78750 100644
--- a/image_example/image_example.pages.inc
+++ b/image_example/image_example.pages.inc
@@ -3,7 +3,6 @@
 /**
  * @file
  * Page/form showing image styles in use.
- *
  */
 
 /**
@@ -15,7 +14,7 @@
  * module and as a way to demonstrate that the styles and effects defined by
  * this module are available via Drupal's image handling system.
  *
- * @see theme_image_style().
+ * @see theme_image_style()
  */
 function image_example_style_form($form, &$form_state) {
   // If there is already an uploaded image display the image here.
@@ -96,7 +95,7 @@ function image_example_style_form_submit($form, &$form_state) {
   }
   // If the file was removed we need to remove the module's reference to the
   // removed file's fid, and remove the file.
-  else if ($form_state['values']['image_example_image_fid'] == 0) {
+  elseif ($form_state['values']['image_example_image_fid'] == 0) {
     // Retrieve the old file's id.
     $fid = variable_get('image_example_image_fid', FALSE);
     $file = $fid ? file_load($fid) : FALSE;
diff --git a/js_example/js_example.module b/js_example/js_example.module
index fc9950b..5ccef02 100755
--- a/js_example/js_example.module
+++ b/js_example/js_example.module
@@ -1,7 +1,12 @@
 <?php
 
 /**
- * Implementation hook_theme().
+ * @file
+ * An example module showing how to use some of the new JavaScript features in Drupal 7.
+ */
+
+/**
+ * Implements hook_theme().
  */
 function js_example_theme() {
   return array(
@@ -33,7 +38,7 @@ function js_example_menu() {
 
 function js_example_js_weights() {
   // add some css to show which line is output by which script
-  drupal_add_css(drupal_get_path('module', 'js_example') .'/css/jsweights.css');
+  drupal_add_css(drupal_get_path('module', 'js_example') . '/css/jsweights.css');
   // 
   $weights = array(
     'red' => 100,
@@ -44,12 +49,12 @@ function js_example_js_weights() {
     'purple' => 60
   );
   drupal_add_js(array('js_weights' => $weights), array('type' => 'setting'));
-  drupal_add_js(drupal_get_path('module', 'js_example') .'/js/red.js', array('weight' => $weights['red']));
-  drupal_add_js(drupal_get_path('module', 'js_example') .'/js/blue.js', array('weight' => $weights['blue']));
-  drupal_add_js(drupal_get_path('module', 'js_example') .'/js/green.js', array('weight' => $weights['green']));
-  drupal_add_js(drupal_get_path('module', 'js_example') .'/js/brown.js', array('weight' => $weights['brown']));
-  drupal_add_js(drupal_get_path('module', 'js_example') .'/js/black.js', array('weight' => $weights['black']));
-  drupal_add_js(drupal_get_path('module', 'js_example') .'/js/purple.js', array('weight' => $weights['purple']));
+  drupal_add_js(drupal_get_path('module', 'js_example') . '/js/red.js', array('weight' => $weights['red']));
+  drupal_add_js(drupal_get_path('module', 'js_example') . '/js/blue.js', array('weight' => $weights['blue']));
+  drupal_add_js(drupal_get_path('module', 'js_example') . '/js/green.js', array('weight' => $weights['green']));
+  drupal_add_js(drupal_get_path('module', 'js_example') . '/js/brown.js', array('weight' => $weights['brown']));
+  drupal_add_js(drupal_get_path('module', 'js_example') . '/js/black.js', array('weight' => $weights['black']));
+  drupal_add_js(drupal_get_path('module', 'js_example') . '/js/purple.js', array('weight' => $weights['purple']));
   $output = '<div id="js-weights"></div>';
   return $output;
 }
diff --git a/menu_example/menu_example.module b/menu_example/menu_example.module
index db38b09..74aa81a 100644
--- a/menu_example/menu_example.module
+++ b/menu_example/menu_example.module
@@ -148,11 +148,11 @@ function menu_example_menu() {
   // callback and other conditions are handled by the parent callback.
   $items['menu_example/tabs/default'] = array(
     'type' => MENU_DEFAULT_LOCAL_TASK,
-    'title' => t('Default primary tab'),
+    'title' => 'Default primary tab',
     'weight' => 1,
   );
   // Now add the rest of the tab entries.
-  foreach(array(t('second') => 2, t('third') => 3, t('fourth') => 4) as $tabname => $weight) {
+  foreach (array(t('second') => 2, t('third') => 3, t('fourth') => 4) as $tabname => $weight) {
     $items["menu_example/tabs/$tabname"] = array(
       'type' => MENU_LOCAL_TASK,
       'title' => $tabname,
@@ -171,11 +171,11 @@ function menu_example_menu() {
   // The default local task needs very little information.
   $items['menu_example/tabs/default/first'] = array(
     'type' => MENU_DEFAULT_LOCAL_TASK,
-    'title' => t('Default secondary tab'),
+    'title' => 'Default secondary tab',
     // The additional page callback and related items are handled by the
     // parent menu item.
   );
-  foreach(array(t('second'), t('third')) as $tabname) {
+  foreach (array(t('second'), t('third')) as $tabname) {
     $items["menu_example/tabs/default/$tabname"] = array(
       'type' => MENU_LOCAL_TASK,
       'title' => $tabname,
diff --git a/node_access_example/node_access_example.install b/node_access_example/node_access_example.install
index cd46da1..6655ba5 100644
--- a/node_access_example/node_access_example.install
+++ b/node_access_example/node_access_example.install
@@ -1,16 +1,9 @@
 <?php
 
 /**
- * Implements hook_install().
+ * @file
+ * Install, update, and uninstall functions for the node_access_example module.
  */
-function node_access_example_install() {
-}
-
-/**
- * Implements hook_uninstall().
- */
-function node_access_example_uninstall() {
-}
 
 /**
  * Implements hook_schema().
diff --git a/node_access_example/node_access_example.test b/node_access_example/node_access_example.test
index be80dda..edb7c05 100644
--- a/node_access_example/node_access_example.test
+++ b/node_access_example/node_access_example.test
@@ -49,12 +49,12 @@ class NodeAccessExampleTestCase extends DrupalWebTestCase {
     $nodes_by_user = array();
     $titles = array(); // Titles keyed by nid
     $private_nodes = array(); // Array of nids marked private.
-    for($i = 0; $i < $num_simple_users; $i++) {
+    for ($i = 0; $i < $num_simple_users; $i++) {
       $simple_users[$i] = $this->drupalCreateUser(array('access content', 'create article content', 'search content'));
     }
     foreach ($simple_users as $web_user) {
       $this->drupalLogin($web_user);
-      foreach(array(0 => 'Public', 1 => 'Private') as $is_private => $type) {
+      foreach (array(0 => 'Public', 1 => 'Private') as $is_private => $type) {
         $edit = array(
           'title' => t('@private_public Article created by @user', array('@private_public' => $type, '@user' => $web_user->name)),
         );
@@ -86,11 +86,11 @@ class NodeAccessExampleTestCase extends DrupalWebTestCase {
       // Check to see that we find the number of search results expected.
       $this->checkSearchResults('Private node', 1);
       // Check own nodes to see that all are readable.
-      foreach(array_keys($nodes_by_user) as $uid) {
+      foreach (array_keys($nodes_by_user) as $uid) {
         // All of this user's nodes should be readable to same.
         if ($uid == $web_user->uid) {
-          foreach($nodes_by_user[$uid] as $nid => $is_private) {
-            $this->drupalGet('node/'.$nid);
+          foreach ($nodes_by_user[$uid] as $nid => $is_private) {
+            $this->drupalGet('node/' . $nid);
             $this->assertResponse(200);
             $this->assertTitle($titles[$nid] . ' | Drupal', t('Correct title for node found'));
           }
@@ -98,8 +98,8 @@ class NodeAccessExampleTestCase extends DrupalWebTestCase {
         else {
           // Otherwise, for other users, private nodes should get a 403,
           // but we should be able to read non-private nodes.
-          foreach($nodes_by_user[$uid] as $nid => $is_private) {
-            $this->drupalGet('node/'.$nid);
+          foreach ($nodes_by_user[$uid] as $nid => $is_private) {
+            $this->drupalGet('node/' . $nid);
             $this->assertResponse($is_private ? 403 : 200, t('Node @nid by user @uid should get a @response for this user (@web_user_uid)', array('@nid' => $nid, '@uid' => $uid, '@response' => $is_private ? 403 : 200, '@web_user_uid' => $web_user->uid)));
             if (!$is_private) {
               $this->assertTitle($titles[$nid] . ' | Drupal', t('Correct title for node was found'));
@@ -124,7 +124,7 @@ class NodeAccessExampleTestCase extends DrupalWebTestCase {
     // Check to see that we find the number of search results expected.
     $this->checkSearchResults('Private node', 3);
 
-    foreach($nodes_by_user as $uid => $private_status) {
+    foreach ($nodes_by_user as $uid => $private_status) {
       foreach ($private_status as $nid => $is_private) {
         $this->drupalGet('node/' . $nid);
         $this->assertResponse(200);
@@ -156,7 +156,7 @@ class NodeAccessExampleTestCase extends DrupalWebTestCase {
     $this->drupalLogin($edit_user);
 
     // Try to edit each of the private nodes.
-    foreach($private_nodes as $nid) {
+    foreach ($private_nodes as $nid) {
       $body = $this->randomName();
       $edit = array('body[und][0][value]' => $body);
       $this->drupalPost('node/' . $nid . '/edit', $edit, t('Save'));
@@ -167,7 +167,7 @@ class NodeAccessExampleTestCase extends DrupalWebTestCase {
     // This test should go last, as the nodes get deleted.
     $edit_user = $this->drupalCreateUser(array('access content', 'access any private content', 'edit any private content'));
     $this->drupalLogin($edit_user);
-    foreach($private_nodes as $nid) {
+    foreach ($private_nodes as $nid) {
       $body = $this->randomName();
       $edit = array('body[und][0][value]' => $body);
       $this->drupalPost('node/' . $nid . '/edit', $edit, t('Save'));
diff --git a/node_example/node_example.install b/node_example/node_example.install
index aaf31b8..e6caf9b 100755
--- a/node_example/node_example.install
+++ b/node_example/node_example.install
@@ -6,12 +6,9 @@
  *
  * The definition of the fields for the module is here,
  *
- * See @link http://drupal.org/node/707832 Field API Tutorial @endlink
- *
- * See @link http://drupal.org/node/443536 Field API Handbook Page @endlink
- *
- * See @link field Field API documentation @endlink
- *
+ * @see @link http://drupal.org/node/707832 Field API Tutorial @endlink
+ * @see @link http://drupal.org/node/443536 Field API Handbook Page @endlink
+ * @see @link field Field API documentation @endlink
  */
 
 /**
@@ -83,7 +80,7 @@ function node_example_install() {
 }
 
 /**
- * Return a structured array defining the fields created by this content type.
+ * Returns a structured array defining the fields created by this content type.
  *
  * This is packaged in a function so it can be used in both
  * node_example_install() and node_example_uninstall().
@@ -113,7 +110,7 @@ function _node_example_installed_fields() {
 }
 
 /**
- * Return a structured array defining the instances for this content type.
+ * Returns a structured array defining the instances for this content type.
  *
  * The instance lets Drupal know which widget to use to allow the user to enter
  * data and how to react in different view modes.  We are going to display a
@@ -175,7 +172,6 @@ function _node_example_installed_instances() {
 
 /**
  * Implements hook_uninstall().
- *
  */
 function node_example_uninstall() {
   // Gather all the example content that might have been created while this
diff --git a/nodeapi_example/nodeapi_example.install b/nodeapi_example/nodeapi_example.install
index d470be8..7abfc01 100644
--- a/nodeapi_example/nodeapi_example.install
+++ b/nodeapi_example/nodeapi_example.install
@@ -2,26 +2,10 @@
 
 /**
  * @file
- * Install, update and uninstall functions for the nodeapi example module.
- *
- * This file contains the functions required to perform install, update and
- * uninstall operations.
- *
+ * Install, update and uninstall functions for the nodeapi_example module.
  */
 
 /**
- * Implements hook_install().
- */
-function nodeapi_example_install() {
-}
-
-/**
- * Implements hook_uninstall().
- */
-function nodeapi_example_uninstall() {
-}
-
-/**
  * Implements hook_schema().
  */
 function nodeapi_example_schema() {
diff --git a/nodeapi_example/nodeapi_example.module b/nodeapi_example/nodeapi_example.module
index 5a221dc..49b24ee 100755
--- a/nodeapi_example/nodeapi_example.module
+++ b/nodeapi_example/nodeapi_example.module
@@ -204,7 +204,7 @@ function nodeapi_example_node_update($node) {
       ->where('e.vid = (:vid)', array(':vid' => $node->vid))
       ->execute()->fetchField();
 
-    if($rating) {
+    if ($rating) {
       // node has been rated before.
       db_update('nodeapi_example')
          ->fields(array('rating' => $node->nodeapi_example_rating))
diff --git a/page_example/page_example.module b/page_example/page_example.module
index 494ce73..500f6d9 100755
--- a/page_example/page_example.module
+++ b/page_example/page_example.module
@@ -32,9 +32,9 @@ function page_example_help($path, $arg) {
  */
 function page_example_permission() {
   return array(
-  	'access simple page' => array(
-  	  'title' => t('Access simple page'),
-  	  'description' => t('Allow users to access simple page'),
+    'access simple page' => array(
+      'title' => t('Access simple page'),
+      'description' => t('Allow users to access simple page'),
     ),
     'access arguments page' => array(
       'title' => t('Access page with arguments'),
diff --git a/render_example/render_example.install b/render_example/render_example.install
index 225e5b8..d2aa2e8 100644
--- a/render_example/render_example.install
+++ b/render_example/render_example.install
@@ -1,11 +1,12 @@
 <?php
+
 /**
- * @file render_example.install
- * Install/uninstall routines for render example.
+ * @file
+ * Install, update and uninstall functions for the render_example module.
  */
 
 /**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
  */
 function render_example_uninstall() {
   variable_del('render_example_show_page');
diff --git a/render_example/render_example.module b/render_example/render_example.module
index 40d1ab6..8e7730f 100644
--- a/render_example/render_example.module
+++ b/render_example/render_example.module
@@ -1,7 +1,8 @@
 <?php
+
 /**
- * @file render_example.module
- * Demonstrate how render arrays are arranged and how they can be altered.
+ * @file
+ * Demonstrates how render arrays are arranged and how they can be altered.
  * This alters blocks and the page to show the actual render array
  * that is being used to create each item.
  *
@@ -138,7 +139,7 @@ function render_example_arrays() {
   // The rest of this function just places the above arrays in a context where
   // they can be rendered (hopefully attractively and usefully) on the page.
   $page_array = array();
-  foreach($demos as $key => $item) {
+  foreach ($demos as $key => $item) {
     $page_array[$key]['#theme_wrappers'] = array('render_array');
     $page_array[$key]['#description'] = $key;
 
@@ -259,7 +260,7 @@ function render_example_demo_form($form, &$form_state) {
     '#default_value' => variable_get('render_example_reverse_sidebar', FALSE),
   );
   $form['page_fiddling']['render_example_prefix'] = array(
-    '#title' => t('Use #prefix and #suffix to wrap a div around every block '),
+    '#title' => t('Use #prefix and #suffix to wrap a div around every block'),
     '#description' => t('Uses hook_page_alter to wrap all blocks with a div using #prefix and #suffix'),
     '#type' => 'checkbox',
     '#default_value' => variable_get('render_example_prefix'),
@@ -281,7 +282,7 @@ function render_example_page_alter(&$page) {
   // Re-sort the sidebar in reverse order.
   if (variable_get('render_example_reverse_sidebar', FALSE) && !empty($page['sidebar_first'])) {
     $page['sidebar_first'] = array_reverse($page['sidebar_first']);
-    foreach(element_children($page['sidebar_first']) as $element) {
+    foreach (element_children($page['sidebar_first']) as $element) {
       // Reverse the weights if they exist.
       if (!empty($page['sidebar_first'][$element]['#weight'])) {
         $page['sidebar_first'][$element]['#weight'] *= -1;
@@ -383,7 +384,7 @@ function render_example_page_alter(&$page) {
   // Add #prefix and #suffix to a block to wrap a div around it.
   if (variable_get('render_example_prefix', FALSE)) {
     foreach (element_children($page) as $region_name) {
-      foreach(element_children($page[$region_name]) as $block_name) {
+      foreach (element_children($page[$region_name]) as $block_name) {
         $block = &$page[$region_name][$block_name];
         $block['#prefix'] = '<div class="block-prefix"><p>Prefixed</p>';
         $block['#suffix'] = '<span class="block-suffix">Block suffix</span></div>';
diff --git a/render_example/render_example.test b/render_example/render_example.test
index 938a44c..235c8ef 100644
--- a/render_example/render_example.test
+++ b/render_example/render_example.test
@@ -29,9 +29,9 @@ class RenderExampleTestCase extends DrupalWebTestCase {
    *   An array of xpaths, each of which must return something.
    */
   function assertRenderResults($xpath_array) {
-    foreach($xpath_array as $xpath) {
+    foreach ($xpath_array as $xpath) {
       $result = $this->xpath($xpath);
-      $this->assertTrue(!empty($result), t('Found xpath ') . $xpath);
+      $this->assertTrue(!empty($result), t('Found xpath %xpath', array('%xpath' => $xpath));
     }
   }
 
@@ -44,7 +44,7 @@ class RenderExampleTestCase extends DrupalWebTestCase {
    *   $xpath => $expected_text
    */
   function assertRenderedText($xpath_array) {
-    foreach($xpath_array as $xpath => $text) {
+    foreach ($xpath_array as $xpath => $text) {
       $result = $this->xpath($xpath);
       $this->assertTrue((string)$result[0][0] == $text, t('%ary selects text %text', array('%ary' => $xpath, '%text' => $text)));
     }
diff --git a/simpletest_example/simpletest_example.install b/simpletest_example/simpletest_example.install
index 36d1f13..7264a95 100644
--- a/simpletest_example/simpletest_example.install
+++ b/simpletest_example/simpletest_example.install
@@ -15,12 +15,8 @@ function simpletest_example_install() {
   node_add_body_field($types['simpletest_example']);
 }
 
-function simpletest_example_uninstall() {
-
-}
-
 /**
- * Add a body field to the simpletest_example node type.
+ * Adds a body field to the simpletest_example node type.
  */
 function simpletest_example_update_7001() {
   node_types_rebuild();
diff --git a/simpletest_example/simpletest_example.module b/simpletest_example/simpletest_example.module
index c76ddc3..ea77b2a 100644
--- a/simpletest_example/simpletest_example.module
+++ b/simpletest_example/simpletest_example.module
@@ -6,7 +6,6 @@
  * http://drupal.org/node/890654.
  *
  * This is built on a traditional node-type implementation.
- *
  */
 
 
diff --git a/token_example/token_example.module b/token_example/token_example.module
index a09dc86..dac5762 100644
--- a/token_example/token_example.module
+++ b/token_example/token_example.module
@@ -1,6 +1,11 @@
 <?php
 
 /**
+ * @file
+ * An example module showing how to define and use tokens.
+ */
+
+/**
  * Implements hook_menu().
  */
 function token_example_menu() {
-- 
1.7.0.5

