Source for file XmlAction.class.php

Documentation is available at XmlAction.class.php

  1. <?php
  2. /**
  3. * @since 11/29/06
  4. * @package polyphony.AbstractActions
  5. *
  6. * @copyright Copyright &copy; 2005, Middlebury College
  7. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  8. *
  9. * @version $Id: XmlAction.class.php,v 1.4 2007/09/19 14:04:42 adamfranco Exp $
  10. */
  11. require_once(POLYPHONY_DIR.'/main/library/AbstractActions/Action.class.php');
  12.  
  13. /**
  14. * A generic class for writing XML responses
  15. *
  16. * @since 11/29/06
  17. * @package polyphony.AbstractActions
  18. *
  19. * @copyright Copyright &copy; 2005, Middlebury College
  20. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  21. *
  22. * @version $Id: XmlAction.class.php,v 1.4 2007/09/19 14:04:42 adamfranco Exp $
  23. */
  24. class XmlAction
  25. extends Action
  26. {
  27.  
  28. /**
  29. * Answer a unauthorized response
  30. *
  31. * @return void
  32. * @access public
  33. * @since 11/29/06
  34. */
  35. function getUnauthorizedMessage () {
  36. $this->error('Unauthorized');
  37. }
  38. /**
  39. * Start the document
  40. *
  41. * @return void
  42. * @access public
  43. * @since 11/10/06
  44. */
  45. function start () {
  46. if (isset($this->_started))
  47. return;
  48. $this->_started = true;
  49. header("Content-Type: text/xml; charset=utf-8");
  50. print<<<END
  51. <?xml version="1.0" encoding="utf-8" ?>
  52. <response>
  53. END;
  54. }
  55. /**
  56. * End the document
  57. *
  58. * @return void
  59. * @access public
  60. * @since 11/10/06
  61. */
  62. function end () {
  63. print "\n</response>";
  64. exit;
  65. }
  66. /**
  67. * Respond with an error
  68. *
  69. * @param string $message
  70. * @return void
  71. * @access public
  72. * @since 11/29/06
  73. */
  74. function error ($message) {
  75. $this->start();
  76. print "\n\t<error><![CDATA[".str_replace(']]>', '}}>', $message)."]]></error>";
  77. $this->end();
  78. }
  79. }
  80.  
  81. ?>

Documentation generated on Wed, 19 Sep 2007 10:28:28 -0400 by phpDocumentor 1.3.0RC3