Skip to content

Commit

Permalink
Add ability to ignore hidden folders. Closes #57.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Sinopoli authored and Nick Sinopoli committed Aug 19, 2012
1 parent df156f5 commit d1743d5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -114,6 +114,12 @@ If you'd like to enable error sandboxing, you will have to do the following:
1. Within the `$config` array, change `sandbox_errors` to `true`. If you'd like, you can keep this set as `false`, though you will have to change the 'Sandbox Errors' option to 'Yes' on the UI if you want the errors encountered during the test run to be sandboxed.
2. Within the `$config` array, change `error_reporting` to reflect which errors you'd like to have sandboxed. See PHP's manual entry on [error_reporting](http://php.net/manual/en/function.error-reporting.php) for more information.

### Ignore Hidden Files

By default, the file selector does not display hidden folders (i.e., folders with a '.' prefix). If you'd like to display hidden folders, you will have to do the following:

1. Within the `$config` array, change `ignore_hidden_folders` to `false`.

### <a name='xml-configuration'></a>PHPUnit XML Configuration File

If you'd like to use a [PHPUnit XML configuration file](http://www.phpunit.de/manual/current/en/appendixes.configuration.html) to define which tests to run, you will have to do the following:
Expand Down
4 changes: 4 additions & 0 deletions app/config/bootstrap.php
Expand Up @@ -52,6 +52,10 @@
// http://us3.php.net/set_error_handler
'error_reporting' => E_ALL | E_STRICT,

// Whether or not to ignore hidden folders
// (i.e., folders with a '.' prefix)
'ignore_hidden_folders' => true,

// The PHPUnit XML configuration file to use
// (set to false to disable)
//
Expand Down
8 changes: 7 additions & 1 deletion app/controller/FileList.php
Expand Up @@ -23,10 +23,16 @@ public function index($request) {
return array();
}

$ignore_hidden = \app\lib\Library::retrieve('ignore_hidden_folders');

$final_dirs = array();
$final_files = array();
foreach ( $files as $file ) {
if ( $file != '.' && $file != '..' ) {
$is_hidden = ( strpos($file, '.') === 0 );
if (
$file != '.' && $file != '..'
&& (!$is_hidden || !$ignore_hidden)
) {
$path = $dir . $file;
$ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
if ( is_dir($path) ) {
Expand Down

0 comments on commit d1743d5

Please sign in to comment.