Index: trunk/lib/FormValidator.inc.php
===================================================================
--- trunk/lib/FormValidator.inc.php	(revision 40)
+++ trunk/lib/FormValidator.inc.php	(revision 42)
@@ -1,5 +1,5 @@
 <?php
 /**
- * FormValidator.inc.php 
+ * FormValidator.inc.php
  * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information
  *
@@ -25,5 +25,5 @@
 class FormValidator
 {
-    
+
     /**
      * Array filling with errors. The key will be the name of the form where
@@ -31,5 +31,5 @@
      */
     var $errors = array();
-    
+
     /**
      * Return the current list of errors.
@@ -43,5 +43,5 @@
         return $this->errors;
     }
-    
+
     /**
      * Add an error to the errors stack.
@@ -64,5 +64,5 @@
         );
     }
-    
+
     /**
      * Check whether any errors have been triggered.
@@ -70,5 +70,5 @@
      * @param  string $form_name the name of the incoming form variable
      *
-     * @return bool   true if any errors were found, or if found for 
+     * @return bool   true if any errors were found, or if found for
      *                a variable of $form_name, false otherwise
      */
@@ -78,5 +78,5 @@
             foreach ($this->errors as $err) {
                 if ($err['name'] == $form_name) {
-                    return true;   
+                    return true;
                 }
             }
@@ -115,13 +115,13 @@
                         echo '<div class="error">' . $err['message'] . '</div>';
                         break;
-            
+
                     case MSG_WARNING:
                         echo '<div class="warning">' . $err['message'] . '</div>';
                         break;
-            
+
                     case MSG_SUCCESS:
                         echo '<div class="success">' . $err['message'] . '</div>';
                         break;
-            
+
                     case MSG_NOTICE:
                     default:
@@ -134,5 +134,5 @@
         }
     }
-    
+
     /**
      * If this form has an error, print an error marker like "<<".
@@ -164,5 +164,5 @@
     function notEmpty($form_name, $msg='')
     {
-    
+
         $val = trim(getFormData($form_name));
         if ($val != '') {
@@ -184,5 +184,5 @@
     function isEmpty($form_name, $msg='')
     {
-    
+
         $val = trim(getFormData($form_name));
         if ($val == '') {
@@ -255,5 +255,5 @@
     /**
      * Check whether input is a float. Don't just use is_float() because the
-     * data coming from the user is *really* a string. Integers will also 
+     * data coming from the user is *really* a string. Integers will also
      * pass this test.
      *
@@ -293,8 +293,8 @@
         }
     }
-    
+
     /**
      * Check whether input matches the specified perl regular expression
-     * pattern. 
+     * pattern.
      *
      * @param  string $form_name the name of the incoming form variable
@@ -325,5 +325,5 @@
         }
     }
-    
+
     /**
      * Tests if the string length is between specified values. Whitespace excluded for min.
@@ -339,5 +339,5 @@
     {
         $val = getFormData($form_name);
-        
+
         if (strlen(trim($val)) < $min || strlen($val) > $max) {
             $this->addError($form_name, $msg);
@@ -375,5 +375,5 @@
     /**
      * Validates an email address based on the recommendations in RFC 3696.
-     * Is more loose than restrictive, to allow the many valid variants of 
+     * Is more loose than restrictive, to allow the many valid variants of
      * email addresses while catching the most common mistakes.
      * http://www.faqs.org/rfcs/rfc822.html
@@ -403,5 +403,5 @@
             return false;
         }
-        
+
         // We have a match! Here are the captured subpatterns, on which further tests are run.
         $local = $e_parts[2];
@@ -415,5 +415,5 @@
             return false;
         }
-        
+
         // Check domain exists: It's a domain if ip2long fails; Checkdnsrr ensures a MX record exists; Gethostbyname() ensures the domain exists.
         if (ip2long($domain) == '-1' && function_exists('checkdnsrr') && !checkdnsrr($domain . '.', 'MX') && gethostbyname($domain) == $domain) {
@@ -422,5 +422,5 @@
             return false;
         }
-        
+
         return true;
     }
@@ -431,5 +431,5 @@
 //             return false;
 //         }
-//         
+//
 //         // Test email address format.
 //         if ($allow_fullname) {
@@ -444,5 +444,5 @@
 //             }
 //         }
-//         
+//
 //         // Test length.
 //         if (!$this->stringLength($form_name, 0, 255, sprintf(_("<strong>Email address</strong> must contain less than 256 characters."), $email))) {
@@ -450,5 +450,5 @@
 //             return false;
 //         }
-//         
+//
 //         // Check domain exists and has valid MX record.
 //         preg_match('/^[^<>@]*<?[^\s@\[\]<>()]+\@([A-Za-z0-9.-]+\.[A-Za-z]{2,5})>?$/i', $email, $matches);
@@ -460,5 +460,5 @@
 //             }
 //         }
-//         
+//
 //         return true;
 //     }
@@ -476,5 +476,5 @@
     {
         $phone = getFormData($form_name);
-        
+
         return $this->checkRegex($form_name, '/^[0-9 +().-]*$/', true, sprintf(_("The phone number <strong>%s</strong> is not valid."), $phone))
         && $this->stringLength($form_name, 0, 25, sprintf(_("The phone number <strong>%s</strong> is too long"), $phone));
@@ -499,6 +499,6 @@
         }
     }
-    
-    
+
+
     /**
      * Verifies credit card number.
@@ -515,15 +515,15 @@
             $cc_num = getFormData($form_name);
         }
-        
+
         if ('' == $cc_num) {
             return false;
         }
-        
+
         // Innocent until proven guilty
         $card_is_valid = true;
-    
+
         // Get rid of any non-digits
         $cc_num = preg_replace('/[^\d]/', '', $cc_num);
-    
+
         // Perform card-specific checks, if applicable
         switch (strtolower($cc_type)) {
@@ -558,8 +558,8 @@
                 break;
         }
-    
+
         // The Luhn formula works right to left, so reverse the number.
         $cc_num = strrev($cc_num);
-        
+
         $luhn_total = 0;
 
@@ -573,14 +573,14 @@
                 $digit *= 2;
             }
-    
+
             //  If the result is two digits, add them.
             if (strlen($digit) == 2) {
                 $digit = substr($digit,0,1) + substr($digit,1,1);
             }
-    
+
             //  Add the current digit to the $luhn_total.
             $luhn_total += $digit;
         }
-    
+
         // If it passed (or bypassed) the card-specific check and the Total is evenly divisible by 10, it's cool!
         if ($card_is_valid && $luhn_total % 10 == 0) {
@@ -609,5 +609,5 @@
         }
     }
-    
+
 } // THE END
 
