Skip to content

Commit

Permalink
Merge pull request #13 from BafS/dev
Browse files Browse the repository at this point in the history
Ready for version 0.6.0
  • Loading branch information
BafS committed Mar 6, 2016
2 parents a00198d + 07a573c commit 3e5cda6
Show file tree
Hide file tree
Showing 40 changed files with 954 additions and 991 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ Thumbs.db
*.paw
*.phar
*.exe
doc/

# Jekyll
_site
.sass-cache
.jekyll-metadata
/api/*

# Npm
node_modules/

137 changes: 0 additions & 137 deletions Parvula/Core/Container.php

This file was deleted.

14 changes: 14 additions & 0 deletions Parvula/Core/FilesSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public function isDir($dirname) {
* @param callable ($fn) Apply function to file data (\SplFileInfo $file, string $data)
* @param boolean ($eval) Evaluate PHP
* @throws IOException If the file does not exists
* @throws IOException If the file is empty
* @return mixed File data
*/
public function read($filename, callable $fn = null, $eval = false) {
Expand All @@ -72,6 +73,9 @@ public function read($filename, callable $fn = null, $eval = false) {
$data = ob_get_clean();
} else {
$file = $fileInfo->openFile('r');
if ($file->getSize() === 0) {
throw new IOException("File `{$filename}` is empty");
}
$data = $file->fread($file->getSize());
}
}
Expand Down Expand Up @@ -204,6 +208,16 @@ public function index($dir = '', callable $fn = null, $filter = null) {
return $this->indexAll($dir, $fn, $filter);
}

/**
* Get file modification time
*
* @param string $filename
* @return int Timestamp
*/
public function modificationTime($filename = '') {
return filemtime($this->workingDirectory . $filename);
}

/**
* Get working directory
*
Expand Down
22 changes: 22 additions & 0 deletions Parvula/Core/Model/Mapper/Pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,28 @@ public function visibility($visible) {
});
}

/**
* Show pages without a parent (the 'root' pages)
*
* @return Pages
*/
public function withoutParent() {
return $this->filter(function (Page $page) {
return (bool) !$page->get('parent');
});
}

/**
* Show pages with a parent (the children pages)
*
* @return Pages
*/
public function withParent() {
return $this->filter(function (Page $page) {
return (bool) $page->get('parent');
});
}

/**
* Filter pages
*
Expand Down
Loading

0 comments on commit 3e5cda6

Please sign in to comment.