mirror of
https://github.com/mashirozx/sakura.git
synced 2024-11-22 23:08:14 +08:00
commit
ccb0b6f5da
1177
functions.php
1177
functions.php
File diff suppressed because it is too large
Load Diff
@ -78,7 +78,6 @@ window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)}
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</head>
|
</head>
|
||||||
<body <?php body_class(); ?>>
|
<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">
|
<section id="main-container">
|
||||||
<?php
|
<?php
|
||||||
|
38
inc/api.php
38
inc/api.php
@ -325,7 +325,15 @@ EOS;
|
|||||||
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/image/cover
|
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/image/cover
|
||||||
*/
|
*/
|
||||||
function cover_gallery() {
|
function cover_gallery() {
|
||||||
global $wpdb,$sakura_image_array;
|
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 = json_decode($sakura_image_array, true);
|
||||||
$img = array_rand($img_array);
|
$img = array_rand($img_array);
|
||||||
$img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory_uri();
|
$img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory_uri();
|
||||||
@ -334,6 +342,7 @@ function cover_gallery() {
|
|||||||
} else {
|
} else {
|
||||||
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["jpeg"][0];
|
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["jpeg"][0];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$data = array('cover image');
|
$data = array('cover image');
|
||||||
$response = new WP_REST_Response($data);
|
$response = new WP_REST_Response($data);
|
||||||
$response->set_status(302);
|
$response->set_status(302);
|
||||||
@ -346,20 +355,7 @@ function cover_gallery() {
|
|||||||
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/image/feature
|
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/image/feature
|
||||||
*/
|
*/
|
||||||
function feature_gallery() {
|
function feature_gallery() {
|
||||||
global $wpdb,$sakura_image_array;
|
return 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')) {
|
|
||||||
$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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -367,9 +363,10 @@ function feature_gallery() {
|
|||||||
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/database/update
|
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/database/update
|
||||||
*/
|
*/
|
||||||
function update_database() {
|
function update_database() {
|
||||||
|
if(akina_option('cover_cdn_options')=="type_1"){
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$sakura_table_name = $wpdb->base_prefix.'sakura';
|
$sakura_table_name = $wpdb->base_prefix.'sakura';
|
||||||
$img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory_uri();
|
$img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory();
|
||||||
$manifest = file_get_contents($img_domain . "/manifest/manifest.json");
|
$manifest = file_get_contents($img_domain . "/manifest/manifest.json");
|
||||||
if($manifest) {
|
if($manifest) {
|
||||||
$manifest = array(
|
$manifest = array(
|
||||||
@ -381,16 +378,19 @@ function update_database() {
|
|||||||
"mate_value" => date("Y-m-d H:i:s",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 $sakura_table_name WHERE `mate_key` ='manifest_json'");
|
||||||
$wpdb->query("DELETE FROM `wp_sakura` WHERE `mate_key` ='json_time'");
|
$wpdb->query("DELETE FROM $sakura_table_name WHERE `mate_key` ='json_time'");
|
||||||
$wpdb->insert($sakura_table_name,$manifest);
|
$wpdb->insert($sakura_table_name,$manifest);
|
||||||
$wpdb->insert($sakura_table_name,$time);
|
$wpdb->insert($sakura_table_name,$time);
|
||||||
$output = "manifest.json has been stored into database.";
|
$output = "manifest.json has been stored into database.";
|
||||||
}else{
|
}else{
|
||||||
$output = "manifest.json not found, please ensure your url is corrent.";
|
$output = "manifest.json not found, please ensure your url ($img_domain) is corrent.";
|
||||||
}
|
}
|
||||||
$result = new WP_REST_Response($output, 200);
|
$result = new WP_REST_Response($output, 200);
|
||||||
return $result;
|
return $result;
|
||||||
|
}else{
|
||||||
|
return new WP_REST_Response("Invalid access", 200);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -753,7 +753,7 @@ if (mashiro_option.float_player_on) {
|
|||||||
autoplay: !1,
|
autoplay: !1,
|
||||||
mutex: !0,
|
mutex: !0,
|
||||||
lrcType: 3,
|
lrcType: 3,
|
||||||
listFolded: !1,
|
listFolded: 1,
|
||||||
preload: 'auto',
|
preload: 'auto',
|
||||||
theme: '#2980b9',
|
theme: '#2980b9',
|
||||||
loop: 'all',
|
loop: 'all',
|
||||||
@ -789,23 +789,13 @@ if (mashiro_option.float_player_on) {
|
|||||||
lrcTag = 2;
|
lrcTag = 2;
|
||||||
});
|
});
|
||||||
var apSwitchTag = 0;
|
var apSwitchTag = 0;
|
||||||
var aplayerlist = $(".aplayer-list");
|
|
||||||
aplayerlist.removeClass("aplayer-list-hide").css({
|
|
||||||
maxHeight: '0px'
|
|
||||||
});
|
|
||||||
$(".aplayer.aplayer-fixed .aplayer-body").addClass("ap-hover");
|
$(".aplayer.aplayer-fixed .aplayer-body").addClass("ap-hover");
|
||||||
$(".aplayer-miniswitcher").click(function () {
|
$(".aplayer-miniswitcher").click(function () {
|
||||||
if (apSwitchTag == 0) {
|
if (apSwitchTag == 0) {
|
||||||
aplayerlist.removeClass("aplayer-list-hide").animate({
|
|
||||||
maxHeight: '250px'
|
|
||||||
});
|
|
||||||
$(".aplayer.aplayer-fixed .aplayer-body").removeClass("ap-hover");
|
$(".aplayer.aplayer-fixed .aplayer-body").removeClass("ap-hover");
|
||||||
$("#secondary").addClass("active");
|
$("#secondary").addClass("active");
|
||||||
apSwitchTag = 1;
|
apSwitchTag = 1;
|
||||||
} else {
|
} else {
|
||||||
aplayerlist.css({
|
|
||||||
maxHeight: '0px'
|
|
||||||
});
|
|
||||||
$(".aplayer.aplayer-fixed .aplayer-body").addClass("ap-hover");
|
$(".aplayer.aplayer-fixed .aplayer-body").addClass("ap-hover");
|
||||||
$("#secondary").removeClass("active");
|
$("#secondary").removeClass("active");
|
||||||
apSwitchTag = 0;
|
apSwitchTag = 0;
|
||||||
@ -999,7 +989,9 @@ function activate_widget(){
|
|||||||
$("#secondary").remove();
|
$("#secondary").remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
activate_widget();
|
setTimeout(function () {
|
||||||
|
activate_widget();
|
||||||
|
}, 100);
|
||||||
|
|
||||||
mashiro_global.ini.normalize();
|
mashiro_global.ini.normalize();
|
||||||
loadCSS(mashiro_option.jsdelivr_css_src);
|
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')){ ?>
|
<?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>
|
<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 } ?>
|
||||||
<?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')){ ?>
|
<?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>
|
<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 } ?>
|
<?php } ?>
|
||||||
|
653
options.php
653
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: Mashiro, Spirit, Louie, Fuzzz
|
||||||
Author URI: http://2heng.xin
|
Author URI: http://2heng.xin
|
||||||
Description: A wonderful branch of theme Akina
|
Description: A wonderful branch of theme Akina
|
||||||
Version: 3.3.5
|
Version: 3.3.6
|
||||||
License: GNU General Public License v2 or later
|
License: GNU General Public License v2 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
Text Domain: sakura
|
Text Domain: sakura
|
||||||
|
Loading…
Reference in New Issue
Block a user