diff options
Diffstat (limited to 'vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php')
-rw-r--r-- | vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php index 0abed2124..64912599f 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php @@ -1,5 +1,4 @@ <?php - /** * Smarty Method CompileAllTemplates * @@ -31,7 +30,10 @@ class Smarty_Internal_Method_CompileAllTemplates * * @return integer number of template files recompiled */ - public function compileAllTemplates(Smarty $smarty, $extension = '.tpl', $force_compile = false, $time_limit = 0, + public function compileAllTemplates(Smarty $smarty, + $extension = '.tpl', + $force_compile = false, + $time_limit = 0, $max_errors = null) { return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors); @@ -49,7 +51,11 @@ class Smarty_Internal_Method_CompileAllTemplates * * @return int number of template files compiled */ - protected function compileAll(Smarty $smarty, $extension, $force_compile, $time_limit, $max_errors, + protected function compileAll(Smarty $smarty, + $extension, + $force_compile, + $time_limit, + $max_errors, $isConfig = false) { // switch off time limit @@ -66,20 +72,20 @@ class Smarty_Internal_Method_CompileAllTemplates $_dir_2 = new RecursiveIteratorIterator($_dir_1); foreach ($_dir_2 as $_fileinfo) { $_file = $_fileinfo->getFilename(); - if (substr(basename($_fileinfo->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) { + if (substr(basename($_fileinfo->getPathname()), 0, 1) === '.' || strpos($_file, '.svn') !== false) { continue; } - if (!substr_compare($_file, $extension, - strlen($extension)) == 0) { + if (!substr_compare($_file, $extension, -strlen($extension)) === 0) { continue; } - if ($_fileinfo->getPath() !== substr($_dir, 0, - 1)) { - $_file = substr($_fileinfo->getPath(), strlen($_dir)) . $smarty->ds . $_file; + if ($_fileinfo->getPath() !== substr($_dir, 0, -1)) { + $_file = substr($_fileinfo->getPath(), strlen($_dir)) . DIRECTORY_SEPARATOR . $_file; } echo "\n<br>", $_dir, '---', $_file; flush(); $_start_time = microtime(true); $_smarty = clone $smarty; - // + // $_smarty->_cache = array(); $_smarty->ext = new Smarty_Internal_Extension_Handler(); $_smarty->ext->objType = $_smarty->_objType; @@ -92,7 +98,7 @@ class Smarty_Internal_Method_CompileAllTemplates $isConfig ? Smarty_Template_Config::load($_tpl) : Smarty_Template_Source::load($_tpl); if ($_tpl->mustCompile()) { $_tpl->compileTemplateSource(); - $_count ++; + $_count++; echo ' compiled in ', microtime(true) - $_start_time, ' seconds'; flush(); } else { @@ -102,14 +108,14 @@ class Smarty_Internal_Method_CompileAllTemplates } catch (Exception $e) { echo "\n<br> ------>Error: ", $e->getMessage(), "<br><br>\n"; - $_error_count ++; + $_error_count++; } // free memory unset($_tpl); $_smarty->_clearTemplateCache(); - if ($max_errors !== null && $_error_count == $max_errors) { + if ($max_errors !== null && $_error_count === $max_errors) { echo "\n<br><br>too many errors\n"; - exit(); + exit(1); } } } |