aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/front/controller/admin/ToolsController.php
blob: a476e8983a4051748015e8ea5e44fb7ff5d15f8e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php

declare(strict_types=1);

namespace Shaarli\Front\Controller\Admin;

use Shaarli\Render\TemplatePage;
use Slim\Http\Request;
use Slim\Http\Response;

/**
 * Class ToolsController
 *
 * Slim controller used to display the tools page.
 */
class ToolsController extends ShaarliAdminController
{
    public function index(Request $request, Response $response): Response
    {
        $data = [
            'pageabsaddr' => index_url($this->container->environment),
            'sslenabled' => is_https($this->container->environment),
        ];

        $data = $this->executeHooks($data);

        foreach ($data as $key => $value) {
            $this->assignView($key, $value);
        }

        $this->assignView('pagetitle', t('Tools') .' - '. $this->container->conf->get('general.title', 'Shaarli'));

        return $response->write($this->render(TemplatePage::TOOLS));
    }

    /**
     * @param mixed[] $data Variables passed to the template engine
     *
     * @return mixed[] Template data after active plugins render_picwall hook execution.
     */
    protected function executeHooks(array $data): array
    {
        $this->container->pluginManager->executeHooks(
            'render_tools',
            $data
        );

        return $data;
    }
}