123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
- }
- class OpensearchAction extends Action
- {
-
- function handle()
- {
- parent::handle();
- $type = $this->trimmed('type');
- $short_name = '';
- if ($type == 'people') {
- $type = 'peoplesearch';
-
- $short_name = _('People Search');
- } else {
- $type = 'noticesearch';
-
- $short_name = _('Notice Search');
- }
- header('Content-Type: application/opensearchdescription+xml');
- $this->startXML();
- $this->elementStart('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
- $short_name = common_config('site', 'name').' '.$short_name;
- $this->element('ShortName', null, $short_name);
- $this->element('Contact', null, common_config('site', 'email'));
- $this->element('Url', array('type' => 'text/html', 'method' => 'get',
- 'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---')))));
- $this->element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
- $this->element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), Theme::path('logo.png'));
- $this->element('AdultContent', null, 'false');
- $this->element('Language', null, common_language());
- $this->element('OutputEncoding', null, 'UTF-8');
- $this->element('InputEncoding', null, 'UTF-8');
- $this->elementEnd('OpenSearchDescription');
- $this->endXML();
- }
- function isReadOnly($args)
- {
- return true;
- }
- }
|