* @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 {
'height' => 16,
'width' => 16,
'type' => 'image/x-icon' ),
- wfExpandUrl( $wgFavicon , PROTO_CURRENT ) );
+ wfExpandUrl( $wgFavicon, PROTO_CURRENT ) );
$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 );
}