From 0a1cc5b73aeaf4e2a5e8767cf7017062ce227aee Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 10 Dec 2015 18:31:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/org/image/driver/gd.php | 4 +- library/org/image/driver/gif.php | 22 +++++----- library/org/image/driver/imagick.php | 4 +- library/org/oauth/driver.php | 16 +++---- library/org/oauth/driver/baidu.php | 8 ++-- library/org/oauth/driver/diandian.php | 8 ++-- library/org/oauth/driver/douban.php | 6 +-- library/org/oauth/driver/github.php | 6 +-- library/org/oauth/driver/google.php | 6 +-- library/org/oauth/driver/kaixin.php | 8 ++-- library/org/oauth/driver/msn.php | 8 ++-- library/org/oauth/driver/qq.php | 10 ++--- library/org/oauth/driver/renren.php | 8 ++-- library/org/oauth/driver/sina.php | 8 ++-- library/org/oauth/driver/sohu.php | 8 ++-- library/org/oauth/driver/t163.php | 8 ++-- library/org/oauth/driver/taobao.php | 8 ++-- library/org/oauth/driver/tencent.php | 8 ++-- library/org/oauth/driver/x360.php | 8 ++-- library/org/parser/driver/ubb.php | 4 +- library/org/transform/driver/base64.php | 4 +- library/org/transform/driver/json.php | 4 +- library/org/transform/driver/xml.php | 4 +- .../org/upload/driver/qiniu/qiniu_storage.php | 44 +++++++++---------- library/think/log/driver/sae.php | 4 +- 25 files changed, 113 insertions(+), 113 deletions(-) diff --git a/library/org/image/driver/gd.php b/library/org/image/driver/gd.php index 712c5f50..4ffd8d0e 100644 --- a/library/org/image/driver/gd.php +++ b/library/org/image/driver/gd.php @@ -1,8 +1,8 @@ "Does not supported function for only one image!", 'ERR01' => "Source is not a GIF image!", 'ERR02' => "Unintelligible flag ", 'ERR03' => "Does not make animation from animated GIF source", - ); + ]; /* ::::::::::::::::::::::::::::::::::::::::::::::::::: @@ -348,15 +348,15 @@ class GIFEncode class GIFDecoder { - public $GIF_buffer = array(); - public $GIF_arrays = array(); - public $GIF_delays = array(); + public $GIF_buffer = []; + public $GIF_arrays = []; + public $GIF_delays = []; public $GIF_stream = ""; public $GIF_string = ""; public $GIF_bfseek = 0; - public $GIF_screen = array(); - public $GIF_global = array(); + public $GIF_screen = []; + public $GIF_global = []; public $GIF_sorted; public $GIF_colorS; public $GIF_colorC; @@ -536,7 +536,7 @@ class GIFDecoder */ public function GIFGetByte($len) { - $this->GIF_buffer = array(); + $this->GIF_buffer = []; for ($i = 0; $i < $len; $i++) { if ($this->GIF_bfseek > strlen($this->GIF_stream)) { diff --git a/library/org/image/driver/imagick.php b/library/org/image/driver/imagick.php index 3e7060a2..a75574b8 100644 --- a/library/org/image/driver/imagick.php +++ b/library/org/image/driver/imagick.php @@ -1,8 +1,8 @@ $this->appKey, 'redirect_uri' => $this->callback, 'response_type' => $this->responseType, - ); + ]; //获取额外参数 if ($this->authorize) { @@ -127,13 +127,13 @@ abstract class Driver */ public function getAccessToken($code) { - $params = array( + $params = [ 'client_id' => $this->appKey, 'client_secret' => $this->appSecret, 'grant_type' => $this->grantType, 'redirect_uri' => $this->callback, 'code' => $code, - ); + ]; // 获取token信息 $data = $this->http($this->getAccessTokenURL, $params, 'POST'); // 解析token @@ -185,13 +185,13 @@ abstract class Driver */ protected function http($url, $params, $method = 'GET', $header = [], $multi = false) { - $opts = array( + $opts = [ CURLOPT_TIMEOUT => 30, CURLOPT_RETURNTRANSFER => 1, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_HTTPHEADER => $header, - ); + ]; /* 根据请求类型设置特定参数 */ switch (strtoupper($method)) { diff --git a/library/org/oauth/driver/baidu.php b/library/org/oauth/driver/baidu.php index 3cf67bbd..c245e3b5 100644 --- a/library/org/oauth/driver/baidu.php +++ b/library/org/oauth/driver/baidu.php @@ -1,8 +1,8 @@ $this->token['access_token'], - ); + ]; $data = $this->http($this->url($api), $this->param($params, $param), $method); return json_decode($data, true); diff --git a/library/org/oauth/driver/diandian.php b/library/org/oauth/driver/diandian.php index fe60f1d6..305601d4 100644 --- a/library/org/oauth/driver/diandian.php +++ b/library/org/oauth/driver/diandian.php @@ -1,8 +1,8 @@ $this->token['access_token'], - ); + ]; $data = $this->http($this->url($api, '.json'), $this->param($params, $param), $method); return json_decode($data, true); diff --git a/library/org/oauth/driver/douban.php b/library/org/oauth/driver/douban.php index 9b839cf9..fb671aa0 100644 --- a/library/org/oauth/driver/douban.php +++ b/library/org/oauth/driver/douban.php @@ -1,8 +1,8 @@ token['access_token']}"); + $header = ["Authorization: Bearer {$this->token['access_token']}"]; $data = $this->http($this->url($api), $this->param($params, $param), $method, $header); return json_decode($data, true); } diff --git a/library/org/oauth/driver/github.php b/library/org/oauth/driver/github.php index 4fffb542..47ff4db4 100644 --- a/library/org/oauth/driver/github.php +++ b/library/org/oauth/driver/github.php @@ -1,8 +1,8 @@ token['access_token']}"); + $header = ["Authorization: bearer {$this->token['access_token']}"]; $data = $this->http($this->url($api), $this->param($params, $param), $method, $header); return json_decode($data, true); diff --git a/library/org/oauth/driver/google.php b/library/org/oauth/driver/google.php index 2b5d90cc..970249ac 100644 --- a/library/org/oauth/driver/google.php +++ b/library/org/oauth/driver/google.php @@ -1,8 +1,8 @@ token['access_token']}"); + $header = ["Authorization: Bearer {$this->token['access_token']}"]; $data = $this->http($this->url($api), $this->param($params, $param), $method, $header); return json_decode($data, true); diff --git a/library/org/oauth/driver/kaixin.php b/library/org/oauth/driver/kaixin.php index 63ab828c..889e8924 100644 --- a/library/org/oauth/driver/kaixin.php +++ b/library/org/oauth/driver/kaixin.php @@ -1,8 +1,8 @@ $this->token['access_token'], - ); + ]; $data = $this->http($this->url($api, '.json'), $this->param($params, $param), $method); return json_decode($data, true); diff --git a/library/org/oauth/driver/msn.php b/library/org/oauth/driver/msn.php index 50217086..f1b4d604 100644 --- a/library/org/oauth/driver/msn.php +++ b/library/org/oauth/driver/msn.php @@ -1,8 +1,8 @@ $this->token['access_token'], - ); + ]; $data = $this->http($this->url($api), $this->param($params, $param), $method); return json_decode($data, true); diff --git a/library/org/oauth/driver/qq.php b/library/org/oauth/driver/qq.php index 5aa0f402..4000253a 100644 --- a/library/org/oauth/driver/qq.php +++ b/library/org/oauth/driver/qq.php @@ -1,8 +1,8 @@ $this->AppKey, 'access_token' => $this->token['access_token'], 'openid' => $this->openid(), 'format' => 'json', - ); + ]; $data = $this->http($this->url($api), $this->param($params, $param), $method); return json_decode($data, true); @@ -87,7 +87,7 @@ class Qq extends Driver } if ($data['access_token']) { - $data = $this->http($this->url('oauth2.0/me'), array('access_token' => $data['access_token'])); + $data = $this->http($this->url('oauth2.0/me'), ['access_token' => $data['access_token']]); $data = json_decode(trim(substr($data, 9), " );\n"), true); if (isset($data['openid'])) { return $data['openid']; diff --git a/library/org/oauth/driver/renren.php b/library/org/oauth/driver/renren.php index 846ad0bd..9f7e4029 100644 --- a/library/org/oauth/driver/renren.php +++ b/library/org/oauth/driver/renren.php @@ -1,8 +1,8 @@ $api, 'access_token' => $this->token['access_token'], 'v' => '1.0', 'format' => 'json', - ); + ]; $data = $this->http($this->url(''), $this->param($params, $param), $method); return json_decode($data, true); diff --git a/library/org/oauth/driver/sina.php b/library/org/oauth/driver/sina.php index 0b2738e3..7129e16c 100644 --- a/library/org/oauth/driver/sina.php +++ b/library/org/oauth/driver/sina.php @@ -1,8 +1,8 @@ $this->token['access_token'], - ); + ]; $data = $this->http($this->url($api, '.json'), $this->param($params, $param), $method, $multi); return json_decode($data, true); diff --git a/library/org/oauth/driver/sohu.php b/library/org/oauth/driver/sohu.php index ca59ec25..06db5e68 100644 --- a/library/org/oauth/driver/sohu.php +++ b/library/org/oauth/driver/sohu.php @@ -1,8 +1,8 @@ $this->token['access_token'], - ); + ]; $data = $this->http($this->url($api), $this->param($params, $param), $method); return json_decode($data, true); diff --git a/library/org/oauth/driver/t163.php b/library/org/oauth/driver/t163.php index 6c07facf..640dee03 100644 --- a/library/org/oauth/driver/t163.php +++ b/library/org/oauth/driver/t163.php @@ -1,8 +1,8 @@ $this->token['access_token'], - ); + ]; $data = $this->http($this->url($api, '.json'), $this->param($params, $param), $method); return json_decode($data, true); diff --git a/library/org/oauth/driver/taobao.php b/library/org/oauth/driver/taobao.php index dcafc89a..3345f218 100644 --- a/library/org/oauth/driver/taobao.php +++ b/library/org/oauth/driver/taobao.php @@ -1,8 +1,8 @@ $api, 'access_token' => $this->token['access_token'], 'format' => 'json', 'v' => '2.0', - ); + ]; $data = $this->http($this->url(''), $this->param($params, $param), $method); return json_decode($data, true); } diff --git a/library/org/oauth/driver/tencent.php b/library/org/oauth/driver/tencent.php index 107d2cbd..2afa2d2c 100644 --- a/library/org/oauth/driver/tencent.php +++ b/library/org/oauth/driver/tencent.php @@ -1,8 +1,8 @@ $this->AppKey, 'access_token' => $this->token['access_token'], 'openid' => $this->openid(), @@ -51,7 +51,7 @@ class Tencent extends Driver 'oauth_version' => '2.a', 'scope' => 'all', 'format' => 'json', - ); + ]; $data = $this->http($this->url($api), $this->param($params, $param), $method, $multi); return json_decode($data, true); diff --git a/library/org/oauth/driver/x360.php b/library/org/oauth/driver/x360.php index 0619c141..7eb6d82d 100644 --- a/library/org/oauth/driver/x360.php +++ b/library/org/oauth/driver/x360.php @@ -1,8 +1,8 @@ $this->token['access_token'], - ); + ]; $data = $this->http($this->url($api, '.json'), $this->param($params, $param), $method); return json_decode($data, true); diff --git a/library/org/parser/driver/ubb.php b/library/org/parser/driver/ubb.php index a5b31c01..bf8614f1 100644 --- a/library/org/parser/driver/ubb.php +++ b/library/org/parser/driver/ubb.php @@ -1,8 +1,8 @@ $this->bucket, 'deadline' => $param['deadline']); + $data = ['scope' => $this->bucket, 'deadline' => $param['deadline']]; if (!empty($param['CallbackUrl'])) { $data['callbackUrl'] = $param['CallbackUrl']; } @@ -79,15 +79,15 @@ class QiniuStorage $url = "{$this->QINIU_UP_HOST}"; $mimeBoundary = md5(microtime()); - $header = array('Content-Type' => 'multipart/form-data;boundary=' . $mimeBoundary); - $data = array(); + $header = ['Content-Type' => 'multipart/form-data;boundary=' . $mimeBoundary]; + $data = []; - $fields = array( + $fields = [ 'token' => $uploadToken, 'key' => $config['saveName'] ?: $file['fileName'], - ); + ]; - if (is_array($config['custom_fields']) && array() !== $config['custom_fields']) { + if (is_array($config['custom_fields']) && [] !== $config['custom_fields']) { $fields = array_merge($fields, $config['custom_fields']); } @@ -173,12 +173,12 @@ class QiniuStorage } //获取某个路径下的文件列表 - public function getList($query = array(), $path = '') + public function getList($query = [], $path = '') { - $query = array_merge(array('bucket' => $this->bucket), $query); + $query = array_merge(['bucket' => $this->bucket], $query); $url = "{$this->QINIU_RSF_HOST}/list?" . http_build_query($query); $accessToken = $this->accessToken($url); - $response = $this->request($url, 'POST', array('Authorization' => "QBox $accessToken")); + $response = $this->request($url, 'POST', ['Authorization' => "QBox $accessToken"]); return $response; } @@ -188,9 +188,9 @@ class QiniuStorage $key = trim($key); $url = "{$this->QINIU_RS_HOST}/stat/" . self::qiniuEncode("{$this->bucket}:{$key}"); $accessToken = $this->accessToken($url); - $response = $this->request($url, 'POST', array( + $response = $this->request($url, 'POST', [ 'Authorization' => "QBox $accessToken", - )); + ]); return $response; } @@ -210,7 +210,7 @@ class QiniuStorage $url = "{$this->QINIU_RS_HOST}/move/" . self::qiniuEncode("{$this->bucket}:{$key}") . '/' . self::qiniuEncode("{$this->bucket}:{$new_file}"); trace($url); $accessToken = $this->accessToken($url); - $response = $this->request($url, 'POST', array('Authorization' => "QBox $accessToken")); + $response = $this->request($url, 'POST', ['Authorization' => "QBox $accessToken"]); return $response; } @@ -220,7 +220,7 @@ class QiniuStorage $key = trim($file); $url = "{$this->QINIU_RS_HOST}/delete/" . self::qiniuEncode("{$this->bucket}:{$key}"); $accessToken = $this->accessToken($url); - $response = $this->request($url, 'POST', array('Authorization' => "QBox $accessToken")); + $response = $this->request($url, 'POST', ['Authorization' => "QBox $accessToken"]); return $response; } @@ -228,7 +228,7 @@ class QiniuStorage public function delBatch($files) { $url = $this->QINIU_RS_HOST . '/batch'; - $ops = array(); + $ops = []; foreach ($files as $file) { $ops[] = "/delete/" . self::qiniuEncode("{$this->bucket}:{$file}"); } @@ -236,22 +236,22 @@ class QiniuStorage $url .= '?' . $params; trace($url); $accessToken = $this->accessToken($url); - $response = $this->request($url, 'POST', array('Authorization' => "QBox $accessToken")); + $response = $this->request($url, 'POST', ['Authorization' => "QBox $accessToken"]); return $response; } public static function qiniuEncode($str) { -// URLSafeBase64Encode - $find = array('+', '/'); - $replace = array('-', '_'); + // URLSafeBase64Encode + $find = ['+', '/']; + $replace = ['-', '_']; return str_replace($find, $replace, base64_encode($str)); } public static function qiniuEscapequotes($str) { - $find = array("\\", "\""); - $replace = array("\\\\", "\\\""); + $find = ["\\", "\""]; + $replace = ["\\\\", "\\\""]; return str_replace($find, $replace, $str); } @@ -267,7 +267,7 @@ class QiniuStorage { $ch = curl_init($path); - $_headers = array('Expect:'); + $_headers = ['Expect:']; if (!is_null($headers) && is_array($headers)) { foreach ($headers as $k => $v) { array_push($_headers, "{$k}: {$v}"); @@ -339,7 +339,7 @@ class QiniuStorage private function response($text) { $headers = explode(PHP_EOL, $text); - $items = array(); + $items = []; foreach ($headers as $header) { $header = trim($header); if (strpos($header, '{') !== false) { diff --git a/library/think/log/driver/sae.php b/library/think/log/driver/sae.php index 43946722..f92140cf 100644 --- a/library/think/log/driver/sae.php +++ b/library/think/log/driver/sae.php @@ -1,8 +1,8 @@