aboutsummaryrefslogtreecommitdiff
path: root/views/xml/opensearch/description.php
blob: 221cb768e99cb7c2a984ee8ea6086a40c2c7134b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
 * Creates an OpenSearch description document from config.ini
 * http://www.opensearch.org/Specifications/OpenSearch/1.1
 */

// reset cache headers because IE8 is stupid
header('Pragma: public', TRUE);
header('Cache-Control: public', TRUE);

$config_ini = dirname(dirname(dirname(dirname(__FILE__)))) . '/config.ini';
$config = parse_ini_file($config_ini);
if ($config == FALSE) {
	elgg_log("Unable to parse OpenSearch config file", 'ERROR');
	return TRUE;
}

extract($config);

$site = get_entity($CONFIG->site_guid);
$email = $site->email;

$rss_url = "{$vars['url']}pg/search/?q={searchTerms}&amp;view=opensearch_rss";
$html_url = "{$vars['url']}pg/search/?q={searchTerms}";

?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
   <ShortName><?php echo $shortname; ?></ShortName>
   <Description><?php echo $description; ?></Description>
<?php if (isset($longname)): ?>
   <LongName><?php echo $longname; ?></LongName>
<?php endif; ?>
   <Contact><?php echo $site->email; ?></Contact>
   <Url type="text/html" template="<?php echo $html_url; ?>"/>
   <Url type="application/rss+xml" template="<?php echo $rss_url; ?>"/>
<?php if (isset($ico)): ?>
   <Image height="16" width="16" type="image/vnd.microsoft.icon"><?php echo "{$vars['url']}$ico"; ?></Image>
<?php endif; ?>
<?php if (isset($png)): ?>
   <Image height="64" width="64" type="image/png"><?php echo "{$vars['url']}$png"; ?></Image>
<?php endif; ?>
<?php if (isset($tags)): ?>
   <Tags><?php echo $tags; ?></Tags>
<?php endif; ?>
<?php if (isset($query)): ?>
   <Query role="example" searchTerms="<?php echo $query; ?>" />
<?php endif; ?>
<?php
if (isset($lang)):
	foreach ($lang as $language):
?>
   <Language><?php echo $language; ?></Language>
<?php
	endforeach;
endif;
?>
   <SyndicationRight>open</SyndicationRight>
   <AdultContent>false</AdultContent>
   <OutputEncoding>UTF-8</OutputEncoding>
   <InputEncoding>UTF-8</InputEncoding>
 </OpenSearchDescription>