PageRenderTime 43ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/includes/Opl/Opt/Instruction/Prolog.php

https://bitbucket.org/kandsten/hitta.sverok.se
PHP | 57 lines | 39 code | 6 blank | 12 comment | 3 complexity | dc99b77de5e5d1fde281d9047f126f7a MD5 | raw file
Possible License(s): GPL-3.0, MIT
  1. <?php
  2. /*
  3. * OPEN POWER LIBS <http://www.invenzzia.org>
  4. *
  5. * This file is subject to the new BSD license that is bundled
  6. * with this package in the file LICENSE. It is also available through
  7. * WWW at this URL: <http://www.invenzzia.org/license/new-bsd>
  8. *
  9. * Copyright (c) Invenzzia Group <http://www.invenzzia.org>
  10. * and other contributors. See website for details.
  11. *
  12. * $Id: Prolog.php 231 2009-09-19 07:13:14Z zyxist $
  13. */
  14. class Opt_Instruction_Prolog extends Opt_Compiler_Processor
  15. {
  16. protected $_name = 'prolog';
  17. public function configure()
  18. {
  19. $this->_addInstructions(array('opt:prolog'));
  20. } // end configure();
  21. public function processNode(Opt_Xml_Node $node)
  22. {
  23. $params = array(
  24. 'version' => array(0 => self::OPTIONAL, self::STRING, null),
  25. 'encoding' => array(0 => self::OPTIONAL, self::STRING, null),
  26. 'standalone' => array(0 => self::OPTIONAL, self::STRING, null)
  27. );
  28. $this->_extractAttributes($node, $params);
  29. $root = $node;
  30. while(is_object($tmp = $root->getParent()))
  31. {
  32. $root = $tmp;
  33. }
  34. if(is_null($params['version']))
  35. {
  36. $params['version'] = '\'1.0\'';
  37. }
  38. if(is_null($params['standalone']))
  39. {
  40. $params['standalone'] = '\'yes\'';
  41. }
  42. if(is_null($params['encoding']))
  43. {
  44. unset($params['encoding']);
  45. }
  46. $root->setProlog($prolog = new Opt_Xml_Prolog($params));
  47. $prolog->setDynamic('version', true);
  48. $prolog->setDynamic('standalone', true);
  49. $prolog->setDynamic('encoding', true);
  50. } // end processNode();
  51. } // end Opt_Instruction_Prolog;