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.
|
|
|
|
* @return TreeBuilder
|
|
|
|
*/
|
|
|
|
public function getConfigTreeBuilder()
|
|
|
|
{
|
|
|
|
$treeBuilder = new TreeBuilder();
|
|
|
|
$rootNode = $treeBuilder->root('gregwar_captcha', 'array');
|
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()
|
|
|
|
->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()
|
2011-09-08 17:02:40 +02:00
|
|
|
->end()
|
|
|
|
;
|
|
|
|
return $treeBuilder;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|