-
Notifications
You must be signed in to change notification settings - Fork 0
/
render.php
42 lines (41 loc) · 1.27 KB
/
render.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
<?php
// require 'test.lib.php';
require 'vendor/autoload.php';
use \TangHoong\ChatBlock\ChatBlock as ChatUI;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Preview</title>
<meta name="description" content="">
</head>
<body>
<?php
// Sources
$rawscript = @$_POST['rawscript'];
$rawscript = nl2br($rawscript);
$breaks = array("<br />","<br>","<br/>");
// $rawscript = str_ireplace($breaks, "\r\n", $rawscript); // Linux
$rawscript = str_ireplace($breaks, "\r", $rawscript); // Window
// $rawscript = file_get_contents('./sample/test.raw.txt'); // OK
// var_dump($rawscript);
// print_r($rawscript);
$cui = new ChatUI([
'allowForkScript' => 'https://editor.chatnovel.app/', // default:null
// 'allowForkScript' => 'editor.php', // default:null
'chatHeaderSize' => 'large' // default:normal,small,large
]);
$cui->setColon([':']);
$cui->setNarrator(['Narrator','narrator','系统','旁白']);
// $cui->setBreakPoint('_I_LOVE_EMANYAN_');
echo sprintf('<style>%s</style>', $cui->renderCss());
$cui->feed($rawscript);
echo $cui->showWarnings();
// echo $cui->showCasts(); // For header introduction, header button
echo $cui->render();
?>
</body>
</html>