WordPress/wp-includes/class-requests.php
Sergey Biryukov 94b55b2643 External Libraries: Update the Requests library to version 2.0.6.
This is a maintenance release with minor changes:
* Fix typo in deprecation notice.
* Minor internal improvements for passing the correct type to function calls.
* Confirmed compatibility with PHP 8.2. No changes were needed, so Requests 2.0.1 and higher can be considered compatible with PHP 8.2.
* Various documentation improvements and other general housekeeping.

References:
* [https://github.com/WordPress/Requests/releases/tag/v2.0.6 Requests 2.0.6 release notes]
* [https://github.com/WordPress/Requests/compare/v2.0.5...v2.0.6 Full list of changes in Requests 2.0.6]

Follow-up to [54997], [55007], [55046], [55225], [55296].

Props jrf, costdev.
Fixes #58079.
Built from https://develop.svn.wordpress.org/trunk@55629


git-svn-id: http://core.svn.wordpress.org/trunk@55141 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-05 13:12:26 +00:00

79 lines
2.2 KiB
PHP

<?php
/**
* Requests for PHP
*
* Inspired by Requests for Python.
*
* Based on concepts from SimplePie_File, RequestCore and WP_Http.
*
* @package Requests
*
* @deprecated 6.2.0
*/
/*
* Integrators who cannot yet upgrade to the PSR-4 class names can silence deprecations
* by defining a `REQUESTS_SILENCE_PSR0_DEPRECATIONS` constant and setting it to `true`.
* The constant needs to be defined before this class is required.
*/
if (!defined('REQUESTS_SILENCE_PSR0_DEPRECATIONS') || REQUESTS_SILENCE_PSR0_DEPRECATIONS !== true) {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
trigger_error(
'The PSR-0 `Requests_...` class names in the Requests library are deprecated.'
. ' Switch to the PSR-4 `WpOrg\Requests\...` class names at your earliest convenience.',
E_USER_DEPRECATED
);
// Prevent the deprecation notice from being thrown twice.
if (!defined('REQUESTS_SILENCE_PSR0_DEPRECATIONS')) {
define('REQUESTS_SILENCE_PSR0_DEPRECATIONS', true);
}
}
require_once __DIR__ . '/Requests/src/Requests.php';
/**
* Requests for PHP
*
* Inspired by Requests for Python.
*
* Based on concepts from SimplePie_File, RequestCore and WP_Http.
*
* @package Requests
*
* @deprecated 6.2.0 Use `WpOrg\Requests\Requests` instead for the actual functionality and
* use `WpOrg\Requests\Autoload` for the autoloading.
*/
class Requests extends WpOrg\Requests\Requests {
/**
* Deprecated autoloader for Requests.
*
* @deprecated 6.2.0 Use the `WpOrg\Requests\Autoload::load()` method instead.
*
* @codeCoverageIgnore
*
* @param string $class Class name to load
*/
public static function autoloader($class) {
if (class_exists('WpOrg\Requests\Autoload') === false) {
require_once __DIR__ . '/Requests/src/Autoload.php';
}
return WpOrg\Requests\Autoload::load($class);
}
/**
* Register the built-in autoloader
*
* @deprecated 6.2.0 Include the `WpOrg\Requests\Autoload` class and
* call `WpOrg\Requests\Autoload::register()` instead.
*
* @codeCoverageIgnore
*/
public static function register_autoloader() {
require_once __DIR__ . '/Requests/src/Autoload.php';
WpOrg\Requests\Autoload::register();
}
}