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()
|
|
|
|
->scalarNode('width')->defaultValue(120)->end()
|
|
|
|
->scalarNode('height')->defaultValue(40)->end()
|
2011-12-02 19:07:28 +01:00
|
|
|
->scalarNode('font')->defaultValue(__DIR__.'/../Generator/Font/captcha.ttf')->end()
|
2011-12-02 18:54:42 +01:00
|
|
|
->scalarNode('keep_value')->defaultValue(true)->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()
|
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()
|
2011-12-14 10:35:10 +01:00
|
|
|
->scalarNode('quality')->defaultValue(15)->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()
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|