注释修改

This commit is contained in:
thinkphp
2015-12-10 18:31:30 +08:00
parent ffdf06d36d
commit 0a1cc5b73a
25 changed files with 113 additions and 113 deletions

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
@@ -117,18 +117,18 @@ class GIFEncode
public $GIF = "GIF89a"; /* GIF header 6 bytes */
public $VER = "GIFEncoder V2.05"; /* Encoder version */
public $BUF = array();
public $BUF = [];
public $LOP = 0;
public $DIS = 2;
public $COL = -1;
public $IMG = -1;
public $ERR = array(
public $ERR = [
'ERR00' => "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)) {

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
@@ -103,11 +103,11 @@ abstract class Driver
public function getRequestCodeURL()
{
//Oauth 标准参数
$params = array(
$params = [
'client_id' => $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)) {

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
@@ -43,9 +43,9 @@ class Baidu extends Driver
public function call($api, $param = '', $method = 'GET')
{
/* 百度调用公共参数 */
$params = array(
$params = [
'access_token' => $this->token['access_token'],
);
];
$data = $this->http($this->url($api), $this->param($params, $param), $method);
return json_decode($data, true);

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
@@ -43,9 +43,9 @@ class Diandian extends Driver
public function call($api, $param = '', $method = 'GET')
{
/* 点点网调用公共参数 */
$params = array(
$params = [
'access_token' => $this->token['access_token'],
);
];
$data = $this->http($this->url($api, '.json'), $this->param($params, $param), $method);
return json_decode($data, true);

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
@@ -44,7 +44,7 @@ class Douban extends Driver
{
/* 豆瓣调用公共参数 */
$params = [];
$header = array("Authorization: Bearer {$this->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);
}

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
@@ -44,7 +44,7 @@ class Github extends Driver
{
/* Github 调用公共参数 */
$params = [];
$header = array("Authorization: bearer {$this->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);

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
@@ -50,7 +50,7 @@ class Google extends Driver
{
/* Google 调用公共参数 */
$params = [];
$header = array("Authorization: Bearer {$this->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);

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
@@ -43,9 +43,9 @@ class Kaixin extends Driver
public function call($api, $param = '', $method = 'GET')
{
/* 开心网调用公共参数 */
$params = array(
$params = [
'access_token' => $this->token['access_token'],
);
];
$data = $this->http($this->url($api, '.json'), $this->param($params, $param), $method);
return json_decode($data, true);

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
@@ -49,9 +49,9 @@ class Msn extends Driver
public function call($api, $param = '', $method = 'GET')
{
/* MSN 调用公共参数 */
$params = array(
$params = [
'access_token' => $this->token['access_token'],
);
];
$data = $this->http($this->url($api), $this->param($params, $param), $method);
return json_decode($data, true);

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
@@ -49,12 +49,12 @@ class Qq extends Driver
public function call($api, $param = '', $method = 'GET')
{
/* 腾讯QQ调用公共参数 */
$params = array(
$params = [
'oauth_consumer_key' => $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'];

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
@@ -43,12 +43,12 @@ class Renren extends Driver
public function call($api, $param = '', $method = 'POST')
{
/* 人人网调用公共参数 */
$params = array(
$params = [
'method' => $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);

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
@@ -43,9 +43,9 @@ class Sina extends Driver
public function call($api, $param = '', $method = 'GET', $multi = false)
{
/* 新浪微博调用公共参数 */
$params = array(
$params = [
'access_token' => $this->token['access_token'],
);
];
$data = $this->http($this->url($api, '.json'), $this->param($params, $param), $method, $multi);
return json_decode($data, true);

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
@@ -43,9 +43,9 @@ class Sohu extends Driver
public function call($api, $param = '', $method = 'GET')
{
/* 搜狐调用公共参数 */
$params = array(
$params = [
'access_token' => $this->token['access_token'],
);
];
$data = $this->http($this->url($api), $this->param($params, $param), $method);
return json_decode($data, true);

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
@@ -43,9 +43,9 @@ class T163 extends Driver
public function call($api, $param = '', $method = 'GET')
{
/* 新浪微博调用公共参数 */
$params = array(
$params = [
'oauth_token' => $this->token['access_token'],
);
];
$data = $this->http($this->url($api, '.json'), $this->param($params, $param), $method);
return json_decode($data, true);

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
@@ -43,12 +43,12 @@ class Taobao extends Driver
public function call($api, $param = '', $method = 'GET')
{
/* 淘宝网调用公共参数 */
$params = array(
$params = [
'method' => $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);
}

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
@@ -43,7 +43,7 @@ class Tencent extends Driver
public function call($api, $param = '', $method = 'GET', $multi = false)
{
/* 腾讯微博调用公共参数 */
$params = array(
$params = [
'oauth_consumer_key' => $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);

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
@@ -43,9 +43,9 @@ class X360 extends Driver
public function call($api, $param = '', $method = 'GET')
{
/* 360开放平台调用公共参数 */
$params = array(
$params = [
'access_token' => $this->token['access_token'],
);
];
$data = $this->http($this->url($api, '.json'), $this->param($params, $param), $method);
return json_decode($data, true);

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2011 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2011 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2011 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------

View File

@@ -50,7 +50,7 @@ class QiniuStorage
{
$param['deadline'] = 0 == $param['Expires'] ? 3600 : $param['Expires'];
$param['deadline'] += time();
$data = array('scope' => $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) {

View File

@@ -1,8 +1,8 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2011 http://topthink.com All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------