1<?php 2/** 3 * Mikio Syntax Plugin: Alert 4 * 5 * Syntax: <ALERT [primary|secondary|success|danger|warning|info|light|dark] [dismissible]></ALERT> 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_alert extends syntax_plugin_mikioplugin_core { 16 public $tag = 'alert'; 17 public $defaults = array('type' => 'primary'); 18 public $options = array( 19 'type' => array('primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark'), 20 'dismissible' 21 ); 22 23 24 public function render_lexer_enter(Doku_Renderer $renderer, $data) { 25 $classes = $this->buildClassString($data, array('type', 'dismissible'), 'alert-'); 26 27 $renderer->doc .= '<div class="alert ' . $classes . '" role="alert">'; 28 29 if(isset($data['dismissible']) && $data['dismissible'] == true) { 30 $renderer->doc .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'; 31 } 32 } 33 34 35 public function render_lexer_exit(Doku_Renderer $renderer, $data) { 36 $renderer->doc .= '</div>'; 37 } 38} 39?>