mirror of
https://github.com/mashirozx/sakura.git
synced 2024-12-12 09:54:35 +08:00
commit
9ddaad79b1
@ -8,7 +8,7 @@ Sakura🌸: A Wonderful WordPress Theme
|
||||
![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)
|
||||
[![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.svg?style=flat-square)](https://github.com/mashirozx/Sakura/commits/)
|
||||
[![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)
|
||||
|
||||
Modified based on theme [Akina (by Fuzzz)](http://www.akina.pw/themeakina) and [Siren (by Louie)](https://github.com/louie-senpai/Siren).
|
||||
|
@ -8,7 +8,7 @@
|
||||
![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)
|
||||
[![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.svg?style=flat-square&logo=git&color=important)](https://github.com/mashirozx/Sakura/commits/)
|
||||
[![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)
|
||||
|
||||
在 Louie 基于 Fuzzz 的 [Akina](http://www.akina.pw/themeakina) 主题修改的主题 [Siren](https://github.com/louie-senpai/Siren) 基础上三次修改 =.=
|
||||
|
2
cdn/css/lib.css
Normal file → Executable file
2
cdn/css/lib.css
Normal file → Executable file
@ -1,4 +1,4 @@
|
||||
/*! Generate by Mashiro. Fri Jan 25 09:41:42 2019*//*!
|
||||
/*! Generate by Mashiro. Mon Dec 23 09:48:25 2019*//*!
|
||||
* baguetteBox.js
|
||||
* @author feimosi
|
||||
* @version 1.11.0
|
||||
|
11
cdn/js/lib.js
Normal file → Executable file
11
cdn/js/lib.js
Normal file → Executable file
File diff suppressed because one or more lines are too long
6
cdn/js/src/10.materialize.min.js
vendored
6
cdn/js/src/10.materialize.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -60,7 +60,7 @@
|
||||
'title_reply_to' => '<div class="graybar"><i class="fa fa-comments-o"></i>' . __('Leave a Reply to', 'sakura') . ' %s' . '</div>',
|
||||
'cancel_reply_link' => __('Cancel Reply', 'sakura'),
|
||||
'label_submit' => __('BiuBiuBiu~', 'sakura'),
|
||||
'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>
|
||||
'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>
|
||||
<div id="upload-img-show"></div>
|
||||
<!--插入表情面版-->
|
||||
<p id="emotion-toggle" class="no-select">
|
||||
@ -92,7 +92,7 @@
|
||||
'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' =>
|
||||
'<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>',
|
||||
'<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>',
|
||||
'url' =>
|
||||
'<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 ,
|
||||
'qq' =>
|
||||
|
@ -157,7 +157,6 @@
|
||||
data-fixed="true"
|
||||
data-theme="orange">
|
||||
</div>
|
||||
<style>.skin-menu{left:auto;right:10px;}.changeSkin-gear{left:auto;right:5px;}</style>
|
||||
<?php endif; ?>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -7,7 +7,7 @@
|
||||
* @package Sakura
|
||||
*/
|
||||
|
||||
define( 'SAKURA_VERSION', '3.3.3' );
|
||||
define( 'SAKURA_VERSION', '3.3.5' );
|
||||
define( 'BUILD_VERSION', '3' );
|
||||
|
||||
//ini_set('display_errors', true);
|
||||
@ -470,7 +470,7 @@ function set_post_views() {
|
||||
global $post;
|
||||
$post_id = intval($post->ID);
|
||||
if($post_id) {
|
||||
$views = get_post_meta($post_id, 'views', true);
|
||||
$views = (int)get_post_meta($post_id, 'views', true);
|
||||
if(!update_post_meta($post_id, 'views', ($views + 1))) {
|
||||
add_post_meta($post_id, 'views', 1, true);
|
||||
}
|
||||
@ -1627,7 +1627,8 @@ function change_avatar($avatar){
|
||||
preg_match('/:\"([^\"]*)\"/i',$qqavatar,$matches);
|
||||
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)">';
|
||||
}else{
|
||||
$encrypted = openssl_encrypt($qq_number, 'aes-128-cbc', $sakura_privkey, 0);
|
||||
$iv = str_repeat($sakura_privkey, 2);
|
||||
$encrypted = openssl_encrypt($qq_number, 'aes-128-cbc', $sakura_privkey, 0, $iv);
|
||||
$encrypted = urlencode(base64_encode($encrypted));
|
||||
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)">';
|
||||
}
|
||||
@ -1687,7 +1688,7 @@ function markdown_parser($incoming_comment) {
|
||||
$comment_markdown_content = $incoming_comment['comment_content'];
|
||||
include 'inc/Parsedown.php';
|
||||
$Parsedown = new Parsedown();
|
||||
$incoming_comment['comment_content'] = $Parsedown->text($incoming_comment['comment_content']);
|
||||
$incoming_comment['comment_content'] = $Parsedown->setUrlsLinked(false)->text($incoming_comment['comment_content']);
|
||||
return $incoming_comment;
|
||||
}
|
||||
add_filter('preprocess_comment' , 'markdown_parser');
|
||||
|
73
inc/api.php
73
inc/api.php
@ -21,7 +21,7 @@ add_action('rest_api_init', function () {
|
||||
'callback' => 'feature_gallery',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/database/update', array(
|
||||
'methods' => 'POST',
|
||||
'methods' => 'GET',
|
||||
'callback' => 'update_database',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/qqinfo/json', array(
|
||||
@ -275,7 +275,7 @@ EOS;
|
||||
|
||||
$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_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()))) . '},';
|
||||
$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()))) . '},';
|
||||
endwhile;
|
||||
wp_reset_postdata();
|
||||
|
||||
@ -351,9 +351,9 @@ function feature_gallery() {
|
||||
$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"][1];
|
||||
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["webp"][0];
|
||||
} else {
|
||||
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["jpeg"][1];
|
||||
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["jpeg"][0];
|
||||
}
|
||||
$data = array('cover image');
|
||||
$response = new WP_REST_Response($data);
|
||||
@ -367,48 +367,30 @@ function feature_gallery() {
|
||||
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/database/update
|
||||
*/
|
||||
function update_database() {
|
||||
$username = $_SERVER['PHP_AUTH_USER'];
|
||||
$password = $_SERVER['PHP_AUTH_PW'];
|
||||
$user = wp_authenticate($username, $password);
|
||||
if (is_a($user, 'WP_User')) {
|
||||
if (in_array('administrator', (array) $user->roles)) {
|
||||
global $wpdb;
|
||||
$sakura_table_name = $wpdb->base_prefix.'sakura';
|
||||
if(isset($_FILES["manifest"])) {
|
||||
$manifest = array(
|
||||
"key" => "manifest_json",
|
||||
"value" => file_get_contents($_FILES["manifest"]["tmp_name"])
|
||||
);
|
||||
$time = array(
|
||||
"key" => "json_time",
|
||||
"value" => date("Y-m-d H:i:s",time())
|
||||
);
|
||||
|
||||
$wpdb->query("DELETE FROM `wp_sakura` WHERE `mate_key` ='manifest_json'");
|
||||
$wpdb->query("DELETE FROM `wp_sakura` WHERE `mate_key` ='json_time'");
|
||||
$wpdb->insert($sakura_table_name,$manifest);
|
||||
$wpdb->insert($sakura_table_name,$time);
|
||||
$message = "manifest.json has been stored into database.";
|
||||
}
|
||||
$output = array(
|
||||
'status' => 200,
|
||||
'success' => true,
|
||||
'message' => $message
|
||||
);
|
||||
$result = new WP_REST_Response($output, 200);
|
||||
$result->set_headers(array('Content-Type' => 'application/json'));
|
||||
return $result;
|
||||
}
|
||||
} else {
|
||||
$output = array(
|
||||
'status' => 401,
|
||||
'success' => false,
|
||||
'message' => 'Not Authorized.'
|
||||
global $wpdb;
|
||||
$sakura_table_name = $wpdb->base_prefix.'sakura';
|
||||
$img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory_uri();
|
||||
$manifest = file_get_contents($img_domain . "/manifest/manifest.json");
|
||||
if($manifest) {
|
||||
$manifest = array(
|
||||
"mate_key" => "manifest_json",
|
||||
"mate_value" => $manifest
|
||||
);
|
||||
$result = new WP_REST_Response($output, 401);
|
||||
$result->set_headers(array('Content-Type' => 'application/json'));
|
||||
return $result;
|
||||
$time = array(
|
||||
"mate_key" => "json_time",
|
||||
"mate_value" => date("Y-m-d H:i:s",time())
|
||||
);
|
||||
|
||||
$wpdb->query("DELETE FROM `wp_sakura` WHERE `mate_key` ='manifest_json'");
|
||||
$wpdb->query("DELETE FROM `wp_sakura` 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 is corrent.";
|
||||
}
|
||||
$result = new WP_REST_Response($output, 200);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -419,8 +401,9 @@ function get_qq_avatar(){
|
||||
global $sakura_privkey;
|
||||
$encrypted=$_GET["qq"];
|
||||
if(isset($encrypted)){
|
||||
$iv = str_repeat($sakura_privkey, 2);
|
||||
$encrypted = urldecode(base64_decode($encrypted));
|
||||
$qq_number = openssl_decrypt($encrypted, 'aes-128-cbc', $sakura_privkey, 0);
|
||||
$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'){
|
||||
|
@ -525,21 +525,23 @@ function killCoverVideo() {
|
||||
|
||||
function coverVideoIni() {
|
||||
if ($('video').hasClass('hls')) {
|
||||
var video = addComment.I('coverVideo');
|
||||
var video_src = $('#coverVideo').attr('data-src');
|
||||
if (Hls.isSupported()) {
|
||||
var hls = new Hls();
|
||||
hls.loadSource(video_src);
|
||||
hls.attachMedia(video);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, function () {
|
||||
video.play();
|
||||
});
|
||||
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = video_src;
|
||||
video.addEventListener('loadedmetadata', function () {
|
||||
video.play();
|
||||
});
|
||||
}
|
||||
$.getScript("https://cdn.jsdelivr.net/gh/mashirozx/Sakura@3.3.3/cdn/js/src/16.hls.js", function(){
|
||||
var video = addComment.I('coverVideo');
|
||||
var video_src = $('#coverVideo').attr('data-src');
|
||||
if (Hls.isSupported()) {
|
||||
var hls = new Hls();
|
||||
hls.loadSource(video_src);
|
||||
hls.attachMedia(video);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, function () {
|
||||
video.play();
|
||||
});
|
||||
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = video_src;
|
||||
video.addEventListener('loadedmetadata', function () {
|
||||
video.play();
|
||||
});
|
||||
}
|
||||
});
|
||||
//console.info('ini:coverVideoIni()');
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
@ -1,8 +1,8 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Sakura\n"
|
||||
"POT-Creation-Date: 2019-12-13 14:51+0800\n"
|
||||
"PO-Revision-Date: 2019-12-13 14:51+0800\n"
|
||||
"POT-Creation-Date: 2019-12-25 10:43+0800\n"
|
||||
"PO-Revision-Date: 2019-12-25 10:43+0800\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: en_US\n"
|
||||
@ -107,7 +107,7 @@ msgid "Name* "
|
||||
msgstr ""
|
||||
|
||||
#: comments.php:95
|
||||
msgid "You\\' receive notification by email"
|
||||
msgid "You will receive notification by email"
|
||||
msgstr ""
|
||||
|
||||
#: comments.php:95
|
||||
@ -205,7 +205,7 @@ msgstr ""
|
||||
msgid "QQ"
|
||||
msgstr ""
|
||||
|
||||
#: functions.php:1664
|
||||
#: functions.php:1665
|
||||
msgid "Sidebar"
|
||||
msgstr ""
|
||||
|
||||
@ -1303,15 +1303,16 @@ msgid ""
|
||||
msgstr ""
|
||||
|
||||
#: options.php:879
|
||||
msgid "Cover CDN"
|
||||
msgid "Cover manifest"
|
||||
msgstr ""
|
||||
|
||||
#: options.php:880
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Fill in the cdn path for random picture display, without adding a slash at "
|
||||
"the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, "
|
||||
"Fill in the manifest path for random picture display, without adding a slash "
|
||||
"at the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, "
|
||||
"please refer to <a href = \"https: //github.com/mashirozx/Sakura/wiki/options"
|
||||
"\">Wiki </a>"
|
||||
"\">Wiki </a>. Click <a href = \"%s\">here</a> to update manifest"
|
||||
msgstr ""
|
||||
|
||||
#: options.php:886
|
||||
@ -1409,7 +1410,7 @@ msgid ""
|
||||
msgstr ""
|
||||
|
||||
#: options.php:973
|
||||
msgid "The categories of articles that don\\t not show on homepage"
|
||||
msgid "The categories of articles that don't not show on homepage"
|
||||
msgstr ""
|
||||
|
||||
#: options.php:974 options.php:981
|
||||
|
@ -3,7 +3,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
||||
"Project-Id-Version: Sakura\n"
|
||||
"POT-Creation-Date: 2019-12-13 14:50+0800\n"
|
||||
"POT-Creation-Date: 2019-12-25 10:43+0800\n"
|
||||
"PO-Revision-Date: 2019-11-01 14:27+0800\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
@ -107,7 +107,7 @@ msgid "Name* "
|
||||
msgstr ""
|
||||
|
||||
#: comments.php:95
|
||||
msgid "You\\' receive notification by email"
|
||||
msgid "You will receive notification by email"
|
||||
msgstr ""
|
||||
|
||||
#: comments.php:95
|
||||
@ -204,7 +204,7 @@ msgstr ""
|
||||
msgid "QQ"
|
||||
msgstr ""
|
||||
|
||||
#: functions.php:1664
|
||||
#: functions.php:1665
|
||||
msgid "Sidebar"
|
||||
msgstr ""
|
||||
|
||||
@ -1287,14 +1287,16 @@ msgid ""
|
||||
msgstr ""
|
||||
|
||||
#: options.php:879
|
||||
msgid "Cover CDN"
|
||||
msgid "Cover manifest"
|
||||
msgstr ""
|
||||
|
||||
#: options.php:880
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Fill in the cdn path for random picture display, without adding a slash at the end, for "
|
||||
"Fill in the manifest path for random picture display, without adding a slash at the end, for "
|
||||
"example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, please refer to <a href = "
|
||||
"\"https: //github.com/mashirozx/Sakura/wiki/options\">Wiki </a>"
|
||||
"\"https: //github.com/mashirozx/Sakura/wiki/options\">Wiki </a>. Click <a href = \"%s\">here</"
|
||||
"a> to update manifest"
|
||||
msgstr ""
|
||||
|
||||
#: options.php:886
|
||||
@ -1387,7 +1389,7 @@ msgid ""
|
||||
msgstr ""
|
||||
|
||||
#: options.php:973
|
||||
msgid "The categories of articles that don\\t not show on homepage"
|
||||
msgid "The categories of articles that don't not show on homepage"
|
||||
msgstr ""
|
||||
|
||||
#: options.php:974 options.php:981
|
||||
|
Binary file not shown.
@ -1,8 +1,8 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Sakura\n"
|
||||
"POT-Creation-Date: 2019-12-13 14:51+0800\n"
|
||||
"PO-Revision-Date: 2019-12-13 14:51+0800\n"
|
||||
"POT-Creation-Date: 2019-12-25 10:43+0800\n"
|
||||
"PO-Revision-Date: 2019-12-25 10:44+0800\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: zh_CN\n"
|
||||
@ -107,7 +107,7 @@ msgid "Name* "
|
||||
msgstr "昵称 "
|
||||
|
||||
#: comments.php:95
|
||||
msgid "You\\' receive notification by email"
|
||||
msgid "You will receive notification by email"
|
||||
msgstr "你将收到回复通知"
|
||||
|
||||
#: comments.php:95
|
||||
@ -207,7 +207,7 @@ msgstr ""
|
||||
msgid "QQ"
|
||||
msgstr ""
|
||||
|
||||
#: functions.php:1664
|
||||
#: functions.php:1665
|
||||
msgid "Sidebar"
|
||||
msgstr "侧栏"
|
||||
|
||||
@ -955,7 +955,7 @@ msgstr "聚焦图二链接"
|
||||
|
||||
#: options.php:509
|
||||
msgid "Top-feature 3 image"
|
||||
msgstr "聚焦图二链接"
|
||||
msgstr "聚焦图三"
|
||||
|
||||
#: options.php:516 options.php:517
|
||||
msgid "Top-feature 3 title"
|
||||
@ -1324,19 +1324,21 @@ msgstr ""
|
||||
"名/2018/05/xx.png 加载"
|
||||
|
||||
#: options.php:879
|
||||
msgid "Cover CDN"
|
||||
msgstr "封面图图片库"
|
||||
msgid "Cover manifest"
|
||||
msgstr ""
|
||||
|
||||
#: options.php:880
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Fill in the cdn path for random picture display, without adding a slash at "
|
||||
"the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, "
|
||||
"Fill in the manifest path for random picture display, without adding a slash "
|
||||
"at the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, "
|
||||
"please refer to <a href = \"https: //github.com/mashirozx/Sakura/wiki/options"
|
||||
"\">Wiki </a>"
|
||||
"\">Wiki </a>. Click <a href = \"%s\">here</a> to update manifest"
|
||||
msgstr ""
|
||||
"填写 cdn 路径,用于随机图片展示,最后不用加斜杠,例:https://cdn.jsdelivr."
|
||||
"net/gh/mashirozx/sakura@3.3.3 ,更多信息请参考<a href=\"https://github.com/"
|
||||
"mashirozx/Sakura/wiki/options\">Wiki</a>"
|
||||
"填写 manifest 路径,用于随机图片展示,最后不用加斜杠,例:https://cdn."
|
||||
"jsdelivr.net/gh/mashirozx/sakura@3.3.3 ,更多信息请参考<a href=\"https://"
|
||||
"github.com/mashirozx/Sakura/wiki/options\">Wiki</a>。点击<a href =\"%s\">这里"
|
||||
"</a>更新manifest"
|
||||
|
||||
#: options.php:886
|
||||
msgid "Use the front-end library locally (lib.js、lib.css)"
|
||||
@ -1442,7 +1444,7 @@ msgstr ""
|
||||
"个字母 = 1字节,自己计算吧"
|
||||
|
||||
#: options.php:973
|
||||
msgid "The categories of articles that don\\t not show on homepage"
|
||||
msgid "The categories of articles that don't not show on homepage"
|
||||
msgstr "首页不显示的分类文章"
|
||||
|
||||
#: options.php:974 options.php:981
|
||||
@ -1850,6 +1852,9 @@ msgstr "注 册"
|
||||
msgid "Registration is not open yet."
|
||||
msgstr "暂未开放注册。"
|
||||
|
||||
#~ msgid "Cover CDN"
|
||||
#~ msgstr "封面图图片库"
|
||||
|
||||
#~ msgid "Jsdelivr CDN"
|
||||
#~ msgstr "随机图片"
|
||||
|
||||
|
@ -58,9 +58,6 @@
|
||||
<?php if (akina_option('facebook')){ ?>
|
||||
<li><a href="<?php echo akina_option('facebook', ''); ?>" target="_blank" class="social-wangyiyun" title="Facebook"><img src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/sns/facebook.png"/></a></li>
|
||||
<?php } ?>
|
||||
<?php if (akina_option('googleplus')){ ?>
|
||||
<li><a href="<?php echo akina_option('googleplus', ''); ?>" target="_blank" class="social-wangyiyun" title="Google+"><img src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/sns/googleplus.png"/></a></li>
|
||||
<?php } ?>
|
||||
<?php if (akina_option('jianshu')){ ?>
|
||||
<li><a href="<?php echo akina_option('jianshu', ''); ?>" target="_blank" class="social-wangyiyun" title="Jianshu"><img src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/sns/jianshu.png"/></a></li>
|
||||
<?php } ?>
|
||||
|
@ -24,8 +24,6 @@ pip3 install Pillow
|
||||
pip install Pillow --user
|
||||
```
|
||||
|
||||
用同样的方法安装`requests`
|
||||
|
||||
### 运行
|
||||
把图片文件放到 `gallary` 目录,Windows 可直接双击 manifest.py,或者和其他操作系统一样,在 Terminal、Powershell、CMD 中运行:
|
||||
|
||||
|
@ -7,8 +7,6 @@ Desc: Webp convertor
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import requests
|
||||
import base64
|
||||
import hashlib
|
||||
from PIL import Image
|
||||
|
||||
@ -50,49 +48,24 @@ class Single(object):
|
||||
self.manifest()
|
||||
return self.mani
|
||||
|
||||
|
||||
class Upload2Wordpress(object):
|
||||
def __init__(self, username, password, url):
|
||||
self.username = username
|
||||
self.password = password
|
||||
self.url = url
|
||||
|
||||
def upload(self, file, field):
|
||||
data_string = self.username + ':' + self.password
|
||||
token = base64.b64encode(data_string.encode()).decode('utf-8')
|
||||
headers = {
|
||||
'Authorization': 'Basic ' + token,
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97"
|
||||
}
|
||||
files = {field: open(file, mode="rb")}
|
||||
reply = requests.post(self.url, headers=headers, files=files)
|
||||
print(json.loads(reply.content)['message'])
|
||||
|
||||
def main(self):
|
||||
print('start uploading `manifest.json`...')
|
||||
self.upload('manifest.json', 'manifest')
|
||||
|
||||
|
||||
def gen_manifest_json():
|
||||
onlyfiles = [f for f in os.listdir('gallary') if os.path.isfile(os.path.join('gallary', f))]
|
||||
id = 1
|
||||
Manifest = {}
|
||||
for f in onlyfiles:
|
||||
worker = Single(f, Manifest)
|
||||
Manifest = worker.main()
|
||||
print(str(id) + '/' + str(len(onlyfiles)))
|
||||
id += 1
|
||||
try:
|
||||
worker = Single(f, Manifest)
|
||||
Manifest = worker.main()
|
||||
print(str(id) + '/' + str(len(onlyfiles)))
|
||||
id += 1
|
||||
except OSError:
|
||||
print("Falied to optimize the picture: " + f)
|
||||
with open('manifest.json', 'w+') as json_file:
|
||||
json.dump(Manifest, json_file)
|
||||
|
||||
|
||||
def main():
|
||||
gen_manifest_json()
|
||||
username = input('Enter your username: ')
|
||||
password = input('Enter your password: ')
|
||||
url = input('Enter your rest api url: ')
|
||||
upload = Upload2Wordpress(username, password, url)
|
||||
upload.main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
14
options.php
14
options.php
@ -689,14 +689,14 @@ function optionsframework_options() {
|
||||
'id' => 'facebook',
|
||||
'std' => '',
|
||||
'type' => 'text');
|
||||
|
||||
/*
|
||||
$options[] = array(
|
||||
'name' => __('Google+', 'sakura'),
|
||||
'desc' => __('G+ address', 'sakura'),/*G+地址*/
|
||||
'desc' => __('G+ address', 'sakura'),
|
||||
'id' => 'googleplus',
|
||||
'std' => '',
|
||||
'type' => 'text');
|
||||
|
||||
*/
|
||||
$options[] = array(
|
||||
'name' => __('Jianshu', 'sakura'),/*简书*/
|
||||
'desc' => __('Jianshu address', 'sakura'),/*简书地址*/
|
||||
@ -876,8 +876,8 @@ function optionsframework_options() {
|
||||
'type' => 'text');
|
||||
|
||||
$options[] = array(
|
||||
'name' => __('Cover CDN', 'sakura'),/*封面图片库*/
|
||||
'desc' => __('Fill in the cdn path for random picture display, without adding a slash at the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, please refer to <a href = "https: //github.com/mashirozx/Sakura/wiki/options">Wiki </a>', 'sakura'),/*填写 cdn 路径,用于随机图片展示,最后不用加斜杠,例:https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3 ,更多信息请参考<a href="https://github.com/mashirozx/Sakura/wiki/options">Wiki</a>*/
|
||||
'name' => __('Cover manifest', 'sakura'),/*封面图片库*/
|
||||
'desc' => sprintf(__('Fill in the manifest path for random picture display, without adding a slash at the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, please refer to <a href = "https: //github.com/mashirozx/Sakura/wiki/options">Wiki </a>. Click <a href = "%s">here</a> to update manifest', 'sakura'), rest_url('sakura/v1/database/update')),/*填写 manifest 路径 ,用于随机图片展示,最后不用加斜杠,例:https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3 ,更多信息请参考<a href="https://github.com/mashirozx/Sakura/wiki/options">Wiki</a>*/
|
||||
'id' => 'cover_cdn',
|
||||
'std' => 'https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3',
|
||||
'type' => 'text');
|
||||
@ -916,7 +916,7 @@ function optionsframework_options() {
|
||||
'type' => "images",
|
||||
'options' => array(
|
||||
'tag' => 'https://img.shields.io/github/release/mashirozx/Sakura.svg?style=flat-square',
|
||||
'tag2' => 'https://img.shields.io/github/commits-since/mashirozx/Sakura/v'.SAKURA_VERSION.'.svg?style=flat-square'
|
||||
'tag2' => 'https://img.shields.io/github/commits-since/mashirozx/Sakura/v'.SAKURA_VERSION.'/dev.svg?style=flat-square'
|
||||
)
|
||||
);
|
||||
|
||||
@ -970,7 +970,7 @@ function optionsframework_options() {
|
||||
'type' => 'text');
|
||||
|
||||
$options[] = array(
|
||||
'name' => __('The categories of articles that don\t not show on homepage', 'sakura'),/*首页不显示的分类文章*/
|
||||
'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,多个用英文“ , ”分开*/
|
||||
'id' => 'classify_display',
|
||||
'std' => '',
|
||||
|
@ -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.3
|
||||
Version: 3.3.5
|
||||
License: GNU General Public License v2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
Text Domain: sakura
|
||||
@ -6809,7 +6809,8 @@ input[type=radio]:checked:before {
|
||||
.changeSkin-gear {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 5px;
|
||||
left: auto;
|
||||
right: 5px;
|
||||
width: auto;
|
||||
height: auto;
|
||||
z-index: 99;
|
||||
@ -8294,7 +8295,8 @@ td.hljs-ln-numbers {
|
||||
.skin-menu {
|
||||
position: fixed;
|
||||
bottom: 50px;
|
||||
left: 10px;
|
||||
left: auto;
|
||||
right: 10px;
|
||||
height: auto;
|
||||
width: 220px;
|
||||
border-radius: 5px;
|
||||
|
Loading…
Reference in New Issue
Block a user