Exemplo n.º 1
0
 /**
  * XoopsCaptcha::loadHandler()
  *
  * @param string $name
  *
  * @return XoopsCaptchaMethod|null
  */
 public function loadHandler($name = null)
 {
     $name = !empty($name) ? $name : (empty($this->config['mode']) ? 'text' : $this->config['mode']);
     $class = 'XoopsCaptcha' . ucfirst($name);
     if (!empty($this->handler) && get_class($this->handler) == $class) {
         return $this->handler;
     }
     $this->handler = null;
     if (XoopsLoad::fileExists($file = $this->path_basic . '/' . $name . '.php')) {
         require_once $file;
     } else {
         if (XoopsLoad::fileExists($file = $this->path_plugin . '/' . $name . '.php')) {
             require_once $file;
         }
     }
     if (!class_exists($class)) {
         $class = 'XoopsCaptchaText';
         require_once $this->path_basic . '/text.php';
     }
     /* @var $handler XoopsCaptchaMethod */
     $handler = new $class($this);
     if ($handler->isActive()) {
         $this->handler = $handler;
         $this->handler->loadConfig($name);
     }
     return $this->handler;
 }
Exemplo n.º 2
0
 function render()
 {
     parent::render();
     parent::loadConfig();
     $form = $this->loadText() . "&nbsp;&nbsp; <input type='text' name='" . $this->config["name"] . "' id='" . $this->config["name"] . "' size='" . $this->config["num_chars"] . "' maxlength='" . $this->config["num_chars"] . "' value='' />";
     $form .= "<br />" . $this->config["rule_text"];
     if (!empty($this->config["maxattempt"])) {
         $form .= "<br />" . sprintf($this->config["maxattempt_text"], $this->config["maxattempt"]);
     }
     return $form;
 }
Exemplo n.º 3
0
 /**
  * XoopsCaptchaText::render()
  *
  * @return
  */
 function render()
 {
     parent::render();
     parent::loadConfig();
     $form = $this->loadText() . '&nbsp;&nbsp; <input type="text" name="' . $this->config['name'] . '" id="' . $this->config['name'] . '" size="' . $this->config['num_chars'] . '" maxlength="' . $this->config['num_chars'] . '" value="" />';
     $form .= '<br />' . $this->config['rule_text'];
     if (!empty($this->config['maxattempt'])) {
         $form .= '<br />' . sprintf($this->config['maxattempt_text'], $this->config['maxattempt']);
     }
     return $form;
 }
Exemplo n.º 4
0
 /**
  * XoopsCaptchaImage::__construct()
  *
  * @param mixed $handler
  */
 function __construct($handler = null)
 {
     parent::__construct($handler);
     parent::loadConfig('image');
 }