Development

/plugins/gyCaptchaPlugin/branches/1.2/lib/validator/gyValidatorCaptcha.class.php

You must first sign up to be able to contribute.

root/plugins/gyCaptchaPlugin/branches/1.2/lib/validator/gyValidatorCaptcha.class.php

Revision 17546, 1.0 kB (checked in by GOYELLO, 4 years ago)

Initial import.

  • Property svn:eol-style set to native
  • Property svn:executable set to
  • Property svn:keywords set to 'LastChangedDate LastChangedRevision LastChangedBy Id'
Line 
1 <?php
2 /*
3  * (c) 2008 - 2009 GOYELLO IT Services
4  * (c) 2008 - 2009 Jakub Zalas
5  *
6  * For the full copyright and license information, please view the LICENSE
7  * file that was distributed with this source code.
8  */
9
10 /**
11  * Captcha validator
12  *
13  * @package     gyCaptchaPlugin
14  * @subpackage  validator
15  * @author      Jakub Zalas <jakub@zalas.pl>
16  * @version     SVN: $Id$
17  */
18 class gyValidatorCaptcha extends sfValidatorBase
19 {
20   /**
21    * Configures the current validator.
22    *
23    * @param array $options   An array of options
24    * @param array $messages  An array of error messages
25    *
26    * @see __construct()
27    */
28   protected function configure($options = array(), $messages = array())
29   {
30     $this->setMessage('invalid', 'Invalid selection');
31   }
32
33   /**
34    * Validates if selected images are the right ones
35    *
36    * @see sfValidatorChoice
37    */
38   protected function doClean($value)
39   {
40     if (!gyCaptcha::getInstance()->validate($value))
41     {
42       throw new sfValidatorError($this, 'invalid', array('value' => $value));
43     }
44     
45     return $value;
46   }
47 }
48
Note: See TracBrowser for help on using the browser.