示例#1
0
文件: captcha.php 项目: cepharum/txf
 /**
  * Injects captcha into provided form using optionally selected field name.
  *
  * @param html_form $form
  * @param string $name name of field to use in form for receiving response
  * @return $this fluent interface
  */
 public function injectIntoForm(html_form $form, $name = 'c_info')
 {
     if ($form->hasInput()) {
         $this->check();
     }
     input::drop($name);
     $info =& $this->generate();
     $query = sprintf(_L('Tragen Sie das Ergebnis von %d %s %d als Ziffernfolge in das folgende Feld ein!'), $info['a'], $info['b'] < 0 ? '-' : '+', abs($info['b']));
     $info['name'] = $name;
     $form->setStaticRow('c_query', null, $query)->setTexteditRow($name, null);
     return $this;
 }