| 1 | <?php |
| 2 | |
| 3 | if(!defined('DOKU_INC')) die(); |
| 4 | if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); |
| 5 | require_once DOKU_PLUGIN.'action.php'; |
| 6 | |
| 7 | class action_plugin_svgedit extends DokuWiki_Action_Plugin { |
| 8 | |
| 9 | function getInfo(){ |
| 10 | return array('author' => 'Thomas Mudrunka', |
| 11 | 'email' => 'harvie--email-cz', |
| 12 | 'date' => '2010-02-21', |
| 13 | 'name' => 'SVG-Edit Plugin (do=export_svg handler)', |
| 14 | 'desc' => 'Adds handler to have clean way for exporting SVGs', |
| 15 | 'url' => 'http://www.dokuwiki.org/plugin:svgedit' |
| 16 | ); |
| 17 | } |
| 18 | |
| 19 | function register(&$controller) { |
| 20 | $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, |
| 21 | '_hookdo'); |
| 22 | } |
| 23 | |
| 24 | function _hookdo(&$event, $param) { |
| 25 | global $ID; |
| 26 | if($event->data === 'export_svg' && auth_quickaclcheck($ID) >= AUTH_READ) { |
| 27 | header('Content-type: image/svg+xml'); |
| 28 | die(rawWiki($ID)); |
| 29 | } |
| 30 | } |
| 31 | } |