xref: /plugin/dbquery/renderer.php (revision 2e564e06806b572fcd4150c4267799087a935085)
1*2e564e06SAndreas Gohr<?php
2*2e564e06SAndreas Gohr
3*2e564e06SAndreas Gohr/**
4*2e564e06SAndreas Gohr * DokuWiki Plugin dbquery (Renderer Component)
5*2e564e06SAndreas Gohr *
6*2e564e06SAndreas Gohr * Extracts code blocks from pages
7*2e564e06SAndreas Gohr *
8*2e564e06SAndreas Gohr * @todo this needs to be extended to get all the HTML blocks from sub sections
9*2e564e06SAndreas Gohr * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
10*2e564e06SAndreas Gohr * @author  Andreas Gohr <dokuwiki@cosmocode.de>
11*2e564e06SAndreas Gohr */
12*2e564e06SAndreas Gohrclass renderer_plugin_dbquery extends \Doku_Renderer
13*2e564e06SAndreas Gohr{
14*2e564e06SAndreas Gohr    /** @var bool remember if the first code block has been found already */
15*2e564e06SAndreas Gohr    protected $codeFound = false;
16*2e564e06SAndreas Gohr
17*2e564e06SAndreas Gohr    /** @inheritDoc */
18*2e564e06SAndreas Gohr    public function getFormat()
19*2e564e06SAndreas Gohr    {
20*2e564e06SAndreas Gohr        return 'dbquery';
21*2e564e06SAndreas Gohr    }
22*2e564e06SAndreas Gohr
23*2e564e06SAndreas Gohr    /** @inheritDoc */
24*2e564e06SAndreas Gohr    public function code($text, $lang = null, $file = null)
25*2e564e06SAndreas Gohr    {
26*2e564e06SAndreas Gohr        if ($this->codeFound) return;
27*2e564e06SAndreas Gohr        $this->codeFound = true;
28*2e564e06SAndreas Gohr        $this->doc = $text;
29*2e564e06SAndreas Gohr    }
30*2e564e06SAndreas Gohr
31*2e564e06SAndreas Gohr}
32