| Server IP : 54.233.248.239 / Your IP : 172.28.20.13 Web Server : Apache System : Linux ip-172-28-29-189 6.5.0-1014-aws #14~22.04.1-Ubuntu SMP Thu Feb 15 15:27:06 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.2.34-43+ubuntu22.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/vinumday2_0/vendor/greggilbert/recaptcha/src/ |
Upload File : |
<?php
namespace Greggilbert\Recaptcha;
class Recaptcha
{
protected $service;
protected $config = [ ];
protected $dataParameterKeys = [ 'theme', 'type', 'callback', 'tabindex', 'expired-callback' ];
public function __construct($service, $config)
{
$this->service = $service;
$this->config = $config;
}
/**
* Render the recaptcha
*
* @param array $options
*
* @return view
*/
public function render($options = [ ])
{
$mergedOptions = array_merge($this->config['options'], $options);
$data = [
'public_key' => value($this->config['public_key']),
'options' => $mergedOptions,
'dataParams' => $this->extractDataParams($mergedOptions),
];
if (array_key_exists('lang', $mergedOptions) && "" !== trim($mergedOptions['lang'])) {
$data['lang'] = $mergedOptions['lang'];
}
$view = $this->getView($options);
return app('view')->make($view, $data);
}
/**
* Generate the view path
*
* @param array $options
*
* @return string
*/
protected function getView($options = [ ])
{
$view = 'recaptcha::' . $this->service->getTemplate();
$configTemplate = $this->config['template'];
if (array_key_exists('template', $options)) {
$view = $options['template'];
} elseif ("" !== trim($configTemplate)) {
$view = $configTemplate;
}
return $view;
}
/**
* Extract the parameters to be converted to data-* attributes
* See the docs at https://developers.google.com/recaptcha/docs/display
*
* @param array $options
*
* @return array
*/
protected function extractDataParams($options = [ ])
{
return array_only($options, $this->dataParameterKeys);
}
}