1<?php
2/*
3 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
4 * @author     Ikuo Obataya (i.obataya[at]gmail.com)
5 */
6if(!defined('DOKU_INC')) die();
7if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
8@require_once(DOKU_PLUGIN.'syntax.php');
9/**
10 * Tab plugin
11 */
12class syntax_plugin_tabinclude_embed extends DokuWiki_Syntax_Plugin{
13  function __construct(){
14      $this->helper = plugin_load('helper','tabinclude');
15  }
16  function getType(){ return 'substition'; }
17  function getSort(){ return 158; }
18  function connectTo($mode){$this->Lexer->addSpecialPattern('\{\{tabembed.+?[^}]*\}\}',$mode,'plugin_tabinclude_embed');}
19 /**
20  * handle syntax
21  */
22  function handle($match, $state, $pos, Doku_Handler $handler){
23      $match = substr($match,10,-2); // strip markup
24      return $this->helper->getTabPages($match);
25  }
26 /**
27  * Render tab control
28  */
29  function render($mode, Doku_Renderer $renderer, $data) {
30      list($state, $tabs,$init_page_idx,$class) = $data;
31      if ($mode=='xhtml'){
32          $this->helper->renderEmbedTabs($renderer,$tabs,$init_page_idx,$class);
33          return true;
34      }else if($mode=='odt'){
35          $this->helper->getOdtHtml($renderer,$tabs);
36          return true;
37      }
38      return false;
39  }
40}
41?>
42