mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 03:44:26 +02:00
- change of utility->compileAllTemplates() log messages
- bugfix on nocache code in {function} tags
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
25/03/2010
|
||||
- change of utility->compileAllTemplates() log messages
|
||||
- bugfix on nocache code in {function} tags
|
||||
|
||||
24/03/2010
|
||||
- bugfix on register->modifier() error messages
|
||||
|
||||
|
@@ -37,7 +37,7 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase {
|
||||
// make function known for recursive calls
|
||||
$this->compiler->smarty->template_functions[$_name]['compiled'] = '';
|
||||
// Init temporay context
|
||||
$compiler->template->required_plugins = array('compiled' => array(), 'cache' => array());
|
||||
$compiler->template->required_plugins = array('compiled' => array(), 'nocache' => array());
|
||||
$compiler->template->extract_code = true;
|
||||
$compiler->template->extracted_compiled_code = '';
|
||||
$compiler->template->has_nocache_code = false;
|
||||
@@ -75,11 +75,11 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
|
||||
}
|
||||
$plugins_string .= '?>';
|
||||
}
|
||||
if (!empty($compiler->template->required_plugins['cache'])) {
|
||||
if (!empty($compiler->template->required_plugins['nocache'])) {
|
||||
$plugins_string .= "<?php echo '/*%%SmartyNocache:{$compiler->template->properties['nocache_hash']}%%*/<?php ";
|
||||
foreach($compiler->template->required_plugins['nocache'] as $tmp) {
|
||||
foreach($tmp as $data) {
|
||||
$plugins_string .= "if (!is_callable('{$data['function']}')) include '{$data['file']}';\n";
|
||||
$plugins_string .= "if (!is_callable(\'{$data['function']}\')) include \'{$data['file']}\';\n";
|
||||
}
|
||||
}
|
||||
$plugins_string .= "?>/*/%%SmartyNocache:{$compiler->template->properties['nocache_hash']}%%*/';?>\n";
|
||||
|
@@ -1,42 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Project: Smarty: the PHP compiling template engine
|
||||
* File: smarty_internal_utility.php
|
||||
* SVN: $Id: $
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* For questions, help, comments, discussion, etc., please join the
|
||||
* Smarty mailing list. Send a blank e-mail to
|
||||
* smarty-discussion-subscribe@googlegroups.com
|
||||
*
|
||||
* @link http://www.smarty.net/
|
||||
* @copyright 2008 New Digital Group, Inc.
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author Uwe Tews
|
||||
* @package Smarty
|
||||
* @subpackage PluginsInternal
|
||||
* @version 3-SVN$Rev: 3286 $
|
||||
*/
|
||||
* Project: Smarty: the PHP compiling template engine
|
||||
* File: smarty_internal_utility.php
|
||||
* SVN: $Id: $
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* For questions, help, comments, discussion, etc., please join the
|
||||
* Smarty mailing list. Send a blank e-mail to
|
||||
* smarty-discussion-subscribe@googlegroups.com
|
||||
*
|
||||
* @link http://www.smarty.net/
|
||||
* @copyright 2008 New Digital Group, Inc.
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author Uwe Tews
|
||||
* @package Smarty
|
||||
* @subpackage PluginsInternal
|
||||
* @version 3-SVN$Rev: 3286 $
|
||||
*/
|
||||
|
||||
class Smarty_Internal_Utility {
|
||||
|
||||
protected $smarty;
|
||||
|
||||
function __construct($smarty) {
|
||||
function __construct($smarty)
|
||||
{
|
||||
$this->smarty = $smarty;
|
||||
}
|
||||
|
||||
@@ -82,13 +82,19 @@ class Smarty_Internal_Utility {
|
||||
$_start_time = _get_time();
|
||||
try {
|
||||
$_tpl = $this->smarty->createTemplate($_template_file);
|
||||
$_tpl->getCompiledTemplate();
|
||||
if ($_tpl->mustCompile()) {
|
||||
$_tpl->compileTemplateSource();
|
||||
echo ' compiled in ', _get_time() - $_start_time, ' seconds';
|
||||
flush();
|
||||
} else {
|
||||
echo ' is up to date';
|
||||
flush();
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo 'Error: ', $e->getMessage(), "<br><br>";
|
||||
$_error_count++;
|
||||
}
|
||||
echo ' done in ', _get_time() - $_start_time, ' seconds';
|
||||
if ($max_errors !== null && $_error_count == $max_errors) {
|
||||
echo '<br><br>too many errors';
|
||||
exit();
|
||||
@@ -108,7 +114,7 @@ class Smarty_Internal_Utility {
|
||||
*/
|
||||
function clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null)
|
||||
{
|
||||
$_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!','_',$compile_id) : null;
|
||||
$_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
|
||||
$_dir_sep = $this->smarty->use_sub_dirs ? DS : '^';
|
||||
if (isset($resource_name)) {
|
||||
$_resource_part_1 = $resource_name . '.php';
|
||||
@@ -215,5 +221,4 @@ class Smarty_Internal_Utility {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user