Compare commits

...

37 Commits
v3.3.7 ... 3.x

Author SHA1 Message Date
imgbot[bot] 9a7a597ac1
[ImgBot] Optimize images (#307)
*Total -- 2,005.66kb -> 1,447.46kb (27.83%)

/images/smilies/bili/tuxue.png -- 24.83kb -> 8.07kb (67.5%)
/images/smilies/bili/xieyanxiao.png -- 25.61kb -> 8.86kb (65.41%)
/images/smilies/bili/qinqin.png -- 28.16kb -> 11.01kb (60.89%)
/images/smilies/bili/doge.png -- 28.77kb -> 11.70kb (59.35%)
/images/smilies/bili/shengqi.png -- 29.09kb -> 12.44kb (57.24%)
/images/smilies/bili/guzhang.png -- 29.65kb -> 12.68kb (57.24%)
/images/smilies/bili/huaixiao.png -- 37.33kb -> 18.09kb (51.53%)
/images/smilies/bili/baiyan.png -- 34.27kb -> 16.73kb (51.18%)
/images/smilies/bili/yun.png -- 37.94kb -> 18.67kb (50.78%)
/images/smilies/bili/daku.png -- 34.48kb -> 17.04kb (50.58%)
/images/smilies/bili/weixiao.png -- 40.23kb -> 20.01kb (50.25%)
/images/smilies/bili/yiwen.png -- 38.27kb -> 19.47kb (49.12%)
/images/smilies/bili/dianzan.png -- 34.15kb -> 17.70kb (48.18%)
/images/smilies/bili/fadai.png -- 42.36kb -> 22.18kb (47.64%)
/images/smilies/bili/nanguo.png -- 47.20kb -> 26.09kb (44.71%)
/images/smilies/bili/outu.png -- 42.76kb -> 23.69kb (44.61%)
/images/smilies/bili/se.png -- 37.86kb -> 21.10kb (44.25%)
/images/smilies/bili/wunai.png -- 48.69kb -> 27.46kb (43.61%)
/images/smilies/bili/haixiu.png -- 50.82kb -> 29.35kb (42.25%)
/images/smilies/bili/xiaoku.png -- 46.64kb -> 28.31kb (39.31%)
/images/smilies/bili/weiqu.png -- 46.17kb -> 28.25kb (38.81%)
/images/smilies/bili/koubi.png -- 55.59kb -> 34.16kb (38.55%)
/images/smilies/bili/jingxia.png -- 64.71kb -> 40.09kb (38.04%)
/images/smilies/bili/zaijian.png -- 50.89kb -> 31.81kb (37.49%)
/images/logo.png -- 3.23kb -> 2.15kb (33.54%)
/images/avatar.jpeg -- 1.29kb -> 0.88kb (31.97%)
/images/smilies/bili/shuizhao.png -- 57.47kb -> 39.34kb (31.55%)
/images/mashiro-logo-s.png -- 3.05kb -> 2.13kb (30.19%)
/images/smilies/bili/sikao.png -- 66.25kb -> 46.90kb (29.21%)
/images/smilies/bili/fanu.png -- 70.29kb -> 55.68kb (20.78%)
/manifest/icon.png -- 50.43kb -> 41.17kb (18.36%)
/manifest/jpeg/e9f33c2c502ab43804964ce7edd431f9.jpeg -- 43.23kb -> 37.48kb (13.3%)
/manifest/jpeg/783bf161f47b32882f0e962fd4064de7.th.jpeg -- 20.50kb -> 18.90kb (7.8%)
/screenshot.jpg -- 102.79kb -> 94.89kb (7.69%)
/manifest/jpeg/19313b0d62b27c8ba022f60fbfedd5ee.jpeg -- 101.61kb -> 94.64kb (6.86%)
/images/avatar.jpg -- 14.53kb -> 13.55kb (6.72%)
/manifest/jpeg/e9f33c2c502ab43804964ce7edd431f9.th.jpeg -- 9.71kb -> 9.07kb (6.56%)
/images/temp.jpg -- 31.91kb -> 29.87kb (6.39%)
/manifest/jpeg/783bf161f47b32882f0e962fd4064de7.jpeg -- 200.07kb -> 190.98kb (4.55%)
/images/random/d-1.jpg -- 14.69kb -> 14.07kb (4.25%)
/images/random/d-4.jpg -- 15.12kb -> 14.51kb (4.06%)
/images/random/d-10.jpg -- 15.05kb -> 14.45kb (4.05%)
/images/random/d-8.jpg -- 14.89kb -> 14.31kb (3.92%)
/images/random/d-9.jpg -- 14.92kb -> 14.33kb (3.91%)
/images/random/d-2.jpg -- 15.01kb -> 14.43kb (3.88%)
/images/random/d-5.jpg -- 15.39kb -> 14.80kb (3.83%)
/images/random/d-3.jpg -- 15.13kb -> 14.55kb (3.83%)
/manifest/jpeg/19313b0d62b27c8ba022f60fbfedd5ee.th.jpeg -- 16.88kb -> 16.25kb (3.76%)
/images/random/d-6.jpg -- 15.26kb -> 14.69kb (3.74%)
/images/random/d-7.jpg -- 15.75kb -> 15.16kb (3.7%)
/inc/fonts/iconfont.svg -- 32.47kb -> 31.52kb (2.93%)
/inc/fonts/SAKURASO.old/sakuraso.svg -- 7.84kb -> 7.62kb (2.78%)
/inc/fonts/SAKURASO.old/sakuraso-symbol.svg -- 7.66kb -> 7.61kb (0.61%)
/images/smilies/bili/mudengkoudai.png -- 2.09kb -> 2.07kb (0.61%)
/manifest/gallary/海の空(56993195)_by_夏T.jpg -- 54.69kb -> 54.50kb (0.34%)

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>
Co-authored-by: ImgBotApp <ImgBotHelp@gmail.com>
2023-02-07 10:55:36 +08:00
migftw 233d0356c9
Update README-en.md (#301) 2022-10-09 13:48:00 +08:00
migftw 8bea22e9da
Update README.md (#302) 2022-09-21 14:43:44 +08:00
Mashiro 0128ba483b
fix: remove unused code 2022-06-01 14:47:16 +08:00
TershiXia 8842caf739
Add Feature: Traditional Chinese Support (#287) 2022-03-06 17:33:49 +08:00
琥珀 a0950f1a5c
fix:timeline behavior (#279) 2021-11-13 18:34:05 +08:00
Mashiro 6e56d0ba42
Update README.md 2021-10-21 22:04:31 +08:00
Spirit b73c45f022
perf: update to v3.4.0 (#273)
* fix: bug fix
update Meting API, add ipv6 support, fix icon
close #255,#243

* style: add some variable definitions
support php8

* perf: update to v3.4.0

* docs: update screenshot
2021-08-01 13:04:09 +08:00
aierlma 8a46b8545f
修改gravatar镜像 (#272) 2021-07-22 14:49:30 +08:00
Mashiro 77722ed4d7
Merge pull request #240 from mashirozx/dev
update to v3.3.9
2020-08-09 17:01:40 +08:00
Spirit a831ae70e1
Merge pull request #239 from mashirozx/issue-237
Issue 237
2020-08-09 14:57:50 +08:00
Spirit 34fdb5d215 perf: update to v3.3.9
close #237
2020-08-09 14:49:16 +08:00
Spirit a063060ad9 perf: update jQuery
update jQuery to the lastest, fix some little bugs
issue #237
2020-08-08 00:02:36 +08:00
Spirit 69b68c00c0 feat: make feature image separate
only for the post without feature image in the home page
issue #237
2020-08-06 17:52:27 +08:00
Spirit 00e2a2f390 fix: fix pagination and alignment
issue #237, fix #224
2020-08-06 17:14:46 +08:00
Spirit fad1d9f30f feat: add comment location option
now you can choose whether to enable comment location in the comment
fields, besides, Comment become a new group in Sakura Options
issue #237
2020-08-06 16:55:02 +08:00
Spirit a0d8f8a6cf fix: fix mail notify
fix wrong position of comment text in mail notify
issue #237
2020-08-04 17:51:07 +08:00
Spirit f829ab4b60
Merge pull request #236 from mashirozx/issue-235
Issue 230 234 235
2020-08-03 23:08:08 +08:00
Spirit c9a041eee3 fix: fix comment link
disable auto linking of URLs in comments
fix #230
2020-08-03 14:01:19 +08:00
Spirit 9d5e0a598b
Merge pull request #232 from Jkkoi/patch-1
404 页面添加网页图标
2020-08-03 13:16:31 +08:00
Spirit e15bbeb896 fix: fix webp image covver
fix #234
2020-08-02 22:35:08 +08:00
Spirit 7a96dd7549 fix: fix code block data-rel
fix #235
2020-08-02 22:31:35 +08:00
Jkkoi 663768b37a
404 页面添加网页图标 2020-06-14 23:21:36 +08:00
Spirit 467818c5f6 perf: optimize
bug fix, update darkmode option
2020-04-19 00:43:35 +08:00
Mashiro 7a1ec65a9a
Merge pull request #216 from mashirozx/dev
update to v3.3.8
2020-04-12 22:00:43 +08:00
Spirit 85f010d6aa perf: optimize 2020-04-11 23:08:16 +08:00
Spirit 6b919d0157 fix: fix styles 2020-04-09 22:19:39 +08:00
Spirit 0ddfcad236
Merge pull request #215 from mashirozx/issue-213
Issue #213
2020-04-09 15:12:09 +08:00
Spirit 6dff427071 feat: add dark mode
add dark mode, replace theme built-in night mode. This style auto on at night, off in the day
close #213
2020-04-09 15:05:03 +08:00
Spirit 777b91817c fix: fix the fixes 2020-04-07 10:16:13 +08:00
Spirit 9abded81ec
feat: integrate Meting API and refactor api.php (#214)
add some music platforms, add netease-cloud-music cookies option.
Integrate Meting API into theme, now you can use aplayer play other
platform's music, refactor theme built-in api interface.
BREAKING CHANGE: refactor api.php, close #211
2020-04-06 23:35:23 +08:00
Spirit 689fc6319d
feat: add bibibili bangumi support (#212)
Now you can display your bibibili bangumi status, note: the api is
unofficial, so may be abandoned in the future. Format api.php
close #209
2020-04-05 12:01:11 +08:00
Spirit a90e961e7b perf: update lib.js 2020-04-02 00:59:04 +08:00
Spirit 499e7eb1cc
feat: add gravatar proxy option (#210)
add gravatar avatar proxy option, you can change your front-end gravatar
url to your costum proxy
fix #208
2020-04-02 00:07:26 +08:00
Spirit a4bd04fc9f perf: upgrade ip location database 2020-04-01 23:57:48 +08:00
Spirit 7437bfa456
Issue 205 (#206)
* fix: fix pagination and alignment
fix pagination and post list thumb alignment
fix #205
2020-03-29 01:06:02 +08:00
Spirit df1c5bac14 perf: optmize 2020-03-28 10:02:47 +08:00
92 changed files with 7226 additions and 3059 deletions

View File

@ -12,6 +12,7 @@
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="<?php echo akina_option('favicon_link', ''); ?>"/>
<title itemprop="name"><?php global $page, $paged;wp_title( '-', true, 'right' );
bloginfo( 'name' );$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) ) echo " - $site_description";if ( $paged >= 2 || $page >= 2 ) echo ' - ' . sprintf( __( 'page %s'), max( $paged, $page ) );/*第 %s 页*/?>

View File

@ -1,12 +1,12 @@
Sakura🌸: A Wonderful WordPress Theme
===
[中文](README.md) | Engilsh
[中文](README.md) | English
![Sakura](https://view.moezx.cc/images/2018/05/26/sakura.png)
![Sakura](screenshot.jpg)
![PHP version](https://img.shields.io/badge/PHP-7.1+-4F5B93.svg?style=flat-square)
![WP version](https://img.shields.io/badge/WordPress-5.0+-0073aa.svg?style=flat-square)
![PHP version](https://img.shields.io/badge/PHP-7.1+-4F5B93.svg?style=flat-square&logo=php)
![WP version](https://img.shields.io/badge/WordPress-5.3-0073aa.svg?style=flat-square&logo=wordpress)
[![GitHub release](https://img.shields.io/github/release/mashirozx/Sakura.svg?style=flat-square)](https://github.com/mashirozx/Sakura/releases/latest)
[![Github commits (since latest release)](https://img.shields.io/github/commits-since/mashirozx/Sakura/latest/dev.svg?style=flat-square)](https://github.com/mashirozx/Sakura/commits/dev)
[![](https://data.jsdelivr.com/v1/package/gh/moezx/cdn/badge)](https://www.jsdelivr.com/package/gh/moezx/cdn)

View File

@ -1,12 +1,12 @@
Sakura🌸: 樱花庄的白猫博客主题
===
中文 | [Engilsh](README-en.md)
中文 | [English](README-en.md)
![Sakura](https://view.moezx.cc/images/2018/05/26/sakura.png)
![Sakura](screenshot.jpg)
![PHP version](https://shader.2heng.xin/badge/PHP-7.1+-4F5B93.svg?style=flat-square&logo=php)
![WP version](https://shader.2heng.xin/badge/WordPress-5.3-0073aa.svg?style=flat-square&logo=wordpress)
![PHP version](https://img.shields.io/badge/PHP-7.1+-4F5B93.svg?style=flat-square&logo=php)
![WP version](https://img.shields.io/badge/WordPress-5.3-0073aa.svg?style=flat-square&logo=wordpress)
[![GitHub release](https://img.shields.io/github/v/release/mashirozx/Sakura.svg?style=flat-square&logo=github)](https://github.com/mashirozx/Sakura/releases/latest)
[![Github commits (since latest release)](https://img.shields.io/github/commits-since/mashirozx/Sakura/latest/dev.svg?style=flat-square&logo=git&color=important)](https://github.com/mashirozx/Sakura/commits/dev)
[![](https://data.jsdelivr.com/v1/package/gh/moezx/cdn/badge)](https://www.jsdelivr.com/package/gh/moezx/cdn)
@ -21,7 +21,7 @@
主题使用说明见:<https://2heng.xin/theme-sakura/>
本仓库国内镜像:<https://gitee.com/mashirozx/Sakura>
本仓库国内镜像:<https://git.moezx.cc/mirrors/sakura>
主题交流群860262481

File diff suppressed because one or more lines are too long

4
cdn/js/src/01.jquery.min.js vendored 100644 → 100755

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,7 @@ function get_gravatar(email, size) {
var size = size || 80;
return 'https://gravatar.2heng.xin/avatar/' + MD5(email) + '.jpg?s=' + size + '&d=mm';
return 'https://' + Poi.gravatar_url + '/' + MD5(email) + '.jpg?s=' + size + '&d=mm';
}
// sync css

View File

@ -150,6 +150,7 @@ h1.entry-title {
}
.entry-content tr:nth-child(even){background-color: #f2f2f2}
body.dark .entry-content tr:nth-child(even){background-color: unset}
.entry-content th {
color: white;

View File

@ -48,7 +48,7 @@
<?php endif; ?>
<?php
$robot_comments = '';
if(comments_open()){
if(akina_option('norobot')) $robot_comments = '<label class="siren-checkbox-label"><input class="siren-checkbox-radio" type="checkbox" name="no-robot"><span class="siren-no-robot-checkbox siren-checkbox-radioInput"></span>'.__('I\'m not a robot', 'sakura').'</label>';
$private_ms = akina_option('open_private_message') ? '<label class="siren-checkbox-label"><input class="siren-checkbox-radio" type="checkbox" name="is-private"><span class="siren-is-private-checkbox siren-checkbox-radioInput"></span>'.__('Comment in private', 'sakura').'</label>' : '';
@ -88,7 +88,7 @@
'comment_notes_after' => '',
'comment_notes_before' => '',
'fields' => apply_filters( 'comment_form_default_fields', array(
'avatar' => '<div class="cmt-info-container"><div class="comment-user-avatar"><img src="https://gravatar.2heng.xin/avatar/f11f237b3de93c93b24045e71f7f65c6?s=80&d=mm&r=g"><div class="socila-check qq-check"><i class="fa fa-qq" aria-hidden="true"></i></div><div class="socila-check gravatar-check"><i class="fa fa-google" aria-hidden="true"></i></div></div>',
'avatar' => '<div class="cmt-info-container"><div class="comment-user-avatar"><img src="' . get_template_directory_uri() . '/images/avatar.jpeg"><div class="socila-check qq-check"><i class="fa fa-qq" aria-hidden="true"></i></div><div class="socila-check gravatar-check"><i class="fa fa-google" aria-hidden="true"></i></div></div>',
'author' =>
'<div class="popup cmt-popup cmt-author" onclick="cmt_showPopup(this)"><span class="popuptext" id="thePopup" style="margin-left: -115px;width: 230px;">' . __("Auto pull nickname and avatar with a QQ num. entered", "sakura")/*输入QQ号将自动拉取昵称和头像*/ . '</span><input type="text" placeholder="' . __("Nickname or QQ number", "sakura") /*昵称或QQ号*/. ' ' . ( $req ? '(' . __("Name* ", "sakura") . ')' : '') . '" name="author" id="author" value="' . esc_attr($comment_author) . '" size="22" autocomplete="off" tabindex="1" ' . ($req ? "aria-required='true'" : '' ). ' /></div>',
'email' =>

View File

@ -65,7 +65,8 @@
<?php wp_nav_menu( array( 'depth' => 2, 'theme_location' => 'primary', 'container' => false ) ); ?>
</div><!-- m-nav-center end -->
<a class="cd-top faa-float animated "></a>
<button onclick="topFunction()" id="moblieGoTop" title="Go to top"><i class="fa fa-chevron-up" aria-hidden="true"></i></button>
<button id="moblieGoTop" title="Go to top"><i class="fa fa-chevron-up" aria-hidden="true"></i></button>
<button id="moblieDarkLight"><i class="fa fa-moon-o" aria-hidden="true"></i></button>
<!-- search start -->
<form class="js-search search-form search-form--modal" method="get" action="<?php echo home_url(); ?>" role="search">
<div class="search-form__inner">
@ -148,11 +149,11 @@
<div class="show-hide-wrap"><button class="show-hide"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 32"><path d="M22 16l-10.105-10.6-1.895 1.987 8.211 8.613-8.211 8.612 1.895 1.988 8.211-8.613z"></path></svg></button></div>
</aside>
<?php endif; ?>
<?php if (akina_option('playlist_id', '')): ?>
<?php if (akina_option('aplayer_server') != 'off'): ?>
<div id="aplayer-float" style="z-index: 100;"
class="aplayer"
data-id="<?php echo akina_option('playlist_id', ''); ?>"
data-server="netease"
data-id="<?php echo akina_option('aplayer_playlistid', ''); ?>"
data-server="<?php echo akina_option('aplayer_server'); ?>"
data-type="playlist"
data-fixed="true"
data-theme="orange">

View File

@ -188,7 +188,7 @@ function sakura_scripts()
wp_enqueue_style('saukra_css', 'https://cdn.jsdelivr.net/gh/mashirozx/Sakura@' . SAKURA_VERSION . '/style.min.css', array(), SAKURA_VERSION);
wp_enqueue_script('app', 'https://cdn.jsdelivr.net/gh/mashirozx/Sakura@' . SAKURA_VERSION . '/js/sakura-app.min.js', array(), SAKURA_VERSION, true);
}
wp_enqueue_script('github_card', 'https://cdn.jsdelivr.net/github-cards/latest/widget.js', array(), SAKURA_VERSION, true);
//wp_enqueue_script('github_card', 'https://cdn.jsdelivr.net/github-cards/latest/widget.js', array(), SAKURA_VERSION, true);
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
@ -204,6 +204,7 @@ function sakura_scripts()
// }
//拦截移动端
version_compare($GLOBALS['wp_version'], '5.1', '>=') ? $reply_link_version = 'new' : $reply_link_version = 'old';
$gravatar_url = akina_option('gravatar_proxy') ?: 'dn-qiniu-avatar.qbox.me/avatar';
wp_localize_script('app', 'Poi', array(
'pjax' => akina_option('poi_pjax'),
'movies' => $movies,
@ -215,7 +216,8 @@ function sakura_scripts()
'reply_link_version' => $reply_link_version,
'api' => esc_url_raw(rest_url()),
'nonce' => wp_create_nonce('wp_rest'),
'google_analytics_id' => akina_option('google_analytics_id', '')
'google_analytics_id' => akina_option('google_analytics_id', ''),
'gravatar_url' => $gravatar_url
));
}
add_action('wp_enqueue_scripts', 'sakura_scripts');
@ -247,149 +249,160 @@ require get_template_directory() . '/inc/categories-images.php';
function convertip($ip)
{
error_reporting(E_ALL ^ E_NOTICE);
$dat_path = dirname(__FILE__) . '/inc/QQWry.Dat';
if (!$fd = @fopen($dat_path, 'rb')) {
return 'IP date file not exists or access denied';
}
$ip = explode('.', $ip);
$ipNum = intval($ip[0]) * 16777216 + intval($ip[1]) * 65536 + intval($ip[2]) * 256 + intval($ip[3]);
$DataBegin = fread($fd, 4);
$DataEnd = fread($fd, 4);
$ipbegin = implode('', unpack('L', $DataBegin));
if ($ipbegin < 0) {
$ipbegin += pow(2, 32);
}
$ipend = implode('', unpack('L', $DataEnd));
if ($ipend < 0) {
$ipend += pow(2, 32);
}
$ipAllNum = ($ipend - $ipbegin) / 7 + 1;
$BeginNum = 0;
$EndNum = $ipAllNum;
while ($ip1num > $ipNum || $ip2num < $ipNum) {
$Middle = intval(($EndNum + $BeginNum) / 2);
fseek($fd, $ipbegin + 7 * $Middle);
$ipData1 = fread($fd, 4);
if (strlen($ipData1) < 4) {
fclose($fd);
return 'System Error';
}
$ip1num = implode('', unpack('L', $ipData1));
if ($ip1num < 0) {
$ip1num += pow(2, 32);
}
if ($ip1num > $ipNum) {
$EndNum = $Middle;
continue;
}
$DataSeek = fread($fd, 3);
if (strlen($DataSeek) < 3) {
fclose($fd);
return 'System Error';
}
$DataSeek = implode('', unpack('L', $DataSeek . chr(0)));
fseek($fd, $DataSeek);
$ipData2 = fread($fd, 4);
if (strlen($ipData2) < 4) {
fclose($fd);
return 'System Error';
}
$ip2num = implode('', unpack('L', $ipData2));
if ($ip2num < 0) {
$ip2num += pow(2, 32);
}
if ($ip2num < $ipNum) {
if ($Middle == $BeginNum) {
fclose($fd);
return 'Unknown';
}
$BeginNum = $Middle;
}
}
$ipFlag = fread($fd, 1);
if ($ipFlag == chr(1)) {
$ipSeek = fread($fd, 3);
if (strlen($ipSeek) < 3) {
fclose($fd);
return 'System Error';
}
$ipSeek = implode('', unpack('L', $ipSeek . chr(0)));
fseek($fd, $ipSeek);
$ipFlag = fread($fd, 1);
}
if ($ipFlag == chr(2)) {
$AddrSeek = fread($fd, 3);
if (strlen($AddrSeek) < 3) {
fclose($fd);
return 'System Error';
}
$ipFlag = fread($fd, 1);
if ($ipFlag == chr(2)) {
$AddrSeek2 = fread($fd, 3);
if (strlen($AddrSeek2) < 3) {
fclose($fd);
return 'System Error';
}
$AddrSeek2 = implode('', unpack('L', $AddrSeek2 . chr(0)));
fseek($fd, $AddrSeek2);
if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) {
$file_contents = file_get_contents('http://ip.taobao.com/outGetIpInfo?accessKey=alibaba-inc&ip='.$ip);
$result = json_decode($file_contents,true);
if ($result['data']['country'] != '中国') {
return $result['data']['country'];
} else {
fseek($fd, -1, SEEK_CUR);
return $result['data']['region'].'&nbsp;·&nbsp;'.$result['data']['city'].'&nbsp;·&nbsp;'.$result['data']['isp'];
}
while (($char = fread($fd, 1)) != chr(0)) {
$ipAddr2 .= $char;
}
$AddrSeek = implode('', unpack('L', $AddrSeek . chr(0)));
fseek($fd, $AddrSeek);
while (($char = fread($fd, 1)) != chr(0)) {
$ipAddr1 .= $char;
}
} else {
fseek($fd, -1, SEEK_CUR);
while (($char = fread($fd, 1)) != chr(0)) {
$ipAddr1 .= $char;
$dat_path = dirname(__FILE__) . '/inc/QQWry.Dat';
if (!$fd = @fopen($dat_path, 'rb')) {
return 'IP date file not exists or access denied';
}
$ip = explode('.', $ip);
$ipNum = intval($ip[0]) * 16777216 + intval($ip[1]) * 65536 + intval($ip[2]) * 256 + intval($ip[3]);
$DataBegin = fread($fd, 4);
$DataEnd = fread($fd, 4);
$ipbegin = implode('', unpack('L', $DataBegin));
if ($ipbegin < 0) {
$ipbegin += pow(2, 32);
}
$ipFlag = fread($fd, 1);
if ($ipFlag == chr(2)) {
$AddrSeek2 = fread($fd, 3);
if (strlen($AddrSeek2) < 3) {
$ipend = implode('', unpack('L', $DataEnd));
if ($ipend < 0) {
$ipend += pow(2, 32);
}
$ipAllNum = ($ipend - $ipbegin) / 7 + 1;
$BeginNum = 0;
$EndNum = $ipAllNum;
$ip1num = $ip2num = $ipAddr1 = $ipAddr2 = '';
while ($ip1num > $ipNum || $ip2num < $ipNum) {
$Middle = intval(($EndNum + $BeginNum) / 2);
fseek($fd, $ipbegin + 7 * $Middle);
$ipData1 = fread($fd, 4);
if (strlen($ipData1) < 4) {
fclose($fd);
return 'System Error';
}
$AddrSeek2 = implode('', unpack('L', $AddrSeek2 . chr(0)));
fseek($fd, $AddrSeek2);
$ip1num = implode('', unpack('L', $ipData1));
if ($ip1num < 0) {
$ip1num += pow(2, 32);
}
if ($ip1num > $ipNum) {
$EndNum = $Middle;
continue;
}
$DataSeek = fread($fd, 3);
if (strlen($DataSeek) < 3) {
fclose($fd);
return 'System Error';
}
$DataSeek = implode('', unpack('L', $DataSeek . chr(0)));
fseek($fd, $DataSeek);
$ipData2 = fread($fd, 4);
if (strlen($ipData2) < 4) {
fclose($fd);
return 'System Error';
}
$ip2num = implode('', unpack('L', $ipData2));
if ($ip2num < 0) {
$ip2num += pow(2, 32);
}
if ($ip2num < $ipNum) {
if ($Middle == $BeginNum) {
fclose($fd);
return 'Unknown';
}
$BeginNum = $Middle;
}
}
$ipFlag = fread($fd, 1);
if ($ipFlag == chr(1)) {
$ipSeek = fread($fd, 3);
if (strlen($ipSeek) < 3) {
fclose($fd);
return 'System Error';
}
$ipSeek = implode('', unpack('L', $ipSeek . chr(0)));
fseek($fd, $ipSeek);
$ipFlag = fread($fd, 1);
}
if ($ipFlag == chr(2)) {
$AddrSeek = fread($fd, 3);
if (strlen($AddrSeek) < 3) {
fclose($fd);
return 'System Error';
}
$ipFlag = fread($fd, 1);
if ($ipFlag == chr(2)) {
$AddrSeek2 = fread($fd, 3);
if (strlen($AddrSeek2) < 3) {
fclose($fd);
return 'System Error';
}
$AddrSeek2 = implode('', unpack('L', $AddrSeek2 . chr(0)));
fseek($fd, $AddrSeek2);
} else {
fseek($fd, -1, SEEK_CUR);
}
while (($char = fread($fd, 1)) != chr(0)) {
$ipAddr2 .= $char;
}
$AddrSeek = implode('', unpack('L', $AddrSeek . chr(0)));
fseek($fd, $AddrSeek);
while (($char = fread($fd, 1)) != chr(0)) {
$ipAddr1 .= $char;
}
} else {
fseek($fd, -1, SEEK_CUR);
while (($char = fread($fd, 1)) != chr(0)) {
$ipAddr1 .= $char;
}
$ipFlag = fread($fd, 1);
if ($ipFlag == chr(2)) {
$AddrSeek2 = fread($fd, 3);
if (strlen($AddrSeek2) < 3) {
fclose($fd);
return 'System Error';
}
$AddrSeek2 = implode('', unpack('L', $AddrSeek2 . chr(0)));
fseek($fd, $AddrSeek2);
} else {
fseek($fd, -1, SEEK_CUR);
}
while (($char = fread($fd, 1)) != chr(0)) {
$ipAddr2 .= $char;
}
}
while (($char = fread($fd, 1)) != chr(0)) {
$ipAddr2 .= $char;
fclose($fd);
if (preg_match('/http/i', $ipAddr2)) {
$ipAddr2 = '';
}
}
fclose($fd);
if (preg_match('/http/i', $ipAddr2)) {
$ipAddr2 = '';
}
$ipaddr = "$ipAddr1 $ipAddr2";
$ipaddr = preg_replace('/CZ88.Net/is', '', $ipaddr);
$ipaddr = preg_replace('/^s*/is', '', $ipaddr);
$ipaddr = preg_replace('/s*$/is', '', $ipaddr);
if (preg_match('/http/i', $ipaddr) || $ipaddr == '') {
$ipaddr = 'Unknown';
}
$ipaddr = iconv('gbk', 'utf-8//IGNORE', $ipaddr);
if ($ipaddr != ' ') {
$ipaddr = "$ipAddr1 $ipAddr2";
$ipaddr = preg_replace('/CZ88.Net/is', '', $ipaddr);
$ipaddr = preg_replace('/^s*/is', '', $ipaddr);
$ipaddr = preg_replace('/s*$/is', '', $ipaddr);
if (preg_match('/http/i', $ipaddr) || $ipaddr == '') {
$ipaddr = 'Unknown';
}
$ipaddr = iconv('gbk', 'utf-8//IGNORE', $ipaddr);
if ($ipaddr != ' ') {
return $ipaddr;
} else {
$ipaddr = 'Unknown';
}
return $ipaddr;
} else {
$ipaddr = 'Unknown';
}
return $ipaddr;
}
//Comment Location End
@ -422,10 +435,11 @@ if (!function_exists('akina_comment_format')) {
</div>
<?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));?>
<div class="right">
<div class="info"><time datetime="<?php comment_date('Y-m-d');?>"><?php echo poi_time_since(strtotime($comment->comment_date_gmt), true); //comment_date(get_option('date_format')); ?></time><?php echo siren_get_useragent($comment->comment_agent); ?><?php echo mobile_get_useragent_icon($comment->comment_agent); ?>&nbsp;<?php _e('Location', 'sakura'); /*来自*/?>: <?php echo convertip(get_comment_author_ip()); ?>
<div class="info"><time datetime="<?php comment_date('Y-m-d');?>"><?php echo poi_time_since(strtotime($comment->comment_date_gmt), true); //comment_date(get_option('date_format')); ?></time><?php echo siren_get_useragent($comment->comment_agent); ?><?php echo mobile_get_useragent_icon($comment->comment_agent); ?>&nbsp;<?php if(akina_option('open_location')){ _e('Location', 'sakura'); /*来自*/?>: <?php echo convertip(get_comment_author_ip());} ?>
<?php if (current_user_can('manage_options') and (wp_is_mobile() == false)) {
$comment_ID = $comment->comment_ID;
$i_private = get_comment_meta($comment_ID, '_private', true);
$flag = '';
$flag .= ' <i class="fa fa-snowflake-o" aria-hidden="true"></i> <a href="javascript:;" data-actionp="set_private" data-idp="' . get_comment_id() . '" id="sp" class="sm" style="color:rgba(0,0,0,.35)">' . __("Private", "sakura") . ': <span class="has_set_private">';
if (!empty($i_private)) {
$flag .= __("Yes", "sakura") . ' <i class="fa fa-lock" aria-hidden="true"></i>';
@ -608,13 +622,15 @@ function get_link_items()
* Gravatar头像使用中国服务器
*/
function gravatar_cn($url)
{
$gravatar_url = array('0.gravatar.com', '1.gravatar.com', '2.gravatar.com', 'secure.gravatar.com');
{
$gravatar_url = array('dn-qiniu-avatar.qbox.me/avatar','cdn.v2ex.com/gravatar','gravatar.loli.net/avatar','gravatar.zeruns.tech/avatar');
//return str_replace($gravatar_url, 'cn.gravatar.com', $url);
//官方服务器近期大陆访问 429建议使用镜像
return str_replace( $gravatar_url, 'gravatar.2heng.xin', $url );
return str_replace( $gravatar_url, akina_option('gravatar_proxy'), $url );
}
if(akina_option('gravatar_proxy')){
add_filter('get_avatar_url', 'gravatar_cn', 4);
}
add_filter('get_avatar_url', 'gravatar_cn', 4);
/*
* 自定义默认头像
@ -662,6 +678,7 @@ function akina_body_classes($classes)
/*if(!wp_is_mobile()) {
$classes[] = 'serif';
}*/
$classes[] = $_COOKIE['dark'.akina_option('cookie_version', '')] == '1' ? 'dark' : ' ';
return $classes;
}
add_filter('body_class', 'akina_body_classes');
@ -796,7 +813,7 @@ function custom_login()
//echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('template_directory') . '/inc/login.css" />'."\n";
echo '<link rel="stylesheet" type="text/css" href="' . get_template_directory_uri() . '/inc/login.css?' . SAKURA_VERSION . '" />' . "\n";
//echo '<script type="text/javascript" src="'.get_bloginfo('template_directory').'/js/jquery.min.js"></script>'."\n";
echo '<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/jquery/jquery@1.8.2/jquery.min.js"></script>' . "\n";
echo '<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/jquery/jquery@1.9.0/jquery.min.js"></script>' . "\n";
}
add_action('login_head', 'custom_login');
@ -964,11 +981,11 @@ function comment_mail_notify($comment_id)
<h3>您有一条来自<a style="text-decoration: none;color: orange " target="_blank" href="' . home_url() . '/">' . get_option("blogname") . '</a>的回复</h3>
<br>
<p style="font-size: 14px;">您在文章《' . get_the_title($comment->comment_post_ID) . '》上发表的评论:</p>
<p style="border-bottom:#ddd 1px solid;border-left:#ddd 1px solid;padding-bottom:20px;background-color:#eee;margin:15px 0px;padding-left:20px;padding-right:20px;border-top:#ddd 1px solid;border-right:#ddd 1px solid;padding-top:20px">'
. trim(get_comment($parent_id)->comment_content) . '</p>
<div style="border-bottom:#ddd 1px solid;border-left:#ddd 1px solid;padding-bottom:20px;background-color:#eee;margin:15px 0px;padding-left:20px;padding-right:20px;border-top:#ddd 1px solid;border-right:#ddd 1px solid;padding-top:20px">'
. trim(get_comment($parent_id)->comment_content) . '</div>
<p style="font-size: 14px;">' . trim($comment->comment_author) . ' 给您的回复如下:</p>
<p style="border-bottom:#ddd 1px solid;border-left:#ddd 1px solid;padding-bottom:20px;background-color:#eee;margin:15px 0px;padding-left:20px;padding-right:20px;border-top:#ddd 1px solid;border-right:#ddd 1px solid;padding-top:20px">'
. trim($comment->comment_content) . '</p>
<div style="border-bottom:#ddd 1px solid;border-left:#ddd 1px solid;padding-bottom:20px;background-color:#eee;margin:15px 0px;padding-left:20px;padding-right:20px;border-top:#ddd 1px solid;border-right:#ddd 1px solid;padding-top:20px">'
. trim($comment->comment_content) . '</div>
<div style="text-align: center;">
<img src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.4/img/other/hr.png" alt="hr" style="width:100%;
@ -1341,7 +1358,10 @@ function memory_archives_list()
if ($mon != $mon_tmp && $mon > 0) {
$output .= '</ul></li>';
}
if ($mon == $mon_tmp && $year != $year_tmp ) {
$mon=$mon_tmp + 12;
$output .= '</ul>';
}
if ($year != $year_tmp && $year > 0) {
$output .= '</ul>';
}
@ -1757,14 +1777,6 @@ function DEFAULT_FEATURE_IMAGE()
return rest_url('sakura/v1/image/feature') . '?' . rand(1, 1000);
}
//防止设置置顶文章造成的图片同侧bug
add_action('pre_get_posts', function ($q) {
if ($q->is_home() && $q->is_main_query() && $q->get('paged') > 1) {
$q->set('post__not_in', get_option('sticky_posts'));
}
});
//评论回复
function sakura_comment_notify($comment_id)
{
@ -1810,6 +1822,7 @@ function markdown_parser($incoming_comment)
return $incoming_comment;
}
add_filter('preprocess_comment', 'markdown_parser');
remove_filter( 'comment_text', 'make_clickable', 9 );
//保存Markdown评论
function save_markdown_comment($comment_ID, $comment_approved)

View File

@ -62,6 +62,7 @@ if (akina_option('akina_meta') == true) {
<meta name="keywords" content="<?php echo $keywords; ?>" />
<?php } ?>
<link rel="shortcut icon" href="<?php echo akina_option('favicon_link', ''); ?>"/>
<meta name="theme-color" content="#31363b">
<meta http-equiv="x-dns-prefetch-control" content="on">
<?php wp_head(); ?>
<script type="text/javascript">

BIN
images/avatar.jpeg 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -17,7 +17,7 @@ class Parsedown
{
# ~
const version = '1.7.3';
const version = '1.7.4';
# ~
@ -1489,22 +1489,41 @@ class Parsedown
}
}
$permitRawHtml = false;
if (isset($Element['text']))
{
$text = $Element['text'];
}
// very strongly consider an alternative if you're writing an
// extension
elseif (isset($Element['rawHtml']))
{
$text = $Element['rawHtml'];
$allowRawHtmlInSafeMode = isset($Element['allowRawHtmlInSafeMode']) && $Element['allowRawHtmlInSafeMode'];
$permitRawHtml = !$this->safeMode || $allowRawHtmlInSafeMode;
}
if (isset($text))
{
$markup .= '>';
if (!isset($Element['nonNestables']))
if (!isset($Element['nonNestables']))
{
$Element['nonNestables'] = array();
}
if (isset($Element['handler']))
{
$markup .= $this->{$Element['handler']}($Element['text'], $Element['nonNestables']);
$markup .= $this->{$Element['handler']}($text, $Element['nonNestables']);
}
elseif (!$permitRawHtml)
{
$markup .= self::escape($text, true);
}
else
{
$markup .= self::escape($Element['text'], true);
$markup .= $text;
}
$markup .= '</'.$Element['name'].'>';

Binary file not shown.

461
inc/api.php 100644 → 100755
View File

@ -1,5 +1,18 @@
<?php
/**
* Classes
*/
include_once('classes/Aplayer.php');
include_once('classes/Bilibili.php');
include_once('classes/Cache.php');
include_once('classes/Images.php');
include_once('classes/QQ.php');
use Sakura\API\Images;
use Sakura\API\QQ;
use Sakura\API\Cache;
/**
* Router
*/
@ -32,63 +45,20 @@ add_action('rest_api_init', function () {
'methods' => 'GET',
'callback' => 'get_qq_avatar',
));
register_rest_route('sakura/v1', '/bangumi/bilibili', array(
'methods' => 'POST',
'callback' => 'bgm_bilibili',
));
register_rest_route('sakura/v1', '/meting/aplayer', array(
'methods' => 'GET',
'callback' => 'meting_aplayer',
));
});
/**
* QQ info
* https://sakura.2heng.xin/wp-json/sakura/v1/qqinfo/json
*/
function get_qq_info(WP_REST_Request $request)
{
if (!check_ajax_referer('wp_rest', '_wpnonce', false)) {
$output = array(
'status' => 403,
'success' => false,
'message' => 'Unauthorized client.'
);
} elseif ($_GET['qq']) {
$qq = $_GET['qq'];
/**
* TODO: 设置host国外服务器默认解析的不是国内IP可能无法获取数据
* 182.254.92.32 r.qzone.qq.com
* 参考https://www.php.net/manual/zh/function.file-get-contents.php#108309
*/
$get_info = file_get_contents('http://r.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?get_nick=1&uins=' . $qq);
$get_info = mb_convert_encoding($get_info, "UTF-8", "GBK");
$name = json_decode(substr($get_info, 17, -1), true);
if ($name) {
$output = array(
'status' => 200,
'success' => true,
'message' => 'success',
'avatar' => 'https://q.qlogo.cn/headimg_dl?dst_uin=' . $qq . '&spec=100',
'name' => $name[$qq][6],
);
} else {
$output = array(
'status' => 404,
'success' => false,
'message' => 'QQ number not exist.'
);
}
} else {
$output = array(
'status' => 400,
'success' => false,
'message' => 'Bad Request'
);
}
$result = new WP_REST_Response($output, $output['status']);
$result->set_headers(array('Content-Type' => 'application/json'));
return $result;
}
/**
* Image uploader response
*/
function upload_image(WP_REST_Request $request)
{
function upload_image(WP_REST_Request $request) {
// see: https://developer.wordpress.org/rest-api/requests/
// handle file params $file === $_FILES
@ -110,19 +80,19 @@ function upload_image(WP_REST_Request $request)
$result->set_headers(array('Content-Type' => 'application/json'));
return $result;
}
$images = new \Sakura\API\Images();
switch (akina_option("img_upload_api")) {
case 'imgur':
$image = file_get_contents($_FILES["cmt_img_file"]["tmp_name"]);
$API_Request = Imgur_API($image);
$API_Request = $images->Imgur_API($image);
break;
case 'smms':
$image = $_FILES;
$API_Request = SMMS_API($image);
$API_Request = $images->SMMS_API($image);
break;
case 'chevereto':
$image = file_get_contents($_FILES["cmt_img_file"]["tmp_name"]);
$API_Request = Chevereto_API($image);
$API_Request = $images->Chevereto_API($image);
break;
}
@ -131,221 +101,13 @@ function upload_image(WP_REST_Request $request)
return $result;
}
/**
* Chevereto upload interface
*/
function Chevereto_API($image)
{
$upload_url = akina_option('cheverto_url') . '/api/1/upload';
$args = array(
'body' => array(
'source' => base64_encode($image),
'key' => akina_option('chevereto_api_key'),
),
);
$response = wp_remote_post($upload_url, $args);
$reply = json_decode($response["body"]);
if ($reply->status_txt == 'OK' && $reply->status_code == 200) {
$status = 200;
$success = true;
$message = "success";
$link = $reply->image->image->url;
$proxy = akina_option('cmt_image_proxy') . $link;
} else {
$status = $reply->status_code;
$success = false;
$message = $reply->error->message;
$link = 'https://view.moezx.cc/images/2019/10/28/default_d_h_large.gif';
$proxy = akina_option('cmt_image_proxy') . $link;
}
$output = array(
'status' => $status,
'success' => $success,
'message' => $message,
'link' => $link,
'proxy' => $proxy,
);
return $output;
}
/**
* Imgur upload interface
*/
function Imgur_API($image)
{
$client_id = akina_option('imgur_client_id');
$upload_url = akina_option('imgur_upload_image_proxy');
$args = array(
'headers' => array(
'Authorization' => 'Client-ID ' . $client_id,
),
'body' => array(
'image' => base64_encode($image),
),
);
$response = wp_remote_post($upload_url, $args);
$reply = json_decode($response["body"]);
if ($reply->success && $reply->status == 200) {
$status = 200;
$success = true;
$message = "success";
$link = $reply->data->link;
$proxy = akina_option('cmt_image_proxy') . $link;
} else {
$status = $reply->status;
$success = false;
$message = $reply->data->error;
$link = 'https://view.moezx.cc/images/2019/10/28/default_d_h_large.gif';
$proxy = akina_option('cmt_image_proxy') . $link;
}
$output = array(
'status' => $status,
'success' => $success,
'message' => $message,
'link' => $link,
'proxy' => $proxy,
);
return $output;
}
/**
* smms upload interface
*/
function SMMS_API($image)
{
$client_id = akina_option('smms_client_id');
$upload_url = "https://sm.ms/api/v2/upload";
$filename = $image['cmt_img_file']['name'];
$filedata = $image['cmt_img_file']['tmp_name'];
$Boundary = wp_generate_password();
$bits = file_get_contents($filedata);
$args = array(
"headers" => "Content-Type: multipart/form-data; boundary=$Boundary\r\n\r\nAuthorization: Basic $client_id\r\n\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97",
"body" => "--$Boundary\r\nContent-Disposition: form-data; name=\"smfile\"; filename=\"$filename\"\r\n\r\n$bits\r\n\r\n--$Boundary--"
);
$response = wp_remote_post($upload_url, $args);
$reply = json_decode($response["body"]);
if ($reply->success && $reply->code == 'success') {
$status = 200;
$success = true;
$message = $reply->message;
$link = $reply->data->url;
$proxy = akina_option('cmt_image_proxy') . $link;
} else if (preg_match("/Image upload repeated limit/i", $reply->message, $matches)) {
$status = 200; // sm.ms 接口不规范,建议检测到重复的情况下返回标准化的 code并单独把 url 放进一个字段
$success = true;
$message = $reply->message;
$link = str_replace('Image upload repeated limit, this image exists at: ', '', $reply->message);
$proxy = akina_option('cmt_image_proxy') . $link;
} else {
$status = 400;
$success = false;
$message = $reply->message;
$link = 'https://view.moezx.cc/images/2019/10/28/default_d_h_large.gif';
$proxy = akina_option('cmt_image_proxy') . $link;
}
$output = array(
'status' => $status,
'success' => $success,
'message' => $message,
'link' => $link,
'proxy' => $proxy,
);
return $output;
}
/*
* 定制实时搜索 rest api
* @rest api接口路径https://sakura.2heng.xin/wp-json/sakura/v1/cache_search/json
* @可在cache_search_json()函数末尾通过设置 HTTP header 控制 json 缓存时间
*/
function cache_search_json()
{
global $more;
$vowels = array("[", "{", "]", "}", "<", ">", "\r\n", "\r", "\n", "-", "'", '"', '`', " ", ":", ";", '\\', " ", "toc");
$regex = <<<EOS
/<\/?[a-zA-Z]+("[^"]*"|'[^']*'|[^'">])*>|begin[\S\s]*\/begin|hermit[\S\s]*\/hermit|img[\S\s]*\/img|{{.*?}}|:.*?:/m
EOS;
$more = 1;
$posts = new WP_Query('posts_per_page=-1&post_status=publish&post_type=post');
while ($posts->have_posts()): $posts->the_post();
$output .= '{"type":"post","link":"' . get_permalink() . '","title":' . json_encode(get_the_title()) . ',"comments":"' . get_comments_number('0', '1', '%') . '","text":' . json_encode(str_replace($vowels, " ", preg_replace($regex, ' ', apply_filters( 'the_content', get_the_content())))) . '},';
endwhile;
wp_reset_postdata();
$pages = new WP_Query('posts_per_page=-1&post_status=publish&post_type=page');
while ($pages->have_posts()): $pages->the_post();
$output .= '{"type":"page","link":"' . get_permalink() . '","title":' . json_encode(get_the_title()) . ',"comments":"' . get_comments_number('0', '1', '%') . '","text":' . json_encode(str_replace($vowels, " ", preg_replace($regex, ' ', apply_filters( 'the_content', get_the_content())))) . '},';
endwhile;
wp_reset_postdata();
$tags = get_tags();
foreach ($tags as $tag) {
$output .= '{"type":"tag","link":"' . get_term_link($tag) . '","title":' . json_encode($tag->name) . ',"comments":"","text":""},';
}
$categories = get_categories();
foreach ($categories as $category) {
$output .= '{"type":"category","link":"' . get_term_link($category) . '","title":' . json_encode($category->name) . ',"comments":"","text":""},';
}
if (akina_option('live_search_comment')) {
$comments = get_comments();
foreach ($comments as $comment) {
$is_private = get_comment_meta($comment->comment_ID, '_private', true);
if ($is_private) {
$output .= '{"type":"comment","link":"' . get_comment_link($comment) . '","title":' . json_encode(get_the_title($comment->comment_post_ID)) . ',"comments":"","text":' . json_encode($comment->comment_author . "" . __("The comment is private", "sakura") /*该评论为私密评论*/) . '},';
continue;
} else {
$output .= '{"type":"comment","link":"' . get_comment_link($comment) . '","title":' . json_encode(get_the_title($comment->comment_post_ID)) . ',"comments":"","text":' . json_encode(str_replace($vowels, " ", preg_replace($regex, " ", $comment->comment_author . "" . $comment->comment_content))) . '},';
}
}
}
$output = substr($output, 0, strlen($output) - 1);
$data = '[' . $output . ']';
$result = new WP_REST_Response(json_decode($data), 200);
$result->set_headers(
array(
'Content-Type' => 'application/json',
'Cache-Control' => 'max-age=3600', // json 缓存控制
)
);
return $result;
}
/*
* 随机封面图 rest api
* @rest api接口路径https://sakura.2heng.xin/wp-json/sakura/v1/image/cover
*/
function cover_gallery() {
if(akina_option('cover_cdn_options')=="type_2"){
$img_array = glob(get_template_directory() . "/manifest/gallary/*.{gif,jpg,png}",GLOB_BRACE);
$img = array_rand($img_array);
$imgurl = trim($img_array[$img]);
$imgurl = str_replace(get_template_directory(), get_template_directory_uri(), $imgurl);
}elseif(akina_option('cover_cdn_options')=="type_3"){
$imgurl = akina_option('cover_cdn');
}else{
global $sakura_image_array;
$img_array = json_decode($sakura_image_array, true);
$img = array_rand($img_array);
$img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory_uri();
if(strpos($_SERVER['HTTP_ACCEPT'], 'image/webp')) {
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["webp"][0];
} else {
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["jpeg"][0];
}
}
$imgurl = Images::cover_gallery();
$data = array('cover image');
$response = new WP_REST_Response($data);
$response->set_status(302);
@ -358,7 +120,12 @@ function cover_gallery() {
* @rest api接口路径https://sakura.2heng.xin/wp-json/sakura/v1/image/feature
*/
function feature_gallery() {
return cover_gallery();
$imgurl = Images::feature_gallery();
$data = array('feature image');
$response = new WP_REST_Response($data);
$response->set_status(302);
$response->header('Location', $imgurl);
return $response;
}
/*
@ -366,59 +133,135 @@ function feature_gallery() {
* @rest api接口路径https://sakura.2heng.xin/wp-json/sakura/v1/database/update
*/
function update_database() {
if(akina_option('cover_cdn_options')=="type_1"){
global $wpdb;
$sakura_table_name = $wpdb->base_prefix.'sakura';
$img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory();
$manifest = file_get_contents($img_domain . "/manifest/manifest.json");
if($manifest) {
$manifest = array(
"mate_key" => "manifest_json",
"mate_value" => $manifest
);
$time = array(
"mate_key" => "json_time",
"mate_value" => date("Y-m-d H:i:s",time())
);
$wpdb->query("DELETE FROM $sakura_table_name WHERE `mate_key` ='manifest_json'");
$wpdb->query("DELETE FROM $sakura_table_name WHERE `mate_key` ='json_time'");
$wpdb->insert($sakura_table_name,$manifest);
$wpdb->insert($sakura_table_name,$time);
$output = "manifest.json has been stored into database.";
}else{
$output = "manifest.json not found, please ensure your url ($img_domain) is corrent.";
}
if (akina_option('cover_cdn_options') == "type_1") {
$output = Cache::update_database();
$result = new WP_REST_Response($output, 200);
return $result;
}else{
} else {
return new WP_REST_Response("Invalid access", 200);
}
}
/*
* 定制实时搜索 rest api
* @rest api接口路径https://sakura.2heng.xin/wp-json/sakura/v1/cache_search/json
* @可在cache_search_json()函数末尾通过设置 HTTP header 控制 json 缓存时间
*/
function cache_search_json() {
if (!check_ajax_referer('wp_rest', '_wpnonce', false)) {
$output = array(
'status' => 403,
'success' => false,
'message' => 'Unauthorized client.'
);
$result = new WP_REST_Response($output, 403);
} else {
$output = Cache::search_json();
$result = new WP_REST_Response($output, 200);
}
$result->set_headers(
array(
'Content-Type' => 'application/json',
'Cache-Control' => 'max-age=3600', // json 缓存控制
)
);
return $result;
}
/**
* QQ info
* https://sakura.2heng.xin/wp-json/sakura/v1/qqinfo/json
*/
function get_qq_info(WP_REST_Request $request) {
if (!check_ajax_referer('wp_rest', '_wpnonce', false)) {
$output = array(
'status' => 403,
'success' => false,
'message' => 'Unauthorized client.'
);
} elseif ($_GET['qq']) {
$qq = $_GET['qq'];
$output = QQ::get_qq_info($qq);
} else {
$output = array(
'status' => 400,
'success' => false,
'message' => 'Bad Request'
);
}
$result = new WP_REST_Response($output, $output['status']);
$result->set_headers(array('Content-Type' => 'application/json'));
return $result;
}
/**
* QQ头像链接解密
* https://sakura.2heng.xin/wp-json/sakura/v1/qqinfo/avatar
*/
function get_qq_avatar(){
global $sakura_privkey;
$encrypted=$_GET["qq"];
if(isset($encrypted)){
$iv = str_repeat($sakura_privkey, 2);
$encrypted = base64_decode(urldecode($encrypted));
$qq_number = openssl_decrypt($encrypted, 'aes-128-cbc', $sakura_privkey, 0, $iv);
preg_match('/^\d{3,}$/', $qq_number, $matches);
$imgurl='https://q2.qlogo.cn/headimg_dl?dst_uin='.$matches[0].'&spec=100';
if(akina_option('qq_avatar_link')=='type_2'){
$imgdata = file_get_contents($imgurl);
header("Content-type: image/jpeg");
header("Cache-Control: max-age=86400");
echo $imgdata;
}else{
function get_qq_avatar() {
$encrypted = $_GET["qq"];
$imgurl = QQ::get_qq_avatar($encrypted);
if (akina_option('qq_avatar_link') == 'type_2') {
$imgdata = file_get_contents($imgurl);
$response = new WP_REST_Response();
$response->set_headers(array(
'Content-Type' => 'image/jpeg',
'Cache-Control' => 'max-age=86400'
));
echo $imgdata;
} else {
$response = new WP_REST_Response();
$response->set_status(301);
$response->header('Location', $imgurl);
}
return $response;
}
function bgm_bilibili() {
if (!check_ajax_referer('wp_rest', '_wpnonce', false)) {
$output = array(
'status' => 403,
'success' => false,
'message' => 'Unauthorized client.'
);
$response = new WP_REST_Response($output, 403);
} else {
$page = $_GET["page"] ?: 2;
$bgm = new \Sakura\API\Bilibili();
$html = preg_replace("/\s+|\n+|\r/", ' ', $bgm->get_bgm_items($page));
$response = new WP_REST_Response($html, 200);
}
return $response;
}
function meting_aplayer() {
$type = $_GET['type'];
$id = $_GET['id'];
$wpnonce = $_GET['_wpnonce'];
$meting_pnonce = $_GET['meting_pnonce'];
if ((isset($wpnonce) && !check_ajax_referer('wp_rest', $wpnonce, false)) || (isset($nonce) && !wp_verify_nonce($nonce, $type . '#:' . $id))) {
$output = array(
'status' => 403,
'success' => false,
'message' => 'Unauthorized client.'
);
$response = new WP_REST_Response($output, 403);
} else {
$Meting_API = new \Sakura\API\Aplayer();
$data = $Meting_API->get_data($type, $id);
if ($type === 'playlist') {
$response = new WP_REST_Response($data, 200);
$response->set_headers(array('cache-control' => 'max-age=3600'));
} elseif ($type === 'lyric') {
$response = new WP_REST_Response();
$response->set_headers(array('cache-control' => 'max-age=3600'));
echo $data;
} else {
$response = new WP_REST_Response();
$response->set_status(301);
$response->header('Location', $imgurl);
return $response;
$response->header('Location', $data);
}
}
}
}
return $response;
}

View File

@ -0,0 +1,156 @@
<?php
namespace Sakura\API;
class Aplayer
{
public $server;
public $playlist_id;
private $cookies;
public $api_url;
public function __construct() {
$this->server = akina_option('aplayer_server');
$this->playlist_id = akina_option('aplayer_playlistid');
$this->cookies = akina_option('aplayer_cookie');
$this->api_url = rest_url('sakura/v1/meting/aplayer');
require('Meting.php');
}
public function get_data($type, $id) {
$server = $this->server;
$cookies = $this->cookies;
$playlist_id = $this->playlist_id;
$api = new \Sakura\API\Meting($server);
if (!empty($cookies) && $server === "netease") $api->cookie($cookies);
switch ($type) {
case 'song':
$data = $api->format(true)->song($id);
$data = json_decode($data, true)["url"];
$data = $this->song_url($data);
break;
// case 'album':
// $data = $api->format(true)->album($id);
// $data=json_decode($data, true)["url"];
// break;
case 'playlist':
$data = $api->format(true)->playlist($playlist_id);
$data = $this->format_playlist($data);
break;
case 'lyric':
$data = $api->format(true)->lyric($id);
$data = $this->format_lyric($data);
break;
case 'pic':
$data = $api->format(true)->pic($id);
$data = json_decode($data, true)["url"];
break;
// case 'search':
// $data = $api->format(true)->search($id);
// $data=json_decode($data, true);
// break;
default:
$data = $api->format(true)->url($id);
$data = json_decode($data, true)["url"];
$data = $this->song_url($data);
break;
}
return $data;
}
private function format_playlist($data) {
$server = $this->server;
$api_url = $this->api_url;
$data = json_decode($data);
$playlist = array();
foreach ((array)$data as $value) {
$name = $value->name;
$artists = implode(" / ", (array)$value->artist);
$mp3_url = "$api_url?server=$server&type=url&id=" . $value->url_id . '&meting_nonce=' . wp_create_nonce('url#:' . $value->url_id);
$cover = "$api_url?server=$server&type=pic&id=" . $value->pic_id . '&meting_nonce=' . wp_create_nonce('pic#:' . $value->url_id);
$lyric = "$api_url?server=$server&type=lyric&id=" . $value->lyric_id . '&meting_nonce=' . wp_create_nonce('lyric#:' . $value->url_id);
$playlist[] = array(
"name" => $name,
"artist" => $artists,
"url" => $mp3_url,
"cover" => $cover,
"lrc" => $lyric
);
}
return $playlist;
}
private function song_url($url){
$server = $this->server;
if ($server == 'netease') {
$url = str_replace('://m7c.', '://m7.', $url);
$url = str_replace('://m8c.', '://m8.', $url);
$url = str_replace('http://m8.', 'https://m9.', $url);
$url = str_replace('http://m7.', 'https://m9.', $url);
$url = str_replace('http://m10.', 'https://m10.', $url);
}elseif ($server == 'xiami') {
$url = str_replace('http://', 'https://', $url);
}elseif ($server == 'baidu') {
$url = str_replace('http://zhangmenshiting.qianqian.com', 'https://gss3.baidu.com/y0s1hSulBw92lNKgpU_Z2jR7b2w6buu', $url);
}else{
$url = $url;
}
return $url;
}
private function format_lyric($data) {
$server = $this->server;
$data = json_decode($data, true);
$data = $this->lrctran($data['lyric'], $data['tlyric']);
if (empty($data)) {
$data = "[00:00.000]此歌曲暂无歌词,请您欣赏";
}
if ($server === 'tencent') {
$data = html_entity_decode($data, ENT_QUOTES | ENT_HTML5);
}
return $data;
}
private function lrctran($lyric, $tlyric) {
$lyric = $this->lrctrim($lyric);
$tlyric = $this->lrctrim($tlyric);
$len1 = count($lyric);
$len2 = count($tlyric);
$result = "";
for ($i = 0, $j = 0; $i < $len1 && $j < $len2; $i++) {
while ($lyric[$i][0] > $tlyric[$j][0] && $j + 1 < $len2) {
$j++;
}
if ($lyric[$i][0] == $tlyric[$j][0]) {
$tlyric[$j][2] = str_replace('/', '', $tlyric[$j][2]);
if (!empty($tlyric[$j][2])) {
$lyric[$i][2] .= " ({$tlyric[$j][2]})";
}
$j++;
}
}
for ($i = 0; $i < $len1; $i++) {
$t = $lyric[$i][0];
$result .= sprintf("[%02d:%02d.%03d]%s\n", $t / 60000, $t % 60000 / 1000, $t % 1000, $lyric[$i][2]);
}
return $result;
}
private function lrctrim($lyrics) {
$lyrics = explode("\n", $lyrics);
$data = array();
foreach ($lyrics as $key => $lyric) {
preg_match('/\[(\d{2}):(\d{2}[\.:]?\d*)]/', $lyric, $lrcTimes);
$lrcText = preg_replace('/\[(\d{2}):(\d{2}[\.:]?\d*)]/', '', $lyric);
if (empty($lrcTimes)) {
continue;
}
$lrcTimes = intval($lrcTimes[1]) * 60000 + intval(floatval($lrcTimes[2]) * 1000);
$lrcText = preg_replace('/\s\s+/', ' ', $lrcText);
$lrcText = trim($lrcText);
$data[] = array($lrcTimes, $key, $lrcText);
}
sort($data);
return $data;
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace Sakura\API;
class Bilibili
{
private $uid;
private $cookies;
public function __construct() {
$this->uid = akina_option('bilibili_id');
$this->cookies = akina_option('bilibili_cookie');
}
public function get_the_bgm_items($page = 1) {
$uid = $this->uid;
$cookies = $this->cookies;
$url = 'https://api.bilibili.com/x/space/bangumi/follow/list?type=1&pn=' . $page . '&ps=15&follow_status=0&vmid=' . $uid;
$args = array(
'headers' => array(
'Cookie' => $cookies,
'Host' => 'api.bilibili.com',
'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97'
)
);
$response = wp_remote_get($url, $args);
$bgmdata = json_decode($response["body"])->data;
return json_encode($bgmdata);
}
public function get_bgm_items($page = 1) {
$bgm = json_decode($this->get_the_bgm_items($page), true);
$totalpage = $bgm["total"] / 15;
if ($totalpage - $page < 0) {
$next = '<span>共追番' . $bgm["total"] . '部,继续加油吧!٩(ˊᗜˋ*)و</span>';
} else {
$next = '<a class="bangumi-next" href="' . rest_url('sakura/v1/bangumi/bilibili') . '?page=' . ++$page . '"><i class="fa fa-bolt" aria-hidden="true"></i> NEXT </a>';
}
$lists = $bgm["list"];
$html = "";
foreach ((array)$lists as $list) {
if (preg_match('/看完/m', $list["progress"], $matches_finish)) {
$percent = 100;
} else {
preg_match('/第(\d+)./m', $list['progress'], $matches_progress);
preg_match('/第(\d+)./m', $list["new_ep"]['index_show'], $matches_new);
$progress = is_numeric($matches_progress[1]) ? $matches_progress[1] : 0;
$total = is_numeric($matches_new[1]) ? $matches_new[1] : $list['total_count'];
$percent = $progress / $total * 100;
}
$html .= '<div class="column">
<a class="bangumi-item" href="https://bangumi.bilibili.com/anime/' . $list['season_id'] . '/" target="_blank" rel="nofollow">
<img class="bangumi-image" src="' . str_replace('http://', 'https://', $list['cover']) . '"/>
<div class="bangumi-info">
<h3 class="bangumi-title" title="' . $list['title'] . '">' . $list['title'] . '</h2>
<div class="bangumi-summary"> ' . $list['evaluate'] . ' </div>
<div class="bangumi-status">
<div class="bangumi-status-bar" style="width: ' . $percent . '%"></div>
<p>' . $list['new_ep']['index_show'] . '</p>
</div>
</div>
</a>
</div>';
}
$html .= '</div><br><div id="bangumi-pagination">' . $next . '</div>';
return $html;
}
}

View File

@ -0,0 +1,103 @@
<?php
namespace Sakura\API;
class Cache
{
public static function search_json() {
global $more;
$vowels = array("[", "{", "]", "}", "<", ">", "\r\n", "\r", "\n", "-", "'", '"', '`', " ", ":", ";", '\\', " ", "toc");
$regex = <<<EOS
/<\/?[a-zA-Z]+("[^"]*"|'[^']*'|[^'">])*>|begin[\S\s]*\/begin|hermit[\S\s]*\/hermit|img[\S\s]*\/img|{{.*?}}|:.*?:/m
EOS;
$more = 1;
$output = array();
$posts = new \WP_Query('posts_per_page=-1&post_status=publish&post_type=post');
while ($posts->have_posts()): $posts->the_post();
$output[] = array(
"type" => "post",
"link" => get_permalink(),
"title" => get_the_title(),
"comments" => get_comments_number('0', '1', '%'),
"text" => str_replace($vowels, " ", preg_replace($regex, ' ', apply_filters('the_content', get_the_content())))
);
endwhile;
wp_reset_postdata();
$pages = new \WP_Query('posts_per_page=-1&post_status=publish&post_type=page');
while ($pages->have_posts()): $pages->the_post();
$output[] = array(
"type" => "page",
"link" => get_permalink(),
"title" => get_the_title(),
"comments" => get_comments_number('0', '1', '%'),
"text" => str_replace($vowels, " ", preg_replace($regex, ' ', apply_filters('the_content', get_the_content())))
);
endwhile;
wp_reset_postdata();
$tags = get_tags();
foreach ($tags as $tag) {
$output[] = array(
"type" => "tag",
"link" => get_term_link($tag),
"title" => $tag->name,
"comments" => "",
"text" => ""
);
}
$categories = get_categories();
foreach ($categories as $category) {
$output[] = array(
"type" => "category",
"link" => get_term_link($category),
"title" => $category->name,
"comments" => "",
"text" => ""
);
}
if (akina_option('live_search_comment')) {
$comments = get_comments();
foreach ($comments as $comment) {
$is_private = get_comment_meta($comment->comment_ID, '_private', true);
$output[] = array(
"type" => "comment",
"link" => get_comment_link($comment),
"title" => get_the_title($comment->comment_post_ID),
"comments" => "",
"text" => $is_private ? ($comment->comment_author . ": " . __('The comment is private', 'sakura')) : str_replace($vowels, ' ', preg_replace($regex, ' ', $comment->comment_author . "" . $comment->comment_content))
);
}
}
return $output;
}
public static function update_database() {
global $wpdb;
$sakura_table_name = $wpdb->base_prefix . 'sakura';
$img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory();
$manifest = file_get_contents($img_domain . "/manifest/manifest.json");
if ($manifest) {
$manifest = array(
"mate_key" => "manifest_json",
"mate_value" => $manifest
);
$time = array(
"mate_key" => "json_time",
"mate_value" => date("Y-m-d H:i:s", time())
);
$wpdb->query("DELETE FROM $sakura_table_name WHERE `mate_key` ='manifest_json'");
$wpdb->query("DELETE FROM $sakura_table_name WHERE `mate_key` ='json_time'");
$wpdb->insert($sakura_table_name, $manifest);
$wpdb->insert($sakura_table_name, $time);
$output = "manifest.json has been stored into database.";
} else {
$output = "manifest.json not found, please ensure your url ($img_domain) is corrent.";
}
return $output;
}
}

View File

@ -0,0 +1,174 @@
<?php
namespace Sakura\API;
class Images
{
private $chevereto_api_key;
private $imgur_client_id;
private $smms_client_id;
public function __construct() {
$this->chevereto_api_key = akina_option('chevereto_api_key');
$this->imgur_client_id = akina_option('imgur_client_id');
$this->smms_client_id = akina_option('smms_client_id');
}
/**
* Chevereto upload interface
*/
public function Chevereto_API($image) {
$upload_url = akina_option('cheverto_url') . '/api/1/upload';
$args = array(
'body' => array(
'source' => base64_encode($image),
'key' => $this->chevereto_api_key,
),
);
$response = wp_remote_post($upload_url, $args);
$reply = json_decode($response["body"]);
if ($reply->status_txt == 'OK' && $reply->status_code == 200) {
$status = 200;
$success = true;
$message = "success";
$link = $reply->image->image->url;
$proxy = akina_option('cmt_image_proxy') . $link;
} else {
$status = $reply->status_code;
$success = false;
$message = $reply->error->message;
$link = 'https://view.moezx.cc/images/2019/10/28/default_d_h_large.gif';
$proxy = akina_option('cmt_image_proxy') . $link;
}
$output = array(
'status' => $status,
'success' => $success,
'message' => $message,
'link' => $link,
'proxy' => $proxy,
);
return $output;
}
/**
* Imgur upload interface
*/
public function Imgur_API($image) {
$upload_url = akina_option('imgur_upload_image_proxy');
$args = array(
'headers' => array(
'Authorization' => 'Client-ID ' . $this->imgur_client_id,
),
'body' => array(
'image' => base64_encode($image),
),
);
$response = wp_remote_post($upload_url, $args);
$reply = json_decode($response["body"]);
if ($reply->success && $reply->status == 200) {
$status = 200;
$success = true;
$message = "success";
$link = $reply->data->link;
$proxy = akina_option('cmt_image_proxy') . $link;
} else {
$status = $reply->status;
$success = false;
$message = $reply->data->error;
$link = 'https://view.moezx.cc/images/2019/10/28/default_d_h_large.gif';
$proxy = akina_option('cmt_image_proxy') . $link;
}
$output = array(
'status' => $status,
'success' => $success,
'message' => $message,
'link' => $link,
'proxy' => $proxy,
);
return $output;
}
/**
* smms upload interface
*/
public function SMMS_API($image) {
$client_id = $this->smms_client_id;
$upload_url = "https://sm.ms/api/v2/upload";
$filename = $image['cmt_img_file']['name'];
$filedata = $image['cmt_img_file']['tmp_name'];
$Boundary = wp_generate_password();
$bits = file_get_contents($filedata);
$args = array(
"headers" => "Content-Type: multipart/form-data; boundary=$Boundary\r\n\r\nAuthorization: Basic $client_id\r\n\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97",
"body" => "--$Boundary\r\nContent-Disposition: form-data; name=\"smfile\"; filename=\"$filename\"\r\n\r\n$bits\r\n\r\n--$Boundary--"
);
$response = wp_remote_post($upload_url, $args);
$reply = json_decode($response["body"]);
if ($reply->success && $reply->code == 'success') {
$status = 200;
$success = true;
$message = $reply->message;
$link = $reply->data->url;
$proxy = akina_option('cmt_image_proxy') . $link;
} else if (preg_match("/Image upload repeated limit/i", $reply->message, $matches)) {
$status = 200; // sm.ms 接口不规范,建议检测到重复的情况下返回标准化的 code并单独把 url 放进一个字段
$success = true;
$message = $reply->message;
$link = str_replace('Image upload repeated limit, this image exists at: ', '', $reply->message);
$proxy = akina_option('cmt_image_proxy') . $link;
} else {
$status = 400;
$success = false;
$message = $reply->message;
$link = 'https://view.moezx.cc/images/2019/10/28/default_d_h_large.gif';
$proxy = akina_option('cmt_image_proxy') . $link;
}
$output = array(
'status' => $status,
'success' => $success,
'message' => $message,
'link' => $link,
'proxy' => $proxy,
);
return $output;
}
public static function cover_gallery() {
if (akina_option('cover_cdn_options') == "type_2") {
$img_array = glob(get_template_directory() . "/manifest/gallary/*.{gif,jpg,png}", GLOB_BRACE);
$img = array_rand($img_array);
$imgurl = trim($img_array[$img]);
$imgurl = str_replace(get_template_directory(), get_template_directory_uri(), $imgurl);
} elseif (akina_option('cover_cdn_options') == "type_3") {
$imgurl = akina_option('cover_cdn');
} else {
global $sakura_image_array;
$img_array = json_decode($sakura_image_array, true);
$img = array_rand($img_array);
$img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory_uri();
if (strpos($_SERVER['HTTP_ACCEPT'], 'image/webp') !== false) {
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["webp"][0];
} else {
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["jpeg"][0];
}
}
return $imgurl;
}
public static function feature_gallery() {
if (akina_option('post_cover_options') == "type_2") {
$imgurl = akina_option('post_cover');
} else {
$imgurl = self::cover_gallery();
}
return $imgurl;
}
}

File diff suppressed because it is too large Load Diff

40
inc/classes/QQ.php 100644
View File

@ -0,0 +1,40 @@
<?php
namespace Sakura\API;
class QQ
{
public static function get_qq_info($qq) {
$get_info = file_get_contents('http://r.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?get_nick=1&uins=' . $qq);
$get_info = mb_convert_encoding($get_info, "UTF-8", "GBK");
$name = json_decode(substr($get_info, 17, -1), true);
if ($name) {
$output = array(
'status' => 200,
'success' => true,
'message' => 'success',
'avatar' => 'https://q.qlogo.cn/headimg_dl?dst_uin=' . $qq . '&spec=100',
'name' => $name[$qq][6],
);
} else {
$output = array(
'status' => 404,
'success' => false,
'message' => 'QQ number not exist.'
);
}
return $output;
}
public static function get_qq_avatar($encrypted) {
global $sakura_privkey;
if (isset($encrypted)) {
$iv = str_repeat($sakura_privkey, 2);
$encrypted = base64_decode(urldecode($encrypted));
$qq_number = openssl_decrypt($encrypted, 'aes-128-cbc', $sakura_privkey, 0, $iv);
preg_match('/^\d{3,}$/', $qq_number, $matches);
$imgurl = 'https://q2.qlogo.cn/headimg_dl?dst_uin=' . $matches[0] . '&spec=100';
return $imgurl;
}
}
}

View File

@ -8,7 +8,7 @@ body {
.nav-tab-wrapper {
position: relative;
max-width: 860px;
max-width: 900px;
margin: auto !important;
}
@ -37,7 +37,7 @@ body {
.nav-tab {
background: none;
border:none;
padding: 10px 20px;
padding: 10px 15px;
font-weight: 300;
font-size: 15px;
color: darkgoldenrod;
@ -74,17 +74,23 @@ a#options-group-4-tab:before {
a#options-group-5-tab:before {
font-family: "dashicons";
content: "\f110";
content: "\f101";
float: left;
}
a#options-group-6-tab:before {
font-family: "dashicons";
content: "\f110";
float: left;
}
a#options-group-7-tab:before {
font-family: "dashicons";
content: "\f325";
float: left;
}
a#options-group-7-tab:before {
a#options-group-8-tab:before {
font-family: "dashicons";
content: "\f487";
float: left;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -188,9 +188,7 @@ color: #676767 !important}
}
input[type=checkbox]:checked:before {
content: "\f147";
margin: -2px 0 0 -2px;
color: #FF5656;
}
/* loading */

View File

@ -37,6 +37,8 @@ mashiro_option.skin_bg6 = "https://api.mashiro.top/bing/";
mashiro_option.skin_bg7 = "https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.2/other-sites/api-index/images/me.png";
<?php } ?>
mashiro_option.darkmode = <?php if ( akina_option('darkmode') ){ echo 'true'; } else { echo 'false'; } ?>;
<?php if( is_home() ){ ?>
mashiro_option.land_at_home = true;
<?php }else {?>
@ -67,8 +69,9 @@ mashiro_option.jsdelivr_css_src = "<?php echo get_template_directory_uri() ?>/cd
<?php } else { ?>
mashiro_option.jsdelivr_css_src = "https://cdn.jsdelivr.net/gh/mashirozx/Sakura@<?php echo SAKURA_VERSION; ?>/cdn/css/lib.min.css";
<?php } ?>
<?php if (akina_option('playlist_id', '')): ?>
<?php if (akina_option('aplayer_server') != 'off'): ?>
mashiro_option.float_player_on = true;
mashiro_option.meting_api_url = "<?php echo rest_url('sakura/v1/meting/aplayer'); ?>";
<?php endif; ?>
mashiro_option.cover_api = "<?php echo rest_url('sakura/v1/image/cover'); ?>";

View File

@ -17,6 +17,7 @@ mashiro_global.ini = new function () {
coverVideoIni();
checkskinSecter();
scrollBar();
load_bangumi();
}
this.pjax = function () { // pjax reload functions (pjax 重载函数)
pjaxInit();
@ -25,6 +26,7 @@ mashiro_global.ini = new function () {
copy_code_block();
coverVideoIni();
checkskinSecter();
load_bangumi();
}
}
@ -77,14 +79,21 @@ function post_list_show_animation() {
function callback(entries) {
entries.forEach((article) => {
if (article.target.classList.contains("post-list-show")) {
if (!window.IntersectionObserver) {
article.target.style.willChange = 'auto';
io.unobserve(article.target)
} else {
if (article.isIntersecting) {
if( article.target.classList.contains("post-list-show") === false){
article.target.classList.add("post-list-show");
}
} else {
if (article.target.classList.contains("post-list-show")) {
article.target.style.willChange = 'auto';
io.unobserve(article.target)
} else {
if (article.isIntersecting) {
article.target.classList.add("post-list-show");
article.target.style.willChange = 'auto';
io.unobserve(article.target)
}
}
}
})
@ -137,7 +146,7 @@ function code_highlight_style() {
}
var ele_name = $('pre:eq(' + i + ')')[0].children[0].className;
var lang = ele_name.substr(0, ele_name.indexOf(" ")).replace('language-', '');
if (lang.toLowerCase() == "hljs") var lang = "text";
if (lang.toLowerCase() == "hljs") var lang = $('pre:eq(' + i + ') code').attr("class").replace('hljs', '')?$('pre:eq(' + i + ') code').attr("class").replace('hljs', ''):"text";
$('pre:eq(' + i + ')').addClass('highlight-wrap');
for (var t in attributes) {
$('pre:eq(' + i + ')').attr(t, attributes[t]);
@ -320,10 +329,49 @@ function checkBgImgCookie() {
$("#" + bgurl).click();
}
}
if (document.body.clientWidth > 860) {
setTimeout(function () {
checkBgImgCookie();
}, 100);
function checkDarkModeCookie() {
var dark = getCookie("dark"),
today = new Date(),
hour = today.getHours();
if (mashiro_option.darkmode && ((!dark && (hour > 21 || hour < 7) ) || (dark == '1' && (hour >= 22 || hour <= 6)))) {
setTimeout(function () {
$("#dark-bg").click();
}, 100);
$("#moblieDarkLight").html('<i class="fa fa-sun-o" aria-hidden="true"></i>');
} else {
if (document.body.clientWidth > 860) {
setTimeout(function () {
checkBgImgCookie();
}, 100);
} else {
$("html").css("background", "unset");
$("body").removeClass("dark");
$("#moblieDarkLight").html('<i class="fa fa-moon-o" aria-hidden="true"></i>');
setCookie("dark", "0", 0.33);
}
}
}
if (!getCookie("darkcache") && (new Date().getHours() > 21 || new Date().getHours() < 7)) {
removeCookie("dark");
setCookie("darkcache", "cached", 0.4);
}
setTimeout(function() {
checkDarkModeCookie();
}, 100);
function mobile_dark_light() {
if ($("body").hasClass("dark")) {
$("html").css("background", "unset");
$("body").removeClass("dark");
$("#moblieDarkLight").html('<i class="fa fa-moon-o" aria-hidden="true"></i>');
setCookie("dark", "0", 0.33);
} else {
$("html").css("background", "#31363b");
$("#moblieDarkLight").html('<i class="fa fa-sun-o" aria-hidden="true"></i>');
$("body").addClass("dark");
setCookie("dark", "1", 0.33);
}
}
function no_right_click() {
@ -336,13 +384,12 @@ $(document).ready(function () {
function checkskin_bg(a) {
return a == "none" ? "" : a
}
function changeBG() {
var cached = $(".menu-list");
cached.find("li").each(function () {
var tagid = this.id;
cached.on("click", "#" + tagid, function () {
if (tagid == "white-bg") {
if (tagid == "white-bg" || tagid == "dark-bg") {
mashiro_global.variables.skinSecter = true;
checkskinSecter();
} else {
@ -350,9 +397,22 @@ $(document).ready(function () {
checkskinSecter();
}
if (tagid == "dark-bg") {
$("#night-mode-cover").css("visibility", "visible");
} else
$("#night-mode-cover").css("visibility", "hidden");
addComment.I("content").classList.add('notransition');
addComment.I("content").style.backgroundColor = "#fff";
addComment.I("content").offsetHeight;
addComment.I("content").classList.remove('notransition');
$("html").css("background", "#31363b");
$("body").addClass("dark");
setCookie("dark", "1", 0.33);
} else{
$("html").css("background", "unset");
$("body").removeClass("dark");
setCookie("dark", "0", 0.33);
setCookie("bgImgSetting", tagid, 30);
setTimeout(function () {
addComment.I("content").style.backgroundColor = "rgba(255, 255, 255, 0.8)";
}, 1000);
}
switch (tagid) {
case "white-bg":
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg0) + ")");
@ -375,11 +435,10 @@ $(document).ready(function () {
case "bing-bg":
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg6) + ")");
break;
case "dark-bg":
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg7) + ")");
break;
// case "dark-bg":
// $("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg7) + ")");
// break;
}
setCookie("bgImgSetting", tagid, 30);
closeSkinMenu();
});
});
@ -421,14 +480,9 @@ $(document).ready(function () {
});
function topFunction() {
if ('scrollBehavior' in document.documentElement.style) {
window.scrollTo({
top: 0,
behavior: "smooth"
})
} else {
window.scrollSmoothTo(0)
}
$('body,html').animate({
scrollTop: 0
})
}
function timeSeriesReload(flag) {
@ -817,7 +871,7 @@ if (mashiro_option.float_player_on) {
}
});
}
var b = 'https://api.i-meto.com/meting/api?server=:server&type=:type&id=:id&r=:r';
var b = mashiro_option.meting_api_url + '?server=:server&type=:type&id=:id&_wpnonce=' + Poi.nonce;
'undefined' != typeof meting_api && (b = meting_api);
for (var f = 0; f < aplayers.length; f++) try {
aplayers[f].destroy()
@ -830,7 +884,7 @@ if (mashiro_option.float_player_on) {
f = d.dataset.id;
if (f) {
var g = d.dataset.api || b;
g = g.replace(':server', d.dataset.server), g = g.replace(':type', d.dataset.type), g = g.replace(':id', d.dataset.id), g = g.replace(':auth', d.dataset.auth), g = g.replace(':r', Math.random());
g = g.replace(':server', d.dataset.server), g = g.replace(':type', d.dataset.type), g = g.replace(':id', d.dataset.id);
var h = new XMLHttpRequest;
h.onreadystatechange = function () {
if (4 === h.readyState && (200 <= h.status && 300 > h.status || 304 === h.status)) {
@ -929,27 +983,6 @@ function getqqinfo() {
}
});
}
// $.ajax({
// type: 'get',
// url: mashiro_option.qq_avatar_api_url + '?type=getqqavatar&qq=' + qq,
// dataType: 'jsonp',
// jsonp: 'callback',
// jsonpCallback: 'qqavatarCallBack',
// success: function (data) {
// $('div.comment-user-avatar img').attr('src', data[qq]);
// setCookie('user_avatar', data[qq], 30);
// },
// error: function () {
// cached.filter('#qq,#email,#url').val('');
// if (!cached.filter('#qq').val()) {
// $('.qq-check').css('display', 'none');
// $('.gravatar-check').css('display', 'block');
// setCookie('user_qq', '', 30);
// $('div.comment-user-avatar img').attr('src', get_gravatar(cached.filter('#email').val(), 80));
// setCookie('user_avatar', get_gravatar(cached.filter('#email').val(), 80), 30);
// }
// }
// });
});
if (getCookie('user_avatar') && getCookie('user_email') && getCookie('is_user_qq') == 'no' && !getCookie('user_qq_email')) {
$('div.comment-user-avatar img').attr('src', getCookie('user_avatar'));
@ -1011,6 +1044,29 @@ setTimeout(function () {
activate_widget();
}, 100);
function load_bangumi() {
if ($("section").hasClass("bangumi")) {
$('body').on('click', '#bangumi-pagination a', function () {
$("#bangumi-pagination a").addClass("loading").text("");
var xhr = new XMLHttpRequest();
xhr.open('POST', this.href + "&_wpnonce=" + Poi.nonce, true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 ) {
if(xhr.status == 200){
var html = JSON.parse(xhr.responseText);
$("#bangumi-pagination").remove();
$(".row").append(html);
}else{
$("#bangumi-pagination a").removeClass("loading").html('<i class="fa fa-exclamation-triangle" aria-hidden="true"></i> ERROR ');
}
}
};
xhr.send();
return false;
});
}
}
mashiro_global.ini.normalize();
loadCSS(mashiro_option.jsdelivr_css_src);
loadCSS(mashiro_option.entry_content_theme_src);
@ -1394,7 +1450,7 @@ var home = location.href,
$('html').css('overflow-y', 'hidden');
if (mashiro_option.live_search) {
var QueryStorage = [];
search_a(Poi.api + "sakura/v1/cache_search/json");
search_a(Poi.api + "sakura/v1/cache_search/json?_wpnonce=" + Poi.nonce);
var otxt = addComment.I("search-input"),
list = addComment.I("PostlistBox"),
@ -1594,7 +1650,7 @@ var home = location.href,
var tempScrollTop = $(window).scrollTop();
$(window).scrollTop(tempScrollTop);
$body.animate({
scrollTop: tempScrollTop + 300
scrollTop: tempScrollTop + 100
}, 666)
} else {
$("#pagination").html("<span>很高兴你翻到这里,但是真的没有了...</span>");
@ -1763,14 +1819,17 @@ var home = location.href,
cheight = window.innerHeight,
pc_to_top = document.querySelector(".cd-top"),
mb_to_top = document.querySelector("#moblieGoTop"),
mb_dark_light = document.querySelector("#moblieDarkLight"),
changeskin = document.querySelector(".changeSkin-gear");
$(window).scroll(function() {
if (cwidth <= 860) {
if ($(this).scrollTop() > 20) {
mb_to_top.style.transform = "scale(1)";
mb_dark_light.style.transform = "scale(1)";
} else {
mb_to_top.style.transform = "scale(0)";
mb_dark_light.style.transform = "scale(0)";
}
} else {
if ($(this).scrollTop() > 100) {
@ -1796,6 +1855,12 @@ var home = location.href,
pc_to_top.onclick = function() {
topFunction();
}
mb_to_top.onclick = function() {
topFunction();
}
mb_dark_light.onclick = function() {
mobile_dark_light();
}
}
}
$(function () {

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

BIN
languages/zh_TW.mo 100644

Binary file not shown.

2042
languages/zh_TW.po 100644

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 KiB

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@ -134,23 +134,10 @@ function optionsframework_options()
$options[] = array(
'name' => __('Theme scheme tool transparency', 'sakura'), /*切换主题菜单透明度*/
'desc' => __('Adjust the theme scheme menu transparency, the smaller the value, the more transparent. The default value is 0.8', 'sakura'), /*调整切换主题菜单透明度值越小越透明。默认透明度0.8*/
'desc' => __('Adjust the theme scheme menu transparency, fill in decimals between 0 and 1, the smaller the value, the more transparent. The default value is 0.8', 'sakura'), /*调整切换主题菜单透明度值越小越透明。默认透明度0.8*/
'id' => 'sakura_skin_alpha',
'std' => '0.8',
'type' => 'select',
'options' => array(
'0' => __('Transparent', 'sakura'), /*全透明*/
'0.1' => __('Transparency 0.1', 'sakura'), /*透明度0.1*/
'0.2' => __('Transparency 0.2', 'sakura'), /*透明度0.2*/
'0.3' => __('Transparency 0.3', 'sakura'), /*透明度0.3*/
'0.4' => __('Transparency 0.4', 'sakura'), /*透明度0.4*/
'0.5' => __('Transparency 0.5', 'sakura'), /*透明度0.5*/
'0.6' => __('Transparency 0.6', 'sakura'), /*透明度0.6*/
'0.7' => __('Transparency 0.7', 'sakura'), /*透明度0.7*/
'0.8' => __('Transparency 0.8', 'sakura'), /*透明度0.8*/
'0.9' => __('Transparency 0.9', 'sakura'), /*透明度0.9*/
'1' => __('Opaque', 'sakura'), /*不透明*/
));
'type' => 'text');
$options[] = array(
'name' => __('Change web background', 'sakura'), /*切换网页背景*/
@ -159,6 +146,13 @@ function optionsframework_options()
'std' => 'none,https://cdn.jsdelivr.net/gh/spirit1431007/cdn@1.6/img/sakura.png,https://cdn.jsdelivr.net/gh/spirit1431007/cdn@1.6/img/plaid2dbf8.jpg,https://cdn.jsdelivr.net/gh/spirit1431007/cdn@1.6/img/star02.png,https://cdn.jsdelivr.net/gh/spirit1431007/cdn@1.6/img/kyotoanimation.png,https://cdn.jsdelivr.net/gh/spirit1431007/cdn@1.6/img/dot_orange.gif,https://api.mashiro.top/bing/,https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.2/other-sites/api-index/images/me.png',
'type' => 'textarea');
$options[] = array(
'name' => __('Darkmode', 'sakura'),
'desc' => __('Automatically turn on dark mode from 10:00 p.m. to 06:00 a.m.', 'sakura'),
'id' => 'darkmode',
'std' => '1',
'type' => 'checkbox');
$options[] = array(
'name' => __('Personal avatar', 'sakura'), /*个人头像*/
'desc' => __('The best size is 130px*130px.', 'sakura'), /*最佳尺寸130px*130px。*/
@ -182,7 +176,7 @@ function optionsframework_options()
'name' => __('Favicon', 'sakura'),
'desc' => __('It is the small logo on the browser tab, fill in the url', 'sakura'), /*就是浏览器标签栏上那个小 logo填写url*/
'id' => 'favicon_link',
'std' => '/wp-content/themes/Sakura/images/favicon.ico',
'std' => get_template_directory_uri().'/images/favicon.ico',
'type' => 'text');
$options[] = array(
@ -240,6 +234,25 @@ function optionsframework_options()
'imageflow' => __('Graphic', 'sakura'), /*图文*/
));
$options[] = array(
'name' => __('Cover manifest', 'sakura'), /*首页文章特色图选项*/
'desc' => __('Select how to call the post featue image, only for the post without feature image', 'sakura'), /*选择文章特色图的调用方式,只对没有设置特色图像的文章生效*/
'id' => 'post_cover_options',
'std' => "type_1",
'type' => "select",
'options' => array(
'type_1' => __('same as the cover of the first screen (default)', 'sakura'), /*跟随第一屏封面图*/
'type_2' => __('custom api (advanced)', 'sakura'), /*外部随机图API*/
)
);
$options[] = array(
'name' => __('Cover images url', 'sakura'), /*图片库url*/
'desc' => __('Fill in the custom image api url.', 'sakura'),
'id' => 'post_cover',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('Home article feature images (only valid for standard mode)', 'sakura'), /*首页文章特色图(仅对标准风格生效)*/
'id' => 'list_type',
@ -740,6 +753,139 @@ function optionsframework_options()
'std' => '',
'type' => 'text');
//评论区
$options[] = array(
'name' => __('Comment field', 'sakura'), /*评论区*/
'type' => 'heading');
$options[] = array(
'name' => __('Gravatar avatar proxy', 'sakura'),
'desc' => __('A front-ed proxy for Gravatar, eg. gravatar.2heng.xin/avatar . Leave it blank if you do not need.', 'sakura'),
'id' => 'gravatar_proxy',
'std' => "gravatar.2heng.xin/avatar",
'type' => "text");
$options[] = array(
'name' => __('Comment image upload API', 'sakura'), /*评论图片上传接口*/
'id' => 'img_upload_api',
'std' => "imgur",
'type' => "radio",
'options' => array(
'imgur' => __('Imgur (https://imgur.com)', 'sakura'),
'smms' => __('SM.MS (https://sm.ms)', 'sakura'),
'chevereto' => __('Chevereto (https://chevereto.com)', 'sakura'),
));
$options[] = array(
'name' => __('Imgur Client ID', 'sakura'),
'desc' => __('Register your application <a href="https://api.imgur.com/oauth2/addclient">here</a>, note we only need the Client ID here.', 'sakura'),
'id' => 'imgur_client_id',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('SM.MS Secret Token', 'sakura'),
'desc' => __('Register your application <a href="https://sm.ms/home/apitoken">here</a>.', 'sakura'),
'id' => 'smms_client_id',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('Chevereto API v1 key', 'sakura'),
'desc' => __('Get your API key here: ' . akina_option('cheverto_url') . '/dashboard/settings/api', 'sakura'),
'id' => 'chevereto_api_key',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('Chevereto URL', 'sakura'),
'desc' => __('Your Chevereto homepage url, no slash in the end, eg. https://your.cherverto.com', 'sakura'),
'id' => 'cheverto_url',
'std' => 'https://your.cherverto.com',
'type' => 'text');
$options[] = array(
'name' => __('Comment images proxy', 'sakura'),
'desc' => __('A front-ed proxy for the uploaded images. Leave it blank if you do not need.', 'sakura'),
'id' => 'cmt_image_proxy',
'std' => 'https://images.weserv.nl/?url=',
'type' => 'text');
$options[] = array(
'name' => __('Imgur upload proxy', 'sakura'),
'desc' => __('A back-ed proxy to upload images. You may set a self hosted proxy with Nginx, following my <a href="https://2heng.xin/2018/06/06/javascript-upload-images-with-imgur-api/">turtal</a>. This feature is mainly for Chinese who cannot access to Imgur due to the GFW. The default and official setting is 【<a href="https://api.imgur.com/3/image/">https://api.imgur.com/3/image/</a>】', 'sakura'),
'id' => 'imgur_upload_image_proxy',
'std' => 'https://api.imgur.com/3/image/',
'type' => 'text');
$options[] = array(
'name' => __('Comments reply notification', 'sakura'), /*邮件回复通知*/
'desc' => __('WordPress will use email to notify users when their comments receive a reply by default. Tick this item allows users to set their own comments reply notification', 'sakura'), /*WordPress默认会使用邮件通知用户评论收到回复开启此项允许用户设置自己的评论收到回复时是否使用邮件通知*/
'id' => 'mail_notify',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Administrator comment notification', 'sakura'), /*邮件回复通知管理员*/
'desc' => __('Whether to use email notification when the administrator\'s comments receive a reply', 'sakura'), /*当管理员评论收到回复时是否使用邮件通知*/
'id' => 'admin_notify',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Enable private comment', 'sakura'), /*允许私密评论*/
'desc' => __('Allow users to set their own comments to be invisible to others', 'sakura'), /*允许用户设置自己的评论对其他人不可见*/
'id' => 'open_private_message',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Human verification', 'sakura'), /*机器人验证*/
'desc' => __('Enable human verification', 'sakura'), /*开启机器人验证*/
'id' => 'norobot',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('QQ avatar link encryption', 'sakura'), /*QQ头像链接加密*/
'desc' => __('Do not display the user\'s qq avatar links directly.', 'sakura'), /*不直接暴露用户qq头像链接*/
'id' => 'qq_avatar_link',
'std' => "off",
'type' => "select",
'options' => array(
'off' => __('Off (default)', 'sakura'), /*关闭(默认)*/
'type_1' => __('use redirect (general security)', 'sakura'), /*使用 重定向(安全性一般)'*/
'type_2' => __('fetch data at backend (high security)', 'sakura'), /*后端获取数据(安全性高)*/
'type_3' => __('fetch data at backend (high securityslow)', 'sakura'), /*后端获取数据(安全性高, 慢)*/
));
$options[] = array(
'name' => __('Comment UA infomation', 'sakura'), /*评论UA信息*/
'desc' => __('Check to enable, display the user\'s browser, operating system information', 'sakura'), /*勾选开启,显示用户的浏览器,操作系统信息*/
'id' => 'open_useragent',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Comment location infomation', 'sakura'), /*评论位置信息*/
'desc' => __('Check to enable, display the user\'s location info', 'sakura'), /*勾选开启,显示用户的位置信息*/
'id' => 'open_location',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Enable disqus', 'sakura'), /*开启多说插件支持*/
'desc' => __('Enable disqus for comment', 'sakura'), /*多说已经凉了*/
'id' => 'general_disqus_plugin_support',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Time Zone adjustment', 'sakura'), /*时区调整*/
'desc' => __('If the comment has a time difference problem adjust here, fill in an integer, the calculation method: actual_time = display_error_time - the_integer_you_entered (unit: hour)', 'sakura'), /*如果评论出现时差问题在这里调整,填入一个整数,计算方法:实际时间=显示错误的时间-你输入的整数(单位:小时)*/
'id' => 'time_zone_fix',
'std' => '0',
'type' => 'text');
//后台配置
$options[] = array(
'name' => __('Dashboard configuration', 'sakura'), /*后台配置*/
@ -923,11 +1069,33 @@ function optionsframework_options()
$options[] = array(
'name' => __('Footer float music player', 'sakura'), /*页脚悬浮播放器*/
'desc' => __('If you don\'t need the player just leave it blank.Fill in the "song list" ID of Netease Cloud Music, eg: https://music.163.com/#/playlist?id=2288037900 The ID is 2288037900', 'sakura'), /*如果不需要播放器留空即可。填写网易云音乐的「歌单」IDeghttps://music.163.com/#/playlist?id=2288037900的ID是2288037900*/
'id' => 'playlist_id',
'desc' => __('Choose which platform you\'ll use.', 'sakura'),
'id' => 'aplayer_server',
'std' => "netease",
'type' => "select",
'options' => array(
'netease' => __('Netease Cloud Music (default)', 'sakura'),
'xiami' => __('Xiami Music', 'sakura'),
'kugou' => __('KuGou Music', 'sakura'),
'baidu' => __('Baidu Music', 'sakura'),
'tencent' => __('QQ Music (may fail) ', 'sakura'),
'off' => __('Off', 'sakura'),
));
$options[] = array(
'name' => __('Song list ID', 'sakura'),
'desc' => __('Fill in the "song list" ID, eg: https://music.163.com/#/playlist?id=2288037900 The ID is 2288037900', 'sakura'),
'id' => 'aplayer_playlistid',
'std' => '2288037900',
'type' => 'text');
$options[] = array(
'name' => __('Netease Cloud Music cookie', 'sakura'),
'desc' => __('For Netease Cloud Music, fill in your vip account\'s cookies if you want to play special tracks.<b>If you don\'t know what does mean, left it blank.</b>', 'sakura'),
'id' => 'aplayer_cookie',
'std' => '',
'type' => 'textarea');
$options[] = array(
'name' => __('Version Control', 'sakura'), /*版本控制*/
'desc' => __('Used to update frontend cookies and browser caches, any string can be used', 'sakura'), /*用于更新前端 cookie 及浏览器缓存,可使用任意字符串*/
@ -969,7 +1137,19 @@ function optionsframework_options()
'id' => 'notice_title',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('Bilibili UID', 'sakura'), /*bilibiliUID*/
'desc' => __('Fill in your UID, eg.https://space.bilibili.com/13972644/, only fill in with the number part.', 'sakura'),
'id' => 'bilibili_id',
'std' => '13972644',
'type' => 'text');
$options[] = array(
'name' => __('Bilibili Cookie', 'sakura'), /*Bilibili Cookie*/
'desc' => __('Fill in your Cookies, go to your bilibili homepage, you can get cookies in brownser network pannel with pressing F12. If left this blank, you\'ll not get the progress.', 'sakura'),
'id' => 'bilibili_cookie',
'std' => 'LIVE_BUVID=',
'type' => 'textarea');
$options[] = array(
'name' => __('The categories of articles that don\'t not show on homepage', 'sakura'), /*首页不显示的分类文章*/
'desc' => __('Fill in category ID, multiple IDs are divided by a comma ","', 'sakura'), /*填写分类ID多个用英文“ , ”分开*/
@ -1006,62 +1186,9 @@ function optionsframework_options()
'type_4' => __('23k Views (chinese)', 'sakura'), /*23k 次访问(中式)*/
));
$options[] = array(
'name' => __('Comment image upload API', 'sakura'), /*评论图片上传接口*/
'id' => 'img_upload_api',
'std' => "imgur",
'type' => "radio",
'options' => array(
'imgur' => __('Imgur (https://imgur.com)', 'sakura'),
'smms' => __('SM.MS (https://sm.ms)', 'sakura'),
'chevereto' => __('Chevereto (https://chevereto.com)', 'sakura'),
));
$options[] = array(
'name' => __('Imgur Client ID', 'sakura'),
'desc' => __('Register your application <a href="https://api.imgur.com/oauth2/addclient">here</a>, note we only need the Client ID here.', 'sakura'),
'id' => 'imgur_client_id',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('SM.MS Secret Token', 'sakura'),
'desc' => __('Register your application <a href="https://sm.ms/home/apitoken">here</a>.', 'sakura'),
'id' => 'smms_client_id',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('Chevereto API v1 key', 'sakura'),
'desc' => __('Get your API key here: ' . akina_option('cheverto_url') . '/dashboard/settings/api', 'sakura'),
'id' => 'chevereto_api_key',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('Chevereto URL', 'sakura'),
'desc' => __('Your Chevereto homepage url, no slash in the end, eg. https://your.cherverto.com', 'sakura'),
'id' => 'cheverto_url',
'std' => 'https://your.cherverto.com',
'type' => 'text');
$options[] = array(
'name' => __('Comment images proxy', 'sakura'),
'desc' => __('A front-ed proxy for the uploaded images. Leave it blank if you do not need.', 'sakura'),
'id' => 'cmt_image_proxy',
'std' => 'https://images.weserv.nl/?url=',
'type' => 'text');
$options[] = array(
'name' => __('Imgur upload proxy', 'sakura'),
'desc' => __('A back-ed proxy to upload images. You may set a self hosted proxy with Nginx, following my <a href="https://2heng.xin/2018/06/06/javascript-upload-images-with-imgur-api/">turtal</a>. This feature is mainly for Chinese who cannot access to Imgur due to the GFW. The default and official setting is 【<a href="https://api.imgur.com/3/image/">https://api.imgur.com/3/image/</a>】', 'sakura'),
'id' => 'imgur_upload_image_proxy',
'std' => 'https://api.imgur.com/3/image/',
'type' => 'text');
$options[] = array(
'name' => __('Enable live search', 'sakura'), /*启用实时搜索*/
'desc' => __('Real-time search in the foreground, call the Rest API to update the cache every hour, you can manually set the cache time in functions.php', 'sakura'), /*前台实现实时搜索,调用 Rest API 每小时更新一次缓存,可在 functions.php 里手动设置缓存时间*/
'desc' => __('Real-time search in the foreground, call the Rest API to update the cache every hour, you can manually set the cache time in api.php', 'sakura'), /*前台实现实时搜索,调用 Rest API 每小时更新一次缓存,可在 functions.php 里手动设置缓存时间*/
'id' => 'live_search',
'std' => '0',
'type' => 'checkbox');
@ -1108,67 +1235,5 @@ function optionsframework_options()
'std' => 'bibi',
'type' => 'text');
$options[] = array(
'name' => __('Comments reply notification', 'sakura'), /*邮件回复通知*/
'desc' => __('WordPress will use email to notify users when their comments receive a reply by default. Tick this item allows users to set their own comments reply notification', 'sakura'), /*WordPress默认会使用邮件通知用户评论收到回复开启此项允许用户设置自己的评论收到回复时是否使用邮件通知*/
'id' => 'mail_notify',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Administrator comment notification', 'sakura'), /*邮件回复通知管理员*/
'desc' => __('Whether to use email notification when the administrator\'s comments receive a reply', 'sakura'), /*当管理员评论收到回复时是否使用邮件通知*/
'id' => 'admin_notify',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Enable private comment', 'sakura'), /*允许私密评论*/
'desc' => __('Allow users to set their own comments to be invisible to others', 'sakura'), /*允许用户设置自己的评论对其他人不可见*/
'id' => 'open_private_message',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Human verification', 'sakura'), /*机器人验证*/
'desc' => __('Enable human verification', 'sakura'), /*开启机器人验证*/
'id' => 'norobot',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('QQ avatar link encryption', 'sakura'), /*QQ头像链接加密*/
'desc' => __('Do not display the user\'s qq avatar links directly.', 'sakura'), /*不直接暴露用户qq头像链接*/
'id' => 'qq_avatar_link',
'std' => "off",
'type' => "select",
'options' => array(
'off' => __('Off (default)', 'sakura'), /*关闭(默认)*/
'type_1' => __('use redirect (general security)', 'sakura'), /*使用 重定向(安全性一般)'*/
'type_2' => __('fetch data at backend (high security)', 'sakura'), /*后端获取数据(安全性高)*/
'type_3' => __('fetch data at backend (high securityslow)', 'sakura'), /*后端获取数据(安全性高, 慢)*/
));
$options[] = array(
'name' => __('Comment UA infomation', 'sakura'), /*评论UA信息*/
'desc' => __('Check to enable, display the user\'s browser, operating system information', 'sakura'), /*勾选开启,显示用户的浏览器,操作系统信息*/
'id' => 'open_useragent',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Enable disqus', 'sakura'), /*开启多说插件支持*/
'desc' => __('Enable disqus for comment', 'sakura'), /*多说已经凉了*/
'id' => 'general_disqus_plugin_support',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Time Zone adjustment', 'sakura'), /*时区调整*/
'desc' => __('If the comment has a time difference problem adjust here, fill in an integer, the calculation method: actual_time = display_error_time - the_integer_you_entered (unit: hour)', 'sakura'), /*如果评论出现时差问题在这里调整,填入一个整数,计算方法:实际时间=显示错误的时间-你输入的整数(单位:小时)*/
'id' => 'time_zone_fix',
'std' => '0',
'type' => 'text');
return $options;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 95 KiB

290
style.css
View File

@ -5,7 +5,7 @@ Theme URI: https://github.com/mashirozx/Sakura/
Author: Mashiro, Spirit, Louie, Fuzzz
Author URI: http://2heng.xin
Description: A wonderful branch of theme Akina
Version: 3.3.7
Version: 3.4.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sakura
@ -1278,6 +1278,14 @@ a:hover {
padding: 40px 0 0
}
.site-content.notransition {
-webkit-transition: none !important;
-moz-transition: none !important;
-o-transition: none !important;
-ms-transition: none !important;
transition: none !important;
}
.site-content {
max-width: 800px;
padding: 0 10px;
@ -1325,7 +1333,8 @@ a:hover {
border-radius: 50%;
padding: 2px;
border: 1px solid #DADADA;
position: relative
position: relative;
object-fit: cover
}
.feature :hover .overlay i {
@ -1575,22 +1584,6 @@ i.iconfont.hotpost {
overflow: hidden
}
.post-list-thumb-left .post-content-wrap {
float: left;
padding-left: 30px;
padding-right: 0;
text-align: right;
margin: 20px 10px 10px 0
}
.post-list-thumb-left .post-thumb {
float: left
}
.post-list-thumb-left .post-thumb a {
border-radius: 10px 0 0 10px
}
@media (max-width:768px) {
.float-content p {
height: auto;
@ -1610,12 +1603,11 @@ i.iconfont.hotpost {
width: 100%;
left: 0
}
.post-content-wrap,
.post-list-thumb-left .post-content-wrap {
text-align: left;
margin: 0;
padding: 20px;
float: none;
.post-list-thumb .post-content-wrap {
text-align: left !important;
margin: 0 !important;
padding: 20px !important;
float: none !important;
box-shadow: none;
border-top: 0
}
@ -1708,6 +1700,10 @@ i.iconfont.hotpost {
background: #FBFBFB
}
body.dark .s-content{
background: unset;
}
.s-time i {
font-size: 13px;
margin-right: 5px
@ -1876,21 +1872,10 @@ h1.page-title.mb- {
text-align: center
}
@media screen and (max-width:860px) {
.cd-top {
display: none;
height: 60px;
width: 50px
}
.cd-top span {
height: 10px;
width: 50px
}
}
#moblieGoTop {
#moblieGoTop,#moblieDarkLight {
visibility: hidden;
position: fixed;
bottom: 10px;
bottom: 60px;
right: 10px;
z-index: 99;
border: 0;
@ -1905,11 +1890,29 @@ h1.page-title.mb- {
transform: scale(0);
transition:transform .3s
}
#moblieGoTop:hover {
#moblieGoTop:hover,#moblieDarkLight:hover {
background-color: #fff;
opacity: .8
}
#moblieDarkLight{
bottom: 10px;
}
@media screen and (max-width:860px) {
.cd-top {
display: none;
height: 60px;
width: 50px
}
.cd-top span {
height: 10px;
width: 50px
}
#moblieGoTop,#moblieDarkLight{
visibility: visible;
}
}
.post-footer {
padding: 20px 0;
border-bottom: 1px dashed #ddd;
@ -3636,7 +3639,7 @@ a.page-numbers {
font-size: 14px
}
.siren-checkbox-label input {
.siren-checkbox-label input,#wp-comment-cookies-consent {
padding: 0;
margin: 0;
float: none;
@ -3866,6 +3869,10 @@ li.feature-2 {
z-index: -1
}
@supports (-webkit-touch-callout: none) {
#centerbg: { background-attachment: scroll !important; }
}
@media (max-width:860px) {
#centerbg {
height: 300px;
@ -4364,7 +4371,9 @@ i.iconfont.js-toggle-search.iconsearch {
margin-top: -3px;
line-height: unset;
}
body.dark .ins-section .fa{
color: #ccc;
}
.ins-section .ins-section-header,.ins-section .ins-search-item {
padding: 8px 15px;
cursor: url(https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/cursor/ayuda.cur),auto;
@ -5009,7 +5018,7 @@ i.iconfont.down {
color: #ADADAD
}
#pagination span {
#pagination span,#bangumi-pagination span {
color: #989898;
font-size: 15px
}
@ -5019,7 +5028,7 @@ i.iconfont.down {
color: orange
}
#pagination .loading {
#pagination .loading,#bangumi-pagination .loading {
background: url(https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/wordpress-rotating-ball-o.svg);
background-position: center;
background-repeat: no-repeat;
@ -5217,7 +5226,7 @@ i.iconfont.down {
@media (max-width:860px) {
#main-container {
transition-duration: .5s;
transition: background,transform .5s !important;
position: relative;
overflow: hidden;
z-index: 2
@ -5304,7 +5313,7 @@ i.iconfont.down {
top: 8px
}
.openNav.open .icon {
background-color: transparent
background-color: transparent !important
}
.openNav.open .icon:after,
.openNav.open .icon:before {
@ -5810,7 +5819,8 @@ i.iconfont.down {
}
.header-user-avatar:hover .header-user-menu {
display: block
display: block;
background: #fff;
}
.header-user-menu {
@ -5841,7 +5851,6 @@ i.iconfont.down {
.herder-user-name {
font-size: 12px;
background: #fff;
padding: 10px 10px;
border-radius: 4px 4px 0 0
}
@ -5857,7 +5866,6 @@ i.iconfont.down {
.header-user-menu .user-menu-option {
padding: 5px 0;
background: #fff;
border-radius: 0 0 4px 4px;
width: 130px
}
@ -5877,6 +5885,11 @@ i.iconfont.down {
background-color: #f1f1f1
}
body.dark .user-menu-option a:hover {
color: #3daee9;
background-color: #232629
}
.no-logged {
font-size: 13px;
padding: 15px 10px;
@ -5886,7 +5899,7 @@ i.iconfont.down {
.no-logged a {
display: initial;
color: #69d2e7;
color: #69d2e7 !important;
font-size: 14px;
padding: 0 5px;
text-decoration: underline
@ -8277,6 +8290,8 @@ td.hljs-ln-numbers {
--widthB: calc(var(--widthA) - 30px);
height: var(--widthB);
min-height: 99%;
white-space: pre-wrap;
word-wrap: break-word;
overflow-y: hidden;
overflow-x: auto;
height: auto
@ -8624,3 +8639,180 @@ h1[id*=toc-head]::before,h2[id*=toc-head]::before,h3[id*=toc-head]::before,h4[id
width: 100%;
height: 100%;
}
.bangumi {
margin-top: 40px;
}
.bangumi .row {
display: flex;
margin: 0 -10px -20px;
flex-wrap: wrap;
}
.bangumi .column {
max-width: 50%;
flex: 0 0 50%;
margin-bottom: 30px;
padding: 0 15px;
max-width: 100%;
flex: 0 0 100%;
transition: .5s;
}
.bangumi-item {
height: 0;
color: #fff;
display: block;
overflow: hidden;
text-align: center;
position: relative;
padding-bottom: 130%;
box-shadow: 0 0 10px rgba(0, 0, 0, .1), 0 5px 20px rgba(0, 0, 0, .2);
}
.bangumi-item:hover {
color: #fff;
}
.bangumi-item img {
width: 100%;
user-select: none;
object-fit: cover;
transition: filter 2s;
}
.bangumi-item .bangumi-info {
height: 30%;
top: 0;
left: 0;
right: 0;
padding: 10px;
position: absolute;
background: rgba(0, 0, 0, .5);
transition: transform 1s;
transform: translateY(250%);
}
.bangumi-title {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-top: 0;
}
.bangumi-summary {
height: 65%;
white-space: normal;
display: none;
font-weight: bold;
}
.bangumi-status-bar {
top: 0;
bottom: 0;
max-width: 100%;
position: absolute;
background: #dc143c;
}
.bangumi-status, .bangumi-status p {
position: relative;
}
.bangumi-status {
background: rgba(0, 0, 0, .6);
}
@media screen and (min-width: 400px) {
.bangumi .column {
max-width: 50%;
flex: 0 0 50%;
}
.bangumi-item .bangumi-info{
height: 50%;
transform: translateY(140%);
}
.bangumi-title {
height: 20%;
}
}
@media screen and (min-width: 600px) {
.bangumi .column {
max-width: 33.3333%;
flex: 0 0 33.3333%;
}
.bangumi-title {
height: 30%;
}
.bangumi-item .bangumi-info{
height: 45%;
transform: translateY(140%);
}
}
@media screen and (min-width: 900px) {
.bangumi .column {
max-width: 25%;
flex: 0 0 25%;
}
.bangumi-item .bangumi-info{
height: 100%;
transform: translateY(85%);
}
.bangumi-item:hover .bangumi-info {
transform: translateY(0);
}
.bangumi-item:hover img{
filter: blur(3px);
}
body.dark .bangumi-item:hover img{
filter: brightness(0.8) blur(3px);
}
.bangumi-title {
height: 15%;
}
.bangumi-summary{
display: block;
}
.bangumi-status {
height: 10%;
}
}
@media screen and (min-width: 1200px) {
.bangumi-item .bangumi-info{
height: 75%;
transform: translateY(115%);
}
.bangumi-item:hover .bangumi-info {
transform: translateY(35%);
}
.bangumi-title {
height: 10%;
}
}
#bangumi-pagination {
width: 100%;
margin-top: 80px;
padding: 20px 0;
font-size: 36px;
text-align: center;
}
.bangumi-next{
font-family: sans-serif;
color: #e67474;
position: relative;
padding: 13px 35px;
overflow: hidden;
}
.bangumi-next:before {
content: ' ';
background-color: pink;
bottom: 0;
left: 0;
width: 100%;
height: 0;
position: absolute;
transition: all 5s;
z-index: -1;
}
.bangumi-next.loading:before{
display: none !important;
}
.bangumi-next:hover:before {
height: 100%;
}
.bangumi-next i {
color: orange;
}

View File

@ -11,21 +11,8 @@
//}
//add_filter('the_excerpt', 'custom_short_excerpt');
$i=0; while ( have_posts() ) : the_post(); $i++;
switch (akina_option('feature_align')) {
case "left":
$class = 'post-list-thumb-left';
break;
case "right":
$class = '';
break;
case "alternate":
$class = ($i%2 == 0) ? 'post-list-thumb-left' : ''; // 如果为偶数
break;
default:
$class = ($i%2 == 0) ? 'post-list-thumb-left' : '';
}
if( $i == 1 ){
$class .= ' post-list-show';
$class = ' post-list-show';
}
if(has_post_thumbnail()){
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large');

View File

@ -0,0 +1,38 @@
<?php
/**
Template Name: Bangumi
*/
get_header();
?>
<meta name="referrer" content="same-origin">
<style>
#content,.comments,.site-footer{max-width:1200px;}
.comments{display: none}
</style>
</head>
<?php while(have_posts()) : the_post(); ?>
<?php if(akina_option('patternimg') || !get_post_thumbnail_id(get_the_ID())) { ?>
<span class="linkss-title"><?php the_title();?></span>
<?php } ?>
<article <?php post_class("post-item"); ?>>
<?php the_content(); ?>
<section class="bangumi">
<?php if (akina_option('bilibili_id') ):?>
<div class="row">
<?php
$bgm = new \Sakura\API\Bilibili();
echo $bgm->get_bgm_items();
?>
<?php else: ?>
<div class="row">
<p> <?php _e("Please fill in the Bilibili UID in Sakura Options.","sakura"); ?></p>
</div>
<?php endif; ?>
</section>
</article>
<?php endwhile; ?>
<?php
get_footer();

View File

@ -86,7 +86,10 @@ if( !empty($_POST['register_reg']) ) {
<?php }else{
$loadurl = akina_option('exlogin_url') ? akina_option('exlogin_url') : get_bloginfo('url');
?>
<script>//window.location.href='<?php echo $loadurl; ?>';</script>
<div class="ex-register-title">
<h3><?php _e("Success! Redirecting......","sakura")/*注册成功!正在跳转...*/?></h3>
</div>
<script>window.location.href='<?php echo $loadurl; ?>';</script>
<?php } ?>
<?php else : ?>
<div class="register-close"><p><?php _e("Registration is not open yet.","sakura")/*暂未开放注册。*/?></p></div>