|
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 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 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 |
|
|---|