Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
Native.php
01 <?php
02
03 /*
04 * @package s9e\TextFormatter
05 * @copyright Copyright (c) 2010-2016 The s9e Authors
06 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
07 */
08 namespace s9e\TextFormatter\Utils\Http\Clients;
09 use s9e\TextFormatter\Utils\Http\Client;
10 class Native extends Client
11 {
12 public $gzipEnabled;
13 public function __construct()
14 {
15 $this->gzipEnabled = \extension_loaded('zlib');
16 }
17 public function get($url, $headers = array())
18 {
19 return $this->request('GET', $url, $headers);
20 }
21 public function post($url, $headers = array(), $body = '')
22 {
23 return $this->request('POST', $url, $headers, $body);
24 }
25 protected function createContext($method, array $headers, $body)
26 {
27 $contextOptions = array(
28 'ssl' => array('verify_peer' => $this->sslVerifyPeer),
29 'http' => array(
30 'method' => $method,
31 'timeout' => $this->timeout,
32 'header' => $this->generateHeaders($headers, $body),
33 'content' => $body
34 )
35 );
36 return \stream_context_create($contextOptions);
37 }
38 protected function decompress($content)
39 {
40 if ($this->gzipEnabled && \substr($content, 0, 2) === "\x1f\x8b")
41 return \gzdecode($content);
42 return $content;
43 }
44 protected function generateHeaders(array $headers, $body)
45 {
46 if ($this->gzipEnabled)
47 $headers[] = 'Accept-Encoding: gzip';
48 $headers[] = 'Content-Length: ' . \strlen($body);
49 return $headers;
50 }
51 protected function request($method, $url, $headers, $body = '')
52 {
53 $response = @\file_get_contents($url, \false, $this->createContext($method, $headers, $body));
54 return (\is_string($response)) ? $this->decompress($response) : $response;
55 }
56 }