Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Form / View / Helper / Captcha / Figlet.php
blobcd25c00a6a23b20a31e7cb643f0d7e4fd7d25cfb
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Form\View\Helper\Captcha;
12 use Zend\Captcha\Figlet as CaptchaAdapter;
13 use Zend\Form\ElementInterface;
14 use Zend\Form\Exception;
16 class Figlet extends AbstractWord
18 /**
19 * Render the captcha
21 * @param ElementInterface $element
22 * @throws Exception\DomainException
23 * @return string
25 public function render(ElementInterface $element)
27 $captcha = $element->getCaptcha();
29 if ($captcha === null || !$captcha instanceof CaptchaAdapter) {
30 throw new Exception\DomainException(sprintf(
31 '%s requires that the element has a "captcha" attribute of type Zend\Captcha\Figlet; none found',
32 __METHOD__
33 ));
36 $captcha->generate();
38 $figlet = sprintf(
39 '<pre>%s</pre>',
40 $captcha->getFiglet()->render($captcha->getWord())
43 $position = $this->getCaptchaPosition();
44 $separator = $this->getSeparator();
45 $captchaInput = $this->renderCaptchaInputs($element);
47 $pattern = '%s%s%s';
48 if ($position == self::CAPTCHA_PREPEND) {
49 return sprintf($pattern, $captchaInput, $separator, $figlet);
52 return sprintf($pattern, $figlet, $separator, $captchaInput);