1<?php
2/**
3 * DokuWiki Plugin embeddedphp (Syntax Component)
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  fiwswe <dwplugin@fwml.de>
7 */
8class syntax_plugin_embeddedphp_phpblock extends syntax_plugin_embeddedphp_phpinline
9{
10    /** @inheritDoc */
11    public function GetTag(): string
12    {
13    	return 'PHP';
14    }
15
16    /** @inheritDoc */
17    public function getPType()
18    {
19        return 'block';
20    }
21
22    /** @inheritDoc */
23    public function render($mode, Doku_Renderer $renderer, $data)
24    {
25        if ($mode === 'xhtml') {
26            if (is_array($data) && (count($data) > 1)) {
27                $this->phpblock($data[1], $renderer);
28
29                return true;
30            }
31        }
32
33        return false;
34    }
35
36    /**
37     * Output block level PHP code
38     *
39     * If $conf['phpok'] is true this should evaluate the given code and append the result
40     * to $doc
41     *
42     * @param string $text The PHP code
43     * @param  Doku_Renderer $renderer   Renderer used for output
44     */
45    public function phpblock($text, Doku_Renderer $renderer): void {
46        $this->php($text, $renderer, 'pre');
47    }
48
49    /** @inheritDoc */
50    public function isBlockElement(): bool
51    {
52    	return true;
53    }
54}
55
56