2011-09-08 17:02:40 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Gregwar\CaptchaBundle\DependencyInjection;
|
|
|
|
|
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|
|
|
|
|
|
|
class Configuration implements ConfigurationInterface
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Generates the configuration tree.
|
2012-11-14 04:33:36 +01:00
|
|
|
*
|
2011-09-08 17:02:40 +02:00
|
|
|
* @return TreeBuilder
|
|
|
|
*/
|
|
|
|
public function getConfigTreeBuilder()
|
|
|
|
{
|
|
|
|
$treeBuilder = new TreeBuilder();
|
2012-12-03 20:49:17 +01:00
|
|
|
$rootNode = $treeBuilder->root('gregwar_captcha');
|
2011-11-09 14:43:25 +01:00
|
|
|
|
2011-09-08 17:02:40 +02:00
|
|
|
$rootNode
|
2011-09-09 20:02:47 +02:00
|
|
|
->addDefaultsIfNotSet()
|
2011-09-08 17:02:40 +02:00
|
|
|
->children()
|
2011-09-09 20:02:47 +02:00
|
|
|
->scalarNode('length')->defaultValue(5)->end()
|
2013-01-21 15:18:19 +01:00
|
|
|
->scalarNode('width')->defaultValue(130)->end()
|
|
|
|
->scalarNode('height')->defaultValue(50)->end()
|
2011-12-02 19:07:28 +01:00
|
|
|
->scalarNode('font')->defaultValue(__DIR__.'/../Generator/Font/captcha.ttf')->end()
|
2012-12-25 19:17:25 +01:00
|
|
|
->scalarNode('keep_value')->defaultValue(false)->end()
|
2011-12-02 18:41:16 +01:00
|
|
|
->scalarNode('charset')->defaultValue('abcdefhjkmnprstuvwxyz23456789')->end()
|
2011-11-09 14:43:25 +01:00
|
|
|
->scalarNode('as_file')->defaultValue(false)->end()
|
2012-11-14 04:33:36 +01:00
|
|
|
->scalarNode('as_url')->defaultValue(false)->end()
|
2012-12-25 20:07:00 +01:00
|
|
|
->scalarNode('reload')->defaultValue(false)->end()
|
2011-11-09 14:43:25 +01:00
|
|
|
->scalarNode('image_folder')->defaultValue('captcha')->end()
|
|
|
|
->scalarNode('web_path')->defaultValue('%kernel.root_dir%/../web')->end()
|
2011-11-09 17:58:53 +01:00
|
|
|
->scalarNode('gc_freq')->defaultValue(100)->end()
|
|
|
|
->scalarNode('expiration')->defaultValue(60)->end()
|
2017-09-27 12:01:02 +02:00
|
|
|
->scalarNode('quality')->defaultValue(50)->end()
|
2012-06-29 16:23:05 +02:00
|
|
|
->scalarNode('invalid_message')->defaultValue('Bad code value')->end()
|
2012-06-30 18:18:05 +02:00
|
|
|
->scalarNode('bypass_code')->defaultValue(null)->end()
|
2012-12-04 11:33:54 +01:00
|
|
|
->scalarNode('whitelist_key')->defaultValue('captcha_whitelist_key')->end()
|
2012-12-04 12:20:23 +01:00
|
|
|
->scalarNode('humanity')->defaultValue(0)->end()
|
2013-01-21 14:04:53 +01:00
|
|
|
->scalarNode('distortion')->defaultValue(true)->end()
|
2013-03-13 11:02:41 +01:00
|
|
|
->scalarNode('max_front_lines')->defaultValue(null)->end()
|
|
|
|
->scalarNode('max_behind_lines')->defaultValue(null)->end()
|
2013-04-24 18:11:08 +02:00
|
|
|
->scalarNode('interpolation')->defaultValue(true)->end()
|
2013-08-07 11:18:16 +02:00
|
|
|
->arrayNode('text_color')->prototype('scalar')->end()->end()
|
|
|
|
->arrayNode('background_color')->prototype('scalar')->end()->end()
|
2013-09-26 20:38:39 +02:00
|
|
|
->arrayNode('background_images')->prototype('scalar')->end()->end()
|
2013-11-19 10:51:58 +01:00
|
|
|
->scalarNode('disabled')->defaultValue(false)->end()
|
2013-09-26 21:10:02 +02:00
|
|
|
->scalarNode('ignore_all_effects')->defaultValue(false)->end()
|
2011-09-08 17:02:40 +02:00
|
|
|
->end()
|
|
|
|
;
|
2012-12-03 20:49:17 +01:00
|
|
|
|
2011-09-08 17:02:40 +02:00
|
|
|
return $treeBuilder;
|
|
|
|
}
|
|
|
|
}
|