mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 19:28:41 +00:00
feat(web/user_info/motto): markdown support
This commit is contained in:
parent
8579e31c19
commit
60ba1a5829
@ -107,7 +107,7 @@
|
|||||||
<label for="input-motto" class="col-sm-2 control-label"><?= UOJLocale::get('motto') ?></label>
|
<label for="input-motto" class="col-sm-2 control-label"><?= UOJLocale::get('motto') ?></label>
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
<textarea class="form-control" id="input-motto" name="motto"><?=HTML::escape($myUser['motto'])?></textarea>
|
<textarea class="form-control" id="input-motto" name="motto"><?=HTML::escape($myUser['motto'])?></textarea>
|
||||||
<span class="help-block" id="help-motto"></span>
|
<span class="help-block" id="help-motto">格言支持 Markdown 语法。</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="list-group-item">
|
<div class="list-group-item">
|
||||||
<h4 class="list-group-item-heading"><?= UOJLocale::get('motto') ?></h4>
|
<h4 class="list-group-item-heading"><?= UOJLocale::get('motto') ?></h4>
|
||||||
<div class="list-group-item-text"><?= HTML::purifier_inline()->purify($user['motto']) ?></div>
|
<div class="list-group-item-text"><?= HTML::purifier_inline()->purify(HTML::parsedown()->line($user['motto'])) ?></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if (isSuperUser($myUser)): ?>
|
<?php if (isSuperUser($myUser)): ?>
|
||||||
|
@ -1357,9 +1357,10 @@ function echoRanklist($config = array()) {
|
|||||||
$header_row .= '<th style="width: 5em;">'.UOJLocale::get('solved').'</th>';
|
$header_row .= '<th style="width: 5em;">'.UOJLocale::get('solved').'</th>';
|
||||||
$header_row .= '</tr>';
|
$header_row .= '</tr>';
|
||||||
|
|
||||||
|
$parsedown = HTML::parsedown();
|
||||||
$purifier = HTML::purifier_inline();
|
$purifier = HTML::purifier_inline();
|
||||||
$users = array();
|
$users = array();
|
||||||
$print_row = function($user, $now_cnt) use (&$users, $config, $purifier) {
|
$print_row = function($user, $now_cnt) use (&$users, $config, $purifier, $parsedown) {
|
||||||
if (!$users) {
|
if (!$users) {
|
||||||
if ($now_cnt == 1) {
|
if ($now_cnt == 1) {
|
||||||
$rank = 1;
|
$rank = 1;
|
||||||
@ -1376,7 +1377,7 @@ function echoRanklist($config = array()) {
|
|||||||
echo '<td>' . $user['rank'] . '</td>';
|
echo '<td>' . $user['rank'] . '</td>';
|
||||||
echo '<td>' . getUserLink($user['username']) . '</td>';
|
echo '<td>' . getUserLink($user['username']) . '</td>';
|
||||||
echo "<td>";
|
echo "<td>";
|
||||||
echo $purifier->purify($user['motto']);
|
echo $purifier->purify($parsedown->line($user['motto']));
|
||||||
echo "</td>";
|
echo "</td>";
|
||||||
echo '<td>' . $user['ac_num'] . '</td>';
|
echo '<td>' . $user['ac_num'] . '</td>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
|
@ -191,4 +191,13 @@ class HTML {
|
|||||||
|
|
||||||
return new HTMLPurifier($config);
|
return new HTMLPurifier($config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function parsedown() {
|
||||||
|
return new ParsedownMath([
|
||||||
|
'math' => [
|
||||||
|
'enabled' => true,
|
||||||
|
'matchSingleDollar' => true
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,12 +102,7 @@ class UOJBlogEditor {
|
|||||||
$this->post_data['is_hidden'] = isset($_POST["{$this->name}_is_hidden"]) ? 1 : 0;
|
$this->post_data['is_hidden'] = isset($_POST["{$this->name}_is_hidden"]) ? 1 : 0;
|
||||||
|
|
||||||
$purifier = HTML::purifier();
|
$purifier = HTML::purifier();
|
||||||
$parsedown = new ParsedownMath([
|
$parsedown = HTML::parsedown();
|
||||||
'math' => [
|
|
||||||
'enabled' => true,
|
|
||||||
'matchSingleDollar' => true
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->post_data['title'] = HTML::escape($this->post_data['title']);
|
$this->post_data['title'] = HTML::escape($this->post_data['title']);
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ function fTime($time, $gran = -1) {
|
|||||||
</span>
|
</span>
|
||||||
</h3>
|
</h3>
|
||||||
<div class="card-text">
|
<div class="card-text">
|
||||||
<?= HTML::purifier_inline()->purify($user['motto']) ?>
|
<?= HTML::purifier_inline()->purify(HTML::parsedown()->line($user['motto'])) ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ul class="list-group list-group-flush">
|
<ul class="list-group list-group-flush">
|
||||||
|
Loading…
Reference in New Issue
Block a user