OXID eShop CE  4.9.9
 All Classes Files Functions Variables Pages
oxmailvalidator.php
Go to the documentation of this file.
1 <?php
2 
7 {
8 
12  private $_sMailValidationRule = null;
13 
19  public function getMailValidationRule()
20  {
21  if (is_null($this->_sMailValidationRule)) {
22  $this->_sMailValidationRule = "/^([\w+\-.])+\@([\w\-.])+\.([A-Za-z]{2,64})$/i";
23  }
24 
26  }
27 
33  public function setMailValidationRule($sMailValidationRule)
34  {
35  $this->_sMailValidationRule = $sMailValidationRule;
36  }
37 
42  public function __construct()
43  {
44  $oConfig = oxRegistry::getConfig();
45  $sEmailValidationRule = $oConfig->getConfigParam('sEmailValidationRule');
46  if (!empty($sEmailValidationRule)) {
47  $this->_sMailValidationRule = $sEmailValidationRule;
48  }
49  }
50 
59  public function isValidEmail($sEmail)
60  {
61  $sEmailRule = $this->getMailValidationRule();
62  $blValid = (getStr()->preg_match($sEmailRule, $sEmail) != 0);
63 
64  return $blValid;
65  }
66 }