aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/front/controllers/OpenSearchController.php
blob: fa32c5f11094eecde632abdf1dc5087f886f371d (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
<?php

declare(strict_types=1);

namespace Shaarli\Front\Controller;

use Slim\Http\Request;
use Slim\Http\Response;

/**
 * Class OpenSearchController
 *
 * Slim controller used to render open search template.
 * This allows to add Shaarli as a search engine within the browser.
 *
 * @package front\controllers
 */
class OpenSearchController extends ShaarliController
{
    public function index(Request $request, Response $response): Response
    {
        $response = $response->withHeader('Content-Type', 'application/opensearchdescription+xml; charset=utf-8');

        $this->assignView('serverurl', index_url($this->container->environment));

        return $response->write($this->render('opensearch'));
    }
}