[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_redirect/src/Field/ -> RedirectField.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_redirect
   6   *
   7   * @copyright   (C) 2014 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  namespace Joomla\Component\Redirect\Administrator\Field;
  12  
  13  use Joomla\CMS\Form\Field\ListField;
  14  use Joomla\CMS\HTML\HTMLHelper;
  15  
  16  // phpcs:disable PSR1.Files.SideEffects
  17  \defined('_JEXEC') or die;
  18  // phpcs:enable PSR1.Files.SideEffects
  19  
  20  /**
  21   * A dropdown containing all valid HTTP 1.1 response codes.
  22   *
  23   * @package     Joomla.Administrator
  24   * @subpackage  com_redirect
  25   * @since       3.4
  26   */
  27  class RedirectField extends ListField
  28  {
  29      /**
  30       * The form field type.
  31       *
  32       * @var    string
  33       * @since  3.4
  34       */
  35      protected $type = 'Redirect';
  36  
  37      /**
  38       * A map of integer HTTP 1.1 response codes to the full HTTP Status for the headers.
  39       *
  40       * @var    object
  41       * @since  3.4
  42       * @link   https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
  43       */
  44      protected $responseMap = array(
  45          100 => 'HTTP/1.1 100 Continue',
  46          101 => 'HTTP/1.1 101 Switching Protocols',
  47          102 => 'HTTP/1.1 102 Processing',
  48          103 => 'HTTP/1.1 103 Early Hints',
  49          200 => 'HTTP/1.1 200 OK',
  50          201 => 'HTTP/1.1 201 Created',
  51          202 => 'HTTP/1.1 202 Accepted',
  52          203 => 'HTTP/1.1 203 Non-Authoritative Information',
  53          204 => 'HTTP/1.1 204 No Content',
  54          205 => 'HTTP/1.1 205 Reset Content',
  55          206 => 'HTTP/1.1 206 Partial Content',
  56          207 => 'HTTP/1.1 207 Multi-Status',
  57          208 => 'HTTP/1.1 208 Already Reported',
  58          226 => 'HTTP/1.1 226 IM Used',
  59          300 => 'HTTP/1.1 300 Multiple Choices',
  60          301 => 'HTTP/1.1 301 Moved Permanently',
  61          302 => 'HTTP/1.1 302 Found',
  62          303 => 'HTTP/1.1 303 See other',
  63          304 => 'HTTP/1.1 304 Not Modified',
  64          305 => 'HTTP/1.1 305 Use Proxy',
  65          306 => 'HTTP/1.1 306 (Unused)',
  66          307 => 'HTTP/1.1 307 Temporary Redirect',
  67          308 => 'HTTP/1.1 308 Permanent Redirect',
  68          400 => 'HTTP/1.1 400 Bad Request',
  69          401 => 'HTTP/1.1 401 Unauthorized',
  70          402 => 'HTTP/1.1 402 Payment Required',
  71          403 => 'HTTP/1.1 403 Forbidden',
  72          404 => 'HTTP/1.1 404 Not Found',
  73          405 => 'HTTP/1.1 405 Method Not Allowed',
  74          406 => 'HTTP/1.1 406 Not Acceptable',
  75          407 => 'HTTP/1.1 407 Proxy Authentication Required',
  76          408 => 'HTTP/1.1 408 Request Timeout',
  77          409 => 'HTTP/1.1 409 Conflict',
  78          410 => 'HTTP/1.1 410 Gone',
  79          411 => 'HTTP/1.1 411 Length Required',
  80          412 => 'HTTP/1.1 412 Precondition Failed',
  81          413 => 'HTTP/1.1 413 Payload Too Large',
  82          414 => 'HTTP/1.1 414 URI Too Long',
  83          415 => 'HTTP/1.1 415 Unsupported Media Type',
  84          416 => 'HTTP/1.1 416 Requested Range Not Satisfiable',
  85          417 => 'HTTP/1.1 417 Expectation Failed',
  86          418 => 'HTTP/1.1 418 I\'m a teapot',
  87          421 => 'HTTP/1.1 421 Misdirected Request',
  88          422 => 'HTTP/1.1 422 Unprocessable Entity',
  89          423 => 'HTTP/1.1 423 Locked',
  90          424 => 'HTTP/1.1 424 Failed Dependency',
  91          425 => 'HTTP/1.1 425 Reserved for WebDAV advanced collections expired proposal',
  92          426 => 'HTTP/1.1 426 Upgrade Required',
  93          428 => 'HTTP/1.1 428 Precondition Required',
  94          429 => 'HTTP/1.1 429 Too Many Requests',
  95          431 => 'HTTP/1.1 431 Request Header Fields Too Large',
  96          451 => 'HTTP/1.1 451 Unavailable For Legal Reasons',
  97          500 => 'HTTP/1.1 500 Internal Server Error',
  98          501 => 'HTTP/1.1 501 Not Implemented',
  99          502 => 'HTTP/1.1 502 Bad Gateway',
 100          503 => 'HTTP/1.1 503 Service Unavailable',
 101          504 => 'HTTP/1.1 504 Gateway Timeout',
 102          505 => 'HTTP/1.1 505 HTTP Version Not Supported',
 103          506 => 'HTTP/1.1 506 Variant Also Negotiates (Experimental)',
 104          507 => 'HTTP/1.1 507 Insufficient Storage',
 105          508 => 'HTTP/1.1 508 Loop Detected',
 106          510 => 'HTTP/1.1 510 Not Extended',
 107          511 => 'HTTP/1.1 511 Network Authentication Required',
 108      );
 109  
 110      /**
 111       * Method to get the field input markup.
 112       *
 113       * @return  array   The field input markup.
 114       *
 115       * @since   3.4
 116       */
 117      protected function getOptions()
 118      {
 119          $options = array();
 120  
 121          foreach ($this->responseMap as $key => $value) {
 122              $options[] = HTMLHelper::_('select.option', $key, $value);
 123          }
 124  
 125          // Merge any additional options in the XML definition.
 126          $options = array_merge(parent::getOptions(), $options);
 127  
 128          return $options;
 129      }
 130  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer