Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/kernel/nparser/compiler.php
Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Line(s) | |||||
*/ | */ | ||||
function FindTemplateFiles($folder_path, $options) | function FindTemplateFiles($folder_path, $options) | ||||
{ | { | ||||
// if FULL_PATH = "/" ensure, that all "/" in $folderPath are not deleted | // if FULL_PATH = "/" ensure, that all "/" in $folderPath are not deleted | ||||
$reg_exp = '/^' . preg_quote(FULL_PATH, '/') . '/'; | $reg_exp = '/^' . preg_quote(FULL_PATH, '/') . '/'; | ||||
$folder_path = preg_replace($reg_exp, '', $folder_path, 1); // this make sense, since $folderPath may NOT contain FULL_PATH | $folder_path = preg_replace($reg_exp, '', $folder_path, 1); // this make sense, since $folderPath may NOT contain FULL_PATH | ||||
$iterator = new DirectoryIterator(FULL_PATH . $folder_path); | $iterator = new DirectoryIterator(FULL_PATH . $folder_path); | ||||
/* @var $file_info DirectoryIterator */ | /** @var DirectoryIterator $file_info */ | ||||
foreach ($iterator as $file_info) { | foreach ($iterator as $file_info) { | ||||
$filename = $file_info->getFilename(); | $filename = $file_info->getFilename(); | ||||
$full_path = $file_info->getPathname(); | $full_path = $file_info->getPathname(); | ||||
if ( $file_info->isDir() && !$file_info->isDot() && $filename != '.svn' && $filename != 'CVS' ) { | if ( $file_info->isDir() && !$file_info->isDot() && $filename != '.svn' && $filename != 'CVS' ) { | ||||
$this->FindTemplateFiles($full_path, $options); | $this->FindTemplateFiles($full_path, $options); | ||||
} | } | ||||
elseif ( pathinfo($full_path, PATHINFO_EXTENSION) == 'tpl' ) { | elseif ( pathinfo($full_path, PATHINFO_EXTENSION) == 'tpl' ) { | ||||
$this->Templates[] = Array ( | $this->Templates[] = Array ( | ||||
'module' => mb_strtolower( $options['Name'] ), | 'module' => mb_strtolower( $options['Name'] ), | ||||
'path' => str_replace(FULL_PATH . $options['Path'] . '/', '', preg_replace('/\.tpl$/', '', $full_path)) | 'path' => str_replace(FULL_PATH . $options['Path'] . '/', '', preg_replace('/\.tpl$/', '', $full_path)) | ||||
); | ); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
No newline at end of file | No newline at end of file |