Use AntTools::getFileList while getting page list

This commit is contained in:
Belle Aerni 2023-01-07 14:29:12 -08:00
parent 1d65fca192
commit f86b8a988b
2 changed files with 3 additions and 10 deletions

View file

@ -6,20 +6,13 @@ use AntCMS\AntCMS;
use AntCMS\AntYaml; use AntCMS\AntYaml;
use AntCMS\AntConfig; use AntCMS\AntConfig;
use AntCMS\AntCache; use AntCMS\AntCache;
use AntCMS\AntTools;
class AntPages class AntPages
{ {
public static function generatePages() public static function generatePages()
{ {
$dir = new \RecursiveDirectoryIterator(antContentPath); $pages = AntTools::getFileList(antContentPath, 'md', true);
$iterator = new \RecursiveIteratorIterator($dir);
$pages = array();
$pageList = array();
foreach ($iterator as $file) {
if (pathinfo($file, PATHINFO_EXTENSION) == "md") {
$pages[] = $file->getPathname();
}
}
foreach ($pages as $page) { foreach ($pages as $page) {
$pageContent = file_get_contents($page); $pageContent = file_get_contents($page);

View file

@ -6,7 +6,7 @@ class AntTools
{ {
public static function getFileList($dir, $extension = null, $returnPath = false) public static function getFileList($dir, $extension = null, $returnPath = false)
{ {
$dir = new \RecursiveDirectoryIterator(antThemePath); $dir = new \RecursiveDirectoryIterator($dir);
$iterator = new \RecursiveIteratorIterator($dir); $iterator = new \RecursiveIteratorIterator($dir);
$files=array(); $files=array();
foreach ($iterator as $file) { foreach ($iterator as $file) {