function _var_check_locale_directory in Variable API 6.2
Same name and namespace in other branches
- 7.2 vars.module \_var_check_locale_directory()
1 call to _var_check_locale_directory()
- Vars::getLibraryPath in ./
vars.module - Returns the list of the directories where library files are looked in.
File
- ./
vars.module, line 605 - Implement an API to handle persistent variables.
Code
function _var_check_locale_directory($dir, array $files) {
if (empty($dir)) {
$directory = '/';
$separator = '';
}
else {
$path = explode('/', $dir);
if (empty($path[0])) {
$directory = '/';
}
else {
$directory = './';
}
$path = preg_grep('/^\\.{0,2}$/', $path, PREG_GREP_INVERT);
if (!empty($path)) {
$directory .= implode('/', $path);
$separator = '/';
}
else {
$separator = '';
}
}
if (file_exists($directory) && is_dir($directory)) {
foreach ($files as $file) {
$filename = implode('/', preg_grep('/^\\.{0,2}$/', explode('/', $file), PREG_GREP_INVERT));
if (!file_exists("{$directory}{$separator}{$filename}")) {
return FALSE;
}
}
}
else {
return FALSE;
}
return TRUE;
}