Login | ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/javautils/ViaThinkSoft Java Utils/src/com/dominicsayers/isemail/is_email.php
(Generate patch)

Comparing ViaThinkSoft Java Utils/src/com/dominicsayers/isemail/is_email.php (file contents):
Revision 15 by daniel-marschall, Mon Jun 14 00:07:32 2010 UTC vs.
Revision 16 by daniel-marschall, Mon Jun 14 19:26:08 2010 UTC

# Line 1 | Line 1
1   <?php
2 +
3 + // This file was edited by Daniel Marschall
4 + // - Fixes: 4 typos
5 +
6   /**
7   * @package     isemail
8   * @author      Dominic Sayers <dominic_sayers@hotmail.com>
# Line 180 | Line 184 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
184          //      (http://tools.ietf.org/html/rfc5322#section-3.4.1)
185          //
186          // Problem: need to distinguish between "first.last" and "first"."last"
187 <        // (i.e. one element or two). And I suck at regexes.
187 >        // (i.e. one element or two). And I suck at regular expressions.
188          $dotArray       = /*. (array[int]string) .*/ preg_split('/\\.(?=(?:[^\\"]*\\"[^\\"]*\\")*(?![^\\"]*\\"))/m', $localPart);
189          $partLength     = 0;
190  
# Line 190 | Line 194 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
194                  $elementLength  = strlen($element);
195  
196                  if ($elementLength === 0)                                                               return $diagnose ? ISEMAIL_ZEROLENGTHELEMENT    : false;        // Can't have empty element (consecutive dots or dots at the start or end)
197 < // revision 1.15: Speed up the test and get rid of "unitialized string offset" notices from PHP
197 > // revision 1.15: Speed up the test and get rid of "uninitialized string offset" notices from PHP
198  
199                  // We need to remove any valid comments (i.e. those at the start or end of the element)
200                  if ($element[0] === '(') {
# Line 229 | Line 233 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
233                          //
234                          // Remove any FWS
235                          $element = preg_replace("/(?<!\\\\)$FWS/", '', $element);
236 <                        // My regex skillz aren't up to distinguishing between \" \\" \\\" \\\\" etc.
236 >                        // My regular expressions skills aren't up to distinguishing between \" \\" \\\" \\\\" etc.
237                          // So remove all \\ from the string first...
238                          $element = preg_replace('/\\\\\\\\/', ' ', $element);
239                          if (preg_match('/(?<!\\\\|^)["\\r\\n\\x00](?!$)|\\\\"$|""/', $element) > 0)     return $diagnose ? ISEMAIL_UNESCAPEDDELIM       : false;        // ", CR, LF and NUL must be escaped, "" is too short
# Line 350 | Line 354 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
354                          // A zero-length element implies a period at the beginning or end of the
355                          // local part, or two periods together. Either way it's not allowed.
356                          if ($elementLength === 0)                               return $diagnose ? ISEMAIL_DOMAINEMPTYELEMENT   : false;        // Dots in wrong place
357 < // revision 1.15: Speed up the test and get rid of "unitialized string offset" notices from PHP
357 > // revision 1.15: Speed up the test and get rid of "uninitialized string offset" notices from PHP
358          
359                          // Then we need to remove all valid comments (i.e. those at the start or end of the element
360                          if ($element[0] === '(') {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines