diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:56:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:56:49 +0000 |
commit | a415c29efee45520ae252d2aa28f1083a521cd7b (patch) | |
tree | f4ade4b6668ecc0765de7e1424f7c1427ad433ff /wp-includes/class-requests.php | |
parent | Initial commit. (diff) | |
download | wordpress-a415c29efee45520ae252d2aa28f1083a521cd7b.tar.xz wordpress-a415c29efee45520ae252d2aa28f1083a521cd7b.zip |
Adding upstream version 6.4.3+dfsg1.upstream/6.4.3+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wp-includes/class-requests.php')
-rw-r--r-- | wp-includes/class-requests.php | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/wp-includes/class-requests.php b/wp-includes/class-requests.php new file mode 100644 index 0000000..4b06252 --- /dev/null +++ b/wp-includes/class-requests.php @@ -0,0 +1,78 @@ +<?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(); + } +} |