Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F390683
smarty_internal_cacher_inlinecode.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
smarty_internal_cacher_inlinecode.php
View Options
<?php
/**
* Smarty Internal Plugin Cacher InlineCode
*
* Process nocached code.
* Version to inject nocache code directly into cache file
* if caching is disabled at render time the code is being evaluated
*
* @package Smarty
* @subpackage Cacher
* @author Uwe Tews
*/
/**
* Smarty Internal Plugin Cacher InlineCode Class
*/
class
Smarty_Internal_Cacher_InlineCode
{
function
__construct
(
$smarty
)
{
$this
->
smarty
=
$smarty
;
}
/**
* Inject inline code for nocache template sections
*
* This method gets the content of each template element from the parser.
* If the content is compiled code and it should be not cached the code is injected
* into the rendered output.
*
* @param string $content content of template element
* @param object $compiler intance of compiler class
* @param boolean $tag_nocache true if the parser detected a nocache situation
* @param boolean $is_code true if content is compiled code
* @return string content
*/
public
function
processNocacheCode
(
$content
,
$compiler
,
$is_code
)
{
// If the template is not evaluated and we have a nocache section and or a nocache tag
if
(
$is_code
)
{
// generate replacement code
if
((!
$compiler
->
template
->
isEvaluated
()
||
$compiler
->
template
->
forceNocache
)
&&
$compiler
->
template
->
caching
&&
(
$compiler
->
nocache
||
$compiler
->
tag_nocache
))
{
$compiler
->
tag_nocache
=
false
;
$_output
=
str_replace
(
"'"
,
"
\'
"
,
$content
);
$_output
=
'<?php echo
\'
'
.
$_output
.
'
\'
;?>'
;
}
else
{
$_output
=
$content
;
}
}
else
{
$_output
=
$content
;
}
// if compiled code shall be grabbed
if
(
$compiler
->
template
->
extract_code
==
false
)
{
// return output
return
$_output
;
}
else
{
// store code in extract buffer
$compiler
->
template
->
extracted_compiled_code
.=
$_output
;
return
''
;
}
}
/**
* Initialize cacher
*
* Is a noop in current implementation
*
* @param object $compiler intance of compiler class
*/
public
function
initCacher
(
$compiler
)
{
return
;
}
/**
* Close cacher
*
* Hook to perform any post processing on the final compiled template
* Is a noop in current implementation
*
* @param object $compiler intance of compiler class
* @param string $template_code complete compiled template
* @return string compiled template output
*/
public
function
closeCacher
(
$compiler
,
$template_code
)
{
return
$template_code
;
}
}
?>
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Feb 22, 15:27 (1 h, 47 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25600
Default Alt Text
smarty_internal_cacher_inlinecode.php (2 KB)
Attached To
rZEDHG ZedLegacy
Event Timeline
Log In to Comment