[ Index ]

MailPress 544

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/class/options/form/field_types/ereg/ -> ereg.php (source)

   1  <?php
   2  class MP_Form_field_type_ereg extends MP_form_field_type_
   3  {
   4      var $file    = __FILE__;
   5  
   6      var $id    = 'ereg';
   7  
   8      var $category = 'html';
   9      var $order    = 95;
  10  
  11  	function submitted($field)
  12      {
  13          $value    = trim($_POST[$this->prefix][$field->form_id][$field->id]);
  14  
  15          $required     = (isset($field->settings['controls']['required']) && $field->settings['controls']['required']);
  16          $empty     = empty($value);
  17          $ereg_ok     = true;
  18  
  19          if ($required)
  20          {
  21              if ($empty)
  22              {
  23                  $field->submitted['on_error'] = 1;
  24                  return $field;
  25              }
  26          }
  27  
  28          $pattern     = $field->settings['options']['pattern'];
  29          if (!$empty && !empty($pattern)) $ereg_ok = (isset($field->settings['options']['ereg'])) ? @preg_match($pattern, $value) : @preg_match($pattern, strtolower($value));
  30  
  31          if (!$ereg_ok)
  32          {
  33              $field->submitted['on_error'] = 2;
  34              return $field;
  35          }
  36          return parent::submitted($field);
  37      }
  38  }
  39  new MP_Form_field_type_ereg(__('Ereg[i] Input ', MP_TXTDOM));


Generated: Thu Apr 28 18:38:52 2016 Cross-referenced by PHPXref 0.7.1