- reformating for PSR-2 coding standards https://github.com/smarty-php/smarty/pull/483

This commit is contained in:
uwetews
2018-08-31 16:46:20 +02:00
parent 4f7cd8f1b3
commit 7b64226e16

View File

@@ -21,9 +21,9 @@ class Smarty_Internal_Templateparser
}
%include_class
{
const Err1 = 'Security error: Call to private 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 ERR1 = 'Security error: Call to private 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';
/**
* result status
@@ -329,10 +329,10 @@ smartytag(A) ::= SMARTYBLOCKCHILDPARENT(i). {
$j = strrpos(i,'.');
if (i[$j+1] == 'c') {
// {$smarty.block.child}
A = $this->compiler->compileTag('child',array(),array(i));;
A = $this->compiler->compileTag('child',array(),array(i));
} else {
// {$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.']';
}
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. {
res = '['.v.']';
@@ -998,28 +998,28 @@ objectchain(res) ::= objectchain(oc) objectelement(oe). {
// variable
objectelement(res)::= PTR ID(i) arrayindex(a). {
if ($this->security && substr(i,0,1) === '_') {
$this->compiler->trigger_template_error (self::Err1);
$this->compiler->trigger_template_error (self::ERR1);
}
res = '->'.i.a;
}
objectelement(res)::= PTR varvar(v) arrayindex(a). {
if ($this->security) {
$this->compiler->trigger_template_error (self::Err2);
$this->compiler->trigger_template_error (self::ERR2);
}
res = '->{'.$this->compiler->compileVariable(v).a.'}';
}
objectelement(res)::= PTR LDEL expr(e) RDEL arrayindex(a). {
if ($this->security) {
$this->compiler->trigger_template_error (self::Err2);
$this->compiler->trigger_template_error (self::ERR2);
}
res = '->{'.e.a.'}';
}
objectelement(res)::= PTR ID(ii) LDEL expr(e) RDEL arrayindex(a). {
if ($this->security) {
$this->compiler->trigger_template_error (self::Err2);
$this->compiler->trigger_template_error (self::ERR2);
}
res = '->{\''.ii.'\'.'.e.a.'}';
}
@@ -1043,14 +1043,14 @@ function(res) ::= ns1(f) OPENP params(p) CLOSEP. {
//
method(res) ::= ID(f) OPENP params(p) CLOSEP. {
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) .')';
}
method(res) ::= DOLLARID(f) OPENP params(p) CLOSEP. {
if ($this->security) {
$this->compiler->trigger_template_error (self::Err2);
$this->compiler->trigger_template_error (self::ERR2);
}
$prefixVar = $this->compiler->getNewPrefixVariable();
$this->compiler->appendPrefixCode("<?php {$prefixVar} = ".$this->compiler->compileVariable('\''.substr(f,1).'\'').';?>');