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