[ Index ]

PHP Cross Reference of Akelos Framework

title

Body

[close]

/AkHeaders/ -> AkHttpStatusCode.php (source)

   1  <?php
   2  /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
   3  
   4  // +----------------------------------------------------------------------+
   5  // | Akelos Framework - http://www.akelos.org                             |
   6  // +----------------------------------------------------------------------+
   7  // | Copyright (c) 2002-2006, Akelos Media, S.L.  & Bermi Ferrer Martinez |
   8  // | Released under the GNU Lesser General Public License, see LICENSE.txt|
   9  // +----------------------------------------------------------------------+
  10  
  11  /**
  12   * @package ActionController
  13   * @subpackage Response
  14   * @author Bermi Ferrer <bermi a.t akelos c.om>
  15   * @copyright Copyright (c) 2002-2006, Akelos Media, S.L. http://www.akelos.org
  16   * @license GNU Lesser General Public License <http://www.gnu.org/copyleft/lesser.html>
  17   */
  18  
  19  class AkHttpStatusCode
  20  {
  21  	function statusCode($code_number=null, $send=true)
  22      {
  23          $codes = array(
  24          // Information Codes
  25          100=>'100 Continue',
  26          101=>'101 Switching Protocols',
  27          102=>'102 Processing',
  28          // Success Codes
  29          200=>'200 OK',
  30          201=>'201 Created',
  31          202=>'202 Accepted',
  32          203=>'203 Non-Authoriative Information',
  33          204=>'204 No Content',
  34          205=>'205 Reset Content',
  35          206=>'206 Partial Content',
  36          207=>'207 Multi-Status',
  37          // Redirection Codes
  38          300=>'300 Multiple Choices',
  39          301=>'301 Moved Permanently',
  40          302=>'302 Found',
  41          303=>'303 See Other',
  42          304=>'304 Not Modified',
  43          305=>'305 Use Proxy',
  44          306=>'306 (Unused)',
  45          307=>'307 Temporary Redirect',
  46          // Client Error Codes
  47          400=>'400 Bad Request',
  48          401=>'401 Unauthorized',
  49          402=>'402 Payment Granted',
  50          403=>'403 Forbidden',
  51          404=>'404 Not found',
  52          405=>'405 Method Not Allowed',
  53          406=>'406 Not Acceptable',
  54          407=>'407 Proxy Authentication Required',
  55          408=>'408 Request Time-out',
  56          409=>'409 Conflict',
  57          410=>'410 Gone',
  58          411=>'411 Length Required',
  59          412=>'412 Precondition Failed',
  60          413=>'413 Request Entity Too Large',
  61          414=>'414 Request-URI Too Large',
  62          415=>'415 Unsupported Media Type',
  63          416=>'416 Requested range not satisfiable',
  64          417=>'417 Expectation Failed',
  65          422=>'422 Unprocessable Entity',
  66          423=>'423 Locked',
  67          424=>'424 Failed Dependency',
  68          // Server Errors
  69          500=>'500 Internal Server Error',
  70          501=>'501 Not Implemented',
  71          502=>'502 Bad Gateway',
  72          503=>'503 Service Unavailable',
  73          504=>'504 Gateway Timeout',
  74          505=>'505 HTTP Version Not Supported',
  75          507=>'507 Insufficient Storage');
  76          
  77  
  78          if(isset($code_number) && array_key_exists($code_number,$codes)){
  79              if($send==true){
  80                  AkHeaders::sendHeader("Status: ".$codes[$code_number]);
  81              }else{
  82                  AkHeaders::addHeader("Status: ".$codes[$code_number]);
  83              }
  84              return true;
  85          }
  86          return false;
  87      }
  88  }
  89  
  90  ?>


Generated: Mon Oct 27 12:43:49 2008 Cross-referenced by PHPXref 0.6