Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

functions.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 13.09 KiB


001  <?php
002   
003  namespace GuzzleHttp\Psr7;
004   
005  use Psr\Http\Message\MessageInterface;
006  use Psr\Http\Message\RequestInterface;
007  use Psr\Http\Message\StreamInterface;
008  use Psr\Http\Message\UriInterface;
009   
010  /**
011   * Returns the string representation of an HTTP message.
012   *
013   * @param MessageInterface $message Message to convert to a string.
014   *
015   * @return string
016   *
017   * @deprecated str will be removed in guzzlehttp/psr7:2.0. Use Message::toString instead.
018   */
019  function str(MessageInterface $message)
020  {
021      return Message::toString($message);
022  }
023   
024  /**
025   * Returns a UriInterface for the given value.
026   *
027   * This function accepts a string or UriInterface and returns a
028   * UriInterface for the given value. If the value is already a
029   * UriInterface, it is returned as-is.
030   *
031   * @param string|UriInterface $uri
032   *
033   * @return UriInterface
034   *
035   * @throws \InvalidArgumentException
036   *
037   * @deprecated uri_for will be removed in guzzlehttp/psr7:2.0. Use Utils::uriFor instead.
038   */
039  function uri_for($uri)
040  {
041      return Utils::uriFor($uri);
042  }
043   
044  /**
045   * Create a new stream based on the input type.
046   *
047   * Options is an associative array that can contain the following keys:
048   * - metadata: Array of custom metadata.
049   * - size: Size of the stream.
050   *
051   * This method accepts the following `$resource` types:
052   * - `Psr\Http\Message\StreamInterface`: Returns the value as-is.
053   * - `string`: Creates a stream object that uses the given string as the contents.
054   * - `resource`: Creates a stream object that wraps the given PHP stream resource.
055   * - `Iterator`: If the provided value implements `Iterator`, then a read-only
056   *   stream object will be created that wraps the given iterable. Each time the
057   *   stream is read from, data from the iterator will fill a buffer and will be
058   *   continuously called until the buffer is equal to the requested read size.
059   *   Subsequent read calls will first read from the buffer and then call `next`
060   *   on the underlying iterator until it is exhausted.
061   * - `object` with `__toString()`: If the object has the `__toString()` method,
062   *   the object will be cast to a string and then a stream will be returned that
063   *   uses the string value.
064   * - `NULL`: When `null` is passed, an empty stream object is returned.
065   * - `callable` When a callable is passed, a read-only stream object will be
066   *   created that invokes the given callable. The callable is invoked with the
067   *   number of suggested bytes to read. The callable can return any number of
068   *   bytes, but MUST return `false` when there is no more data to return. The
069   *   stream object that wraps the callable will invoke the callable until the
070   *   number of requested bytes are available. Any additional bytes will be
071   *   buffered and used in subsequent reads.
072   *
073   * @param resource|string|int|float|bool|StreamInterface|callable|\Iterator|null $resource Entity body data
074   * @param array                                                                  $options  Additional options
075   *
076   * @return StreamInterface
077   *
078   * @throws \InvalidArgumentException if the $resource arg is not valid.
079   *
080   * @deprecated stream_for will be removed in guzzlehttp/psr7:2.0. Use Utils::streamFor instead.
081   */
082  function stream_for($resource = '', array $options = [])
083  {
084      return Utils::streamFor($resource, $options);
085  }
086   
087  /**
088   * Parse an array of header values containing ";" separated data into an
089   * array of associative arrays representing the header key value pair data
090   * of the header. When a parameter does not contain a value, but just
091   * contains a key, this function will inject a key with a '' string value.
092   *
093   * @param string|array $header Header to parse into components.
094   *
095   * @return array Returns the parsed header values.
096   *
097   * @deprecated parse_header will be removed in guzzlehttp/psr7:2.0. Use Header::parse instead.
098   */
099  function parse_header($header)
100  {
101      return Header::parse($header);
102  }
103   
104  /**
105   * Converts an array of header values that may contain comma separated
106   * headers into an array of headers with no comma separated values.
107   *
108   * @param string|array $header Header to normalize.
109   *
110   * @return array Returns the normalized header field values.
111   *
112   * @deprecated normalize_header will be removed in guzzlehttp/psr7:2.0. Use Header::normalize instead.
113   */
114  function normalize_header($header)
115  {
116      return Header::normalize($header);
117  }
118   
119  /**
120   * Clone and modify a request with the given changes.
121   *
122   * This method is useful for reducing the number of clones needed to mutate a
123   * message.
124   *
125   * The changes can be one of:
126   * - method: (string) Changes the HTTP method.
127   * - set_headers: (array) Sets the given headers.
128   * - remove_headers: (array) Remove the given headers.
129   * - body: (mixed) Sets the given body.
130   * - uri: (UriInterface) Set the URI.
131   * - query: (string) Set the query string value of the URI.
132   * - version: (string) Set the protocol version.
133   *
134   * @param RequestInterface $request Request to clone and modify.
135   * @param array            $changes Changes to apply.
136   *
137   * @return RequestInterface
138   *
139   * @deprecated modify_request will be removed in guzzlehttp/psr7:2.0. Use Utils::modifyRequest instead.
140   */
141  function modify_request(RequestInterface $request, array $changes)
142  {
143      return Utils::modifyRequest($request, $changes);
144  }
145   
146  /**
147   * Attempts to rewind a message body and throws an exception on failure.
148   *
149   * The body of the message will only be rewound if a call to `tell()` returns a
150   * value other than `0`.
151   *
152   * @param MessageInterface $message Message to rewind
153   *
154   * @throws \RuntimeException
155   *
156   * @deprecated rewind_body will be removed in guzzlehttp/psr7:2.0. Use Message::rewindBody instead.
157   */
158  function rewind_body(MessageInterface $message)
159  {
160      Message::rewindBody($message);
161  }
162   
163  /**
164   * Safely opens a PHP stream resource using a filename.
165   *
166   * When fopen fails, PHP normally raises a warning. This function adds an
167   * error handler that checks for errors and throws an exception instead.
168   *
169   * @param string $filename File to open
170   * @param string $mode     Mode used to open the file
171   *
172   * @return resource
173   *
174   * @throws \RuntimeException if the file cannot be opened
175   *
176   * @deprecated try_fopen will be removed in guzzlehttp/psr7:2.0. Use Utils::tryFopen instead.
177   */
178  function try_fopen($filename, $mode)
179  {
180      return Utils::tryFopen($filename, $mode);
181  }
182   
183  /**
184   * Copy the contents of a stream into a string until the given number of
185   * bytes have been read.
186   *
187   * @param StreamInterface $stream Stream to read
188   * @param int             $maxLen Maximum number of bytes to read. Pass -1
189   *                                to read the entire stream.
190   *
191   * @return string
192   *
193   * @throws \RuntimeException on error.
194   *
195   * @deprecated copy_to_string will be removed in guzzlehttp/psr7:2.0. Use Utils::copyToString instead.
196   */
197  function copy_to_string(StreamInterface $stream, $maxLen = -1)
198  {
199      return Utils::copyToString($stream, $maxLen);
200  }
201   
202  /**
203   * Copy the contents of a stream into another stream until the given number
204   * of bytes have been read.
205   *
206   * @param StreamInterface $source Stream to read from
207   * @param StreamInterface $dest   Stream to write to
208   * @param int             $maxLen Maximum number of bytes to read. Pass -1
209   *                                to read the entire stream.
210   *
211   * @throws \RuntimeException on error.
212   *
213   * @deprecated copy_to_stream will be removed in guzzlehttp/psr7:2.0. Use Utils::copyToStream instead.
214   */
215  function copy_to_stream(StreamInterface $source, StreamInterface $dest, $maxLen = -1)
216  {
217      return Utils::copyToStream($source, $dest, $maxLen);
218  }
219   
220  /**
221   * Calculate a hash of a stream.
222   *
223   * This method reads the entire stream to calculate a rolling hash, based on
224   * PHP's `hash_init` functions.
225   *
226   * @param StreamInterface $stream    Stream to calculate the hash for
227   * @param string          $algo      Hash algorithm (e.g. md5, crc32, etc)
228   * @param bool            $rawOutput Whether or not to use raw output
229   *
230   * @return string Returns the hash of the stream
231   *
232   * @throws \RuntimeException on error.
233   *
234   * @deprecated hash will be removed in guzzlehttp/psr7:2.0. Use Utils::hash instead.
235   */
236  function hash(StreamInterface $stream, $algo, $rawOutput = false)
237  {
238      return Utils::hash($stream, $algo, $rawOutput);
239  }
240   
241  /**
242   * Read a line from the stream up to the maximum allowed buffer length.
243   *
244   * @param StreamInterface $stream    Stream to read from
245   * @param int|null        $maxLength Maximum buffer length
246   *
247   * @return string
248   *
249   * @deprecated readline will be removed in guzzlehttp/psr7:2.0. Use Utils::readLine instead.
250   */
251  function readline(StreamInterface $stream, $maxLength = null)
252  {
253      return Utils::readLine($stream, $maxLength);
254  }
255   
256  /**
257   * Parses a request message string into a request object.
258   *
259   * @param string $message Request message string.
260   *
261   * @return Request
262   *
263   * @deprecated parse_request will be removed in guzzlehttp/psr7:2.0. Use Message::parseRequest instead.
264   */
265  function parse_request($message)
266  {
267      return Message::parseRequest($message);
268  }
269   
270  /**
271   * Parses a response message string into a response object.
272   *
273   * @param string $message Response message string.
274   *
275   * @return Response
276   *
277   * @deprecated parse_response will be removed in guzzlehttp/psr7:2.0. Use Message::parseResponse instead.
278   */
279  function parse_response($message)
280  {
281      return Message::parseResponse($message);
282  }
283   
284  /**
285   * Parse a query string into an associative array.
286   *
287   * If multiple values are found for the same key, the value of that key value
288   * pair will become an array. This function does not parse nested PHP style
289   * arrays into an associative array (e.g., `foo[a]=1&foo[b]=2` will be parsed
290   * into `['foo[a]' => '1', 'foo[b]' => '2'])`.
291   *
292   * @param string   $str         Query string to parse
293   * @param int|bool $urlEncoding How the query string is encoded
294   *
295   * @return array
296   *
297   * @deprecated parse_query will be removed in guzzlehttp/psr7:2.0. Use Query::parse instead.
298   */
299  function parse_query($str, $urlEncoding = true)
300  {
301      return Query::parse($str, $urlEncoding);
302  }
303   
304  /**
305   * Build a query string from an array of key value pairs.
306   *
307   * This function can use the return value of `parse_query()` to build a query
308   * string. This function does not modify the provided keys when an array is
309   * encountered (like `http_build_query()` would).
310   *
311   * @param array     $params   Query string parameters.
312   * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986
313   *                            to encode using RFC3986, or PHP_QUERY_RFC1738
314   *                            to encode using RFC1738.
315   *
316   * @return string
317   *
318   * @deprecated build_query will be removed in guzzlehttp/psr7:2.0. Use Query::build instead.
319   */
320  function build_query(array $params, $encoding = PHP_QUERY_RFC3986)
321  {
322      return Query::build($params, $encoding);
323  }
324   
325  /**
326   * Determines the mimetype of a file by looking at its extension.
327   *
328   * @param string $filename
329   *
330   * @return string|null
331   *
332   * @deprecated mimetype_from_filename will be removed in guzzlehttp/psr7:2.0. Use MimeType::fromFilename instead.
333   */
334  function mimetype_from_filename($filename)
335  {
336      return MimeType::fromFilename($filename);
337  }
338   
339  /**
340   * Maps a file extensions to a mimetype.
341   *
342   * @param $extension string The file extension.
343   *
344   * @return string|null
345   *
346   * @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types
347   * @deprecated mimetype_from_extension will be removed in guzzlehttp/psr7:2.0. Use MimeType::fromExtension instead.
348   */
349  function mimetype_from_extension($extension)
350  {
351      return MimeType::fromExtension($extension);
352  }
353   
354  /**
355   * Parses an HTTP message into an associative array.
356   *
357   * The array contains the "start-line" key containing the start line of
358   * the message, "headers" key containing an associative array of header
359   * array values, and a "body" key containing the body of the message.
360   *
361   * @param string $message HTTP request or response to parse.
362   *
363   * @return array
364   *
365   * @internal
366   *
367   * @deprecated _parse_message will be removed in guzzlehttp/psr7:2.0. Use Message::parseMessage instead.
368   */
369  function _parse_message($message)
370  {
371      return Message::parseMessage($message);
372  }
373   
374  /**
375   * Constructs a URI for an HTTP request message.
376   *
377   * @param string $path    Path from the start-line
378   * @param array  $headers Array of headers (each value an array).
379   *
380   * @return string
381   *
382   * @internal
383   *
384   * @deprecated _parse_request_uri will be removed in guzzlehttp/psr7:2.0. Use Message::parseRequestUri instead.
385   */
386  function _parse_request_uri($path, array $headers)
387  {
388      return Message::parseRequestUri($path, $headers);
389  }
390   
391  /**
392   * Get a short summary of the message body.
393   *
394   * Will return `null` if the response is not printable.
395   *
396   * @param MessageInterface $message    The message to get the body summary
397   * @param int              $truncateAt The maximum allowed size of the summary
398   *
399   * @return string|null
400   *
401   * @deprecated get_message_body_summary will be removed in guzzlehttp/psr7:2.0. Use Message::bodySummary instead.
402   */
403  function get_message_body_summary(MessageInterface $message, $truncateAt = 120)
404  {
405      return Message::bodySummary($message, $truncateAt);
406  }
407   
408  /**
409   * Remove the items given by the keys, case insensitively from the data.
410   *
411   * @param iterable<string> $keys
412   *
413   * @return array
414   *
415   * @internal
416   *
417   * @deprecated _caseless_remove will be removed in guzzlehttp/psr7:2.0. Use Utils::caselessRemove instead.
418   */
419  function _caseless_remove($keys, array $data)
420  {
421      return Utils::caselessRemove($keys, $data);
422  }
423