public function __construct($width = 150, $height = 50) { parent::__construct($width, $height); $exp = $this->generateExpression(); $this->setGenerateValue($exp); eval('$this->setAssertValue(' . $exp . ');'); }
public function initialize($config = array()) { foreach ($config as $key => $val) { $method = 'set_' . $key; if (method_exists($this, $method)) { $this->{$method}($val); } else { $this->{$key} = $val; } } parent::__construct($config['CaptchaId']); return $this; }
public function __construct($width = 150, $height = 50) { parent::__construct($width, $height); $text = ''; $chars = self::CHARS; for ($i = 0; $i < $this->getLength(); $i++) { $char = $chars[rand(0, strlen($chars) - 1)]; if (rand(0, 10) % 2 == 0) { $char = strtoupper($char); } $text .= $char; } $this->setGenerateValue($text); $this->setAssertValue($text); }