mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 03:44:26 +02:00
- added all major setter/getter methodes
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
03/30/2009
|
||||
- added all major setter/getter methodes
|
||||
|
||||
03/28/2009
|
||||
- {block} tags can be nested now
|
||||
- md5 hash function replace with crc32 for speed optimization
|
||||
|
@@ -100,7 +100,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
// config var settings
|
||||
public $config_overwrite = true; //Controls whether variables with the same name overwrite each other.
|
||||
public $config_booleanize = true; //Controls whether config values of on/true/yes and off/false/no get converted to boolean
|
||||
public $config_read_hidden = true; //Controls whether hidden config sections/vars are read from the file.
|
||||
public $config_read_hidden = true; //Controls whether hidden config sections/vars are read from the file.
|
||||
// config vars
|
||||
public $config_vars = array();
|
||||
// assigned tpl vars
|
||||
@@ -178,7 +178,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
$this->loadPlugin('Smarty_Internal_Plugin_Handler');
|
||||
$this->plugin_handler = new Smarty_Internal_Plugin_Handler;
|
||||
if (!$this->debugging && $this->debugging_ctrl == 'URL') {
|
||||
$_query_string = $this->request_use_auto_globals ? $_SERVER['QUERY_STRING'] : $GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
|
||||
$_query_string = $this->request_use_auto_globals ? isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING']:'' : isset($GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING']) ? $GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING']:'';
|
||||
if (false !== strpos($_query_string, $this->smarty_debug_id)) {
|
||||
if (false !== strpos($_query_string, $this->smarty_debug_id . '=on')) {
|
||||
// enable debugging for this browser session
|
||||
@@ -292,7 +292,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the plugin with securty definition and enables security
|
||||
* Load the plugin with security definition and enables security
|
||||
*
|
||||
* @param string $security_policy plugin to load
|
||||
*/
|
||||
@@ -311,6 +311,64 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set template directory
|
||||
*
|
||||
* @param string $ |array $template_dir folder(s) of template sorces
|
||||
*/
|
||||
public function setTemplateDir($template_dir)
|
||||
{
|
||||
$this->smarty->template_dir = (array)$template_dir;
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Adds template directory(s) to existing ones
|
||||
*
|
||||
* @param string|array $template_dir folder(s) of template sources
|
||||
*/
|
||||
public function addTemplateDir($template_dir)
|
||||
{
|
||||
$this->smarty->template_dir = array_merge((array)$this->smarty->template_dir, (array)$template_dir);
|
||||
$this->smarty->template_dir = array_unique($this->smarty->template_dir);
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Set compile directory
|
||||
*
|
||||
* @param string $compile_dir folder of compiled template sources
|
||||
*/
|
||||
public function setCompileDir($compile_dir)
|
||||
{
|
||||
$this->smarty->compile_dir = $compile_dir;
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Set cache directory
|
||||
*
|
||||
* @param string $cache_dir folder of cache files
|
||||
*/
|
||||
public function setCacheDir($cache_dir)
|
||||
{
|
||||
$this->smarty->cache_dir = $cache_dir;
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Enable Caching
|
||||
*/
|
||||
public function enableCaching()
|
||||
{
|
||||
$this->smarty->caching = true;
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Set caching life time
|
||||
* @param integer $lifetime lifetime of cached file in seconds
|
||||
*/
|
||||
public function setCachingLifetime($lifetime)
|
||||
{
|
||||
$this->smarty->caching_lifetime = $lifetime;
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Takes unknown classes and loads plugin files for them
|
||||
* class name format: Smarty_PluginType_PluginName
|
||||
|
@@ -57,7 +57,7 @@ class Smarty_Internal_Resource_PHP extends Smarty_Internal_Base {
|
||||
public function getTemplateSource($_template)
|
||||
{
|
||||
if (file_exists($_template->getTemplateFilepath())) {
|
||||
$_template->template_source = file_get_contents($_template->getTemplateFilepath());
|
||||
$_template->template_source = file_get_contents($_template->getTemplateFilepath());
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@@ -259,7 +259,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
if ($this->mustCompile()) {
|
||||
$this->compileTemplateSource();
|
||||
} else {
|
||||
$this->compiled_template = !$this->isEvaluated() ? file_get_contents($this->getCompiledFilepath()) : false;
|
||||
$this->compiled_template = !$this->isEvaluated() && $this->usesCompiler() ? file_get_contents($this->getCompiledFilepath()) : false;
|
||||
}
|
||||
}
|
||||
return $this->compiled_template;
|
||||
|
34
libs/sysplugins/method.addpluginsdir.php
Normal file
34
libs/sysplugins/method.addpluginsdir.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty method addPluginsDir
|
||||
*
|
||||
* Adds directory of plugin files
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage SmartyMethod
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class addPluginsDir
|
||||
*
|
||||
* Adds directory of plugin files
|
||||
*/
|
||||
|
||||
class Smarty_Method_AddPluginsDir extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Adds directory of plugin files
|
||||
*
|
||||
* @param string|array $ plugins folder
|
||||
* @return
|
||||
*/
|
||||
public function execute($plugins_dir)
|
||||
{
|
||||
$this->smarty->plugins_dir = array_merge((array)$this->smarty->plugins_dir, (array)$plugins_dir);
|
||||
$this->smarty->plugins_dir = array_unique($this->smarty->plugins_dir);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
25
libs/sysplugins/method.disablecaching.php
Normal file
25
libs/sysplugins/method.disablecaching.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty method disableCaching
|
||||
*
|
||||
* Disable caching
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage SmartyMethod
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class disableCaching
|
||||
*
|
||||
* Disable caching
|
||||
*/
|
||||
class Smarty_Method_DisableCaching extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->caching = false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
25
libs/sysplugins/method.disableforcecompile.php
Normal file
25
libs/sysplugins/method.disableforcecompile.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty method disableForceCompile
|
||||
*
|
||||
* Disable forced compiling
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage SmartyMethod
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class disableForceCompile
|
||||
*
|
||||
* Disable forced compiling
|
||||
*/
|
||||
class Smarty_Method_DisableForceCompile extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->force_compile = false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
25
libs/sysplugins/method.enableforcecompile.php
Normal file
25
libs/sysplugins/method.enableforcecompile.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty method enableForceCompile
|
||||
*
|
||||
* Enable forced compiling
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage SmartyMethod
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class enableForceCompile
|
||||
*
|
||||
* Enable forced compiling
|
||||
*/
|
||||
class Smarty_Method_enableForceCompile extends Smarty_Internal_Base {
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->force_compile = true;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
31
libs/sysplugins/method.getcachedir.php
Normal file
31
libs/sysplugins/method.getcachedir.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty method getCacheDir
|
||||
*
|
||||
* Returns directory of cache files
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage SmartyMethod
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class getCacheDir
|
||||
*
|
||||
* Returns directory of cache files
|
||||
*/
|
||||
|
||||
class Smarty_Method_GetCacheDir extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Returns directory of cache files
|
||||
*
|
||||
* @return array cache folder
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->cache_dir;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
30
libs/sysplugins/method.getcachelifetime.php
Normal file
30
libs/sysplugins/method.getcachelifetime.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty method getCacheLifetime
|
||||
*
|
||||
* Returns lifetime of cache files
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage SmartyMethod
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class getCacheLifetime
|
||||
*
|
||||
* Returns lifetime of cache files
|
||||
*/
|
||||
class Smarty_Method_GetCacheLifetime extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Returns lifetime of cache files
|
||||
*
|
||||
* @return integer cache file lifetime
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->cache_lifetime;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
31
libs/sysplugins/method.getcompiledir.php
Normal file
31
libs/sysplugins/method.getcompiledir.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty method getCompileDir
|
||||
*
|
||||
* Returns directory of compiled templates
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage SmartyMethod
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class getCompileDir
|
||||
*
|
||||
* Returns directory of compiled templates
|
||||
*/
|
||||
|
||||
class Smarty_Method_GetCompileDir extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Returns directory of compiled templates
|
||||
*
|
||||
* @return array compiled template folder
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->compile_dir;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
31
libs/sysplugins/method.getconfigdir.php
Normal file
31
libs/sysplugins/method.getconfigdir.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty method getConfigDir
|
||||
*
|
||||
* Returns directory of config files
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage SmartyMethod
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class getConfigDir
|
||||
*
|
||||
* Returns directory of config files
|
||||
*/
|
||||
|
||||
class Smarty_Method_GetConfigDir extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Returns directory of config files
|
||||
*
|
||||
* @return array config folder
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->config_dir;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
31
libs/sysplugins/method.getpluginsdir.php
Normal file
31
libs/sysplugins/method.getpluginsdir.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty method getPluginsDir
|
||||
*
|
||||
* Returns directory of plugins
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage SmartyMethod
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class getPluginsDir
|
||||
*
|
||||
* Returns directory of plugins
|
||||
*/
|
||||
|
||||
class Smarty_Method_GetPluginsDir extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Returns directory of plugins
|
||||
*
|
||||
* @return array plugins folder
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->plugins_dir;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
31
libs/sysplugins/method.gettemplatedir.php
Normal file
31
libs/sysplugins/method.gettemplatedir.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty method getTemplateDir
|
||||
*
|
||||
* Returns template directory
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage SmartyMethod
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class getTemplate_dir
|
||||
*
|
||||
* Returns template directory
|
||||
*/
|
||||
|
||||
class Smarty_Method_GetTemplateDir extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Returns template directory
|
||||
*
|
||||
* @return array template folders
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
return $this->smarty->template_dir;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
32
libs/sysplugins/method.setconfigdir.php
Normal file
32
libs/sysplugins/method.setconfigdir.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty method setConfigDir
|
||||
*
|
||||
* Sets directory of config files
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage SmartyMethod
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class setConfigDir
|
||||
*
|
||||
* Sets directory of config files
|
||||
*/
|
||||
|
||||
class Smarty_Method_SetConfigDir extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Sets directory of config files
|
||||
*
|
||||
* @param string $ config folder
|
||||
* @return
|
||||
*/
|
||||
public function execute($config_dir)
|
||||
{
|
||||
$this->smarty->config_dir = $config_dir;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
32
libs/sysplugins/method.setpluginsdir.php
Normal file
32
libs/sysplugins/method.setpluginsdir.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty method setPluginsDir
|
||||
*
|
||||
* Sets directory of plugin files
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage SmartyMethod
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty class setPluginsDir
|
||||
*
|
||||
* Sets directory of plugin files
|
||||
*/
|
||||
|
||||
class Smarty_Method_SetPluginsDir extends Smarty_Internal_Base {
|
||||
/**
|
||||
* Sets directory of plugin files
|
||||
*
|
||||
* @param string $ plugins folder
|
||||
* @return
|
||||
*/
|
||||
public function execute($plugins_dir)
|
||||
{
|
||||
$this->smarty->plugins_dir = (array)$plugins_dir;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user