1<?php
2
3/**
4 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
5   *
6   * class       plugin_fckg_specials
7   * @author     Myron Turner <turnermm02@shaw.ca>
8*/
9
10// must be run within Dokuwiki
11if(!defined('DOKU_INC')) die();
12
13if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
14require_once(DOKU_PLUGIN.'syntax.php');
15define ('FCKG_IMAGES', DOKU_URL . 'lib/plugins/fckg/images/');
16define ('FCK_IMG_PATH',DOKU_INC . 'lib/plugins/fckg/images/');
17if(!defined('DOKU_LF')) define ('DOKU_LF',"\n");
18if(!defined('DOKU_TAB')) define ('DOKU_TAB',"\t");
19
20/**
21 * All DokuWiki plugins to extend the parser/rendering mechanism
22 * need to inherit from this class
23 */
24class syntax_plugin_fckg_specials extends DokuWiki_Syntax_Plugin {
25
26
27    /**
28     * What kind of syntax are we?
29     */
30    function getType(){
31        return 'substition';
32    }
33
34    /**
35     * What about paragraphs?
36     */
37
38    function getPType(){
39       //  return 'stack';
40       return 'block';
41    }
42
43    /**
44     * Where to sort in?
45     */
46    function getSort(){
47        return 155;
48    }
49
50
51    /**
52     * Connect pattern to lexer
53     */
54    function connectTo($mode) {
55
56          $this->Lexer->addSpecialPattern('~~MULTI_PLUGIN_OPEN~~',$mode,'plugin_fckg_specials');
57          $this->Lexer->addSpecialPattern('~~MULTI_PLUGIN_CLOSE~~',$mode,'plugin_fckg_specials');
58          $this->Lexer->addSpecialPattern('~~COMPLEX_TABLES~~',$mode,'plugin_fckg_specials');
59    }
60
61
62    /**
63     * Handle the match
64     */
65    function handle($match, $state, $pos, Doku_Handler $handler){
66
67        $class = "";
68        $xhtml = "";
69
70        if(preg_match('/OPEN/', $match)) {
71
72           return array($state, "<span class='multi_p_open'></span>" );
73        }
74        elseif(preg_match('/CLOSE/', $match)) {
75              return array($state, "<span class='multi_p_close'></span>" );
76        }
77        elseif(preg_match('/TABLES/', $match)) {
78              return array($state, "" );
79        }
80
81         return array($state, "" );
82
83    }
84
85    /**
86     * Create output
87     */
88    function render($mode, Doku_Renderer $renderer, $data) {
89        if($mode == 'xhtml'){
90            list($state, $xhtml) = $data;
91            $renderer->doc .=  DOKU_LF . $xhtml . DOKU_LF;
92            return true;
93        }
94        return false;
95    }
96
97  function write_debug($what) {
98     $handle = fopen("blog_pats.txt", "a");
99     fwrite($handle,"$what\n");
100     fclose($handle);
101  }
102}
103
104
105