mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-04 03:18:49 +03:00
Speedup templates compiler
This commit is contained in:
parent
89740bf50f
commit
4e45b56ea4
3 changed files with 11 additions and 49 deletions
|
|
@ -131,31 +131,6 @@ class Utils
|
|||
return $sResult;
|
||||
}
|
||||
|
||||
public static function FolderFiles(string $sDir, string $sType = '') : array
|
||||
{
|
||||
$aResult = array();
|
||||
if (\is_dir($sDir))
|
||||
{
|
||||
if (false !== ($rDirHandle = \opendir($sDir)))
|
||||
{
|
||||
while (false !== ($sFile = \readdir($rDirHandle)))
|
||||
{
|
||||
if (empty($sType) || $sType === \substr($sFile, -\strlen($sType)))
|
||||
{
|
||||
if (\is_file($sDir.'/'.$sFile))
|
||||
{
|
||||
$aResult[] = $sFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
\closedir($rDirHandle);
|
||||
}
|
||||
}
|
||||
|
||||
return $aResult;
|
||||
}
|
||||
|
||||
public static function ClearHtmlOutput(string $sHtml) : string
|
||||
{
|
||||
// return $sHtml;
|
||||
|
|
@ -166,20 +141,6 @@ class Utils
|
|||
);
|
||||
}
|
||||
|
||||
public static function CompileTemplates(array &$aList, string $sDirName, string $sNameSuffix = '')
|
||||
{
|
||||
if (\file_exists($sDirName))
|
||||
{
|
||||
$aFileList = static::FolderFiles($sDirName, '.html');
|
||||
|
||||
foreach ($aFileList as $sName)
|
||||
{
|
||||
$sTemplateName = \substr($sName, 0, -5).$sNameSuffix;
|
||||
$aList[$sTemplateName] = $sDirName.'/'.$sName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $mDefault = null
|
||||
* @return mixed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue