diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-05-20 10:47:20 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-07-23 21:19:21 +0200 |
commit | 5ec4708ced1cdca01eddd7e52377ab5e5f8b3290 (patch) | |
tree | 2d65bdd883c70ac12bee12e113f514cd59d3bdc2 /application/front/controllers | |
parent | 7b2ba6ef820335df682fbe3dcfaceef3a62cf4a5 (diff) | |
download | Shaarli-5ec4708ced1cdca01eddd7e52377ab5e5f8b3290.tar.gz Shaarli-5ec4708ced1cdca01eddd7e52377ab5e5f8b3290.tar.zst Shaarli-5ec4708ced1cdca01eddd7e52377ab5e5f8b3290.zip |
Process OpenSearch controller through Slim
Also it was missing on the default template feeds
Diffstat (limited to 'application/front/controllers')
-rw-r--r-- | application/front/controllers/OpenSearchController.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/application/front/controllers/OpenSearchController.php b/application/front/controllers/OpenSearchController.php new file mode 100644 index 00000000..fa32c5f1 --- /dev/null +++ b/application/front/controllers/OpenSearchController.php | |||
@@ -0,0 +1,28 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Shaarli\Front\Controller; | ||
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. | ||
15 | * | ||
16 | * @package front\controllers | ||
17 | */ | ||
18 | class OpenSearchController extends ShaarliController | ||
19 | { | ||
20 | public function index(Request $request, Response $response): Response | ||
21 | { | ||
22 | $response = $response->withHeader('Content-Type', 'application/opensearchdescription+xml; charset=utf-8'); | ||
23 | |||
24 | $this->assignView('serverurl', index_url($this->container->environment)); | ||
25 | |||
26 | return $response->write($this->render('opensearch')); | ||
27 | } | ||
28 | } | ||