Skip to content

Commit 9ddaad7

Browse files
authored
Merge pull request #176 from mashirozx/dev
update to v3.3.5
2 parents 5608a0d + 8b77fbd commit 9ddaad7

21 files changed

+115
-165
lines changed

README-en.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Sakura🌸: A Wonderful WordPress Theme
88
![PHP version](https://img.shields.io/badge/PHP-7.1+-4F5B93.svg?style=flat-square)
99
![WP version](https://img.shields.io/badge/WordPress-5.0+-0073aa.svg?style=flat-square)
1010
[![GitHub release](https://img.shields.io/github/release/mashirozx/Sakura.svg?style=flat-square)](https://github.com/mashirozx/Sakura/releases/latest)
11-
[![Github commits (since latest release)](https://img.shields.io/github/commits-since/mashirozx/Sakura/latest.svg?style=flat-square)](https://github.com/mashirozx/Sakura/commits/)
11+
[![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)
1212
[![](https://data.jsdelivr.com/v1/package/gh/moezx/cdn/badge)](https://www.jsdelivr.com/package/gh/moezx/cdn)
1313

1414
Modified based on theme [Akina (by Fuzzz)](http://www.akina.pw/themeakina) and [Siren (by Louie)](https://github.com/louie-senpai/Siren).

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
![PHP version](https://shader.2heng.xin/badge/PHP-7.1+-4F5B93.svg?style=flat-square&logo=php)
99
![WP version](https://shader.2heng.xin/badge/WordPress-5.3-0073aa.svg?style=flat-square&logo=wordpress)
1010
[![GitHub release](https://img.shields.io/github/v/release/mashirozx/Sakura.svg?style=flat-square&logo=github)](https://github.com/mashirozx/Sakura/releases/latest)
11-
[![Github commits (since latest release)](https://img.shields.io/github/commits-since/mashirozx/Sakura/latest.svg?style=flat-square&logo=git&color=important)](https://github.com/mashirozx/Sakura/commits/)
11+
[![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)
1212
[![](https://data.jsdelivr.com/v1/package/gh/moezx/cdn/badge)](https://www.jsdelivr.com/package/gh/moezx/cdn)
1313

1414
在 Louie 基于 Fuzzz 的 [Akina](http://www.akina.pw/themeakina) 主题修改的主题 [Siren](https://github.com/louie-senpai/Siren) 基础上三次修改 =.=

cdn/css/lib.css

100644100755
+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cdn/js/lib.js

100644100755
+3-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cdn/js/src/10.materialize.min.js

-6
This file was deleted.

cdn/js/src/16.hls.js

-2
This file was deleted.

comments.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
'title_reply_to' => '<div class="graybar"><i class="fa fa-comments-o"></i>' . __('Leave a Reply to', 'sakura') . ' %s' . '</div>',
6161
'cancel_reply_link' => __('Cancel Reply', 'sakura'),
6262
'label_submit' => __('BiuBiuBiu~', 'sakura'),
63-
'comment_field' => '<p><i class="iconfont icon-markdown"></i> Markdown Supported while <i class="fa fa-code" aria-hidden="true"></i> Forbidden</p><div class="comment-textarea"><textarea placeholder="' . __("You are a surprise that I will only meet once in my life", "sakura") . ' ..." name="comment" class="commentbody" id="comment" rows="5" tabindex="4"></textarea><label class="input-label">' . __("You are a surprise that I will only meet once in my life", "sakura") . ' ...</label></div>
63+
'comment_field' => '<p style="font-style:italic"><a href="https://segmentfault.com/markdown" target="_blank"><i class="iconfont icon-markdown" style="color:#000"></i></a> Markdown Supported while <i class="fa fa-code" aria-hidden="true"></i> Forbidden</p><div class="comment-textarea"><textarea placeholder="' . __("You are a surprise that I will only meet once in my life", "sakura") . ' ..." name="comment" class="commentbody" id="comment" rows="5" tabindex="4"></textarea><label class="input-label">' . __("You are a surprise that I will only meet once in my life", "sakura") . ' ...</label></div>
6464
<div id="upload-img-show"></div>
6565
<!--插入表情面版-->
6666
<p id="emotion-toggle" class="no-select">
@@ -92,7 +92,7 @@ class="tieba-bar">Tieba</th>
9292
'author' =>
9393
'<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>',
9494
'email' =>
95-
'<div class="popup cmt-popup" onclick="cmt_showPopup(this)"><span class="popuptext" id="thePopup" style="margin-left: -65px;width: 130px;">' . __("You\' receive notification by email", "sakura")/*你将收到回复通知*/ . '</span><input type="text" placeholder="' . __("email", "sakura") . ' ' . ( $req ? '(' . __("Must* ", "sakura") . ')' : '') . '" name="email" id="email" value="' . esc_attr($comment_author_email) . '" size="22" tabindex="1" autocomplete="off" ' . ($req ? "aria-required='true'" : '' ). ' /></div>',
95+
'<div class="popup cmt-popup" onclick="cmt_showPopup(this)"><span class="popuptext" id="thePopup" style="margin-left: -65px;width: 130px;">' . __("You will receive notification by email", "sakura")/*你将收到回复通知*/ . '</span><input type="text" placeholder="' . __("email", "sakura") . ' ' . ( $req ? '(' . __("Must* ", "sakura") . ')' : '') . '" name="email" id="email" value="' . esc_attr($comment_author_email) . '" size="22" tabindex="1" autocomplete="off" ' . ($req ? "aria-required='true'" : '' ). ' /></div>',
9696
'url' =>
9797
'<div class="popup cmt-popup" onclick="cmt_showPopup(this)"><span class="popuptext" id="thePopup" style="margin-left: -55px;width: 110px;">' . __("Advertisement is forbidden 😀", "sakura")/*禁止小广告😀*/ . '</span><input type="text" placeholder="' . __("Site", "sakura") . '" name="url" id="url" value="' . esc_attr($comment_author_url) . '" size="22" autocomplete="off" tabindex="1" /></div></div>' . $robot_comments . $private_ms . $mail_notify ,
9898
'qq' =>

footer.php

-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ class="aplayer"
157157
data-fixed="true"
158158
data-theme="orange">
159159
</div>
160-
<style>.skin-menu{left:auto;right:10px;}.changeSkin-gear{left:auto;right:5px;}</style>
161160
<?php endif; ?>
162161
</body>
163162
</html>

functions.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @package Sakura
88
*/
99

10-
define( 'SAKURA_VERSION', '3.3.3' );
10+
define( 'SAKURA_VERSION', '3.3.5' );
1111
define( 'BUILD_VERSION', '3' );
1212

1313
//ini_set('display_errors', true);
@@ -470,7 +470,7 @@ function set_post_views() {
470470
global $post;
471471
$post_id = intval($post->ID);
472472
if($post_id) {
473-
$views = get_post_meta($post_id, 'views', true);
473+
$views = (int)get_post_meta($post_id, 'views', true);
474474
if(!update_post_meta($post_id, 'views', ($views + 1))) {
475475
add_post_meta($post_id, 'views', 1, true);
476476
}
@@ -1627,7 +1627,8 @@ function change_avatar($avatar){
16271627
preg_match('/:\"([^\"]*)\"/i',$qqavatar,$matches);
16281628
return '<img src="'.$matches[1].'" data-src="'.stripslashes($m[1]).'" class="lazyload avatar avatar-24 photo" alt="😀" width="24" height="24" onerror="imgError(this,1)">';
16291629
}else{
1630-
$encrypted = openssl_encrypt($qq_number, 'aes-128-cbc', $sakura_privkey, 0);
1630+
$iv = str_repeat($sakura_privkey, 2);
1631+
$encrypted = openssl_encrypt($qq_number, 'aes-128-cbc', $sakura_privkey, 0, $iv);
16311632
$encrypted = urlencode(base64_encode($encrypted));
16321633
return '<img src="'.rest_url("sakura/v1/qqinfo/avatar").'?qq='.$encrypted.'"class="lazyload avatar avatar-24 photo" alt="😀" width="24" height="24" onerror="imgError(this,1)">';
16331634
}
@@ -1687,7 +1688,7 @@ function markdown_parser($incoming_comment) {
16871688
$comment_markdown_content = $incoming_comment['comment_content'];
16881689
include 'inc/Parsedown.php';
16891690
$Parsedown = new Parsedown();
1690-
$incoming_comment['comment_content'] = $Parsedown->text($incoming_comment['comment_content']);
1691+
$incoming_comment['comment_content'] = $Parsedown->setUrlsLinked(false)->text($incoming_comment['comment_content']);
16911692
return $incoming_comment;
16921693
}
16931694
add_filter('preprocess_comment' , 'markdown_parser');

inc/api.php

+28-45
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
'callback' => 'feature_gallery',
2222
));
2323
register_rest_route('sakura/v1', '/database/update', array(
24-
'methods' => 'POST',
24+
'methods' => 'GET',
2525
'callback' => 'update_database',
2626
));
2727
register_rest_route('sakura/v1', '/qqinfo/json', array(
@@ -275,7 +275,7 @@ function cache_search_json()
275275

276276
$posts = new WP_Query('posts_per_page=-1&post_status=publish&post_type=post');
277277
while ($posts->have_posts()): $posts->the_post();
278-
$output .= '{"type":"post","link":"' . get_post_permalink() . '","title":' . json_encode(get_the_title()) . ',"comments":"' . get_comments_number('0', '1', '%') . '","text":' . json_encode(str_replace($vowels, " ", preg_replace($regex, ' ', get_the_content()))) . '},';
278+
$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, ' ', get_the_content()))) . '},';
279279
endwhile;
280280
wp_reset_postdata();
281281

@@ -351,9 +351,9 @@ function feature_gallery() {
351351
$img = array_rand($img_array);
352352
$img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory_uri();
353353
if(strpos($_SERVER['HTTP_ACCEPT'], 'image/webp')) {
354-
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["webp"][1];
354+
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["webp"][0];
355355
} else {
356-
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["jpeg"][1];
356+
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["jpeg"][0];
357357
}
358358
$data = array('cover image');
359359
$response = new WP_REST_Response($data);
@@ -367,48 +367,30 @@ function feature_gallery() {
367367
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/database/update
368368
*/
369369
function update_database() {
370-
$username = $_SERVER['PHP_AUTH_USER'];
371-
$password = $_SERVER['PHP_AUTH_PW'];
372-
$user = wp_authenticate($username, $password);
373-
if (is_a($user, 'WP_User')) {
374-
if (in_array('administrator', (array) $user->roles)) {
375-
global $wpdb;
376-
$sakura_table_name = $wpdb->base_prefix.'sakura';
377-
if(isset($_FILES["manifest"])) {
378-
$manifest = array(
379-
"key" => "manifest_json",
380-
"value" => file_get_contents($_FILES["manifest"]["tmp_name"])
381-
);
382-
$time = array(
383-
"key" => "json_time",
384-
"value" => date("Y-m-d H:i:s",time())
385-
);
386-
387-
$wpdb->query("DELETE FROM `wp_sakura` WHERE `mate_key` ='manifest_json'");
388-
$wpdb->query("DELETE FROM `wp_sakura` WHERE `mate_key` ='json_time'");
389-
$wpdb->insert($sakura_table_name,$manifest);
390-
$wpdb->insert($sakura_table_name,$time);
391-
$message = "manifest.json has been stored into database.";
392-
}
393-
$output = array(
394-
'status' => 200,
395-
'success' => true,
396-
'message' => $message
397-
);
398-
$result = new WP_REST_Response($output, 200);
399-
$result->set_headers(array('Content-Type' => 'application/json'));
400-
return $result;
401-
}
402-
} else {
403-
$output = array(
404-
'status' => 401,
405-
'success' => false,
406-
'message' => 'Not Authorized.'
370+
global $wpdb;
371+
$sakura_table_name = $wpdb->base_prefix.'sakura';
372+
$img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory_uri();
373+
$manifest = file_get_contents($img_domain . "/manifest/manifest.json");
374+
if($manifest) {
375+
$manifest = array(
376+
"mate_key" => "manifest_json",
377+
"mate_value" => $manifest
407378
);
408-
$result = new WP_REST_Response($output, 401);
409-
$result->set_headers(array('Content-Type' => 'application/json'));
410-
return $result;
379+
$time = array(
380+
"mate_key" => "json_time",
381+
"mate_value" => date("Y-m-d H:i:s",time())
382+
);
383+
384+
$wpdb->query("DELETE FROM `wp_sakura` WHERE `mate_key` ='manifest_json'");
385+
$wpdb->query("DELETE FROM `wp_sakura` WHERE `mate_key` ='json_time'");
386+
$wpdb->insert($sakura_table_name,$manifest);
387+
$wpdb->insert($sakura_table_name,$time);
388+
$output = "manifest.json has been stored into database.";
389+
}else{
390+
$output = "manifest.json not found, please ensure your url is corrent.";
411391
}
392+
$result = new WP_REST_Response($output, 200);
393+
return $result;
412394
}
413395

414396
/**
@@ -419,8 +401,9 @@ function get_qq_avatar(){
419401
global $sakura_privkey;
420402
$encrypted=$_GET["qq"];
421403
if(isset($encrypted)){
404+
$iv = str_repeat($sakura_privkey, 2);
422405
$encrypted = urldecode(base64_decode($encrypted));
423-
$qq_number = openssl_decrypt($encrypted, 'aes-128-cbc', $sakura_privkey, 0);
406+
$qq_number = openssl_decrypt($encrypted, 'aes-128-cbc', $sakura_privkey, 0, $iv);
424407
preg_match('/^\d{3,}$/', $qq_number, $matches);
425408
$imgurl='https://q2.qlogo.cn/headimg_dl?dst_uin='.$matches[0].'&spec=100';
426409
if(akina_option('qq_avatar_link')=='type_2'){

js/sakura-app.js

+17-15
Original file line numberDiff line numberDiff line change
@@ -525,21 +525,23 @@ function killCoverVideo() {
525525

526526
function coverVideoIni() {
527527
if ($('video').hasClass('hls')) {
528-
var video = addComment.I('coverVideo');
529-
var video_src = $('#coverVideo').attr('data-src');
530-
if (Hls.isSupported()) {
531-
var hls = new Hls();
532-
hls.loadSource(video_src);
533-
hls.attachMedia(video);
534-
hls.on(Hls.Events.MANIFEST_PARSED, function () {
535-
video.play();
536-
});
537-
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
538-
video.src = video_src;
539-
video.addEventListener('loadedmetadata', function () {
540-
video.play();
541-
});
542-
}
528+
$.getScript("https://cdn.jsdelivr.net/gh/mashirozx/Sakura@3.3.3/cdn/js/src/16.hls.js", function(){
529+
var video = addComment.I('coverVideo');
530+
var video_src = $('#coverVideo').attr('data-src');
531+
if (Hls.isSupported()) {
532+
var hls = new Hls();
533+
hls.loadSource(video_src);
534+
hls.attachMedia(video);
535+
hls.on(Hls.Events.MANIFEST_PARSED, function () {
536+
video.play();
537+
});
538+
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
539+
video.src = video_src;
540+
video.addEventListener('loadedmetadata', function () {
541+
video.play();
542+
});
543+
}
544+
});
543545
//console.info('ini:coverVideoIni()');
544546
}
545547
}

languages/en_US.mo

0 Bytes
Binary file not shown.

languages/en_US.po

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
msgid ""
22
msgstr ""
33
"Project-Id-Version: Sakura\n"
4-
"POT-Creation-Date: 2019-12-13 14:51+0800\n"
5-
"PO-Revision-Date: 2019-12-13 14:51+0800\n"
4+
"POT-Creation-Date: 2019-12-25 10:43+0800\n"
5+
"PO-Revision-Date: 2019-12-25 10:43+0800\n"
66
"Last-Translator: \n"
77
"Language-Team: \n"
88
"Language: en_US\n"
@@ -107,7 +107,7 @@ msgid "Name* "
107107
msgstr ""
108108

109109
#: comments.php:95
110-
msgid "You\\' receive notification by email"
110+
msgid "You will receive notification by email"
111111
msgstr ""
112112

113113
#: comments.php:95
@@ -205,7 +205,7 @@ msgstr ""
205205
msgid "QQ"
206206
msgstr ""
207207

208-
#: functions.php:1664
208+
#: functions.php:1665
209209
msgid "Sidebar"
210210
msgstr ""
211211

@@ -1303,15 +1303,16 @@ msgid ""
13031303
msgstr ""
13041304

13051305
#: options.php:879
1306-
msgid "Cover CDN"
1306+
msgid "Cover manifest"
13071307
msgstr ""
13081308

13091309
#: options.php:880
1310+
#, php-format
13101311
msgid ""
1311-
"Fill in the cdn path for random picture display, without adding a slash at "
1312-
"the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, "
1312+
"Fill in the manifest path for random picture display, without adding a slash "
1313+
"at the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, "
13131314
"please refer to <a href = \"https: //github.com/mashirozx/Sakura/wiki/options"
1314-
"\">Wiki </a>"
1315+
"\">Wiki </a>. Click <a href = \"%s\">here</a> to update manifest"
13151316
msgstr ""
13161317

13171318
#: options.php:886
@@ -1409,7 +1410,7 @@ msgid ""
14091410
msgstr ""
14101411

14111412
#: options.php:973
1412-
msgid "The categories of articles that don\\t not show on homepage"
1413+
msgid "The categories of articles that don't not show on homepage"
14131414
msgstr ""
14141415

14151416
#: options.php:974 options.php:981

languages/sakura.pot

+9-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ msgid ""
33
msgstr ""
44
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
55
"Project-Id-Version: Sakura\n"
6-
"POT-Creation-Date: 2019-12-13 14:50+0800\n"
6+
"POT-Creation-Date: 2019-12-25 10:43+0800\n"
77
"PO-Revision-Date: 2019-11-01 14:27+0800\n"
88
"Last-Translator: \n"
99
"Language-Team: \n"
@@ -107,7 +107,7 @@ msgid "Name* "
107107
msgstr ""
108108

109109
#: comments.php:95
110-
msgid "You\\' receive notification by email"
110+
msgid "You will receive notification by email"
111111
msgstr ""
112112

113113
#: comments.php:95
@@ -204,7 +204,7 @@ msgstr ""
204204
msgid "QQ"
205205
msgstr ""
206206

207-
#: functions.php:1664
207+
#: functions.php:1665
208208
msgid "Sidebar"
209209
msgstr ""
210210

@@ -1287,14 +1287,16 @@ msgid ""
12871287
msgstr ""
12881288

12891289
#: options.php:879
1290-
msgid "Cover CDN"
1290+
msgid "Cover manifest"
12911291
msgstr ""
12921292

12931293
#: options.php:880
1294+
#, php-format
12941295
msgid ""
1295-
"Fill in the cdn path for random picture display, without adding a slash at the end, for "
1296+
"Fill in the manifest path for random picture display, without adding a slash at the end, for "
12961297
"example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, please refer to <a href = "
1297-
"\"https: //github.com/mashirozx/Sakura/wiki/options\">Wiki </a>"
1298+
"\"https: //github.com/mashirozx/Sakura/wiki/options\">Wiki </a>. Click <a href = \"%s\">here</"
1299+
"a> to update manifest"
12981300
msgstr ""
12991301

13001302
#: options.php:886
@@ -1387,7 +1389,7 @@ msgid ""
13871389
msgstr ""
13881390

13891391
#: options.php:973
1390-
msgid "The categories of articles that don\\t not show on homepage"
1392+
msgid "The categories of articles that don't not show on homepage"
13911393
msgstr ""
13921394

13931395
#: options.php:974 options.php:981

languages/zh_CN.mo

59 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)