1<?php 2/** 3 * Mikio Syntax Plugin: Carousel Item 4 * 5 * Syntax: <CAROUSEL-ITEM [active] [image=] [title=] [text=]></CAROUSEL-ITEM> 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_carouselitem extends syntax_plugin_mikioplugin_core { 16 public $tag = 'carousel-item'; 17 public $noEndTag = true; 18 public $options = array('active', 'image', 'title', 'text'); 19 20 21 public function render_lexer_special(Doku_Renderer $renderer, $data) { 22 $classes = $this->buildClassString($data, array('active'), ''); 23 24 $renderer->doc .= '<div class="carousel-item' . $classes . '">'; 25 if(array_key_exists('image', $data) && $data['image'] != '') $renderer->doc .= '<img src="' . $this->getMediaFile($data['image']) . '" class="d-block w-100">'; 26 27 if((array_key_exists('title', $data) && $data['title'] != '') || (array_key_exists('title', $data) && $data['title'] != '')) { 28 $renderer->doc .= '<div class="carousel-caption d-none d-md-block">'; 29 if(array_key_exists('title', $data) && $data['title'] != '') $renderer->doc .= '<h5>' . $data['title'] . '</h5>'; 30 if(array_key_exists('text', $data) && $data['text'] != '') $renderer->doc .= '<p>' . $data['text'] . '</p>'; 31 $renderer->doc .= '</div>'; 32 } 33 34 $renderer->doc .= '</div>'; 35 } 36 37} 38?>