XOOPS  2.6.0
Captcha.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
12 namespace Xoops\Form;
13 
40 class Captcha extends Element
41 {
46 
55  public function __construct($caption = '', $name = 'xoopscaptcha', $skipmember = true, $configs = array())
56  {
57  $this->captchaHandler = \XoopsCaptcha::getInstance();
58  $configs['name'] = $name;
59  $configs['skipmember'] = $skipmember;
60  $configs = $this->captchaHandler->loadConfig();
61  $this->captchaHandler->setConfigs($configs);
62  if (! $this->captchaHandler->isActive()) {
63  $this->setHidden();
64  } else {
65  $caption = ! empty($caption) ? $caption : $this->captchaHandler->getCaption();
66  $this->setCaption($caption);
67  $this->setName($name);
68  }
69  }
70 
79  public function setConfig($name, $val)
80  {
81  return $this->captchaHandler->setConfig($name, $val);
82  }
83 
89  public function render()
90  {
91  return $this->captchaHandler->render();
92  }
93 
99  public function renderValidationJS()
100  {
101  return $this->captchaHandler->renderValidationJS();
102  }
103 }
static getInstance()
setConfig($name, $val)
Definition: Captcha.php:79
setCaption($caption)
Definition: Element.php:396
$configs
Definition: config.php:27
__construct($caption= '', $name= 'xoopscaptcha', $skipmember=true, $configs=array())
Definition: Captcha.php:55