From 8bda3d90f6cd7d0f47b8ffa1e919cf2f3b2bd40d Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Sat, 14 Jun 2014 10:19:19 +0200 Subject: [PATCH] Generate the title for the page. --- .../dokuwiki/objectrepresentation/DokuWikiChangeset.php | 8 +++++++- lib/enko/dokuwiki/objectrepresentation/DokuWikiPage.php | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/enko/dokuwiki/objectrepresentation/DokuWikiChangeset.php b/lib/enko/dokuwiki/objectrepresentation/DokuWikiChangeset.php index 97b10bc..67451a4 100755 --- a/lib/enko/dokuwiki/objectrepresentation/DokuWikiChangeset.php +++ b/lib/enko/dokuwiki/objectrepresentation/DokuWikiChangeset.php @@ -18,6 +18,7 @@ class DokuWikiChangeset { private $sum; private $extra; private $content; + private $page; /** * @return mixed @@ -75,6 +76,10 @@ class DokuWikiChangeset { return $this->type; } + public function getPage() { + return $this->page; + } + /** * @return mixed */ @@ -83,7 +88,7 @@ class DokuWikiChangeset { return $this->user; } - function __construct($date,$extra, $id, $ip, $sum, $type, $user) + function __construct($date,$extra, $id, $ip, $sum, $type, $user, DokuWikiPage $page) { $this->date = new \DateTime(); $this->date->setTimestamp($date); @@ -94,6 +99,7 @@ class DokuWikiChangeset { $this->type = $type; $this->user = $user; $this->content = rawWiki($id,$this->date->format('U')); + $this->page = $page; } diff --git a/lib/enko/dokuwiki/objectrepresentation/DokuWikiPage.php b/lib/enko/dokuwiki/objectrepresentation/DokuWikiPage.php index fdffa68..c78dad3 100755 --- a/lib/enko/dokuwiki/objectrepresentation/DokuWikiPage.php +++ b/lib/enko/dokuwiki/objectrepresentation/DokuWikiPage.php @@ -35,10 +35,14 @@ class DokuWikiPage extends DokuWikiNode $changelog_entries = explode("\n", file_get_contents($file)); foreach ($changelog_entries as $raw_entry) { $entry = parseChangelogLine($raw_entry); - $changelog = new DokuWikiChangeset($entry['date'], $entry['extra'], $entry['id'], $entry['ip'], $entry['sum'], $entry['type'], $entry['user']); + $changelog = new DokuWikiChangeset($entry['date'], $entry['extra'], $entry['id'], $entry['ip'], $entry['sum'], $entry['type'], $entry['user'],$this); $this->ChangeLog->append($changelog); } } } + + public function getTitle() { + return strlen($this->getMetaData('title')) > 0 ? $this->getMetaData('title') : $this->getName(); + } } \ No newline at end of file