1<?php
2/**
3 * Opera Widget Plugin
4 *
5 * @license    GPLv3 (http://www.gnu.org/licenses/gpl.html)
6 * @link       http://www.dokuwiki.org/plugin:jquery
7 * @author     Markus Birth <markus@birth-online.de>
8 */
9
10if(!defined('DOKU_INC')) die();
11if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
12require_once(DOKU_PLUGIN.'action.php');
13
14class action_plugin_operawidget extends DokuWiki_Action_Plugin {
15
16    function getInfo() {
17        return confToHash(dirname(__FILE__).'/INFO.txt');
18    }
19
20    function register(&$controller) {
21        $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, '_addwidget');
22    }
23
24    function _addwidget(&$event, $param) {
25        global $conf;
26        $title = $this->getConf('customtitle');;
27        if (empty($title)) $title = $conf['title'];
28        $title = rawurlencode($title);
29        $skin  = rawurlencode($this->getConf('skin'));
30
31        $event->data['link'][] = array(
32            'rel'   => 'alternate',
33            'type'  => 'application/x-opera-widgets',
34            'title' => $conf['title'],
35            'href'  => 'http://widgets.opera.com/widgetize/Feed%20Reader/Advanced/?serve&skin=' . $skin . '&widgetname=' . $title . '&url=' . rawurlencode(DOKU_BASE.'feed.php'),
36        );
37    }
38
39}