1<?php
2/**
3 * Blog Plugin, draft component: marks the current page as draft
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author     Esther Brunner <wikidesign@gmail.com>
7 */
8
9class syntax_plugin_blog_draft extends DokuWiki_Syntax_Plugin {
10
11    function getType() { return 'substition'; }
12    function getSort() { return 99; }
13
14    function connectTo($mode) {
15        $this->Lexer->addSpecialPattern('~~DRAFT~~', $mode, 'plugin_blog_draft');
16    }
17
18    function handle($match, $state, $pos, Doku_Handler $handler) {
19        return true;
20    }
21
22    /**
23     * The only thing this plugin component does is to set the metadata 'type' to 'draft'
24     */
25    function render($mode, Doku_Renderer $renderer, $data) {
26        if ($mode == 'xthml') {
27            return true; // don't output anything
28        } elseif ($mode == 'metadata') {
29            $renderer->meta['type'] = 'draft';
30        }
31    }
32}
33// vim:ts=4:sw=4:et:enc=utf-8:
34