[ Index ]

MailPress 544

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

title

Body

[close]

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

   1  <?php
   2  if (!extension_loaded('gd')) return;
   3  
   4  class MP_Form_field_type_captcha_gd2 extends MP_form_field_type_
   5  {
   6      var $file    = __FILE__;
   7  
   8      var $id     = 'captcha_gd2';
   9  
  10      var $category = 'composite';
  11      var $order    = 91;
  12  
  13  	function submitted($field)
  14      {
  15          $value    = trim($_POST[$this->prefix][$field->form_id][$field->id]);
  16  
  17          $required     = true;
  18          $empty = empty($value);
  19  
  20          if ($empty)
  21          {
  22              $field->submitted['on_error'] = 1;
  23              return $field;
  24          }
  25          else
  26          {
  27              @session_start();
  28  
  29              if ((!$_SESSION['mp_googlelike']) || (strtolower($_SESSION['mp_googlelike']) != strtolower($value)))
  30              {
  31                  $field->submitted['on_error'] = 1;
  32                  return $field;
  33              }
  34          }
  35  
  36          $field->submitted['value'] = 1;
  37          $field->submitted['text']  = __('ok', MP_TXTDOM);
  38  
  39          return $field;
  40      }
  41  
  42  	function attributes_filter($no_reset)
  43      {
  44          if (!$no_reset) return;
  45          
  46          $this->attributes_filter_css();
  47      }
  48  
  49  	function build_tag()
  50      {
  51          $id_input     = $this->get_id($this->field);
  52          $tag_input     = parent::build_tag();
  53  
  54          $id_img     = $id_input . '_img';
  55          $tag_img     = "<img id='$id_img' src='" . esc_url(MP_Action_url . '?id=' . $this->field->id . '&action=2ahctpac') . "' alt='' />";
  56  
  57          $this->field->type = $this->id;
  58  
  59          $form_format =  '{{img}}<br />{{input}}';
  60  
  61          $form_format = $this->get_formats($form_format);
  62  
  63          $search[] = '{{img}}';        $replace[] = '%1$s';
  64          $search[] = '{{id_img}}';     $replace[] = '%2$s';
  65          $search[] = '{{input}}';     $replace[] = '%3$s';
  66          $search[] = '{{id_input}}';    $replace[] = '%4$s';
  67  
  68          $html = str_replace($search, $replace,  $form_format);
  69  
  70          return sprintf($html, $tag_img, $id_img, $tag_input, $id_input);
  71      }
  72  }
  73  new MP_Form_field_type_captcha_gd2(__('Captcha 2', MP_TXTDOM));


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