mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 02:14:26 +02:00
- reformating for PSR-2 coding standards https://github.com/smarty-php/smarty/pull/483
This commit is contained in:
@@ -21,9 +21,9 @@ class Smarty_Internal_Templateparser
|
|||||||
}
|
}
|
||||||
%include_class
|
%include_class
|
||||||
{
|
{
|
||||||
const Err1 = 'Security error: Call to private object member not allowed';
|
const ERR1 = 'Security error: Call to private object member not allowed';
|
||||||
const Err2 = 'Security error: Call to dynamic object member not allowed';
|
const ERR2 = 'Security error: Call to dynamic object member not allowed';
|
||||||
const Err3 = 'PHP in template not allowed. Use SmartyBC to enable it';
|
const ERR3 = 'PHP in template not allowed. Use SmartyBC to enable it';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* result status
|
* result status
|
||||||
@@ -329,10 +329,10 @@ smartytag(A) ::= SMARTYBLOCKCHILDPARENT(i). {
|
|||||||
$j = strrpos(i,'.');
|
$j = strrpos(i,'.');
|
||||||
if (i[$j+1] == 'c') {
|
if (i[$j+1] == 'c') {
|
||||||
// {$smarty.block.child}
|
// {$smarty.block.child}
|
||||||
A = $this->compiler->compileTag('child',array(),array(i));;
|
A = $this->compiler->compileTag('child',array(),array(i));
|
||||||
} else {
|
} else {
|
||||||
// {$smarty.block.parent}
|
// {$smarty.block.parent}
|
||||||
A = $this->compiler->compileTag('parent',array(),array(i));;
|
A = $this->compiler->compileTag('parent',array(),array(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -922,7 +922,7 @@ indexdef(res) ::= OPENB INTEGER(n) CLOSEB. {
|
|||||||
res = '['.n.']';
|
res = '['.n.']';
|
||||||
}
|
}
|
||||||
indexdef(res) ::= OPENB DOLLARID(i) CLOSEB. {
|
indexdef(res) ::= OPENB DOLLARID(i) CLOSEB. {
|
||||||
res = '['.$this->compiler->compileVariable('\''.substr(i,1).'\'').']';;
|
res = '['.$this->compiler->compileVariable('\''.substr(i,1).'\'').']';
|
||||||
}
|
}
|
||||||
indexdef(res) ::= OPENB variable(v) CLOSEB. {
|
indexdef(res) ::= OPENB variable(v) CLOSEB. {
|
||||||
res = '['.v.']';
|
res = '['.v.']';
|
||||||
@@ -998,28 +998,28 @@ objectchain(res) ::= objectchain(oc) objectelement(oe). {
|
|||||||
// variable
|
// variable
|
||||||
objectelement(res)::= PTR ID(i) arrayindex(a). {
|
objectelement(res)::= PTR ID(i) arrayindex(a). {
|
||||||
if ($this->security && substr(i,0,1) === '_') {
|
if ($this->security && substr(i,0,1) === '_') {
|
||||||
$this->compiler->trigger_template_error (self::Err1);
|
$this->compiler->trigger_template_error (self::ERR1);
|
||||||
}
|
}
|
||||||
res = '->'.i.a;
|
res = '->'.i.a;
|
||||||
}
|
}
|
||||||
|
|
||||||
objectelement(res)::= PTR varvar(v) arrayindex(a). {
|
objectelement(res)::= PTR varvar(v) arrayindex(a). {
|
||||||
if ($this->security) {
|
if ($this->security) {
|
||||||
$this->compiler->trigger_template_error (self::Err2);
|
$this->compiler->trigger_template_error (self::ERR2);
|
||||||
}
|
}
|
||||||
res = '->{'.$this->compiler->compileVariable(v).a.'}';
|
res = '->{'.$this->compiler->compileVariable(v).a.'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
objectelement(res)::= PTR LDEL expr(e) RDEL arrayindex(a). {
|
objectelement(res)::= PTR LDEL expr(e) RDEL arrayindex(a). {
|
||||||
if ($this->security) {
|
if ($this->security) {
|
||||||
$this->compiler->trigger_template_error (self::Err2);
|
$this->compiler->trigger_template_error (self::ERR2);
|
||||||
}
|
}
|
||||||
res = '->{'.e.a.'}';
|
res = '->{'.e.a.'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
objectelement(res)::= PTR ID(ii) LDEL expr(e) RDEL arrayindex(a). {
|
objectelement(res)::= PTR ID(ii) LDEL expr(e) RDEL arrayindex(a). {
|
||||||
if ($this->security) {
|
if ($this->security) {
|
||||||
$this->compiler->trigger_template_error (self::Err2);
|
$this->compiler->trigger_template_error (self::ERR2);
|
||||||
}
|
}
|
||||||
res = '->{\''.ii.'\'.'.e.a.'}';
|
res = '->{\''.ii.'\'.'.e.a.'}';
|
||||||
}
|
}
|
||||||
@@ -1043,14 +1043,14 @@ function(res) ::= ns1(f) OPENP params(p) CLOSEP. {
|
|||||||
//
|
//
|
||||||
method(res) ::= ID(f) OPENP params(p) CLOSEP. {
|
method(res) ::= ID(f) OPENP params(p) CLOSEP. {
|
||||||
if ($this->security && substr(f,0,1) === '_') {
|
if ($this->security && substr(f,0,1) === '_') {
|
||||||
$this->compiler->trigger_template_error (self::Err1);
|
$this->compiler->trigger_template_error (self::ERR1);
|
||||||
}
|
}
|
||||||
res = f . '('. implode(',',p) .')';
|
res = f . '('. implode(',',p) .')';
|
||||||
}
|
}
|
||||||
|
|
||||||
method(res) ::= DOLLARID(f) OPENP params(p) CLOSEP. {
|
method(res) ::= DOLLARID(f) OPENP params(p) CLOSEP. {
|
||||||
if ($this->security) {
|
if ($this->security) {
|
||||||
$this->compiler->trigger_template_error (self::Err2);
|
$this->compiler->trigger_template_error (self::ERR2);
|
||||||
}
|
}
|
||||||
$prefixVar = $this->compiler->getNewPrefixVariable();
|
$prefixVar = $this->compiler->getNewPrefixVariable();
|
||||||
$this->compiler->appendPrefixCode("<?php {$prefixVar} = ".$this->compiler->compileVariable('\''.substr(f,1).'\'').';?>');
|
$this->compiler->appendPrefixCode("<?php {$prefixVar} = ".$this->compiler->compileVariable('\''.substr(f,1).'\'').';?>');
|
||||||
|
Reference in New Issue
Block a user