change variable names in fetch() fuction to smarty_* to avoid namespace conflicts

This commit is contained in:
mohrt
2001-11-30 23:09:48 +00:00
parent 91eb23a9f0
commit cab5582983
3 changed files with 47 additions and 47 deletions

2
NEWS
View File

@@ -21,7 +21,7 @@
- fixed bug with clear_cache introduced in 1.4.6, third parameter should - fixed bug with clear_cache introduced in 1.4.6, third parameter should
default to null. (Monte) default to null. (Monte)
- updated Config_File class to support '\' path separator in OS/2. (Monte, - updated Config_File class to support '\' path separator in OS/2. (Monte,
Francesco Ciprianii) Francesco Cipriani)
- removed secure_ext setting (not used). (Monte) - removed secure_ext setting (not used). (Monte)
- made cache reading process more efficient. (Monte) - made cache reading process more efficient. (Monte)
- fixed bug, is_cached() now supports new 1.4.6 caching behavior. (Monte) - fixed bug, is_cached() now supports new 1.4.6 caching behavior. (Monte)

View File

@@ -497,7 +497,7 @@ class Smarty
Function: fetch() Function: fetch()
Purpose: executes & returns or displays the template results Purpose: executes & returns or displays the template results
\*======================================================================*/ \*======================================================================*/
function fetch($tpl_file, $cache_id = null, $compile_id = null, $display = false) function fetch($smarty_tpl_file, $smarty_cache_id = null, $smarty_compile_id = null, $smarty_display = false)
{ {
global $HTTP_SERVER_VARS, $QUERY_STRING, $HTTP_COOKIE_VARS; global $HTTP_SERVER_VARS, $QUERY_STRING, $HTTP_COOKIE_VARS;
@@ -510,25 +510,25 @@ class Smarty
// capture time for debugging info // capture time for debugging info
$debug_start_time = $this->_get_microtime(); $debug_start_time = $this->_get_microtime();
$this->_smarty_debug_info[] = array('type' => 'template', $this->_smarty_debug_info[] = array('type' => 'template',
'filename' => $tpl_file, 'filename' => $smarty_tpl_file,
'depth' => 0); 'depth' => 0);
$included_tpls_idx = count($this->_smarty_debug_info) - 1; $included_tpls_idx = count($this->_smarty_debug_info) - 1;
} }
$this->_compile_id = $compile_id; $this->_compile_id = $smarty_compile_id;
$this->_inclusion_depth = 0; $this->_inclusion_depth = 0;
if ($this->caching) { if ($this->caching) {
$this->_cache_info[] = array('template', $tpl_file); $this->_cache_info[] = array('template', $smarty_tpl_file);
if ($this->_read_cache_file($tpl_file, $cache_id, $compile_id, $results)) { if ($this->_read_cache_file($smarty_tpl_file, $smarty_cache_id, $smarty_compile_id, $smarty_results)) {
if ($this->insert_tag_check) { if ($this->insert_tag_check) {
$results = $this->_process_cached_inserts($results); $smarty_results = $this->_process_cached_inserts($smarty_results);
} }
if ($display) { if ($smarty_display) {
echo $results; echo $smarty_results;
if ($this->debugging) if ($this->debugging)
{ {
// capture time for debugging info // capture time for debugging info
@@ -538,7 +538,7 @@ class Smarty
} }
return; return;
} else { } else {
return $results; return $smarty_results;
} }
} }
} }
@@ -566,46 +566,46 @@ class Smarty
$info_header = ''; $info_header = '';
} }
$compile_path = $this->_get_compile_path($tpl_file); $compile_path = $this->_get_compile_path($smarty_tpl_file);
// if we just need to display the results, don't perform output // if we just need to display the results, don't perform output
// buffering - for speed // buffering - for speed
if ($display && !$this->caching) { if ($smarty_display && !$this->caching) {
echo $info_header; echo $info_header;
if ($this->_process_template($tpl_file, $compile_path)) if ($this->_process_template($smarty_tpl_file, $compile_path))
{ {
if ($this->show_info_include) { if ($this->show_info_include) {
echo "\n<!-- SMARTY_BEGIN: ".$tpl_file." -->\n"; echo "\n<!-- SMARTY_BEGIN: ".$smarty_tpl_file." -->\n";
} }
include($compile_path); include($compile_path);
if ($this->show_info_include) { if ($this->show_info_include) {
echo "\n<!-- SMARTY_END: ".$tpl_file." -->\n"; echo "\n<!-- SMARTY_END: ".$smarty_tpl_file." -->\n";
} }
} }
} else { } else {
ob_start(); ob_start();
echo $info_header; echo $info_header;
if ($this->_process_template($tpl_file, $compile_path)) if ($this->_process_template($smarty_tpl_file, $compile_path))
{ {
if ($this->show_info_include) { if ($this->show_info_include) {
echo "\n<!-- SMARTY_BEGIN: ".$tpl_file." -->\n"; echo "\n<!-- SMARTY_BEGIN: ".$smarty_tpl_file." -->\n";
} }
include($compile_path); include($compile_path);
if ($this->show_info_include) { if ($this->show_info_include) {
echo "\n<!-- SMARTY_END: ".$tpl_file." -->\n"; echo "\n<!-- SMARTY_END: ".$smarty_tpl_file." -->\n";
} }
} }
$results = ob_get_contents(); $smarty_results = ob_get_contents();
ob_end_clean(); ob_end_clean();
} }
if ($this->caching) { if ($this->caching) {
$this->_write_cache_file($tpl_file, $cache_id, $compile_id, $results); $this->_write_cache_file($smarty_tpl_file, $smarty_cache_id, $smarty_compile_id, $smarty_results);
$results = $this->_process_cached_inserts($results); $smarty_results = $this->_process_cached_inserts($smarty_results);
} }
if ($display) { if ($smarty_display) {
if (isset($results)) { echo $results; } if (isset($smarty_results)) { echo $smarty_results; }
if ($this->debugging) if ($this->debugging)
{ {
// capture time for debugging info // capture time for debugging info
@@ -615,7 +615,7 @@ class Smarty
} }
return; return;
} else { } else {
if (isset($results)) { return $results; } if (isset($smarty_results)) { return $smarty_results; }
} }
} }

