-echo <<<EOT
-<?xml version="1.0"?>
-<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
-<ShortName>$shortName</ShortName>
-<Description>$siteName</Description>
-<Image height="16" width="16" type="image/x-icon">$favicon</Image>
-<Url type="text/html" method="get" template="$template"/>
-<Url type="application/x-suggestions+json" method="GET" template="$suggest"/>
-</OpenSearchDescription>
-EOT;
+// General search template. Given an input term, this should bring up
+// search results or a specific found page.
+// At least Firefox and IE 7 support this.
+$searchPage = SpecialPage::getTitleFor( 'Search' );
+$urls[] = array(
+ 'type' => 'text/html',
+ '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() );
+}
+
+// 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 ) {
+ print Xml::element( 'Url', $attribs );
+}