corrected note typos and changed trigger_errors error LEVEL
back to Warning as before, which still is halted by the smarty error handler
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<?php // (experimental) serendipity_smarty_class.inc.php 2011-12-05 13:09 Ian
|
||||
<?php // (experimental) serendipity_smarty_class.inc.php 2011-12-25 15:19 Ian
|
||||
|
||||
// define secure_dir and trusted_dirs for Serendipity_Smarty_Security_Policy class.
|
||||
@define('S9Y_TEMPLATE_FALLBACK', $serendipity['serendipityPath'] . $serendipity['templatePath'] . 'default');
|
||||
@@ -45,7 +45,7 @@ class Serendipity_Smarty_Security_Policy extends Smarty_Security
|
||||
return true;
|
||||
}
|
||||
|
||||
static public function test()
|
||||
public static function test()
|
||||
{
|
||||
var_dump(get_called_class());
|
||||
}
|
||||
@@ -104,18 +104,18 @@ class Serendipity_Smarty extends Smarty
|
||||
global $serendipity;
|
||||
|
||||
// some documentary from the smarty forum
|
||||
/*********************************************************
|
||||
* Adressing a specific $template_dir (see 3.1 release notes)
|
||||
*
|
||||
* Smarty 3.1 introduces the $template_dir index notation.
|
||||
* $smarty->fetch('[foo]bar.tpl') and {include file="[foo]bar.tpl"} require the template bar.tpl to be loaded from $template_dir['foo'];
|
||||
* Smarty::setTemplateDir() and Smarty::addTemplateDir() offer ways to define indexes along with the actual directories.
|
||||
**/
|
||||
/*
|
||||
Adressing a specific $template_dir (see 3.1 release notes)
|
||||
|
||||
Smarty 3.1 introduces the $template_dir index notation.
|
||||
$smarty->fetch('[foo]bar.tpl') and {include file="[foo]bar.tpl"} require the template bar.tpl to be loaded from $template_dir['foo'];
|
||||
Smarty::setTemplateDir() and Smarty::addTemplateDir() offer ways to define indexes along with the actual directories.
|
||||
*/
|
||||
|
||||
/*****************************
|
||||
* Set all directory setters
|
||||
* Smarty will always use the first template found in order of the given array. Move the least significant directory to the end.
|
||||
****************************/
|
||||
/* +++++++++++++++++++++++++++++++++++++++++++
|
||||
Set all directory setters
|
||||
Smarty will always use the first template found in order of the given array. Move the least significant directory to the end.
|
||||
*/
|
||||
|
||||
// initiate templateDir setter
|
||||
$this->setTemplateDir(array(S9Y_TEMPLATE_USERDEFAULT));
|
||||
@@ -162,9 +162,9 @@ class Serendipity_Smarty extends Smarty
|
||||
Note: rodneyrehm - From within the Smarty class context you can safely access properties like Smarty::$use_sub_dirs directly.
|
||||
*/
|
||||
|
||||
/************************************
|
||||
* Set Smarty caching
|
||||
***********************************/
|
||||
/* +++++++++++++++++++++++++++++++++++
|
||||
Set Smarty caching
|
||||
*/
|
||||
|
||||
/*
|
||||
Caching is disabled, as long as we haven't figured out on how to use it best here....
|
||||
@@ -195,26 +195,27 @@ class Serendipity_Smarty extends Smarty
|
||||
*/
|
||||
|
||||
// some documentary from the smarty forum
|
||||
/*********************************************************
|
||||
* With Smarty::CACHING_LIFETIME_SAVED the expiration date is written into the cached file.
|
||||
* So each cache_id / compile_id combination may have their own cache lifetime.
|
||||
* The point is simply, that once the cache lifetime (expiration date) has been saved to the cache file,
|
||||
* it cannot be altered except for clearing and regenerating said cache file
|
||||
*
|
||||
* Template Inheritance
|
||||
* Using is_cached() on sub-templates has to set up caching before is_cached() calls,
|
||||
* e.g if (!$smarty->isCached('sub_test.tpl')) { $smarty->assign('foo', $foo); }.
|
||||
* The subtemplate will always be cached as specified in the {include} tag.
|
||||
* Otherwise you could never cache a subtemplate with caching disabled for the main template.
|
||||
* If you don't want to have the main template cached, turn caching off again after the is_cached() calls for the subtemplate.
|
||||
* So the example will cache sub_test.tpl, but not test.tpl
|
||||
* Using is_cached() on subtemplates has to set up caching before is_cached() calls.
|
||||
* The subtemplate will always be cached as specified in the {include} tag. Otherwise you could never cache a subtemplate with caching disabled for the main template.
|
||||
* If you don't want to have the main template cached, turn caching off again after the is_cached() calls for the subtemplate.
|
||||
* So the example will cache sub_test.tpl but not test.tpl
|
||||
* Use $smarty->caching = Smarty::CACHING_LIFETIME_SAVED; with {include file="sub_test.tpl" cache_lifetime="120"} in test.tpl;
|
||||
* Use $smarty->caching = Smarty::CACHING_LIFETIME_CURRENT; with {include .... caching}
|
||||
**/
|
||||
/*
|
||||
With Smarty::CACHING_LIFETIME_SAVED the expiration date is written into the cached file.
|
||||
So each cache_id / compile_id combination may have their own cache lifetime.
|
||||
The point is simply, that once the cache lifetime (expiration date) has been saved to the cache file,
|
||||
it cannot be altered except for clearing and regenerating said cache file
|
||||
|
||||
Template Inheritance
|
||||
Using is_cached() on sub-templates has to set up caching before is_cached() calls,
|
||||
e.g if (!$smarty->isCached('sub_test.tpl')) { $smarty->assign('foo', $foo); }.
|
||||
The subtemplate will always be cached as specified in the {include} tag.
|
||||
Otherwise you could never cache a subtemplate with caching disabled for the main template.
|
||||
If you don't want to have the main template cached, turn caching off again after the is_cached() calls for the subtemplate.
|
||||
So the example will cache sub_test.tpl, but not test.tpl
|
||||
Using is_cached() on subtemplates has to set up caching before is_cached() calls.
|
||||
The subtemplate will always be cached as specified in the {include} tag.
|
||||
Otherwise you could never cache a subtemplate with caching disabled for the main template.
|
||||
If you don't want to have the main template cached, turn caching off again after the is_cached() calls for the subtemplate.
|
||||
So the example will cache sub_test.tpl but not test.tpl
|
||||
Use $smarty->caching = Smarty::CACHING_LIFETIME_SAVED; with {include file="sub_test.tpl" cache_lifetime="120"} in test.tpl;
|
||||
Use $smarty->caching = Smarty::CACHING_LIFETIME_CURRENT; with {include .... caching}
|
||||
*/
|
||||
|
||||
#cache# $this->caching = Smarty::CACHING_LIFETIME_CURRENT; // $this->setCaching(2); // 1 will change the end of lifetime immediately.
|
||||
# $this->caching = Smarty::CACHING_LIFETIME_SAVED; // $this->setCaching(Smarty::CACHING_LIFETIME_SAVED);
|
||||
@@ -233,15 +234,15 @@ class Serendipity_Smarty extends Smarty
|
||||
// set the cache_lifetime for index.tpl to 5 minutes
|
||||
#cache# $this->cache_lifetime = 300; // $this->setCacheLifetime(300); // 86400; // one day: 60*60*24
|
||||
|
||||
// some documentary from the smarty forum
|
||||
/*********************************************************
|
||||
* Smarty caching is based purely on the fetch() or display() call. So:
|
||||
* $smarty->fetch('application.tpl');
|
||||
* Will generate a cached output and use that on repeated calls. If you have multiple versions of this call, you need to pass a cache_id. Example:
|
||||
* $cache_id = md5($_SERVER['REQUEST_URI']);
|
||||
* $smarty->fetch('application.tpl',$cache_id);
|
||||
* It is entirely up to you what is taken into account for the cache_id (URL, etc.)
|
||||
**/
|
||||
// some documentary from the smarty forum
|
||||
/*
|
||||
Smarty caching is based purely on the fetch() or display() call. So:
|
||||
$smarty->fetch('application.tpl');
|
||||
Will generate a cached output and use that on repeated calls. If you have multiple versions of this call, you need to pass a cache_id. Example:
|
||||
$cache_id = md5($_SERVER['REQUEST_URI']);
|
||||
$smarty->fetch('application.tpl',$cache_id);
|
||||
It is entirely up to you what is taken into account for the cache_id (URL, etc.)
|
||||
*/
|
||||
|
||||
// does this mean $this->setCacheId($id); is useless here and has to be set where the actual templates are called? or does ist work as something default?
|
||||
/*
|
||||
@@ -254,12 +255,12 @@ class Serendipity_Smarty extends Smarty
|
||||
*/
|
||||
|
||||
// some documentary from the smarty forum
|
||||
/*********************************************************
|
||||
* Smarty will use the cache_id for distributing the cache files into sub_dirs
|
||||
* A cache id is used if you cache different output generated by the same template as for example on a product page.
|
||||
* In such a case you should use a product id as cache id.
|
||||
* $this->cache_id($id); // $this->setCacheId($id);
|
||||
**/
|
||||
/*
|
||||
Smarty will use the cache_id for distributing the cache files into sub_dirs
|
||||
A cache id is used if you cache different output generated by the same template as for example on a product page.
|
||||
In such a case you should use a product id as cache id.
|
||||
$this->cache_id($id); // $this->setCacheId($id);
|
||||
*/
|
||||
|
||||
#cache# $this->cache_id = md5($_SERVER['REQUEST_URI']); // this isn't a good idea either, better have it disabled or use a special id
|
||||
/*
|
||||
@@ -268,9 +269,9 @@ class Serendipity_Smarty extends Smarty
|
||||
- see Rodneys first caching note
|
||||
*/
|
||||
|
||||
/************************************************
|
||||
* Set all other needed Smarty class properties
|
||||
***********************************************/
|
||||
/* ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
Set all other needed Smarty class properties
|
||||
*/
|
||||
|
||||
#???# $this->merge_compiled_includes = true; // $this->setMergeCompiledIncludes(true); // what is this for?
|
||||
|
||||
@@ -366,7 +367,7 @@ class Serendipity_Smarty extends Smarty
|
||||
$this->assignByRef($tpl_var, $value);
|
||||
}
|
||||
|
||||
static public function test()
|
||||
public static function test()
|
||||
{
|
||||
var_dump(get_called_class());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user