@@ -7,39 +7,6 @@ class Curl
7
7
const VERSION = '7.1.0 ' ;
8
8
const DEFAULT_TIMEOUT = 30 ;
9
9
10
- public static $ RFC2616 = array (
11
- // RFC2616: "any CHAR except CTLs or separators".
12
- // CHAR = <any US-ASCII character (octets 0 - 127)>
13
- // CTL = <any US-ASCII control character
14
- // (octets 0 - 31) and DEL (127)>
15
- // separators = "(" | ")" | "<" | ">" | "@"
16
- // | "," | ";" | ":" | "\" | <">
17
- // | "/" | "[" | "]" | "?" | "="
18
- // | "{" | "}" | SP | HT
19
- // SP = <US-ASCII SP, space (32)>
20
- // HT = <US-ASCII HT, horizontal-tab (9)>
21
- // <"> = <US-ASCII double-quote mark (34)>
22
- '! ' , '# ' , '$ ' , '% ' , '& ' , "' " , '* ' , '+ ' , '- ' , '. ' , '0 ' , '1 ' , '2 ' , '3 ' , '4 ' , '5 ' , '6 ' , '7 ' , '8 ' , '9 ' , 'A ' , 'B ' ,
23
- 'C ' , 'D ' , 'E ' , 'F ' , 'G ' , 'H ' , 'I ' , 'J ' , 'K ' , 'L ' , 'M ' , 'N ' , 'O ' , 'P ' , 'Q ' , 'R ' , 'S ' , 'T ' , 'U ' , 'V ' , 'W ' , 'X ' ,
24
- 'Y ' , 'Z ' , '^ ' , '_ ' , '` ' , 'a ' , 'b ' , 'c ' , 'd ' , 'e ' , 'f ' , 'g ' , 'h ' , 'i ' , 'j ' , 'k ' , 'l ' , 'm ' , 'n ' , 'o ' , 'p ' , 'q ' ,
25
- 'r ' , 's ' , 't ' , 'u ' , 'v ' , 'w ' , 'x ' , 'y ' , 'z ' , '| ' , '~ ' ,
26
- );
27
- public static $ RFC6265 = array (
28
- // RFC6265: "US-ASCII characters excluding CTLs, whitespace DQUOTE, comma, semicolon, and backslash".
29
- // %x21
30
- '! ' ,
31
- // %x23-2B
32
- '# ' , '$ ' , '% ' , '& ' , "' " , '( ' , ') ' , '* ' , '+ ' ,
33
- // %x2D-3A
34
- '- ' , '. ' , '/ ' , '0 ' , '1 ' , '2 ' , '3 ' , '4 ' , '5 ' , '6 ' , '7 ' , '8 ' , '9 ' , ': ' ,
35
- // %x3C-5B
36
- '< ' , '= ' , '> ' , '? ' , '@ ' , 'A ' , 'B ' , 'C ' , 'D ' , 'E ' , 'F ' , 'G ' , 'H ' , 'I ' , 'J ' , 'K ' , 'L ' , 'M ' , 'N ' , 'O ' , 'P ' , 'Q ' ,
37
- 'R ' , 'S ' , 'T ' , 'U ' , 'V ' , 'W ' , 'X ' , 'Y ' , 'Z ' , '[ ' ,
38
- // %x5D-7E
39
- '] ' , '^ ' , '_ ' , '` ' , 'a ' , 'b ' , 'c ' , 'd ' , 'e ' , 'f ' , 'g ' , 'h ' , 'i ' , 'j ' , 'k ' , 'l ' , 'm ' , 'n ' , 'o ' , 'p ' , 'q ' , 'r ' ,
40
- 's ' , 't ' , 'u ' , 'v ' , 'w ' , 'x ' , 'y ' , 'z ' , '{ ' , '| ' , '} ' , '~ ' ,
41
- );
42
-
43
10
public $ curl ;
44
11
public $ id = null ;
45
12
@@ -81,6 +48,39 @@ class Curl
81
48
private $ xmlPattern = '~^(?:text/|application/(?:atom\+|rss\+)?)xml~i ' ;
82
49
private $ defaultDecoder = null ;
83
50
51
+ public static $ RFC2616 = array (
52
+ // RFC2616: "any CHAR except CTLs or separators".
53
+ // CHAR = <any US-ASCII character (octets 0 - 127)>
54
+ // CTL = <any US-ASCII control character
55
+ // (octets 0 - 31) and DEL (127)>
56
+ // separators = "(" | ")" | "<" | ">" | "@"
57
+ // | "," | ";" | ":" | "\" | <">
58
+ // | "/" | "[" | "]" | "?" | "="
59
+ // | "{" | "}" | SP | HT
60
+ // SP = <US-ASCII SP, space (32)>
61
+ // HT = <US-ASCII HT, horizontal-tab (9)>
62
+ // <"> = <US-ASCII double-quote mark (34)>
63
+ '! ' , '# ' , '$ ' , '% ' , '& ' , "' " , '* ' , '+ ' , '- ' , '. ' , '0 ' , '1 ' , '2 ' , '3 ' , '4 ' , '5 ' , '6 ' , '7 ' , '8 ' , '9 ' , 'A ' , 'B ' ,
64
+ 'C ' , 'D ' , 'E ' , 'F ' , 'G ' , 'H ' , 'I ' , 'J ' , 'K ' , 'L ' , 'M ' , 'N ' , 'O ' , 'P ' , 'Q ' , 'R ' , 'S ' , 'T ' , 'U ' , 'V ' , 'W ' , 'X ' ,
65
+ 'Y ' , 'Z ' , '^ ' , '_ ' , '` ' , 'a ' , 'b ' , 'c ' , 'd ' , 'e ' , 'f ' , 'g ' , 'h ' , 'i ' , 'j ' , 'k ' , 'l ' , 'm ' , 'n ' , 'o ' , 'p ' , 'q ' ,
66
+ 'r ' , 's ' , 't ' , 'u ' , 'v ' , 'w ' , 'x ' , 'y ' , 'z ' , '| ' , '~ ' ,
67
+ );
68
+ public static $ RFC6265 = array (
69
+ // RFC6265: "US-ASCII characters excluding CTLs, whitespace DQUOTE, comma, semicolon, and backslash".
70
+ // %x21
71
+ '! ' ,
72
+ // %x23-2B
73
+ '# ' , '$ ' , '% ' , '& ' , "' " , '( ' , ') ' , '* ' , '+ ' ,
74
+ // %x2D-3A
75
+ '- ' , '. ' , '/ ' , '0 ' , '1 ' , '2 ' , '3 ' , '4 ' , '5 ' , '6 ' , '7 ' , '8 ' , '9 ' , ': ' ,
76
+ // %x3C-5B
77
+ '< ' , '= ' , '> ' , '? ' , '@ ' , 'A ' , 'B ' , 'C ' , 'D ' , 'E ' , 'F ' , 'G ' , 'H ' , 'I ' , 'J ' , 'K ' , 'L ' , 'M ' , 'N ' , 'O ' , 'P ' , 'Q ' ,
78
+ 'R ' , 'S ' , 'T ' , 'U ' , 'V ' , 'W ' , 'X ' , 'Y ' , 'Z ' , '[ ' ,
79
+ // %x5D-7E
80
+ '] ' , '^ ' , '_ ' , '` ' , 'a ' , 'b ' , 'c ' , 'd ' , 'e ' , 'f ' , 'g ' , 'h ' , 'i ' , 'j ' , 'k ' , 'l ' , 'm ' , 'n ' , 'o ' , 'p ' , 'q ' , 'r ' ,
81
+ 's ' , 't ' , 'u ' , 'v ' , 'w ' , 'x ' , 'y ' , 'z ' , '{ ' , '| ' , '} ' , '~ ' ,
82
+ );
83
+
84
84
private static $ deferredProperties = array (
85
85
'effectiveUrl ' ,
86
86
'rfc2616 ' ,
@@ -148,8 +148,8 @@ public function buildPostData($data)
148
148
// Manually build a single-dimensional array from a multi-dimensional array as using curl_setopt($ch,
149
149
// CURLOPT_POSTFIELDS, $data) doesn't correctly handle multi-dimensional arrays when files are
150
150
// referenced.
151
- if (self ::is_array_multidim ($ data )) {
152
- $ data = self ::array_flatten_multidim ($ data );
151
+ if (\ Curl \ArrayUtil ::is_array_multidim ($ data )) {
152
+ $ data = \ Curl \ArrayUtil ::array_flatten_multidim ($ data );
153
153
}
154
154
155
155
// Modify array values to ensure any referenced files are properly handled depending on the support of
@@ -1379,78 +1379,4 @@ private function parseResponseHeaders($raw_response_headers)
1379
1379
}
1380
1380
return $ response_headers ;
1381
1381
}
1382
-
1383
- /**
1384
- * Is Array Assoc
1385
- *
1386
- * @access public
1387
- * @param $array
1388
- *
1389
- * @return boolean
1390
- */
1391
- public static function is_array_assoc ($ array )
1392
- {
1393
- return (bool )count (array_filter (array_keys ($ array ), 'is_string ' ));
1394
- }
1395
-
1396
- /**
1397
- * Is Array Multidim
1398
- *
1399
- * @access public
1400
- * @param $array
1401
- *
1402
- * @return boolean
1403
- */
1404
- public static function is_array_multidim ($ array )
1405
- {
1406
- if (!is_array ($ array )) {
1407
- return false ;
1408
- }
1409
-
1410
- return (bool )count (array_filter ($ array , 'is_array ' ));
1411
- }
1412
-
1413
- /**
1414
- * Array Flatten Multidim
1415
- *
1416
- * @access public
1417
- * @param $array
1418
- * @param $prefix
1419
- *
1420
- * @return array
1421
- */
1422
- public static function array_flatten_multidim ($ array , $ prefix = false )
1423
- {
1424
- $ return = array ();
1425
- if (is_array ($ array ) || is_object ($ array )) {
1426
- if (empty ($ array )) {
1427
- $ return [$ prefix ] = '' ;
1428
- } else {
1429
- foreach ($ array as $ key => $ value ) {
1430
- if (is_scalar ($ value )) {
1431
- if ($ prefix ) {
1432
- $ return [$ prefix . '[ ' . $ key . '] ' ] = $ value ;
1433
- } else {
1434
- $ return [$ key ] = $ value ;
1435
- }
1436
- } else {
1437
- if ($ value instanceof \CURLFile) {
1438
- $ return [$ key ] = $ value ;
1439
- } else {
1440
- $ return = array_merge (
1441
- $ return ,
1442
- self ::array_flatten_multidim (
1443
- $ value ,
1444
- $ prefix ? $ prefix . '[ ' . $ key . '] ' : $ key
1445
- )
1446
- );
1447
- }
1448
- }
1449
- }
1450
- }
1451
- } elseif ($ array === null ) {
1452
- $ return [$ prefix ] = $ array ;
1453
- }
1454
- return $ return ;
1455
- }
1456
1382
}
0 commit comments