mirror of
https://github.com/smarty-php/smarty.git
synced 2025-09-25 20:00:54 +02:00
Merge branch 'master' into 420upd
This commit is contained in:
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -31,6 +31,7 @@ jobs:
|
|||||||
- "7.4"
|
- "7.4"
|
||||||
- "8.0"
|
- "8.0"
|
||||||
- "8.1"
|
- "8.1"
|
||||||
|
- "8.2"
|
||||||
|
|
||||||
compiler:
|
compiler:
|
||||||
- default
|
- default
|
||||||
@@ -42,6 +43,9 @@ jobs:
|
|||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
php-version: "8.1"
|
php-version: "8.1"
|
||||||
compiler: jit
|
compiler: jit
|
||||||
|
- os: ubuntu-latest
|
||||||
|
php-version: "8.2"
|
||||||
|
compiler: jit
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- PHP8.2 compatibility [#775](https://github.com/smarty-php/smarty/pull/775)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Include docs and demo in the releases [#799](https://github.com/smarty-php/smarty/issues/799)
|
- Include docs and demo in the releases [#799](https://github.com/smarty-php/smarty/issues/799)
|
||||||
- Using PHP functions as modifiers now triggers a deprecation notice because we will drop support for this in the next major release [#813](https://github.com/smarty-php/smarty/issues/813)
|
- Using PHP functions as modifiers now triggers a deprecation notice because we will drop support for this in the next major release [#813](https://github.com/smarty-php/smarty/issues/813)
|
||||||
|
@@ -7,7 +7,7 @@ Smarty is a template engine for PHP, facilitating the separation of presentation
|
|||||||
Read the [documentation](https://smarty-php.github.io/smarty/) to find out how to use it.
|
Read the [documentation](https://smarty-php.github.io/smarty/) to find out how to use it.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
Smarty can be run with PHP 7.1 to PHP 8.1.
|
Smarty can be run with PHP 7.1 to PHP 8.2.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
Smarty versions 3.1.11 or later can be installed with [Composer](https://getcomposer.org/).
|
Smarty versions 3.1.11 or later can be installed with [Composer](https://getcomposer.org/).
|
||||||
|
@@ -38,3 +38,8 @@ services:
|
|||||||
service: base
|
service: base
|
||||||
build:
|
build:
|
||||||
dockerfile: ./utilities/testrunners/php81/Dockerfile
|
dockerfile: ./utilities/testrunners/php81/Dockerfile
|
||||||
|
php82:
|
||||||
|
extends:
|
||||||
|
service: base
|
||||||
|
build:
|
||||||
|
dockerfile: ./utilities/testrunners/php82/Dockerfile
|
||||||
|
@@ -109,7 +109,7 @@ the corresponding error is in the template.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
- This means that your application registered a custom error hander
|
- This means that your application registered a custom error handler
|
||||||
(using [set\_error\_handler()](&url.php-manual;set_error_handler))
|
(using [set\_error\_handler()](&url.php-manual;set_error_handler))
|
||||||
which is not respecting the given `$errno` as it should. If, for
|
which is not respecting the given `$errno` as it should. If, for
|
||||||
whatever reason, this is the desired behaviour of your custom error
|
whatever reason, this is the desired behaviour of your custom error
|
||||||
|
@@ -3,14 +3,14 @@
|
|||||||
|
|
||||||
`{block}` is used to define a named area of template source for template
|
`{block}` is used to define a named area of template source for template
|
||||||
inheritance. For details see section of [Template
|
inheritance. For details see section of [Template
|
||||||
Interitance](#advanced.features.template.inheritance).
|
Inheritance](#advanced.features.template.inheritance).
|
||||||
|
|
||||||
The `{block}` template source area of a child template will replace the
|
The `{block}` template source area of a child template will replace the
|
||||||
correponding areas in the parent template(s).
|
corresponding areas in the parent template(s).
|
||||||
|
|
||||||
Optionally `{block}` areas of child and parent templates can be merged
|
Optionally `{block}` areas of child and parent templates can be merged
|
||||||
into each other. You can append or prepend the parent `{block}` content
|
into each other. You can append or prepend the parent `{block}` content
|
||||||
by using the `append` or `prepend` option flag with the childs `{block}`
|
by using the `append` or `prepend` option flag with the child's `{block}`
|
||||||
definition. With the {\$smarty.block.parent} the `{block}` content of
|
definition. With the {\$smarty.block.parent} the `{block}` content of
|
||||||
the parent template can be inserted at any location of the child
|
the parent template can be inserted at any location of the child
|
||||||
`{block}` content. {\$smarty.block.child} inserts the `{block}` content
|
`{block}` content. {\$smarty.block.child} inserts the `{block}` content
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
`{extends}` tags are used in child templates in template inheritance for
|
`{extends}` tags are used in child templates in template inheritance for
|
||||||
extending parent templates. For details see section of [Template
|
extending parent templates. For details see section of [Template
|
||||||
Interitance](#advanced.features.template.inheritance).
|
Inheritance](#advanced.features.template.inheritance).
|
||||||
|
|
||||||
- The `{extends}` tag must be on the first line of the template.
|
- The `{extends}` tag must be on the first line of the template.
|
||||||
|
|
||||||
@@ -33,5 +33,5 @@ Interitance](#advanced.features.template.inheritance).
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
See also [Template Interitance](#advanced.features.template.inheritance)
|
See also [Template Inheritance](#advanced.features.template.inheritance)
|
||||||
and [`{block}`](#language.function.block).
|
and [`{block}`](#language.function.block).
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
=====
|
=====
|
||||||
|
|
||||||
The `{for}{forelse}` tag is used to create simple loops. The following
|
The `{for}{forelse}` tag is used to create simple loops. The following
|
||||||
different formarts are supported:
|
different formats are supported:
|
||||||
|
|
||||||
- `{for $var=$start to $end}` simple loop with step size of 1.
|
- `{for $var=$start to $end}` simple loop with step size of 1.
|
||||||
|
|
||||||
|
@@ -131,7 +131,7 @@ cache lifetime of 500 seconds.
|
|||||||
|
|
||||||
|
|
||||||
In this example included template will be cached independent of the
|
In this example included template will be cached independent of the
|
||||||
global cahing setting.
|
global caching setting.
|
||||||
|
|
||||||
|
|
||||||
{include 'sub_template.tpl' caching}
|
{include 'sub_template.tpl' caching}
|
||||||
|
@@ -65,7 +65,7 @@ and display the returned results in place of the {insert} tag.
|
|||||||
The path can be either absolute, or relative to
|
The path can be either absolute, or relative to
|
||||||
[`$trusted_dir`](#variable.trusted.dir). If security is enabled,
|
[`$trusted_dir`](#variable.trusted.dir). If security is enabled,
|
||||||
then the script must be located in the `$trusted_dir` path of the
|
then the script must be located in the `$trusted_dir` path of the
|
||||||
securty policy. See the [Security](#advanced.features.security)
|
security policy. See the [Security](#advanced.features.security)
|
||||||
section for details.
|
section for details.
|
||||||
|
|
||||||
The Smarty object is passed as the second argument. This way you can
|
The Smarty object is passed as the second argument. This way you can
|
||||||
|
@@ -251,8 +251,8 @@ The above example will output:
|
|||||||
|
|
||||||
{section}\'s can be nested as deep as you like. With nested
|
{section}\'s can be nested as deep as you like. With nested
|
||||||
{section}\'s, you can access complex data structures, such as
|
{section}\'s, you can access complex data structures, such as
|
||||||
multi-dimensional arrays. This is an example `.php` script thats
|
multi-dimensional arrays. This is an example `.php` script that
|
||||||
assign\'s the arrays.
|
assigns the arrays.
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
@@ -10,7 +10,7 @@ The filter can be:
|
|||||||
|
|
||||||
- A variable filter plugin specified by it\'s name.
|
- A variable filter plugin specified by it\'s name.
|
||||||
|
|
||||||
- A modidier specified by it\'s name and optional additional
|
- A modifier specified by it\'s name and optional additional
|
||||||
parameter.
|
parameter.
|
||||||
|
|
||||||
`{setfilter}...{/setfilter}` blocks can be nested. The filter definition
|
`{setfilter}...{/setfilter}` blocks can be nested. The filter definition
|
||||||
|
@@ -22,7 +22,7 @@ ftp and display the contents.
|
|||||||
>
|
>
|
||||||
> If security is enabled and you are fetching a file from the local
|
> If security is enabled and you are fetching a file from the local
|
||||||
> file system, `{fetch}` will only allow files from within the
|
> file system, `{fetch}` will only allow files from within the
|
||||||
> `$secure_dir` path of the securty policy. See the
|
> `$secure_dir` path of the security policy. See the
|
||||||
> [Security](#advanced.features.security) section for details.
|
> [Security](#advanced.features.security) section for details.
|
||||||
|
|
||||||
- If the `assign` attribute is set, the output of the `{fetch}`
|
- If the `assign` attribute is set, the output of the `{fetch}`
|
||||||
|
@@ -19,7 +19,7 @@ automatically calculated from the image file if they are not supplied.
|
|||||||
from. If not given, the web server\'s document root
|
from. If not given, the web server\'s document root
|
||||||
`$_ENV['DOCUMENT_ROOT']` is used as the base. If security is
|
`$_ENV['DOCUMENT_ROOT']` is used as the base. If security is
|
||||||
enabled, then the image must be located in the `$secure_dir` path of
|
enabled, then the image must be located in the `$secure_dir` path of
|
||||||
the securty policy. See the [Security](#advanced.features.security)
|
the security policy. See the [Security](#advanced.features.security)
|
||||||
section for details.
|
section for details.
|
||||||
|
|
||||||
- `href` is the href value to link the image to. If link is supplied,
|
- `href` is the href value to link the image to. If link is supplied,
|
||||||
|
@@ -115,7 +115,7 @@ These parameters follow the modifier name and are separated by a `:`
|
|||||||
|
|
||||||
- Secondly - if security is enabled, all php-functions that are to
|
- Secondly - if security is enabled, all php-functions that are to
|
||||||
be used as modifiers have to be declared trusted in the
|
be used as modifiers have to be declared trusted in the
|
||||||
`$modifiers` property of the securty policy. See the
|
`$modifiers` property of the security policy. See the
|
||||||
[Security](../programmers/advanced-features/advanced-features-security.md) section for details.
|
[Security](../programmers/advanced-features/advanced-features-security.md) section for details.
|
||||||
|
|
||||||
See also [`registerPlugin()`](../programmers/api-functions/api-register-plugin.md), [combining
|
See also [`registerPlugin()`](../programmers/api-functions/api-register-plugin.md), [combining
|
||||||
|
@@ -15,5 +15,5 @@ modifier](#language.modifier.to_charset).
|
|||||||
> modifier should only be used in cases where the application cannot
|
> modifier should only be used in cases where the application cannot
|
||||||
> anticipate that a certain string is required in another encoding.
|
> anticipate that a certain string is required in another encoding.
|
||||||
|
|
||||||
See also [Charset Enconding](#charset), [from\_charset
|
See also [Charset Encoding](#charset), [from\_charset
|
||||||
modifier](#language.modifier.from_charset).
|
modifier](#language.modifier.from_charset).
|
||||||
|
@@ -15,5 +15,5 @@ modifier](#language.modifier.from_charset).
|
|||||||
> modifier should only be used in cases where the application cannot
|
> modifier should only be used in cases where the application cannot
|
||||||
> anticipate that a certain string is required in another encoding.
|
> anticipate that a certain string is required in another encoding.
|
||||||
|
|
||||||
See also [Charset Enconding](#charset), [from\_charset
|
See also [Charset Encoding](#charset), [from\_charset
|
||||||
modifier](#language.modifier.from_charset).
|
modifier](#language.modifier.from_charset).
|
||||||
|
@@ -157,13 +157,13 @@ Returns the version of Smarty the template was compiled with.
|
|||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
Returns block text from child template. See [Template
|
Returns block text from child template. See [Template
|
||||||
interitance](#advanced.features.template.inheritance).
|
inheritance](#advanced.features.template.inheritance).
|
||||||
|
|
||||||
{\$smarty.block.parent} {#language.variables.smarty.block.parent}
|
{\$smarty.block.parent} {#language.variables.smarty.block.parent}
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
Returns block text from parent template. See [Template
|
Returns block text from parent template. See [Template
|
||||||
interitance](#advanced.features.template.inheritance)
|
inheritance](#advanced.features.template.inheritance)
|
||||||
|
|
||||||
{\$smarty.ldelim}, {\$smarty.rdelim} {#language.variables.smarty.ldelim}
|
{\$smarty.ldelim}, {\$smarty.rdelim} {#language.variables.smarty.ldelim}
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
@@ -2,7 +2,7 @@ What is Smarty?
|
|||||||
==============
|
==============
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
Smarty can be run with PHP 7.1 to PHP 8.1.
|
Smarty can be run with PHP 7.1 to PHP 8.2.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
Smarty versions 3.1.11 or later can be installed with [Composer](https://getcomposer.org/).
|
Smarty versions 3.1.11 or later can be installed with [Composer](https://getcomposer.org/).
|
||||||
|
@@ -29,7 +29,7 @@ determined by your needs, but use the first method whenever possible to
|
|||||||
keep template syntax to a minimum.
|
keep template syntax to a minimum.
|
||||||
|
|
||||||
If security is enabled, no private methods or functions can be accessed
|
If security is enabled, no private methods or functions can be accessed
|
||||||
(beginningwith \'\_\'). If a method and property of the same name exist,
|
(beginning with \'\_\'). If a method and property of the same name exist,
|
||||||
the method will be used.
|
the method will be used.
|
||||||
|
|
||||||
You can restrict the methods and properties that can be accessed by
|
You can restrict the methods and properties that can be accessed by
|
||||||
|
@@ -2,7 +2,7 @@ Security {#advanced.features.security}
|
|||||||
========
|
========
|
||||||
|
|
||||||
Security is good for situations when you have untrusted parties editing
|
Security is good for situations when you have untrusted parties editing
|
||||||
the templates eg via ftp, and you want to reduce the risk of system
|
the templates e.g. via ftp, and you want to reduce the risk of system
|
||||||
security compromises through the template language.
|
security compromises through the template language.
|
||||||
|
|
||||||
The settings of the security policy are defined by properties of an
|
The settings of the security policy are defined by properties of an
|
||||||
@@ -10,7 +10,7 @@ instance of the Smarty\_Security class. These are the possible settings:
|
|||||||
|
|
||||||
- `$secure_dir` is an array of template directories that are
|
- `$secure_dir` is an array of template directories that are
|
||||||
considered secure. [`$template_dir`](#variable.template.dir)
|
considered secure. [`$template_dir`](#variable.template.dir)
|
||||||
concidered secure implicitly. The default is an empty array.
|
considered secure implicitly. The default is an empty array.
|
||||||
|
|
||||||
- `$trusted_dir` is an array of all directories that are considered
|
- `$trusted_dir` is an array of all directories that are considered
|
||||||
trusted. Trusted directories are where you keep php scripts that are
|
trusted. Trusted directories are where you keep php scripts that are
|
||||||
@@ -27,7 +27,7 @@ instance of the Smarty\_Security class. These are the possible settings:
|
|||||||
like authentication-tokens).
|
like authentication-tokens).
|
||||||
|
|
||||||
The expression `'#https?://.*smarty.net$#i'` would allow accessing
|
The expression `'#https?://.*smarty.net$#i'` would allow accessing
|
||||||
the follwing URIs:
|
the following URIs:
|
||||||
|
|
||||||
- `http://smarty.net/foo`
|
- `http://smarty.net/foo`
|
||||||
|
|
||||||
@@ -140,5 +140,5 @@ Smarty\_Security class or create an instance of it.
|
|||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
> Most security policy settings are only checked when the template gets
|
> Most security policy settings are only checked when the template gets
|
||||||
> compiled. For that reasion you should delete all cached and compiled
|
> compiled. For that reason you should delete all cached and compiled
|
||||||
> template files when you change your security settings.
|
> template files when you change your security settings.
|
||||||
|
@@ -33,7 +33,7 @@ can override all or some of the parent named block areas.
|
|||||||
you can define the whole template inheritance tree in the PHP script
|
you can define the whole template inheritance tree in the PHP script
|
||||||
when you are calling [`fetch()`](#api.fetch) or
|
when you are calling [`fetch()`](#api.fetch) or
|
||||||
[`display()`](#api.display) with the `extends:` template resource
|
[`display()`](#api.display) with the `extends:` template resource
|
||||||
type. The later provides even more flexibillity.
|
type. The later provides even more flexibility.
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
|
@@ -8,7 +8,7 @@ Modifications done to the Smarty object will be global for all
|
|||||||
templates.
|
templates.
|
||||||
|
|
||||||
However the Smarty class variables and functions can be accessed or
|
However the Smarty class variables and functions can be accessed or
|
||||||
called by induvidual template objects. Modification done to a template
|
called by individual template objects. Modification done to a template
|
||||||
object will apply only for that template and its included subtemplates.
|
object will apply only for that template and its included subtemplates.
|
||||||
|
|
||||||
|
|
||||||
|
@@ -26,7 +26,7 @@ the following parameters:
|
|||||||
variables assigned to any of the objects in it\'s parent chain.
|
variables assigned to any of the objects in it\'s parent chain.
|
||||||
|
|
||||||
Data objects are used to create scopes for assigned variables. They can
|
Data objects are used to create scopes for assigned variables. They can
|
||||||
be used to have controll which variables are seen by which templates.
|
be used to control which variables are seen by which templates.
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
@@ -9,7 +9,7 @@ string
|
|||||||
|
|
||||||
disableSecurity
|
disableSecurity
|
||||||
|
|
||||||
This disables securty checking on templates.
|
This disables security checking on templates.
|
||||||
|
|
||||||
See also [`enableSecurity()`](#api.enable.security), and
|
See also [`enableSecurity()`](#api.enable.security), and
|
||||||
[Security](#advanced.features.security).
|
[Security](#advanced.features.security).
|
||||||
|
@@ -25,7 +25,7 @@ string
|
|||||||
|
|
||||||
enableSecurity
|
enableSecurity
|
||||||
|
|
||||||
This enables securty checking on templates. It uses the following
|
This enables security checking on templates. It uses the following
|
||||||
parameters:
|
parameters:
|
||||||
|
|
||||||
- `securityclass` is an optional parameter. It\'s the name of the
|
- `securityclass` is an optional parameter. It\'s the name of the
|
||||||
|
@@ -16,6 +16,6 @@ given error was produced deliberately and must be ignored, or should be
|
|||||||
passed on to the next error handler.
|
passed on to the next error handler.
|
||||||
|
|
||||||
`Smarty::unmuteExpectedErrors()` removes the current error handler.
|
`Smarty::unmuteExpectedErrors()` removes the current error handler.
|
||||||
Please note, that if you\'ve registerd any custom error handlers after
|
Please note, that if you\'ve registered any custom error handlers after
|
||||||
the muteExpectedErrors() call, the unmute will not remove Smarty\'s
|
the muteExpectedErrors() call, the unmute will not remove Smarty\'s
|
||||||
muting error handler, but the one registered last.
|
muting error handler, but the one registered last.
|
||||||
|
@@ -18,7 +18,7 @@ not find a definition for a tag otherwise. It uses the following
|
|||||||
parameters:
|
parameters:
|
||||||
|
|
||||||
If during compilation Smarty encounters tag which is not defined
|
If during compilation Smarty encounters tag which is not defined
|
||||||
internal, registered or loacted in the plugins folder it tries to
|
internal, registered or located in the plugins folder it tries to
|
||||||
resolve it by calling the registered default plugin handler. The handler
|
resolve it by calling the registered default plugin handler. The handler
|
||||||
may be called several times for same undefined tag looping over valid
|
may be called several times for same undefined tag looping over valid
|
||||||
plugin types.
|
plugin types.
|
||||||
|
@@ -10,7 +10,7 @@ void
|
|||||||
testInstall
|
testInstall
|
||||||
|
|
||||||
This function verifies that all required working folders of the Smarty
|
This function verifies that all required working folders of the Smarty
|
||||||
installation can be accessed. It does output a corresponding protocoll.
|
installation can be accessed. It does output a corresponding protocol.
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
\$compile\_id {#variable.compile.id}
|
\$compile\_id {#variable.compile.id}
|
||||||
=============
|
=============
|
||||||
|
|
||||||
Persistant compile identifier. As an alternative to passing the same
|
Persistent compile identifier. As an alternative to passing the same
|
||||||
`$compile_id` to each and every function call, you can set this
|
`$compile_id` to each and every function call, you can set this
|
||||||
`$compile_id` and it will be used implicitly thereafter.
|
`$compile_id` and it will be used implicitly thereafter.
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ post-filters](#plugins.prefilters.postfilters) you must use a unique
|
|||||||
`$compile_id` to keep the compiled template files separated.
|
`$compile_id` to keep the compiled template files separated.
|
||||||
|
|
||||||
For example a [prefilter](#plugins.prefilters.postfilters) that
|
For example a [prefilter](#plugins.prefilters.postfilters) that
|
||||||
localizes your templates (that is: translates language dependend parts)
|
localizes your templates (that is: translates language dependent parts)
|
||||||
at compile time, then you could use the current language as
|
at compile time, then you could use the current language as
|
||||||
`$compile_id` and you will get a set of compiled templates for each
|
`$compile_id` and you will get a set of compiled templates for each
|
||||||
language you use.
|
language you use.
|
||||||
|
@@ -2,6 +2,6 @@
|
|||||||
==================
|
==================
|
||||||
|
|
||||||
This is maximum time in seconds a cache lock is valid to avoid dead
|
This is maximum time in seconds a cache lock is valid to avoid dead
|
||||||
locks. The deafult value is 10 seconds.
|
locks. The default value is 10 seconds.
|
||||||
|
|
||||||
See also [`$cache_locking`](#variable.cache.locking)
|
See also [`$cache_locking`](#variable.cache.locking)
|
||||||
|
@@ -10,7 +10,7 @@ environments do not allow PHP processes to create directories, so this
|
|||||||
must be disabled which is the default.
|
must be disabled which is the default.
|
||||||
|
|
||||||
Sub directories are more efficient, so use them if you can.
|
Sub directories are more efficient, so use them if you can.
|
||||||
Theoretically you get much better perfomance on a filesystem with 10
|
Theoretically you get much better performance on a filesystem with 10
|
||||||
directories each having 100 files, than with 1 directory having 1000
|
directories each having 100 files, than with 1 directory having 1000
|
||||||
files. This was certainly the case with Solaris 7 (UFS)\... with newer
|
files. This was certainly the case with Solaris 7 (UFS)\... with newer
|
||||||
filesystems such as ext3 and especially reiserfs, the difference is
|
filesystems such as ext3 and especially reiserfs, the difference is
|
||||||
|
@@ -25,10 +25,10 @@ like.
|
|||||||
- You CANNOT remove a specified template name under multiple cache
|
- You CANNOT remove a specified template name under multiple cache
|
||||||
groups such as `'/a/b/*/foo.tpl'`, the cache grouping works
|
groups such as `'/a/b/*/foo.tpl'`, the cache grouping works
|
||||||
left-to-right ONLY. You will need to group your templates under a
|
left-to-right ONLY. You will need to group your templates under a
|
||||||
single cache group heirarchy to be able to clear them as a group.
|
single cache group hierarchy to be able to clear them as a group.
|
||||||
|
|
||||||
Cache grouping should not be confused with your template directory
|
Cache grouping should not be confused with your template directory
|
||||||
heirarchy, the cache grouping has no knowledge of how your templates are
|
hierarchy, the cache grouping has no knowledge of how your templates are
|
||||||
structured. So for example, if you have a template structure like
|
structured. So for example, if you have a template structure like
|
||||||
`themes/blue/index.tpl` and you want to be able to clear all the cache
|
`themes/blue/index.tpl` and you want to be able to clear all the cache
|
||||||
files for the "blue" theme, you will need to create a cache group
|
files for the "blue" theme, you will need to create a cache group
|
||||||
|
@@ -15,7 +15,7 @@ Smarty recognizes `UTF-8` as the internal charset if
|
|||||||
> `ISO-8859-1` has been PHP\'s default internal charset since the
|
> `ISO-8859-1` has been PHP\'s default internal charset since the
|
||||||
> beginning. Unicode has been evolving since 1991. Since then it has
|
> beginning. Unicode has been evolving since 1991. Since then it has
|
||||||
> become the one charset to conquer them all, as it is capable of
|
> become the one charset to conquer them all, as it is capable of
|
||||||
> encoding most of the known characters even accross different character
|
> encoding most of the known characters even across different character
|
||||||
> systems (latin, cyrillic, japanese, ...). `UTF-8` is unicode\'s most
|
> systems (latin, cyrillic, japanese, ...). `UTF-8` is unicode\'s most
|
||||||
> used encoding, as it allows referencing the thousands of character
|
> used encoding, as it allows referencing the thousands of character
|
||||||
> with the smallest size overhead possible.
|
> with the smallest size overhead possible.
|
||||||
|
@@ -3,20 +3,20 @@ Extends Template Resources {#resources.extends}
|
|||||||
|
|
||||||
The `extends:` resource is used to define child/parent relationships for
|
The `extends:` resource is used to define child/parent relationships for
|
||||||
template inheritance from the PHP script. For details see section of
|
template inheritance from the PHP script. For details see section of
|
||||||
[Template Interitance](#advanced.features.template.inheritance).
|
[Template Inheritance](#advanced.features.template.inheritance).
|
||||||
|
|
||||||
As of Smarty 3.1 the `extends:` resource may use any available [template
|
As of Smarty 3.1 the `extends:` resource may use any available [template
|
||||||
resource](#resources), including `string:` and `eval:`. When [templates
|
resource](#resources), including `string:` and `eval:`. When [templates
|
||||||
from strings](#resources.string) are used, make sure they are properly
|
from strings](#resources.string) are used, make sure they are properly
|
||||||
(url or base64) encoded. Is an `eval:` resource found within an
|
(url or base64) encoded. Is an `eval:` resource found within an
|
||||||
inheritance chain, its \"don\'t save a compile file\" property is
|
inheritance chain, its \"don\'t save a compile file\" property is
|
||||||
superseeded by the `extends:` resource. The templates within an
|
superseded by the `extends:` resource. The templates within an
|
||||||
inheritance chain are not compiled separately, though. Only a single
|
inheritance chain are not compiled separately, though. Only a single
|
||||||
compiled template will be generated.
|
compiled template will be generated.
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
> Use this when inheritance is required programatically. When inheriting
|
> Use this when inheritance is required programmatically. When inheriting
|
||||||
> within PHP, it is not obvious from the child template what inheritance
|
> within PHP, it is not obvious from the child template what inheritance
|
||||||
> took place. If you have a choice, it is normally more flexible and
|
> took place. If you have a choice, it is normally more flexible and
|
||||||
> intuitive to handle inheritance chains from within the templates.
|
> intuitive to handle inheritance chains from within the templates.
|
||||||
|
@@ -47,7 +47,7 @@ Templates from a specific \$template\_dir {#templates.from.specified.template.di
|
|||||||
Smarty 3.1 introduced the bracket-syntax for specifying an element from
|
Smarty 3.1 introduced the bracket-syntax for specifying an element from
|
||||||
[`$template_dir`](#variable.template.dir). This allows websites
|
[`$template_dir`](#variable.template.dir). This allows websites
|
||||||
employing multiple sets of templates better control over which template
|
employing multiple sets of templates better control over which template
|
||||||
to acces.
|
to access.
|
||||||
|
|
||||||
The bracket-syntax can be used from anywhere you can specify the `file:`
|
The bracket-syntax can be used from anywhere you can specify the `file:`
|
||||||
resource type.
|
resource type.
|
||||||
|
@@ -37,9 +37,8 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
|||||||
// no break
|
// no break
|
||||||
case 'htmlall':
|
case 'htmlall':
|
||||||
if (Smarty::$_MBSTRING) {
|
if (Smarty::$_MBSTRING) {
|
||||||
$string = htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode);
|
$string = mb_convert_encoding($string, 'UTF-8', $char_set);
|
||||||
// htmlentities() won't convert everything, so use mb_convert_encoding
|
return htmlentities($string, ENT_QUOTES, 'UTF-8', $double_encode);
|
||||||
return mb_convert_encoding($string, 'HTML-ENTITIES', $char_set);
|
|
||||||
}
|
}
|
||||||
// no MBString fallback
|
// no MBString fallback
|
||||||
return htmlentities($string, ENT_QUOTES, $char_set, $double_encode);
|
return htmlentities($string, ENT_QUOTES, $char_set, $double_encode);
|
||||||
|
@@ -19,11 +19,10 @@
|
|||||||
* @param Smarty_Internal_TemplateCompilerBase $compiler
|
* @param Smarty_Internal_TemplateCompilerBase $compiler
|
||||||
*
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
* @throws \SmartyException
|
* @throws SmartyException
|
||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompilerBase $compiler)
|
function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompilerBase $compiler)
|
||||||
{
|
{
|
||||||
static $is_loaded = false;
|
|
||||||
$compiler->template->_checkPlugins(
|
$compiler->template->_checkPlugins(
|
||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
@@ -43,17 +42,15 @@ function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompile
|
|||||||
case 'html':
|
case 'html':
|
||||||
return 'htmlspecialchars((string)' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ', ' .
|
return 'htmlspecialchars((string)' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ', ' .
|
||||||
var_export($double_encode, true) . ')';
|
var_export($double_encode, true) . ')';
|
||||||
// no break
|
|
||||||
case 'htmlall':
|
case 'htmlall':
|
||||||
if (Smarty::$_MBSTRING) {
|
if (Smarty::$_MBSTRING) {
|
||||||
return 'mb_convert_encoding(htmlspecialchars((string)' . $params[ 0 ] . ', ENT_QUOTES, ' .
|
return 'htmlentities(mb_convert_encoding((string)' . $params[ 0 ] . ', \'UTF-8\', ' .
|
||||||
var_export($char_set, true) . ', ' . var_export($double_encode, true) .
|
var_export($char_set, true) . '), ENT_QUOTES, \'UTF-8\', ' .
|
||||||
'), "HTML-ENTITIES", ' . var_export($char_set, true) . ')';
|
var_export($double_encode, true) . ')';
|
||||||
}
|
}
|
||||||
// no MBString fallback
|
// no MBString fallback
|
||||||
return 'htmlentities((string)' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ', ' .
|
return 'htmlentities((string)' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ', ' .
|
||||||
var_export($double_encode, true) . ')';
|
var_export($double_encode, true) . ')';
|
||||||
// no break
|
|
||||||
case 'url':
|
case 'url':
|
||||||
return 'rawurlencode((string)' . $params[ 0 ] . ')';
|
return 'rawurlencode((string)' . $params[ 0 ] . ')';
|
||||||
case 'urlpathinfo':
|
case 'urlpathinfo':
|
||||||
|
@@ -39,9 +39,9 @@ function smarty_modifiercompiler_unescape($params, Smarty_Internal_TemplateCompi
|
|||||||
case 'entity':
|
case 'entity':
|
||||||
case 'htmlall':
|
case 'htmlall':
|
||||||
if (Smarty::$_MBSTRING) {
|
if (Smarty::$_MBSTRING) {
|
||||||
return 'mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 2 ] . ', \'HTML-ENTITIES\')';
|
return 'html_entity_decode(mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 2 ] . ', \'UTF-8\'), ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, ' . $params[ 2 ] . ')';
|
||||||
}
|
}
|
||||||
return 'html_entity_decode(' . $params[ 0 ] . ', ENT_NOQUOTES, ' . $params[ 2 ] . ')';
|
return 'html_entity_decode(' . $params[ 0 ] . ', ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, ' . $params[ 2 ] . ')';
|
||||||
case 'html':
|
case 'html':
|
||||||
return 'htmlspecialchars_decode(' . $params[ 0 ] . ', ENT_QUOTES)';
|
return 'htmlspecialchars_decode(' . $params[ 0 ] . ', ENT_QUOTES)';
|
||||||
case 'url':
|
case 'url':
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
* @property Smarty_Internal_Method_RegisterPlugin $registerPlugin
|
* @property Smarty_Internal_Method_RegisterPlugin $registerPlugin
|
||||||
* @property mixed|\Smarty_Template_Cached configLoad
|
* @property mixed|\Smarty_Template_Cached configLoad
|
||||||
*/
|
*/
|
||||||
|
#[\AllowDynamicProperties]
|
||||||
class Smarty_Internal_Extension_Handler
|
class Smarty_Internal_Extension_Handler
|
||||||
{
|
{
|
||||||
public $objType = null;
|
public $objType = null;
|
||||||
|
@@ -22,7 +22,7 @@ class Smarty_Internal_Runtime_Make_Nocache
|
|||||||
{
|
{
|
||||||
if (isset($tpl->tpl_vars[ $var ])) {
|
if (isset($tpl->tpl_vars[ $var ])) {
|
||||||
$export =
|
$export =
|
||||||
preg_replace('/^Smarty_Variable::__set_state[(]|[)]$/', '', var_export($tpl->tpl_vars[ $var ], true));
|
preg_replace('/^\\\\?Smarty_Variable::__set_state[(]|[)]$/', '', var_export($tpl->tpl_vars[ $var ], true));
|
||||||
if (preg_match('/(\w+)::__set_state/', $export, $match)) {
|
if (preg_match('/(\w+)::__set_state/', $export, $match)) {
|
||||||
throw new SmartyException("{make_nocache \${$var}} in template '{$tpl->source->name}': variable does contain object '{$match[1]}' not implementing method '__set_state'");
|
throw new SmartyException("{make_nocache \${$var}} in template '{$tpl->source->name}': variable does contain object '{$match[1]}' not implementing method '__set_state'");
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
*
|
*
|
||||||
* @method bool mustCompile()
|
* @method bool mustCompile()
|
||||||
*/
|
*/
|
||||||
|
#[\AllowDynamicProperties]
|
||||||
class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
/**
|
/**
|
||||||
* This class does contain the security settings
|
* This class does contain the security settings
|
||||||
*/
|
*/
|
||||||
|
#[\AllowDynamicProperties]
|
||||||
class Smarty_Security
|
class Smarty_Security
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage Template
|
* @subpackage Template
|
||||||
*/
|
*/
|
||||||
|
#[\AllowDynamicProperties]
|
||||||
class Smarty_Variable
|
class Smarty_Variable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@@ -206,6 +206,7 @@ class StreamResourceTest extends PHPUnit_Smarty
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class ResourceStream
|
class ResourceStream
|
||||||
{
|
{
|
||||||
private $position;
|
private $position;
|
||||||
|
@@ -391,6 +391,7 @@ class Security extends Smarty_Security
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class ResourceStreamSecurity
|
class ResourceStreamSecurity
|
||||||
{
|
{
|
||||||
private $position;
|
private $position;
|
||||||
|
@@ -15,6 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
class CompileRegisteredObjectFunctionTest extends PHPUnit_Smarty
|
class CompileRegisteredObjectFunctionTest extends PHPUnit_Smarty
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var RegObject
|
||||||
|
*/
|
||||||
|
private $object;
|
||||||
|
|
||||||
public function setUp(): void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
$this->setUpSmarty(__DIR__);
|
$this->setUpSmarty(__DIR__);
|
||||||
|
@@ -23,7 +23,7 @@ class PluginModifierCharsetTest extends PHPUnit_Smarty
|
|||||||
public function testToLatin1()
|
public function testToLatin1()
|
||||||
{
|
{
|
||||||
$encoded = "hällö wörld 1";
|
$encoded = "hällö wörld 1";
|
||||||
$result = utf8_decode($encoded);
|
$result = mb_convert_encoding($encoded, 'ISO-8859-1', 'UTF-8');
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|to_charset}');
|
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|to_charset}');
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
|
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ class PluginModifierCharsetTest extends PHPUnit_Smarty
|
|||||||
Smarty::$_MBSTRING = false;
|
Smarty::$_MBSTRING = false;
|
||||||
$this->smarty->setCompileId('mb');
|
$this->smarty->setCompileId('mb');
|
||||||
$encoded = "hällö wörld 2";
|
$encoded = "hällö wörld 2";
|
||||||
$result = utf8_decode($encoded);
|
$result = mb_convert_encoding($encoded, 'ISO-8859-1', 'UTF-8');
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|to_charset}');
|
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|to_charset}');
|
||||||
$this->assertEquals($encoded, $tpl->fetch());
|
$this->assertEquals($encoded, $tpl->fetch());
|
||||||
Smarty::$_MBSTRING = true;
|
Smarty::$_MBSTRING = true;
|
||||||
@@ -42,7 +42,7 @@ class PluginModifierCharsetTest extends PHPUnit_Smarty
|
|||||||
public function testFromLatin1()
|
public function testFromLatin1()
|
||||||
{
|
{
|
||||||
$result = "hällö wörld 3";
|
$result = "hällö wörld 3";
|
||||||
$encoded = utf8_decode($result);
|
$encoded = mb_convert_encoding($result, 'ISO-8859-1', 'UTF-8');
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|from_charset}');
|
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|from_charset}');
|
||||||
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
|
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ class PluginModifierCharsetTest extends PHPUnit_Smarty
|
|||||||
Smarty::$_MBSTRING = false;
|
Smarty::$_MBSTRING = false;
|
||||||
$this->smarty->setCompileId('mb');
|
$this->smarty->setCompileId('mb');
|
||||||
$result = "hällö wörld 4";
|
$result = "hällö wörld 4";
|
||||||
$encoded = utf8_decode($result);
|
$encoded = mb_convert_encoding($result, 'ISO-8859-1', 'UTF-8');
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|from_charset}');
|
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|from_charset}');
|
||||||
$this->assertEquals($encoded, $tpl->fetch());
|
$this->assertEquals($encoded, $tpl->fetch());
|
||||||
Smarty::$_MBSTRING = true;
|
Smarty::$_MBSTRING = true;
|
||||||
|
@@ -20,12 +20,19 @@ class PluginModifierEscapeTest extends PHPUnit_Smarty
|
|||||||
$this->setUpSmarty(__DIR__);
|
$this->setUpSmarty(__DIR__);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHtml()
|
public function testHtmlCompiled()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"html"}');
|
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"html"}');
|
||||||
$this->assertEquals("I'm some <html> to ä be "escaped" or &copy;", $this->smarty->fetch($tpl));
|
$this->assertEquals("I'm some <html> to ä be "escaped" or &copy;", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testHtmlModifier()
|
||||||
|
{
|
||||||
|
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:$mode}');
|
||||||
|
$this->smarty->assign('mode', 'html');
|
||||||
|
$this->assertEquals("I'm some <html> to ä be "escaped" or &copy;", $this->smarty->fetch($tpl));
|
||||||
|
}
|
||||||
|
|
||||||
public function testHtmlWithoutMbstring()
|
public function testHtmlWithoutMbstring()
|
||||||
{
|
{
|
||||||
Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
||||||
@@ -48,13 +55,20 @@ class PluginModifierEscapeTest extends PHPUnit_Smarty
|
|||||||
Smarty::$_MBSTRING = true;
|
Smarty::$_MBSTRING = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHtmlall()
|
public function testHtmlallCompiled()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"htmlall"}');
|
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"htmlall"}');
|
||||||
$this->assertEquals("I'm some <html> to ä be "escaped" or &copy;", $this->smarty->fetch($tpl));
|
$this->assertEquals("I'm some <html> to ä be "escaped" or &copy;", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHtmlallWithoutMbstring()
|
public function testHtmlallModifier()
|
||||||
|
{
|
||||||
|
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:$mode}');
|
||||||
|
$this->smarty->assign('mode', 'htmlall');
|
||||||
|
$this->assertEquals("I'm some <html> to ä be "escaped" or &copy;", $this->smarty->fetch($tpl));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testHtmlallWithoutMbstringCompiled()
|
||||||
{
|
{
|
||||||
Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
||||||
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"htmlall"}');
|
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"htmlall"}');
|
||||||
@@ -62,6 +76,15 @@ class PluginModifierEscapeTest extends PHPUnit_Smarty
|
|||||||
Smarty::$_MBSTRING = true;
|
Smarty::$_MBSTRING = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testHtmlallWithoutMbstringModifier()
|
||||||
|
{
|
||||||
|
Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
||||||
|
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:$mode}');
|
||||||
|
$this->smarty->assign('mode', 'htmlall');
|
||||||
|
$this->assertEquals("I'm some <html> to ä be "escaped" or &copy;", $this->smarty->fetch($tpl));
|
||||||
|
Smarty::$_MBSTRING = true;
|
||||||
|
}
|
||||||
|
|
||||||
public function testHtmlallDouble()
|
public function testHtmlallDouble()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"htmlall":null:false}');
|
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or ©"|escape:"htmlall":null:false}');
|
||||||
@@ -76,12 +99,19 @@ class PluginModifierEscapeTest extends PHPUnit_Smarty
|
|||||||
Smarty::$_MBSTRING = true;
|
Smarty::$_MBSTRING = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUrl()
|
public function testUrlCompiled()
|
||||||
{
|
{
|
||||||
$tpl = $this->smarty->createTemplate('string:{"http://some.encoded.com/url?parts#foo"|escape:"url"}');
|
$tpl = $this->smarty->createTemplate('string:{"http://some.encoded.com/url?parts#foo"|escape:"url"}');
|
||||||
$this->assertEquals("http%3A%2F%2Fsome.encoded.com%2Furl%3Fparts%23foo", $this->smarty->fetch($tpl));
|
$this->assertEquals("http%3A%2F%2Fsome.encoded.com%2Furl%3Fparts%23foo", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testUrlModifier()
|
||||||
|
{
|
||||||
|
$tpl = $this->smarty->createTemplate('string:{"http://some.encoded.com/url?parts#foo"|escape:$mode}');
|
||||||
|
$this->smarty->assign('mode', 'url');
|
||||||
|
$this->assertEquals("http%3A%2F%2Fsome.encoded.com%2Furl%3Fparts%23foo", $this->smarty->fetch($tpl));
|
||||||
|
}
|
||||||
|
|
||||||
public function testUrlWithoutMbstring()
|
public function testUrlWithoutMbstring()
|
||||||
{
|
{
|
||||||
Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
||||||
@@ -203,7 +233,7 @@ class PluginModifierEscapeTest extends PHPUnit_Smarty
|
|||||||
public function testNonstdWithoutMbstring()
|
public function testNonstdWithoutMbstring()
|
||||||
{
|
{
|
||||||
Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . utf8_decode('sma\'rty@»example«.com') . '"|escape:"nonstd"}');
|
$tpl = $this->smarty->createTemplate('string:{"' . mb_convert_encoding('sma\'rty@»example«.com', 'ISO-8859-1', 'UTF-8') . '"|escape:"nonstd"}');
|
||||||
$this->assertEquals("sma'rty@»example«.com", $this->smarty->fetch($tpl));
|
$this->assertEquals("sma'rty@»example«.com", $this->smarty->fetch($tpl));
|
||||||
Smarty::$_MBSTRING = true;
|
Smarty::$_MBSTRING = true;
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ class PluginModifierStripTest extends PHPUnit_Smarty
|
|||||||
{
|
{
|
||||||
// Some Unicode Spaces
|
// Some Unicode Spaces
|
||||||
$string = " hello spaced       words ";
|
$string = " hello spaced       words ";
|
||||||
$string = mb_convert_encoding($string, 'UTF-8', "HTML-ENTITIES");
|
$string = html_entity_decode($string, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, 'UTF-8');
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . $string . '"|strip}');
|
$tpl = $this->smarty->createTemplate('string:{"' . $string . '"|strip}');
|
||||||
$this->assertEquals(" hello spaced words ", $this->smarty->fetch($tpl));
|
$this->assertEquals(" hello spaced words ", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
@@ -40,8 +40,8 @@ class PluginModifierUnescapeTest extends PHPUnit_Smarty
|
|||||||
|
|
||||||
public function testHtmlall()
|
public function testHtmlall()
|
||||||
{
|
{
|
||||||
$encoded = "aäЗдра><&amp;ääвсствуйте";
|
$encoded = "'"aäЗдра><&amp;ääвсствуйте";
|
||||||
$result = "aäЗдра><&ääвсствуйте";
|
$result = "'\"aäЗдра><&ääвсствуйте";
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|unescape:"htmlall"}');
|
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|unescape:"htmlall"}');
|
||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
@@ -49,8 +49,8 @@ class PluginModifierUnescapeTest extends PHPUnit_Smarty
|
|||||||
public function testHtmlallWithoutMbstring()
|
public function testHtmlallWithoutMbstring()
|
||||||
{
|
{
|
||||||
Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
||||||
$encoded = "aäЗдра><&amp;ääвсствуйте";
|
$encoded = "'"aäЗдра><&amp;ääвсствуйте";
|
||||||
$result = "aäЗдра><&ääвсствуйте";
|
$result = "'\"aäЗдра><&ääвсствуйте";
|
||||||
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|unescape:"htmlall"}');
|
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|unescape:"htmlall"}');
|
||||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
||||||
Smarty::$_MBSTRING = true;
|
Smarty::$_MBSTRING = true;
|
||||||
|
@@ -68,6 +68,7 @@ class StreamVariableTest extends PHPUnit_Smarty
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class VariableStream
|
class VariableStream
|
||||||
{
|
{
|
||||||
private $position;
|
private $position;
|
||||||
|
10
utilities/testrunners/php82/Dockerfile
Normal file
10
utilities/testrunners/php82/Dockerfile
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
FROM php:8.2-cli
|
||||||
|
|
||||||
|
## Basic utilities
|
||||||
|
RUN apt-get update -yqq && apt-get install -y curl apt-utils git zip unzip
|
||||||
|
|
||||||
|
## Composer
|
||||||
|
COPY ./utilities/testrunners/shared/install-composer.sh /root/install-composer.sh
|
||||||
|
WORKDIR /root
|
||||||
|
RUN sh ./install-composer.sh
|
||||||
|
RUN mv ./composer.phar /usr/local/bin/composer
|
Reference in New Issue
Block a user