/** * Renders the captcha image and its textfields * * @return string */ public function render() { // Render image tag $this->tag->reset(); $this->tag->setTagName("img"); $this->tag->addAttributes($this->getAttributes("image", array("src" => $this->captchaService->create($this->arguments["width"], $this->arguments["height"]), "width" => $this->arguments["width"], "height" => $this->arguments["height"], "style" => "width: " . $this->arguments["width"] . "px; height: " . $this->arguments["height"] . "px;"))); $markup = str_replace("{image}", $this->tag->render(), $this->arguments["markup"]); // Render phrase textfield $this->tag->reset(); $this->tag->setTagName("input"); $this->tag->addAttributes($this->getAttributes("phrase", array("name" => $this->arguments["name"] . "[phrase]", "type" => "text", "autocomplete" => "off"))); $markup = str_replace("{phrase}", $this->tag->render(), $markup); // Render phrase textfield $this->tag->reset(); $this->tag->setTagName("input"); $this->tag->addAttributes($this->getAttributes("hash", array("name" => $this->arguments["name"] . "[hash]", "type" => "hidden", "value" => $this->captchaService->getPhraseHash()))); return str_replace("{hash}", $this->tag->render(), $markup); }