diff --git auth/services_oauth/services_oauth.inc auth/services_oauth/services_oauth.inc
index ac1020a..c5c819f 100644
--- auth/services_oauth/services_oauth.inc
+++ auth/services_oauth/services_oauth.inc
@@ -1,6 +1,11 @@
 <?php
 
 /**
+ * @file
+ * Include file for services_oauth module.
+ */
+
+/**
  * Authenticates a call using OAuth to verify the request.
  *
  * @param array $settings
diff --git auth/services_oauth/services_oauth.install auth/services_oauth/services_oauth.install
index 94d2cbc..492b55e 100644
--- auth/services_oauth/services_oauth.install
+++ auth/services_oauth/services_oauth.install
@@ -1,4 +1,8 @@
 <?php
+/**
+ * @file
+ * Install, update and uninstall functions for the services_oauth module.
+ */
 
 /**
  * Implementation of hook_install().
diff --git auth/services_sessauth/services_sessauth.inc auth/services_sessauth/services_sessauth.inc
index 6c242da..9d00e86 100644
--- auth/services_sessauth/services_sessauth.inc
+++ auth/services_sessauth/services_sessauth.inc
@@ -6,7 +6,7 @@
  */
 
 function _services_sessauth_authenticate_call($settings, $method, &$args, $auth_args) {
-  // Anyone passing in a specific session id to use, should do so in the 
+  // Anyone passing in a specific session id to use, should do so in the
   // 'sessid' key. Otherwise, just use the current session (IE do nothing.)
   if (isset($auth_args['sessid'])) {
     // Add additonal processing for methods requiring session
diff --git resources/comment_resource.inc resources/comment_resource.inc
index fa50f4b..de18638 100644
--- resources/comment_resource.inc
+++ resources/comment_resource.inc
@@ -357,9 +357,9 @@ function _comment_resource_access($op = 'view', $args = array()) {
  * Passthrough function to _node_resource_access().
  *
  * @see _node_resource_access()
- **/
+ */
 function _comment_resource_node_access($op = 'view', $args = array()) {
   module_load_include('inc', 'services', 'resources/node_resource');
-  
+
   return _node_resource_access($op, $args);
 }
diff --git resources/file_resource.inc resources/file_resource.inc
index fda5d13..49a69b9 100644
--- resources/file_resource.inc
+++ resources/file_resource.inc
@@ -1,6 +1,11 @@
 <?php
 
 /**
+ * @file
+ * File resource.
+ */
+
+/**
  * THERE SHOULD BE NO UPDATE!!!
  * Drupal doesn't allow updating or replacing a file in the files table.
  * If you need to, create a new file and remove the old file.
@@ -147,7 +152,7 @@ function _file_resource_create($file) {
   $file->filemime = file_get_mimetype($file->filename);
 
   // Rename potentially executable files, to help prevent exploits.
-  if (preg_match('/\.(php|pl|py|cgi|asp|js)$/i', $file->filename) && (substr($file->filename, -4) != '.txt')) {
+  if (preg_match('/\.(php|pl|py|cgi|asp|js)$/i', $file->filename) && (drupal_substr($file->filename, -4) != '.txt')) {
     $file->filemime = 'text/plain';
     $file->filepath .= '.txt';
     $file->filename .= '.txt';
@@ -193,12 +198,12 @@ function _file_resource_create($file) {
  */
 function _file_resource_retrieve($fid, $file_include_contents =  TRUE) {
   if ($file = db_fetch_array(db_query('SELECT * FROM {files} WHERE fid = %d', $fid))) {
-    if($file_include_contents) {
+    if ($file_include_contents) {
       $filepath = file_create_path($file['filepath']);
       $binaryfile = fopen($filepath, 'rb');
       $file['file'] = base64_encode(fread($binaryfile, filesize($filepath)));
       fclose($binaryfile);
-    }    
+    }
     return $file;
   }
   else {
@@ -228,7 +233,7 @@ function _file_resource_load_node_files($nid, $file_include_contents = TRUE) {
       $send = array();
       foreach ($files as $file) {
         $file = array_shift($files);
-        if($file_include_contents) {
+        if ($file_include_contents) {
           $filepath = file_create_path($file->filepath);
           $binaryfile = fopen($filepath, 'rb');
           $file = base64_encode(fread($binaryfile, filesize($filepath)));
diff --git resources/node_resource.inc resources/node_resource.inc
index ef753ac..7a85a80 100644
--- resources/node_resource.inc
+++ resources/node_resource.inc
@@ -112,7 +112,7 @@ function _node_resource_definition() {
  * Returns the results of a node_load() for the specified node.
  *
  * This returned node may optionally take content_permissions settings into
- * account, based on a configuration setting. 
+ * account, based on a configuration setting.
  *
  * @param $nid
  *   NID of the node we want to return.
@@ -120,7 +120,7 @@ function _node_resource_definition() {
  *   Node object or FALSE if not found.
  *
  * @see node_load()
- **/
+ */
 function _node_resource_retrieve($nid) {
   global $user;
   $node = node_load($nid);
@@ -140,7 +140,8 @@ function _node_resource_retrieve($nid) {
     }
     $node->uri = services_resource_uri(array('node', $node->nid));
     return $node;
-  } else {
+  }
+  else {
     return services_error('Node nid '. $nid .' not found', 404);
   }
 }
@@ -159,7 +160,7 @@ function _node_resource_retrieve($nid) {
  *   the fully qualified URI to this resource.
  *
  * @see drupal_execute()
- **/
+ */
 function _node_resource_create($node) {
   $node = (object)$node;
 
@@ -216,7 +217,7 @@ function _node_resource_create($node) {
  *   The node's nid.
  *
  * @see drupal_execute()
- **/
+ */
 function _node_resource_update($nid, $node) {
   $node = (object)$node;
   $node->nid = $nid;
@@ -242,7 +243,7 @@ function _node_resource_update($nid, $node) {
   else {
     return services_error(t('Node not found'), 404);
   }
-  
+
   $nid = $node->nid;
   $node = array('nid' => $nid);
   if ($uri = services_resource_uri(array('node', $nid))) {
@@ -258,7 +259,7 @@ function _node_resource_update($nid, $node) {
  *   Node ID of the node we're deleting.
  * @return
  *   The node's nid.
- **/
+ */
 function _node_resource_delete($nid) {
   node_delete($nid);
   return 1;
@@ -277,19 +278,19 @@ function _node_resource_delete($nid) {
  * @param $page
  *   Page number of results to return (in pages of 20).
  * @param $fields
- *   The fields you want returned. 
+ *   The fields you want returned.
  * @param $parameters
  *   An array of fields and values used to build a sql WHERE clause indicating
  *   what items should be deleted.
  * @return
  *   An array of node objects.
  *
- * @todo 
+ * @todo
  *   Evaluate the functionality here in general. Particularly around
  *     - Do we need fields at all? Should this just return full nodes?
  *     - Is there an easier syntax we can define which can make the urls
  *       for index requests more straightforward?
- **/
+ */
 function _node_resource_index($page = 0, $fields = '*', $parameters = array()) {
   $parameters = (array) $parameters;
   $schema = drupal_get_schema('node');
@@ -299,10 +300,10 @@ function _node_resource_index($page = 0, $fields = '*', $parameters = array()) {
 
   // Limit to published nodes if user doesn't have 'administer nodes'
   // permissions.
-  if (!user_access('administer nodes')) {	
+  if (!user_access('administer nodes')) {
     $parameters['status'] = 1;
   }
-  
+
   // Build an array of fields with the appropriate placeholders for use in
   // db_query().
   foreach ($parameters as $field => $value) {
@@ -339,26 +340,28 @@ function _node_resource_index($page = 0, $fields = '*', $parameters = array()) {
  * @return bool
  *
  * @see node_access()
- **/
+ */
 function _node_resource_access($op = 'view', $args = array()) {
   // Make sure we have an object or this all fails, some servers can
   // mess up the types.
   if (is_array($args[0])) {
     $args[0] = (object) $args[0];
-  } else if(!is_array($args[0]) && !is_object($args[0])) {  //This is to determine if it is just a string
-    $args[0] = (object)array('nid'=>$args[0]);
+  }
+  elseif (!is_array($args[0]) && !is_object($args[0])) {  //This is to determine if it is just a string
+    $args[0] = (object)array('nid' => $args[0]);
   }
 
   if ($op != 'create' && !empty($args)) {
     $node = node_load($args[0]->nid);
   }
-  else if ($op == 'create') {
+  elseif ($op == 'create') {
     $node = $args[0]->type;
     return node_access($op, $node);
   }
-  if(isset($node->nid) && $node->nid) {
+  if (isset($node->nid) && $node->nid) {
     return node_access($op, $node);
-  } else {
+  }
+  else {
     return services_error('Node id: '. $args[0]->nid .' could not be found', 404);
   }
 }
\ No newline at end of file
diff --git resources/taxonomy_resource.inc resources/taxonomy_resource.inc
index 7fba247..da47604 100644
--- resources/taxonomy_resource.inc
+++ resources/taxonomy_resource.inc
@@ -97,44 +97,44 @@ function _taxonomy_resource_definition() {
               'optional'     => FALSE,
             ),
             array(
-              'name'         => 'fields',
-              'type'         => 'string',
-              'description'  => t('The fields to retrieve, separated by comma.'),
-              'source'       => 'data',
-              'optional'     => TRUE,
-              'default value'=> array(),
+              'name'          => 'fields',
+              'type'          => 'string',
+              'description'   => t('The fields to retrieve, separated by comma.'),
+              'source'        => 'data',
+              'optional'      => TRUE,
+              'default value' => array(),
             ),
             array(
-              'name'         => 'operator',
-              'type'         => 'string',
-              'description'  => t('How to interpret multiple IDs in the array. Can be "or" or "and".'),
-              'source'       => 'data',
-              'optional'     => TRUE,
-              'default value'=> 'or',
+              'name'          => 'operator',
+              'type'          => 'string',
+              'description'   => t('How to interpret multiple IDs in the array. Can be "or" or "and".'),
+              'source'        => 'data',
+              'optional'      => TRUE,
+              'default value' => 'or',
             ),
             array(
-              'name'         => 'depth',
-              'type'         => 'int',
-              'description'  => t('How many levels deep to traverse the taxonomy tree. Can be a nonnegative integer or "all".'),
-              'source'       => 'data',
-              'optional'     => TRUE,
-              'default value'=> 0,
+              'name'          => 'depth',
+              'type'          => 'int',
+              'description'   => t('How many levels deep to traverse the taxonomy tree. Can be a nonnegative integer or "all".'),
+              'source'        => 'data',
+              'optional'      => TRUE,
+              'default value' => 0,
             ),
             array(
-              'name'         => 'pager',
-              'type'         => 'int',
-              'description'  => t('Whether the nodes are to be used with a pager (the case on most Drupal pages) or not (in an XML feed, for example).'),
-              'source'       => 'data',
-              'optional'     => TRUE,
-              'default value'=> TRUE,
+              'name'          => 'pager',
+              'type'          => 'int',
+              'description'   => t('Whether the nodes are to be used with a pager (the case on most Drupal pages) or not (in an XML feed, for example).'),
+              'source'        => 'data',
+              'optional'      => TRUE,
+              'default value' => TRUE,
             ),
             array(
-              'name'         => 'order',
-              'type'         => 'int',
-              'description'  => t('The order clause for the query that retrieve the nodes.'),
-              'source'       => 'data',
-              'optional'     => TRUE,
-              'default value'=> 'n.sticky DESC, n.created DESC',
+              'name'          => 'order',
+              'type'          => 'int',
+              'description'   => t('The order clause for the query that retrieve the nodes.'),
+              'source'        => 'data',
+              'optional'      => TRUE,
+              'default value' => 'n.sticky DESC, n.created DESC',
             ),
           ),
         ),
@@ -211,7 +211,7 @@ function _taxonomy_resource_definition() {
         'access arguments append' => TRUE,
         'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/taxonomy_resource'),
       ),
-      'actions' =>array(
+      'actions' => array(
         'getTree' => array(
           'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/taxonomy_resource'),
           'help'   => t('This method returns a full list of taxonomy terms.'),
@@ -258,7 +258,7 @@ function _taxonomy_resource_definition() {
  * @return
  *   A term object.
  *
- * @see taxonomy_get_term().
+ * @see taxonomy_get_term()
  */
 function _taxonomy_term_resource_retrieve($tid) {
   return taxonomy_get_term($tid);
@@ -272,7 +272,7 @@ function _taxonomy_term_resource_retrieve($tid) {
  * @return
  *   Status constant indicating if term was inserted or updated.
  *
- * @see taxonomy_save_term().
+ * @see taxonomy_save_term()
  */
 function _taxonomy_term_resource_create($term) {
   $term = (array) $term;
@@ -289,7 +289,7 @@ function _taxonomy_term_resource_create($term) {
  * @return
  *   Status constant indicating if term was inserted or updated.
  *
- * @see taxonomy_save_term().
+ * @see taxonomy_save_term()
  */
 function _taxonomy_term_resource_update($tid, $term) {
   $term = (array) $term;
@@ -305,7 +305,7 @@ function _taxonomy_term_resource_update($tid, $term) {
  * @return
  *   Status constant indicating deletion.
  *
- * @see taxonomy_del_term().
+ * @see taxonomy_del_term()
  */
 function _taxonomy_term_resource_delete($tid) {
   return taxonomy_del_term($tid);
@@ -320,7 +320,7 @@ function _taxonomy_term_resource_delete($tid) {
  * @return
  *   A vocabulary object or FALSE.
  *
- * @see taxonomy_vocabulary_load().
+ * @see taxonomy_vocabulary_load()
  */
 function _taxonomy_vocabulary_resource_retrieve($vid) {
   return taxonomy_vocabulary_load($vid);
@@ -353,7 +353,7 @@ function _taxonomy_vocabulary_resource_retrieve($vid) {
  * @return
  *   Status constant indicating if vocabulary was inserted or updated.
  *
- * @see taxonomy_save_vocabulary().
+ * @see taxonomy_save_vocabulary()
  */
 function _taxonomy_vocabulary_resource_create($vocabulary) {
   $vocabulary = (array) $vocabulary;
@@ -370,7 +370,7 @@ function _taxonomy_vocabulary_resource_create($vocabulary) {
  * @return
  *   Status constant indicating if vocabulary was inserted or updated.
  *
- * @see taxonomy_save_vocabulary().
+ * @see taxonomy_save_vocabulary()
  */
 function _taxonomy_vocabulary_resource_update($vid, $vocabulary) {
   $vocabulary = (array) $vocabulary;
@@ -386,7 +386,7 @@ function _taxonomy_vocabulary_resource_update($vid, $vocabulary) {
  * @return
  *   Status constant indicating deletion.
  *
- * @see taxonomy_del_vocabulary().
+ * @see taxonomy_del_vocabulary()
  */
 function _taxonomy_vocabulary_resource_delete($vid) {
   return taxonomy_del_vocabulary($vid);
@@ -397,12 +397,11 @@ function _taxonomy_vocabulary_resource_delete($vid) {
 /**
  * Services interface to taxonomy_get_tree().
  *
- * @see
- *   taxonomy_get_tree()
+ * @see taxonomy_get_tree()
  */
 function taxonomy_service_get_tree($vid, $parent = 0, $max_depth = NULL) {
   $terms = taxonomy_get_tree($vid, $parent, -1, $max_depth);
-  if(empty($terms)) {
+  if (empty($terms)) {
     return services_error('No vocabulary with id: '. $vid .' found.', 404);
   }
   return $terms;
@@ -414,23 +413,22 @@ function taxonomy_service_get_tree($vid, $parent = 0, $max_depth = NULL) {
  * Note that where taxonomy_select_nodes() returns the results
  * of a db_query(), this function returns an array of node objects.
  *
- * @see
- *   taxonomy_select_nodes().
+ * @see taxonomy_select_nodes()
  * @return
  *   An array of node objects.
  */
 function taxonomy_service_select_nodes($tids, $fields, $operator, $depth, $pager, $order) {
-  if(!is_array($tids)) {
-   $tids =  explode(',', $tids);
+  if (!is_array($tids)) {
+    $tids =  explode(',', $tids);
   }
-  if(!is_array($fields)) {
-   $fields =  explode(',', $fields);
+  if (!is_array($fields)) {
+    $fields =  explode(',', $fields);
   }
   $result = taxonomy_select_nodes($tids, $operator, $depth, $pager, $order);
   while ($node = db_fetch_object($result)) {
     $nodes[] = services_node_load(node_load($node->nid), $fields);
   }
-  if(empty($nodes)) {
+  if (empty($nodes)) {
     return services_error('No nodes were found with tid(s): '. implode(",", $tids), 404);
   }
   return $nodes;
diff --git resources/user_resource.inc resources/user_resource.inc
index 489c1bd..c638797 100644
--- resources/user_resource.inc
+++ resources/user_resource.inc
@@ -1,6 +1,5 @@
 <?php
 
-
 function _user_resource_definition() {
   return array(
     'user' => array(
@@ -64,7 +63,7 @@ function _user_resource_definition() {
           ),
         ),
       ),
-     
+
       'delete' => array(
         'help' => 'Deletes a user',
         'callback' => '_user_resource_delete',
@@ -173,11 +172,11 @@ function _user_resource_retrieve($uid) {
 /**
  * Create a new user.
  *
- * This function uses drupal_execute() and as such exepects all input to match 
+ * This function uses drupal_execute() and as such exepects all input to match
  * the submitting form in question.
  *
  * @param $account
- *   A object containing account information. The $account object should 
+ *   A object containing account information. The $account object should
  *   contain, at minimum, the following properties:
  *     - name (user name)
  *     - mail (email address)
@@ -189,8 +188,8 @@ function _user_resource_retrieve($uid) {
  *
  *  Roles can be passed in a roles property which is an associative
  *  array formatted with '<role id>' => '<role id>', not including
- *  the authenticated user role, which is given by default. 
- *  
+ *  the authenticated user role, which is given by default.
+ *
  * @return
  *   The user object of the newly created user.
  */
@@ -216,7 +215,7 @@ function _user_resource_create($account) {
     'pass2' => $account->pass,
   );
   $form_state['values']['op'] = t('Create new account');
-  
+
   $ret = drupal_execute('user_register', $form_state);
 
   // Error if needed.
@@ -231,7 +230,7 @@ function _user_resource_create($account) {
 /**
  * Update an existing user.
  *
- * This function uses drupal_execute() and as such exepects all input to match 
+ * This function uses drupal_execute() and as such exepects all input to match
  * the submitting form in question.
  *
  * @param $uid
@@ -266,7 +265,7 @@ function _user_resource_update($uid, $account) {
     $category = $account->category;
     unset($account->category);
   }
-  
+
   // Drop any passed in values into the $account var. Anything
   // unused by the form just gets ignored.
   foreach ($account as $key => $value) {
@@ -382,7 +381,7 @@ function _user_resource_logout() {
  * @param $page
  *   Page number of results to return (in pages of 20).
  * @param $fields
- *   The fields you want returned. 
+ *   The fields you want returned.
  * @param $parameters
  *   An array of fields and values used to build a sql WHERE clause indicating
  *   what items should be deleted.
@@ -390,7 +389,7 @@ function _user_resource_logout() {
  *   An array of user objects.
  *
  * @see _node_resource_index() for more notes
- **/
+ */
 function _user_resource_index($page = 0, $fields = '*', $parameters = array()) {
   $parameters = (array) $parameters;
   $schema = drupal_get_schema('users');
@@ -429,24 +428,24 @@ function _user_resource_index($page = 0, $fields = '*', $parameters = array()) {
  */
 function _user_resource_access($op = 'view', $args = array()) {
   global $user;
-  switch($op) {
+  switch ($op) {
     case 'view':
         $account = user_load($args[0]);
-        if(!$account->uid) {
+        if (!$account->uid) {
           return services_error('That user ID does not exist', 406);
         }
-        return user_view_access($account);   
+        return user_view_access($account);
     case 'update':
         $account = user_load($args[0]);
-        if(!$account->uid) {
+        if (!$account->uid) {
           return services_error('That user ID does not exist', 406);
-        }      
+        }
       return ($user->uid == $account->uid || user_access('administer users'));
     case 'create':
       return user_access('administer users');
     case 'delete':
       $account = user_load($args[0]);
-      if(!$account->uid) {
+      if (!$account->uid) {
         return services_error('That user ID does not exist', 406);
       }
       return user_access('administer users');
diff --git servers/rest_server/formats/RssFormatView.inc servers/rest_server/formats/RssFormatView.inc
index 56a01fb..2f25b38 100644
--- servers/rest_server/formats/RssFormatView.inc
+++ servers/rest_server/formats/RssFormatView.inc
@@ -10,8 +10,8 @@ class RssFormatView extends RESTServerView {
     }
 
     $out = '<?xml version="1.0" encoding="utf-8"?>' . "\n";
-    $out .= '<rss version="2.0" xml:base="' . url('', array('absolute'=>TRUE)) . '"  xmlns:dc="http://purl.org/dc/elements/1.1/">' . "\n";
-    $out .= format_rss_channel(variable_get('site_name',''), url($_GET['q'], array('absolute'=>TRUE)), variable_get('site_name',''), $items);
+    $out .= '<rss version="2.0" xml:base="' . url('', array('absolute' => TRUE)) . '"  xmlns:dc="http://purl.org/dc/elements/1.1/">' . "\n";
+    $out .= format_rss_channel(variable_get('site_name', ''), url($_GET['q'], array('absolute' => TRUE)), variable_get('site_name', ''), $items);
 
     return $out;
   }
diff --git servers/rest_server/formats/XCalFormatView.inc servers/rest_server/formats/XCalFormatView.inc
index 0a5e1ee..2272463 100644
--- servers/rest_server/formats/XCalFormatView.inc
+++ servers/rest_server/formats/XCalFormatView.inc
@@ -68,15 +68,15 @@ class XCalFormatView extends RESTServerView {
     $value = preg_replace('/\n+/', ' ', $value);
     $value = preg_replace('/\s{2,}/', ' ', $value);
 
-    $preamble_len = strlen($preamble);
+    $preamble_len = drupal_strlen($preamble);
 
     $lines = array();
-    while (strlen($value)>(75-$preamble_len)) {
+    while (drupal_strlen($value)>(75-$preamble_len)) {
       $space = (75-$preamble_len);
       $mbcc = $space;
       while ($mbcc) {
         $line = mb_substr($value, 0, $mbcc);
-        $oct = strlen($line);
+        $oct = drupal_strlen($line);
         if ($oct > $space) {
           $mbcc -= $oct-$space;
         }
diff --git servers/rest_server/includes/RESTServer.inc servers/rest_server/includes/RESTServer.inc
index 367f2f3..90955b8 100755
--- servers/rest_server/includes/RESTServer.inc
+++ servers/rest_server/includes/RESTServer.inc
@@ -1,5 +1,10 @@
 <?php
 
+/**
+ * @file
+ * Class for handling REST calls.
+ */
+
 class RESTServer {
   private $endpoint;
 
@@ -204,7 +209,7 @@ class RESTServer {
             }
           }
           else {
-              if(isset($sources[$info['source']][$info['name']])) {
+              if (isset($sources[$info['source']][$info['name']])) {
                 $arguments[$i] = $sources[$info['source']][$info['name']];
               }
           }
@@ -230,10 +235,10 @@ class RESTServer {
         if (!isset($arguments[$i])) {
           if (isset($info['default value'])) {
             $arguments[$i] = $info['default value'];
-          } 
-          else if (!isset($info['optional']) || !$info['optional']) {
+          }
+          elseif (!isset($info['optional']) || !$info['optional']) {
             throw new ServicesArgumentException(t('Missing required argument !arg', array(
-              '!arg'=>$info['name'])), $info['name'], 406);
+              '!arg' => $info['name'])), $info['name'], 406);
           }
           else {
               $arguments[$i] = NULL;
@@ -264,7 +269,7 @@ class RESTServer {
         $parser = $this->requestParsers($mime, $controller);
         if (!$parser) {
           throw new ServicesException(t('Unsupported request content type !mime', array(
-              '!mime'=>$mime,
+              '!mime' => $mime,
             )), 406);
         }
 
@@ -300,8 +305,8 @@ class RESTServer {
           $pcount = count($pm[0]);
           for ($i=0; $i<$pcount; $i++) {
             $value = $pm[2][$i];
-            if (substr($value, 0, 1) == '"') {
-              $value = stripcslashes(substr($value, 1, mb_strlen($value)-2));
+            if (drupal_substr($value, 0, 1) == '"') {
+              $value = stripcslashes(drupal_substr($value, 1, mb_strlen($value)-2));
             }
             $ret_val['param'][$pm[1][$i]] = $value;
           }
@@ -329,7 +334,7 @@ class RESTServer {
     $filename = file_munge_filename(trim(basename(($disposition['param']['filename']))));
 
     // Rename potentially executable files, to help prevent exploits.
-    if (preg_match('/\.(php|pl|py|cgi|asp|js)$/i', $filename) && (substr($filename, -4) != '.txt')) {
+    if (preg_match('/\.(php|pl|py|cgi|asp|js)$/i', $filename) && (drupal_substr($filename, -4) != '.txt')) {
       $type['value'] = 'text/plain';
       $filename .= '.txt';
     }
@@ -463,32 +468,32 @@ class RESTServer {
         'xml' => array(
           'mime types' => array('application/xml', 'text/xml'),
           'view' => 'RESTServerViewBuiltIn',
-          'view arguments' => array('format'=>'xml'),
+          'view arguments' => array('format' => 'xml'),
         ),
         'json' => array(
           'mime types' => array('application/json'),
           'view' => 'RESTServerViewBuiltIn',
-          'view arguments' => array('format'=>'json'),
+          'view arguments' => array('format' => 'json'),
         ),
         'jsonp' => array(
           'mime types' => array('text/javascript', 'application/javascript'),
           'view' => 'RESTServerViewBuiltIn',
-          'view arguments' => array('format'=>'jsonp'),
+          'view arguments' => array('format' => 'jsonp'),
         ),
         'php' => array(
           'mime types' => array('application/vnd.php.serialized'),
           'view' => 'RESTServerViewBuiltIn',
-          'view arguments' => array('format'=>'php'),
+          'view arguments' => array('format' => 'php'),
         ),
         'yaml' => array(
           'mime types' => array('text/plain', 'application/x-yaml', 'text/yaml'),
           'view' => 'RESTServerViewBuiltIn',
-          'view arguments' => array('format'=>'yaml'),
+          'view arguments' => array('format' => 'yaml'),
         ),
         'bencode' => array(
           'mime types' => array('application/x-bencode'),
           'view' => 'RESTServerViewBuiltIn',
-          'view arguments' => array('format'=>'bencode'),
+          'view arguments' => array('format' => 'bencode'),
         ),
         'rss' => array(
           'model' => 'ResourceFeedModel',
@@ -521,14 +526,14 @@ class RESTServer {
     }
   }
 
- private function resolveController($resource, $method, $path) {
+  private function resolveController($resource, $method, $path) {
     $pc = count($path);
     // Use the index handler for all empty path request, except on POST
     if (!$pc && $method!='POST') {
       return isset($resource['index']) ? $resource['index'] : NULL;
     }
     // Detect the standard crud operations
-    else if (
+    elseif (
         ($pc==1 && ($method=='GET' || $method=='PUT' || $method=='DELETE')) ||
         ($pc==0 && $method='POST')) {
       $action_mapping = array(
@@ -546,18 +551,18 @@ class RESTServer {
       }
     }
     // Detect relationship requests
-    else if ($pc>=2 && $method=='GET') {
+    elseif ($pc >= 2 && $method == 'GET') {
       if (isset($resource['relationships']) && $resource['relationships'][$path[1]]) {
         $relationship = $resource['relationships'][$path[1]];
         return $relationship;
       }
     }
     // Detect action requests
-    else if ($pc==1 && $method=='POST') {
+    elseif ($pc == 1 && $method == 'POST') {
       return $resource['actions'][$path[0]];
     }
     // Detect action requests targeted at specific resources
-    else if ($pc>=2 && $method=='POST') {
+    elseif ($pc >= 2 && $method == 'POST') {
       $action = $resource['targeted actions'][$path[1]];
       return $action;
     }
diff --git servers/rest_server/includes/models.inc servers/rest_server/includes/models.inc
index 79041f9..fd02450 100644
--- servers/rest_server/includes/models.inc
+++ servers/rest_server/includes/models.inc
@@ -14,8 +14,8 @@ interface ResourceFeedModel extends Iterator {
   //  * is called. This makes it possible for the model to ensure that required
   //  * data is requested when the model is used.
   //  *
-  //  * @param array &$arguments 
-  //  * @param array $model_arguments 
+  //  * @param array &$arguments
+  //  * @param array $model_arguments
   //  * @return void
   //  */
   // public static function alterArguments(&$arguments, $model_arguments);
@@ -30,7 +30,7 @@ interface ResourceFeedModelItem {
   public function getDescription();
   public function getUrl();
   public function getCreated();
-  
+
   /**
    * Gets a associative array containing extra properties for the item.
    *
@@ -47,7 +47,7 @@ interface ResourceTimeFeedModel extends ResourceFeedModel {
 }
 
 /**
- * Interface that must be implemented by items returned 
+ * Interface that must be implemented by items returned
  * by a ResourceTimeFeedModel.
  */
 interface ResourceTimeFeedModelItem extends ResourceFeedModelItem {
@@ -58,7 +58,7 @@ interface ResourceTimeFeedModelItem extends ResourceFeedModelItem {
    *  The starting time of the item as a timestamp
    */
   public function getStarts();
-  
+
   /**
    * Gets the end time of the item
    *
diff --git servers/rest_server/includes/node_resource.models.inc servers/rest_server/includes/node_resource.models.inc
index f258718..66908cf 100644
--- servers/rest_server/includes/node_resource.models.inc
+++ servers/rest_server/includes/node_resource.models.inc
@@ -142,7 +142,11 @@ class NodeResourceFeedModelItem implements ResourceTimeFeedModelItem {
 
     // Allow modules to add additional item fields and/or modify $item
     $extra = node_invoke_nodeapi($item, 'rss item');
-    $extra = array_merge($extra, array(array('key' => 'pubDate', 'value' => gmdate('r', $item->created)), array('key' => 'dc:creator', 'value' => $item->name), array('key' => 'guid', 'value' => $item->nid .' at '. $base_url, 'attributes' => array('isPermaLink' => 'false'))));
+    $extra = array_merge($extra, array(
+      array('key' => 'pubDate', 'value' => gmdate('r', $item->created)),
+      array('key' => 'dc:creator', 'value' => $item->name),
+      array('key' => 'guid', 'value' => $item->nid . ' at ' . $base_url, 'attributes' => array('isPermaLink' => 'false')))
+    );
     foreach ($extra as $element) {
       if (isset($element['namespace'])) {
         $namespaces = array_merge($namespaces, $element['namespace']);
@@ -157,7 +161,7 @@ class NodeResourceFeedModelItem implements ResourceTimeFeedModelItem {
       case 'teaser':
         $item_text = $item->teaser;
         if (!empty($item->readmore)) {
-          $item_text .= '<p>'. l(t('read more'), 'node/'. $item->nid, array('absolute' => TRUE, 'attributes' => array('target' => '_blank'))) .'</p>';
+          $item_text .= '<p>' . l(t('read more'), 'node/' . $item->nid, array('absolute' => TRUE, 'attributes' => array('target' => '_blank'))) . '</p>';
         }
         break;
       case 'title':
@@ -217,4 +221,4 @@ class NodeResourceFeedModelItem implements ResourceTimeFeedModelItem {
   public function getProperties() {
     return get_object_vars($this->node);
   }
-}
\ No newline at end of file
+}
diff --git servers/rest_server/includes/rest_server.views.inc servers/rest_server/includes/rest_server.views.inc
index 780b4af..4a73b72 100644
--- servers/rest_server/includes/rest_server.views.inc
+++ servers/rest_server/includes/rest_server.views.inc
@@ -1,7 +1,14 @@
 <?php
+// $Id$
 
 /**
- * Base class for all response format views
+ * @file
+ * Provide formatter class for all standard response formats.
+ *
+ */
+
+/**
+ * Base class for all response format views.
  */
 abstract class RESTServerView {
   protected $model;
@@ -91,7 +98,7 @@ class RESTServerViewBuiltIn extends RESTServerView {
         $parent->setAttribute('is_array', 'true');
       }
     }
-    else if ($data!==NULL) {
+    elseif ($data !== NULL) {
       $parent->appendChild($doc->createTextNode($data));
     }
   }
diff --git servers/rest_server/rest_server.api.php servers/rest_server/rest_server.api.php
index 9d00cf0..7e0217f 100644
--- servers/rest_server/rest_server.api.php
+++ servers/rest_server/rest_server.api.php
@@ -17,7 +17,7 @@
 function hook_rest_server_request_parsers_alter() {
   return array(
     'name' => 'REST',
-  );  
+  );
 }
 
 /**
@@ -27,6 +27,6 @@ function hook_rest_server_request_parsers_alter() {
 function hook_rest_server_response_formatters_alter() {
   return array(
     'name' => 'REST',
-  );  
+  );
 }
 
diff --git servers/rest_server/rest_server.inc servers/rest_server/rest_server.inc
index 2173e8d..462a8ac 100644
--- servers/rest_server/rest_server.inc
+++ servers/rest_server/rest_server.inc
@@ -1,5 +1,10 @@
 <?php
 
+/**
+ * @file
+ * Autoload classes.
+ */
+
 function _rest_server_autoload_info() {
   return array(
     'RESTServer' => array(
diff --git servers/rest_server/rest_server.module servers/rest_server/rest_server.module
index e3a31a6..26579ea 100755
--- servers/rest_server/rest_server.module
+++ servers/rest_server/rest_server.module
@@ -39,7 +39,7 @@ function rest_server_server() {
   }
   catch (Exception $e) {
     $code = $e->getCode();
-    switch($code) {
+    switch ($code) {
       case 401:
         drupal_set_header('HTTP/1.0 401 Unauthorized: ' . $e->getMessage());
       break;
diff --git services.admin.inc services.admin.inc
index ab6a27f..e269fe3 100644
--- services.admin.inc
+++ services.admin.inc
@@ -39,7 +39,7 @@ function services_list_endpoint($js = NULL) {
     else {
       $debug[] = array(
         'title' => t('Turn On'),
-        'style' => array('color'=> 'green'),
+        'style' => array('color' => 'green'),
         'href'  => 'admin/build/services/' . $endpoint->name . '/enabledebug',
         'query' => drupal_get_destination(),
       );
@@ -89,12 +89,13 @@ function services_list_endpoint($js = NULL) {
       $auth_names[] = $info['title'];
     }
     $row_class = '';
-    if($endpoint->status) {
+    if ($endpoint->status) {
       $row_class = 'services-endpoint-enabled';
-    } else {
+    }
+    else {
       $row_class = 'services-endpoint-disabled';
     }
-    if($endpoint->debug && $endpoint->status) {
+    if ($endpoint->debug && $endpoint->status) {
       $row_class = 'services-endpoint-debug';
     }
     $rows[$endpoint->name] = array(
@@ -118,9 +119,9 @@ function services_list_endpoint($js = NULL) {
         'storage' => array(
           'data'  => ($endpoint->export_type == EXPORT_IN_CODE) ? t('In code') : t('In database'),
           'class' => 'services-endpoint-storage',
-        ),       
+        ),
         'debug' => array(
-          'data'  =>theme('links', $debug),
+          'data'  => theme('links', $debug),
           'class' => 'services-endpoint-debug',
         ),
         'operations' => array(
@@ -477,7 +478,7 @@ function services_edit_form_endpoint_authentication(&$form_state, $endpoint) {
         'Drupal session based security will be used.'),
     );
   }
-  else if (empty($endpoint->authentication)) {
+  elseif (empty($endpoint->authentication)) {
     $form['message'] = array(
       '#type'          => 'item',
       '#title'         => t('No enabled authentication modules'),
diff --git services.authentication.api.php services.authentication.api.php
index 4261384..6676a6b 100644
--- services.authentication.api.php
+++ services.authentication.api.php
@@ -13,9 +13,9 @@
  /**
   * Supplies information about a given authentication method to Services.
   *
-  * @return 
+  * @return
   *   An associative array with information about the authentication method
-  *   and its callbacks. The possible keys are as follows (all keys are 
+  *   and its callbacks. The possible keys are as follows (all keys are
   *   optional unless noted).
   *
   *   - title (required): The display name for this authentication method.
@@ -24,15 +24,15 @@
   *   - authenticate_call (required): The name of a function to be called
   *     to perform the actual authentication. <details of params/return>
   *   - security_settings: A callback function which returns an associative
-  *     array of Form API elements for a settings form. 
+  *     array of Form API elements for a settings form.
   *   - _services_oauth_security_settings_validate: The name of a standard form
   *     validation callback for the form defined in 'security_settings'.
   *   - _services_oauth_security_settings_submit: The name of a standard form
   *     submit callback for the form defined in 'security_settings'.
-  *   - alter_methods: The name of a callback function which will alter a 
+  *   - alter_methods: The name of a callback function which will alter a
   *     services method signature in order to add required arguments.
-  *   - file: An include file which contains the authentication callbacks. 
+  *   - file: An include file which contains the authentication callbacks.
   */
 function hook_services_authentication_info() {
-  
+
 }
diff --git services.module services.module
index 6801c91..5f452a2 100644
--- services.module
+++ services.module
@@ -206,10 +206,10 @@ function services_endpoint_callback($endpoint_name) {
 
   $endpoint = services_endpoint_load($endpoint_name);
   $server = $endpoint->server;
-  
+
   if (function_exists($server . '_server')) {
     // call the server
-    if($endpoint->debug) {
+    if ($endpoint->debug) {
       watchdog('services', 'Calling server: %server', array('%server' => $server . '_server'), WATCHDOG_DEBUG);
     }
     services_set_server_info_from_array(array(
@@ -219,7 +219,7 @@ function services_endpoint_callback($endpoint_name) {
       'debug'         => $endpoint->debug,
       'drupal_path'   => getcwd(),
     ));
-    if($endpoint->debug) {
+    if ($endpoint->debug) {
       watchdog('services', 'Server info main object: <pre>@info</pre>', array('@info' => print_r(services_server_info_object(), TRUE)), WATCHDOG_DEBUG);
     }
     print call_user_func($server . '_server');
@@ -278,7 +278,7 @@ function services_services_crossdomain_domain_policy() {
 function services_xml_output($xml) {
   $xml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $xml;
   header('Connection: close');
-  header('Content-Length: ' . strlen($xml));
+  header('Content-Length: ' . drupal_strlen($xml));
   header('Content-Type: text/xml');
   header('Date: ' . date('r'));
   echo $xml;
@@ -309,10 +309,10 @@ function services_endpoint_load($name) {
   $result = ctools_export_load_object('services_endpoint', 'names', array($name));
   if (isset($result[$name])) {
     return $result[$name];
-  } 
+  }
   else {
-   $result =  db_query("SELECT * FROM {services_endpoint} WHERE name = '%s'", $name);
-   $matches = array();
+    $result = db_query("SELECT * FROM {services_endpoint} WHERE name = '%s'", $name);
+    $matches = array();
     while ($endpoint = db_fetch_object($result)) {
       return $endpoint;
     }
@@ -328,9 +328,9 @@ function services_endpoint_load($name) {
  */
 function services_endpoint_load_all() {
   ctools_include('export');
-  if(!ctools_export_load_object('services_endpoint')) {
-   $result =  db_query("SELECT * FROM {services_endpoint}");
-   $matches = array();
+  if (!ctools_export_load_object('services_endpoint')) {
+    $result = db_query("SELECT * FROM {services_endpoint}");
+    $matches = array();
     while ($endpoint = db_fetch_object($result)) {
       $matches[] = $endpoint;
     }
diff --git services.runtime.inc services.runtime.inc
index cf0fa57..7762ba5 100644
--- services.runtime.inc
+++ services.runtime.inc
@@ -97,7 +97,7 @@ class ServicesArgumentException extends ServicesException {
 function services_controller_execute($controller, $args = array(), $auth_args = array(), $options = array()) {
   // Check for missing arguments.
   $server_info =  services_server_info_object();
-  if($server_info->debug) {
+  if ($server_info->debug) {
     watchdog('services', 'Controller: <pre>@controller</pre>', array('@controller' => print_r($controller, TRUE)), WATCHDOG_DEBUG);
     watchdog('services', 'Passed arguments: <pre>@arguments</pre>', array('@arguments' => print_r($args, TRUE)), WATCHDOG_DEBUG);
   }
@@ -130,7 +130,7 @@ function services_controller_execute($controller, $args = array(), $auth_args =
     // Just use the arguments array if no access arguments have been specified
     $access_arguments = $args;
   }
-  
+
   // Call default or custom access callback
   if (call_user_func_array($controller['access callback'], $access_arguments) != TRUE) {
     global $user;
@@ -209,7 +209,7 @@ function services_authentication_info($module) {
  *  arg1 = Settings
  *  arg2 = Method
  *  arg3 = Controller
- *  arg4 = Auth args  
+ *  arg4 = Auth args
  *
  */
 function services_auth_invoke($module, $method, &$arg1 = NULL, &$arg2 = NULL, &$arg3 = NULL, $arg4 = NULL) {
diff --git services.servers.api.php services.servers.api.php
index f9b879e..dff762b 100644
--- services.servers.api.php
+++ services.servers.api.php
@@ -21,7 +21,7 @@
 function hook_server_info() {
   return array(
     'name' => 'REST',
-  );  
+  );
 }
 
 /**
@@ -32,5 +32,5 @@ function hook_server_info() {
  * servers.
  */
 function hook_server() {
-  
+
 }
\ No newline at end of file
diff --git tests/functional/NoAuthEndpointTestRunner.test tests/functional/NoAuthEndpointTestRunner.test
index 049409f..9497c84 100644
--- tests/functional/NoAuthEndpointTestRunner.test
+++ tests/functional/NoAuthEndpointTestRunner.test
@@ -14,7 +14,7 @@ require_once('ServicesEndpointTests.test') ;
 /**
  * Sets conditions for a no-authentication set of endpoint test runs.
  */
- class NoAuthEndpointTestRunner extends ServicesEndpointTests {
+class NoAuthEndpointTestRunner extends ServicesEndpointTests {
 
   // Class variables
   protected $privilegedUser = NULL ;
@@ -22,19 +22,19 @@ require_once('ServicesEndpointTests.test') ;
    /**
     * Implementation of setUp().
     */
-   public function setUp() {
-     parent::setUp();
-   }
+  public function setUp() {
+    parent::setUp();
+  }
 
-   /**
-    * Implementation of getInfo().
-    */
-   public static function getInfo() {
-     return array(
-       'name'        => t('Services Endpoint tests, no auth'),
-       'description' =>
-         t('Test the endpoint functionality when no authentication is turned on'),
-       'group'       => t('Services'),
-     ) ;
-   }
- }
\ No newline at end of file
+  /**
+   * Implementation of getInfo().
+   */
+  public static function getInfo() {
+    return array(
+      'name' => t('Services Endpoint tests, no auth'),
+      'description' =>
+      t('Test the endpoint functionality when no authentication is turned on'),
+      'group' => t('Services'),
+    );
+  }
+}
\ No newline at end of file
diff --git tests/functional/ServicesEndpointTests.test tests/functional/ServicesEndpointTests.test
index 276d3bc..7be3db5 100644
--- tests/functional/ServicesEndpointTests.test
+++ tests/functional/ServicesEndpointTests.test
@@ -12,131 +12,133 @@ require_once('ServicesWebTestCase.php') ;
  * Run test cases for the endpoint with no authentication turned on.
  *
  */
- class ServicesEndpointTests extends ServicesWebTestCase {
+class ServicesEndpointTests extends ServicesWebTestCase {
 
-	/**
-    * Implementation of setUp().
-    */
-   public function setUp() {
-     parent::setUp(
+  /**
+   * Implementation of setUp().
+   */
+  public function setUp() {
+    parent::setUp(
       'autoload',
-     	'ctools',
-     	'services',
+      'ctools',
+      'services',
       'rest_server',
       'services_sessauth',
       'inputstream'
-     );
-   }
-   /**
-    * Test adding an endpoint succeeds.
-    */
-   public function testEndpointForm() {
-     // Create and log in our privileged user.
-     $this->privilegedUser = $this->drupalCreateUser(array(
-         'administer services',
-     ));
-     $this->drupalLogin($this->privilegedUser);
+    );
+  }
 
-     $edit = $this->populateEndpointFAPI() ;
-     $this->drupalPost('admin/build/services/add', $edit, t('Save and proceed'));
-     $this->drupalGet($edit['path']);
-   }
-   /**
-    * Test adding an endpoint succeeds.
-    */
-   public function testSuccessfulAddEndpoint() {
-     $edit = $this->populateEndpointFAPI() ;
+  /**
+   * Test adding an endpoint succeeds.
+   */
+  public function testEndpointForm() {
     // Create and log in our privileged user.
     $this->privilegedUser = $this->drupalCreateUser(array(
-       'administer services',
-       'administer nodes',
+      'administer services',
     ));
     $this->drupalLogin($this->privilegedUser);
-     $this->drupalPost('admin/build/services/add', $edit, t('Save and proceed')) ;
-     $this->assertResponse('200', t('expected 200'));
-     $this->drupalGet('admin/build/services/list') ;
-     $this->assertResponse('200',t('expected 200'));
 
-     $this->assertText($edit['title'], t('Endpoint path appears')) ;
-     $this->assertText('rest_server', t('Server is rest server')) ;
-     $this->assertText('In database', t('Storage is in database')) ;
-   }
+    $edit = $this->populateEndpointFAPI() ;
+    $this->drupalPost('admin/build/services/add', $edit, t('Save and proceed'));
+    $this->drupalGet($edit['path']);
+  }
 
-   /**
-    * Test missing path to endpoint causes an error.
-    */
-   public function testMissingPath() {
-     $edit = $this->populateEndpointFAPI() ;
-     unset($edit['path']) ;
+  /**
+   * Test adding an endpoint succeeds.
+   */
+  public function testSuccessfulAddEndpoint() {
+    $edit = $this->populateEndpointFAPI() ;
+    // Create and log in our privileged user.
+    $this->privilegedUser = $this->drupalCreateUser(array(
+      'administer services',
+      'administer nodes',
+    ));
+    $this->drupalLogin($this->privilegedUser);
+    $this->drupalPost('admin/build/services/add', $edit, t('Save and proceed')) ;
+    $this->assertResponse('200', t('expected 200'));
+    $this->drupalGet('admin/build/services/list') ;
+    $this->assertResponse('200', t('expected 200'));
+
+    $this->assertText($edit['title'], t('Endpoint path appears')) ;
+    $this->assertText('rest_server', t('Server is rest server')) ;
+    $this->assertText('In database', t('Storage is in database')) ;
+  }
+
+  /**
+   * Test missing path to endpoint causes an error.
+   */
+  public function testMissingPath() {
+    $edit = $this->populateEndpointFAPI() ;
+    unset($edit['path']) ;
     // Create and log in our privileged user.
     $this->privilegedUser = $this->drupalCreateUser(array(
-       'administer services',
-       'administer nodes',
+      'administer services',
+      'administer nodes',
     ));
     $this->drupalLogin($this->privilegedUser);
-     $this->drupalPost('admin/build/services/add', $edit, t('Save and proceed')) ;
-     $this->assertResponse('200', 'expected 200');
+    $this->drupalPost('admin/build/services/add', $edit, t('Save and proceed')) ;
+    $this->assertResponse('200', 'expected 200');
 
-     $this->assertText('Path to endpoint field is required.',
-       t('Endpoint path missing error message.')) ;
-     $this->assertFieldByName('title', $edit['title'],
-       t('Title field remains.')) ;
-     $this->assertFieldByName('server', 'rest_server',
-       t('Server is rest server')) ;
-     $this->assertFieldChecked('edit-services-use-content-permissions',
-       t('Storage use content permission is checked.')) ;
-   }
+    $this->assertText('Path to endpoint field is required.',
+      t('Endpoint path missing error message.')) ;
+    $this->assertFieldByName('title', $edit['title'],
+      t('Title field remains.')) ;
+    $this->assertFieldByName('server', 'rest_server',
+      t('Server is rest server')) ;
+    $this->assertFieldChecked('edit-services-use-content-permissions',
+      t('Storage use content permission is checked.')) ;
+  }
 
-   /**
-    * Test missing title for endpoint causes an error.
-    */
-   public function testMissingTitle() {
-     $edit = $this->populateEndpointFAPI() ;
-     unset($edit['title']) ;
+  /**
+   * Test missing title for endpoint causes an error.
+   */
+  public function testMissingTitle() {
+    $edit = $this->populateEndpointFAPI() ;
+    unset($edit['title']) ;
     // Create and log in our privileged user.
     $this->privilegedUser = $this->drupalCreateUser(array(
-       'administer services',
-       'administer nodes',
+      'administer services',
+      'administer nodes',
     ));
     $this->drupalLogin($this->privilegedUser);
-     $this->drupalPost('admin/build/services/add', $edit, t('Save and proceed')) ;
-     $this->assertResponse('200', 'expected 200');
+    $this->drupalPost('admin/build/services/add', $edit, t('Save and proceed')) ;
+    $this->assertResponse('200', 'expected 200');
 
-     $this->assertText('Endpoint title field is required.',
-       t('Endpoint title missing error message.')) ;
-     $this->assertFieldByName('name', $edit['name'],
-       t('Name field remains.')) ;
-     $this->assertFieldByName('server', 'rest_server',
-       t('Server is rest server')) ;
-     $this->assertFieldChecked('edit-services-use-content-permissions',
-       t('Storage use content permission is checked.')) ;
-   }
+    $this->assertText('Endpoint title field is required.',
+      t('Endpoint title missing error message.')) ;
+    $this->assertFieldByName('name', $edit['name'],
+      t('Name field remains.')) ;
+    $this->assertFieldByName('server', 'rest_server',
+      t('Server is rest server')) ;
+    $this->assertFieldChecked('edit-services-use-content-permissions',
+      t('Storage use content permission is checked.')) ;
+  }
 
-   /**
-    * Test missing server for endpoint causes an error.
-    */
-   public function testMissingServer() {
-     $edit = $this->populateEndpointFAPI() ;
-     unset($edit['server']) ;
+  /**
+   * Test missing server for endpoint causes an error.
+   */
+  public function testMissingServer() {
+    $edit = $this->populateEndpointFAPI();
+    unset($edit['server']);
     // Create and log in our privileged user.
     $this->privilegedUser = $this->drupalCreateUser(array(
-       'administer services',
-       'administer nodes',
+      'administer services',
+      'administer nodes',
     ));
     $this->drupalLogin($this->privilegedUser);
-     $this->drupalPost('admin/build/services/add', $edit,
-       t('Save and proceed')) ;
-     $this->assertResponse('200', 'expected 200');
+    $this->drupalPost('admin/build/services/add', $edit,
+      t('Save and proceed'));
+    $this->assertResponse('200', 'expected 200');
 
-     $this->assertText('Server field is required.',
-       t('Server missing error message.')) ;
-     $this->assertFieldByName('name', $edit['name'],
-       t('Name field remains.')) ;
-     $this->assertFieldByName('title', $edit['title'],
-       t('Title field remains.')) ;
-     $this->assertFieldChecked('edit-services-use-content-permissions',
-       t('Storage use content permission is checked.')) ;
-   }
+    $this->assertText('Server field is required.',
+      t('Server missing error message.'));
+    $this->assertFieldByName('name', $edit['name'],
+      t('Name field remains.'));
+    $this->assertFieldByName('title', $edit['title'],
+      t('Title field remains.'));
+    $this->assertFieldChecked('edit-services-use-content-permissions',
+      t('Storage use content permission is checked.')) ;
+  }
 
    /*
     ------------------------------------
@@ -144,23 +146,23 @@ require_once('ServicesWebTestCase.php') ;
     ------------------------------------
    */
 
-   /**
-    * Creates a data array for populating an endpoint creation form.
-    *
-    * @return
-    * An array of fields for fully populating an endpoint creation form.
-    */
-   public function populateEndpointFAPI() {
-     return array(
-       'name'   => 'mchnname',
-       'title'  => $this->randomName(20),
-       'path'   => $this->randomName(10),
-       'server' => 'rest_server',
-       'services_use_content_permissions' => TRUE,
-     ) ;
-   }
+  /**
+   * Creates a data array for populating an endpoint creation form.
+   *
+   * @return
+   * An array of fields for fully populating an endpoint creation form.
+   */
+  public function populateEndpointFAPI() {
+    return array(
+      'name'   => 'machinename',
+      'title'  => $this->randomName(20),
+      'path'   => $this->randomName(10),
+      'server' => 'rest_server',
+      'services_use_content_permissions' => TRUE,
+    );
+  }
 
-   public function saveNewEndpoint() {
+  public function saveNewEndpoint() {
     $edit = $this->populateEndpointFAPI() ;
     $endpoint = new stdClass;
     $endpoint->disabled = FALSE; /* Edit this to true to make a default endpoint disabled initially */
@@ -339,36 +341,37 @@ require_once('ServicesWebTestCase.php') ;
     $endpoint->status = 1;
     services_endpoint_save($endpoint);
     $endpoint = services_endpoint_load($endpoint->name);
-    if($endpoint->name == $edit['name']) {
-      $this->pass('Endpoint successfully created');  
-    } else {
-       $this->fail('Endpoint creation failed');  
+    if ($endpoint->name == $edit['name']) {
+      $this->pass('Endpoint successfully created');
     }
-     $this->servicesGet($endpoint->path);
-     return $endpoint;
-   }
- /**
- * Builds out our post fields
- *
- */
+    else {
+      $this->fail('Endpoint creation failed');
+    }
+    $this->servicesGet($endpoint->path);
+    return $endpoint;
+  }
+  /**
+   * Builds out our post fields
+   *
+   */
   public function services_build_postfields($data = array()) {
-    $post_data = '';  
+    $post_data = '';
     if (is_array($data) && !empty($data)) {
       array_walk($data, array($this, 'services_flatten_fields'));
       $post_data = implode('&', $data);
     }
-    if(is_object($data) && !empty($data)) {
+    if (is_object($data) && !empty($data)) {
       array_walk(get_object_vars($data), array($this, 'services_flatten_fields'));
       $post_data = implode('&', $data);
     }
     return $post_data;
   }
-/**
- * Modifies our array data so we can turn it into a querystring
- * 
- * @param string $item - array value
- * @param string $key  - key of the array element
- */
+  /**
+   * Modifies our array data so we can turn it into a querystring
+   *
+   * @param string $item - array value
+   * @param string $key  - key of the array element
+   */
   public function services_flatten_fields(&$item, $key) {
     $item = $key .'='. $item;
   }
diff --git tests/functional/ServicesResourceCommentTests.test tests/functional/ServicesResourceCommentTests.test
index 55f574b..dad919e 100644
--- tests/functional/ServicesResourceCommentTests.test
+++ tests/functional/ServicesResourceCommentTests.test
@@ -43,11 +43,11 @@ class ServicesResourceCommentTests extends ServicesWebtestCase {
    * Implementation of getInfo().
    */
   public static function getInfo() {
-   return array(
-     'name'        => t('Resource Comment'),
-     'description' => t('Test the resource Comment methods and actions.'),
-     'group'       => t('Services'),
-   );
+    return array(
+      'name'        => t('Resource Comment'),
+      'description' => t('Test the resource Comment methods and actions.'),
+      'group'       => t('Services'),
+    );
   }
 
   /**
@@ -208,7 +208,7 @@ class ServicesResourceCommentTests extends ServicesWebtestCase {
     }
 
     // Load all comments of the first node.
-   $response = $this->servicesPost($path . '/comment/loadNodeComments', array('nid' => $nid));
+    $response = $this->servicesPost($path . '/comment/loadNodeComments', array('nid' => $nid));
     $this->assertEqual($comments, $response['body'], t('Received all 15 comments.'), 'CommentResource: loadNodeComments');
 
     // Load only 5 comments of the first node.
diff --git tests/functional/ServicesResourceNodeTests.test tests/functional/ServicesResourceNodeTests.test
index bf55c46..6aae85b 100644
--- tests/functional/ServicesResourceNodeTests.test
+++ tests/functional/ServicesResourceNodeTests.test
@@ -38,11 +38,11 @@ class ServicesResourceNodetests extends ServicesWebtestCase {
    * Implementation of getInfo().
    */
   public static function getInfo() {
-   return array(
-     'name'        => t('Resource Node'),
-     'description' => t('test the resource Node methods and actions.'),
-     'group'       => t('Services'),
-   );
+    return array(
+      'name' => t('Resource Node'),
+      'description' => t('Test the resource Node methods and actions.'),
+      'group' => t('Services'),
+    );
   }
 
   /**
diff --git tests/functional/ServicesResourceSystemTests.test tests/functional/ServicesResourceSystemTests.test
index b90c882..8078b01 100644
--- tests/functional/ServicesResourceSystemTests.test
+++ tests/functional/ServicesResourceSystemTests.test
@@ -41,11 +41,11 @@ class ServicesResourceSystemTests extends ServicesWebtestCase {
    * Implementation of getInfo().
    */
   public static function getInfo() {
-   return array(
-     'name'        => t('Resource System'),
-     'description' => t('Test the resource System methods.'),
-     'group'       => t('Services'),
-   );
+    return array(
+      'name'        => t('Resource System'),
+      'description' => t('Test the resource System methods.'),
+      'group'       => t('Services'),
+    );
   }
 
   /**
diff --git tests/functional/ServicesResourceTaxonomyTests.test tests/functional/ServicesResourceTaxonomyTests.test
index c5d4314..1bbf87e 100644
--- tests/functional/ServicesResourceTaxonomyTests.test
+++ tests/functional/ServicesResourceTaxonomyTests.test
@@ -42,11 +42,11 @@ class ServicesResourceTaxonomyTests extends ServicesWebtestCase {
    * Implementation of getInfo().
    */
   public static function getInfo() {
-   return array(
-     'name'        => t('Resource Taxonomy'),
-     'description' => t('Test the resource Taxonomy methods and actions.'),
-     'group'       => t('Services'),
-   );
+    return array(
+      'name'        => t('Resource Taxonomy'),
+      'description' => t('Test the resource Taxonomy methods and actions.'),
+      'group'       => t('Services'),
+    );
   }
 
   /**
diff --git tests/functional/ServicesResourceUserTests.test tests/functional/ServicesResourceUserTests.test
index dab769c..5704907 100644
--- tests/functional/ServicesResourceUserTests.test
+++ tests/functional/ServicesResourceUserTests.test
@@ -41,11 +41,11 @@ class ServicesResourceUsertests extends ServicesWebtestCase {
    * Implementation of getInfo().
    */
   public static function getInfo() {
-   return array(
-     'name'        => t('Resource User'),
-     'description' => t('Test the resource User methods and actions.'),
-     'group'       => t('Services'),
-   );
+    return array(
+      'name'        => t('Resource User'),
+      'description' => t('Test the resource User methods and actions.'),
+      'group'       => t('Services'),
+    );
   }
 
   /**
diff --git tests/functional/ServicesWebTestCase.php tests/functional/ServicesWebTestCase.php
index 0415c1e..8c1c601 100644
--- tests/functional/ServicesWebTestCase.php
+++ tests/functional/ServicesWebTestCase.php
@@ -1,4 +1,8 @@
 <?php
+/**
+ * @file
+ * Services base testing class.
+ */
 
 class ServicesWebTestCase extends DrupalWebTestCase {
 
@@ -76,7 +80,7 @@ class ServicesWebTestCase extends DrupalWebTestCase {
       CURLOPT_HEADER => TRUE,
       CURLOPT_HTTPHEADER => $headers,
       CURLOPT_INFILE => $putData,
-      CURLOPT_INFILESIZE => strlen($serialize_args)
+      CURLOPT_INFILESIZE => drupal_strlen($serialize_args)
     ));
     fclose($putData);
 
@@ -127,11 +131,11 @@ class ServicesWebTestCase extends DrupalWebTestCase {
    */
   function parseHeader($content) {
     $info = curl_getinfo($this->curlHandle);
-    $header = substr($content, 0, $info['header_size']);
+    $header = drupal_substr($content, 0, $info['header_size']);
     $header = str_replace("HTTP/1.1 100 Continue\r\n\r\n", '', $header);
     $status = strtok($header, "\r\n");
     $code = $info['http_code'];
-    $body = unserialize(substr($content, $info['header_size'], strlen($content) - $info['header_size']));
+    $body = unserialize(drupal_substr($content, $info['header_size'], drupal_strlen($content) - $info['header_size']));
     return array($info, $header, $status, $code, $body);
   }
 
@@ -383,7 +387,7 @@ class ServicesWebTestCase extends DrupalWebTestCase {
       '!method' => $method,
       '@url'    => $url,
       '@status' => curl_getinfo($this->curlHandle, CURLINFO_HTTP_CODE),
-      '!length' => format_size(strlen($this->content))
+      '!length' => format_size(drupal_strlen($this->content))
     );
     $message = t('!method @url returned @status (!length).', $message_vars);
     $this->assertTrue($this->content !== FALSE, $message, t('Browser'));
diff --git tests/unit/TestServicesModule.test tests/unit/TestServicesModule.test
index 8f47392..4e1ee4c 100644
--- tests/unit/TestServicesModule.test
+++ tests/unit/TestServicesModule.test
@@ -9,15 +9,14 @@
 /**
  * Run test cases for the functions in the 'services.module' file.
  */
- class ServicesModuleTests extends DrupalWebTestCase {
+class ServicesModuleTests extends DrupalWebTestCase {
+  // Class variables.
+  protected $privilegedUser = NULL ;
 
-   // Class variables.
-   protected $privilegedUser = NULL ;
-
-   /**
-    * Implementation of getInfo.
-    */
-   public static function getInfo() {
+  /**
+   * Implementation of getInfo.
+   */
+  public static function getInfo() {
     return array(
       'name' => 'Unit tests for services.module file.',
       'description' => 'These are the unit tests for the services.module file functions.',
@@ -33,7 +32,7 @@
       'ctools',
       'services',
       'rest_server'
-      );
+    );
 
     // Create and logi in our privileged user.
     $this->privilegedUser = $this->drupalCreateUser(array(
@@ -60,7 +59,7 @@
    * Test services_perm results.
    */
   public function testServicesPerm() {
-    $resultArray = services_perm () ;
+    $resultArray = services_perm() ;
     $message = t('services_perm should return an array') ;
     $this->assertTrue(gettype($resultArray)=='array', $message) ;
 
@@ -164,7 +163,7 @@
     $this->assertEqual($items['crossdomain.xml']['page callback'],
       'services_crossdomain_xml', $message) ;
 
-   $message = t('crossdomain.xml should have \'page callback\' '
+    $message = t('crossdomain.xml should have \'page callback\' '
       . '=> \'services_crossdomain_xml\'') ;
     $this->assertEqual($items['crossdomain.xml']['page callback'],
       'services_crossdomain_xml', $message) ;
@@ -176,35 +175,35 @@
   public function testEndpointMenu() {
     // Create the endpoint.
     $endpointSettings = array(
-       'name'   => 'mchnname',
-       'title'  => $this->randomName(20),
-       'path'   => $this->randomName(10),
-       'server' => 'rest_server',
-       'services_use_content_permissions' => TRUE,
-     );
-
-     $this->drupalPost('admin/build/services/add', $endpointSettings,
-       t('Save and proceed'));
-     $this->assertResponse('200', t('Failed to create endpoint.'));
-
-     // Check path.
-     $this->drupalGet($endpointSettings['path']);
-     $this->assertResponse('200', t('Failed to access endpoint menu path.'));
-
-     // Check edit.
-     $this->drupalGet('admin/build/services/' . $endpointSettings['name']
-       . '/edit');
-     $this->assertResponse('200', t('Failed to access endpoint edit path.')) ;
-
-     // Check export.
-     $this->drupalGet('admin/build/services/' . $endpointSettings['name']
-       . '/export');
-     $this->assertResponse('200', t('Failed to access endpoint export path.')) ;
-
-     // Check delete.
-     $this->drupalGet('admin/build/services/' . $endpointSettings['name']
-       . '/delete');
-     $this->assertResponse('200', t('Failed to access endpoint delete path.')) ;
+      'name'   => 'mchnname',
+      'title'  => $this->randomName(20),
+      'path'   => $this->randomName(10),
+      'server' => 'rest_server',
+      'services_use_content_permissions' => TRUE,
+    );
+
+    $this->drupalPost('admin/build/services/add', $endpointSettings,
+      t('Save and proceed'));
+    $this->assertResponse('200', t('Failed to create endpoint.'));
+
+    // Check path.
+    $this->drupalGet($endpointSettings['path']);
+    $this->assertResponse('200', t('Failed to access endpoint menu path.'));
+
+    // Check edit.
+    $this->drupalGet('admin/build/services/' . $endpointSettings['name']
+      . '/edit');
+    $this->assertResponse('200', t('Failed to access endpoint edit path.')) ;
+
+    // Check export.
+    $this->drupalGet('admin/build/services/' . $endpointSettings['name']
+      . '/export');
+    $this->assertResponse('200', t('Failed to access endpoint export path.')) ;
+
+    // Check delete.
+    $this->drupalGet('admin/build/services/' . $endpointSettings['name']
+      . '/delete');
+    $this->assertResponse('200', t('Failed to access endpoint delete path.')) ;
   }
 
   /*
@@ -222,24 +221,20 @@
    * Void. Feedback is given through the test harness via assertions.
    */
   protected function helpMenuItem($menuItem, $items) {
-    $message = $menuItem . t(' should exist') ;
-    $this->assertTrue(isset($items[$menuItem]), $message) ;
+    $message = t('%menuItem should exist', array('%menuItem' => $menuItem));
+    $this->assertTrue(isset($items[$menuItem]), $message);
 
-    $message = $menuItem . t(' value should be an array') ;
-    $this->assertTrue(gettype($items[$menuItem]) == 'array', $message) ;
+    $message = t('%menuItem value should be an array', array('%menuItem' => $menuItem));
+    $this->assertTrue(gettype($items[$menuItem]) == 'array', $message);
 
-    $message = $menuItem
-      . t(' should have \'access arguments\' set to \'administer services\'') ;
-    $this->assertEqual($items[$menuItem]['access arguments']
-      [0], 'administer services', $message) ;
+    $message = t("%menuItem should have 'access arguments' set to 'administer services'", array('%menuItem' => $menuItem));
+    $this->assertEqual($items[$menuItem]['access arguments'][0], 'administer services', $message);
 
-    $message = $menuItem
-      . t(' should have \'file\' to \'services.admin.inc\'') ;
-    $this->assertEqual($items[$menuItem]['file'], 'services.admin.inc',
-      $message) ;
+    $message = t("%menuItem should have 'file' to 'services.admin.inc'", array('%menuItem' => $menuItem));
+    $this->assertEqual($items[$menuItem]['file'], 'services.admin.inc', $message);
 
-    $message = $menuItem . t(' should have a \'page callback\'') ;
-    $this->assertTrue(isset($items[$menuItem]['page callback']), $message) ;
+    $message = t("%menuItem should have a 'page callback'", array('%menuItem' => $menuItem));
+    $this->assertTrue(isset($items[$menuItem]['page callback']), $message);
   } // function
 
   /**
@@ -310,23 +305,18 @@
     $message = t('services_endpoints_new() should return an object.');
     $this->assertEqual($results_type, 'object', $message);
 
-    $message = t('New Service object should have property ') ;
-    $this->assertTrue(property_exists($results, 'eid'   ),
-      $message . t('eid.'));
-    $this->assertTrue(property_exists($results, 'name'  ),
-      $message . t('name.'));
-    $this->assertTrue(property_exists($results, 'title' ),
-      $message . t('title.'));
-    $this->assertTrue(property_exists($results, 'server'),
-      $message . t('server.'));
-    $this->assertTrue(property_exists($results, 'path'  ),
-      $message . t('path.'));
+    $string = 'New Service object should have property ';
+    $this->assertTrue(property_exists($results, 'eid'), t($string . 'eid.'));
+    $this->assertTrue(property_exists($results, 'name'), t($string . 'name.'));
+    $this->assertTrue(property_exists($results, 'title'), t($string . 'title.'));
+    $this->assertTrue(property_exists($results, 'server'), t($string . 'server.'));
+    $this->assertTrue(property_exists($results, 'path'  ), t($string . 'path.'));
   }
 
   /**
    * Test services_controller_get().
    */
-  public function testServicesControllerGet() {
-
-  }
- } // class
\ No newline at end of file
+//  public function testServicesControllerGet() {
+//
+//  }
+} // class
\ No newline at end of file
