Development

/plugins/sfExtraWidgetsPlugin/lib/widget/sfExtraWidgetFormInputCaptcha.class.php

You must first sign up to be able to contribute.

root/plugins/sfExtraWidgetsPlugin/lib/widget/sfExtraWidgetFormInputCaptcha.class.php

Revision 17655, 0.9 kB (checked in by zellerda, 4 years ago)

Add Colorpicker widget
Add Money widget
Add Spin widget
Add Captcha widget
Add TinyMce? widget
Add Ip validators
Remove ReCaptcha?
Fix autocompleter style
Fix datepicker input render

Line 
1 <?php
2 /**
3 * sfExtraWidgetFormCaptcha render an input with a captcha image
4 *
5 * @author   David Zeller <zellerda01@gmail.com>
6 */
7 class sfExtraWidgetFormInputCaptcha extends sfWidgetFormInput
8 {   
9     public function render($name, $value = null, $attributes = array(), $errors = array())
10     {
11         $obj = link_to_function(
12             image_tag(
13                 url_for('captcha/getImage?key=' . time()),
14                 array(
15                     'id' => 'captcha_img',
16                     'alt' => 'Click if you cannot read the picture',
17                     'align' => 'absmiddle'
18                 )
19             ),
20             'document.getElementById(\'captcha_img\').src=\'' . url_for('captcha/getImage?reload=1') . '&key=\'+Math.round(Math.random(0)*1000)+1+\'\''
21         );
22         
23         return '<div style="padding-bottom: 5px;">' . $obj . '</div>' . parent::render($name, $value, $attributes, $errors);
24     }
25 }
26
Note: See TracBrowser for help on using the browser.