Minor changes
This commit is contained in:
parent
7e9be455a4
commit
bc3a108578
@ -241,7 +241,7 @@ function install($adminPassword, $email)
|
||||
'description'=>'Welcome to Bludit',
|
||||
'username'=>'admin',
|
||||
'status'=>'published',
|
||||
'tags'=>'bludit, cms, flat-file',
|
||||
'tags'=>'bludit,cms,flat-file',
|
||||
'allowComments'=>false,
|
||||
'date'=>$currentDate
|
||||
)
|
||||
|
@ -87,7 +87,7 @@ class dbLanguage extends dbJSON
|
||||
// Returns an array with all dictionaries.
|
||||
public function getLanguageList()
|
||||
{
|
||||
$files = glob(PATH_LANGUAGES.'*.json');
|
||||
$files = Filesystem::listFiles(PATH_LANGUAGES, '*', 'json');
|
||||
|
||||
$tmp = array();
|
||||
|
||||
|
@ -301,7 +301,8 @@ class dbPages extends dbJSON
|
||||
$fields['status'] = CLI_STATUS;
|
||||
$fields['date'] = Date::current(DB_DATE_FORMAT);
|
||||
|
||||
$tmpPaths = glob(PATH_PAGES.'*', GLOB_ONLYDIR);
|
||||
//$tmpPaths = glob(PATH_PAGES.'*', GLOB_ONLYDIR);
|
||||
$tmpPaths = Filesystem::listDirectories(PATH_PAGES);
|
||||
foreach($tmpPaths as $directory)
|
||||
{
|
||||
$key = basename($directory);
|
||||
@ -312,7 +313,8 @@ class dbPages extends dbJSON
|
||||
}
|
||||
|
||||
// Recovery pages from subdirectories
|
||||
$subPaths = glob($directory.DS.'*', GLOB_ONLYDIR);
|
||||
//$subPaths = glob($directory.DS.'*', GLOB_ONLYDIR);
|
||||
$subPaths = Filesystem::listDirectories($directory.DS);
|
||||
foreach($subPaths as $subDirectory)
|
||||
{
|
||||
$subKey = basename($subDirectory);
|
||||
|
@ -370,7 +370,8 @@ class dbPosts extends dbJSON
|
||||
$fields['date'] = Date::current(DB_DATE_FORMAT);
|
||||
|
||||
// Recovery pages from the first level of directories
|
||||
$tmpPaths = glob(PATH_POSTS.'*', GLOB_ONLYDIR);
|
||||
//$tmpPaths = glob(PATH_POSTS.'*', GLOB_ONLYDIR);
|
||||
$tmpPaths = Filesystem::listDirectories(PATH_POSTS);
|
||||
foreach($tmpPaths as $directory)
|
||||
{
|
||||
$key = basename($directory);
|
||||
|
@ -5,7 +5,24 @@ class Filesystem {
|
||||
// NEW
|
||||
public static function listDirectories($path, $regex='*')
|
||||
{
|
||||
return glob($path.$regex, GLOB_ONLYDIR);
|
||||
$directories = glob($path.$regex, GLOB_ONLYDIR);
|
||||
|
||||
if(empty($directories)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
return $directories;
|
||||
}
|
||||
|
||||
public static function listFiles($path, $regex='*', $extension)
|
||||
{
|
||||
$files = glob($path.$regex.'.'.$extension);
|
||||
|
||||
if(empty($files)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
public static function mkdir($pathname, $recursive=false)
|
||||
|
@ -141,7 +141,8 @@ class Page extends fileContent
|
||||
public function children()
|
||||
{
|
||||
$tmp = array();
|
||||
$paths = glob(PATH_PAGES.$this->getField('key').DS.'*', GLOB_ONLYDIR);
|
||||
//$paths = glob(PATH_PAGES.$this->getField('key').DS.'*', GLOB_ONLYDIR);
|
||||
$paths = Filesystem::listDirectories(PATH_PAGES.$this->getField('key').DS);
|
||||
foreach($paths as $path) {
|
||||
array_push($tmp, basename($path));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user