Add dependency checking for included files.
[htmlpurifier-web.git] / xhtml-compiler / XHTMLCompiler / DOMFilter / IEConditionalComments.php
blob4edc31a31634a9569a6e2f9beddb95c887bc32bb
1 <?php
3 class XHTMLCompiler_DOMFilter_IEConditionalComments extends XHTMLCompiler_DOMFilter
6 protected $name = 'IEConditionalComments';
7 protected $xcAttr = array('ie-condition');
9 public function process(DOMDocument $dom, $page, $manager) {
11 $nodes = $this->query( "//*[@xc:ie-condition]" );
13 foreach ($nodes as $node) {
14 $condition = $this->confiscateAttr($node, $this->ns, 'ie-condition');
15 if ($condition) {
16 $sxml = simplexml_import_dom($node);
17 $code = $sxml->asXml();
18 $comment = "[if $condition]>$code<![endif]";
19 $parent = $node->parentNode;
20 $parent->replaceChild($dom->createComment($comment), $node);