Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
8199d20092 | |||
8770c50ff0 | |||
721a2b1f3d | |||
e2f1966bfb | |||
2f508ddd07 | |||
2e803e1471 | |||
800643d72c | |||
c09b7245b1 | |||
c3c8904862 | |||
9d4f95e39b | |||
107dbe33e4 | |||
6b4e7db721 | |||
aef6a785ca | |||
fc72ab4f6c | |||
e3727a975d | |||
9d741e0ac6 | |||
0ab26cac81 | |||
ddab3ef005 | |||
0b08b38cb0 | |||
3f64e064d3 | |||
9578caab10 | |||
7f30646c68 | |||
daec205870 | |||
1881d292b8 | |||
181b0cd0d0 |
@ -42,7 +42,9 @@ class Configuration implements ConfigurationInterface
|
||||
->scalarNode('max_front_lines')->defaultValue(null)->end()
|
||||
->scalarNode('max_behind_lines')->defaultValue(null)->end()
|
||||
->scalarNode('interpolation')->defaultValue(true)->end()
|
||||
->arrayNode('background_color')->prototype('scalar')->end()
|
||||
->arrayNode('text_color')->prototype('scalar')->end()->end()
|
||||
->arrayNode('background_color')->prototype('scalar')->end()->end()
|
||||
->scalarNode('disabled')->defaultValue(false)->end()
|
||||
->end()
|
||||
;
|
||||
|
||||
|
@ -33,10 +33,6 @@ class GregwarCaptchaExtension extends Extension
|
||||
$container->setParameter('gregwar_captcha.config.expiration', $config['expiration']);
|
||||
$container->setParameter('gregwar_captcha.config.whitelist_key', $config['whitelist_key']);
|
||||
|
||||
if ($config['reload'] && !$config['as_url']) {
|
||||
throw new \InvalidArgumentException('GregwarCaptcha: The reload option cannot be set without as_url, see the README for more information');
|
||||
}
|
||||
|
||||
$resources = $container->getParameter('twig.form.resources');
|
||||
$container->setParameter('twig.form.resources', array_merge(array('GregwarCaptchaBundle::captcha.html.twig'), $resources));
|
||||
}
|
||||
|
@ -98,8 +98,17 @@ class CaptchaGenerator
|
||||
$this->builder->setMaxFrontLines($options['max_front_lines']);
|
||||
$this->builder->setMaxBehindLines($options['max_behind_lines']);
|
||||
|
||||
if ($options['background_color'] != array()) {
|
||||
if (count($options['background_color'])!=3) {
|
||||
if (isset($options['text_color']) && $options['text_color']) {
|
||||
if (count($options['text_color']) !== 3) {
|
||||
throw new \RuntimeException('text_color should be an array of r, g and b');
|
||||
}
|
||||
|
||||
$color = $options['text_color'];
|
||||
$this->builder->setTextColor($color[0], $color[1], $color[2]);
|
||||
}
|
||||
|
||||
if (isset($options['background_color']) && $options['background_color']) {
|
||||
if (count($options['background_color']) !== 3) {
|
||||
throw new \RuntimeException('background_color should be an array of r, g and b');
|
||||
}
|
||||
|
||||
|
@ -123,10 +123,12 @@ You can define the following configuration options globally or on the CaptchaTyp
|
||||
|
||||
* **width**: the width of the captcha image (default=120)
|
||||
* **height**: the height of the captcha image (default=40)
|
||||
* **disabled**: disable globally the CAPTCHAs (can be useful in dev environment), it will
|
||||
still appear but won't be editable and won't be checked
|
||||
* **length**: the length of the captcha (number of chars, default 5)
|
||||
* **quality**: jpeg quality of captchas (default=15)
|
||||
* **charset**: the charset used for code generation (default=abcdefhjkmnprstuvwxyz23456789)
|
||||
* **font**: the font to use (default=Generator/Font/captcha.ttf)
|
||||
* **font**: the font to use (default is random among some pre-provided fonts), this should be an absolute path
|
||||
* **keep_value**: the value will be the same until the form is posted, even if the page is refreshed (default=true)
|
||||
* **as_file**: if set to true an image file will be created instead of embedding to please IE6/7 (default=false)
|
||||
* **as_url**: if set to true, a URL will be used in the image tag and will handle captcha generation. This can be used in a multiple-server environment and support IE6/7 (default=false)
|
||||
|
1
Resources/translations/gregwar_captcha.de.yml
Normal file
1
Resources/translations/gregwar_captcha.de.yml
Normal file
@ -0,0 +1 @@
|
||||
Renew: Erneuern
|
1
Resources/translations/gregwar_captcha.en.yml
Normal file
1
Resources/translations/gregwar_captcha.en.yml
Normal file
@ -0,0 +1 @@
|
||||
Renew: Renew
|
1
Resources/translations/gregwar_captcha.nl.yml
Normal file
1
Resources/translations/gregwar_captcha.nl.yml
Normal file
@ -0,0 +1 @@
|
||||
Renew: Vernieuwen
|
1
Resources/translations/gregwar_captcha.pt_BR.yml
Normal file
1
Resources/translations/gregwar_captcha.pt_BR.yml
Normal file
@ -0,0 +1 @@
|
||||
Renew: Regerar
|
1
Resources/translations/gregwar_captcha.ru.yml
Normal file
1
Resources/translations/gregwar_captcha.ru.yml
Normal file
@ -0,0 +1 @@
|
||||
Renew: Обновить
|
1
Resources/translations/validators.de.yml
Normal file
1
Resources/translations/validators.de.yml
Normal file
@ -0,0 +1 @@
|
||||
Bad code value: Code stimmt nicht überein
|
1
Resources/translations/validators.en.yml
Normal file
1
Resources/translations/validators.en.yml
Normal file
@ -0,0 +1 @@
|
||||
Bad code value: Code does not match
|
1
Resources/translations/validators.nl.yml
Normal file
1
Resources/translations/validators.nl.yml
Normal file
@ -0,0 +1 @@
|
||||
Bad code value: Code komt niet overeen
|
1
Resources/translations/validators.pt_BR.yml
Normal file
1
Resources/translations/validators.pt_BR.yml
Normal file
@ -0,0 +1 @@
|
||||
Bad code value: Código de verificação inválido
|
1
Resources/translations/validators.ru.yml
Normal file
1
Resources/translations/validators.ru.yml
Normal file
@ -0,0 +1 @@
|
||||
Bad code value: Неправильный код
|
@ -90,6 +90,10 @@ class CaptchaType extends AbstractType
|
||||
{
|
||||
$isHuman = false;
|
||||
|
||||
if ($options['reload'] && !$options['as_url']) {
|
||||
throw new \InvalidArgumentException('GregwarCaptcha: The reload option cannot be set without as_url, see the README for more information');
|
||||
}
|
||||
|
||||
if ($options['humanity'] > 0) {
|
||||
$humanityKey = $this->key.'_humanity';
|
||||
if ($this->session->get($humanityKey, 0) > 0) {
|
||||
|
@ -18,7 +18,7 @@
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"gregwar/captcha": "v1.0.7"
|
||||
"gregwar/captcha": "v1.0.10"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
|
Reference in New Issue
Block a user