diff options
author | Andrew Manning <andrew@reticu.li> | 2016-11-28 06:36:52 -0700 |
---|---|---|
committer | Andrew Manning <andrew@reticu.li> | 2016-11-28 06:36:52 -0700 |
commit | 924f796eb830b8a498c01013d9690dd071b50691 (patch) | |
tree | f2ada23a919b8f2b7a1a3f2034f7aef2916e4d1d /include | |
parent | 2528f35f008dcc39e2a6c6680ab771a9da7c20f5 (diff) | |
parent | 683a09781ad9c9be00ce67e35f560e6fca051f3b (diff) | |
download | volse-hubzilla-924f796eb830b8a498c01013d9690dd071b50691.tar.gz volse-hubzilla-924f796eb830b8a498c01013d9690dd071b50691.tar.bz2 volse-hubzilla-924f796eb830b8a498c01013d9690dd071b50691.zip |
Merge remote-tracking branch 'upstream/dev' into doco
Diffstat (limited to 'include')
-rw-r--r-- | include/wiki.php | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/include/wiki.php b/include/wiki.php index d2cb51bd3..eb87840f6 100644 --- a/include/wiki.php +++ b/include/wiki.php @@ -31,16 +31,29 @@ function wiki_page_list($resource_id) { if (!$w['path']) { return array('pages' => null, 'wiki' => null); } - $pages = array(); - $pages[] = array('title' => 'Home', 'url' => 'Home'); + + $pages[] = [ + 'resource_id' => '', + 'title' => 'Home', + 'url' => 'Home', + 'link_id' => 'id_wiki_home_0' + ]; + if (is_dir($w['path']) === true) { $files = array_diff(scandir($w['path']), array('.', '..', '.git')); // TODO: Check that the files are all text files - + $i = 1; foreach($files as $file) { // strip the .md file extension and unwrap URL encoding to leave HTML encoded name - if( urldecode(substr($file, 0, -3)) !== 'Home') { - $pages[] = array('title' => urldecode(substr($file, 0, -3)), 'url' => urlencode(substr($file, 0, -3))); + $title = substr($file, 0, -3); + if(urldecode($title) !== 'Home') { + $pages[] = [ + 'resource_id' => $resource_id, + 'title' => urldecode($title), + 'url' => $title, + 'link_id' => 'id_' . substr($resource_id, 0, 10) . '_' . $i + ]; + $i++; } } } |