]> git.immae.eu Git - github/shaarli/Shaarli.git/blame - application/front/controller/visitor/OpenSearchController.php
Process main page (linklist) through Slim controller
[github/shaarli/Shaarli.git] / application / front / controller / visitor / OpenSearchController.php
CommitLineData
5ec4708c
A
1<?php
2
3declare(strict_types=1);
4
2899ebb5 5namespace Shaarli\Front\Controller\Visitor;
5ec4708c 6
1a8ac737 7use Shaarli\Render\TemplatePage;
5ec4708c
A
8use Slim\Http\Request;
9use Slim\Http\Response;
10
11/**
12 * Class OpenSearchController
13 *
14 * Slim controller used to render open search template.
15 * This allows to add Shaarli as a search engine within the browser.
5ec4708c 16 */
2899ebb5 17class OpenSearchController extends ShaarliVisitorController
5ec4708c
A
18{
19 public function index(Request $request, Response $response): Response
20 {
21 $response = $response->withHeader('Content-Type', 'application/opensearchdescription+xml; charset=utf-8');
22
23 $this->assignView('serverurl', index_url($this->container->environment));
24
1a8ac737 25 return $response->write($this->render(TemplatePage::OPEN_SEARCH));
5ec4708c
A
26 }
27}