Source for file gMessageRedirect.php

Documentation is available at gMessageRedirect.php

  1. <?php
  2. /**
  3. * ========================================================
  4. * phpGCheckout, Open Source PHP G Checkout Library
  5. * http://www.phpgcheckout.com
  6. * ========================================================
  7. *
  8. * Copyright (c) 2006 Expert Database Solutions, LLC
  9. *
  10. * Permission is hereby granted, free of charge, to any person obtaining a
  11. * copy of this software and associated documentation files (the "Software"),
  12. * to deal in the Software without restriction, including without limitation the
  13. * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14. * copies of the Software, and to permit persons to whom the Software is
  15. * furnished to do so, subject to the following conditions:
  16. *
  17. * The above copyright notice and this permission notice shall be included in all
  18. * copies or substantial portions of the Software.
  19. *
  20. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  21. * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  22. * PARTICULAR PURPOSE AND NONINFRINGEMENT.
  23. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  24. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
  25. * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26. *
  27. */
  28. /**
  29. * Google Checkout Redirect Message Parser
  30. *
  31. * @author David Machiavello
  32. * @copyright Expert Database Solutions, LLC &copy; 2006
  33. *
  34. */
  35. class gMessageRedirect
  36. {
  37. /**
  38. * Holds message to be parsed
  39. *
  40. * @var mixed
  41. */
  42. var $message;
  43. /**
  44. * XML_Unserializer object
  45. *
  46. * @var PEAR XML_Unserializer Obj
  47. */
  48. var $xml_parser;
  49. /**
  50. * Parsed XML from the Unserializer
  51. *
  52. * @var associative array
  53. */
  54. var $parsed_response;
  55. /**
  56. * Stores the redirect URL after parsing
  57. *
  58. * @var string
  59. */
  60. var $redirect_url;
  61. /**
  62. * Constructor
  63. *
  64. * @param mixed $data (xml data)
  65. */
  66. function gMessageRedirect($data)
  67. {
  68. $this->message = $data;
  69. $this->parseMessage();
  70. }
  71. /**
  72. * Parses message provided to the constructor and populates
  73. * the object's parameters
  74. *
  75. * @return void
  76. */
  77. function parseMessage()
  78. {
  79. $this->xml_parser = new XML_Unserializer();
  80. $this->xml_parser->unserialize($this->message);
  81. $this->parsed_response = $this->xml_parser->getUnserializedData();
  82. $this->redirect_url = $this->parsed_response['redirect-url'];
  83. }
  84.  
  85. }
  86. ?>

Documentation generated on Mon, 04 Dec 2006 11:09:35 -0500 by phpDocumentor 1.3.0RC3