/includes/Opl/Opt/Instruction/Prolog.php
PHP | 57 lines | 39 code | 6 blank | 12 comment | 3 complexity | dc99b77de5e5d1fde281d9047f126f7a MD5 | raw file
Possible License(s): GPL-3.0, MIT
- <?php
- /*
- * OPEN POWER LIBS <http://www.invenzzia.org>
- *
- * This file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE. It is also available through
- * WWW at this URL: <http://www.invenzzia.org/license/new-bsd>
- *
- * Copyright (c) Invenzzia Group <http://www.invenzzia.org>
- * and other contributors. See website for details.
- *
- * $Id: Prolog.php 231 2009-09-19 07:13:14Z zyxist $
- */
- class Opt_Instruction_Prolog extends Opt_Compiler_Processor
- {
- protected $_name = 'prolog';
-
- public function configure()
- {
- $this->_addInstructions(array('opt:prolog'));
- } // end configure();
-
- public function processNode(Opt_Xml_Node $node)
- {
- $params = array(
- 'version' => array(0 => self::OPTIONAL, self::STRING, null),
- 'encoding' => array(0 => self::OPTIONAL, self::STRING, null),
- 'standalone' => array(0 => self::OPTIONAL, self::STRING, null)
- );
- $this->_extractAttributes($node, $params);
-
- $root = $node;
- while(is_object($tmp = $root->getParent()))
- {
- $root = $tmp;
- }
- if(is_null($params['version']))
- {
- $params['version'] = '\'1.0\'';
- }
- if(is_null($params['standalone']))
- {
- $params['standalone'] = '\'yes\'';
- }
- if(is_null($params['encoding']))
- {
- unset($params['encoding']);
- }
- $root->setProlog($prolog = new Opt_Xml_Prolog($params));
- $prolog->setDynamic('version', true);
- $prolog->setDynamic('standalone', true);
- $prolog->setDynamic('encoding', true);
- } // end processNode();
- } // end Opt_Instruction_Prolog;