Requests.php
71 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * AmeliaVendor_Requests for PHP |
| 5 | * |
| 6 | * Inspired by AmeliaVendor_Requests for Python. |
| 7 | * |
| 8 | * Based on concepts from SimplePie_File, RequestCore and WP_Http. |
| 9 | * |
| 10 | * @package AmeliaVendor_Requests |
| 11 | * |
| 12 | * @deprecated 2.0.0 |
| 13 | */ |
| 14 | /* |
| 15 | * Integrators who cannot yet upgrade to the PSR-4 class names can silence deprecations |
| 16 | * by defining a `REQUESTS_SILENCE_PSR0_DEPRECATIONS` constant and setting it to `true`. |
| 17 | * The constant needs to be defined before this class is required. |
| 18 | */ |
| 19 | if (!defined('REQUESTS_SILENCE_PSR0_DEPRECATIONS') || REQUESTS_SILENCE_PSR0_DEPRECATIONS !== true) { |
| 20 | // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error |
| 21 | trigger_error('The PSR-0 `Requests_...` class names in the AmeliaVendor_Requests library are deprecated.' . ' Switch to the PSR-4 `WpOrg\Requests\...` class names at your earliest convenience.', E_USER_DEPRECATED); |
| 22 | // Prevent the deprecation notice from being thrown twice. |
| 23 | if (!defined('REQUESTS_SILENCE_PSR0_DEPRECATIONS')) { |
| 24 | define('REQUESTS_SILENCE_PSR0_DEPRECATIONS', true); |
| 25 | } |
| 26 | } |
| 27 | require_once dirname(__DIR__) . '/src/AmeliaVendor_Requests.php'; |
| 28 | /** |
| 29 | * AmeliaVendor_Requests for PHP |
| 30 | * |
| 31 | * Inspired by AmeliaVendor_Requests for Python. |
| 32 | * |
| 33 | * Based on concepts from SimplePie_File, RequestCore and WP_Http. |
| 34 | * |
| 35 | * @package AmeliaVendor_Requests |
| 36 | * |
| 37 | * @deprecated 2.0.0 Use `WpOrg\Requests\Requests` instead for the actual functionality and |
| 38 | * use `WpOrg\Requests\Autoload` for the autoloading. |
| 39 | */ |
| 40 | class AmeliaVendor_Requests extends WpOrg\Requests\Requests |
| 41 | { |
| 42 | /** |
| 43 | * Deprecated autoloader for AmeliaVendor_Requests. |
| 44 | * |
| 45 | * @deprecated 2.0.0 Use the `WpOrg\Requests\Autoload::load()` method instead. |
| 46 | * |
| 47 | * @codeCoverageIgnore |
| 48 | * |
| 49 | * @param string $class Class name to load |
| 50 | */ |
| 51 | public static function autoloader($class) |
| 52 | { |
| 53 | if (class_exists('AmeliaVendor\WpOrg\Requests\Autoload') === false) { |
| 54 | require_once dirname(__DIR__) . '/src/Autoload.php'; |
| 55 | } |
| 56 | return \AmeliaVendor\WpOrg\Requests\Autoload::load($class); |
| 57 | } |
| 58 | /** |
| 59 | * Register the built-in autoloader |
| 60 | * |
| 61 | * @deprecated 2.0.0 Include the `WpOrg\Requests\Autoload` class and |
| 62 | * call `WpOrg\Requests\Autoload::register()` instead. |
| 63 | * |
| 64 | * @codeCoverageIgnore |
| 65 | */ |
| 66 | public static function register_autoloader() |
| 67 | { |
| 68 | require_once dirname(__DIR__) . '/src/Autoload.php'; |
| 69 | \AmeliaVendor\WpOrg\Requests\Autoload::register(); |
| 70 | } |
| 71 | } |