示例#1
0
 /**
  * @param null $options
  */
 public function __construct($options = null)
 {
     $this->setService(new ReCaptchaService());
     parent::__construct($options);
     if (!empty($options)) {
         if (array_key_exists('site_key', $options)) {
             $this->setSiteKey($options['site_key']);
         }
         if (array_key_exists('secret_key', $options)) {
             $this->setSecretKey($options['secret_key']);
         }
         $this->setOptions($options);
     }
 }
 /**
  * @param null $options
  */
 public function __construct($options = null)
 {
     $options = $options === null ? [] : $options;
     $serviceOptions = array_key_exists('service_options', $options) ? $options['service_options'] : null;
     $this->setService(new ReCaptchaService(null, $serviceOptions));
     parent::__construct($options);
     if (!empty($options)) {
         if (array_key_exists('site_key', $options)) {
             $this->setSiteKey($options['site_key']);
         }
         if (array_key_exists('secret_key', $options)) {
             $this->setSecretKey($options['secret_key']);
         }
         $this->setOptions($options);
     }
 }
示例#3
0
 /**
  * Set option
  *
  * If option is a service parameter, proxies to the service. The same
  * goes for any service options (distinct from service params)
  *
  * @param  string $key
  * @param  mixed $value
  * @return \Zend\Captcha\ReCaptcha
  */
 public function setOption($key, $value)
 {
     $service = $this->getService();
     if (isset($this->_serviceParams[$key])) {
         $service->setParam($key, $value);
         return $this;
     }
     if (isset($this->_serviceOptions[$key])) {
         $service->setOption($key, $value);
         return $this;
     }
     return parent::setOption($key, $value);
 }
示例#4
0
 /**
  * Constructor.
  *
  * @param null|array|Traversable $options
  */
 public function __construct($options = null)
 {
     $this->setService(new ReCaptchaService());
     parent::__construct($options);
     if (!empty($options)) {
         if (array_key_exists('private_key', $options)) {
             $this->getService()->setPrivateKey($options['private_key']);
         }
         if (array_key_exists('public_key', $options)) {
             $this->getService()->setPublicKey($options['public_key']);
         }
         if (array_key_exists('theme', $options)) {
             $this->getService()->setTheme($options['theme']);
         }
         $this->setOptions($options);
     }
 }
示例#5
0
 /**
  * Set option
  *
  * If option is a service parameter, proxies to the service. The same
  * goes for any service options (distinct from service params)
  *
  * @param  string $key
  * @param  mixed $value
  * @return ReCaptcha
  */
 public function setOption($key, $value)
 {
     $service = $this->getService();
     if (array_key_exists($key, $this->serviceParams)) {
         $service->setParam($key, $value);
         return $this;
     }
     if (array_key_exists($key, $this->serviceOptions)) {
         $service->setOption($key, $value);
         return $this;
     }
     return parent::setOption($key, $value);
 }