Frame.php 789 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * @package Net_EPP
  4. */
  5. abstract class Net_EPP_Frame extends DomDocument {
  6. const EPP_URN = 'urn:ietf:params:xml:ns:epp-1.0';
  7. const SCHEMA_URI = 'http://www.w3.org/2001/XMLSchema-instance';
  8. const TEMPLATE = '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"></epp>';
  9. function __construct($type) {
  10. parent::__construct('1.0', 'UTF-8');
  11. $this->loadXML(self::TEMPLATE);
  12. $type = strtolower($type);
  13. if (!in_array($type, array('hello', 'greeting', 'command', 'response'))) trigger_error("Invalid argument value '$type' for \$type", E_USER_ERROR);
  14. $this->epp = $this->firstChild;
  15. $this->body = $this->createElement($type);
  16. $this->epp->appendChild($this->body);
  17. }
  18. function friendly() {
  19. return str_replace('><', ">\n<", $this->saveXML());
  20. }
  21. }
  22. ?>