1<?php
2
3
4use ComboStrap\PluginUtility;
5
6require_once(__DIR__ . '/../vendor/autoload.php');
7
8/**
9 * Class syntax_plugin_combo_analytics
10 * This class was just created to add the syntax analytics
11 * to the metadata.
12 */
13class syntax_plugin_combo_analytics extends DokuWiki_Syntax_Plugin
14{
15
16    const TAG = "analytics";
17    public const CONF_SYNTAX_ANALYTICS_ENABLE = "syntaxAnalyticsEnable";
18
19    /**
20     * Syntax Type.
21     * @see DokuWiki_Syntax_Plugin::getType()
22     */
23    function getType()
24    {
25        return 'formatting';
26    }
27
28    /**
29     * How Dokuwiki will add P element
30     *
31     *  * 'normal' - Inline
32     *  * 'block' - Block (p are not created inside)
33     *  * 'stack' - Block (p can be created inside)
34     *
35     * @see DokuWiki_Syntax_Plugin::getPType()
36     */
37    function getPType()
38    {
39        return 'normal';
40    }
41
42    /**
43     * @return array
44     * Allow which kind of plugin inside
45     *
46     * array('container', 'baseonly', 'formatting', 'substition', 'protected', 'disabled', 'paragraphs')
47     *
48     */
49    function getAllowedTypes()
50    {
51        return array();
52    }
53
54    function getSort()
55    {
56        return 201;
57    }
58
59
60    /**
61     * Create a pattern that will called this plugin
62     *
63     * @param string $mode
64     * @see Doku_Parser_Mode::connectTo()
65     */
66    function connectTo($mode)
67    {
68        /**
69         * The instruction `calls` are not created via syntax
70         * but dynamically in the Outline {@link \ComboStrap\Outline::buildOutline()}
71         */
72
73    }
74
75    function postConnect()
76    {
77
78        /**
79         * The instruction `calls` are not created via syntax
80         * but dynamically in the Outline {@link \ComboStrap\Outline::buildOutline()}
81         */
82
83    }
84
85    function handle($match, $state, $pos, Doku_Handler $handler)
86    {
87
88        /**
89         * The instruction `calls` are not created via syntax
90         * but dynamically via {@link action_plugin_combo_syntaxanalyticsTest}
91         */
92
93    }
94
95    /**
96     * Render the output
97     * @param string $format
98     * @param Doku_Renderer $renderer
99     * @param array $data - what the function handle() return'ed
100     * @return boolean - rendered correctly? (however, returned value is not used at the moment)
101     * @see DokuWiki_Syntax_Plugin::render()
102     *
103     *
104     */
105    function render($format, Doku_Renderer $renderer, $data)
106    {
107
108        if ($format == renderer_plugin_combo_analytics::RENDERER_FORMAT) {
109
110            /** @var renderer_plugin_combo_analytics $renderer */
111            $state = $data[PluginUtility::STATE];
112            if ($state == DOKU_LEXER_SPECIAL) {
113                $attributes = $data[PluginUtility::ATTRIBUTES];
114                $renderer->stats[renderer_plugin_combo_analytics::SYNTAX_COUNT] = $attributes;
115                return true;
116            }
117
118        }
119
120        return false;
121    }
122
123
124}
125
126