/** * XoopsCaptchaMethod::loadConfig() * * @param string $name * * @return array */ public function loadConfig($name = '') { if (!is_object($this->handler)) { $this->config = array(); } else { $this->config = empty($name) ? $this->handler->config : array_merge($this->handler->config, $this->handler->loadConfig($name)); } }
/** * @covers XoopsCaptcha::loadConfig */ public function testLoadConfig() { $x = $this->object->loadConfig(); $this->assertTrue(is_array($x)); $this->assertTrue(isset($x['disabled'])); $this->assertTrue(isset($x['mode'])); $this->assertTrue(isset($x['name'])); $this->assertTrue(isset($x['skipmember'])); $this->assertTrue(isset($x['maxattempts'])); $x = $this->object->loadConfig('text'); $this->assertTrue(is_array($x)); $this->assertTrue(isset($x['num_chars'])); }
/** * __construct * * @param string $caption Caption of the form element, default value is defined in captcha/language/ * @param string $name Name for the input box * @param boolean $skipmember Skip CAPTCHA check for members * @param array $configs key/value pairs */ public function __construct($caption = '', $name = 'xoopscaptcha', $skipmember = true, $configs = array()) { $this->captchaHandler = \XoopsCaptcha::getInstance(); $configs['name'] = $name; $configs['skipmember'] = $skipmember; $configs = $this->captchaHandler->loadConfig(); $this->captchaHandler->setConfigs($configs); if (!$this->captchaHandler->isActive()) { $this->setHidden(); } else { $caption = !empty($caption) ? $caption : $this->captchaHandler->getCaption(); $this->setCaption($caption); $this->setName($name); } }
/** * __construct * * @param string|array $caption Caption (default defined in captcha/language/) or array of all attributes * @param string $name Name for the input box * @param boolean $skipmember Skip CAPTCHA check for members * @param array $configs key/value pairs */ public function __construct($caption = '', $name = 'xoopscaptcha', $skipmember = true, $configs = array()) { $this->captchaHandler = \XoopsCaptcha::getInstance(); if (is_array($caption)) { parent::__construct($caption); } else { parent::__construct([]); $this->setIfNotEmpty('caption', $caption); $this->setIfNotEmpty('name', $name); $this->setIfNotSet(':skipmember', $skipmember); $this->setIfNotEmpty(':configs', $configs); } $this->setIfNotSet('caption', $this->captchaHandler->getCaption()); $this->setIfNotSet('name', 'xoopscaptcha'); $configs = $this->get(':configs', []); $configs['name'] = $this->get('name'); $configs['skipmember'] = $this->get(':skipmember', true); $configs = $this->captchaHandler->loadConfig(); $this->captchaHandler->setConfigs($configs); if (!$this->captchaHandler->isActive()) { $this->setHidden(); } }
/** * Constructor */ public function __construct() { $this->captcha_handler = XoopsCaptcha::getInstance(); $this->config = $this->captcha_handler->loadConfig("image"); $this->xoops_root_path = \XoopsBaseConfig::get('root-path'); }