1<?php
2
3use dokuwiki\Debug\PropertyDeprecationHelper;
4use dokuwiki\Parsing\Parser;
5
6/**
7 * Define various types of modes used by the parser - they are used to
8 * populate the list of modes another mode accepts
9 */
10global $PARSER_MODES;
11$PARSER_MODES = [
12    // containers are complex modes that can contain many other modes
13    // hr breaks the principle but they shouldn't be used in tables / lists
14    // so they are put here
15    'container' => ['listblock', 'table', 'quote', 'hr'],
16    // some mode are allowed inside the base mode only
17    'baseonly' => ['header'],
18    // modes for styling text -- footnote behaves similar to styling
19    'formatting' => [
20        'strong', 'emphasis', 'underline', 'monospace', 'subscript', 'superscript', 'deleted', 'footnote'
21    ],
22    // modes where the token is simply replaced - they can not contain any
23    // other modes
24    'substition' => [
25        'acronym', 'smiley', 'wordblock', 'entity', 'camelcaselink', 'internallink', 'media', 'externallink',
26        'linebreak', 'emaillink', 'windowssharelink', 'filelink', 'notoc', 'nocache', 'multiplyentity', 'quotes', 'rss'
27    ],
28    // modes which have a start and end token but inside which
29    // no other modes should be applied
30    'protected' => ['preformatted', 'code', 'file'],
31    // inside this mode no wiki markup should be applied but lineendings
32    // and whitespace isn't preserved
33    'disabled' => ['unformatted'],
34    // used to mark paragraph boundaries
35    'paragraphs' => ['eol'],
36];
37
38/**
39 * Class Doku_Parser
40 *
41 * @deprecated 2018-05-04
42 */
43class Doku_Parser extends Parser
44{
45    use PropertyDeprecationHelper {
46        __set as protected deprecationHelperMagicSet;
47        __get as protected deprecationHelperMagicGet;
48    }
49
50    /** @inheritdoc */
51    public function __construct(Doku_Handler $handler = null)
52    {
53        dbg_deprecated(Parser::class);
54        $this->deprecatePublicProperty('modes', self::class);
55        $this->deprecatePublicProperty('connected', self::class);
56
57        if (!$handler instanceof \Doku_Handler) {
58            $handler = new Doku_Handler();
59        }
60
61        parent::__construct($handler);
62    }
63
64    public function __set($name, $value)
65    {
66
67        if ($name === 'Handler') {
68            $this->handler = $value;
69            return;
70        }
71
72        if ($name === 'Lexer') {
73            $this->lexer = $value;
74            return;
75        }
76
77        $this->deprecationHelperMagicSet($name, $value);
78    }
79
80    public function __get($name)
81    {
82        if ($name === 'Handler') {
83            return $this->handler;
84        }
85
86        if ($name === 'Lexer') {
87            return $this->lexer;
88        }
89
90        return $this->deprecationHelperMagicGet($name);
91    }
92}
93