Initial commit
This commit is contained in:
commit
08a8a71c55
631 changed files with 139902 additions and 0 deletions
21
public/site/plugins/kql/extensions/autoload.php
Normal file
21
public/site/plugins/kql/extensions/autoload.php
Normal 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;
|
||||
}
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue