Implement AbsolutePath and IEConditionalComments filters. Add an xc namespace (urn...
[xhtml-compiler.git] / XHTMLCompiler / DOMFilter / AbsolutePath.php
blob8c8d927841691e52513cb54dddac1131ab57ed14
1 <?php
3 class XHTMLCompiler_DOMFilter_AbsolutePath extends XHTMLCompiler_DOMFilter
6 protected $name = 'AbsolutePath';
7 protected $xcAttr = array('absolute');
9 public function process(DOMDocument $dom, $page) {
11 $xc = XHTMLCompiler::getInstance();
12 $absolute_prefix = $xc->getConf('web_path') . '/';
13 $nodes = $this->query("//*[@xc:absolute]");
15 foreach ($nodes as $node) {
16 // absolute
17 $absolute = $this->confiscateAttr($node, $this->ns, 'absolute');
18 if ($absolute) {
19 $uri = $node->getAttribute($absolute);
20 $node->setAttribute($absolute, $absolute_prefix . $uri);