mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
43b6d42719
This major update changes the behaviour of the docviewer module to use a cached manifest rather than on demand. This allows us to simplify the URL matching and store 'nice' URL configuration rather than altering handleAction().
38 lines
719 B
PHP
38 lines
719 B
PHP
<?php
|
|
|
|
class DocumentationManifestFileFinder extends SS_FileFinder {
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
private static $ignored_files = array(
|
|
'.', '..', '.ds_store',
|
|
'.svn', '.git', 'assets', 'themes', '_images'
|
|
);
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
protected static $default_options = array(
|
|
'name_regex' => '/\.(md|markdown)$/i',
|
|
'file_callback' => null,
|
|
'dir_callback' => null,
|
|
'ignore_vcs' => true
|
|
);
|
|
|
|
/**
|
|
*
|
|
*/
|
|
public function acceptDir($basename, $pathname, $depth) {
|
|
$ignored = Config::inst()->get('DocumentationManifestFileFinder', 'ignored_files');
|
|
|
|
if($ignored) {
|
|
if(in_array(strtolower($basename), $ignored)) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
} |