diff --git a/print.pages.inc b/print.pages.inc
index d0fcef3dfd872ae96ce7d59b8b56b857d4aeab7a..c9ff9755494ec12970315c1129dc9d9b7d8544a7 100644
--- a/print.pages.inc
+++ b/print.pages.inc
@@ -352,7 +352,7 @@ function _print_rewrite_urls($matches) {
               $path = "node/$path";
             }
             // Printer-friendly URLs is on, so we need to make it absolute
-            $newurl = url($path, array('fragment' => substr($url, 1), 'absolute' => TRUE));
+            $newurl = url($path, array('fragment' => drupal_substr($url, 1), 'absolute' => TRUE));
           }
           // Because base href is the original page, change the link to
           // still be usable inside the print page
diff --git a/print_mail/print_mail.inc b/print_mail/print_mail.inc
index a39ef5830ec037e525c834f13aebdf579b3cc0e3..1761037e7cec2937a287df00ddf3fae98fa2ec52 100644
--- a/print_mail/print_mail.inc
+++ b/print_mail/print_mail.inc
@@ -38,7 +38,7 @@ function print_mail_form($form, &$form_state) {
     }
     drupal_goto(PRINTMAIL_PATH . '/' . $path);
   }
-  else if (ctype_digit($path_arr[1])) {
+  elseif (ctype_digit($path_arr[1])) {
     if (drupal_lookup_path('source', $path)) {
       // This is a numeric alias
       $path = drupal_get_normal_path($path);
@@ -200,7 +200,7 @@ function theme_print_mail_form($form) {
  */
 function print_mail_form_validate($form, &$form_state) {
   if (array_key_exists('cancel', $form_state['input'])) {
-    form_set_error(NULL,'',TRUE);
+    form_set_error(NULL, '', TRUE);
     drupal_get_messages('error');
 
     drupal_goto(preg_replace('!^book/export/html/!', 'node/', $form_state['values']['path']));
@@ -241,7 +241,7 @@ function print_mail_form_validate($form, &$form_state) {
 
   // In all fields, prevent insertion of custom headers
   foreach ($form_state['values'] as $key => $string) {
-    if ( (substr($key, 0, 4) == 'fld_') && ((strpos($string, "\n") !== FALSE) || (strpos($string, "\r") !== FALSE)) ) {
+    if ( (drupal_substr($key, 0, 4) == 'fld_') && ((strpos($string, "\n") !== FALSE) || (strpos($string, "\r") !== FALSE)) ) {
       form_set_error($key, 'Found invalid character');
     }
   }
diff --git a/print_mail/print_mail.module b/print_mail/print_mail.module
index 243754172be9104ce38198a2e8a0178c999f299f..34b072c3c7bd480ac5169186fbbc35a2bc5271be 100644
--- a/print_mail/print_mail.module
+++ b/print_mail/print_mail.module
@@ -347,7 +347,7 @@ function _print_mail_access($permission) {
       }
       // If the destination page is not accessible, don't show the form
       if (!($router_item = menu_get_item($path)) || (!$router_item['access'])) {
-	$page_access = FALSE;
+        $page_access = FALSE;
       }
     }
   }
@@ -553,8 +553,8 @@ function print_mail_link_allowed($args) {
 }
 
 /**
-* Implementation of hook_nollom_form_list().
-*/
+ * Implements hook_nollom_form_list().
+ */
 function print_mail_mollom_form_list() {
   $forms['print_mail_form'] = array(
     'title' => t('Send page form'),
@@ -564,8 +564,8 @@ function print_mail_mollom_form_list() {
 }
 
 /**
-* Implementation of hook_mollom_form_info().
-*/
+ * Implemenents hook_mollom_form_info().
+ */
 function print_mail_mollom_form_info($form_id) {
   switch ($form_id) {
     case 'print_mail_form':
diff --git a/print_mail/views_handler_sort_print_mail_sentcount.inc b/print_mail/views_handler_sort_print_mail_sentcount.inc
index a274263f197ce07b9a8ad3d86760c5b3ace3ad19..211deb5046f7d7a2613e6e23a39532d6364c0c8c 100644
--- a/print_mail/views_handler_sort_print_mail_sentcount.inc
+++ b/print_mail/views_handler_sort_print_mail_sentcount.inc
@@ -1,6 +1,9 @@
 <?php
 
 /**
+ * @file
+ * Views sort handler for the print_mail module
+ *
  * Extend the default sort handler.
  * Add a relationship with custom join to print's emailed counter
  */
diff --git a/print_pdf/print_pdf.drush.inc b/print_pdf/print_pdf.drush.inc
index d031221f48c72239fa6369c9c8d9a0bc66212545..f2ae4426e3ff58596032304d1158853e0ce62fb8 100644
--- a/print_pdf/print_pdf.drush.inc
+++ b/print_pdf/print_pdf.drush.inc
@@ -81,7 +81,7 @@ function drush_print_pdf_download($library) {
         }
         else {
           drush_log(dt('@file has been downloaded to @path, but extract failed. Check that you have the necessary program installed, and if necessary extract it manually.',
-                       array('@file' => $filename, '@path' => $path)), 'warning');
+                    array('@file' => $filename, '@path' => $path)), 'warning');
         }
       }
       else {
@@ -97,13 +97,13 @@ function drush_print_pdf_download($library) {
   }
 }
 
-/** 
+/**
  * Discover the correct URL of the package to download
  */
 function _drush_print_pdf_download_url($library) {
   $ret = FALSE;
 
-  switch (strtolower($library)) {
+  switch (drupal_strtolower($library)) {
     case 'dompdf':
       $ret = DOMPDF_DOWNLOAD_URI;
       break;
@@ -111,7 +111,7 @@ function _drush_print_pdf_download_url($library) {
       $ret = TCPDF_DOWNLOAD_URI;
       break;
     case 'wkhtmltopdf':
-      switch (substr(php_uname('s'), 0, 3)) {
+      switch (drupal_substr(php_uname('s'), 0, 3)) {
         case 'Lin':
           $ret = (php_uname('m') == 'x86_64') ? WKHTMLTOPDF_AMD64_DOWNLOAD_URI : WKHTMLTOPDF_I386_DOWNLOAD_URI;
           break;
@@ -176,7 +176,7 @@ function _drush_print_pdf_download_extract($filename) {
  *   The path to the file to download
  *
  * @return string
- *   The filename that was downloaded, or NULL if the file could not be 
+ *   The filename that was downloaded, or NULL if the file could not be
  *   downloaded.
  */
 function _drush_print_pdf_download_file($download_url) {
diff --git a/print_pdf/print_pdf.module b/print_pdf/print_pdf.module
index 4e405cb5499b23c83f17fced3832d29e1a9eebbc..4a38e02021b0f9f27fd1fa130f25fd4cab69de54 100644
--- a/print_pdf/print_pdf.module
+++ b/print_pdf/print_pdf.module
@@ -208,9 +208,9 @@ function print_pdf_requirements($phase) {
           }
 
           foreach (array('cache', 'images') as $dir) {
-            $directory = dirname($print_pdf_pdf_tool) .'/'. $dir;
+            $directory = dirname($print_pdf_pdf_tool) . '/' . $dir;
             if (!is_dir($directory) || !is_writable($directory)) {
-              $requirements['print_pdf_tool_'. $dir] = array(
+              $requirements['print_pdf_tool_' . $dir] = array(
                 'title' => $t('TCPDF directory'),
                 'value' => $t('Non-writable permissions'),
                 'description' => $t('You must change the %fontdir permissions to be writable, as dompdf requires write-access to that directory.', array('%fontdir' => $directory)),
@@ -219,7 +219,7 @@ function print_pdf_requirements($phase) {
             }
           }
         }
-        elseif (substr(basename($print_pdf_pdf_tool, '.exe'), 0, 11) == 'wkhtmltopdf') {
+        elseif (drupal_substr(basename($print_pdf_pdf_tool, '.exe'), 0, 11) == 'wkhtmltopdf') {
           if (function_exists('is_executable') && !is_executable($print_pdf_pdf_tool)) {
             $requirements['print_pdf_tool'] = array(
               'title' => $t('wkhtmltopdf library'),
diff --git a/print_pdf/print_pdf.pages.inc b/print_pdf/print_pdf.pages.inc
index ebbec96358d9c304442f39ff7300933b6ac140ec..b92da07c9c600d284fe6c00c27981d5a0e70eb9a 100644
--- a/print_pdf/print_pdf.pages.inc
+++ b/print_pdf/print_pdf.pages.inc
@@ -108,7 +108,7 @@ function print_pdf_generate_html($print, $html, $filename = NULL) {
   elseif (basename($print_pdf_pdf_tool) == 'tcpdf.php') {
     return _print_pdf_tcpdf($print, $html, $filename);
   }
-  elseif (substr(basename($print_pdf_pdf_tool, '.exe'), 0, 11) == 'wkhtmltopdf') {
+  elseif (drupal_substr(basename($print_pdf_pdf_tool, '.exe'), 0, 11) == 'wkhtmltopdf') {
     return _print_pdf_wkhtmltopdf($print, $html, $filename);
   }
   elseif ($filename) {
@@ -136,6 +136,7 @@ function _print_pdf_file_access_images($html) {
   // TODO: This needs to be rewritten from scratch for Drupal 7
   $lang = '';
 /*
+  TODO
   switch (variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE)) {
     case LANGUAGE_NEGOTIATION_PATH_DEFAULT:
     case LANGUAGE_NEGOTIATION_PATH:
@@ -307,7 +308,7 @@ function _print_pdf_tcpdf($print, $html, $filename = NULL) {
   $pdf->SetCreator(variable_get('site_name', 'Drupal'));
   $pdf->SetTitle(html_entity_decode($print['title'], ENT_QUOTES, 'UTF-8'));
   $pdf->setPDFVersion('1.6');
-  $pdf->setFontSubsetting(variable_get('print_pdf_font_subsetting',FALSE));
+  $pdf->setFontSubsetting(variable_get('print_pdf_font_subsetting', FALSE));
 
   if ($language->direction == LANGUAGE_RTL) {
     $pdf->setRTL(TRUE);