/fluentia-payments/vendor/leafs/http/src/Headers.php
$data = [];
foreach ($params as $param) {
$data[$param] = self::get($param, $safeOutput);
}
return $data;
}
/**
* Set a new header
*/
public static function set($key, string $value = "", $replace = true, int $httpCode = 200): void
{
if (!is_array($key)) {
$code = $httpCode ?? self::$httpCode;
if (!$code) {
header("$key: $value", $replace);
} else {
header("$key: $value", $replace, $code);
}
} else {
foreach ($key as $header => $headerValue) {
self::set($header, $headerValue, $replace, $httpCode);
}
}
}
/**
* Remove a header
*/
public static function remove($keys)
{
if (!is_array($keys)) {
header_remove($keys);
} else {
foreach ($keys as $key) {
self::remove($key);
}
}
Arguments
"Cannot modify header information - headers already sent by (output started at /fluentia-payments/public/index.php:38)"
/fluentia-payments/vendor/leafs/http/src/Headers.php
$data = [];
foreach ($params as $param) {
$data[$param] = self::get($param, $safeOutput);
}
return $data;
}
/**
* Set a new header
*/
public static function set($key, string $value = "", $replace = true, int $httpCode = 200): void
{
if (!is_array($key)) {
$code = $httpCode ?? self::$httpCode;
if (!$code) {
header("$key: $value", $replace);
} else {
header("$key: $value", $replace, $code);
}
} else {
foreach ($key as $header => $headerValue) {
self::set($header, $headerValue, $replace, $httpCode);
}
}
}
/**
* Remove a header
*/
public static function remove($keys)
{
if (!is_array($keys)) {
header_remove($keys);
} else {
foreach ($keys as $key) {
self::remove($key);
}
}
Arguments
"Access-Control-Allow-Origin: fluentia-payments.clinera.io"
true
200
/fluentia-payments/vendor/leafs/http/src/Headers.php
public static function contentXml($code = 200): void
{
self::set("Content-Type", "application/xml", true, $code ?? self::$httpCode);
}
/**
* Set the content-type to json
*/
public static function contentJSON($code = 200): void
{
self::set("Content-Type", "application/json", true, $code ?? self::$httpCode);
}
/**
* Quickly set an access control header
*/
public static function accessControl($key, $value = "", $code = 200)
{
if (is_string($key)) {
self::set("Access-Control-$key", $value, true, $code ?? self::$httpCode);
} else {
foreach ($key as $header => $headerValue) {
self::accessControl($header, $headerValue, $code);
}
}
}
protected static function findHeaders()
{
if (function_exists("getallheaders") && \getallheaders()) {
return \getallheaders();
}
$headers = [];
foreach ($_SERVER as $name => $value) {
if ((substr($name, 0, 5) == 'HTTP_') || ($name == 'CONTENT_TYPE') || ($name == 'CONTENT_LENGTH')) {
$headers[str_replace([' ', 'Http'], ['-', 'HTTP'], ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
}
return $headers;
Arguments
"Access-Control-Allow-Origin"
"fluentia-payments.clinera.io"
true
200
/fluentia-payments/vendor/leafs/cors/src/Cors.php
{
if (is_array(static::$config['methods'])) {
static::$config['methods'] = implode(',', static::$config['methods']);
}
Headers::accessControl('Allow-Methods', static::$config['methods']);
}
protected static function configureOrigin()
{
$origin = static::$config['origin'];
// if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS' && static::$config['optionsSuccessRequest'] == '204') {
// // Safari (and potentially other browsers) need content-length 0,
// // for 204 or they just hang waiting for a body
// Headers::set('Content-Length', '0');
// }
if (static::isOriginAllowed($origin)) {
Headers::accessControl(
'Allow-Origin',
$_SERVER['HTTP_ORIGIN'] ?? $_SERVER['HTTP_HOST']
);
}
if ($origin !== '*') {
Headers::set('Vary', 'Origin');
}
}
protected static function configureHeaders()
{
$headers = static::$config['allowedHeaders'];
if (!$headers) {
// .headers wasn't specified, so reflect the request headers
$headers = Headers::get('access-control-request-headers');
Headers::set('Vary', 'Access-Control-Request-Headers');
}
Arguments
"Allow-Origin"
"fluentia-payments.clinera.io"
/fluentia-payments/vendor/leafs/cors/src/Cors.php
class Cors
{
protected static $config = [];
protected static $defaultConfig = [
'origin' => '*',
'methods' => 'GET,HEAD,PUT,PATCH,POST,DELETE',
'allowedHeaders' => '*',
'exposedHeaders' => '',
'credentials' => false,
'maxAge' => null,
'preflightContinue' => false,
'optionsSuccessStatus' => 204,
];
public static function config($config = [])
{
static::$config = array_merge(static::$defaultConfig, $config);
static::configureOrigin();
static::configureHeaders();
static::configureExposedHeaders();
static::configureMaxAge();
static::configureCredentials();
static::configureMethods();
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
if (static::$config['preflightContinue']) {
// skip to code
} else {
exit(0);
}
}
}
protected static function configureMethods()
{
if (is_array(static::$config['methods'])) {
static::$config['methods'] = implode(',', static::$config['methods']);
}
/fluentia-payments/vendor/leafs/leaf/src/App.php
$this->setupErrorHandler();
}
/**
* Attach a view engine to Leaf
* @param mixed $view The view engine to attach
*/
public function attachView($view, $name = null)
{
Config::attachView($view, $name);
}
/**
* Evade CORS errors
* @param $options Config for cors
*/
public function cors($options = [])
{
if (\class_exists('Leaf\Http\Cors')) {
Http\Cors::config($options);
} else {
\trigger_error('Cors module not found! Run `leaf install cors` or `composer require leafs/cors` to install the CORS module. This is required to configure CORS.');
}
}
/**
* Tune vite to work without Leaf MVC
*/
public function vite(
$options = [
'assets' => '',
'build' => '',
'hotFile' => 'hot',
]
) {
if (class_exists('Leaf\Vite')) {
\Leaf\Vite::config('assets', $options['assets']);
\Leaf\Vite::config('build', $options['build']);
\Leaf\Vite::config('hotFile', $options['hotFile']);
}
Arguments
array:8 [
"origin" => "*"
"methods" => "GET,HEAD,PUT,PATCH,POST,DELETE"
"allowedHeaders" => "*"
"exposedHeaders" => ""
"credentials" => false
"maxAge" => null
"preflightContinue" => false
"optionsSuccessStatus" => 204
]
/fluentia-payments/vendor/leafs/mvc-core/src/Core.php
},
], $config['auth'] ?? []);
auth()->config($config['auth']);
}
if (class_exists('Leaf\Http\Cors')) {
$config['cors'] = array_merge([
'origin' => _env('CORS_ALLOWED_ORIGINS', '*'),
'methods' => _env('CORS_ALLOWED_METHODS', 'GET,HEAD,PUT,PATCH,POST,DELETE'),
'allowedHeaders' => _env('CORS_ALLOWED_HEADERS', '*'),
'exposedHeaders' => _env('CORS_EXPOSED_HEADERS', ''),
'credentials' => false,
'maxAge' => null,
'preflightContinue' => false,
'optionsSuccessStatus' => 204,
], $config['cors'] ?? []);
if (php_sapi_name() !== 'cli') {
app()->cors($config['cors']);
}
}
if (class_exists('Leaf\Anchor\CSRF')) {
$config['csrf'] = array_merge([
'secret' => _env('APP_KEY', '@nkor_leaf$0Secret!!'),
'secretKey' => 'X-Leaf-CSRF-Token',
'except' => [],
'methods' => ['POST', 'PUT', 'PATCH', 'DELETE'],
'messages.tokenNotFound' => 'Token not found.',
'messages.tokenInvalid' => 'Invalid token.',
'onError' => null,
], $config['csrf'] ?? []);
$csrfEnabled = (
$config['csrf'] &&
$config['auth']['session'] ?? false
);
if (($config['csrf']['enabled'] ?? null) !== null) {
Arguments
array:8 [
"origin" => "*"
"methods" => "GET,HEAD,PUT,PATCH,POST,DELETE"
"allowedHeaders" => "*"
"exposedHeaders" => ""
"credentials" => false
"maxAge" => null
"preflightContinue" => false
"optionsSuccessStatus" => 204
]
/fluentia-payments/vendor/leafs/mvc-core/src/Core.php
{
protected static $paths;
protected static $mode = 'web';
/**
* Return application paths
* @return array
*/
public static function paths(): array
{
return static::$paths;
}
/**
* Setup MVC application based on config
*/
public static function loadApplicationConfig()
{
static::loadConfig();
\Leaf\Database::initDb();
if (php_sapi_name() !== 'cli') {
if (class_exists('Leaf\Vite')) {
\Leaf\Vite::config('assets', PublicPath('build'));
\Leaf\Vite::config('build', 'public/build');
\Leaf\Vite::config('hotFile', 'public/hot');
}
if (storage()->exists(LibPath())) {
static::loadLibs();
}
if (storage()->exists('app/index.php')) {
require 'app/index.php';
}
}
}
/fluentia-payments/vendor/leafs/mvc-core/src/Core.php
$handler = (new \Leaf\Exception\Run());
$handler->allowQuit(false);
$handler->writeToOutput(false);
$handler->pushHandler(new \Leaf\Exception\Handler\PlainTextHandler());
echo $handler->handleException($th);
return 1;
}
}
/**
* Load all application routes and run the application
*/
public static function runApplication()
{
// trick process into setting Leaf up
app();
try {
static::loadApplicationConfig();
$routePath = static::$paths['routes'];
$routeFiles = glob("$routePath/*.php");
app()->setNamespace('\App\Controllers');
require "$routePath/index.php";
foreach ($routeFiles as $routeFile) {
if (basename($routeFile) === 'index.php') {
continue;
}
if (strpos(basename($routeFile), '_') !== 0) {
continue;
}
require $routeFile;
}
/fluentia-payments/public/index.php
*/
if (php_sapi_name() === 'cli-server') {
$path = realpath(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
if (is_string($path) && __FILE__ !== $path && is_file($path)) {
return false;
}
unset($path);
}
/*
|--------------------------------------------------------------------------
| Run your Leaf MVC application
|--------------------------------------------------------------------------
|
| This line brings in all your routes and starts your application
|
*/
\Leaf\Core::runApplication();