radekdostal / nette-captchacontrol
Captcha Control for Nette Framework
1.0.0
2016-04-01 06:45 UTC
Requires
- php: >=5.3.0
- nette/nette: ^2.3.0
Requires (Dev)
- nette/deprecated: ^2.3.0
- nette/forms: ^2.3.0
- nette/http: ^2.3.0
- nette/utils: ^2.3.0
- tracy/tracy: ^2.3.0
This package is auto-updated.
Last update: 2024-12-20 04:52:51 UTC
README
Captcha Control for Nette Framework
- Author: Radek Dostál <radek.dostal@gmail.com>
- Copyright: Copyright (c) 2016 Radek Dostál
- Author: Pavel Máca
- Copyright: Copyright (c) 2010 Pavel Máca
- Licence: MIT License
- GitHub: http://github.com/radekdostal/Nette-CaptchaControl
Requirements
- PHP 5.3 or later
- Nette Framework 2.3 or later
Example
Registration
Registration to bootstrap.php file.
RadekDostal\NetteComponents\CaptchaControl::register($container->getByType('Nette\Http\Session'));
Usage
$form = new \Nette\Application\UI\Form; $form->addCaptcha('captcha') ->addRule(\Nette\Forms\Form::FILLED, 'Rewrite text from image.') ->addRule($form['captcha']->getValidator(), 'Try it again.') ->setFontSize(25) ->setLength(10) // word length ->setTextMargin(20) // px, set margin on left and right side ->setTextColor(\Nette\Image::rgb(0, 0, 0)) // array('red' => 0-255, 'green' => 0-255, 'blue' => 0-255) ->setBackgroundColor(\Nette\Image::rgb(240,240,240)) // array('red' => 0-255, 'green' => 0-255, 'blue' => 0-255) ->setImageHeight(50) // px, if not set (0), image height will be generated by font size ->setImageWidth(0) // px, if not set (0), image width will be generated by font size ->setExpire(10) // seconds, set expiration time to session ->setFilterSmooth(FALSE) // int or FALSE (disable) ->setFilterContrast(FALSE) // int or FALSE (disable) ->useNumbers(FALSE); // bool or void
Global setting
CaptchaControl::$defaultFontSize = 30; CaptchaControl::$defaultFilterSmooth = 10; ...