pull/6/head
sy-records 2020-09-13 13:45:11 +08:00
parent 0de2c73cff
commit e91742b194
1 changed files with 15 additions and 15 deletions

View File

@ -23,14 +23,14 @@ register_activation_hook(__FILE__, 'oss_set_options');
function oss_set_options()
{
$options = array(
'bucket' => "",
'regional' => "oss-cn-shanghai",
'accessKeyId' => "",
'accessKeySecret' => "",
'is_internal' => "false",
'nothumb' => "false", // 是否上传缩略图
'nolocalsaving' => "false", // 是否保留本地备份
'upload_url_path' => "", // URL前缀
'bucket' => '',
'regional' => 'oss-cn-shanghai',
'accessKeyId' => '',
'accessKeySecret' => '',
'is_internal' => 'false',
'nothumb' => 'false', // 是否上传缩略图
'nolocalsaving' => 'false', // 是否保留本地备份
'upload_url_path' => '', // URL前缀
'style' => '', // 图片处理
);
add_option('oss_options', $options, '', 'yes');
@ -48,10 +48,10 @@ function oss_get_client()
function oss_get_bucket_endpoint($oss_option)
{
$oss_regional = esc_attr($oss_option['regional']);
if ($oss_option['is_internal'] == "true") {
return $oss_regional . "-internal.aliyuncs.com";
if ($oss_option['is_internal'] == 'true') {
return $oss_regional . '-internal.aliyuncs.com';
}
return $oss_regional . ".aliyuncs.com";
return $oss_regional . '.aliyuncs.com';
}
function oss_get_bucket_name()
@ -115,7 +115,7 @@ function oss_delete_local_file($file)
}
return true;
} catch (Exception $ex) {
} catch (\Exception $ex) {
return false;
}
}
@ -165,7 +165,7 @@ function oss_upload_attachments($metadata)
if (!in_array($metadata['type'], $image_mime_types)) {
//生成object在oss中的存储路径
if (get_option('upload_path') == '.') {
$metadata['file'] = str_replace("./", '', $metadata['file']);
$metadata['file'] = str_replace('./', '', $metadata['file']);
}
$object = str_replace("\\", '/', $metadata['file']);
$home_path = get_home_path();
@ -477,7 +477,7 @@ function oss_setting_page()
$oss_nolocalsaving = ($oss_nolocalsaving == 'true');
$oss_style = esc_attr($oss_options['style']);
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://';
?>
<div class="wrap" style="margin: 10px;">
<h1>阿里云 OSS 设置 <span style="font-size: 13px;">当前版本:<?php echo OSS_VERSION; ?></span></h1>