View File

@@ -497,7 +497,7 @@ class Smarty
Function: fetch() Function: fetch()
Purpose: executes & returns or displays the template results Purpose: executes & returns or displays the template results
\*======================================================================*/ \*======================================================================*/
function fetch($tpl_file, $cache_id = null, $compile_id = null, $display = false) function fetch($smarty_tpl_file, $smarty_cache_id = null, $smarty_compile_id = null, $smarty_display = false)
{ {
global $HTTP_SERVER_VARS, $QUERY_STRING, $HTTP_COOKIE_VARS; global $HTTP_SERVER_VARS, $QUERY_STRING, $HTTP_COOKIE_VARS;
@@ -510,25 +510,25 @@ class Smarty
// capture time for debugging info // capture time for debugging info
$debug_start_time = $this->_get_microtime(); $debug_start_time = $this->_get_microtime();
$this->_smarty_debug_info[] = array('type' => 'template', $this->_smarty_debug_info[] = array('type' => 'template',
'filename' => $tpl_file, 'filename' => $smarty_tpl_file,
'depth' => 0); 'depth' => 0);
$included_tpls_idx = count($this->_smarty_debug_info) - 1; $included_tpls_idx = count($this->_smarty_debug_info) - 1;
} }
$this->_compile_id = $compile_id; $this->_compile_id = $smarty_compile_id;
$this->_inclusion_depth = 0; $this->_inclusion_depth = 0;
if ($this->caching) { if ($this->caching) {
$this->_cache_info[] = array('template', $tpl_file); $this->_cache_info[] = array('template', $smarty_tpl_file);
if ($this->_read_cache_file($tpl_file, $cache_id, $compile_id, $results)) { if ($this->_read_cache_file($smarty_tpl_file, $smarty_cache_id, $smarty_compile_id, $smarty_results)) {
if ($this->insert_tag_check) { if ($this->insert_tag_check) {
$results = $this->_process_cached_inserts($results); $smarty_results = $this->_process_cached_inserts($smarty_results);
} }
if ($display) { if ($smarty_display) {
echo $results; echo $smarty_results;
if ($this->debugging) if ($this->debugging)
{ {
// capture time for debugging info // capture time for debugging info
@@ -538,7 +538,7 @@ class Smarty
} }
return; return;
} else { } else {
return $results; return $smarty_results;
} }
} }
} }
@@ -566,46 +566,46 @@ class Smarty
$info_header = ''; $info_header = '';
} }
$compile_path = $this->_get_compile_path($tpl_file); $compile_path = $this->_get_compile_path($smarty_tpl_file);
// if we just need to display the results, don't perform output // if we just need to display the results, don't perform output
// buffering - for speed // buffering - for speed
if ($display && !$this->caching) { if ($smarty_display && !$this->caching) {
echo $info_header; echo $info_header;
if ($this->_process_template($tpl_file, $compile_path)) if ($this->_process_template($smarty_tpl_file, $compile_path))
{ {
if ($this->show_info_include) { if ($this->show_info_include) {
echo "\n<!-- SMARTY_BEGIN: ".$tpl_file." -->\n"; echo "\n<!-- SMARTY_BEGIN: ".$smarty_tpl_file." -->\n";
} }
include($compile_path); include($compile_path);
if ($this->show_info_include) { if ($this->show_info_include) {
echo "\n<!-- SMARTY_END: ".$tpl_file." -->\n"; echo "\n<!-- SMARTY_END: ".$smarty_tpl_file." -->\n";
} }
} }
} else { } else {
ob_start(); ob_start();
echo $info_header; echo $info_header;
if ($this->_process_template($tpl_file, $compile_path)) if ($this->_process_template($smarty_tpl_file, $compile_path))
{ {
if ($this->show_info_include) { if ($this->show_info_include) {
echo "\n<!-- SMARTY_BEGIN: ".$tpl_file." -->\n"; echo "\n<!-- SMARTY_BEGIN: ".$smarty_tpl_file." -->\n";
} }
include($compile_path); include($compile_path);
if ($this->show_info_include) { if ($this->show_info_include) {
echo "\n<!-- SMARTY_END: ".$tpl_file." -->\n"; echo "\n<!-- SMARTY_END: ".$smarty_tpl_file." -->\n";
} }
} }
$results = ob_get_contents(); $smarty_results = ob_get_contents();
ob_end_clean(); ob_end_clean();
} }
if ($this->caching) { if ($this->caching) {
$this->_write_cache_file($tpl_file, $cache_id, $compile_id, $results); $this->_write_cache_file($smarty_tpl_file, $smarty_cache_id, $smarty_compile_id, $smarty_results);
$results = $this->_process_cached_inserts($results); $smarty_results = $this->_process_cached_inserts($smarty_results);
} }
if ($display) { if ($smarty_display) {
if (isset($results)) { echo $results; } if (isset($smarty_results)) { echo $smarty_results; }
if ($this->debugging) if ($this->debugging)
{ {
// capture time for debugging info // capture time for debugging info
@@ -615,7 +615,7 @@ class Smarty
} }
return; return;
} else { } else {
if (isset($results)) { return $results; } if (isset($smarty_results)) { return $smarty_results; }
} }
} }