diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-05-22 13:47:02 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-07-23 21:19:21 +0200 |
commit | ba43064ddb7771fc97df135a32f9b0d5e373dd36 (patch) | |
tree | b3519775fa4fe573af6980459e486f43837e5594 /application/front/controller | |
parent | 2899ebb5b5e82890c877151f5c02045266ac9973 (diff) | |
download | Shaarli-ba43064ddb7771fc97df135a32f9b0d5e373dd36.tar.gz Shaarli-ba43064ddb7771fc97df135a32f9b0d5e373dd36.tar.zst Shaarli-ba43064ddb7771fc97df135a32f9b0d5e373dd36.zip |
Process tools page through Slim controller
Diffstat (limited to 'application/front/controller')
-rw-r--r-- | application/front/controller/admin/ToolsController.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/application/front/controller/admin/ToolsController.php b/application/front/controller/admin/ToolsController.php new file mode 100644 index 00000000..66db5ad9 --- /dev/null +++ b/application/front/controller/admin/ToolsController.php | |||
@@ -0,0 +1,49 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Shaarli\Front\Controller\Admin; | ||
6 | |||
7 | use Slim\Http\Request; | ||
8 | use Slim\Http\Response; | ||
9 | |||
10 | /** | ||
11 | * Class ToolsController | ||
12 | * | ||
13 | * Slim controller used to display the tools page. | ||
14 | */ | ||
15 | class ToolsController extends ShaarliAdminController | ||
16 | { | ||
17 | public function index(Request $request, Response $response): Response | ||
18 | { | ||
19 | $data = [ | ||
20 | 'pageabsaddr' => index_url($this->container->environment), | ||
21 | 'sslenabled' => is_https($this->container->environment), | ||
22 | ]; | ||
23 | |||
24 | $this->executeHooks($data); | ||
25 | |||
26 | foreach ($data as $key => $value) { | ||
27 | $this->assignView($key, $value); | ||
28 | } | ||
29 | |||
30 | $this->assignView('pagetitle', t('Tools') .' - '. $this->container->conf->get('general.title', 'Shaarli')); | ||
31 | |||
32 | return $response->write($this->render('tools')); | ||
33 | } | ||
34 | |||
35 | /** | ||
36 | * @param mixed[] $data Variables passed to the template engine | ||
37 | * | ||
38 | * @return mixed[] Template data after active plugins render_picwall hook execution. | ||
39 | */ | ||
40 | protected function executeHooks(array $data): array | ||
41 | { | ||
42 | $this->container->pluginManager->executeHooks( | ||
43 | 'render_tools', | ||
44 | $data | ||
45 | ); | ||
46 | |||
47 | return $data; | ||
48 | } | ||
49 | } | ||