aboutsummaryrefslogtreecommitdiff
path: root/start.php
blob: 88329c8d1b13da2599d702d8d8ad02ca3f8efc8c (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
<?php
/**
 * OpenSearch plugin
 *
 * http://www.opensearch.org/Home
 *
 * @author Cash Costello
 * @license http://opensource.org/licenses/gpl-2.0.php GPL 2
 */

elgg_register_event_handler('init', 'system', 'opensearch_init');

function opensearch_init() {
	elgg_register_page_handler('opensearch', 'opensearch_handler');
	elgg_extend_view('page/elements/head', 'opensearch/includes');
}

/**
 * Handles OpenSearch requests
 *
 * @param array $page An array of URL elements
 * @return bool
 */
function opensearch_handler($page) {
	switch ($page[0]) {
		case 'osd.xml':
			elgg_set_viewtype('xml');
			echo elgg_view_page('', elgg_view('opensearch/description'));
			return true;
			break;
	}
	return false;
}