46 if (
$wgRequest->getVal(
'ctype' ) ==
'application/xml' ) {
48 $ctype =
'application/xml';
50 $ctype =
'application/opensearchdescription+xml';
54 $response->header(
"Content-type: $ctype" );
58 $expiryTime = 600; # 10 minutes
59 $response->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', time() + $expiryTime ) .
' GMT' );
60 $response->header(
'Cache-control: max-age=600' );
62 print
'<?xml version="1.0"?>';
63 print Xml::openElement(
'OpenSearchDescription',
65 'xmlns' =>
'http://a9.com/-/spec/opensearch/1.1/',
66 'xmlns:moz' =>
'http://www.mozilla.org/2006/browser/search/' ] );
78 $fullName =
wfMessage(
'opensearch-desc' )->inContentLanguage()->text();
79 print Xml::element(
'ShortName',
null, $fullName );
80 print Xml::element(
'Description',
null, $fullName );
82 $services = MediaWikiServices::getInstance();
86 print Xml::element(
'Image',
90 'type' =>
'image/x-icon'
100 $searchPage = SpecialPage::getTitleFor(
'Search' );
102 'type' =>
'text/html',
104 'template' => $searchPage->getCanonicalURL(
'search={searchTerms}' ) ];
115 'template' => $template,
122 (
new HookRunner( $services->getHookContainer() ) )->onOpenSearchUrls( $urls );
124 foreach ( $urls as $attribs ) {
125 print Xml::element(
'Url', $attribs );
132 print Xml::element(
'moz:SearchForm',
null,
133 $searchPage->getCanonicalURL() );
135 print
'</OpenSearchDescription>';