forked from GamemakerChina/gmchina_xiuno_editormd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetting.htm
311 lines (283 loc) · 14.9 KB
/
setting.htm
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>
<div class="row">
<div class="col-lg-10 mx-auto">
<div class="card">
<div class="card-body">
<form action="<?php echo url('plugin-setting-gmchina_xiuno_editormd');?>" method="post" id="form">
<p style="text-align:center;">Editor.md 设置</p>
<hr class="mb-4" />
<?php if($editor_md_config['edit_info']==0){?>
<p>
如果您第一次使用编辑器,请修改当前主题以使用本编辑器。
请找到当前主题的<code>post.htm</code>文件,如奇梦主题:青绿色调模版位于<code>qimeng_theme_green\overwrite\view\htm</code>下。
在当前主题下在 id 和 name 为 message 的代码中加入两段 Hook 于 textarea 标签的上下两行:
<pre>
<code><!--{hook post_editor_before.htm}--><br><!--{hook post_editor_after.htm}--></code>
</pre>
范例:
<pre>
<code><div class="form-group"><br><!--{hook post_editor_before.htm}--><br><textarea class="form-control" placeholder="<?php echo lang('message');?>" name="message" id="message"><?php echo $form_message;?></textarea><br><!--{hook post_editor_after.htm}--><br></div></code>
</pre>
<br />
如果您当前使用的主题已经兼容了本编辑器,可以忽略这个提示。
<br />
注意!!!:从本插件 1.2 版本开始,输出修改为 message (即用户输入的原始数据),这样会解决大量渲染问题,同时也兼容了 HTML,尽管 XSS 问题已经由 HTML Purifler 和 JS-XSS 过滤后基本消失,但依然请谨慎使用。
</p>
<?php }?>
<div class="form-group row">
<label class="col-sm-3 form-control-label">修改代码提示:</label>
<div class="col-sm-9">
<?php echo $edit_info; ?>
</div>
</div>
<p style="text-align:center;">版本信息</p>
<hr class="mb-4" />
<p>Editor.md 版本:2.0.1 (<a href="https://github.com/hawtim/editor.md" target="_blank">hawtim ver.</a>)</p>
<p>XiunoPHP 版本:4.0</p>
<p>HTML Purifler 版本:4.10.0</p>
<p>JS-XSS 版本:1.0.3</p>
<p>PHP 版本:<?php echo PHP_VERSION; ?></p>
<p>注意:当 PHP 大版本为 5.2 时插件功能会受到限制</p>
<p style="text-align:center;">一般设置</p>
<hr class="mb-4" />
<div class="form-group row">
<label class="col-sm-3 form-control-label">Parsedown 版本:</label>
<div class="col-sm-9">
<?php echo $parsedown_version; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">宽度:</label>
<div class="col-sm-9">
<?php echo $width; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">高度:</label>
<div class="col-sm-9">
<?php echo $height; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">同步滚动:</label>
<div class="col-sm-9">
<?php echo $sync_scrolling; ?>
</div>
</div>
<p style="text-align:center;">本地图片上传设置</p>
<hr class="mb-4" />
<div class="form-group row">
<label class="col-sm-3 form-control-label">图片上传:</label>
<div class="col-sm-9">
<?php echo $img_upload; ?>
</div>
</div>
<?php if($editor_md_config['img_upload']=='true'){?>
<div class="form-group row">
<label class="col-sm-3 form-control-label">支持的图片格式:</label>
<div class="col-sm-9">
<?php echo $img_upload_formats; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">图片上传服务:</label>
<div class="col-sm-9">
<?php echo $img_upload_service; ?>
</div>
</div>
<?php if($editor_md_config['img_upload_service']=='qiniu'){?>
<div class="form-group row">
<label class="col-sm-3 form-control-label">七牛云 Bucket:</label>
<div class="col-sm-9">
<?php echo $qiniu_bucket; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">七牛云 AccessKey:</label>
<div class="col-sm-9">
<?php echo $qiniu_accessKey; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">七牛云 SecretKey:</label>
<div class="col-sm-9">
<?php echo $qiniu_secretKey; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">七牛云图片样式:</label>
<div class="col-sm-9">
<?php echo $qiniu_class_type; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">七牛云 CDN 地址:</label>
<div class="col-sm-9">
<?php echo $qiniu_cdnurl; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">七牛云 MimeType:</label>
<div class="col-sm-9">
<?php echo $qiniu_mimetype; ?>
</div>
</div>
<?php }?>
<div class="form-group row">
<label class="col-sm-3 form-control-label">图片跨域上传:</label>
<div class="col-sm-9">
<?php echo $cross_domain_upload; ?>
</div>
</div>
<?php if($editor_md_config['cross_domain_upload']=='true'){?>
<div class="form-group row">
<label class="col-sm-3 form-control-label">图片跨域上传 Callback URL:</label>
<div class="col-sm-9">
<?php echo $upload_callback_url; ?>
</div>
</div>
<?php }?>
<?php }?>
<p style="text-align:center;">HTML 解析设置</p>
<hr class="mb-4" />
<div class="form-group row">
<label class="col-sm-3 form-control-label">HTML 解析:</label>
<div class="col-sm-9">
<?php echo $html_decode; ?>
</div>
</div>
<?php if($editor_md_config['html_decode']=='true'){?>
<div class="form-group row">
<label class="col-sm-3 form-control-label">需过滤的 HTML 标签:</label>
<div class="col-sm-9">
<?php echo $html_decode_fliter; ?>
</div>
</div>
<?php }?>
<p style="text-align:center;">编辑器功能设置</p>
<hr class="mb-4" />
<div class="form-group row">
<label class="col-sm-3 form-control-label">自动高度:</label>
<div class="col-sm-9">
<?php echo $autoheight; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">只读模式:</label>
<div class="col-sm-9">
<?php echo $readonly; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">代码折叠:</label>
<div class="col-sm-9">
<?php echo $codefold; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">任务列表(GFM 功能):</label>
<div class="col-sm-9">
<?php echo $tasklist; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">@ 链接:</label>
<div class="col-sm-9">
<?php echo $atLink; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">Email 链接:</label>
<div class="col-sm-9">
<?php echo $emailLink; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">TeX / LaTeX 科学公式语言:</label>
<div class="col-sm-9">
<?php echo $tex; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">FlowChart 流程图:</label>
<div class="col-sm-9">
<?php echo $flowChart; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">SequenceDiagram 时序图 / 序列图:</label>
<div class="col-sm-9">
<?php echo $sequenceDiagram; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">分页符:</label>
<div class="col-sm-9">
<?php echo $pageBreak; ?>
</div>
</div>
<p style="text-align:center;">编辑器主题设置</p>
<hr class="mb-4" />
<div class="form-group row">
<label class="col-sm-3 form-control-label">主题开关(关闭则为默认主题):</label>
<div class="col-sm-9">
<?php echo $theme_onoff; ?>
</div>
</div>
<?php if($editor_md_config['theme_onoff']=='true'){?>
<div class="form-group row">
<label class="col-sm-3 form-control-label">主题:</label>
<div class="col-sm-9">
<?php echo $theme; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">主题:</label>
<div class="col-sm-9">
<?php echo $theme_editor; ?>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">预览主题:</label>
<div class="col-sm-9">
<?php echo $theme_preview; ?>
</div>
</div>
<?php }?>
<div class="form-group row">
<label class="col-sm-2 form-control-label"></label>
<div class="col-sm-10">
<button type="submit" class="btn btn-primary btn-block" id="submit" data-loading-text="<?php echo lang('submiting');?>...">
<?php echo lang('confirm');?>
</button>
<a role="button" class="btn btn-secondary btn-block mt-3" href="javascript:history.back();">
<?php echo lang('back');?>
</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<?php include _include(ADMIN_PATH.'view/htm/footer.inc.htm');?>
<script>
var jform = $("#form");
var jsubmit = $("#submit");
var referer = '<?php echo url("plugin-setting-gmchina_xiuno_editormd");?>';
jform.on('submit', function () {
jform.reset();
jsubmit.button('loading');
var postdata = jform.serialize();
$.xpost(jform.attr('action'), postdata, function (code, message) {
if (code == 0) {
$.alert(message);
jsubmit.text(message).delay(1000).button('reset').location(referer);
} else {
$.alert('提交失败');
jsubmit.button('reset');
}
});
return false;
});
</script>