-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDokuwikiPage.php
57 lines (50 loc) · 1.41 KB
/
DokuwikiPage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
* This is the Dokuwiki export for FINDOLOGIC.
*
* If any bugs occur, please submit a new issue
* @see https://github.com/findologic/dokuwiki-plugin-findologic-xml-export/issues/new
* @author Dominik Brader <[email protected]>
*/
class DokuwikiPage
{
/**
* @var string ID of the DokuWiki page.
*/
public $id;
/**
* @var string URL of the DokuWiki page (absolute).
*/
public $url;
/**
* @var string Author of the last change that was made to the DokuWiki page.
*/
public $author;
/**
* @var DateTime DateTime object of last edited date.
*/
public $lastEdit;
/**
* @var array Entire metadata of the page.
*/
public $metadata;
/**
* Gets DokuWiki page data based on page ID.
*
* @param $page string page ID.
*/
public function __construct($page)
{
$this->id = $page;
$this->url = wl($page, '', true);
$this->author = p_get_metadata($page)['last_change']['user'];
$date = new DateTime();
$this->lastEdit = $date->setTimestamp(p_get_metadata($page)['last_change']['date']);
$this->metadata = p_get_metadata($page);
// If no user was logged in, then no author is saved.
// DokuWiki uses '(external edit)' as value, so we use it too.
if (empty($this->author)) {
$this->author = '(external edit)';
}
}
}