summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruwetews <uwe.tews@googlemail.com>2016-09-08 22:28:06 +0200
committeruwetews <uwe.tews@googlemail.com>2016-09-08 22:28:06 +0200
commit124b333da21a58927d710d11e2041ed0a9e61ece (patch)
tree2871bf8e45320d0bcf4654ec0f0ffe687ac0a025
parentbfc1ef888550416bbe059681a7fb73edd3c3b17a (diff)
downloadsmarty-124b333da21a58927d710d11e2041ed0a9e61ece.tar.gz
smarty-124b333da21a58927d710d11e2041ed0a9e61ece.tar.bz2
smarty-124b333da21a58927d710d11e2041ed0a9e61ece.zip
- bugfix implement wrapper for removed method getConfigVariable() https://github.com/smarty-php/smarty/issues/286
-rw-r--r--change_log.txt3
-rw-r--r--libs/Smarty.class.php2
-rw-r--r--libs/sysplugins/smarty_internal_data.php1
-rw-r--r--libs/sysplugins/smarty_internal_method_configload.php16
-rw-r--r--libs/sysplugins/smarty_internal_method_getconfigvariable.php34
-rw-r--r--libs/sysplugins/smarty_internal_testinstall.php1
6 files changed, 48 insertions, 9 deletions
diff --git a/change_log.txt b/change_log.txt
index 84c0065c..018d008e 100644
--- a/change_log.txt
+++ b/change_log.txt
@@ -1,4 +1,7 @@
===== 3.1.31-dev ===== (xx.xx.xx)
+ 08.09.2016
+ - bugfix implement wrapper for removed method getConfigVariable() https://github.com/smarty-php/smarty/issues/286
+
07.09.2016
- bugfix using nocache like attribute with value true like {plugin nocache=true} did not work https://github.com/smarty-php/smarty/issues/285
- bugfix uppercase TRUE, FALSE and NULL did not work when security was enabled https://github.com/smarty-php/smarty/issues/282
diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php
index 690fcb85..016e058c 100644
--- a/libs/Smarty.class.php
+++ b/libs/Smarty.class.php
@@ -114,7 +114,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
- const SMARTY_VERSION = '3.1.31-dev/12';
+ const SMARTY_VERSION = '3.1.31-dev/13';
/**
* define variable scopes
diff --git a/libs/sysplugins/smarty_internal_data.php b/libs/sysplugins/smarty_internal_data.php
index 59366b77..62366085 100644
--- a/libs/sysplugins/smarty_internal_data.php
+++ b/libs/sysplugins/smarty_internal_data.php
@@ -18,6 +18,7 @@
* The following methods will be dynamically loaded by the extension handler when they are called.
* They are located in a corresponding Smarty_Internal_Method_xxxx class
*
+ * @method mixed getConfigVariable(string $varName, bool $errorEnable = true)
* @method mixed getConfigVars(string $varName = null, bool $searchParents = true)
* @method mixed getGlobal(string $varName = null)
* @method mixed getStreamVariable(string $variable)
diff --git a/libs/sysplugins/smarty_internal_method_configload.php b/libs/sysplugins/smarty_internal_method_configload.php
index 2a38b188..401b0df9 100644
--- a/libs/sysplugins/smarty_internal_method_configload.php
+++ b/libs/sysplugins/smarty_internal_method_configload.php
@@ -109,7 +109,7 @@ class Smarty_Internal_Method_ConfigLoad
/**
* Assign all config variables in given scope
*
- * @param array $config_vars config variables in scope
+ * @param array $config_vars config variables in scope
* @param \Smarty_Internal_Template $tpl
* @param array $new_config_vars loaded config variables
*/
@@ -158,15 +158,15 @@ class Smarty_Internal_Method_ConfigLoad
/**
* gets a config variable value
*
- * @param \Smarty_Internal_Template $tpl template object
- * @param string $varName the name of the config variable
- * @param bool $errorEnable
+ * @param \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template $data
+ * @param string $varName the name of the config variable
+ * @param bool $errorEnable
*
- * @return mixed the value of the config variable
+ * @return null|string the value of the config variable
*/
- public function _getConfigVariable(Smarty_Internal_Template $tpl, $varName, $errorEnable = true)
+ public function _getConfigVariable(Smarty_Internal_Data $data, $varName, $errorEnable = true)
{
- $_ptr = $tpl;
+ $_ptr = $data;
while ($_ptr !== null) {
if (isset($_ptr->config_vars[ $varName ])) {
// found it, return it
@@ -175,7 +175,7 @@ class Smarty_Internal_Method_ConfigLoad
// not found, try at parent
$_ptr = $_ptr->parent;
}
- if ($tpl->smarty->error_unassigned && $errorEnable) {
+ if ($data->smarty->error_unassigned && $errorEnable) {
// force a notice
$x = $$varName;
}
diff --git a/libs/sysplugins/smarty_internal_method_getconfigvariable.php b/libs/sysplugins/smarty_internal_method_getconfigvariable.php
new file mode 100644
index 00000000..4dd39820
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_method_getconfigvariable.php
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * Smarty Method GetConfigVariable
+ *
+ * Smarty::getConfigVariable() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_GetConfigVariable
+{
+ /**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
+ * gets a config variable value
+ *
+ * @param \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template $data
+ * @param string $varName the name of the config variable
+ * @param bool $errorEnable
+ *
+ * @return null|string the value of the config variable
+ */
+ public function getConfigVariable(Smarty_Internal_Data $data, $varName = null, $errorEnable = true)
+ {
+ return $data->ext->configLoad->_getConfigVariable($data, $varName, $errorEnable);
+ }
+} \ No newline at end of file
diff --git a/libs/sysplugins/smarty_internal_testinstall.php b/libs/sysplugins/smarty_internal_testinstall.php
index ca2b9547..45bd6a91 100644
--- a/libs/sysplugins/smarty_internal_testinstall.php
+++ b/libs/sysplugins/smarty_internal_testinstall.php
@@ -425,6 +425,7 @@ class Smarty_Internal_TestInstall
'smarty_internal_method_configload.php' => true,
'smarty_internal_method_createdata.php' => true,
'smarty_internal_method_getautoloadfilters.php' => true,
+ 'smarty_internal_method_getconfigvariable.php' => true,
'smarty_internal_method_getconfigvars.php' => true,
'smarty_internal_method_getdebugtemplate.php' => true,
'smarty_internal_method_getdefaultmodifiers.php' => true,