Skip to content

Commit 389d7b0

Browse files
authored
only glob dirs when loading plugins
1 parent f21c477 commit 389d7b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function st(int $c) { http_response_code($c); exit; }
1717
if ($config->maintenance) st(503);
1818
$req = (object)parse_url(rtrim($_SERVER['REQUEST_URI'], '/') ?: '/'); $req->query = $_REQUEST ?? []; $req->params = [];
1919
$page = $config->routes->{$req->path} ?? $config->routes->{@array_values(array_filter(array_keys(get_object_vars($config->routes)), function($r) use($req) { if (preg_match('#^' . preg_replace('#:(\w+)#', '(?<$1>[\w\-]+)', $r) . '$#', $req->path, $params)) { $req->params = $params; return true; } return false; }))[0]} ?? $config->routes->{'404'} ?? st(404);
20-
if (file_exists('plugins')) { foreach (glob('plugins/*') as $p) include "$p/" . basename($p) . '.php'; }
20+
if (file_exists('plugins')) { foreach (glob('plugins/*', GLOB_ONLYDIR) as $p) include "$p/" . basename($p) . '.php'; }
2121
if (property_exists($page, 'file') && file_exists($page->file)) { ob_start(); include $page->file; $page->body = ob_get_clean(); }
2222
else if (!property_exists($page, 'body')) throw new \JerpyException('File nor body property set on route');
2323
if (property_exists($page, 'layout') && !($l = $page->layout)) { echo $page->body; exit; } else $l = $config->layout ?? throw new \JerpyException('No global layout defined');

0 commit comments

Comments
 (0)