Initial commit

This commit is contained in:
isUnknown 2024-07-10 16:10:33 +02:00
commit 08a8a71c55
631 changed files with 139902 additions and 0 deletions

View file

@ -0,0 +1,8 @@
<?php
class_alias(\Kirby\Kql\Kql::class, 'Kql');
class_alias(\Kirby\Kql\Interceptor::class, 'Kirby\Kql\Interceptors\Interceptor');
// Provide backwards compatibility for Kirby 3 core classes
class_alias(\Kirby\Kql\Interceptors\Content\Content::class, 'Kirby\Kql\Interceptors\Cms\Content');
class_alias(\Kirby\Kql\Interceptors\Content\Field::class, 'Kirby\Kql\Interceptors\Cms\Field');

View file

@ -0,0 +1,25 @@
<?php
use Kirby\Kql\Kql;
return [
'routes' => function ($kirby) {
return [
[
'pattern' => 'query',
'method' => 'POST|GET',
'auth' => $kirby->option('kql.auth') === false ? false : true,
'action' => function () use ($kirby) {
$input = $kirby->request()->get();
$result = Kql::run($input);
return [
'code' => 200,
'result' => $result,
'status' => 'ok',
];
}
]
];
}
];

View file

@ -0,0 +1,21 @@
<?php
namespace Kirby\Kql;
use Kirby\Toolkit\Str;
function autoload(string $namespace, string $dir)
{
spl_autoload_register(function ($class) use ($namespace, $dir) {
if (str_contains($class, '.') === true || str_starts_with($class, $namespace) === false) {
return;
}
$path = Str::after($class, $namespace);
$path = $dir . '/' . str_replace('\\', '/', $path) . '.php';
if (is_file($path) === true) {
include $path;
}
});
}

View file

@ -0,0 +1,11 @@
<?php
use Kirby\Cms\Helpers;
use Kirby\Kql\Kql;
if (Helpers::hasOverride('kql') === false) {
function kql($input, $model = null)
{
return Kql::run($input, $model);
}
}