equal
deleted
inserted
replaced
13 * to license@zend.com so we can send you a copy immediately. |
13 * to license@zend.com so we can send you a copy immediately. |
14 * |
14 * |
15 * @category Zend |
15 * @category Zend |
16 * @package Zend_Captcha |
16 * @package Zend_Captcha |
17 * @subpackage Adapter |
17 * @subpackage Adapter |
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
18 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
20 * @version $Id: Image.php 22589 2010-07-16 20:51:51Z mikaelkael $ |
20 * @version $Id: Image.php 24821 2012-05-29 14:54:50Z adamlundrigan $ |
21 */ |
21 */ |
22 |
22 |
23 /** @see Zend_Captcha_Word */ |
23 /** @see Zend_Captcha_Word */ |
24 require_once 'Zend/Captcha/Word.php'; |
24 require_once 'Zend/Captcha/Word.php'; |
25 |
25 |
29 * Generates image displaying random word |
29 * Generates image displaying random word |
30 * |
30 * |
31 * @category Zend |
31 * @category Zend |
32 * @package Zend_Captcha |
32 * @package Zend_Captcha |
33 * @subpackage Adapter |
33 * @subpackage Adapter |
34 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
34 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
35 * @license http://framework.zend.com/license/new-bsd New BSD License |
35 * @license http://framework.zend.com/license/new-bsd New BSD License |
36 */ |
36 */ |
37 class Zend_Captcha_Image extends Zend_Captcha_Word |
37 class Zend_Captcha_Image extends Zend_Captcha_Word |
38 { |
38 { |
39 /** |
39 /** |
578 return; |
578 return; |
579 } |
579 } |
580 $suffixLength = strlen($this->_suffix); |
580 $suffixLength = strlen($this->_suffix); |
581 foreach (new DirectoryIterator($imgdir) as $file) { |
581 foreach (new DirectoryIterator($imgdir) as $file) { |
582 if (!$file->isDot() && !$file->isDir()) { |
582 if (!$file->isDot() && !$file->isDir()) { |
583 if ($file->getMTime() < $expire) { |
583 if (file_exists($file->getPathname()) && $file->getMTime() < $expire) { |
584 // only deletes files ending with $this->_suffix |
584 // only deletes files ending with $this->_suffix |
585 if (substr($file->getFilename(), -($suffixLength)) == $this->_suffix) { |
585 if (substr($file->getFilename(), -($suffixLength)) == $this->_suffix) { |
586 unlink($file->getPathname()); |
586 unlink($file->getPathname()); |
587 } |
587 } |
588 } |
588 } |
597 * @param mixed $element |
597 * @param mixed $element |
598 * @return string |
598 * @return string |
599 */ |
599 */ |
600 public function render(Zend_View_Interface $view = null, $element = null) |
600 public function render(Zend_View_Interface $view = null, $element = null) |
601 { |
601 { |
|
602 $endTag = ' />'; |
|
603 if (($view instanceof Zend_View_Abstract) && !$view->doctype()->isXhtml()) { |
|
604 $endTag = '>'; |
|
605 } |
602 return '<img width="' . $this->getWidth() . '" height="' . $this->getHeight() . '" alt="' . $this->getImgAlt() |
606 return '<img width="' . $this->getWidth() . '" height="' . $this->getHeight() . '" alt="' . $this->getImgAlt() |
603 . '" src="' . $this->getImgUrl() . $this->getId() . $this->getSuffix() . '" />'; |
607 . '" src="' . $this->getImgUrl() . $this->getId() . $this->getSuffix() . '"' . $endTag; |
604 } |
608 } |
605 } |
609 } |