protected function xautoload_RecursiveScan::_validCand in X Autoload 7
1 call to xautoload_RecursiveScan::_validCand()
File
- lib/
RecursiveScan.php, line 57
Class
- xautoload_RecursiveScan
- Scan directories for wildcard files[] instructions in a module's info file.
Code
protected function _validCand($candidate, $b) {
if ($candidate == '.' || $candidate == '..') {
return FALSE;
}
if (strpos($candidate, '*') !== FALSE) {
return FALSE;
}
if ($b == '*' || $b == '**') {
return TRUE;
}
// More complex wildcard string.
$fragments = array();
foreach (explode('*', $b) as $fragment) {
$fragments[] = preg_quote($fragment);
}
$regex = implode('.*', $fragments);
return preg_match("/^{$regex}\$/", $candidate);
}