/** * Get generated phrase * * @access public * @return string */ public function regenerate($width = null, $height = null, $font = null) { // Builder options $width = is_null($width) ? $this->config->get('makocaptcha::config.width') : $width; $height = is_null($height) ? $this->config->get('makocaptcha::config.height') : $height; $font = is_null($font) ? $this->config->get('makocaptcha::config.font') : $font; // Destroy session $this->session->remove($this->secret . '::phrase'); $this->session->remove($this->secret . '::lastModified'); // Regenerate builder $this->setBuilder($width, $height, $font); }
/** * Load connection parameters from config file. * * @access public * @param string $connection Connection group name */ public function useConn($config) { if ($this->config->get('carteiro::config.connections.' . $config) === null) { throw new \InvalidArgumentException(vsprintf("%s(): A valid config name is required to load connection settings.", [__METHOD__])); } $connection = $this->config->get('carteiro::config.connections.' . $config); $this->host = $connection['host']; $this->port = $connection['port']; $this->secure = $connection['secure']; $this->auth = $connection['auth']; $this->user = $connection['user']; $this->pass = $connection['pass']; $this->from($connection['from'], $connection['sender']); $this->reply($connection['reply'], $connection['sender']); return $this; }
/** * Gets the challenge HTML (javascript and non-javascript version). * * @return string */ public function html() { // Recaptcha Options $htmlContent = '<script type="text/javascript"> var RecaptchaOptions = { theme : "' . $this->config->get('makorecaptcha::config.theme') . '", lang : "' . $this->config->get('makorecaptcha::config.lang') . '" }; </script>'; // Form HTML Content $htmlContent .= '<script type="text/javascript" src="' . $this->getServerUrl() . '/challenge?k=' . $this->publicKey . '"></script> <noscript> <iframe src="' . $this->getServerUrl() . '/noscript?k=' . $this->publicKey . '" height="300" width="500" frameborder="0"></iframe><br/> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/> </noscript>'; // Return HTML return $htmlContent; }
/** * Validator. * * @access public * @param string $input Input * @param string $config Array key to match result * @return boolean */ public function validate($input, $config) { return array_key_exists($input, $this->config->get($config)); }
/** * Validator. * * @access public * @param string $input Input * @param string $config Config key to match result * @return boolean */ public function validate($input, $config) { return in_array($input, $this->config->get($config)); }