Source for file jResponseText.class.php

Documentation is available at jResponseText.class.php

  1. <?php
  2. /**
  3. @package     jelix
  4. @subpackage  core_response
  5. @author      Laurent Jouanneau
  6. @copyright   2005-2010 Laurent Jouanneau
  7. @link        http://www.jelix.org
  8. @licence     GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
  9. */
  10.  
  11. /**
  12. * plain Text response
  13. @package  jelix
  14. @subpackage core_response
  15. */
  16. class jResponseText extends jResponse {
  17.     /**
  18.     * @var string 
  19.     */
  20.     protected $_type = 'text';
  21.  
  22.     /**
  23.      * text content
  24.      * @var string 
  25.      */
  26.     public $content = '';
  27.  
  28.     /**
  29.      * output the content with the text/plain mime type
  30.      * @return boolean    true si it's ok
  31.      */
  32.     public function output(){
  33.         global $gJConfig;
  34.         $this->addHttpHeader('Content-Type','text/plain;charset='.$gJConfig->charset,false);
  35.         $this->_httpHeaders['Content-length']=strlen($this->content);
  36.         $this->sendHttpHeaders();
  37.         echo $this->content;
  38.         return true;
  39.     }
  40.  
  41.     /**
  42.      * output errors
  43.      */
  44.     public function outputErrors(){
  45.         global $gJConfig;
  46.         header("HTTP/1.0 500 Internal Jelix Error");
  47.         header('Content-Type: text/plain;charset='.$gJConfig->charset);
  48.         echo $GLOBALS['gJCoord']->getGenericErrorMessage();
  49.     }
  50. }

Documentation generated on Wed, 24 Sep 2014 22:01:43 +0200 by phpDocumentor 1.4.3