X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=opensearch_desc.php;h=5e5e35d3334b1be37e63aac184df5ecbd3cd52a0;hp=cb8b1bec9d9088a16576dab22136935bbab07459;hb=dc40debaea2effd46a43c88d0fc925b3550c829b;hpb=99e968b5aa933a33a45216f6355f00780a0cf203 diff --git a/opensearch_desc.php b/opensearch_desc.php index cb8b1bec9d..5e5e35d333 100644 --- a/opensearch_desc.php +++ b/opensearch_desc.php @@ -20,7 +20,7 @@ * @file */ -require_once( __DIR__ . '/includes/WebStart.php' ); +require_once __DIR__ . '/includes/WebStart.php'; if ( $wgRequest->getVal( 'ctype' ) == 'application/xml' ) { // Makes testing tweaks about a billion times easier @@ -78,13 +78,18 @@ $urls[] = array( 'method' => 'get', 'template' => $searchPage->getCanonicalURL( 'search={searchTerms}' ) ); -if ( $wgEnableAPI ) { - // JSON interface for search suggestions. - // Supported in Firefox 2 and later. - $urls[] = array( - 'type' => 'application/x-suggestions+json', - 'method' => 'get', - 'template' => SearchEngine::getOpenSearchTemplate() ); +foreach ( $wgOpenSearchTemplates as $type => $template ) { + if ( !$template && $wgEnableAPI ) { + $template = ApiOpenSearch::getOpenSearchTemplate( $type ); + } + + if ( $template ) { + $urls[] = array( + 'type' => $type, + 'method' => 'get', + 'template' => $template, + ); + } } // Allow hooks to override the suggestion URL settings in a more