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

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

function opensearch_init() {
	global $CONFIG;

	register_page_handler('opensearch', 'opensearch_handler');

	elgg_extend_view('metatags', 'opensearch/includes');
}

/**
 * Handles OpenSearch requests
 *
 * @param array $page An array of URL elements
 * @return boolean
 */
function opensearch_handler($page) {
	global $CONFIG;

	switch ($page[0]) {
		case 'osd.xml':
			elgg_set_viewtype('xml');
			page_draw('', elgg_view('opensearch/description'));
			return TRUE;
			break;
	}

}