Skip to content

Commit

Permalink
Merge pull request #185 from mashirozx/dev
Browse files Browse the repository at this point in the history
update to v3.3.6
  • Loading branch information
mashirozx authored Jan 10, 2020
2 parents 9ddaad7 + a6e42f1 commit ccb0b6f
Show file tree
Hide file tree
Showing 12 changed files with 3,198 additions and 3,019 deletions.
1,871 changes: 999 additions & 872 deletions functions.php

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@
<?php endif; ?>
</head>
<body <?php body_class(); ?>>
<?php if(get_template_directory_uri() != get_site_url().'/wp-content/themes/Sakura') echo '<div style="position:fixed;height:100%;width:100%;top:0;left:0;font-size:20px;z-index:999999;background-color: #fff;">Plz rename the theme folder name as <span style="color:red">Sakura</span>!<br>请将主题文件夹名改为 <span style="color:red">Sakura</span>!</div>'; ?>
<div class="scrollbar" id="bar"></div>
<div class="scrollbar" id="bar"></div>
<section id="main-container">
<?php
if(!akina_option('head_focus')){
Expand Down
88 changes: 44 additions & 44 deletions inc/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,23 @@ function cache_search_json()
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/image/cover
*/
function cover_gallery() {
global $wpdb,$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];
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];
}
}
$data = array('cover image');
$response = new WP_REST_Response($data);
Expand All @@ -346,51 +355,42 @@ function cover_gallery() {
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/image/feature
*/
function feature_gallery() {
global $wpdb,$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];
}
$data = array('cover image');
$response = new WP_REST_Response($data);
$response->set_status(302);
$response->header('Location', $imgurl);
return $response;
return cover_gallery();
}

/*
* update database rest api
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/database/update
*/
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_uri();
$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 `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.";
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.";
}
$result = new WP_REST_Response($output, 200);
return $result;
}else{
$output = "manifest.json not found, please ensure your url is corrent.";
return new WP_REST_Response("Invalid access", 200);
}
$result = new WP_REST_Response($output, 200);
return $result;
}

/**
Expand Down
16 changes: 4 additions & 12 deletions js/sakura-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ if (mashiro_option.float_player_on) {
autoplay: !1,
mutex: !0,
lrcType: 3,
listFolded: !1,
listFolded: 1,
preload: 'auto',
theme: '#2980b9',
loop: 'all',
Expand Down Expand Up @@ -789,23 +789,13 @@ if (mashiro_option.float_player_on) {
lrcTag = 2;
});
var apSwitchTag = 0;
var aplayerlist = $(".aplayer-list");
aplayerlist.removeClass("aplayer-list-hide").css({
maxHeight: '0px'
});
$(".aplayer.aplayer-fixed .aplayer-body").addClass("ap-hover");
$(".aplayer-miniswitcher").click(function () {
if (apSwitchTag == 0) {
aplayerlist.removeClass("aplayer-list-hide").animate({
maxHeight: '250px'
});
$(".aplayer.aplayer-fixed .aplayer-body").removeClass("ap-hover");
$("#secondary").addClass("active");
apSwitchTag = 1;
} else {
aplayerlist.css({
maxHeight: '0px'
});
$(".aplayer.aplayer-fixed .aplayer-body").addClass("ap-hover");
$("#secondary").removeClass("active");
apSwitchTag = 0;
Expand Down Expand Up @@ -999,7 +989,9 @@ function activate_widget(){
$("#secondary").remove();
}
}
activate_widget();
setTimeout(function () {
activate_widget();
}, 100);

mashiro_global.ini.normalize();
loadCSS(mashiro_option.jsdelivr_css_src);
Expand Down
Binary file modified languages/en_US.mo
Binary file not shown.
Loading

0 comments on commit ccb0b6f

Please sign in to comment.