4 * Generate an OpenSearch description file
7 require_once( dirname(__FILE__
) . '/includes/WebStart.php' );
8 require_once( dirname(__FILE__
) . '/languages/Names.php' );
9 $fullName = "$wgSitename ({$wgLanguageNames[$wgLanguageCode]})";
10 $shortName = htmlspecialchars( mb_substr( $fullName, 0, 24 ) );
11 $siteName = htmlspecialchars( $fullName );
13 if ( !preg_match( '/^https?:/', $wgFavicon ) ) {
14 $favicon = htmlspecialchars( $wgServer . $wgFavicon );
16 $favicon = htmlspecialchars( $wgFavicon );
19 $title = Title
::makeTitle( NS_SPECIAL
, 'Search' );
20 $template = $title->escapeFullURL( 'search={searchTerms}' );
22 $response = $wgRequest->response();
23 $response->header( 'Content-type: application/opensearchdescription+xml' );
25 # Set an Expires header so that squid can cache it for a short time
26 # Short enough so that the sysadmin barely notices when $wgSitename is changed
27 $expiryTime = 300; # 5 minutes
28 $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() +
$expiryTime ) . ' GMT' );
32 <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
33 <ShortName>$shortName</ShortName>
34 <Description>$siteName</Description>
35 <Image height="16" width="16" type="image/x-icon">$favicon</Image>
36 <Url type="text/html" method="get" template="$template"/>
37 </OpenSearchDescription>