[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> class-requests.php (source)

   1  <?php
   2  /**
   3   * Requests for PHP
   4   *
   5   * Inspired by Requests for Python.
   6   *
   7   * Based on concepts from SimplePie_File, RequestCore and WP_Http.
   8   *
   9   * @package Requests
  10   *
  11   * @deprecated 6.2.0
  12   */
  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(
  22          'The PSR-0 `Requests_...` class names in the Requests library are deprecated.'
  23          . ' Switch to the PSR-4 `WpOrg\Requests\...` class names at your earliest convenience.',
  24          E_USER_DEPRECATED
  25      );
  26  
  27      // Prevent the deprecation notice from being thrown twice.
  28      if (!defined('REQUESTS_SILENCE_PSR0_DEPRECATIONS')) {
  29          define('REQUESTS_SILENCE_PSR0_DEPRECATIONS', true);
  30      }
  31  }
  32  
  33  require_once  __DIR__ . '/Requests/src/Requests.php';
  34  
  35  /**
  36   * Requests for PHP
  37   *
  38   * Inspired by Requests for Python.
  39   *
  40   * Based on concepts from SimplePie_File, RequestCore and WP_Http.
  41   *
  42   * @package Requests
  43   *
  44   * @deprecated 6.2.0 Use `WpOrg\Requests\Requests` instead for the actual functionality and
  45   *                   use `WpOrg\Requests\Autoload` for the autoloading.
  46   */
  47  class Requests extends WpOrg\Requests\Requests {
  48  
  49      /**
  50       * Deprecated autoloader for Requests.
  51       *
  52       * @deprecated 6.2.0 Use the `WpOrg\Requests\Autoload::load()` method instead.
  53       *
  54       * @codeCoverageIgnore
  55       *
  56       * @param string $class Class name to load
  57       */
  58  	public static function autoloader($class) {
  59          if (class_exists('WpOrg\Requests\Autoload') === false) {
  60              require_once  __DIR__ . '/Requests/src/Autoload.php';
  61          }
  62  
  63          return WpOrg\Requests\Autoload::load($class);
  64      }
  65  
  66      /**
  67       * Register the built-in autoloader
  68       *
  69       * @deprecated 6.2.0 Include the `WpOrg\Requests\Autoload` class and
  70       *                   call `WpOrg\Requests\Autoload::register()` instead.
  71       *
  72       * @codeCoverageIgnore
  73       */
  74  	public static function register_autoloader() {
  75          require_once  __DIR__ . '/Requests/src/Autoload.php';
  76          WpOrg\Requests\Autoload::register();
  77      }
  78  }


Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref