-
Notifications
You must be signed in to change notification settings - Fork 49
/
renderer.php
141 lines (122 loc) · 3.66 KB
/
renderer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
/**
* Renderer for XHTML output
*
* @author Pierre Spring <pierre.spring@liip.ch>
* @author Myron Turner <turnermm02@shaw.ca>
*/
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
// we inherit from the XHTML renderer instead directly of the base renderer
require_once DOKU_INC.'inc/parser/xhtml.php';
/**
* The Renderer
*/
class renderer_plugin_ckgedit extends Doku_Renderer_xhtml
{
var $ver_anteater;
var $dwiki_version;
/**
* Establish version in constructor
* @author Myron Turner <turnermm02@shaw.ca>
*/
function __construct() {
global $conf;
$this->ver_anteater = mktime(0,0,0,11,7,2010);
$this->dwiki_version=mktime(0,0,0,01,01,2008);
if(isset($conf['fnencode'])) {
$this->ver_anteater = mktime(0,0,0,11,7,2010);
$this->dwiki_version=mktime(0,0,0,11,7,2010);
}
else if(function_exists('getVersionData')) {
$verdata= getVersionData();
if(isset($verdata) && preg_match('/(\d+)-(\d+)-(\d+)/',$verdata['date'],$ver_date)) {
if($ver_date[1] >= 2005 && ($ver_date[3] > 0 && $ver_date[3] < 31) && ($ver_date[2] > 0 && $ver_date[2] <= 12)) {
// month day year
$this->dwiki_version=@mktime(0, 0, 0, $ver_date[2],$ver_date[3], $ver_date[1]);
if(!$this->dwiki_version) $this->dwiki_version = mktime(0,0,0,01,01,2008);
$this->ver_anteater = mktime(0,0,0,11,7,2010);
}
}
}
}
/**
* the format we produce
*/
function getFormat()
{
// this should be 'ckgedit' usally, but we inherit from the xhtml renderer
// and produce XHTML as well, so we can gain magically compatibility
// by saying we're the 'xhtml' renderer here.
return 'xhtml';
}
/*
* The standard xhtml renderer adds anchors we do not need.
*/
function header($text, $level, $pos, $returnonly = false) {
// write the header
$this->doc .= DOKU_LF.'<h'.$level.'>';
$this->doc .= $this->_xmlEntities($text);
$this->doc .= "</h$level>".DOKU_LF;
}
/*
* The FCKEditor prefers <b> over <strong>
*/
function strong_open()
{
$this->doc .= '<b>';
}
function strong_close()
{
$this->doc .= '</b>';
}
/*
* The FCKEditor prefers <strike> over <del>
*/
function deleted_open()
{
$this->doc .= '<strike>';
}
function deleted_close()
{
$this->doc .= '</strike>';
}
/**
* isolate table from bottom and top editor window margins
* @author Myron Turner <turnermm02@shaw.ca>
*/
function table_close($pos = NULL)
{
global $conf;
$this->doc .= "</table>\n<span class='np_break'> </span>\n";
if($this->dwiki_version >= $this->ver_anteater) {
$this->doc .= "</div>";
}
}
function table_open($maxcols = null, $numrows = null, $pos = null, $classes = NULL){
$this->doc .= "\n<span class='np_break'> </span>\n";
parent::table_open($maxcols, $numrows, $pos,$classes);
}
/*
* Dokuwiki displays __underlines__ as follows
* <em class="u">underlines</em>
* in the fck editor this conflicts with
* the //italic// style that is displayed as
* <em>italic</em>
* which makes the rathe obvious
*/
function underline_open()
{
$this->doc .= '<u>';
}
function underline_close()
{
$this->doc .= '</u>';
}
function listcontent_open()
{
}
function listcontent_close()
{
}
}