1<?php
2/**
3 * Mikio Syntax Plugin: Statistic
4 *
5 * @link        http://github.com/nomadjimbob/mikioplugin
6 * @license     GPL 2 (http://www.gnu.org/licenses/gpl.html)
7 * @author      James Collins <james.collins@outlook.com.au>
8 */
9if (!defined('DOKU_INC')) die();
10if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
11require_once(dirname(__FILE__).'/core.php');
12
13class syntax_plugin_mikioplugin_statistic extends syntax_plugin_mikioplugin_core {
14    public $tag                 = 'statistic';
15    public $hasEndTag           = false;
16    public $options             = array(
17        'title'     => array('type'     => 'text',    'default'   => ''),
18        'number'    => array('type'     => 'number',  'default'   => ''),
19        'below'     => array('type'     => 'boolean', 'default'   => 'false')
20    );
21
22    public function __construct() {
23
24    }
25
26
27    public function render_lexer_special(Doku_Renderer $renderer, $data) {
28        $renderer->doc .= '<div class="' . $this->elemClass . ' ' . $this->classPrefix . 'statistic">';
29        if($data['below']) $renderer->doc .= number_format($data['number']);
30        $renderer->doc .= '<div class="' . $this->elemClass . ' ' . $this->classPrefix . 'statistic-title">' . $data['title'] . '</div>';
31        if(!$data['below']) $renderer->doc .= number_format($data['number']);
32        $renderer->doc .= '</div>';
33    }
34}
35?>