Skip to content

Commit

Permalink
Merge pull request #240 from mashirozx/dev
Browse files Browse the repository at this point in the history
update to v3.3.9
  • Loading branch information
mashirozx authored Aug 9, 2020
2 parents 7a1ec65 + a831ae7 commit 77722ed
Show file tree
Hide file tree
Showing 20 changed files with 1,821 additions and 1,829 deletions.
1 change: 1 addition & 0 deletions 404.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 页*/?>
Expand Down
8 changes: 4 additions & 4 deletions cdn/js/lib.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions cdn/js/src/01.jquery.min.js
100644 → 100755

Large diffs are not rendered by default.

23 changes: 7 additions & 16 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ function akina_comment_format($comment, $args, $depth)
</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);
Expand Down Expand Up @@ -801,7 +801,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');
Expand Down Expand Up @@ -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/[email protected]/img/other/hr.png" alt="hr" style="width:100%;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -1817,6 +1807,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)
Expand Down
27 changes: 23 additions & 4 deletions inc/Parsedown.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Parsedown
{
# ~

const version = '1.7.3';
const version = '1.7.4';

# ~

Expand Down Expand Up @@ -1489,22 +1489,41 @@ protected function element(array $Element)
}
}

$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'].'>';
Expand Down
7 changes: 6 additions & 1 deletion inc/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/*
Expand Down
11 changes: 10 additions & 1 deletion inc/classes/Images.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,21 @@ public static function cover_gallery() {
$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')) {
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;
}
}
14 changes: 10 additions & 4 deletions inc/css/optionsframework.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body {

.nav-tab-wrapper {
position: relative;
max-width: 860px;
max-width: 900px;
margin: auto !important;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
35 changes: 34 additions & 1 deletion inc/decorate.php

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions inc/login.css
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,7 @@ color: #676767 !important}
}

input[type=checkbox]:checked:before {
content: "\f147";
margin: -2px 0 0 -2px;
color: #FF5656;
}

/* loading */
Expand Down
2 changes: 2 additions & 0 deletions inc/swicher.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ function font_end_js_control() { ?>
mashiro_option.skin_bg7 = "https://cdn.jsdelivr.net/gh/moezx/[email protected]/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 {?>
Expand Down
36 changes: 17 additions & 19 deletions js/sakura-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,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]);
Expand Down Expand Up @@ -334,12 +334,11 @@ function checkDarkModeCookie() {
var dark = getCookie("dark"),
today = new Date(),
hour = today.getHours();
if ((!dark && (hour > 21 || hour < 7) ) || (dark == '1' && (hour >= 22 || hour <= 6))) {
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>');
console.log('夜间模式开启');
} else {
if (document.body.clientWidth > 860) {
setTimeout(function () {
Expand All @@ -351,7 +350,6 @@ function checkDarkModeCookie() {
$("#moblieDarkLight").html('<i class="fa fa-moon-o" aria-hidden="true"></i>');
setCookie("dark", "0", 0.33);
}
console.log('夜间模式关闭');
}
}
if (!getCookie("darkcache") && (new Date().getHours() > 21 || new Date().getHours() < 7)) {
Expand Down Expand Up @@ -399,45 +397,43 @@ $(document).ready(function () {
checkskinSecter();
}
if (tagid == "dark-bg") {
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");
$(".site-content").css("background-color", "#fff");
$("body").addClass("dark");
setCookie("dark", "1", 0.33);
} else{
$("html").css("background", "unset");
$("body").removeClass("dark");
$(".site-content").css("background-color", "rgba(255, 255, 255, .8)");
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) + ")");
$(".site-content").css("background-color", "#fff");
break;
case "sakura-bg":
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg1) + ")");
$(".site-content").css("background-color", "rgba(255, 255, 255, .8)");
break;
case "gribs-bg":
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg2) + ")");
$(".site-content").css("background-color", "rgba(255, 255, 255, .8)");
break;
case "pixiv-bg":
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg3) + ")");
$(".site-content").css("background-color", "rgba(255, 255, 255, .8)");
break;
case "KAdots-bg":
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg4) + ")");
$(".site-content").css("background-color", "rgba(255, 255, 255, .8)");
break;
case "totem-bg":
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg5) + ")");
$(".site-content").css("background-color", "rgba(255, 255, 255, .8)");
break;
case "bing-bg":
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg6) + ")");
$(".site-content").css("background-color", "rgba(255, 255, 255, .8)");
break;
// case "dark-bg":
// $("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg7) + ")");
Expand Down Expand Up @@ -1055,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();
Expand Down
Binary file modified languages/en_US.mo
Binary file not shown.
Loading

0 comments on commit 77722ed

Please sign in to comment.