Limezy It's slightly more complicated to document and understand, but in the end if makes more sense than having two contradictory settings in the config file.
Actually, it's not too complicated and isn't necessarily contradictory. My only point was that as soon as dirs_include
gets populated, it will already exclude all dirs except the ones specified. Therefore, it's unlikely anyone will need to use both. However, there are cases when both can be used, for example:
'files_include' => '/\.jpe?g$/i', // only show JPG image files
'files_exclude' => '/\(^\.|hidden)/i', // exclude JPG images that start with .dot or contain "hidden"
The rules will run in order 1.files_include
2.files_exclude
, and it's entirely fine to combine both. files_include
will narrow down the matches, while files_exclude
could potentially narrow down matches further. It just needs to be clear to the user that as soon as files_include
is populated, files will be excluded by default, unless they match the include regex. In most cases, the user will only use one or the other.
Options dirs_include
dirs_exclude
files_include
files_include
should be able to cover any requirement.
Limezy return array (
'dirs_filters' => array(
'Dir1/To/Be/Included' => true,
I would really prefer to avoid complex array options, especially when the same can already be achieved, even when there are no common patterns in dirs to include or exclude.
'dirs_include' => '/Dir1\/To\/Be\/Included|Dir2\/To\/Be\/Included/',
'dirs_exclude' => '/Dir1\/To\/Be\/Excluded|Dir2\/To\/Be\/Excluded/',
Now, the above would not be logical of course, and unlikely you would use both. However, there are many example of combining both include and exclude. For example:
'dirs_include' => '/Dir1\/subdir|Dir2\/subdir/', // only include two dirs
'dirs_exclude' => '/\/secret|\/\_|\/username/', // additionally, exclude dirs that contain 'secret' or start with _underscore or contain 'username'
If we really need more advanced per-dir include/exclude, this would perhaps instead be part of future CMS-like capabilities when/if I decide to store optional config options per dir. In that case, each dir would have a config that could contain options like "hidden", possibly on a per-user basis. Just theory for now ...
Thanks for contributing!