1<?php 2/** 3 * Mikio Syntax Plugin: Accordion Item 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 */ 9 10if (!defined('DOKU_INC')) { die(); 11} 12if (!defined('DOKU_PLUGIN')) { define('DOKU_PLUGIN', DOKU_INC.'lib/plugins/'); 13} 14require_once dirname(__FILE__).'/core.php'; 15 16class syntax_plugin_mikioplugin_accordionitem extends syntax_plugin_mikioplugin_core 17{ 18 public $tag = 'accordion-item'; 19 public $hasEndTag = true; 20 public $options = array( 21 'title' => array('type' => 'text', 'default' => ''), 22 'show' => array('type' => 'boolean', 'default' => 'false'), 23 ); 24 25 public function __construct() 26 { 27 $this->addCommonOptions('type text-align'); 28 } 29 30 public function getAllowedTypes() 31 { 32 return array('container', 'formatting', 'substition', 'disabled', 'paragraphs', 'protected'); 33 } 34 35 public function render_lexer_enter(Doku_Renderer $renderer, $data) 36 { 37 $classes = $this->buildClass($data, array('show')); 38 39 $renderer->doc .= '<div class="' . $this->elemClass . ' ' . $this->classPrefix . 'accordian-item' . $classes . '"><a href="#" class="' . $this->elemClass . ' ' . $this->classPrefix . 'accordian-title">' . $data['title'] . '</a><div class="' . $this->elemClass . ' ' . $this->classPrefix . 'accordian-body">'; 40 } 41 42 43 public function render_lexer_exit(Doku_Renderer $renderer, $data) 44 { 45 $renderer->doc .= '</div></div>'; 46 } 47} 48?>