1<?php 2/** 3 * Mikio Syntax Plugin: Pagenation 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_pagenation extends syntax_plugin_mikioplugin_core { 14 public $tag = 'pagenation'; 15 public $hasEndTag = true; 16 17 public function __construct() { 18 $this->addCommonOptions('shadow'); 19 } 20 21 public function getAllowedTypes() { return array(); } 22 public function getPType() { return 'normal'; } 23 24 public function render_lexer_enter(Doku_Renderer $renderer, $data) { 25 $classes = $this->buildClass($data); 26 27 $renderer->doc .= '<div class="' . $this->elemClass . ' ' . $this->classPrefix . 'pagenation">'; 28 $renderer->doc .= '<ul class="' . $this->elemClass . ' ' . $this->classPrefix . 'pagenation-inner'. $classes . '">'; 29 $renderer->doc .= '<li class="' . $this->elemClass . ' ' . $this->classPrefix . 'pagenation-item ' . $this->classPrefix . 'pagenation-prev"><a href="#">Prev</a></li>'; 30 } 31 32 33 public function render_lexer_exit(Doku_Renderer $renderer, $data) { 34 $renderer->doc .= '<li class="' . $this->elemClass . ' ' . $this->classPrefix . 'pagenation-item ' . $this->classPrefix . 'pagenation-next"><a href="#">Next</a></li>'; 35 $renderer->doc .= '</ul></div>'; 36 } 37 38 public function render_lexer_unmatched(Doku_Renderer $renderer, $data) { 39 $i = 1; 40 41 $itemOptions = array( 42 'url' => array('type' => 'url', 'default' => ''), 43 'active' => array('type' => 'boolean', 'default'=> 'false', 'class' => true), 44 'disabled' => array('type' => 'boolean', 'default'=> 'false', 'class' => true), 45 ); 46 47 $items = $this->findTags($this->tagPrefix . 'pagenation-item', $data, $itemOptions, false); 48 49 foreach($items as $item) { 50 $classes = $this->buildClass($item['options'], null, false, $itemOptions); 51 52 $renderer->doc .= '<li class="' . $this->elemClass . ' ' . $this->classPrefix . 'pagenation-item' . $classes . '"><a href="' . $item['options']['url'] . '">' . $i++ . '</a></li>'; 53 } 54 } 55} 56?> 57