mirror of
https://github.com/smarty-php/smarty.git
synced 2026-08-04 04:24:18 +02:00
Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d53d3cbf2 | |||
| 47c4864dd1 | |||
| f411247aa1 | |||
| 9a8702d937 | |||
| 5ee4363000 | |||
| 77c0b74e3b | |||
| 34adf4e54c | |||
| 5400b53edf | |||
| 599bcee13e | |||
| 569cef71d0 | |||
| 0972503aef | |||
| 46b15e6365 | |||
| beafa5ec31 | |||
| 82a815aafb | |||
| 4efa427a87 | |||
| 30b1c5bf6d | |||
| 3f871f9f7a | |||
| cafe5e1e59 | |||
| a58d869502 | |||
| 28e11b114b | |||
| 1da30e76e8 | |||
| 58348c38ef | |||
| 578c03efa5 | |||
| 7255b4d73c | |||
| e161babbd4 | |||
| f8e63fc480 |
@@ -6,6 +6,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [5.1.0] - 2024-04-22
|
||||
- Prevent deprecation notices during compilation in PHP8.3 [#996](https://github.com/smarty-php/smarty/issues/996)
|
||||
- Fix that getTemplateVars would return an array of objects instead of the assigned variables values [#994](https://github.com/smarty-php/smarty/issues/994)
|
||||
- Fix Smarty::assign() not returning $this when called with an array as first parameter [#972](https://github.com/smarty-php/smarty/pull/972)
|
||||
- Documented support for `{if $element is in $array}` syntax [#937](https://github.com/smarty-php/smarty/issues/937)
|
||||
- Added support for `{if $element is not in $array}` syntax [#937](https://github.com/smarty-php/smarty/issues/937)
|
||||
- Using stream variables in templates now throws a deprecation notice [#933](https://github.com/smarty-php/smarty/pull/933)
|
||||
- Internal compiler classes always return a string (the internal has_code flag has been removed for simplicity) [#918](https://github.com/smarty-php/smarty/pull/918)
|
||||
- Fix invalid classnames in Runtime code for foreach [#1000](https://github.com/smarty-php/smarty/issues/1000)
|
||||
|
||||
|
||||
## [5.0.1] - 2024-03-27
|
||||
- Fix error in Smarty\Smarty::compileAllTemplates() by including missing FilesystemIterator class [#966](https://github.com/smarty-php/smarty/issues/966)
|
||||
|
||||
|
||||
## [5.0.0] - 2024-03-25
|
||||
- Fixed that scoped variables would overwrite parent scope [#952](https://github.com/smarty-php/smarty/issues/952)
|
||||
- Removed publicly accessible `$tpl->_var_stack` variable
|
||||
|
||||
|
||||
### Fixed
|
||||
- Too many shorthand attributes error when using a modifier as a function with more than 3 parameters in an expression [#949](https://github.com/smarty-php/smarty/issues/949)
|
||||
|
||||
|
||||
@@ -29,5 +29,4 @@
|
||||
|
||||
## Unrelated / other
|
||||
- review (and avoid) use of 'clone' keyword
|
||||
- compiler->has_code seems silly. Why not have proper return values?
|
||||
- what is 'user literal support', why are unit tests skipped?
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
- Fixed that scoped variables would overwrite parent scope [#952](https://github.com/smarty-php/smarty/issues/952)
|
||||
- Removed publicly accessible `$tpl->_var_stack` variable
|
||||
@@ -10,4 +10,7 @@ template.
|
||||
{$foo:bar}
|
||||
```
|
||||
|
||||
NB. Support for using streams to call variables is deprecated since Smarty v5.1 and will be removed
|
||||
in a future version.
|
||||
|
||||
See also [`Template Resources`](../resources.md)
|
||||
|
||||
@@ -27,6 +27,30 @@ Various basic operators can be applied directly to variable values.
|
||||
> complex, it may be a good idea to move the bits that do not deal
|
||||
> explicitly with presentation to PHP by way of plugins or modifiers.
|
||||
|
||||
## List
|
||||
The following is a list of recognized operators, which must be
|
||||
separated from surrounding elements by spaces. Note that items listed in
|
||||
\[brackets\] are optional. PHP equivalents are shown where applicable.
|
||||
|
||||
| Operator | Alternates | Syntax Example | Meaning | PHP Equivalent |
|
||||
|--------------------|------------|----------------------|--------------------------------|--------------------|
|
||||
| == | eq | $a eq $b | equals | == |
|
||||
| != | ne, neq | $a neq $b | not equals | != |
|
||||
| > | gt | $a gt $b | greater than | > |
|
||||
| < | lt | $a lt $b | less than | < |
|
||||
| >= | gte, ge | $a ge $b | greater than or equal | >= |
|
||||
| <= | lte, le | $a le $b | less than or equal | <= |
|
||||
| === | | $a === 0 | check for identity | === |
|
||||
| ! | not | not $a | negation (unary) | ! |
|
||||
| % | mod | $a mod $b | modulo | % |
|
||||
| is \[not\] div by | | $a is not div by 4 | divisible by | $a % $b == 0 |
|
||||
| is \[not\] even | | $a is not even | \[not\] an even number (unary) | $a % 2 == 0 |
|
||||
| is \[not\] even by | | $a is not even by $b | grouping level \[not\] even | ($a / $b) % 2 == 0 |
|
||||
| is \[not\] odd | | $a is not odd | \[not\] an odd number (unary) | $a % 2 != 0 |
|
||||
| is \[not\] odd by | | $a is not odd by $b | \[not\] an odd grouping | ($a / $b) % 2 != 0 |
|
||||
| is in | | $a is in $b | exists in array | in_array($a, $b) |
|
||||
| is \[not\] in | | $a is not in $b | does not exist in array | !in_array($a, $b) |
|
||||
|
||||
## Ternary
|
||||
You can use the `?:` (or ternary) operator to test one expression and present the value
|
||||
of the second or third expression, based on the result of the test.
|
||||
|
||||
@@ -3,32 +3,8 @@
|
||||
`{if}` statements in Smarty have much the same flexibility as PHP
|
||||
[if](https://www.php.net/if) statements, with a few added features for the
|
||||
template engine. Every `{if}` must be paired with a matching `{/if}`.
|
||||
`{else}` and `{elseif}` are also permitted. All PHP conditionals and
|
||||
functions are recognized, such as *\|\|*, *or*, *&&*, *and*,
|
||||
*is_array()*, etc.
|
||||
|
||||
The following is a list of recognized qualifiers, which must be
|
||||
separated from surrounding elements by spaces. Note that items listed in
|
||||
\[brackets\] are optional. PHP equivalents are shown where applicable.
|
||||
|
||||
## Qualifiers
|
||||
|
||||
| Qualifier | Alternates | Syntax Example | Meaning | PHP Equivalent |
|
||||
|--------------------|------------|----------------------|--------------------------------|--------------------|
|
||||
| == | eq | $a eq $b | equals | == |
|
||||
| != | ne, neq | $a neq $b | not equals | != |
|
||||
| > | gt | $a gt $b | greater than | > |
|
||||
| < | lt | $a lt $b | less than | < |
|
||||
| >= | gte, ge | $a ge $b | greater than or equal | >= |
|
||||
| <= | lte, le | $a le $b | less than or equal | <= |
|
||||
| === | | $a === 0 | check for identity | === |
|
||||
| ! | not | not $a | negation (unary) | ! |
|
||||
| % | mod | $a mod $b | modulo | % |
|
||||
| is \[not\] div by | | $a is not div by 4 | divisible by | $a % $b == 0 |
|
||||
| is \[not\] even | | $a is not even | \[not\] an even number (unary) | $a % 2 == 0 |
|
||||
| is \[not\] even by | | $a is not even by $b | grouping level \[not\] even | ($a / $b) % 2 == 0 |
|
||||
| is \[not\] odd | | $a is not odd | \[not\] an odd number (unary) | $a % 2 != 0 |
|
||||
| is \[not\] odd by | | $a is not odd by $b | \[not\] an odd grouping | ($a / $b) % 2 != 0 |
|
||||
`{else}` and `{elseif}` are also permitted. All [operators](../language-basic-syntax/language-syntax-operators.md) are recognized, such as *==*,
|
||||
*\|\|*, *or*, *&&*, *and*, etc and you can use modifiers as functions, such as *is_array()*.
|
||||
|
||||
## Examples
|
||||
```smarty
|
||||
|
||||
@@ -3,31 +3,8 @@
|
||||
`{while}` loops in Smarty have much the same flexibility as PHP
|
||||
[while](https://www.php.net/while) statements, with a few added features for
|
||||
the template engine. Every `{while}` must be paired with a matching
|
||||
`{/while}`. All PHP conditionals and functions are recognized, such as
|
||||
*\|\|*, *or*, *&&*, *and*, *is_array()*, etc.
|
||||
|
||||
The following is a list of recognized qualifiers, which must be
|
||||
separated from surrounding elements by spaces. Note that items listed in
|
||||
\[brackets\] are optional. PHP equivalents are shown where applicable.
|
||||
|
||||
## Qualifiers
|
||||
|
||||
| Qualifier | Alternates | Syntax Example | Meaning | PHP Equivalent |
|
||||
|--------------------|------------|----------------------|--------------------------------|--------------------|
|
||||
| == | eq | $a eq $b | equals | == |
|
||||
| != | ne, neq | $a neq $b | not equals | != |
|
||||
| > | gt | $a gt $b | greater than | > |
|
||||
| < | lt | $a lt $b | less than | < |
|
||||
| >= | gte, ge | $a ge $b | greater than or equal | >= |
|
||||
| <= | lte, le | $a le $b | less than or equal | <= |
|
||||
| === | | $a === 0 | check for identity | === |
|
||||
| ! | not | not $a | negation (unary) | ! |
|
||||
| % | mod | $a mod $b | modulo | % |
|
||||
| is \[not\] div by | | $a is not div by 4 | divisible by | $a % $b == 0 |
|
||||
| is \[not\] even | | $a is not even | \[not\] an even number (unary) | $a % 2 == 0 |
|
||||
| is \[not\] even by | | $a is not even by $b | grouping level \[not\] even | ($a / $b) % 2 == 0 |
|
||||
| is \[not\] odd | | $a is not odd | \[not\] an odd number (unary) | $a % 2 != 0 |
|
||||
| is \[not\] odd by | | $a is not odd by $b | \[not\] an odd grouping | ($a / $b) % 2 != 0 |
|
||||
`{/while}`. All [operators](../language-basic-syntax/language-syntax-operators.md) are recognized, such as *==*,
|
||||
*\|\|*, *or*, *&&*, *and*, etc and you can use modifiers as functions, such as *is_array()*.
|
||||
|
||||
## Examples
|
||||
```smarty
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# is_array
|
||||
|
||||
Return true if the variable passed to it is an array.
|
||||
|
||||
## Basic usage
|
||||
|
||||
```smarty
|
||||
{if $myVar|is_array}it's an array{/if}
|
||||
```
|
||||
@@ -60,6 +60,7 @@ nav:
|
||||
- 'escape': 'designers/language-modifiers/language-modifier-escape.md'
|
||||
- 'from_charset': 'designers/language-modifiers/language-modifier-from-charset.md'
|
||||
- 'indent': 'designers/language-modifiers/language-modifier-indent.md'
|
||||
- 'is_array': 'designers/language-modifiers/language-modifier-is_array.md'
|
||||
- 'isset': 'designers/language-modifiers/language-modifier-isset.md'
|
||||
- 'join': 'designers/language-modifiers/language-modifier-join.md'
|
||||
- 'json_encode': 'designers/language-modifiers/language-modifier-json-encode.md'
|
||||
|
||||
@@ -20,9 +20,6 @@ use Smarty\Template;
|
||||
* - indent_char - string (" ")
|
||||
* - wrap_boundary - boolean (true)
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.textformat.php {textformat}
|
||||
* (Smarty online manual)
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param string $content contents of the block
|
||||
* @param Template $template template object
|
||||
|
||||
@@ -226,8 +226,8 @@ abstract class Base implements CompilerInterface {
|
||||
* @param Template $compiler compiler object
|
||||
* @param array $parameter array with compilation parameter
|
||||
*
|
||||
* @return bool|string compiled code or true if no code has been compiled
|
||||
* @return string compiled code as a string
|
||||
* @throws \Smarty\CompilerException
|
||||
*/
|
||||
abstract public function compile($args, Template $compiler, $parameter = array(), $tag = null, $function = null);
|
||||
abstract public function compile($args, Template $compiler, $parameter = array(), $tag = null, $function = null): string;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ class BlockCompiler extends Base {
|
||||
* @throws CompilerException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function compile($args, Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
|
||||
if (!isset($tag[5]) || substr($tag, -5) !== 'close') {
|
||||
$output = $this->compileOpeningTag($compiler, $args, $tag, $function);
|
||||
@@ -77,7 +78,6 @@ class BlockCompiler extends Base {
|
||||
);
|
||||
}
|
||||
$compiler->_cache['blockParams'][$compiler->_cache['blockNesting']]['callsChild'] = true;
|
||||
$compiler->has_code = true;
|
||||
$compiler->suppressNocacheProcessing = true;
|
||||
|
||||
$output = "<?php \n";
|
||||
@@ -102,7 +102,6 @@ class BlockCompiler extends Base {
|
||||
$compiler->getParser()->lex->taglineno
|
||||
);
|
||||
}
|
||||
$compiler->has_code = true;
|
||||
$compiler->suppressNocacheProcessing = true;
|
||||
|
||||
$output = "<?php \n";
|
||||
|
||||
@@ -17,10 +17,10 @@ interface CompilerInterface {
|
||||
* @param \Smarty\Compiler\Template $compiler compiler object
|
||||
* @param array $parameter array with compilation parameter
|
||||
*
|
||||
* @return bool|string compiled code or true if no code has been compiled
|
||||
* @return string compiled code as a string
|
||||
* @throws \Smarty\CompilerException
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null);
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string;
|
||||
|
||||
public function isCacheable(): bool;
|
||||
}
|
||||
@@ -27,7 +27,8 @@ class DefaultHandlerFunctionCallCompiler extends Base {
|
||||
* @throws \Smarty\CompilerException
|
||||
* @throws \Smarty\Exception
|
||||
*/
|
||||
public function compile($args, Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
unset($_attr['nocache']);
|
||||
|
||||
@@ -49,7 +49,8 @@ class FunctionCallCompiler extends Base {
|
||||
* @throws \Smarty\CompilerException
|
||||
* @throws \Smarty\Exception
|
||||
*/
|
||||
public function compile($args, Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
|
||||
@@ -11,8 +11,6 @@ namespace Smarty\Compile\Modifier;
|
||||
* Input: string to catenate
|
||||
* Example: {$var|cat:"foo"}
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.cat.php cat
|
||||
* (Smarty online manual)
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ namespace Smarty\Compile\Modifier;
|
||||
* Name: count_characters
|
||||
* Purpose: count the number of characters in a text
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online
|
||||
* manual)
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ namespace Smarty\Compile\Modifier;
|
||||
* Name: count_paragraphs
|
||||
* Purpose: count the number of paragraphs in a text
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
|
||||
* count_paragraphs (Smarty online manual)
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ namespace Smarty\Compile\Modifier;
|
||||
* Name: count_sentences
|
||||
* Purpose: count the number of sentences in a text
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
|
||||
* count_sentences (Smarty online manual)
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ namespace Smarty\Compile\Modifier;
|
||||
* Name: count_words
|
||||
* Purpose: count the number of words in a text
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual)
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ namespace Smarty\Compile\Modifier;
|
||||
* Name: default
|
||||
* Purpose: designate default value for empty variables
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual)
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ use Smarty\Exception;
|
||||
* Name: escape
|
||||
* Purpose: escape string for output
|
||||
*
|
||||
* @link https://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual)
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ namespace Smarty\Compile\Modifier;
|
||||
* Name: indent
|
||||
* Purpose: indent lines of text
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual)
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ namespace Smarty\Compile\Modifier;
|
||||
* Name: lower
|
||||
* Purpose: convert string to lowercase
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace Smarty\Compile\Modifier;
|
||||
* Name: nl2br
|
||||
* Purpose: insert HTML line breaks before all newlines in a string
|
||||
*
|
||||
* @link https://www.smarty.net/docs/en/language.modifier.nl2br.tpl nl2br (Smarty online manual)
|
||||
*/
|
||||
|
||||
class Nl2brModifierCompiler extends Base {
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace Smarty\Compile\Modifier;
|
||||
* Name: round
|
||||
* Purpose: Returns the rounded value of num to specified precision (number of digits after the decimal point)
|
||||
*
|
||||
* @link https://www.smarty.net/docs/en/language.modifier.round.tpl round (Smarty online manual)
|
||||
*/
|
||||
|
||||
class RoundModifierCompiler extends Base {
|
||||
|
||||
@@ -6,7 +6,6 @@ namespace Smarty\Compile\Modifier;
|
||||
* Name: str_repeat
|
||||
* Purpose: returns string repeated times times
|
||||
*
|
||||
* @link https://www.smarty.net/docs/en/language.modifier.str_repeat.tpl str_repeat (Smarty online manual)
|
||||
*/
|
||||
|
||||
class StrRepeatModifierCompiler extends Base {
|
||||
|
||||
@@ -6,7 +6,6 @@ namespace Smarty\Compile\Modifier;
|
||||
* Name: string_format
|
||||
* Purpose: format strings via sprintf
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual)
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace Smarty\Compile\Modifier;
|
||||
* Example: {$var|strip} {$var|strip:" "}
|
||||
* Date: September 25th, 2002
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual)
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ namespace Smarty\Compile\Modifier;
|
||||
* Name: strip_tags
|
||||
* Purpose: strip html tags from text
|
||||
*
|
||||
* @link https://www.smarty.net/docs/en/language.modifier.strip.tags.tpl strip_tags (Smarty online manual)
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace Smarty\Compile\Modifier;
|
||||
* Name: strlen
|
||||
* Purpose: return the length of the given string
|
||||
*
|
||||
* @link https://www.smarty.net/docs/en/language.modifier.strlen.tpl strlen (Smarty online manual)
|
||||
*/
|
||||
|
||||
class StrlenModifierCompiler extends Base {
|
||||
|
||||
@@ -6,7 +6,6 @@ namespace Smarty\Compile\Modifier;
|
||||
* Name: lower
|
||||
* Purpose: convert string to uppercase
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.upper.php lower (Smarty online manual)
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ namespace Smarty\Compile\Modifier;
|
||||
* Name: wordwrap
|
||||
* Purpose: wrap a string of text at a given length
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
|
||||
@@ -33,9 +33,8 @@ class ModifierCompiler extends Base {
|
||||
* @throws \Smarty\CompilerException
|
||||
* @throws \Smarty\Exception
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
|
||||
$compiler->has_code = true;
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
|
||||
$output = $parameter['value'];
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@ class ObjectMethodCallCompiler extends Base {
|
||||
* @throws \Smarty\CompilerException
|
||||
* @throws \Smarty\Exception
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
unset($_attr['nocache']);
|
||||
|
||||
@@ -47,9 +47,8 @@ class PrintExpressionCompiler extends Base {
|
||||
* @return string
|
||||
* @throws \Smarty\Exception
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
|
||||
$compiler->has_code = true;
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
|
||||
@@ -37,9 +37,8 @@ class SpecialVariableCompiler extends Base {
|
||||
* @return string compiled code
|
||||
* @throws CompilerException
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
|
||||
$compiler->has_code = true;
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
|
||||
$_index = preg_split("/\]\[/", substr($parameter, 1, strlen($parameter) - 2));
|
||||
$variable = smarty_strtolower_ascii($compiler->getId($_index[0]));
|
||||
@@ -129,5 +128,7 @@ class SpecialVariableCompiler extends Base {
|
||||
}
|
||||
return $compiled_ref;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ class Append extends Assign
|
||||
* @return string compiled code
|
||||
* @throws \Smarty\CompilerException
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = array(), $tag = null, $function = null)
|
||||
{
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = array(), $tag = null, $function = null): string
|
||||
{
|
||||
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
|
||||
@@ -55,8 +55,8 @@ class Assign extends Base
|
||||
* @return string compiled code
|
||||
* @throws \Smarty\CompilerException
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = array(), $tag = null, $function = null)
|
||||
{
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = array(), $tag = null, $function = null): string
|
||||
{
|
||||
|
||||
$_nocache = false;
|
||||
// check and get attributes
|
||||
|
||||
@@ -24,7 +24,8 @@ class BCPluginWrapper extends Base {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
return call_user_func($this->callback, $this->getAttributes($compiler, $args), $compiler->getSmarty());
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ class Block extends Inheritance {
|
||||
* @param \Smarty\Compiler\Template $compiler compiler object
|
||||
* @param array $parameter array with compilation parameter
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = array(), $tag = null, $function = null)
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = array(), $tag = null, $function = null): string
|
||||
{
|
||||
if (!isset($compiler->_cache['blockNesting'])) {
|
||||
$compiler->_cache['blockNesting'] = 0;
|
||||
@@ -87,5 +87,6 @@ class Block extends Inheritance {
|
||||
$compiler->getParser()->current_buffer = new Template();
|
||||
$compiler->getTemplate()->getCompiled()->setNocacheCode(false);
|
||||
$compiler->suppressNocacheProcessing = true;
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class BlockClose extends Inheritance {
|
||||
*
|
||||
* @return bool true
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = array(), $tag = null, $function = null)
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = array(), $tag = null, $function = null): string
|
||||
{
|
||||
[$_attr, $_nocache, $_buffer, $_has_nocache_code, $_className] = $this->closeTag($compiler, ['block']);
|
||||
|
||||
@@ -103,7 +103,6 @@ class BlockClose extends Inheritance {
|
||||
if ($compiler->_cache['blockNesting'] === 0) {
|
||||
unset($compiler->_cache['blockNesting']);
|
||||
}
|
||||
$compiler->has_code = true;
|
||||
$compiler->suppressNocacheProcessing = true;
|
||||
return $output;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class BreakTag extends Base {
|
||||
* @return string compiled code
|
||||
* @throws \Smarty\CompilerException
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = array(), $tag = null, $function = null)
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = array(), $tag = null, $function = null): string
|
||||
{
|
||||
[$levels, $foreachLevels] = $this->checkLevels($args, $compiler);
|
||||
$output = "<?php ";
|
||||
|
||||
@@ -47,7 +47,8 @@ class Call extends Base {
|
||||
*
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
// save possible attributes
|
||||
|
||||
@@ -53,7 +53,8 @@ class Capture extends Base {
|
||||
*
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
$buffer = $_attr['name'] ?? "'default'";
|
||||
@@ -66,7 +67,6 @@ class Capture extends Base {
|
||||
$compiler->openTag('nocache');
|
||||
}
|
||||
|
||||
$_output = "<?php \$_smarty_tpl->getSmarty()->getRuntime('Capture')->open(\$_smarty_tpl, $buffer, $assign, $append);?>";
|
||||
return $_output;
|
||||
return "<?php \$_smarty_tpl->getSmarty()->getRuntime('Capture')->open(\$_smarty_tpl, $buffer, $assign, $append);?>";
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,8 @@ class CaptureClose extends Base {
|
||||
*
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
|
||||
if (array_pop($compiler->_cache['capture_stack'])) {
|
||||
// pop the virtual {nocache} tag from the stack.
|
||||
|
||||
@@ -62,7 +62,8 @@ class ConfigLoad extends Base {
|
||||
* @return string compiled code
|
||||
* @throws \Smarty\CompilerException
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
if ($_attr['nocache'] === true) {
|
||||
|
||||
@@ -29,7 +29,8 @@ class Debug extends Base {
|
||||
*
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
// check and get attributes, may trigger errors
|
||||
$this->getAttributes($compiler, $args);
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@ class ElseIfTag extends Base {
|
||||
* @return string compiled code
|
||||
* @throws \Smarty\CompilerException
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
|
||||
[$nesting, $nocache_pushed] = $this->closeTag($compiler, ['if', 'elseif']);
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@ class ElseTag extends Base {
|
||||
*
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
[$nesting, $compiler->tag_nocache] = $this->closeTag($compiler, ['if', 'elseif']);
|
||||
$this->openTag($compiler, 'else', [$nesting, $compiler->tag_nocache]);
|
||||
return '<?php } else { ?>';
|
||||
|
||||
@@ -52,7 +52,8 @@ class EvalTag extends Base {
|
||||
*
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
if (isset($_attr['assign'])) {
|
||||
|
||||
@@ -52,7 +52,8 @@ class ExtendsTag extends Inheritance {
|
||||
* @throws \Smarty\CompilerException
|
||||
* @throws \Smarty\Exception
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
if ($_attr['nocache'] === true) {
|
||||
@@ -86,7 +87,6 @@ class ExtendsTag extends Inheritance {
|
||||
} else {
|
||||
$this->compileEndChild($compiler, $_attr['file']);
|
||||
}
|
||||
$compiler->has_code = false;
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@ class ForClose extends Base {
|
||||
*
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
$compiler->loopNesting--;
|
||||
|
||||
[$openTag, $nocache_pushed] = $this->closeTag($compiler, ['for', 'forelse']);
|
||||
|
||||
@@ -21,7 +21,8 @@ class ForElse extends Base {
|
||||
*
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
[$tagName, $nocache_pushed] = $this->closeTag($compiler, ['for']);
|
||||
$this->openTag($compiler, 'forelse', ['forelse', $nocache_pushed]);
|
||||
return "<?php }} else { ?>";
|
||||
|
||||
@@ -28,7 +28,8 @@ class ForTag extends Base {
|
||||
*
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
$compiler->loopNesting++;
|
||||
if ($parameter === 0) {
|
||||
$this->required_attributes = ['start', 'to'];
|
||||
|
||||
@@ -29,7 +29,8 @@ class ForeachClose extends Base {
|
||||
* @return string compiled code
|
||||
* @throws \Smarty\CompilerException
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
$compiler->loopNesting--;
|
||||
|
||||
[$openTag, $nocache_pushed, $localVariablePrefix, $item, $restore] = $this->closeTag($compiler, ['foreach', 'foreachelse']);
|
||||
|
||||
@@ -20,7 +20,8 @@ class ForeachElse extends Base {
|
||||
*
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
|
||||
[$openTag, $nocache_pushed, $localVariablePrefix, $item, $restore] = $this->closeTag($compiler, ['foreach']);
|
||||
$this->openTag($compiler, 'foreachelse', ['foreachelse', $nocache_pushed, $localVariablePrefix, $item, false]);
|
||||
|
||||
@@ -79,7 +79,8 @@ class ForeachTag extends ForeachSection {
|
||||
* @throws \Smarty\CompilerException
|
||||
* @throws \Smarty\Exception
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
$compiler->loopNesting++;
|
||||
// init
|
||||
$this->isNamed = false;
|
||||
|
||||
@@ -33,9 +33,10 @@ class FunctionClose extends Base {
|
||||
* @param array $args array with attributes from parser
|
||||
* @param object|\Smarty\Compiler\Template $compiler compiler object
|
||||
*
|
||||
* @return bool true
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
$this->compiler = $compiler;
|
||||
$saved_data = $this->closeTag($compiler, ['function']);
|
||||
$_attr = $saved_data[0];
|
||||
@@ -140,7 +141,7 @@ class FunctionClose extends Base {
|
||||
// restore old status
|
||||
$compiler->getTemplate()->getCompiled()->setNocacheCode($saved_data[2]);
|
||||
$compiler->getTemplate()->caching = $saved_data[3];
|
||||
return true;
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,10 +42,11 @@ class FunctionTag extends Base {
|
||||
* @param array $args array with attributes from parser
|
||||
* @param \Smarty\Compiler\Template $compiler compiler object
|
||||
*
|
||||
* @return bool true
|
||||
* @return string compiled code
|
||||
* @throws \Smarty\CompilerException
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
if ($_attr['nocache'] === true) {
|
||||
@@ -67,6 +68,6 @@ class FunctionTag extends Base {
|
||||
// Init temporary context
|
||||
$compiler->getParser()->current_buffer = new \Smarty\ParseTree\Template();
|
||||
$compiler->getTemplate()->getCompiled()->setNocacheCode(false);
|
||||
return true;
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,8 @@ class IfClose extends Base {
|
||||
*
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
|
||||
[$nesting, $nocache_pushed] = $this->closeTag($compiler, ['if', 'else', 'elseif']);
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@ class IfTag extends Base {
|
||||
* @return string compiled code
|
||||
* @throws \Smarty\CompilerException
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
|
||||
if ($compiler->tag_nocache) {
|
||||
// push a {nocache} tag onto the stack to prevent caching of this block
|
||||
|
||||
@@ -67,7 +67,8 @@ class IncludeTag extends Base {
|
||||
* @throws \Smarty\CompilerException
|
||||
* @throws \Smarty\Exception
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
$uid = $t_hash = null;
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
|
||||
@@ -30,7 +30,8 @@ class Ldelim extends Base {
|
||||
* @return string compiled code
|
||||
* @throws \Smarty\CompilerException
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
if ($_attr['nocache'] === true) {
|
||||
$compiler->trigger_template_error('nocache option not allowed', null, true);
|
||||
|
||||
@@ -26,12 +26,11 @@ class Nocache extends Base {
|
||||
* @param array $args array with attributes from parser
|
||||
* @param \Smarty\Compiler\Template $compiler compiler object
|
||||
*
|
||||
* @return bool
|
||||
* @return string
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
$this->openTag($compiler, 'nocache');
|
||||
// this tag does not return compiled code
|
||||
$compiler->has_code = false;
|
||||
return true;
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -27,12 +27,11 @@ class NocacheClose extends Base {
|
||||
* @param array $args array with attributes from parser
|
||||
* @param \Smarty\Compiler\Template $compiler compiler object
|
||||
*
|
||||
* @return bool
|
||||
* @return string
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
$this->closeTag($compiler, ['nocache']);
|
||||
// this tag does not return compiled code
|
||||
$compiler->has_code = false;
|
||||
return true;
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ class Rdelim extends Ldelim {
|
||||
* @return string compiled code
|
||||
* @throws \Smarty\CompilerException
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
parent::compile($args, $compiler);
|
||||
return $compiler->getTemplate()->getRightDelimiter();
|
||||
}
|
||||
|
||||
@@ -82,7 +82,8 @@ class Section extends ForeachSection {
|
||||
* @throws \Smarty\CompilerException
|
||||
* @throws \Smarty\Exception
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
$compiler->loopNesting++;
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
|
||||
@@ -25,7 +25,8 @@ class SectionClose extends Base {
|
||||
*
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
$compiler->loopNesting--;
|
||||
|
||||
[$openTag, $nocache_pushed] = $this->closeTag($compiler, ['section', 'sectionelse']);
|
||||
|
||||
@@ -20,7 +20,8 @@ class SectionElse extends Base {
|
||||
*
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
[$openTag, $nocache_pushed] = $this->closeTag($compiler, ['section']);
|
||||
$this->openTag($compiler, 'sectionelse', ['sectionelse', $nocache_pushed]);
|
||||
return "<?php }} else {\n ?>";
|
||||
|
||||
@@ -21,7 +21,8 @@ class Setfilter extends Base {
|
||||
*
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
$compiler->variable_filter_stack[] = $compiler->getSmarty()->getDefaultModifiers();
|
||||
|
||||
// The modifier_list is passed as an array of array's. The inner arrays have the modifier at index 0,
|
||||
@@ -34,8 +35,6 @@ class Setfilter extends Base {
|
||||
|
||||
$compiler->getSmarty()->setDefaultModifiers($newList);
|
||||
|
||||
// this tag does not return compiled code
|
||||
$compiler->has_code = false;
|
||||
return true;
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,8 @@ class SetfilterClose extends Base {
|
||||
*
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
$this->getAttributes($compiler, $args);
|
||||
|
||||
// reset variable filter to previous state
|
||||
@@ -37,8 +38,6 @@ class SetfilterClose extends Base {
|
||||
count($compiler->variable_filter_stack) ? array_pop($compiler->variable_filter_stack) : []
|
||||
);
|
||||
|
||||
// this tag does not return compiled code
|
||||
$compiler->has_code = false;
|
||||
return true;
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ class WhileClose extends Base {
|
||||
*
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
$compiler->loopNesting--;
|
||||
|
||||
$nocache_pushed = $this->closeTag($compiler, ['while']);
|
||||
|
||||
@@ -22,7 +22,8 @@ class WhileTag extends Base {
|
||||
* @return string compiled code
|
||||
* @throws \Smarty\CompilerException
|
||||
*/
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
|
||||
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
$compiler->loopNesting++;
|
||||
|
||||
if ($compiler->tag_nocache) {
|
||||
|
||||
@@ -184,13 +184,6 @@ class Template extends BaseCompiler {
|
||||
*/
|
||||
public $prefixCodeStack = [];
|
||||
|
||||
/**
|
||||
* Tag has compiled code
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $has_code = false;
|
||||
|
||||
/**
|
||||
* A variable string was compiled
|
||||
*
|
||||
@@ -687,7 +680,8 @@ class Template extends BaseCompiler {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function appendCode($left, $right) {
|
||||
public function appendCode(string $left, string $right): string
|
||||
{
|
||||
if (preg_match('/\s*\?>\s?$/D', $left) && preg_match('/^<\?php\s+/', $right)) {
|
||||
$left = preg_replace('/\s*\?>\s?$/D', "\n", $left);
|
||||
$left .= preg_replace('/^<\?php\s+/', '', $right);
|
||||
@@ -1063,7 +1057,7 @@ class Template extends BaseCompiler {
|
||||
$prefixArray = array_merge($this->prefix_code, array_pop($this->prefixCodeStack));
|
||||
$this->prefixCodeStack[] = [];
|
||||
foreach ($prefixArray as $c) {
|
||||
$code = $this->appendCode($code, $c);
|
||||
$code = $this->appendCode($code, (string) $c);
|
||||
}
|
||||
$this->prefix_code = [];
|
||||
return $code;
|
||||
@@ -1074,12 +1068,10 @@ class Template extends BaseCompiler {
|
||||
}
|
||||
|
||||
public function compileChildBlock() {
|
||||
$this->has_code = true;
|
||||
return $this->blockCompiler->compileChild($this);
|
||||
}
|
||||
|
||||
public function compileParentBlock() {
|
||||
$this->has_code = true;
|
||||
return $this->blockCompiler->compileParent($this);
|
||||
}
|
||||
|
||||
@@ -1096,8 +1088,6 @@ class Template extends BaseCompiler {
|
||||
*/
|
||||
private function compileTag2($tag, $args, $parameter) {
|
||||
// $args contains the attributes parsed and compiled by the lexer/parser
|
||||
// assume that tag does compile into code, but creates no HTML output
|
||||
$this->has_code = true;
|
||||
|
||||
$this->handleNocacheFlag($args);
|
||||
|
||||
@@ -1106,12 +1096,10 @@ class Template extends BaseCompiler {
|
||||
if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) {
|
||||
$this->tag_nocache = $this->tag_nocache | !$tagCompiler->isCacheable();
|
||||
$_output = $tagCompiler->compile($args, $this, $parameter);
|
||||
if ($_output !== false) {
|
||||
if (!empty($parameter['modifierlist'])) {
|
||||
throw new CompilerException('No modifiers allowed on ' . $tag);
|
||||
}
|
||||
return $this->has_code && $_output !== true ? $_output : null;
|
||||
if (!empty($parameter['modifierlist'])) {
|
||||
throw new CompilerException('No modifiers allowed on ' . $tag);
|
||||
}
|
||||
return $_output;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1124,8 +1112,7 @@ class Template extends BaseCompiler {
|
||||
|
||||
$args['_attr']['name'] = "'{$tag}'";
|
||||
$tagCompiler = $this->getTagCompiler('call');
|
||||
$_output = $tagCompiler === null ? false : $tagCompiler->compile($args, $this, $parameter);
|
||||
return $this->has_code ? $_output : null;
|
||||
return $tagCompiler === null ? false : $tagCompiler->compile($args, $this, $parameter);
|
||||
}
|
||||
|
||||
// remaining tastes: (object-)function, (object-function-)block, custom-compiler
|
||||
|
||||
+5
-10
@@ -109,7 +109,7 @@ class Data
|
||||
foreach ($tpl_var as $_key => $_val) {
|
||||
$this->assign($_key, $_val, $nocache, $scope);
|
||||
}
|
||||
return;
|
||||
return $this;
|
||||
}
|
||||
switch ($scope ?? $this->getDefaultScope()) {
|
||||
case self::SCOPE_GLOBAL:
|
||||
@@ -163,8 +163,6 @@ class Data
|
||||
* be not cached
|
||||
*
|
||||
* @return Data
|
||||
* @link https://www.smarty.net/docs/en/api.append.tpl
|
||||
*
|
||||
* @api Smarty::append()
|
||||
*/
|
||||
public function append($tpl_var, $value = null, $merge = false, $nocache = false)
|
||||
@@ -218,7 +216,6 @@ class Data
|
||||
*
|
||||
* @return mixed variable value or or array of variables
|
||||
* @api Smarty::getTemplateVars()
|
||||
* @link https://www.smarty.net/docs/en/api.get.template.vars.tpl
|
||||
*
|
||||
*/
|
||||
public function getTemplateVars($varName = null, $searchParents = true)
|
||||
@@ -227,7 +224,10 @@ class Data
|
||||
return $this->getValue($varName, $searchParents);
|
||||
}
|
||||
|
||||
return array_merge($this->parent && $searchParents ? $this->parent->getTemplateVars() : [], $this->tpl_vars);
|
||||
return array_merge(
|
||||
$this->parent && $searchParents ? $this->parent->getTemplateVars() : [],
|
||||
array_map(function(Variable $var) { return $var->getValue(); }, $this->tpl_vars)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -351,7 +351,6 @@ class Data
|
||||
* @param string|array $tpl_var the template variable(s) to clear
|
||||
*
|
||||
* @return Data
|
||||
* @link https://www.smarty.net/docs/en/api.clear.assign.tpl
|
||||
*
|
||||
* @api Smarty::clearAssign()
|
||||
*/
|
||||
@@ -371,7 +370,6 @@ class Data
|
||||
* clear all the assigned template variables.
|
||||
*
|
||||
* @return Data
|
||||
* @link https://www.smarty.net/docs/en/api.clear.all.assign.tpl
|
||||
*
|
||||
* @api Smarty::clearAllAssign()
|
||||
*/
|
||||
@@ -387,7 +385,6 @@ class Data
|
||||
* @param string|null $name variable name or null
|
||||
*
|
||||
* @return Data
|
||||
* @link https://www.smarty.net/docs/en/api.clear.config.tpl
|
||||
*
|
||||
* @api Smarty::clearConfig()
|
||||
*/
|
||||
@@ -440,7 +437,6 @@ class Data
|
||||
*
|
||||
* @return mixed variable value or or array of variables
|
||||
* @throws Exception
|
||||
* @link https://www.smarty.net/docs/en/api.get.config.vars.tpl
|
||||
*
|
||||
* @api Smarty::getConfigVars()
|
||||
*/
|
||||
@@ -462,7 +458,6 @@ class Data
|
||||
|
||||
* @returns $this
|
||||
* @throws \Exception
|
||||
* @link https://www.smarty.net/docs/en/api.config.load.tpl
|
||||
*
|
||||
* @api Smarty::configLoad()
|
||||
*/
|
||||
|
||||
@@ -113,7 +113,6 @@ class DefaultExtension extends Base {
|
||||
* Name: spacify
|
||||
* Purpose: add spaces between characters in a string
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*
|
||||
* @param string $string input string
|
||||
@@ -234,7 +233,6 @@ class DefaultExtension extends Base {
|
||||
* - format: strftime format for output
|
||||
* - default_date: default date if $string is empty
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*
|
||||
* @param string $string input date string
|
||||
@@ -386,7 +384,6 @@ class DefaultExtension extends Base {
|
||||
* Name: escape
|
||||
* Purpose: escape string for output
|
||||
*
|
||||
* @link https://www.smarty.net/docs/en/language.modifier.escape
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*
|
||||
* @param string $string input string
|
||||
@@ -654,8 +651,6 @@ class DefaultExtension extends Base {
|
||||
* Name: regex_replace
|
||||
* Purpose: regular expression search/replace
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.regex.replace.php
|
||||
* regex_replace (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*
|
||||
* @param string $string input string
|
||||
@@ -703,7 +698,6 @@ class DefaultExtension extends Base {
|
||||
* Name: replace
|
||||
* Purpose: simple search/replace
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.replace.php replace (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author Uwe Tews
|
||||
*
|
||||
@@ -726,7 +720,6 @@ class DefaultExtension extends Base {
|
||||
* optionally splitting in the middle of a word, and
|
||||
* appending the $etc string or inserting $etc into the middle.
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.truncate.php truncate (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*
|
||||
* @param string $string input string
|
||||
|
||||
@@ -13,8 +13,6 @@ use Smarty\Template;
|
||||
* @param Template $template template object
|
||||
*
|
||||
* @return string|null
|
||||
*@link https://www.smarty.net/manual/en/language.function.counter.php {counter}
|
||||
* (Smarty online manual)
|
||||
*
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*/
|
||||
|
||||
@@ -26,8 +26,6 @@ use Smarty\Template;
|
||||
* {cycle name=row values="one,two,three" reset=true}
|
||||
* {cycle name=row}
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.cycle.php {cycle}
|
||||
* (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author credit to Mark Priatel <mpriatel@rogers.com>
|
||||
* @author credit to Gerard <gerard@interfold.com>
|
||||
|
||||
@@ -10,8 +10,6 @@ use Smarty\Template;
|
||||
* Name: fetch
|
||||
* Purpose: fetch file, web or ftp data and display results
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.fetch.php {fetch}
|
||||
* (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*
|
||||
* @param array $params parameters
|
||||
|
||||
@@ -27,8 +27,6 @@ use Smarty\Template;
|
||||
* - assign (optional) - assign the output as an array to this variable
|
||||
* - escape (optional) - escape the content (not value), defaults to true
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
|
||||
* (Smarty online manual)
|
||||
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
|
||||
* @author credits to Monte Ohrt <monte at ohrt dot com>
|
||||
* @version 1.0
|
||||
|
||||
@@ -20,8 +20,6 @@ use Smarty\Template;
|
||||
* - basedir - (optional) - base directory for absolute paths, default is environment variable DOCUMENT_ROOT
|
||||
* - path_prefix - prefix for path output (optional, default empty)
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.html.image.php {html_image}
|
||||
* (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author credits to Duda <duda@big.hu>
|
||||
* @version 1.0
|
||||
|
||||
@@ -19,8 +19,6 @@ use Smarty\Template;
|
||||
* - id (optional) - string default not set
|
||||
* - class (optional) - string default not set
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.html.options.php {html_image}
|
||||
* (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de>
|
||||
*
|
||||
|
||||
@@ -27,8 +27,6 @@ use Smarty\Template;
|
||||
* {html_radios values=$ids name='box' separator='<br>' output=$names}
|
||||
* {html_radios values=$ids checked=$checked separator='<br>' output=$names}
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.html.radios.php {html_radios}
|
||||
* (Smarty online manual)
|
||||
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
|
||||
* @author credits to Monte Ohrt <monte at ohrt dot com>
|
||||
* @version 1.0
|
||||
|
||||
@@ -26,8 +26,6 @@ use Smarty\Template;
|
||||
* - 2.0 complete rewrite for performance,
|
||||
* added attributes month_names, *_id
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date}
|
||||
* (Smarty online manual)
|
||||
* @version 2.0
|
||||
* @author Andrei Zmievski
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
|
||||
@@ -9,8 +9,6 @@ use Smarty\Template;
|
||||
* Name: html_select_time
|
||||
* Purpose: Prints the dropdowns for time selection
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time}
|
||||
* (Smarty online manual)
|
||||
* @author Roberto Berto <roberto@berto.net>
|
||||
* @author Monte Ohrt <monte AT ohrt DOT com>
|
||||
*
|
||||
|
||||
@@ -37,8 +37,6 @@ use Smarty\Template;
|
||||
* @return string
|
||||
*@author credit to boots <boots dot smarty at yahoo dot com>
|
||||
* @version 1.1
|
||||
* @link https://www.smarty.net/manual/en/language.function.html.table.php {html_table}
|
||||
* (Smarty online manual)
|
||||
*
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author credit to Messju Mohr <messju at lammfellpuschen dot de>
|
||||
|
||||
@@ -35,8 +35,6 @@ use Smarty\Template;
|
||||
* {mailto address="me@domain.com" cc="you@domain.com,they@domain.com"}
|
||||
* {mailto address="me@domain.com" extra='class="mailto"'}
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.mailto.php {mailto}
|
||||
* (Smarty online manual)
|
||||
* @version 1.2
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author credits to Jason Sweat (added cc, bcc and subject functionality)
|
||||
|
||||
@@ -10,8 +10,6 @@ use Smarty\Template;
|
||||
* Name: math
|
||||
* Purpose: handle math computations in template
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.math.php {math}
|
||||
* (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*
|
||||
* @param array $params parameters
|
||||
|
||||
+39
-39
@@ -567,7 +567,7 @@ class TemplateLexer
|
||||
public function yylex3()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern3)) {
|
||||
$this->yy_global_pattern3 = $this->replace("/\G(\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*([!=][=]{1,2}|[<][=>]?|[>][=]?|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even|div)\\s+by\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G([!]\\s*|not\\s+)|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G(array\\s*[(]\\s*)|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|][@]?)|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G([\S\s])/isS");
|
||||
$this->yy_global_pattern3 = $this->replace("/\G(\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+(not\\s+)?in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*([!=][=]{1,2}|[<][=>]?|[>][=]?|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even|div)\\s+by\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G([!]\\s*|not\\s+)|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G(array\\s*[(]\\s*)|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|][@]?)|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G([\S\s])/isS");
|
||||
}
|
||||
if (!isset($this->dataLength)) {
|
||||
$this->dataLength = strlen($this->data);
|
||||
@@ -659,122 +659,122 @@ class TemplateLexer
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_ISIN;
|
||||
}
|
||||
public function yy_r3_9()
|
||||
public function yy_r3_10()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_AS;
|
||||
}
|
||||
public function yy_r3_10()
|
||||
public function yy_r3_11()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_TO;
|
||||
}
|
||||
public function yy_r3_11()
|
||||
public function yy_r3_12()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_STEP;
|
||||
}
|
||||
public function yy_r3_12()
|
||||
public function yy_r3_13()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_INSTANCEOF;
|
||||
}
|
||||
public function yy_r3_13()
|
||||
public function yy_r3_14()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_LOGOP;
|
||||
}
|
||||
public function yy_r3_15()
|
||||
public function yy_r3_16()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_SLOGOP;
|
||||
}
|
||||
public function yy_r3_17()
|
||||
public function yy_r3_18()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_TLOGOP;
|
||||
}
|
||||
public function yy_r3_20()
|
||||
public function yy_r3_21()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_SINGLECOND;
|
||||
}
|
||||
public function yy_r3_23()
|
||||
public function yy_r3_24()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_NOT;
|
||||
}
|
||||
public function yy_r3_24()
|
||||
public function yy_r3_25()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_TYPECAST;
|
||||
}
|
||||
public function yy_r3_28()
|
||||
public function yy_r3_29()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_OPENP;
|
||||
}
|
||||
public function yy_r3_29()
|
||||
public function yy_r3_30()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_CLOSEP;
|
||||
}
|
||||
public function yy_r3_30()
|
||||
public function yy_r3_31()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_OPENB;
|
||||
}
|
||||
public function yy_r3_31()
|
||||
public function yy_r3_32()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_CLOSEB;
|
||||
}
|
||||
public function yy_r3_32()
|
||||
public function yy_r3_33()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_PTR;
|
||||
}
|
||||
public function yy_r3_33()
|
||||
public function yy_r3_34()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_APTR;
|
||||
}
|
||||
public function yy_r3_34()
|
||||
public function yy_r3_35()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_EQUAL;
|
||||
}
|
||||
public function yy_r3_35()
|
||||
public function yy_r3_36()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_INCDEC;
|
||||
}
|
||||
public function yy_r3_37()
|
||||
public function yy_r3_38()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_UNIMATH;
|
||||
}
|
||||
public function yy_r3_39()
|
||||
public function yy_r3_40()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_MATH;
|
||||
}
|
||||
public function yy_r3_41()
|
||||
public function yy_r3_42()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_AT;
|
||||
}
|
||||
public function yy_r3_42()
|
||||
public function yy_r3_43()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_ARRAYOPEN;
|
||||
}
|
||||
public function yy_r3_43()
|
||||
public function yy_r3_44()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_HATCH;
|
||||
}
|
||||
public function yy_r3_44()
|
||||
public function yy_r3_45()
|
||||
{
|
||||
|
||||
// resolve conflicts with shorttag and right_delimiter starting with '='
|
||||
@@ -786,73 +786,73 @@ class TemplateLexer
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_ATTR;
|
||||
}
|
||||
}
|
||||
public function yy_r3_45()
|
||||
public function yy_r3_46()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_NAMESPACE;
|
||||
}
|
||||
public function yy_r3_48()
|
||||
public function yy_r3_49()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_ID;
|
||||
}
|
||||
public function yy_r3_49()
|
||||
public function yy_r3_50()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_INTEGER;
|
||||
}
|
||||
public function yy_r3_50()
|
||||
public function yy_r3_51()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_BACKTICK;
|
||||
$this->yypopstate();
|
||||
}
|
||||
public function yy_r3_51()
|
||||
public function yy_r3_52()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_VERT;
|
||||
}
|
||||
public function yy_r3_52()
|
||||
public function yy_r3_53()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_DOT;
|
||||
}
|
||||
public function yy_r3_53()
|
||||
public function yy_r3_54()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_COMMA;
|
||||
}
|
||||
public function yy_r3_54()
|
||||
public function yy_r3_55()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_SEMICOLON;
|
||||
}
|
||||
public function yy_r3_55()
|
||||
public function yy_r3_56()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_DOUBLECOLON;
|
||||
}
|
||||
public function yy_r3_56()
|
||||
public function yy_r3_57()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_COLON;
|
||||
}
|
||||
public function yy_r3_57()
|
||||
public function yy_r3_58()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_QMARK;
|
||||
}
|
||||
public function yy_r3_58()
|
||||
public function yy_r3_59()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_HEX;
|
||||
}
|
||||
public function yy_r3_59()
|
||||
public function yy_r3_60()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_SPACE;
|
||||
}
|
||||
public function yy_r3_60()
|
||||
public function yy_r3_61()
|
||||
{
|
||||
|
||||
$this->token = \Smarty\Parser\TemplateParser::TP_TEXT;
|
||||
|
||||
@@ -324,7 +324,7 @@ class TemplateLexer
|
||||
slop = ~\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\s+~
|
||||
tlop = ~\s+is\s+(not\s+)?(odd|even|div)\s+by\s+~
|
||||
scond = ~\s+is\s+(not\s+)?(odd|even)~
|
||||
isin = ~\s+is\s+in\s+~
|
||||
isin = ~\s+is\s+(not\s+)?in\s+~
|
||||
as = ~\s+as\s+~
|
||||
to = ~\s+to\s+~
|
||||
step = ~\s+step\s+~
|
||||
|
||||
@@ -47,18 +47,18 @@ class Dq extends Base
|
||||
if ($subtree instanceof Code) {
|
||||
$this->subtrees[ $last_subtree ]->data =
|
||||
$parser->compiler->appendCode(
|
||||
$this->subtrees[ $last_subtree ]->data,
|
||||
(string) $this->subtrees[ $last_subtree ]->data,
|
||||
'<?php echo ' . $subtree->data . ';?>'
|
||||
);
|
||||
} elseif ($subtree instanceof DqContent) {
|
||||
$this->subtrees[ $last_subtree ]->data =
|
||||
$parser->compiler->appendCode(
|
||||
$this->subtrees[ $last_subtree ]->data,
|
||||
(string) $this->subtrees[ $last_subtree ]->data,
|
||||
'<?php echo "' . $subtree->data . '";?>'
|
||||
);
|
||||
} else {
|
||||
$this->subtrees[ $last_subtree ]->data =
|
||||
$parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data, $subtree->data);
|
||||
$parser->compiler->appendCode((string) $this->subtrees[ $last_subtree ]->data, (string) $subtree->data);
|
||||
}
|
||||
} else {
|
||||
$this->subtrees[] = $subtree;
|
||||
|
||||
@@ -62,9 +62,9 @@ class Tag extends Base
|
||||
public function assign_to_var(\Smarty\Parser\TemplateParser $parser)
|
||||
{
|
||||
$var = $parser->compiler->getNewPrefixVariable();
|
||||
$tmp = $parser->compiler->appendCode('<?php ob_start();?>', $this->data);
|
||||
$tmp = $parser->compiler->appendCode('<?php ob_start();?>', (string) $this->data);
|
||||
$tmp = $parser->compiler->appendCode($tmp, "<?php {$var}=ob_get_clean();?>");
|
||||
$parser->compiler->appendPrefixCode((string) $tmp);
|
||||
$parser->compiler->appendPrefixCode($tmp);
|
||||
return $var;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ class Template extends Base
|
||||
break;
|
||||
case 'tag':
|
||||
foreach ($chunk['subtrees'] as $subtree) {
|
||||
$text = $parser->compiler->appendCode($text, $subtree->to_smarty_php($parser));
|
||||
$text = $parser->compiler->appendCode($text, (string) $subtree->to_smarty_php($parser));
|
||||
}
|
||||
$code .= $text;
|
||||
break;
|
||||
|
||||
+908
-860
File diff suppressed because it is too large
Load Diff
@@ -290,9 +290,7 @@ literal_e1(A) ::= . {
|
||||
}
|
||||
// Smarty tag
|
||||
template ::= template smartytag(B). {
|
||||
if ($this->compiler->has_code) {
|
||||
$this->current_buffer->append_subtree($this, $this->mergePrefixCode(B));
|
||||
}
|
||||
$this->current_buffer->append_subtree($this, $this->mergePrefixCode(B));
|
||||
$this->compiler->has_variable_string = false;
|
||||
$this->block_nesting_level = $this->compiler->getTagStackCount();
|
||||
}
|
||||
@@ -665,12 +663,21 @@ expr(res) ::= expr(e1) scond(c). {
|
||||
res = c . e1 . ')';
|
||||
}
|
||||
|
||||
expr(res) ::= expr(e1) ISIN array(a). {
|
||||
res = 'in_array('.e1.','.a.')';
|
||||
isin(res) ::= ISIN(o). {
|
||||
static $isin = [
|
||||
'isin' => 'in_array(',
|
||||
'isnotin' => '!in_array(',
|
||||
];
|
||||
$op = strtolower(str_replace(' ', '', o));
|
||||
res = $isin[$op];
|
||||
}
|
||||
|
||||
expr(res) ::= expr(e1) ISIN value(v). {
|
||||
res = 'in_array('.e1.',(array)'.v.')';
|
||||
expr(res) ::= expr(e1) isin(c) array(a). {
|
||||
res = c . e1.','.a.')';
|
||||
}
|
||||
|
||||
expr(res) ::= expr(e1) isin(c) value(v). {
|
||||
res = c . e1.',(array)'.v.')';
|
||||
}
|
||||
|
||||
// null coalescing
|
||||
@@ -798,7 +805,7 @@ value(res) ::= varindexed(vi) DOUBLECOLON static_class_access(r). {
|
||||
// Smarty tag
|
||||
value(res) ::= smartytag(st). {
|
||||
$prefixVar = $this->compiler->getNewPrefixVariable();
|
||||
$tmp = $this->compiler->appendCode('<?php ob_start();?>', st);
|
||||
$tmp = $this->compiler->appendCode('<?php ob_start();?>', (string) st);
|
||||
$this->compiler->appendPrefixCode($this->compiler->appendCode($tmp, "<?php {$prefixVar} = ob_get_clean();?>"));
|
||||
res = $prefixVar;
|
||||
}
|
||||
|
||||
@@ -116,22 +116,20 @@ class ForeachRuntime {
|
||||
*
|
||||
* @return int the count for arrays and objects that implement countable, 1 for other objects that don't, and 0
|
||||
* for empty elements
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function count($value) {
|
||||
if ($value instanceof IteratorAggregate) {
|
||||
public function count($value): int
|
||||
{
|
||||
if ($value instanceof \IteratorAggregate) {
|
||||
// Note: getIterator() returns a Traversable, not an Iterator
|
||||
// thus rewind() and valid() methods may not be present
|
||||
return iterator_count($value->getIterator());
|
||||
} elseif ($value instanceof Iterator) {
|
||||
return $value instanceof Generator ? 1 : iterator_count($value);
|
||||
} elseif ($value instanceof Countable) {
|
||||
} elseif ($value instanceof \Iterator) {
|
||||
return $value instanceof \Generator ? 1 : iterator_count($value);
|
||||
} elseif ($value instanceof \Countable) {
|
||||
return count($value);
|
||||
} elseif ($value instanceof PDOStatement) {
|
||||
return $value->rowCount();
|
||||
} elseif ($value instanceof Traversable) {
|
||||
return iterator_count($value);
|
||||
}
|
||||
return count((array)$value);
|
||||
return count((array) $value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+32
-47
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Smarty;
|
||||
|
||||
use FilesystemIterator;
|
||||
use RecursiveDirectoryIterator;
|
||||
use RecursiveIteratorIterator;
|
||||
use Smarty\Cacheresource\File;
|
||||
@@ -12,11 +13,12 @@ use Smarty\Extension\CoreExtension;
|
||||
use Smarty\Extension\DefaultExtension;
|
||||
use Smarty\Extension\ExtensionInterface;
|
||||
use Smarty\Filter\Output\TrimWhitespace;
|
||||
use Smarty\Resource\BasePlugin;
|
||||
use Smarty\Smarty\Runtime\CaptureRuntime;
|
||||
use Smarty\Smarty\Runtime\ForeachRuntime;
|
||||
use Smarty\Smarty\Runtime\InheritanceRuntime;
|
||||
use Smarty\Smarty\Runtime\TplFunctionRuntime;
|
||||
use Smarty\Runtime\CaptureRuntime;
|
||||
use Smarty\Runtime\DefaultPluginHandlerRuntime;
|
||||
use Smarty\Runtime\ForeachRuntime;
|
||||
use Smarty\Runtime\InheritanceRuntime;
|
||||
use Smarty\Runtime\TplFunctionRuntime;
|
||||
|
||||
|
||||
/**
|
||||
* Project: Smarty: the PHP compiling template engine
|
||||
@@ -38,7 +40,6 @@ use Smarty\Smarty\Runtime\TplFunctionRuntime;
|
||||
* Smarty mailing list. Send a blank e-mail to
|
||||
* smarty-discussion-subscribe@googlegroups.com
|
||||
*
|
||||
* @link https://www.smarty.net/
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author Uwe Tews <uwe dot tews at gmail dot com>
|
||||
* @author Rodney Rehm
|
||||
@@ -53,7 +54,7 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
/**
|
||||
* smarty version
|
||||
*/
|
||||
const SMARTY_VERSION = '5.0.0-rc3';
|
||||
const SMARTY_VERSION = '5.1.0';
|
||||
|
||||
/**
|
||||
* define caching modes
|
||||
@@ -534,8 +535,6 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
/**
|
||||
* Load an additional extension.
|
||||
*
|
||||
* @param Base $extension
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addExtension(ExtensionInterface $extension) {
|
||||
@@ -581,7 +580,7 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
*
|
||||
* @param string|\Smarty\Security $security_class if a string is used, it must be class-name
|
||||
*
|
||||
* @return Smarty current Smarty instance for chaining
|
||||
* @return static current Smarty instance for chaining
|
||||
* @throws \Smarty\Exception
|
||||
*/
|
||||
public function enableSecurity($security_class = null) {
|
||||
@@ -592,7 +591,7 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
/**
|
||||
* Disable security
|
||||
*
|
||||
* @return Smarty current Smarty instance for chaining
|
||||
* @return static current Smarty instance for chaining
|
||||
*/
|
||||
public function disableSecurity() {
|
||||
$this->security_policy = null;
|
||||
@@ -606,7 +605,7 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
* @param string $key of the array element to assign the template dir to
|
||||
* @param bool $isConfig true for config_dir
|
||||
*
|
||||
* @return Smarty current Smarty instance for chaining
|
||||
* @return static current Smarty instance for chaining
|
||||
*/
|
||||
public function addTemplateDir($template_dir, $key = null, $isConfig = false) {
|
||||
if ($isConfig) {
|
||||
@@ -671,7 +670,7 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
* @param string|array $template_dir directory(s) of template sources
|
||||
* @param bool $isConfig true for config_dir
|
||||
*
|
||||
* @return Smarty current Smarty instance for chaining
|
||||
* @return static current Smarty instance for chaining
|
||||
*/
|
||||
public function setTemplateDir($template_dir, $isConfig = false) {
|
||||
if ($isConfig) {
|
||||
@@ -691,7 +690,7 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
* @param string|array $config_dir directory(s) of config sources
|
||||
* @param mixed $key key of the array element to assign the config dir to
|
||||
*
|
||||
* @return Smarty current Smarty instance for chaining
|
||||
* @return static current Smarty instance for chaining
|
||||
*/
|
||||
public function addConfigDir($config_dir, $key = null) {
|
||||
return $this->addTemplateDir($config_dir, $key, true);
|
||||
@@ -713,7 +712,7 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
*
|
||||
* @param $config_dir
|
||||
*
|
||||
* @return Smarty current Smarty instance for chaining
|
||||
* @return static current Smarty instance for chaining
|
||||
*/
|
||||
public function setConfigDir($config_dir) {
|
||||
return $this->setTemplateDir($config_dir, true);
|
||||
@@ -729,7 +728,6 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
*
|
||||
* @return $this
|
||||
* @throws \Smarty\Exception
|
||||
* @link https://www.smarty.net/docs/en/api.register.plugin.tpl
|
||||
*
|
||||
* @api Smarty::registerPlugin()
|
||||
*/
|
||||
@@ -756,7 +754,6 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
* @param string $name name of template tag
|
||||
*
|
||||
* @return array|null
|
||||
* @link https://www.smarty.net/docs/en/api.unregister.plugin.tpl
|
||||
*
|
||||
* @api Smarty::unregisterPlugin()
|
||||
*/
|
||||
@@ -774,7 +771,6 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
* @param string $name name of template tag
|
||||
*
|
||||
* @return $this
|
||||
* @link https://www.smarty.net/docs/en/api.unregister.plugin.tpl
|
||||
*
|
||||
* @api Smarty::unregisterPlugin()
|
||||
*/
|
||||
@@ -790,7 +786,7 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
*
|
||||
* @param null|array|string $plugins_dir
|
||||
*
|
||||
* @return Smarty current Smarty instance for chaining
|
||||
* @return static current Smarty instance for chaining
|
||||
* @deprecated since 5.0
|
||||
*/
|
||||
public function addPluginsDir($plugins_dir) {
|
||||
@@ -823,7 +819,7 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
*
|
||||
* @param string|array $plugins_dir directory(s) of plugins
|
||||
*
|
||||
* @return Smarty current Smarty instance for chaining
|
||||
* @return static current Smarty instance for chaining
|
||||
* @deprecated since 5.0
|
||||
*/
|
||||
public function setPluginsDir($plugins_dir) {
|
||||
@@ -848,7 +844,6 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
*
|
||||
* @return $this
|
||||
* @throws Exception if $callback is not callable
|
||||
* @link https://www.smarty.net/docs/en/api.register.default.plugin.handler.tpl
|
||||
*
|
||||
* @api Smarty::registerDefaultPluginHandler()
|
||||
*
|
||||
@@ -885,7 +880,7 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
*
|
||||
* @param string $compile_dir directory to store compiled templates in
|
||||
*
|
||||
* @return Smarty current Smarty instance for chaining
|
||||
* @return static current Smarty instance for chaining
|
||||
*/
|
||||
public function setCompileDir($compile_dir) {
|
||||
$this->_normalizeDir('compile_dir', $compile_dir);
|
||||
@@ -911,7 +906,7 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
*
|
||||
* @param string $cache_dir directory to store cached templates in
|
||||
*
|
||||
* @return Smarty current Smarty instance for chaining
|
||||
* @return static current Smarty instance for chaining
|
||||
*/
|
||||
public function setCacheDir($cache_dir) {
|
||||
$this->_normalizeDir('cache_dir', $cache_dir);
|
||||
@@ -1174,7 +1169,7 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
/**
|
||||
* Get Smarty object
|
||||
*
|
||||
* @return Smarty
|
||||
* @return static
|
||||
*/
|
||||
public function getSmarty() {
|
||||
return $this;
|
||||
@@ -1252,7 +1247,6 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
*
|
||||
* @return int number of cache files deleted
|
||||
* @throws \Smarty\Exception
|
||||
* @link https://www.smarty.net/docs/en/api.clear.cache.tpl
|
||||
*
|
||||
* @api Smarty::clearCache()
|
||||
*/
|
||||
@@ -1272,7 +1266,6 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
* @param string $type resource type
|
||||
*
|
||||
* @return int number of cache files deleted
|
||||
* @link https://www.smarty.net/docs/en/api.clear.all.cache.tpl
|
||||
*
|
||||
* @api Smarty::clearAllCache()
|
||||
*/
|
||||
@@ -1289,7 +1282,6 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
*
|
||||
* @return int number of template files deleted
|
||||
* @throws \Smarty\Exception
|
||||
* @link https://www.smarty.net/docs/en/api.clear.compiled.template.tpl
|
||||
*
|
||||
* @api Smarty::clearCompiledTemplate()
|
||||
*/
|
||||
@@ -1755,15 +1747,15 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
// Lazy load runtimes when/if needed
|
||||
switch ($type) {
|
||||
case 'Capture':
|
||||
return $this->runtimes[$type] = new \Smarty\Runtime\CaptureRuntime();
|
||||
return $this->runtimes[$type] = new CaptureRuntime();
|
||||
case 'Foreach':
|
||||
return $this->runtimes[$type] = new \Smarty\Runtime\ForeachRuntime();
|
||||
return $this->runtimes[$type] = new ForeachRuntime();
|
||||
case 'Inheritance':
|
||||
return $this->runtimes[$type] = new \Smarty\Runtime\InheritanceRuntime();
|
||||
return $this->runtimes[$type] = new InheritanceRuntime();
|
||||
case 'TplFunction':
|
||||
return $this->runtimes[$type] = new \Smarty\Runtime\TplFunctionRuntime();
|
||||
return $this->runtimes[$type] = new TplFunctionRuntime();
|
||||
case 'DefaultPluginHandler':
|
||||
return $this->runtimes[$type] = new \Smarty\Runtime\DefaultPluginHandlerRuntime(
|
||||
return $this->runtimes[$type] = new DefaultPluginHandlerRuntime(
|
||||
$this->getDefaultPluginHandlerFunc()
|
||||
);
|
||||
}
|
||||
@@ -1803,7 +1795,6 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
* @return bool
|
||||
* @throws \Smarty\Exception
|
||||
* @api Smarty::loadFilter()
|
||||
* @link https://www.smarty.net/docs/en/api.load.filter.tpl
|
||||
*
|
||||
* @deprecated since 5.0
|
||||
*/
|
||||
@@ -1851,11 +1842,10 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
* @param string $type filter type
|
||||
* @param string $name filter name
|
||||
*
|
||||
* @return TemplateBase
|
||||
* @return static
|
||||
* @throws \Smarty\Exception
|
||||
* @api Smarty::unloadFilter()
|
||||
*
|
||||
* @link https://www.smarty.net/docs/en/api.unload.filter.tpl
|
||||
*
|
||||
* @deprecated since 5.0
|
||||
*/
|
||||
@@ -1898,8 +1888,7 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
* @param string $name name of resource type
|
||||
* @param Base $resource_handler
|
||||
*
|
||||
* @return Smarty
|
||||
* @link https://www.smarty.net/docs/en/api.register.cacheresource.tpl
|
||||
* @return static
|
||||
*
|
||||
* @api Smarty::registerCacheResource()
|
||||
*
|
||||
@@ -1920,9 +1909,8 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
*
|
||||
* @param $name
|
||||
*
|
||||
* @return Smarty
|
||||
* @return static
|
||||
* @api Smarty::unregisterCacheResource()
|
||||
* @link https://www.smarty.net/docs/en/api.unregister.cacheresource.tpl
|
||||
*
|
||||
* @deprecated since 5.0
|
||||
*
|
||||
@@ -1954,9 +1942,8 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
* @param callable $callback
|
||||
* @param string|null $name optional filter name
|
||||
*
|
||||
* @return TemplateBase
|
||||
* @return static
|
||||
* @throws \Smarty\Exception
|
||||
* @link https://www.smarty.net/docs/en/api.register.filter.tpl
|
||||
*
|
||||
* @api Smarty::registerFilter()
|
||||
*/
|
||||
@@ -2014,11 +2001,10 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
* @param string $type filter type
|
||||
* @param callback|string $name the name previously used in ::registerFilter
|
||||
*
|
||||
* @return TemplateBase
|
||||
* @return static
|
||||
* @throws \Smarty\Exception
|
||||
* @api Smarty::unregisterFilter()
|
||||
*
|
||||
* @link https://www.smarty.net/docs/en/api.unregister.filter.tpl
|
||||
*
|
||||
*/
|
||||
public function unregisterFilter($type, $name) {
|
||||
@@ -2052,7 +2038,7 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
* @param array|string $modifiers modifier or list of modifiers
|
||||
* to add
|
||||
*
|
||||
* @return \Smarty|Template
|
||||
* @return static
|
||||
* @api Smarty::addDefaultModifiers()
|
||||
*
|
||||
*/
|
||||
@@ -2082,7 +2068,7 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
* @param array|string $modifiers modifier or list of modifiers
|
||||
* to set
|
||||
*
|
||||
* @return TemplateBase
|
||||
* @return static
|
||||
* @api Smarty::setDefaultModifiers()
|
||||
*
|
||||
*/
|
||||
@@ -2131,7 +2117,7 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
* @throws \Smarty\Exception
|
||||
*/
|
||||
public function display($template = null, $cache_id = null, $compile_id = null) {
|
||||
return $this->returnOrCreateTemplate($template, $cache_id, $compile_id)->display();
|
||||
$this->returnOrCreateTemplate($template, $cache_id, $compile_id)->display();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2201,7 +2187,6 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
* @return bool cache status
|
||||
* @throws \Exception
|
||||
* @throws \Smarty\Exception
|
||||
* @link https://www.smarty.net/docs/en/api.is.cached.tpl
|
||||
*
|
||||
* @api Smarty::isCached()
|
||||
*/
|
||||
|
||||
+3
-1
@@ -555,6 +555,9 @@ class Template extends TemplateBase {
|
||||
*/
|
||||
public function getStreamVariable($variable)
|
||||
{
|
||||
|
||||
trigger_error("Using stream variables (\`\{\$foo:bar\}\`)is deprecated.", E_USER_DEPRECATED);
|
||||
|
||||
$_result = '';
|
||||
$fp = fopen($variable, 'r+');
|
||||
if ($fp) {
|
||||
@@ -601,7 +604,6 @@ class Template extends TemplateBase {
|
||||
* @return bool cache status
|
||||
* @throws \Exception
|
||||
* @throws \Smarty\Exception
|
||||
* @link https://www.smarty.net/docs/en/api.is.cached.tpl
|
||||
*
|
||||
* @api Smarty::isCached()
|
||||
*/
|
||||
|
||||
+11
-18
@@ -73,9 +73,8 @@ abstract class TemplateBase extends Data {
|
||||
* @param bool $format smarty argument format, else traditional
|
||||
* @param array $block_methods list of block-methods
|
||||
*
|
||||
* @return \Smarty|\Smarty\Template
|
||||
* @return static
|
||||
* @throws \Smarty\Exception
|
||||
* @link https://www.smarty.net/docs/en/api.register.object.tpl
|
||||
*
|
||||
* @api Smarty::registerObject()
|
||||
*/
|
||||
@@ -114,9 +113,8 @@ abstract class TemplateBase extends Data {
|
||||
*
|
||||
* @param string $object_name name of object
|
||||
*
|
||||
* @return TemplateBase
|
||||
* @return static
|
||||
* @api Smarty::unregisterObject()
|
||||
* @link https://www.smarty.net/docs/en/api.unregister.object.tpl
|
||||
*
|
||||
*/
|
||||
public function unregisterObject($object_name) {
|
||||
@@ -179,7 +177,6 @@ abstract class TemplateBase extends Data {
|
||||
* @return Data data object
|
||||
* @throws Exception
|
||||
* @api Smarty::createData()
|
||||
* @link https://www.smarty.net/docs/en/api.create.data.tpl
|
||||
*
|
||||
*/
|
||||
public function createData(Data $parent = null, $name = null) {
|
||||
@@ -222,7 +219,6 @@ abstract class TemplateBase extends Data {
|
||||
*
|
||||
* @return object
|
||||
* @throws \Smarty\Exception if no such object is found
|
||||
* @link https://www.smarty.net/docs/en/api.get.registered.object.tpl
|
||||
*
|
||||
* @api Smarty::getRegisteredObject()
|
||||
*/
|
||||
@@ -255,7 +251,7 @@ abstract class TemplateBase extends Data {
|
||||
* @param array|string $literals literal or list of literals
|
||||
* to addto add
|
||||
*
|
||||
* @return TemplateBase
|
||||
* @return static
|
||||
* @throws \Smarty\Exception
|
||||
* @api Smarty::addLiterals()
|
||||
*
|
||||
@@ -273,7 +269,7 @@ abstract class TemplateBase extends Data {
|
||||
* @param array|string $literals literal or list of literals
|
||||
* to setto set
|
||||
*
|
||||
* @return TemplateBase
|
||||
* @return static
|
||||
* @throws \Smarty\Exception
|
||||
* @api Smarty::setLiterals()
|
||||
*
|
||||
@@ -316,10 +312,9 @@ abstract class TemplateBase extends Data {
|
||||
* @param string $class_impl the referenced PHP class to
|
||||
* register
|
||||
*
|
||||
* @return TemplateBase
|
||||
* @return static
|
||||
* @throws \Smarty\Exception
|
||||
* @api Smarty::registerClass()
|
||||
* @link https://www.smarty.net/docs/en/api.register.class.tpl
|
||||
*
|
||||
*/
|
||||
public function registerClass($class_name, $class_impl) {
|
||||
@@ -338,7 +333,7 @@ abstract class TemplateBase extends Data {
|
||||
*
|
||||
* @param callable $callback class/method name
|
||||
*
|
||||
* @return TemplateBase
|
||||
* @return static
|
||||
* @throws Exception if $callback is not callable
|
||||
* @api Smarty::registerDefaultConfigHandler()
|
||||
*
|
||||
@@ -358,7 +353,7 @@ abstract class TemplateBase extends Data {
|
||||
*
|
||||
* @param callable $callback class/method name
|
||||
*
|
||||
* @return TemplateBase
|
||||
* @return static
|
||||
* @throws Exception if $callback is not callable
|
||||
* @api Smarty::registerDefaultTemplateHandler()
|
||||
*
|
||||
@@ -377,10 +372,9 @@ abstract class TemplateBase extends Data {
|
||||
* Registers a resource to fetch a template
|
||||
*
|
||||
* @param string $name name of resource type
|
||||
* @param Smarty\Resource\Base $resource_handler instance of Smarty\Resource\Base
|
||||
* @param \Smarty\Resource\BasePlugin $resource_handler instance of Smarty\Resource\BasePlugin
|
||||
*
|
||||
* @return \Smarty|\Smarty\Template
|
||||
* @link https://www.smarty.net/docs/en/api.register.resource.tpl
|
||||
* @return static
|
||||
*
|
||||
* @api Smarty::registerResource()
|
||||
*/
|
||||
@@ -395,9 +389,8 @@ abstract class TemplateBase extends Data {
|
||||
*
|
||||
* @param string $type name of resource type
|
||||
*
|
||||
* @return TemplateBase
|
||||
* @return static
|
||||
* @api Smarty::unregisterResource()
|
||||
* @link https://www.smarty.net/docs/en/api.unregister.resource.tpl
|
||||
*
|
||||
*/
|
||||
public function unregisterResource($type) {
|
||||
@@ -413,7 +406,7 @@ abstract class TemplateBase extends Data {
|
||||
*
|
||||
* @param string $tpl_name
|
||||
*
|
||||
* @return TemplateBase
|
||||
* @return static
|
||||
* @throws Exception if file is not readable
|
||||
* @api Smarty::setDebugTemplate()
|
||||
*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user