Source for file CMS3_StandartOutputHandler_OutputHandle.php

Documentation is available at CMS3_StandartOutputHandler_OutputHandle.php

  1. <?php     
  2. //              (F)
  3. // CMS3 - A Three Content Management System.
  4. // Copyright (C) 2007  Jop... (Jonas F. Jensen).
  5. // 
  6. // This program is free software; you can redistribute it and/or
  7. // modify it under the terms of the GNU General Public License
  8. // as published by the Free Software Foundation; either version 2
  9. // of the License, or (at your option) any later version.
  10. // 
  11. // This program is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. // GNU General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU General Public License
  17. // along with this program; if not, write to the Free Software
  18. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  19.  
  20. /**
  21. *This file defines CMS3_StandartOutputHandler_OutputHandler
  22. *
  23. *An abstract class with implementation of error handling for IOutputHandlers
  24. *
  25. @package    StandartOutputHandler
  26. @author    Jonas F. Jensen <jopsen@gmail.com>
  27. @copyright    2007 Jonas F. Jensen.
  28. @license    http://www.gnu.org/licenses/gpl.txt
  29. */
  30.  
  31. /**
  32. *The interface defined in this file depends on IOutputHandler
  33. */
  34. require_once("share/System/IOutputHandler.php");
  35.  
  36. /**
  37.  * class CMS3_StandartOutputHandler_OutputHandler an abstract implementation of error codes for an outputhandler
  38.  */
  39. abstract class CMS3_StandartOutputHandler_OutputHandler implements IOutputHandler
  40. {
  41.  
  42.     /** Aggregations: */
  43.  
  44.     /** Compositions: */
  45.  
  46.      /*** Attributes: ***/
  47.  
  48.  
  49.     /**
  50.      * Print an error code, if you use this method no other methods will be available.
  51.      *
  52.      * This method will print all 4xx and 5xx error codes specified in the RFC 2616, and some of the codes specified in the WebDAV extension.
  53.      * NOTE: This mehtod postes a soft error code in HTML, this may be improved later on.
  54.      *
  55.      * @param string msg The message you wish to print
  56.  
  57.      * @param int code The error code you wish to print eg. 404.
  58.  
  59.      * @return 
  60.      * @access public
  61.      */
  62.     public function PrintError$msg,  $code {
  63.         $ErrorCodes array(
  64.             "400" => "Bad Request",
  65.             "401" => "Unauthorized",
  66.             "402" => "Payment Required",
  67.             "403" => "Forbidden",
  68.             "404" => "Not Found",
  69.             "405" => "Method Not Allowed",
  70.             "406" => "Not Acceptable",
  71.             "407" => "Proxy Authentication Required",
  72.             "408" => "Request Timeout",
  73.             "409" => "Conflict",
  74.             "410" => "Gone",
  75.             "411" => "Length Required",
  76.             "412" => "Precondition Failed",
  77.             "413" => "Request Entity Too Large",
  78.             "414" => "Request-URI Too Long",
  79.             "415" => "Unsupported Media Type",
  80.             "416" => "Requested Range Not Satisfiable",
  81.             "417" => "Expectation Failed",
  82.             "422" => "Unprocessable Entity",
  83.             "423" => "Locked",
  84.             "424" => "Failed Dependency",
  85.             "425" => "Unordered Collection",
  86.             "426" => "Upgrade Required",
  87.             "449" => "Retry With",
  88.             "500" => "Internal Server Error",
  89.             "501" => "Not Implemented",
  90.             "502" => "Bad Gateway",
  91.             "503" => "Service Unavailable",
  92.             "504" => "Gateway Timeout",
  93.             "505" => "HTTP Version Not Supported",
  94.             "507" => "Insufficient Storage",
  95.             "509" => "Bandwidth Limit Exceeded");
  96.  
  97.         //Set title on the child
  98.         $this->SetTitle($code "-" $title);
  99.  
  100.         //Do we know the meaning of the error code?
  101.         if(array_key_exists($code,$ErrorCodes)){
  102.             $this->SetBody("Error$code - $ErrorCodes[$code]);    
  103.         }else{
  104.             $this->SetBody("CustomError$code");
  105.         }
  106.  
  107.         //Print the error message, using method on a child
  108.         $this->Parse();
  109.  
  110.     // end of member function PrintError
  111.  
  112.  
  113. // end of CMS3_OutputHandler
  114. ?>

Documentation generated on Mon, 30 Apr 2007 01:59:09 +0200 by phpDocumentor 1.3.1