mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
b6b753ee4c
Without this fix, the & was then passed to urlencode(), which escaped the ; and make invalid XML. This keeps XML out of the source URL (so the & is just a raw & in the code) and relies on the template engine to escape XML as needed (the .XML on the end of the variables).
39 lines
984 B
PHP
39 lines
984 B
PHP
<?php
|
|
|
|
/**
|
|
* Public facing controller for handling an opensearch interface based on
|
|
* the standard search form.
|
|
*
|
|
* @package docsviewer
|
|
*/
|
|
|
|
class DocumentationOpenSearchController extends Controller {
|
|
|
|
private static $allowed_actions = array(
|
|
'description'
|
|
);
|
|
|
|
public function index() {
|
|
return $this->httpError(404);
|
|
}
|
|
|
|
public function description() {
|
|
$viewer = new DocumentationViewer();
|
|
|
|
if(!$viewer->canView()) return Security::permissionFailure($this);
|
|
if(!DocumentationSearch::enabled()) return $this->httpError('404');
|
|
|
|
$data = DocumentationSearch::get_meta_data();
|
|
$link = Director::absoluteBaseUrl() .
|
|
$data['SearchPageLink'] = Controller::join_links(
|
|
$viewer->Link(),
|
|
'results/?Search={searchTerms}&start={startIndex}&length={count}&action_results=1'
|
|
);
|
|
|
|
$data['SearchPageAtom'] = $data['SearchPageLink'] . '&format=atom';
|
|
|
|
return $this->customise(
|
|
new ArrayData($data)
|
|
)->renderWith(array('OpenSearchDescription'));
|
|
}
|
|
} |