diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -31,6 +31,7 @@ use Psr\Log\LogLevel; | |||
31 | use Shaarli\Config\ConfigManager; | 31 | use Shaarli\Config\ConfigManager; |
32 | use Shaarli\Container\ContainerBuilder; | 32 | use Shaarli\Container\ContainerBuilder; |
33 | use Shaarli\Languages; | 33 | use Shaarli\Languages; |
34 | use Shaarli\Plugin\PluginManager; | ||
34 | use Shaarli\Security\BanManager; | 35 | use Shaarli\Security\BanManager; |
35 | use Shaarli\Security\CookieManager; | 36 | use Shaarli\Security\CookieManager; |
36 | use Shaarli\Security\LoginManager; | 37 | use Shaarli\Security\LoginManager; |
@@ -87,7 +88,17 @@ date_default_timezone_set($conf->get('general.timezone', 'UTC')); | |||
87 | 88 | ||
88 | $loginManager->checkLoginState(client_ip_id($_SERVER)); | 89 | $loginManager->checkLoginState(client_ip_id($_SERVER)); |
89 | 90 | ||
90 | $containerBuilder = new ContainerBuilder($conf, $sessionManager, $cookieManager, $loginManager, $logger); | 91 | $pluginManager = new PluginManager($conf); |
92 | $pluginManager->load($conf->get('general.enabled_plugins', [])); | ||
93 | |||
94 | $containerBuilder = new ContainerBuilder( | ||
95 | $conf, | ||
96 | $sessionManager, | ||
97 | $cookieManager, | ||
98 | $loginManager, | ||
99 | $pluginManager, | ||
100 | $logger | ||
101 | ); | ||
91 | $container = $containerBuilder->build(); | 102 | $container = $containerBuilder->build(); |
92 | $app = new App($container); | 103 | $app = new App($container); |
93 | 104 | ||
@@ -154,6 +165,15 @@ $app->group('/admin', function () { | |||
154 | $this->get('/visibility/{visibility}', '\Shaarli\Front\Controller\Admin\SessionFilterController:visibility'); | 165 | $this->get('/visibility/{visibility}', '\Shaarli\Front\Controller\Admin\SessionFilterController:visibility'); |
155 | })->add('\Shaarli\Front\ShaarliAdminMiddleware'); | 166 | })->add('\Shaarli\Front\ShaarliAdminMiddleware'); |
156 | 167 | ||
168 | $app->group('/plugin', function () use ($pluginManager) { | ||
169 | foreach ($pluginManager->getRegisteredRoutes() as $pluginName => $routes) { | ||
170 | $this->group('/' . $pluginName, function () use ($routes) { | ||
171 | foreach ($routes as $route) { | ||
172 | $this->{strtolower($route['method'])}('/' . ltrim($route['route'], '/'), $route['callable']); | ||
173 | } | ||
174 | }); | ||
175 | } | ||
176 | })->add('\Shaarli\Front\ShaarliMiddleware'); | ||
157 | 177 | ||
158 | // REST API routes | 178 | // REST API routes |
159 | $app->group('/api/v1', function () { | 179 | $app->group('/api/v1', function () { |