-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmarkdown-master_callback.php
More file actions
58 lines (44 loc) · 2.53 KB
/
markdown-master_callback.php
File metadata and controls
58 lines (44 loc) · 2.53 KB
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
<?php
!defined('EMLOG_ROOT') && exit('access deined!');
function callback_init() {
// 将后台页面的 DCOTYPE 更改成 HTML5 标准,适应 MarkDown 编辑器
$file_path = EMLOG_ROOT.'/admin/views/header.php';
$file_1 = fopen($file_path, 'r+');
$file_content = fread($file_1, filesize($file_path));
$file_content = str_replace(' PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"', '', $file_content);
fclose($file_1);
$file_2 = fopen($file_path, 'w+');
fwrite($file_2, $file_content);
fclose($file_2);
// 消除 js 错误
$files_path = array(EMLOG_ROOT.'/admin/views/add_log.php', EMLOG_ROOT.'/admin/views/edit_log.php');
foreach ($files_path as $file_path) {
$file_1 = fopen($file_path, 'r+');
$file_content = fread($file_1, filesize($file_path));
$file_content = str_replace('<div>文章摘要:</div>', '<div>文章摘要:<b>由于编辑器与系统 jQuery 版本冲突,无法显示。</b></div>', $file_content);
$file_content = str_replace('$("#advset").css(\'display\', $.cookie(\'em_advset\') ? $.cookie(\'em_advset\') : \'\');', '//$("#advset").css(\'display\', $.cookie(\'em_advset\') ? $.cookie(\'em_advset\') : \'\');', $file_content);
fclose($file_1);
$file_2 = fopen($file_path, 'w+');
fwrite($file_2, $file_content);
fclose($file_2);
}
// 更改上传插入页面代码,采用新方式插入
rename(EMLOG_ROOT.'/admin/views/attlib.php', EMLOG_ROOT.'/admin/views/attlib_old.php');
copy(EMLOG_ROOT.'/content/plugins/markdown-master/attlib.php', EMLOG_ROOT.'/admin/views/attlib.php');
}
function callback_rm() {
// 文件复原 》》 消除 js 错误
$files_path = array(EMLOG_ROOT.'/admin/views/add_log.php', EMLOG_ROOT.'/admin/views/edit_log.php');
foreach ($files_path as $file_path) {
$file_1 = fopen($file_path, 'r+');
$file_content = fread($file_1, filesize($file_path));
$file_content = str_replace('<div>文章摘要:<b>由于编辑器与系统 jQuery 版本冲突,无法显示。</b></div>', '<div>文章摘要:</div>', $file_content);
$file_content = str_replace('//$("#advset").css(\'display\', $.cookie(\'em_advset\') ? $.cookie(\'em_advset\') : \'\');', '$("#advset").css(\'display\', $.cookie(\'em_advset\') ? $.cookie(\'em_advset\') : \'\');', $file_content);
fclose($file_1);
$file_2 = fopen($file_path, 'w+');
fwrite($file_2, $file_content);
fclose($file_2);
}
// 文件复原 》》 更改上传插入页面代码,采用新方式插入
rename(EMLOG_ROOT.'/admin/views/attlib_old.php', EMLOG_ROOT.'/admin/views/attlib.php');
}