Source for file jFormsControlCaptcha.class.php

Documentation is available at jFormsControlCaptcha.class.php

  1. <?php
  2. /**
  3. @package     jelix
  4. @subpackage  forms
  5. @author      Laurent Jouanneau
  6. @copyright   2006-2008 Laurent Jouanneau
  7. @link        http://www.jelix.org
  8. @licence     http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file
  9. */
  10.  
  11.  
  12. /**
  13.  * captcha control
  14.  * @package     jelix
  15.  * @subpackage  forms
  16.  * @since 1.1
  17.  */
  18. class jFormsControlCaptcha extends jFormsControl {
  19.     public $type = 'captcha';
  20.     public $question='';
  21.     public $required = true;
  22.     function check(){
  23.         $value $this->container->data[$this->ref];
  24.         if(trim($value== ''{
  25.             return $this->container->errors[$this->refjForms::ERRDATA_REQUIRED;
  26.         }elseif($value !=  $this->container->privateData[$this->ref]){
  27.             return $this->container->errors[$this->refjForms::ERRDATA_INVALID;
  28.         }
  29.         return null;
  30.     }
  31.  
  32.     function initExpectedValue(){
  33.         $numbers jLocale::get('jelix~captcha.number');
  34.         $id rand(1,intval($numbers));
  35.         $this->question = jLocale::get('jelix~captcha.question.'.$id);
  36.         $this->container->privateData[$this->refjLocale::get('jelix~captcha.response.'.$id);
  37.     }
  38. }

Documentation generated on Wed, 04 Jan 2017 22:54:43 +0100 by phpDocumentor 1.4.3