Initial commit.
This commit is contained in:
31
lib/php/monica/rfc822.inc.php
Normal file
31
lib/php/monica/rfc822.inc.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
// File name: rfc822.inc.php
|
||||
// Description: PHP subroutine for RFC 822 address related patterns
|
||||
// Date: 2004-02-11
|
||||
// Author: imacat <imacat@pristine.com.tw>
|
||||
// Copyright: Copyright (C) 2004-2007 Pristine Communications
|
||||
|
||||
define("RFC822_CTL", "[\\x01-\\x1F\\x7F]");
|
||||
define("RFC822_SPECIALS", "[()<>@,;:\\\\\".\\[\\]]");
|
||||
define("RFC822_ATOM", "[\\x21\\x23-\\x27\\x2A-\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x41-\\x5A\\x5E-\\x7E]+");
|
||||
define("RFC822_DTEXT", "[^\"\\\\\r]");
|
||||
define("RFC822_QUOTED_PAIR", "\\\\[\\x01-\\xFF]");
|
||||
|
||||
define("RFC822_DOMAIN_REF", RFC822_ATOM);
|
||||
define("RFC822_DOMAIN_LITERAL", "\\[(?:" . RFC822_DTEXT . "|" . RFC822_QUOTED_PAIR . ")*\\]");
|
||||
define("RFC822_SUB_DOMAIN", "(?:" . RFC822_DOMAIN_REF . "|" . RFC822_DOMAIN_LITERAL . ")");
|
||||
define("RFC822_DOMAIN", RFC822_SUB_DOMAIN . "(?:\." . RFC822_SUB_DOMAIN . ")*");
|
||||
define("RFC822_QUOTED_STR", "\"(?:" . RFC822_DTEXT . "|" . RFC822_QUOTED_PAIR . ")*\"");
|
||||
define("RFC822_WORD", "(?:" . RFC822_ATOM . "|" . RFC822_QUOTED_STR . ")");
|
||||
define("RFC822_LOCAL_PART", RFC822_WORD . "(?:\." . RFC822_WORD . ")*");
|
||||
|
||||
define("RFC822_ADDR_SPEC", RFC822_LOCAL_PART . "@" . RFC822_DOMAIN);
|
||||
|
||||
// rfc822_phrase_need_quoting: Whether a phrase need to be quoted by RFC-822
|
||||
function rfc822_phrase_need_quoting($a)
|
||||
{
|
||||
return preg_match("/[()<>@,;:\\\\\".\\[\\]\\x01-\\x1F\\x7F]/", $a)?
|
||||
true: false;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user