示例#1
0
    /**
     * Constructor
     *
     * Creates session namespace for CSRF token, and adds validator for CSRF
     * token.
     *
     * @param  string|array|\Zend\Config\Config $spec
     * @param  array|\Zend\Config\Config $options
     * @return void
     */
    public function __construct($spec, $options = null)
    {
        parent::__construct($spec, $options);

        $this->setAllowEmpty(false)
             ->setRequired(true)
             ->initCsrfValidator();
    }
示例#2
0
文件: Submit.php 项目: rikaix/zf2
 /**
  * Constructor
  *
  * @param  string|array|\Zend\Config\Config $spec Element name or configuration
  * @param  string|array|\Zend\Config\Config $options Element value or configuration
  * @return void
  */
 public function __construct($spec, $options = null)
 {
     if (is_string($spec) && (null !== $options && is_string($options))) {
         $options = array('label' => $options);
     }
     if (!isset($options['ignore'])) {
         $options['ignore'] = true;
     }
     parent::__construct($spec, $options);
 }
示例#3
0
文件: Captcha.php 项目: rexmac/zf2
 /**
  * Constructor
  *
  * $spec may be:
  * - string: name of element
  * - array: options with which to configure element
  * - Zend_Config: Zend_Config with options for configuring element
  *
  * @param  string|array|\Zend\Config\Config $spec
  * @return void
  */
 public function __construct($spec, $options = null)
 {
     parent::__construct($spec, $options);
     $this->setAllowEmpty(true)->setRequired(true)->setAutoInsertNotEmptyValidator(false)->addValidator($this->getCaptcha(), true);
 }