4 * Opensearch action class.
10 * @author Evan Prodromou <evan@status.net>
11 * @author Robin Millette <millette@status.net>
12 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
13 * @link http://status.net/
15 * StatusNet - the distributed open-source microblogging tool
16 * Copyright (C) 2008, 2009, StatusNet, Inc.
18 * This program is free software: you can redistribute it and/or modify
19 * it under the terms of the GNU Affero General Public License as published by
20 * the Free Software Foundation, either version 3 of the License, or
21 * (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU Affero General Public License for more details.
28 * You should have received a copy of the GNU Affero General Public License
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
32 if (!defined('STATUSNET') && !defined('LACONICA')) {
37 * Opensearch action class.
39 * Formatting of RSS handled by Rss10Action
43 * @author Evan Prodromou <evan@status.net>
44 * @author Robin Millette <millette@status.net>
45 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
46 * @link http://status.net/
48 class OpensearchAction extends Action
53 * @param array $args query arguments
55 * @return boolean false if user doesn't exist
57 function handle($args)
59 parent::handle($args);
60 $type = $this->trimmed('type');
62 if ($type == 'people') {
63 $type = 'peoplesearch';
64 $short_name = _('People Search');
66 $type = 'noticesearch';
67 $short_name = _('Notice Search');
69 header('Content-Type: application/opensearchdescription+xml');
71 $this->elementStart('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
72 $short_name = common_config('site', 'name').' '.$short_name;
73 $this->element('ShortName', null, $short_name);
74 $this->element('Contact', null, common_config('site', 'email'));
75 $this->element('Url', array('type' => 'text/html', 'method' => 'get',
76 'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---')))));
77 $this->element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
78 $this->element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), Theme::path('logo.png'));
79 $this->element('AdultContent', null, 'false');
80 $this->element('Language', null, common_language());
81 $this->element('OutputEncoding', null, 'UTF-8');
82 $this->element('InputEncoding', null, 'UTF-8');
83 $this->elementEnd('OpenSearchDescription');
87 function isReadOnly($args)