2020-05-20 10:47:20 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-05-22 13:20:31 +02:00
|
|
|
namespace Shaarli\Front\Controller\Visitor;
|
2020-05-20 10:47:20 +02:00
|
|
|
|
2020-07-06 08:04:35 +02:00
|
|
|
use Shaarli\Render\TemplatePage;
|
2020-05-20 10:47:20 +02:00
|
|
|
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.
|
|
|
|
*/
|
2020-05-22 13:20:31 +02:00
|
|
|
class OpenSearchController extends ShaarliVisitorController
|
2020-05-20 10:47:20 +02:00
|
|
|
{
|
|
|
|
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));
|
|
|
|
|
2020-07-06 08:04:35 +02:00
|
|
|
return $response->write($this->render(TemplatePage::OPEN_SEARCH));
|
2020-05-20 10:47:20 +02:00
|
|
|
}
|
|
|
|
}
|