diff --git a/inc/theme-core.php b/inc/theme-core.php index 1e9c002..95306ea 100644 --- a/inc/theme-core.php +++ b/inc/theme-core.php @@ -232,11 +232,11 @@ function custom_upload_filter($file) $ext = '.' . $info['extension']; - $prdfix = kratos_option('g_renameother_prdfix', '') . '-'; + $prdfix = kratos_option('g_renameother_prdfix', getdomain(home_url()), 'g_renameother') . '-'; $img_mimes = array('jpg', 'JPG', 'jpeg', 'JPEG', 'gif', 'GIF', 'png', 'PNG', 'bmp', 'BMP', 'webp', 'WEBP', 'svg', 'SVG'); - $str = kratos_option('g_renameother_mime', ''); + $str = kratos_option('g_renameother_mime', 'tar|zip|gz|gzip|rar|7z', 'g_renameother'); $arr = explode("|", $str); $arr = array_filter($arr); @@ -255,7 +255,7 @@ function custom_upload_filter($file) } } - if (kratos_option('g_renameother', false)) { + if (kratos_option('g_renameother', false, 'g_renameother')) { foreach ($compressed_mimes as $compressed_mime) { if ($info['extension'] == $compressed_mime) { $file['name'] = $prdfix . $file['name']; diff --git a/inc/theme-options.php b/inc/theme-options.php index 15ef40c..ff459e9 100644 --- a/inc/theme-options.php +++ b/inc/theme-options.php @@ -12,10 +12,17 @@ defined('ABSPATH') || exit; $prefix = 'kratos_options'; if (!function_exists('kratos_option')) { - function kratos_option($option = '', $default = null) + function kratos_option($option = '', $default = null, $fieldset = '') { $options = get_option('kratos_options'); - return (isset($options[$option])) ? $options[$option] : $default; + + if (!empty($fieldset)) { + $results = $options[$fieldset . "_fieldset"][$option]; + } else { + $results = $options[$option]; + } + + return (isset($results)) ? $results : $default; } } @@ -200,7 +207,7 @@ CSF::createSection($prefix, array( ), 'default' => array( 'g_renameother' => false, - 'g_renameother_prdfix' => '[' . getdomain(home_url()) . ']', + 'g_renameother_prdfix' => getdomain(home_url()), 'g_renameother_mime' => 'tar|zip|gz|gzip|rar|7z', ), ),