<commit_before><?php
/*
 * Limb PHP Framework
 *
 * @link http://limb-project.com
 * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
 * @license    LGPL http://www.gnu.org/copyleft/lesser.html
 */
lmb_require('limb/validation/src/rule/lmbDomainRule.class.php');

/**
 * Checks that field value is a valid Email address.
 * @package validation
 * @version $Id: lmbEmailRule.class.php 7185 2008-09-26 11:49:50Z conf $
 */
class lmbEmailRule extends lmbDomainRule
{
  function check($value)
  {
    if (is_integer(strpos($value, '@')))
    {
      list($user, $domain) = split('@', $value, 2);
      $this->_checkUser($user);
      $this->_checkDomain($domain);
    }
    else
      $this->error('{Field} must contain a @ character.');
  }
  
  function error($message, $values = array(), $i18n_params = array())
  {
    if(isset($this->custom_error))
    {  if($this->is_valid)
        parent::error($message, $values = array(), $i18n_params = array());
    }
    else
      parent::error($message, $values = array(), $i18n_params = array());
  }

  protected function _checkUser($value)
  {
    if (!preg_match('/^[a-z0-9_]+([_.-][a-z0-9]+|[_])*$/i', $value))
        $this->error('Invalid user in {Field}.');
  }

  protected function _checkDomain($value)
  {
    parent :: check($value);
  }
}
<commit_msg>[svn r7290] -- preparing for php-5.3 -- replaced deprecated split by explode<commit_after><?php
/*
 * Limb PHP Framework
 *
 * @link http://limb-project.com
 * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-<EMAIL>)
 * @license    LGPL http://www.gnu.org/copyleft/lesser.html
 */
lmb_require('limb/validation/src/rule/lmbDomainRule.class.php');

/**
 * Checks that field value is a valid Email address.
 * @package validation
 * @version $Id: lmbEmailRule.class.php 7290 2008-12-08 14:35:20Z idler $
 */
class lmbEmailRule extends lmbDomainRule
{
  function check($value)
  {
    if (is_integer(strpos($value, '@')))
    {
      list($user, $domain) = explode('@', $value);
      $this->_checkUser($user);
      $this->_checkDomain($domain);
    }
    else
      $this->error('{Field} must contain a @ character.');
  }

  function error($message, $values = array(), $i18n_params = array())
  {
    if(isset($this->custom_error))
    {  if($this->is_valid)
        parent::error($message, $values = array(), $i18n_params = array());
    }
    else
      parent::error($message, $values = array(), $i18n_params = array());
  }

  protected function _checkUser($value)
  {
    if (!preg_match('/^[a-z0-9_]+([_.-][a-z0-9]+|[_])*$/i', $value))
        $this->error('Invalid user in {Field}.');
  }

  protected function _checkDomain($value)
  {
    parent :: check($value);
  }
}
{'fraction_non_alphanumeric': 0.18973791066814322, 'fraction_numerical': 0.02916205241786637, 'mean_word_length': 3.378029079159935, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1452755', 'n_tokens_mistral': 1000, 'n_tokens_neox': 940, 'n_words': 184}