feat: optimize logic

pull/409/head^2
Seaton Jiang 2021-08-20 08:51:54 +08:00
parent 2e5aaeea7f
commit 8dc052fea4
No known key found for this signature in database
GPG Key ID: 0E05070D261ACFEA
3 changed files with 7 additions and 7 deletions

View File

@ -9,18 +9,18 @@
?> ?>
<div class="k-footer"> <div class="k-footer">
<div class="f-toolbox"> <div class="f-toolbox">
<div class="gotop <?php if (kratos_option('g_wechat', false, 'g_wechat')) { <div class="gotop <?php if (kratos_option('g_wechat', false, 'g_wechat_fieldset')) {
echo 'gotop-haswechat'; echo 'gotop-haswechat';
} ?>"> } ?>">
<div class="gotop-btn"> <div class="gotop-btn">
<span class="kicon i-up"></span> <span class="kicon i-up"></span>
</div> </div>
</div> </div>
<?php if (kratos_option('g_wechat', false, 'g_wechat')) { ?> <?php if (kratos_option('g_wechat', false, 'g_wechat_fieldset')) { ?>
<div class="wechat"> <div class="wechat">
<span class="kicon i-wechat"></span> <span class="kicon i-wechat"></span>
<div class="wechat-pic"> <div class="wechat-pic">
<img src="<?php echo kratos_option('g_wechat_url', ASSET_PATH . '/assets/img/wechat.png', 'g_wechat'); ?>"> <img src="<?php echo kratos_option('g_wechat_url', ASSET_PATH . '/assets/img/wechat.png', 'g_wechat_fieldset'); ?>">
</div> </div>
</div> </div>
<?php } ?> <?php } ?>

View File

@ -232,11 +232,11 @@ function custom_upload_filter($file)
$ext = '.' . $info['extension']; $ext = '.' . $info['extension'];
$prdfix = kratos_option('g_renameother_prdfix', getdomain(home_url()), 'g_renameother') . '-'; $prdfix = kratos_option('g_renameother_prdfix', getdomain(home_url()), 'g_renameother_fieldset') . '-';
$img_mimes = array('jpg', 'JPG', 'jpeg', 'JPEG', 'gif', 'GIF', 'png', 'PNG', 'bmp', 'BMP', 'webp', 'WEBP', 'svg', 'SVG'); $img_mimes = array('jpg', 'JPG', 'jpeg', 'JPEG', 'gif', 'GIF', 'png', 'PNG', 'bmp', 'BMP', 'webp', 'WEBP', 'svg', 'SVG');
$str = kratos_option('g_renameother_mime', 'tar|zip|gz|gzip|rar|7z', 'g_renameother'); $str = kratos_option('g_renameother_mime', 'tar|zip|gz|gzip|rar|7z', 'g_renameother_fieldset');
$arr = explode("|", $str); $arr = explode("|", $str);
$arr = array_filter($arr); $arr = array_filter($arr);
@ -255,7 +255,7 @@ function custom_upload_filter($file)
} }
} }
if (kratos_option('g_renameother', false, 'g_renameother')) { if (kratos_option('g_renameother', false, 'g_renameother_fieldset')) {
foreach ($compressed_mimes as $compressed_mime) { foreach ($compressed_mimes as $compressed_mime) {
if ($info['extension'] == $compressed_mime) { if ($info['extension'] == $compressed_mime) {
$file['name'] = $prdfix . $file['name']; $file['name'] = $prdfix . $file['name'];

View File

@ -17,7 +17,7 @@ if (!function_exists('kratos_option')) {
$options = get_option('kratos_options'); $options = get_option('kratos_options');
if (!empty($fieldset)) { if (!empty($fieldset)) {
$results = $options[$fieldset . "_fieldset"][$option]; $results = $options[$fieldset][$option];
} else { } else {
$results = $options[$option]; $results = $options[$option];
} }