Merge pull request #185 from mashirozx/dev

update to v3.3.6
pull/193/head v3.3.6
Mashiro 2020-01-10 21:29:05 +08:00 committed by GitHub
commit ccb0b6f5da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 3147 additions and 2968 deletions

File diff suppressed because it is too large Load Diff

View File

@ -78,7 +78,6 @@ 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>
<section id="main-container">
<?php

View File

@ -325,7 +325,15 @@ EOS;
* @rest api接口路径https://sakura.2heng.xin/wp-json/sakura/v1/image/cover
*/
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_rand($img_array);
$img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory_uri();
@ -334,6 +342,7 @@ function cover_gallery() {
} else {
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["jpeg"][0];
}
}
$data = array('cover image');
$response = new WP_REST_Response($data);
$response->set_status(302);
@ -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,9 +363,10 @@ function feature_gallery() {
* @rest api接口路径https://sakura.2heng.xin/wp-json/sakura/v1/database/update
*/
function update_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_uri();
$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(
@ -381,16 +378,19 @@ function update_database() {
"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->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 is corrent.";
$output = "manifest.json not found, please ensure your url ($img_domain) is corrent.";
}
$result = new WP_REST_Response($output, 200);
return $result;
}else{
return new WP_REST_Response("Invalid access", 200);
}
}
/**

View File

@ -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();
}
}
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

View File

@ -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 } ?>

View File

@ -5,9 +5,8 @@
* If the identifier changes, it'll appear as if the options have been reset.
*/
function optionsframework_option_name() {
function optionsframework_option_name()
{
// 从样式表获取主题名称
$themename = wp_get_theme();
@ -28,7 +27,8 @@ function optionsframework_option_name() {
* Frame from: https://github.com/devinsays/options-framework-plugin/
*/
function optionsframework_options() {
function optionsframework_options()
{
// 测试数据
$test_array = array(
'one' => __('1', 'sakura'),
@ -37,23 +37,22 @@ function optionsframework_options() {
'four' => __('4', 'sakura'),
'five' => __('5', 'sakura'),
'six' => __('6', 'sakura'),
'seven' => __('7', 'sakura')
'seven' => __('7', 'sakura'),
);
// 复选框数组
$multicheck_array = array(
'one' => __('1', 'sakura'),
'two' => __('2', 'sakura'),
'three' => __('3', 'sakura'),
'four' => __('4', 'sakura'),
'five' => __('5', 'sakura')
'five' => __('5', 'sakura'),
);
// 复选框默认值
$multicheck_defaults = array(
'one' => '1',
'five' => '1'
'five' => '1',
);
// 背景默认值
@ -76,7 +75,7 @@ function optionsframework_options() {
'sizes' => array('6', '12', '14', '16', '20'),
'faces' => array('Helvetica Neue' => 'Helvetica Neue', 'Arial' => 'Arial'),
'styles' => array('normal' => '普通', 'bold' => '粗体'),
'color' => false
'color' => false,
);
// 将所有分类categories加入数组
@ -93,7 +92,6 @@ function optionsframework_options() {
$options_tags[$tag->term_id] = $tag->name;
}
// 将所有页面pages加入数组
$options_pages = array();
$options_pages_obj = get_pages('sort_column=post_parent,menu_order');
@ -131,7 +129,7 @@ function optionsframework_options() {
'id' => 'theme_skin',
'std' => "#FE9600",
'desc' => __('Custom theme color', 'sakura'), /*自定义主题颜色*/
'type' => "color"
'type' => "color",
);
$options[] = array(
@ -229,7 +227,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'yes' => __('Open', 'sakura'),
'no' => __('Close', 'sakura')
'no' => __('Close', 'sakura'),
));
$options[] = array(
@ -239,7 +237,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'standard' => __('Standard', 'sakura'), /*标准*/
'imageflow' => __('Graphic', 'sakura')/*图文*/
'imageflow' => __('Graphic', 'sakura'), /*图文*/
));
$options[] = array(
@ -249,7 +247,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'round' => __('Round', 'sakura'), /*圆形*/
'square' => __('Square', 'sakura')/*方形*/
'square' => __('Square', 'sakura'), /*方形*/
));
$options[] = array(
@ -260,7 +258,7 @@ function optionsframework_options() {
'options' => array(
'left' => __('Left', 'sakura'), /*向左对齐*/
'right' => __('Right', 'sakura'), /*向右对齐*/
'alternate' => __('Alternate', 'sakura')/*左右交替*/
'alternate' => __('Alternate', 'sakura'), /*左右交替*/
));
$options[] = array(
@ -270,7 +268,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'yes' => __('Open', 'sakura'), /*开启*/
'no' => __('Close', 'sakura')/*关闭*/
'no' => __('Close', 'sakura'), /*关闭*/
));
$options[] = array(
@ -287,7 +285,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'ajax' => __('Ajax load', 'sakura'), /*ajax加载*/
'np' => __('Previous and next page', 'sakura')/*上一页和下一页*/
'np' => __('Previous and next page', 'sakura'), /*上一页和下一页*/
));
$options[] = array(
@ -346,7 +344,6 @@ function optionsframework_options() {
'std' => '',
'type' => 'textarea');
//第一屏
$options[] = array(
'name' => __('First screen', 'sakura'), /*第一屏*/
@ -373,9 +370,29 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'v2' => __('Merge with signature', 'sakura'), /*与签名合并*/
'v1' => __('Independent line', 'sakura')/*独立成行*/
'v1' => __('Independent line', 'sakura'), /*独立成行*/
));
$options[] = array(
'name' => __('Cover manifest', 'sakura'), /*封面图片库选项*/
'desc' => __('Select how to call the cover random image', 'sakura'), /*选择封面随机图的调用方式*/
'id' => 'cover_cdn_options',
'std' => "type_2",
'type' => "select",
'options' => array(
'type_1' => __('webp images (optimization)', 'sakura'), /*webp优化随机图*/
'type_2' => __('built-in api (default)', 'sakura'), /*内置原图随机图*/
'type_3' => __('custom api (advanced)', 'sakura'), /*外部随机图API*/
)
);
$options[] = array(
'name' => __('Cover images url', 'sakura'), /*图片库url*/
'desc' => sprintf(__('Fill in the manifest path for random picture display, please refer to <a href = "https: //github.com/mashirozx/Sakura/wiki/options">Wiki </a>. If you select webp images above, click <a href = "%s">here</a> to update manifest', 'sakura'), rest_url('sakura/v1/database/update')), /*填写 manifest 路径,更多信息请参考<a href="https://github.com/mashirozx/Sakura/wiki/options">Wiki</a>,如果你在上面选择了webp优化点击<a href = "%s">这里</a>更新 manifest*/
'id' => 'cover_cdn',
'std' => 'https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3',
'type' => 'text');
$options[] = array(
'name' => __('full-screen display', 'sakura'), /*全屏显示*/
'desc' => __('Default on, check off', 'sakura'), /*默认开启,勾选关闭*/
@ -421,7 +438,7 @@ function optionsframework_options() {
'filter-undertint' => __('Undertint', 'sakura'), /*浅色*/
'filter-dim' => __('Dim', 'sakura'), /*暗淡*/
'filter-grid' => __('Grid', 'sakura'), /*网格*/
'filter-dot' => __('Dot', 'sakura')/*点点*/
'filter-dot' => __('Dot', 'sakura'), /*点点*/
));
$options[] = array(
@ -438,7 +455,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'left_and_right' => __('Alternate left and right', 'sakura'), /*左右交替*/
'bottom_to_top' => __('From bottom to top', 'sakura')/*从下往上*/
'bottom_to_top' => __('From bottom to top', 'sakura'), /*从下往上*/
));
$options[] = array(
@ -533,7 +550,6 @@ function optionsframework_options() {
'std' => '#',
'type' => 'text');
//文章页
$options[] = array(
'name' => __('Post page', 'sakura'), /*文章页*/
@ -556,7 +572,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'yes' => __('Open', 'sakura'), /*开启*/
'no' => __('Close', 'sakura')/*关闭*/
'no' => __('Close', 'sakura'), /*关闭*/
));
$options[] = array(
@ -566,7 +582,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'yes' => __('Open', 'sakura'), /*开启*/
'no' => __('Close', 'sakura')/*关闭*/
'no' => __('Close', 'sakura'), /*关闭*/
));
$options[] = array(
@ -576,7 +592,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'yes' => __('Open', 'sakura'), /*开启*/
'no' => __('Close', 'sakura')/*关闭*/
'no' => __('Close', 'sakura'), /*关闭*/
));
$options[] = array(
@ -586,7 +602,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'yes' => __('Open', 'sakura'), /*开启*/
'no' => __('Close', 'sakura')/*关闭*/
'no' => __('Close', 'sakura'), /*关闭*/
));
$options[] = array(
@ -601,7 +617,6 @@ function optionsframework_options() {
'id' => 'wechat_code',
'type' => 'upload');
//社交选项
$options[] = array(
'name' => __('Social network', 'sakura'), /*社交网络*/
@ -689,14 +704,7 @@ function optionsframework_options() {
'id' => 'facebook',
'std' => '',
'type' => 'text');
/*
$options[] = array(
'name' => __('Google+', 'sakura'),
'desc' => __('G+ address', 'sakura'),
'id' => 'googleplus',
'std' => '',
'type' => 'text');
*/
$options[] = array(
'name' => __('Jianshu', 'sakura'), /*简书*/
'desc' => __('Jianshu address', 'sakura'), /*简书地址*/
@ -750,7 +758,7 @@ function optionsframework_options() {
'id' => 'dash_scheme_color_a',
'std' => "#c6742b",
'desc' => __('<i>(array) (optional)</i> An array of CSS color definitions which are used to give the user a feel for the theme.', 'sakura'),
'type' => "color"
'type' => "color",
);
$options[] = array(
@ -758,7 +766,7 @@ function optionsframework_options() {
'id' => 'dash_scheme_color_b',
'std' => "#d88e4c",
'desc' => __('<i>(array) (optional)</i> An array of CSS color definitions which are used to give the user a feel for the theme.', 'sakura'),
'type' => "color"
'type' => "color",
);
$options[] = array(
@ -766,7 +774,7 @@ function optionsframework_options() {
'id' => 'dash_scheme_color_c',
'std' => "#695644",
'desc' => __('<i>(array) (optional)</i> An array of CSS color definitions which are used to give the user a feel for the theme.', 'sakura'),
'type' => "color"
'type' => "color",
);
$options[] = array(
@ -774,7 +782,7 @@ function optionsframework_options() {
'id' => 'dash_scheme_color_d',
'std' => "#a19780",
'desc' => __('<i>(array) (optional)</i> An array of CSS color definitions which are used to give the user a feel for the theme.', 'sakura'),
'type' => "color"
'type' => "color",
);
$options[] = array(
@ -782,7 +790,7 @@ function optionsframework_options() {
'id' => 'dash_scheme_color_base',
'std' => "#e5f8ff",
'desc' => __('<i>(array) (optional)</i> An array of CSS color definitions used to color any SVG icons.', 'sakura'),
'type' => "color"
'type' => "color",
);
$options[] = array(
@ -790,7 +798,7 @@ function optionsframework_options() {
'id' => 'dash_scheme_color_focus',
'std' => "#fff",
'desc' => __('<i>(array) (optional)</i> An array of CSS color definitions used to color any SVG icons.', 'sakura'),
'type' => "color"
'type' => "color",
);
$options[] = array(
@ -798,7 +806,7 @@ function optionsframework_options() {
'id' => 'dash_scheme_color_current',
'std' => "#fff",
'desc' => __('<i>(array) (optional)</i> An array of CSS color definitions used to color any SVG icons.', 'sakura'),
'type' => "color"
'type' => "color",
);
$options[] = array(
@ -875,13 +883,6 @@ function optionsframework_options() {
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('Cover manifest', 'sakura'),/*封面图片库*/
'desc' => sprintf(__('Fill in the manifest path for random picture display, without adding a slash at the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, please refer to <a href = "https: //github.com/mashirozx/Sakura/wiki/options">Wiki </a>. Click <a href = "%s">here</a> to update manifest', 'sakura'), rest_url('sakura/v1/database/update')),/*填写 manifest 路径 用于随机图片展示最后不用加斜杠https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3 ,更多信息请参考<a href="https://github.com/mashirozx/Sakura/wiki/options">Wiki</a>*/
'id' => 'cover_cdn',
'std' => 'https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3',
'type' => 'text');
$options[] = array(
'name' => __('Use the front-end library locally (lib.js、lib.css)', 'sakura'), /*本地调用前端库lib.js、lib.css*/
'desc' => __('The front-end library don\'t load from jsDelivr, not recommand', 'sakura'), /*前端库不走 jsDelivr不建议启用*/
@ -916,8 +917,8 @@ function optionsframework_options() {
'type' => "images",
'options' => array(
'tag' => 'https://img.shields.io/github/release/mashirozx/Sakura.svg?style=flat-square',
'tag2' => 'https://img.shields.io/github/commits-since/mashirozx/Sakura/v'.SAKURA_VERSION.'/dev.svg?style=flat-square'
)
'tag2' => 'https://img.shields.io/github/commits-since/mashirozx/Sakura/v' . SAKURA_VERSION . '/dev.svg?style=flat-square',
),
);
$options[] = array(
@ -990,7 +991,7 @@ function optionsframework_options() {
'type' => "radio",
'options' => array(
'wp_statistics' => __('WP-Statistics plugin (Professional statistics, can exclude invalid access)', 'sakura'), /*WP-Statistics 插件(专业性统计,可排除无效访问)*/
'theme_build_in' => __('Theme built-in (simple statistics, calculate each page access request)', 'sakura')/*主题内建(简单的统计,计算每一次页面访问请求)*/
'theme_build_in' => __('Theme built-in (simple statistics, calculate each page access request)', 'sakura'), /*主题内建(简单的统计,计算每一次页面访问请求)*/
));
$options[] = array(
@ -1013,7 +1014,7 @@ function optionsframework_options() {
'options' => array(
'imgur' => __('Imgur (https://imgur.com)', 'sakura'),
'smms' => __('SM.MS (https://sm.ms)', 'sakura'),
'chevereto' => __('Chevereto (https://chevereto.com)', 'sakura')
'chevereto' => __('Chevereto (https://chevereto.com)', 'sakura'),
));
$options[] = array(

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.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