예제 #1
0
 /**
  * Processes the opt:dtd node.
  * @internal
  * @param Opt_Xml_Node $node The recognized node.
  */
 public function processNode(Opt_Xml_Node $node)
 {
     $params = array('template' => array(0 => self::OPTIONAL, self::ID, null));
     $this->_extractAttributes($node, $params);
     // TODO: Hmmm... now we have to invent, how to deal with THAT!
     if (is_null($params['template'])) {
         Opt_Compiler_Utils::removeCdata($node, false);
         $this->_process($node);
     } else {
         $root = $node;
         while (is_object($tmp = $root->getParent())) {
             $root = $tmp;
         }
         $node->set('nophp', true);
         $node->set('hidden', false);
         // Use one of the predefined DTD templates for various markup languages
         switch ($params['template']) {
             case 'xhtml10strict':
                 $dtd = new Opt_Xml_Dtd('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
                 break;
             case 'xhtml10transitional':
                 $dtd = new Opt_Xml_Dtd('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
                 break;
             case 'xhtml10frameset':
                 $dtd = new Opt_Xml_Dtd('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">');
                 break;
             case 'xhtml11':
                 $dtd = new Opt_Xml_Dtd('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">');
                 break;
             case 'html40':
             case 'html4':
                 $dtd = new Opt_Xml_Dtd('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">');
                 break;
             case 'html5':
                 $dtd = new Opt_Xml_Dtd('<!DOCTYPE html>');
                 break;
             default:
                 throw new Opt_InvalidValue_Exception('opt:dtd template attribute: ' . $params['template']);
         }
         if (isset($dtd)) {
             $root->setDtd($dtd);
         }
     }
 }
예제 #2
0
 /**
  * Used on a node, it looks for the CDATA elements and disables the
  * CDATA flag on them. Moreover, it allows to disable the text entitizing.
  *
  * Note: this function is deprecated. Use Opt_Compiler_Utils::removeCdata()
  * instead.
  *
  * @deprecated
  * @param Opt_Xml_Node $node The scanned node
  * @param Boolean $noEntitize optional The entitizing flag.
  */
 public function disableCDATA(Opt_Xml_Node $node, $noEntitize = false)
 {
     Opt_Compiler_Utils::removeCdata($node, !$noEntitize);
 }