Skip to content

Commit 6f10ed6

Browse files
committedDec 23, 2022
更新:优化性能和评论主题
1 parent 200443e commit 6f10ed6

File tree

5 files changed

+97
-177
lines changed

5 files changed

+97
-177
lines changed
 

‎app/CodeFec/CodeFec.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
declare(strict_types=1);
44
/**
5-
* This file is part of Hyperf.
6-
* @link https://www.hyperf.io
7-
* @document https://hyperf.wiki
8-
* @contact group@hyperf.io
9-
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
5+
* This file is part of zhuchunshu.
6+
* @link https://github.com/zhuchunshu
7+
* @document https://github.com/zhuchunshu/super-forum
8+
* @contact laravel@88.com
9+
* @license https://github.com/zhuchunshu/super-forum/blob/master/LICENSE
1010
*/
1111
namespace App\CodeFec;
1212

‎app/Command/Docker.php

Lines changed: 0 additions & 110 deletions
This file was deleted.

‎app/Plugins/Comment/resources/views/Widget/topic.blade.php

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,36 @@
55
</div>
66
<div class="card-body">
77
@if(!auth()->check())
8-
<a href="/login" class="btn btn-dark">登陆</a>
9-
OR
10-
<a href="/register" class="btn btn-light">注册</a>
8+
<div class="col-md-12">
9+
<div class="border-0 card">
10+
<div class="empty">
11+
<div class="empty-icon"><!-- Download SVG icon from http://tabler-icons.io/i/mood-sad -->
12+
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-login" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
13+
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
14+
<path d="M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"></path>
15+
<path d="M20 12h-13l3 -3m0 6l-3 -3"></path>
16+
</svg>
17+
</div>
18+
<p class="empty-title">无权限</p>
19+
<p class="empty-subtitle text-muted">
20+
请登录后评论
21+
</p>
22+
@if(!auth()->check())
23+
<div class="empty-action">
24+
<a href="/login" class="btn btn-primary">
25+
<!-- Download SVG icon from http://tabler-icons.io/i/search -->
26+
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-login" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
27+
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
28+
<path d="M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"></path>
29+
<path d="M20 12h-13l3 -3m0 6l-3 -3"></path>
30+
</svg>
31+
登陆
32+
</a>
33+
</div>
34+
@endif
35+
</div>
36+
</div>
37+
</div>
1138
@else
1239
<div class="alert alert-important alert-info alert-dismissible" role="alert">
1340
<div class="d-flex">
Lines changed: 61 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,70 @@
11
<?php
22

3+
declare(strict_types=1);
4+
/**
5+
* This file is part of zhuchunshu.
6+
* @link https://github.com/zhuchunshu
7+
* @document https://github.com/zhuchunshu/super-forum
8+
* @contact laravel@88.com
9+
* @license https://github.com/zhuchunshu/super-forum/blob/master/LICENSE
10+
*/
311
namespace App\Plugins\Topic\src;
412

513
use Hyperf\Utils\Arr;
614
use Zhuchunshu\EmojiParse\Emoji;
715

