Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Improved variables inside attributes support

givanz35cbe0c89bfe
diff --git a/system/vtpl/vtpl.php b/system/vtpl/vtpl.php
index a0511e0..574321f 100755
--- a/system/vtpl/vtpl.php
+++ b/system/vtpl/vtpl.php
@@ -1868,14 +1868,21 @@ class Vtpl {
continue;
} else {
- if (isset($value[0]) && $value[0] == '$' && preg_match('/^\$[a-z][\w\.]+$/i', $value)) {
- if (strpos($value, 'this') === 0) {
- $value = str_replace('this.', 'this->', $value);
- }
- $value = Vvveb\dotToArrayKey($value);
+ if (strpos($value,'$') !== false) {
+ $value = preg_replace_callback('/{(\$[a-z][\w\.]+)}/i',
+ function ($matches) {
+ $value = $matches[1];
+
+ if (strpos($value, '$this') === 0) {
+ $value = str_replace('$this.', '$this->', $value);
+ }
+ $value = Vvveb\dotToArrayKey($value);
+ $php = '<_script language="php"><![CDATA[ if (isset(' . $value . ')) echo htmlentities(' . $value . ');]]></_script>';
+
+ return $php;
+ }, $value);
- $php = '<_script language="php"><![CDATA[ if (isset(' . $value . ')) echo htmlentities(' . $value . ');]]></_script>';
- $this->setNodeAttribute($node, $name, $php);
+ $this->setNodeAttribute($node, $name, $value);
}
}
/*