home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / HTML / AJAX / Response.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  2.0 KB  |  79 lines

  1. <?php
  2. /**
  3.  * OO AJAX Implementation for PHP, contains HTML_AJAX_Response
  4.  *
  5.  * SVN Rev: $Id: Response.php 620 2008-05-07 22:33:32Z jeichorn $ 
  6.  *
  7.  * @category   HTML
  8.  * @package    AJAX
  9.  * @author     Elizabeth Smith <auroraeosrose@gmail.com>
  10.  * @copyright  2005-2006 Elizabeth Smith
  11.  * @license    http://www.opensource.org/licenses/lgpl-license.php  LGPL
  12.  * @version    Release: 0.5.6
  13.  */
  14.  
  15. /**
  16.  * Require the main AJAX library
  17.  */
  18. require_once 'HTML/AJAX.php';
  19.  
  20. /**
  21.  * Simple base class for a response object to use as an ajax callback
  22.  *
  23.  * This is the base response class, more interesting response classes can be
  24.  * built off of this, simply give it a unique content type and override the
  25.  * getPayload method or fill the payload property with your extended classes's
  26.  * serialized content
  27.  *
  28.  * @version   $Id: Response.php 620 2008-05-07 22:33:32Z jeichorn $
  29.  */
  30. class HTML_AJAX_Response
  31. {
  32.  
  33.     /**
  34.      * The base response class uses plain text so use that content type
  35.      *
  36.      * @var string
  37.      * @access public
  38.      */
  39.     var $contentType = 'text/plain';
  40.  
  41.     /**
  42.      * Assign a string to this variable to use the bare response class
  43.      *
  44.      * @var string
  45.      * @access public
  46.      */
  47.     var $payload = '';
  48.  
  49.     /**
  50.      * Returns the appropriate content type
  51.      *
  52.      * This normally simply returns the contentType property but can be overridden
  53.      * by an extending class if the content-type is variable
  54.      *
  55.      * @return  string   appropriate content type
  56.      * @access public
  57.      */
  58.     function getContentType()
  59.     {
  60.         return $this->contentType;
  61.     }
  62.  
  63.     /**
  64.      * Returns the serialized content of the response class
  65.      *
  66.      * You can either fill the payload elsewhere in an extending class and leave
  67.      * this method alone, or you can override it if you have a different type
  68.      * of payload that needs special treatment
  69.      *
  70.      * @return  string   serialized response content
  71.      * @access public
  72.      */
  73.     function getPayload()
  74.     {
  75.         return $this->payload;
  76.     }
  77. }
  78. ?>
  79.