3 * Laconica - a distributed open-source microblogging tool
4 * Copyright (C) 2008, Controlez-Vous, Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 if (!defined('LACONICA')) { exit(1); }
22 class OpensearchAction extends Action {
24 function handle($args) {
26 parent::handle($args);
28 $type = $this->trimmed('type');
31 if ($type == 'people') {
32 $type = 'peoplesearch';
33 $short_name = _('People Search');
35 $short_name = _('Notice Search');
36 $type = 'noticesearch';
39 header('Content-Type: text/html');
42 common_element_start('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
44 $short_name = common_config('site', 'name').' '.$short_name;
45 common_element('ShortName', NULL, $short_name);
46 common_element('Contact', NULL, common_config('site', 'email'));
47 common_element('Url', array('type' => 'text/html', 'method' => 'get',
48 'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---')))));
49 common_element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
50 common_element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), theme_path('logo.png'));
51 common_element('AdultContent', NULL, 'false');
52 common_element('Language', NULL, common_language());
53 common_element('OutputEncoding', NULL, 'UTF-8');
54 common_element('InputEncoding', NULL, 'UTF-8');
56 common_element_end('OpenSearchDescription');