Skip to content

Commit

Permalink
Merge pull request #462 from mirai-mamori/preview
Browse files Browse the repository at this point in the history
物語「ものがたり」 Chapter Ⅰ ~君が見た夢の物語~ Update Enhancement Package 1
  • Loading branch information
mirai-mamori authored Mar 25, 2022
2 parents 4011651 + 51c30d1 commit b5c9590
Show file tree
Hide file tree
Showing 172 changed files with 587 additions and 186 deletions.
2 changes: 1 addition & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ function convertip($ip)
if (empty($ip)) $ip = get_comment_author_IP();
$ch = curl_init();
$timeout = 5;
if (iro_opt('statistics_format') === 'type_1') {
if (iro_opt('ipsource') === 'type_1') {
$url = 'https://api.maho.cc/ip?ip=' . $ip;
} else {
$url = 'https://ip.taobao.com/outGetIpInfo?accessKey=alibaba-inc&ip=' . $ip;
Expand Down
25 changes: 23 additions & 2 deletions inc/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,20 @@ function cover_gallery() {
}else{
$imgurl = Images::cover_gallery();
}
if (!$imgurl['status']){
return new WP_REST_Response(
array(
'status' => 500,
'success' => false,
'message' => $imgurl['msg']
),
500
);
}
$data = array('cover image');
$response = new WP_REST_Response($data);
$response->set_status(302);
$response->header('Location', $imgurl);
$response->header('Location', $imgurl['url']);
return $response;
}

Expand All @@ -131,10 +141,21 @@ function cover_gallery() {
*/
function feature_gallery() {
$imgurl = Images::feature_gallery();
if (!$imgurl['status']){
return new WP_REST_Response(
array(
'status' => 500,
'success' => false,
'message' => $imgurl['msg']
),
500
);
}
$data = array('feature image');
$response = new WP_REST_Response($data);
$response->set_status(302);
$response->header('Location', $imgurl);
var_dump($imgurl);
$response->header('Location', $imgurl['url']);
return $response;
}

Expand Down
13 changes: 10 additions & 3 deletions inc/classes/Images.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ public function SMMS_API($image) {
public static function cover_gallery() {
if (iro_opt('random_graphs_options') == 'local') {
$img_array = glob(get_template_directory() . '/manifest/gallary/*.{gif,jpg,jpeg,png}', GLOB_BRACE);
if (count($img_array) == 0){
return ['status'=>False,'msg'=>'ERROR:请联系管理员查看gallary目录中是否存在图片!'];
}
$img = array_rand($img_array);
$imgurl = trim($img_array[$img]);
$imgurl = str_replace(get_template_directory(), get_template_directory_uri(), $imgurl);
Expand All @@ -156,16 +159,20 @@ public static function cover_gallery() {
$img_domain = iro_opt('random_graphs_link') ?: get_template_directory_uri();
if (strpos($_SERVER['HTTP_ACCEPT'], 'image/webp') !== false) {
$imgurl = $img_domain . "/manifest/" . $img_array[$img]['webp'][0];
var_dump($imgurl);
} else {
$imgurl = $img_domain . "/manifest/" . $img_array[$img]['jpeg'][0];
}
}
return $imgurl;
return ['status'=>True,'url'=>$imgurl];
}

public static function mobile_cover_gallery() {
if (iro_opt('random_graphs_options') == 'local') {
$img_array = glob(get_template_directory() . '/manifest/gallary/*.{gif,jpg,jpeg,png}', GLOB_BRACE);
if (count($img_array) == 0){
return ['status'=>False,'msg'=>'没有找到图片,请联系管理员检查gallary目录下是否存在图片'];
}
$img = array_rand($img_array);
$imgurl = trim($img_array[$img]);
$imgurl = str_replace(get_template_directory(), get_template_directory_uri(), $imgurl);
Expand All @@ -183,12 +190,12 @@ public static function mobile_cover_gallery() {
$imgurl = $img_domain . "/manifest/" . $img_array[$img]['jpeg'][0];
}
}
return $imgurl;
return ['status'=>True,'url'=>$imgurl];
}

public static function feature_gallery() {
if (iro_opt('post_cover_options') == 'type_2') {
$imgurl = iro_opt('post_cover');
return ['status'=>True,'url'=>iro_opt('post_cover')];
} else {
$imgurl = self::cover_gallery();
}
Expand Down
10 changes: 9 additions & 1 deletion inc/swicher.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ function ecs_src($a) {
'loading_ph'=>iro_opt('load_in_svg'),
'clipboardCopyright' => iro_opt('clipboard_copyright') == '0' ? false:true,
'entry_content_style' => iro_opt('entry_content_style'),
'cover_api' => rest_url('sakura/v1/image/cover'),
'random_graphs_mts' => check(iro_opt('random_graphs_mts' )),
'code_highlight' => iro_opt('code_highlight_method','hljs'),
'comment_upload_img' => iro_opt('img_upload_api')=='off' ? false : true,
Expand All @@ -69,6 +68,15 @@ function ecs_src($a) {
];
$reception_background = iro_opt('reception_background');
// 判空 empty 如果变量不存在也会返回true
if (iro_opt('random_graphs_options') == 'external_api') {
if (wp_is_mobile()) {
$iro_opt['cover_api'] = iro_opt('random_graphs_link_mobile');
}else{
$iro_opt['cover_api'] = iro_opt('random_graphs_link');
}
} else {
$iro_opt['cover_api'] = rest_url('sakura/v1/image/cover');
}
!empty($reception_background['img1']) && $iro_opt['skin_bg0'] = $reception_background['img1'];
!empty($reception_background['img2']) && $iro_opt['skin_bg1'] = $reception_background['img2'];
!empty($reception_background['img3']) && $iro_opt['skin_bg2'] = $reception_background['img3'];
Expand Down
3 changes: 3 additions & 0 deletions js/103.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions js/103.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion js/114.js.map

This file was deleted.

2 changes: 0 additions & 2 deletions js/128.js

This file was deleted.

1 change: 0 additions & 1 deletion js/128.js.map

This file was deleted.

1 change: 0 additions & 1 deletion js/138.css.map

This file was deleted.

1 change: 0 additions & 1 deletion js/152.js.map

This file was deleted.

1 change: 0 additions & 1 deletion js/155.js.map

This file was deleted.

4 changes: 2 additions & 2 deletions js/759.js → js/218.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b5c9590

Please sign in to comment.