1<?php 2/** 3 * Mikio Syntax Plugin: Progress Bar 4 * 5 * Syntax: <PROGRESSBAR [width=] [height=] [striped] [animated] [text=]> 6 * 7 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 8 * @author James Collins <james.collins@outlook.com.au> 9 */ 10 11if (!defined('DOKU_INC')) die(); 12if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 13require_once(dirname(__FILE__).'/core.php'); 14 15class syntax_plugin_mikioplugin_progressbar extends syntax_plugin_mikioplugin_core { 16 public $tag = 'progressbar'; 17 public $noEndTag = true; 18 public $options = array( 19 'width', 20 'height', 21 'striped', 22 'animated', 23 'text', 24 'type' => array('primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark') 25 ); 26 //, 'outline-primary', 'outline-secondary', 'outline-success', 'outline-danger', 'outline-warning', 'outline-info', 'outline-light', 'outline-dark'), 27 28 29 public function render_lexer_special(Doku_Renderer $renderer, $data) { 30 $barClasses = $this->buildClassString($data, array('type', 'striped', 'animated'), array('bg-' => 'type', 'progress-bar-' => array('striped', 'animated'))); 31 32 $width = 0; 33 if(array_key_exists('width', $data) && $data['width'] != '') { 34 $width = $data['width']; 35 if(substr($width, -1) == '%') $width = substr($width, 0, -1); 36 } 37 38 $height = ''; 39 if(array_key_exists('height', $data) && $data['height'] != false) { 40 $height = $data['height']; 41 42 } 43 44 $renderer->doc .= '<div class="progress"'. ($height != '' ? ' style="height:' . $height . ';"' : '' ) . '><div class="progress-bar ' . $barClasses . '" role="progressbar" style="width:' . $width . '%" aria-valuenow="' . $width . '" aria-valuemin="0" aria-valuemax="100">' . (array_key_exists('text', $data) && $data['text'] != '' ? $data['text'] : '') . '</div></div>'; 45 } 46} 47?>