aboutsummaryrefslogblamecommitdiffhomepage
path: root/application/front/controller/visitor/OpenSearchController.php
blob: 36d60acf12639ba8dbd2d75e5ba74c3af5338c60 (plain) (tree)
1
2
3
4
5
6
7



                        
                                           
 
                                







                                                                    
   
                                                           






                                                                                                                  
                                                                          

     
<?php

declare(strict_types=1);

namespace Shaarli\Front\Controller\Visitor;

use Shaarli\Render\TemplatePage;
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.
 */
class OpenSearchController extends ShaarliVisitorController
{
    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(TemplatePage::OPEN_SEARCH));
    }
}