silverstripe-docsviewer/code/DocumentationManifestFileFi...

39 lines
857 B
PHP
Raw Permalink Normal View History

<?php
2015-11-21 07:25:41 +01:00
class DocumentationManifestFileFinder extends SS_FileFinder
{
/**
* @var array
*/
private static $ignored_files = array(
'.', '..', '.ds_store',
'.svn', '.git', 'assets', 'themes', '_images'
);
2015-11-21 07:25:41 +01:00
/**
* @var array
*/
protected static $default_options = array(
'name_regex' => '/\.(md|markdown)$/i',
'file_callback' => null,
'dir_callback' => null,
'ignore_vcs' => true
);
2015-11-21 07:25:41 +01:00
/**
2017-08-08 05:50:24 +02:00
*
2015-11-21 07:25:41 +01:00
*/
public function acceptDir($basename, $pathname, $depth)
{
$ignored = Config::inst()->get('DocumentationManifestFileFinder', 'ignored_files');
2015-11-21 07:25:41 +01:00
if ($ignored) {
if (in_array(strtolower($basename), $ignored)) {
return false;
}
}
2015-11-21 07:25:41 +01:00
return true;
}
}