예제 #1
0
파일: Hash.php 프로젝트: alab1001101/zf2
 /**
  * Render CSRF token in form
  *
  * @param  \Zend\View\Renderer $view
  * @return string
  */
 public function render(View $view = null)
 {
     $this->initCsrfToken();
     return parent::render($view);
 }
예제 #2
0
파일: Captcha.php 프로젝트: nevvermind/zf2
 /**
  * Render form element
  *
  * @param  \Zend\View\Renderer $view
  * @return string
  */
 public function render(View $view = null)
 {
     $captcha = $this->getCaptcha();
     $captcha->setName($this->getFullyQualifiedName());
     if (!$this->loadDefaultDecoratorsIsDisabled()) {
         $decorators = $this->getDecorators();
         $decorator = $captcha->getDecorator();
         $key = get_class($this->_getDecorator($decorator, null));
         if (!empty($decorator) && !array_key_exists($key, $decorators)) {
             array_unshift($decorators, $decorator);
         }
         $decorator = array('Captcha', array('captcha' => $captcha));
         $key = get_class($this->_getDecorator($decorator[0], $decorator[1]));
         if ($captcha instanceof \Zend\Captcha\Word && !array_key_exists($key, $decorators)) {
             array_unshift($decorators, $decorator);
         }
         $this->setDecorators($decorators);
     }
     $this->setValue($this->getCaptcha()->generate());
     return parent::render($view);
 }
예제 #3
0
파일: Captcha.php 프로젝트: rexmac/zf2
 /**
  * Render form element
  *
  * @param  \Zend\View\ViewEngine $view
  * @return string
  */
 public function render(View $view = null)
 {
     $captcha = $this->getCaptcha();
     $captcha->setName($this->getFullyQualifiedName());
     $decorators = $this->getDecorators();
     $decorator = $captcha->getDecorator();
     if (!empty($decorator)) {
         array_unshift($decorators, $decorator);
     }
     $decorator = array('Captcha', array('captcha' => $captcha));
     array_unshift($decorators, $decorator);
     $this->setDecorators($decorators);
     $this->setValue($this->getCaptcha()->generate());
     return parent::render($view);
 }
예제 #4
0
 /**
  * Render form element
  * Checks for decorator interface to prevent errors
  *
  * @param  \Zend\View\ViewEngine $view
  * @return string
  */
 public function render(View $view = null)
 {
     $marker = false;
     foreach ($this->getDecorators() as $decorator) {
         if ($decorator instanceof FileDecorator) {
             $marker = true;
         }
     }
     if (!$marker) {
         throw new Exception\RunTimeException('No file decorator found... unable to render file element');
     }
     return parent::render($view);
 }