X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=opensearch_desc.php;h=5e5e35d3334b1be37e63aac184df5ecbd3cd52a0;hb=aa21e125a34e8ca44e05d5dd96bb28562ec8e347;hp=4e8a1a2eb831b9a708a167247a15c101515aa4f1;hpb=fd03fa28251c84b00c9d623d8b3461add7887904;p=lhc%2Fweb%2Fwiklou.git diff --git a/opensearch_desc.php b/opensearch_desc.php index 4e8a1a2eb8..5e5e35d333 100644 --- a/opensearch_desc.php +++ b/opensearch_desc.php @@ -20,9 +20,9 @@ * @file */ -require_once( __DIR__ . '/includes/WebStart.php' ); +require_once __DIR__ . '/includes/WebStart.php'; -if( $wgRequest->getVal( 'ctype' ) == 'application/xml' ) { +if ( $wgRequest->getVal( 'ctype' ) == 'application/xml' ) { // Makes testing tweaks about a billion times easier $ctype = 'application/xml'; } else { @@ -78,20 +78,25 @@ $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 ) ); -foreach( $urls as $attribs ) { +foreach ( $urls as $attribs ) { print Xml::element( 'Url', $attribs ); }