mirror of
https://github.com/mashirozx/sakura.git
synced 2024-11-22 06:48:12 +08:00
commit
ccb0b6f5da
1847
functions.php
1847
functions.php
File diff suppressed because it is too large
Load Diff
@ -78,8 +78,7 @@ window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)}
|
||||
<?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')){
|
||||
|
88
inc/api.php
88
inc/api.php
@ -325,14 +325,23 @@ EOS;
|
||||
* @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);
|
||||
@ -346,20 +355,7 @@ 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();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -367,30 +363,34 @@ function feature_gallery() {
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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',
|
||||
@ -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;
|
||||
@ -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);
|
||||
|
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
@ -117,9 +117,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 } ?>
|
||||
|
2135
options.php
2135
options.php
File diff suppressed because it is too large
Load Diff
@ -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.5
|
||||
Version: 3.3.6
|
||||
License: GNU General Public License v2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
Text Domain: sakura
|
||||
|
Loading…
Reference in New Issue
Block a user