1<?php
2/**
3  * Helper Class for the csstimeline plugin
4  */
5
6// must be run within Dokuwiki
7if(!defined('DOKU_INC')) die();
8
9class helper_plugin_csstimeline extends DokuWiki_Plugin {
10
11    public $specialPattern = '<csstimeline>.*?</csstimeline>';
12
13    public function handleMatch($match)
14    {
15        $match = substr($match, 13, -14);
16        $lines = explode("\n",$match);
17        $data = array();
18        $cnt = 0;
19        $data['entries'] = array();
20        foreach($lines as $line)
21        {
22            $line = trim($line);
23            if($line)
24            {
25                $lineSplit = explode(':', $line, 2);
26                switch(trim($lineSplit[0]))
27                {
28                    case '<entry>':
29                        break;
30                    case '</entry>':
31                        $cnt++;
32                        break;
33                    case 'description':
34                        $data['entries'][$cnt]['description'] = $this->render_text(trim($lineSplit[1]));
35                        break;
36                    default:
37                        $data['entries'][$cnt][$lineSplit[0]] = hsc(trim($lineSplit[1]));
38
39
40                }
41            }
42        }
43        return $data;
44    }
45
46}
47