X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=opensearch_desc.php;h=0b5697270a7a2be9546b011b0d5922cb44ae95c8;hb=09763c14ed75b97d30d314438c1f4247e50debfc;hp=cb8b1bec9d9088a16576dab22136935bbab07459;hpb=88e01ff9d6783e2175d6af1124169fcfb087db39;p=lhc%2Fweb%2Fwiklou.git diff --git a/opensearch_desc.php b/opensearch_desc.php index cb8b1bec9d..0b5697270a 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,18 +78,23 @@ $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 // general way than overriding the whole search engine... -wfRunHooks( 'OpenSearchUrls', array( &$urls ) ); +Hooks::run( 'OpenSearchUrls', array( &$urls ) ); foreach ( $urls as $attribs ) { print Xml::element( 'Url', $attribs );