Code: Select all
class mySmarty extends Smarty {
function __constructor {
parent::__constructor();
// local settings go here
}
}
Ian
Code: Select all
class mySmarty extends Smarty {
function __constructor {
parent::__constructor();
// local settings go here
}
}
So this has to be our way going into futureIt was not intended that the $display parameter is used by user applications.
It is an internal flag when fetch() gets called from display().
For that reason it was in Smarty2 an undocumented last parameter.
As we have in Smarty3 a new additional public parameter $parent the hidden $display moved by one position.
We will not change Smarty3 parameter ordering. You could implement a wrapper by extending the Smarty class for example like this:
Code:Code: Select all
MySmarty extends Smarty { public function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false) { parent::fetch($resource_name, $cache_id, $compile_id, null, $display); } }
Code: Select all
// Default Smarty Engine will be used
@define('SMARTY_DIR', S9Y_PEAR_PATH . 'Smarty/libs/');
if (!class_exists('Smarty')) {
include SMARTY_DIR . 'Smarty.class.php';
}
if (!class_exists('Smarty')) {
return false;
}
class serendipity_smarty extends Smarty
{
// reorder parameters in smarty(3) fetch method to be smarty(2) compat
public function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
{
return parent::fetch($resource_name, $cache_id, $compile_id, null, $display);
}
public function display($resource_name, $cache_id = null, $compile_id = null, $parent = null)
{
return parent::fetch($resource_name, $cache_id, $compile_id, $parent, true);
}
public function __construct()
{
// Class Constructor.
// These automatically get set with each new instance.
parent::__construct();
}
}
$serendipity['smarty'] = new serendipity_smarty;
This is a feature [the cache itself] I cannot figure out how we use it in s9y in detail.Some major performance improvements have been implemented since 3.0.6, mostly memory management. There are still more improvements to come before 3.1, but it my be worth a test.
Starting with the upcomming version 3.1 Smarty will use the cache_id for distributing the cache files into sub_dirs.
Code: Select all
$inclusion = $serendipity['smarty']->security_settings[INCLUDE_ANY];
$serendipity['smarty']->security_settings[INCLUDE_ANY] = true;
$content = $serendipity['smarty']->fetch('file:'. $tfile);
$serendipity['smarty']->security_settings[INCLUDE_ANY] = $inclusion;
Code: Select all
Line 492: $serendipity['smarty']->security_settings['MODIFIER_FUNCS'][] = "rand"; // necessary tweak before 0.8 final
Code: Select all
$content = $serendipity['smarty']->fetch('file:'. $tfile);
Them we should start a "Großreinemachen"...!garvinhicking wrote:Yes, I agree on this how you proposed.
NO certainly not! They just changed the property::security_setting to something being more precise, which is being set in the global smarty config enviroment. But we definitely dont need this bunch set overall any more.garvinhicking wrote:does that mean that smarty now allows any template file to access any file path? That's a shame, it would mean that previously you could force people only to edit template files without being able to use raw PHP code and access random files and now it means they can?
This is just a reminder for the upcoming 1.6 release.Timbalu wrote:Then we should start a "Großreinemachen"...!garvinhicking wrote:Yes, I agree on this how you proposed.
Code: Select all
$propbag->add('requirements', array(
'serendipity' => '1.2',
'smarty' => '2.6.18',
'php' => '4.1.0'
));