Add new variants to the English file.
[lhc/web/wiklou.git] / opensearch_desc.php
index 70e9035..82e74b2 100644 (file)
@@ -6,24 +6,27 @@
 
 require_once( dirname(__FILE__) . '/includes/WebStart.php' );
 require_once( dirname(__FILE__) . '/languages/Names.php' );
-$fullName = "$wgSitename ({$wgLanguageNames[$wgLanguageCode]})";
+$fullName = wfMsgForContent( 'opensearch-desc' );
 $shortName = htmlspecialchars( mb_substr( $fullName, 0, 24 ) );
 $siteName = htmlspecialchars( $fullName );
 
-if ( !preg_match( '/^https?:/', $wgFavicon ) ) {
-       $favicon = htmlspecialchars( $wgServer . $wgFavicon );
-} else {
-       $favicon = htmlspecialchars( $wgFavicon );
-}
+
+$favicon = htmlspecialchars( wfExpandUrl( $wgFavicon ) );
 
 $title = SpecialPage::getTitleFor( 'Search' );
 $template = $title->escapeFullURL( 'search={searchTerms}' );
 
-$suggest = htmlspecialchars($wgServer . $wgScriptPath . '/api.php?action=opensearch&search={searchTerms}');
+$suggest = htmlspecialchars(SearchEngine::getOpenSearchTemplate() );
 
 
 $response = $wgRequest->response();
-$response->header( 'Content-type: application/opensearchdescription+xml' );
+if( $wgRequest->getVal( 'ctype' ) == 'application/xml' ) {
+       // Makes testing tweaks about a billion times easier
+       $ctype = 'application/xml';
+} else {
+       $ctype = 'application/opensearchdescription+xml';
+}
+$response->header( "Content-type: $ctype" );
 
 # Set an Expires header so that squid can cache it for a short time
 # Short enough so that the sysadmin barely notices when $wgSitename is changed