816
class ContentParse
917
{
10-
/**
11-
* @param string $content 内容
12-
* @param array $data 数据
13-
*/
14-
public function parse(string $content, array $data = [])
15-
{
16-
$content = $this->ShortCode($content, $data);
17-
$content = $this->twemoji($content);
18-
$content = $this->owo($content);
19-
return $content;
20-
}
21-
22-
/**
23-
* ShortCode 处理
24-
* @param string $content 内容
25-
* @param array $data 数据
26-
*/
27-
private function ShortCode(string $content, array $data = []): string
28-
{
29-
// 要删除的ShortCode
30-
// 要删除的ShortCode
31-
$shortCode = [];
32-
if(count(Itf()->get('topic_shortCode_remove'))) {
33-
$shortCode = array_merge($shortCode, Itf()->get('topic_shortCode_remove'));
34-
}
35-
if(Arr::has($data, 'RemoveshortCode') && count($data['RemoveshortCode'])) {
36-
$shortCode = array_merge($shortCode, $data['RemoveshortCode']);
37-
}
38-
$shortCode = array_unique($shortCode);
39-
return ShortCodeR()->setRemove($shortCode)->handle($content, $data);
40-
}
41-
42-
/**
43-
* TwEmoji 处理
44-
* @param string $content
45-
* @return string
46-
*/
47-
private function twemoji(string $content): string
48-
{
49-
if(get_options("contentParse_twemoji", "开启") === "开启") {
50-
return (new Emoji())->twemoji($content)->svg()->base(get_options("contentParse_twemoji_cdn", "https://lib.baomitu.com/twemoji/1.4.2"))->toHtml(null, ['width' => get_options("contentParse_twemoji_contentParse_width", 25), 'height' => get_options("contentParse_twemoji_contentParse_height", 25)]);
51-
}
52-
return $content;
53-
}
54-
55-
/**
56-
* 渲染owo表情
57-
* @param string $content
58-
* @return string
59-
*/
60-
private function owo(string $content): string
61-
{
62-
if(get_options('contentParse_owo', '开启') === "开启") {
63-
return (new \App\Plugins\Core\src\Lib\Emoji())->parse($content);
64-
}
65-
return $content;
66-
}
67-
}
18+
/**
19+
* @param string $content 内容
20+
* @param array $data 数据
21+
*/
22+
public function parse(string $content, array $data = [])
23+
{
24+
$content = $this->ShortCode($content, $data);
25+
$content = $this->twemoji($content);
26+
return $this->owo($content);
27+
}
28+
29+
/**
30+
* ShortCode 处理.
31+
* @param string $content 内容
32+
* @param array $data 数据
33+
*/
34+
private function ShortCode(string $content, array $data = []): string
35+
{
36+
// 要删除的ShortCode
37+
// 要删除的ShortCode
38+
$shortCode = [];
39+
if (count(Itf()->get('topic_shortCode_remove'))) {
40+
$shortCode = array_merge($shortCode, Itf()->get('topic_shortCode_remove'));
41+
}
42+
if (Arr::has($data, 'RemoveshortCode') && count($data['RemoveshortCode'])) {
43+
$shortCode = array_merge($shortCode, $data['RemoveshortCode']);
44+
}
45+
$shortCode = array_unique($shortCode);
46+
return ShortCodeR()->setRemove($shortCode)->handle($content, $data);
47+
}
48+
49+
/**
50+
* TwEmoji 处理.
51+
*/
52+
private function twemoji(string $content): string
53+
{
54+
if (get_options('contentParse_twemoji', '开启') === '开启') {
55+
return (new Emoji())->twemoji($content)->svg()->base(get_options('contentParse_twemoji_cdn', 'https://lib.baomitu.com/twemoji/1.4.2'))->toHtml(null, ['width' => get_options('contentParse_twemoji_contentParse_width', 25), 'height' => get_options('contentParse_twemoji_contentParse_height', 25)]);
56+
}
57+
return $content;
58+
}
59+
60+
/**
61+
* 渲染owo表情.
62+
*/
63+
private function owo(string $content): string
64+
{
65+
if (get_options('contentParse_owo', '开启') === '开启') {
66+
return (new \App\Plugins\Core\src\Lib\Emoji())->parse($content);
67+
}
68+
return $content;
69+
}
70+
}

‎config/config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
return [
1515
'app_name' => env('APP_NAME', 'CodeFec'),
1616
'app_env' => env('APP_ENV', 'dev'),
17-
'scan_cacheable' => env('SCAN_CACHEABLE', false),
17+
'scan_cacheable' => env('SCAN_CACHEABLE', true),
1818
StdoutLoggerInterface::class => [
1919
'log_level' => [
2020
LogLevel::INFO,

0 commit comments

Comments
 (0)