diff --git a/aliyun-oss-wordpress.php b/aliyun-oss-wordpress.php index c7f5f4b..2167715 100644 --- a/aliyun-oss-wordpress.php +++ b/aliyun-oss-wordpress.php @@ -99,7 +99,7 @@ function oss_get_client() } $region = !empty($oss_options['origin_region']) ? esc_attr($oss_options['origin_region']) : esc_attr($oss_options['regional']); - if (($region == 'oss-accelerate' || $region == 'oss-accelerate-overseas') && empty($oss_options['origin_region'])) { + if (in_array($region, ['oss-accelerate', 'oss-accelerate-overseas']) && empty($oss_options['origin_region'])) { try { $config = [ 'provider' => $provider, @@ -788,12 +788,13 @@ function oss_setting_page() $options['is_internal'] = isset($_POST['is_internal']) ? 'true' : 'false'; $options['nothumb'] = isset($_POST['nothumb']) ? 'true' : 'false'; $options['nolocalsaving'] = isset($_POST['nolocalsaving']) ? 'true' : 'false'; - //仅用于插件卸载时比较使用 $options['upload_url_path'] = isset($_POST['upload_url_path']) ? sanitize_text_field(stripslashes($_POST['upload_url_path'])) : ''; $options['style'] = isset($_POST['style']) ? sanitize_text_field($_POST['style']) : ''; $options['update_file_name'] = isset($_POST['update_file_name']) ? sanitize_text_field($_POST['update_file_name']) : 'false'; $options['origin_protect'] = isset($_POST['origin_protect']) ? sanitize_text_field($_POST['origin_protect']) : 'off'; + $options['origin_region'] = in_array($options['regional'], ['oss-accelerate', 'oss-accelerate-overseas']) ? '' : $options['regional']; + if ($options['regional'] === 'oss-rg-china-mainland' && $options['is_internal'] === 'true') { echo '
无地域属性不支持内网,请重新填写配置!