Have filters add self as dependencies, rm whitespace.
[xhtml-compiler.git] / XHTMLCompiler / DOMFilter / NewsDate.php
blobc4d3739be6c45b853eed9bb896d62b4c70a01260
1 <?php
3 /**
4 * This filter, closely related with the News filter, generates the
5 * Date metadata associated with a news article.
6 */
7 class XHTMLCompiler_DOMFilter_NewsDate extends XHTMLCompiler_DOMFilter_NewsBase
9 protected $name = 'NewsDate';
10 public function process(DOMDocument $dom, $page, $manager) {
11 if (!isset($page->attr['news'])) return;
12 $dateTime = $page->getCreatedTime();
13 if (!$dateTime) return;
14 $manager->addDependency(__FILE__);
15 $content = $dom->getElementById('content');
16 $body = $content->parentNode;
17 $date = $this->makeDateNode($dom, $dateTime);
18 $date->setAttribute('id', 'news-date');
19 $body->insertBefore($date, $content);