Merge pull request #239 from mashirozx/issue-237

Issue 237
pull/240/head
Spirit 2020-08-09 14:57:50 +08:00 committed by GitHub
commit a831ae70e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 2312 additions and 2353 deletions

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

@ -424,7 +424,7 @@ 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);
@ -969,11 +969,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%;
@ -1762,16 +1762,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->set( 'posts_per_page', 10 - sizeof(get_option( 'sticky_posts' )) );
if ( $q->get( 'paged' ) > 1 )
$q->set( 'post__not_in', get_option( 'sticky_posts' ) );
}
});
//评论回复
function sakura_comment_notify($comment_id)
{

View File

@ -120,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;
}
/*

View File

@ -162,4 +162,13 @@ class Images
}
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;
}
}

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

View File

@ -1051,12 +1051,14 @@ function load_bangumi() {
var xhr = new XMLHttpRequest();
xhr.open('POST', this.href + "&_wpnonce=" + Poi.nonce, true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && 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 ');
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();

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

View File

@ -234,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',
@ -734,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'), /*后台配置*/
@ -1034,66 +1186,6 @@ function optionsframework_options()
'type_4' => __('23k Views (chinese)', 'sakura'), /*23k 次访问(中式)*/
));
$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' => __('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 api.php', 'sakura'), /*前台实现实时搜索,调用 Rest API 每小时更新一次缓存,可在 functions.php 里手动设置缓存时间*/
@ -1143,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;
}

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.8
Version: 3.3.9
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sakura
@ -1584,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;
@ -1619,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
}
@ -3656,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;

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');