Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d7fb7a186 | |||
| 8da6f903bc | |||
| 856a88d891 | |||
| 2287af625b | |||
| c5d151a08c |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
vendor
|
||||
vendor/
|
||||
tools/
|
||||
composer.lock
|
||||
.phpunit.cache/
|
||||
tools-libs/
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phive xmlns="https://phar.io/phive">
|
||||
<phar name="phpunit" version="^10.3.5" installed="10.3.5" location="./tools/phpunit" copy="false"/>
|
||||
<phar name="phpunit" version="^12.0.0" installed="12.5.4" location="./tools/phpunit" copy="false"/>
|
||||
<phar name="phpcs" version="^4.0.0" installed="4.0.1" location="./tools/phpcs" copy="false"/>
|
||||
<phar name="phpcbf" version="^4.0.0" installed="4.0.1" location="./tools/phpcbf" copy="false"/>
|
||||
<phar name="phan" version="^5.5.2" installed="5.5.2" location="./tools/phan" copy="false"/>
|
||||
<phar name="phpstan" version="^2.1.33" installed="2.1.33" location="./tools/phpstan" copy="false"/>
|
||||
</phive>
|
||||
|
||||
15
ReadMe.md
15
ReadMe.md
@@ -29,12 +29,11 @@ Alternative setup composer local zip file repot:
|
||||
|
||||
## How to update
|
||||
|
||||
1) update the original composer for ^5
|
||||
1) Located in `Smarty/Smarty-Composer/vendor/smarty/smarty/src/`
|
||||
2) Alternative is to checkout master branch from git
|
||||
1) Alternative is to checkout master branch from git
|
||||
1) Located in `Smarty/Smarty-git/src/`
|
||||
3) Copy the `src/` folder as is over the `Smarty/Smarty-Extended/src` folder
|
||||
4) From the `update/` folder copy
|
||||
2) Run `git pull smarty master`
|
||||
2) Copy the `src/` folder as is over the `Smarty/Smarty-Extended/src` folder
|
||||
3) From the `update/` folder copy
|
||||
1) copy over the following into `src/BlockHandler/`:
|
||||
1) T.php
|
||||
2) copy over the following into `src/FunctionHandler`:
|
||||
@@ -45,7 +44,7 @@ Alternative setup composer local zip file repot:
|
||||
2) `getBlockHandler`: t
|
||||
4) check either `src/FunctionHander/HtmlCheckboxes.php`, `src/FunctionHander/HtmlOptions.php` and `src/FunctionHander/HtmlBase.php` have changed
|
||||
1) Update and leep the label/pos changes
|
||||
5) Create new release version as official relase number
|
||||
4) Create new release version as official relase number
|
||||
|
||||
## Test
|
||||
|
||||
@@ -63,7 +62,9 @@ Intelephense cannot directly access the phar file, if phpunit was installed as a
|
||||
In the base folder:
|
||||
|
||||
```sh
|
||||
php -r "(new Phar('/path/to/phive/folder/.phive/phars/phpunit-10.3.5.phar'))->extractTo('tools-libs/phpunit');"
|
||||
php -r "(new Phar('/path/to/phive/folder/.phive/phars/phpunit-X.Y.Z.phar'))->extractTo('tools-libs/phpunit');"
|
||||
// Example, must point to the .phar file itself
|
||||
php -r "(new Phar('/storage/home/clemens/.phive/phars/phpunit-11.5.46.phar'))->extractTo('tools-libs/phpunit');"
|
||||
```
|
||||
|
||||
Then open the vscode settings and set for the Folder (if multiple folders are in the workspace) or the Workspace the following setting
|
||||
|
||||
@@ -1 +1 @@
|
||||
5.4.3
|
||||
5.7.0
|
||||
|
||||
@@ -3,23 +3,92 @@
|
||||
BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
|
||||
PACKAGE_DOWNLOAD="${BASE_FOLDER}package-download/";
|
||||
if [ ! -d "${PACKAGE_DOWNLOAD}" ]; then
|
||||
mkdir "${PACKAGE_DOWNLOAD}";
|
||||
mkdir "${PACKAGE_DOWNLOAD}";
|
||||
fi;
|
||||
VERSION=$(git tag --list | sort -V | tail -n1 | sed -e "s/^v//");
|
||||
file_last_published="${BASE_FOLDER}last.published";
|
||||
go_flag="$1";
|
||||
|
||||
function gitea_publish
|
||||
{
|
||||
_GITEA_PUBLISH="${1}"
|
||||
_GITEA_UPLOAD_FILENAME="${2}"
|
||||
_GITEA_URL_DL="${3}"
|
||||
_GITEA_URL_PUSH="${4}"
|
||||
_GITEA_USER="${5}"
|
||||
_GITEA_TOKEN="${6}"
|
||||
_PACKAGE_DOWNLOAD="${7}"
|
||||
_VERSION="${8}"
|
||||
_file_last_published="${9}"
|
||||
|
||||
if [ -z "${_GITEA_PUBLISH}" ]; then
|
||||
return
|
||||
fi;
|
||||
if [ -n "${_GITEA_UPLOAD_FILENAME}" ] &&
|
||||
[ -n "${_GITEA_URL_DL}" ] && [ -n "${_GITEA_URL_PUSH}" ] &&
|
||||
[ -n "${_GITEA_USER}" ] && [ -n "${_GITEA_TOKEN}" ]; then
|
||||
echo "> Publish ${_GITEA_UPLOAD_FILENAME} with ${_VERSION} to: ${_GITEA_URL_PUSH}";
|
||||
if [ ! -f "${_PACKAGE_DOWNLOAD}${_GITEA_UPLOAD_FILENAME}-v${_VERSION}.zip" ]; then
|
||||
echo "> Download: ${_GITEA_UPLOAD_FILENAME}-v${_VERSION}.zip";
|
||||
curl -LJO \
|
||||
--output-dir "${_PACKAGE_DOWNLOAD}" \
|
||||
"${_GITEA_URL_DL}"/v"${_VERSION}".zip;
|
||||
fi;
|
||||
if [ ! -f "${_PACKAGE_DOWNLOAD}${_GITEA_UPLOAD_FILENAME}-v${_VERSION}.zip" ]; then
|
||||
echo "[!] Package file does not exist for version: ${_VERSION}";
|
||||
else
|
||||
response=$(curl --user "${_GITEA_USER}":"${_GITEA_TOKEN}" \
|
||||
--upload-file "${_PACKAGE_DOWNLOAD}${_GITEA_UPLOAD_FILENAME}-v${_VERSION}.zip" \
|
||||
"${_GITEA_URL_PUSH}"?version="${_VERSION}");
|
||||
status=$(echo "${response}" | jq .errors[].status);
|
||||
message=$(echo "${response}" | jq .errors[].message);
|
||||
if [ -n "${status}" ]; then
|
||||
echo "[!] Error ${status}: ${message}";
|
||||
else
|
||||
echo "> Publish completed";
|
||||
fi;
|
||||
echo "${_VERSION}" > "${_file_last_published}";
|
||||
fi;
|
||||
else
|
||||
echo "[!] Missing either GITEA_UPLOAD_FILENAME, GITEA_URL_DL, GITEA_URL_PUSH, GITEA_USER or GITEA_TOKEN environment variable";
|
||||
fi;
|
||||
}
|
||||
|
||||
function gitlab_publish
|
||||
{
|
||||
_GITLAB_PUBLISH="${1}";
|
||||
_GITLAB_URL="${2}";
|
||||
_GITLAB_DEPLOY_TOKEN="${3}";
|
||||
_PACKAGE_DOWNLOAD="${4}"
|
||||
_VERSION="${5}"
|
||||
_file_last_published="${6}"
|
||||
if [ -z "${_GITLAB_PUBLISH}" ]; then
|
||||
return;
|
||||
fi;
|
||||
if [ -n "${_GITLAB_URL}" ] && [ -n "${_GITLAB_DEPLOY_TOKEN}" ]; then
|
||||
curl --data tag=v"${_VERSION}" \
|
||||
--header "Deploy-Token: ${_GITLAB_DEPLOY_TOKEN}" \
|
||||
"${_GITLAB_URL}";
|
||||
curl --data branch=master \
|
||||
--header "Deploy-Token: ${_GITLAB_DEPLOY_TOKEN}" \
|
||||
"${_GITLAB_URL}";
|
||||
echo "${_VERSION}" > "${_file_last_published}";
|
||||
else
|
||||
echo "[!] Missing GITLAB_URL or GITLAB_DEPLOY_TOKEN environment variable";
|
||||
fi;
|
||||
}
|
||||
|
||||
|
||||
if [ -z "${VERSION}" ]; then
|
||||
echo "Version must be set in the form x.y.z without any leading characters";
|
||||
exit;
|
||||
echo "[!] Version must be set in the form x.y.z without any leading characters";
|
||||
exit;
|
||||
fi;
|
||||
# compare version, if different or newer, deploy
|
||||
if [ -f "${file_last_published}" ]; then
|
||||
LAST_PUBLISHED_VERSION=$(cat "${file_last_published}");
|
||||
if dpkg --compare-versions "${VERSION}" le "${LAST_PUBLISHED_VERSION}"; then
|
||||
echo "git tag version ${VERSION} is not newer than previous published version ${LAST_PUBLISHED_VERSION}";
|
||||
exit;
|
||||
fi;
|
||||
LAST_PUBLISHED_VERSION=$(cat "${file_last_published}");
|
||||
if dpkg --compare-versions "${VERSION}" le "${LAST_PUBLISHED_VERSION}"; then
|
||||
echo "[!] git tag version ${VERSION} is not newer than previous published version ${LAST_PUBLISHED_VERSION}";
|
||||
fi;
|
||||
fi;
|
||||
|
||||
# read in the .env.deploy file and we must have
|
||||
@@ -36,62 +105,30 @@ fi;
|
||||
# GITLAB_TOKEN
|
||||
# GITLAB_URL
|
||||
if [ ! -f "${BASE_FOLDER}.env.deploy" ]; then
|
||||
echo "Deploy enviroment file .env.deploy is missing";
|
||||
exit;
|
||||
echo "[!] Deploy enviroment file .env.deploy is missing";
|
||||
exit;
|
||||
fi;
|
||||
set -o allexport;
|
||||
cd "${BASE_FOLDER}" || exit;
|
||||
cd "${BASE_FOLDER}" || exit
|
||||
# shellcheck source=.env.deploy
|
||||
source .env.deploy;
|
||||
cd - || exit;
|
||||
cd - >/dev/null 2>&1 || exit;
|
||||
set +o allexport;
|
||||
|
||||
if [ "${go_flag}" != "go" ]; then
|
||||
echo "No go flag given";
|
||||
echo "Would publish ${VERSION}";
|
||||
echo "[END]";
|
||||
exit;
|
||||
echo "[!] No go flag given";
|
||||
echo "> Would publish ${VERSION}";
|
||||
echo "[END]";
|
||||
exit;
|
||||
fi;
|
||||
|
||||
echo "[START]";
|
||||
# gitea
|
||||
# skip iof
|
||||
if [ -n "${GITEA_PUBLISH}" ]; then
|
||||
if [ -n "${GITEA_UPLOAD_FILENAME}" ] &&
|
||||
[ -n "${GITEA_URL_DL}" ] && [ -n "${GITEA_URL_PUSH}" ] &&
|
||||
[ -n "${GITEA_USER}" ] && [ -n "${GITEA_TOKEN}" ]; then
|
||||
if [ ! -f "${PACKAGE_DOWNLOAD}${GITEA_UPLOAD_FILENAME}-v${VERSION}.zip" ]; then
|
||||
curl -LJO \
|
||||
--output-dir "${PACKAGE_DOWNLOAD}" \
|
||||
"${GITEA_URL_DL}"/v"${VERSION}".zip;
|
||||
fi;
|
||||
if [ ! -f "${PACKAGE_DOWNLOAD}${GITEA_UPLOAD_FILENAME}-v${VERSION}.zip" ]; then
|
||||
echo "Version file does not exist for ${VERSION}";
|
||||
else
|
||||
curl --user "${GITEA_USER}":"${GITEA_TOKEN}" \
|
||||
--upload-file "${PACKAGE_DOWNLOAD}${GITEA_UPLOAD_FILENAME}-v${VERSION}.zip" \
|
||||
"${GITEA_URL_PUSH}"?version="${VERSION}";
|
||||
echo "${VERSION}" > "${file_last_published}";
|
||||
fi;
|
||||
else
|
||||
echo "Missing either GITEA_UPLOAD_FILENAME, GITEA_URL_DL, GITEA_URL_PUSH, GITEA_USER or GITEA_TOKEN environment variable";
|
||||
fi;
|
||||
fi;
|
||||
gitea_publish "${GITEA_PUBLISH}" "${GITEA_UPLOAD_FILENAME}" "${GITEA_URL_DL}" "${GITEA_URL_PUSH}" "${GITEA_USER}" "${GITEA_TOKEN}" "${PACKAGE_DOWNLOAD}" "${VERSION}" "${file_last_published}";
|
||||
gitea_publish "${PR_GITEA_PUBLISH}" "${PR_GITEA_UPLOAD_FILENAME}" "${PR_GITEA_URL_DL}" "${PR_GITEA_URL_PUSH}" "${PR_GITEA_USER}" "${PR_GITEA_TOKEN}" "${PACKAGE_DOWNLOAD}" "${VERSION}" "${file_last_published}";
|
||||
|
||||
# gitlab
|
||||
if [ -n "${GITLAB_PUBLISH}" ]; then
|
||||
if [ -n "${GITLAB_URL}" ] && [ -n "${GITLAB_DEPLOY_TOKEN}" ]; then
|
||||
curl --data tag=v"${VERSION}" \
|
||||
--header "Deploy-Token: ${GITLAB_DEPLOY_TOKEN}" \
|
||||
"${GITLAB_URL}";
|
||||
curl --data branch=master \
|
||||
--header "Deploy-Token: ${GITLAB_DEPLOY_TOKEN}" \
|
||||
"${GITLAB_URL}";
|
||||
echo "${VERSION}" > "${file_last_published}";
|
||||
else
|
||||
echo "Missing GITLAB_URL or GITLAB_DEPLOY_TOKEN environment variable";
|
||||
fi;
|
||||
fi;
|
||||
# gitlab_publish "${GITLAB_PUBLISH}" "${GITLAB_URL}" "${GITLAB_DEPLOY_TOKEN}" "${PACKAGE_DOWNLOAD}" "${VERSION}" "${file_last_published}";
|
||||
echo "";
|
||||
echo "[DONE]";
|
||||
|
||||
|
||||
144
src/Compile/AttributeCompiler.php
Normal file
144
src/Compile/AttributeCompiler.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
namespace Smarty\Compile;
|
||||
|
||||
/**
|
||||
* This class handles compiling the attributes.
|
||||
*/
|
||||
class AttributeCompiler
|
||||
{
|
||||
/**
|
||||
* Array of names of required attributes required by tag
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $required_attributes = [];
|
||||
|
||||
/**
|
||||
* Array of names of optional attribute required by tag
|
||||
* use array('_any') if there is no restriction of attributes names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $optional_attributes = [];
|
||||
|
||||
/**
|
||||
* Shorttag attribute order defined by its names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $shorttag_order = [];
|
||||
|
||||
/**
|
||||
* Array of names of valid option flags
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $option_flags = [];
|
||||
|
||||
public function __construct(
|
||||
array $required_attributes = [],
|
||||
array $optional_attributes = [],
|
||||
array $shorttag_order = [],
|
||||
array $option_flags = []
|
||||
) {
|
||||
$this->required_attributes = $required_attributes;
|
||||
$this->optional_attributes = $optional_attributes;
|
||||
$this->shorttag_order = $shorttag_order;
|
||||
$this->option_flags = $option_flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks if the attributes passed are valid
|
||||
* The attributes passed for the tag to compile are checked against the list of required and
|
||||
* optional attributes. Required attributes must be present. Optional attributes are check against
|
||||
* the corresponding list. The keyword '_any' specifies that any attribute will be accepted
|
||||
* as valid
|
||||
*
|
||||
* @param object $compiler compiler object
|
||||
* @param array $attributes attributes applied to the tag
|
||||
*
|
||||
* @return array of mapped attributes for further processing
|
||||
*/
|
||||
public function getAttributes($compiler, $attributes)
|
||||
{
|
||||
$_indexed_attr = [];
|
||||
$options = array_fill_keys($this->option_flags, true);
|
||||
foreach ($attributes as $key => $mixed) {
|
||||
// shorthand ?
|
||||
if (!is_array($mixed)) {
|
||||
// options flag ?
|
||||
if (isset($options[trim($mixed, '\'"')])) {
|
||||
$_indexed_attr[trim($mixed, '\'"')] = true;
|
||||
// shorthand attribute ?
|
||||
} elseif (isset($this->shorttag_order[$key])) {
|
||||
$_indexed_attr[$this->shorttag_order[$key]] = $mixed;
|
||||
} else {
|
||||
// too many shorthands
|
||||
$compiler->trigger_template_error('too many shorthand attributes', null, true);
|
||||
}
|
||||
// named attribute
|
||||
} else {
|
||||
foreach ($mixed as $k => $v) {
|
||||
// options flag?
|
||||
if (isset($options[$k])) {
|
||||
if (is_bool($v)) {
|
||||
$_indexed_attr[$k] = $v;
|
||||
} else {
|
||||
if (is_string($v)) {
|
||||
$v = trim($v, '\'" ');
|
||||
}
|
||||
|
||||
// Mapping array for boolean option value
|
||||
static $optionMap = [1 => true, 0 => false, 'true' => true, 'false' => false];
|
||||
|
||||
if (isset($optionMap[$v])) {
|
||||
$_indexed_attr[$k] = $optionMap[$v];
|
||||
} else {
|
||||
$compiler->trigger_template_error(
|
||||
"illegal value '" . var_export($v, true) .
|
||||
"' for options flag '{$k}'",
|
||||
null,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
// must be named attribute
|
||||
} else {
|
||||
$_indexed_attr[$k] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// check if all required attributes present
|
||||
foreach ($this->required_attributes as $attr) {
|
||||
if (!isset($_indexed_attr[$attr])) {
|
||||
$compiler->trigger_template_error("missing '{$attr}' attribute", null, true);
|
||||
}
|
||||
}
|
||||
// check for not allowed attributes
|
||||
if ($this->optional_attributes !== ['_any']) {
|
||||
$allowedAttributes = array_fill_keys(
|
||||
array_merge(
|
||||
$this->required_attributes,
|
||||
$this->optional_attributes,
|
||||
$this->option_flags
|
||||
),
|
||||
true
|
||||
);
|
||||
foreach ($_indexed_attr as $key => $dummy) {
|
||||
if (!isset($allowedAttributes[$key]) && $key !== 0) {
|
||||
$compiler->trigger_template_error("unexpected '{$key}' attribute", null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
// default 'false' for all options flags not set
|
||||
foreach ($this->option_flags as $flag) {
|
||||
if (!isset($_indexed_attr[$flag])) {
|
||||
$_indexed_attr[$flag] = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $_indexed_attr;
|
||||
}
|
||||
}
|
||||
@@ -82,84 +82,12 @@ abstract class Base implements CompilerInterface {
|
||||
* @return array of mapped attributes for further processing
|
||||
*/
|
||||
protected function getAttributes($compiler, $attributes) {
|
||||
$_indexed_attr = [];
|
||||
$options = array_fill_keys($this->option_flags, true);
|
||||
foreach ($attributes as $key => $mixed) {
|
||||
// shorthand ?
|
||||
if (!is_array($mixed)) {
|
||||
// options flag ?
|
||||
if (isset($options[trim($mixed, '\'"')])) {
|
||||
$_indexed_attr[trim($mixed, '\'"')] = true;
|
||||
// shorthand attribute ?
|
||||
} elseif (isset($this->shorttag_order[$key])) {
|
||||
$_indexed_attr[$this->shorttag_order[$key]] = $mixed;
|
||||
} else {
|
||||
// too many shorthands
|
||||
$compiler->trigger_template_error('too many shorthand attributes', null, true);
|
||||
}
|
||||
// named attribute
|
||||
} else {
|
||||
foreach ($mixed as $k => $v) {
|
||||
// options flag?
|
||||
if (isset($options[$k])) {
|
||||
if (is_bool($v)) {
|
||||
$_indexed_attr[$k] = $v;
|
||||
} else {
|
||||
if (is_string($v)) {
|
||||
$v = trim($v, '\'" ');
|
||||
}
|
||||
|
||||
// Mapping array for boolean option value
|
||||
static $optionMap = [1 => true, 0 => false, 'true' => true, 'false' => false];
|
||||
|
||||
if (isset($optionMap[$v])) {
|
||||
$_indexed_attr[$k] = $optionMap[$v];
|
||||
} else {
|
||||
$compiler->trigger_template_error(
|
||||
"illegal value '" . var_export($v, true) .
|
||||
"' for options flag '{$k}'",
|
||||
null,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
// must be named attribute
|
||||
} else {
|
||||
$_indexed_attr[$k] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// check if all required attributes present
|
||||
foreach ($this->required_attributes as $attr) {
|
||||
if (!isset($_indexed_attr[$attr])) {
|
||||
$compiler->trigger_template_error("missing '{$attr}' attribute", null, true);
|
||||
}
|
||||
}
|
||||
// check for not allowed attributes
|
||||
if ($this->optional_attributes !== ['_any']) {
|
||||
$allowedAttributes = array_fill_keys(
|
||||
array_merge(
|
||||
$this->required_attributes,
|
||||
$this->optional_attributes,
|
||||
$this->option_flags
|
||||
),
|
||||
true
|
||||
);
|
||||
foreach ($_indexed_attr as $key => $dummy) {
|
||||
if (!isset($allowedAttributes[$key]) && $key !== 0) {
|
||||
$compiler->trigger_template_error("unexpected '{$key}' attribute", null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
// default 'false' for all options flags not set
|
||||
foreach ($this->option_flags as $flag) {
|
||||
if (!isset($_indexed_attr[$flag])) {
|
||||
$_indexed_attr[$flag] = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $_indexed_attr;
|
||||
return (new AttributeCompiler(
|
||||
$this->required_attributes,
|
||||
$this->optional_attributes,
|
||||
$this->shorttag_order,
|
||||
$this->option_flags
|
||||
))->getAttributes($compiler, $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,24 +3,18 @@
|
||||
* Smarty Internal Plugin Compile Registered Function
|
||||
* Compiles code for the execution of a registered function
|
||||
*
|
||||
|
||||
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
namespace Smarty\Compile;
|
||||
|
||||
use Smarty\Compiler\Template;
|
||||
use Smarty\CompilerException;
|
||||
use Smarty\FunctionHandler\AttributeFunctionHandlerInterface;
|
||||
|
||||
/**
|
||||
* Smarty Internal Plugin Compile Registered Function Class
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
class FunctionCallCompiler extends Base {
|
||||
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -51,17 +45,27 @@ class FunctionCallCompiler extends Base {
|
||||
*/
|
||||
public function compile($args, Template $compiler, $parameter = [], $tag = null, $function = null): string
|
||||
{
|
||||
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
unset($_attr['nocache']);
|
||||
|
||||
$_paramsArray = $this->formatParamsArray($_attr);
|
||||
$_params = 'array(' . implode(',', $_paramsArray) . ')';
|
||||
|
||||
|
||||
if ($functionHandler = $compiler->getSmarty()->getFunctionHandler($function)) {
|
||||
|
||||
$attribute_overrides = [];
|
||||
|
||||
if ($functionHandler instanceof AttributeFunctionHandlerInterface) {
|
||||
$attribute_overrides = $functionHandler->getSupportedAttributes();
|
||||
}
|
||||
|
||||
// check and get attributes
|
||||
$_attr = (new AttributeCompiler(
|
||||
$attribute_overrides['required_attributes'] ?? $this->required_attributes,
|
||||
$attribute_overrides['optional_attributes'] ?? $this->optional_attributes,
|
||||
$attribute_overrides['shorttag_order'] ?? $this->shorttag_order,
|
||||
$attribute_overrides['option_flags'] ?? $this->option_flags
|
||||
))->getAttributes($compiler, $args);
|
||||
|
||||
unset($_attr['nocache']);
|
||||
|
||||
$_paramsArray = $this->formatParamsArray($_attr);
|
||||
$_params = 'array(' . implode(',', $_paramsArray) . ')';
|
||||
|
||||
// not cacheable?
|
||||
$compiler->tag_nocache = $compiler->tag_nocache || !$functionHandler->isCacheable();
|
||||
$output = "\$_smarty_tpl->getSmarty()->getFunctionHandler(" . var_export($function, true) . ")";
|
||||
|
||||
@@ -1146,12 +1146,12 @@ class Template extends BaseCompiler {
|
||||
}
|
||||
|
||||
// check if tag is a function
|
||||
if ($this->smarty->getFunctionHandler($base_tag)) {
|
||||
if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($base_tag, $this)) {
|
||||
if ($this->smarty->getFunctionHandler($tag)) {
|
||||
if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) {
|
||||
return (new \Smarty\Compile\PrintExpressionCompiler())->compile(
|
||||
['nofilter'], // functions are never auto-escaped
|
||||
$this,
|
||||
['value' => $this->compileFunctionCall($base_tag, $args, $parameter)]
|
||||
['value' => $this->compileFunctionCall($tag, $args, $parameter)]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1164,16 +1164,16 @@ class Template extends BaseCompiler {
|
||||
}
|
||||
|
||||
// the default plugin handler is a handler of last resort, it may also handle not specifically registered tags.
|
||||
if ($callback = $this->getPluginFromDefaultHandler($base_tag, Smarty::PLUGIN_COMPILER)) {
|
||||
if ($callback = $this->getPluginFromDefaultHandler($tag, Smarty::PLUGIN_COMPILER)) {
|
||||
if (!empty($parameter['modifierlist'])) {
|
||||
throw new CompilerException('No modifiers allowed on ' . $base_tag);
|
||||
throw new CompilerException('No modifiers allowed on ' . $tag);
|
||||
}
|
||||
$tagCompiler = new \Smarty\Compile\Tag\BCPluginWrapper($callback);
|
||||
return $tagCompiler->compile($args, $this, $parameter);
|
||||
}
|
||||
|
||||
if ($this->getPluginFromDefaultHandler($base_tag, Smarty::PLUGIN_FUNCTION)) {
|
||||
return $this->defaultHandlerFunctionCallCompiler->compile($args, $this, $parameter, $tag, $base_tag);
|
||||
return $this->defaultHandlerFunctionCallCompiler->compile($args, $this, $parameter, $tag, $tag);
|
||||
}
|
||||
|
||||
if ($this->getPluginFromDefaultHandler($base_tag, Smarty::PLUGIN_BLOCK)) {
|
||||
|
||||
@@ -168,7 +168,6 @@ class BCPluginsAdapter extends Base {
|
||||
}
|
||||
|
||||
public function loadPluginsFromDir(string $path) {
|
||||
|
||||
foreach([
|
||||
'function',
|
||||
'modifier',
|
||||
@@ -177,6 +176,7 @@ class BCPluginsAdapter extends Base {
|
||||
'prefilter',
|
||||
'postfilter',
|
||||
'outputfilter',
|
||||
'modifiercompiler',
|
||||
] as $type) {
|
||||
foreach (glob($path . $type . '.?*.php') as $filename) {
|
||||
$pluginName = $this->getPluginNameFromFilename($filename);
|
||||
@@ -226,4 +226,4 @@ class BCPluginsAdapter extends Base {
|
||||
return $matches[1];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ class DefaultExtension extends Base {
|
||||
break;
|
||||
}
|
||||
foreach ($var as $curr_key => $curr_val) {
|
||||
$results .= '<br>' . str_repeat(' ', $depth * 2) . '<b>' . strtr($curr_key, $_replace) .
|
||||
$results .= '<br>' . str_repeat(' ', $depth * 2) . '<b>' . htmlspecialchars(strtr($curr_key, $_replace)) .
|
||||
'</b> => ' .
|
||||
$this->smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects);
|
||||
$depth--;
|
||||
@@ -341,7 +341,7 @@ class DefaultExtension extends Base {
|
||||
}
|
||||
$objects[] = $var;
|
||||
foreach ($object_vars as $curr_key => $curr_val) {
|
||||
$results .= '<br>' . str_repeat(' ', $depth * 2) . '<b> ->' . strtr($curr_key, $_replace) .
|
||||
$results .= '<br>' . str_repeat(' ', $depth * 2) . '<b> ->' . htmlspecialchars(strtr($curr_key, $_replace)) .
|
||||
'</b> = ' . $this->smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects);
|
||||
$depth--;
|
||||
}
|
||||
|
||||
77
src/FunctionHandler/AttributeBase.php
Normal file
77
src/FunctionHandler/AttributeBase.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace Smarty\FunctionHandler;
|
||||
|
||||
use Smarty\Template;
|
||||
|
||||
/**
|
||||
* Abstract implementation for function handlers which support custom attributes
|
||||
*/
|
||||
abstract class AttributeBase implements AttributeFunctionHandlerInterface
|
||||
{
|
||||
/**
|
||||
* Array of names of required attribute required by tag
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected array $required_attributes = [];
|
||||
|
||||
/**
|
||||
* Array of names of optional attribute required by tag
|
||||
* use array('_any') if there is no restriction of attributes names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected array $optional_attributes = [];
|
||||
|
||||
/**
|
||||
* Shorttag attribute order defined by its names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected array $shorttag_order = [];
|
||||
|
||||
/**
|
||||
* Array of names of valid option flags
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected array $option_flags = [];
|
||||
|
||||
/**
|
||||
* Return whether the output is cacheable.
|
||||
* @var bool
|
||||
*/
|
||||
protected bool $cacheable = true;
|
||||
|
||||
/**
|
||||
* Return whether the output is cacheable.
|
||||
* @return bool
|
||||
*/
|
||||
public function isCacheable(): bool
|
||||
{
|
||||
return $this->cacheable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function body
|
||||
* @param mixed $params The supplied parameters.
|
||||
* @param Smarty\Template $template
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function handle($params, Template $template): ?string;
|
||||
|
||||
/**
|
||||
* Return the support attributes for this function.
|
||||
* @return array<string, array>
|
||||
*/
|
||||
public function getSupportedAttributes(): array
|
||||
{
|
||||
return [
|
||||
'required_attributes' => $this->required_attributes,
|
||||
'optional_attributes' => $this->optional_attributes,
|
||||
'shorttag_order' => $this->shorttag_order,
|
||||
'option_flags' => $this->option_flags,
|
||||
];
|
||||
}
|
||||
}
|
||||
15
src/FunctionHandler/AttributeFunctionHandlerInterface.php
Normal file
15
src/FunctionHandler/AttributeFunctionHandlerInterface.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Smarty\FunctionHandler;
|
||||
|
||||
/**
|
||||
* Function handler interface with support for specifying supported properties
|
||||
*/
|
||||
interface AttributeFunctionHandlerInterface extends FunctionHandlerInterface
|
||||
{
|
||||
/**
|
||||
* Returns an array with the supported attributes, flags, and shorttags
|
||||
* @return array<string, array>
|
||||
*/
|
||||
public function getSupportedAttributes(): array;
|
||||
}
|
||||
@@ -263,9 +263,9 @@ class TemplateParser
|
||||
const TP_ARRAYOPEN = 57;
|
||||
const TP_QUOTE = 58;
|
||||
const TP_BACKTICK = 59;
|
||||
const YY_NO_ACTION = 541;
|
||||
const YY_ACCEPT_ACTION = 540;
|
||||
const YY_ERROR_ACTION = 539;
|
||||
const YY_NO_ACTION = 542;
|
||||
const YY_ACCEPT_ACTION = 541;
|
||||
const YY_ERROR_ACTION = 540;
|
||||
|
||||
const YY_SZ_ACTTAB = 2565;
|
||||
public static $yy_action = array(
|
||||
@@ -286,7 +286,7 @@ public static $yy_action = array(
|
||||
278, 226, 302, 282, 200, 203, 446, 53, 4, 115,
|
||||
302, 47, 22, 285, 41, 5, 54, 247, 248, 249,
|
||||
1, 139, 137, 267, 202, 141, 6, 87, 14, 222,
|
||||
540, 99, 112, 151, 15, 446, 217, 261, 218, 314,
|
||||
541, 99, 112, 151, 15, 446, 217, 261, 218, 314,
|
||||
224, 216, 21, 256, 233, 44, 9, 446, 45, 46,
|
||||
278, 226, 325, 282, 268, 203, 53, 53, 4, 302,
|
||||
302, 152, 257, 361, 320, 5, 54, 247, 248, 249,
|
||||
@@ -338,194 +338,194 @@ public static $yy_action = array(
|
||||
288, 362, 216, 327, 200, 114, 396, 362, 201, 119,
|
||||
72, 336, 396, 37, 259, 101, 393, 19, 273, 274,
|
||||
154, 258, 228, 339, 94, 281, 204, 283, 393, 289,
|
||||
256, 300, 298, 301, 393, 38, 313, 288, 313, 216,
|
||||
313, 313, 114, 207, 319, 201, 119, 72, 313, 313,
|
||||
313, 313, 101, 221, 184, 273, 274, 156, 313, 313,
|
||||
313, 95, 281, 204, 283, 313, 289, 256, 300, 298,
|
||||
301, 313, 313, 313, 288, 313, 216, 313, 313, 108,
|
||||
206, 319, 201, 122, 51, 313, 120, 313, 313, 101,
|
||||
313, 184, 273, 274, 313, 313, 313, 313, 313, 281,
|
||||
204, 283, 313, 289, 313, 300, 298, 301, 288, 313,
|
||||
216, 313, 313, 114, 313, 313, 201, 122, 67, 313,
|
||||
313, 313, 313, 101, 313, 313, 273, 274, 313, 313,
|
||||
313, 313, 313, 281, 204, 283, 313, 289, 313, 300,
|
||||
298, 301, 288, 313, 216, 313, 313, 114, 212, 313,
|
||||
201, 122, 67, 313, 313, 313, 313, 101, 313, 313,
|
||||
273, 274, 313, 313, 313, 313, 313, 281, 204, 283,
|
||||
313, 289, 313, 300, 298, 301, 288, 313, 216, 313,
|
||||
313, 114, 205, 313, 201, 119, 72, 313, 313, 313,
|
||||
313, 101, 313, 313, 273, 274, 313, 313, 313, 313,
|
||||
313, 281, 204, 283, 313, 289, 313, 300, 298, 301,
|
||||
313, 313, 313, 288, 313, 216, 313, 313, 114, 313,
|
||||
318, 201, 122, 78, 313, 313, 313, 313, 101, 313,
|
||||
482, 273, 274, 482, 313, 313, 313, 482, 281, 204,
|
||||
283, 313, 289, 209, 211, 298, 301, 288, 313, 216,
|
||||
313, 313, 108, 313, 313, 201, 122, 58, 313, 238,
|
||||
313, 313, 101, 313, 313, 273, 274, 313, 313, 482,
|
||||
313, 313, 281, 204, 283, 313, 289, 313, 300, 298,
|
||||
301, 288, 313, 216, 313, 313, 114, 313, 313, 201,
|
||||
118, 64, 313, 313, 313, 313, 101, 313, 313, 273,
|
||||
274, 313, 313, 313, 313, 313, 281, 204, 283, 313,
|
||||
289, 313, 300, 298, 301, 288, 313, 216, 313, 313,
|
||||
114, 313, 313, 196, 117, 59, 313, 313, 313, 313,
|
||||
101, 313, 313, 273, 274, 313, 313, 313, 313, 313,
|
||||
281, 204, 283, 313, 289, 313, 300, 298, 301, 288,
|
||||
313, 216, 313, 313, 114, 313, 313, 201, 104, 84,
|
||||
313, 313, 313, 313, 101, 313, 313, 273, 274, 313,
|
||||
313, 313, 313, 313, 281, 204, 283, 313, 289, 313,
|
||||
300, 298, 301, 288, 313, 216, 313, 313, 114, 313,
|
||||
313, 201, 105, 83, 313, 313, 313, 313, 101, 313,
|
||||
313, 273, 274, 313, 313, 313, 313, 313, 281, 204,
|
||||
283, 313, 289, 313, 300, 298, 301, 288, 313, 216,
|
||||
313, 313, 114, 313, 313, 201, 122, 55, 313, 313,
|
||||
313, 313, 101, 313, 313, 273, 274, 313, 313, 313,
|
||||
313, 313, 281, 204, 283, 313, 289, 313, 300, 298,
|
||||
301, 288, 313, 216, 313, 313, 114, 313, 313, 201,
|
||||
122, 66, 313, 313, 313, 313, 101, 313, 313, 273,
|
||||
274, 313, 313, 313, 313, 313, 281, 204, 283, 313,
|
||||
289, 313, 300, 298, 301, 288, 313, 216, 313, 313,
|
||||
114, 313, 313, 201, 104, 56, 313, 313, 313, 313,
|
||||
101, 313, 313, 273, 274, 313, 313, 313, 313, 313,
|
||||
281, 204, 283, 313, 289, 313, 300, 298, 301, 288,
|
||||
313, 216, 313, 313, 114, 313, 313, 201, 122, 65,
|
||||
313, 313, 313, 313, 101, 313, 313, 273, 274, 313,
|
||||
313, 313, 313, 313, 281, 204, 283, 313, 289, 313,
|
||||
300, 298, 301, 288, 313, 216, 313, 313, 114, 313,
|
||||
313, 201, 122, 57, 313, 313, 313, 313, 101, 313,
|
||||
313, 273, 274, 313, 313, 313, 313, 313, 281, 204,
|
||||
283, 313, 289, 313, 300, 298, 301, 288, 313, 216,
|
||||
313, 313, 114, 313, 313, 201, 122, 58, 313, 313,
|
||||
313, 313, 101, 313, 313, 273, 274, 313, 313, 313,
|
||||
313, 313, 281, 204, 283, 313, 289, 313, 300, 298,
|
||||
301, 288, 313, 216, 313, 313, 114, 313, 313, 201,
|
||||
122, 68, 313, 313, 313, 313, 101, 313, 313, 273,
|
||||
274, 313, 313, 313, 313, 313, 281, 204, 283, 313,
|
||||
289, 313, 300, 298, 301, 288, 313, 216, 313, 313,
|
||||
114, 313, 313, 201, 122, 69, 313, 313, 313, 313,
|
||||
101, 313, 313, 273, 274, 313, 313, 313, 313, 313,
|
||||
281, 204, 283, 313, 289, 313, 300, 298, 301, 288,
|
||||
313, 216, 313, 313, 114, 313, 313, 201, 122, 70,
|
||||
313, 313, 313, 313, 101, 313, 313, 273, 274, 313,
|
||||
313, 313, 313, 313, 281, 204, 283, 313, 289, 313,
|
||||
300, 298, 301, 288, 313, 216, 313, 313, 114, 313,
|
||||
313, 201, 122, 71, 313, 313, 313, 313, 101, 313,
|
||||
313, 273, 274, 313, 313, 313, 313, 313, 281, 204,
|
||||
283, 313, 289, 313, 300, 298, 301, 288, 313, 216,
|
||||
313, 313, 114, 313, 313, 201, 122, 73, 313, 313,
|
||||
313, 313, 101, 313, 313, 273, 274, 313, 313, 313,
|
||||
313, 313, 281, 204, 283, 313, 289, 313, 300, 298,
|
||||
301, 288, 313, 216, 313, 313, 114, 313, 313, 195,
|
||||
122, 61, 313, 313, 313, 313, 101, 313, 313, 273,
|
||||
274, 313, 313, 313, 313, 313, 281, 204, 283, 313,
|
||||
289, 313, 300, 298, 301, 288, 313, 216, 313, 313,
|
||||
114, 313, 313, 201, 122, 62, 313, 313, 313, 313,
|
||||
101, 313, 313, 273, 274, 313, 313, 313, 313, 313,
|
||||
281, 204, 283, 313, 289, 313, 300, 298, 301, 288,
|
||||
313, 216, 313, 313, 114, 313, 313, 201, 122, 63,
|
||||
313, 313, 313, 313, 101, 313, 313, 273, 274, 313,
|
||||
313, 313, 313, 313, 281, 204, 283, 313, 289, 313,
|
||||
300, 298, 301, 288, 313, 216, 313, 313, 114, 313,
|
||||
313, 201, 122, 74, 313, 313, 313, 313, 101, 313,
|
||||
313, 273, 274, 313, 313, 313, 313, 313, 281, 204,
|
||||
283, 313, 289, 313, 300, 298, 301, 288, 313, 216,
|
||||
313, 313, 114, 313, 313, 201, 122, 75, 313, 313,
|
||||
313, 313, 101, 313, 313, 273, 274, 313, 313, 313,
|
||||
313, 313, 281, 204, 283, 313, 289, 313, 300, 298,
|
||||
301, 288, 313, 216, 313, 313, 114, 313, 313, 201,
|
||||
122, 76, 313, 313, 313, 313, 101, 313, 313, 273,
|
||||
274, 313, 313, 313, 313, 313, 281, 204, 283, 313,
|
||||
289, 313, 300, 298, 301, 288, 313, 216, 313, 313,
|
||||
114, 313, 313, 201, 122, 77, 313, 313, 313, 313,
|
||||
101, 313, 313, 273, 274, 313, 313, 313, 313, 313,
|
||||
281, 204, 283, 313, 289, 313, 300, 298, 301, 288,
|
||||
313, 216, 313, 313, 114, 313, 313, 201, 122, 79,
|
||||
313, 313, 313, 313, 101, 313, 313, 273, 274, 313,
|
||||
313, 313, 313, 313, 281, 204, 283, 313, 289, 313,
|
||||
210, 298, 301, 288, 313, 216, 313, 313, 114, 313,
|
||||
313, 201, 122, 80, 313, 313, 313, 313, 101, 313,
|
||||
313, 273, 274, 313, 313, 313, 313, 313, 281, 204,
|
||||
283, 313, 289, 313, 300, 298, 301, 288, 313, 216,
|
||||
313, 313, 114, 313, 313, 201, 122, 81, 313, 313,
|
||||
313, 313, 101, 313, 313, 273, 274, 313, 313, 313,
|
||||
313, 313, 281, 204, 283, 313, 289, 313, 300, 298,
|
||||
301, 288, 313, 216, 313, 313, 114, 313, 313, 201,
|
||||
122, 82, 313, 313, 313, 313, 101, 313, 313, 273,
|
||||
274, 313, 313, 313, 313, 313, 281, 204, 283, 313,
|
||||
289, 313, 300, 298, 301, 288, 313, 216, 313, 313,
|
||||
114, 313, 313, 201, 122, 50, 313, 313, 313, 313,
|
||||
101, 313, 313, 273, 274, 313, 313, 313, 313, 313,
|
||||
281, 204, 283, 313, 289, 313, 300, 298, 301, 288,
|
||||
313, 216, 313, 313, 114, 313, 313, 201, 122, 52,
|
||||
313, 313, 313, 313, 101, 313, 313, 273, 274, 313,
|
||||
313, 313, 313, 313, 281, 204, 283, 313, 289, 313,
|
||||
300, 298, 301, 288, 313, 216, 168, 313, 114, 313,
|
||||
313, 201, 134, 313, 313, 313, 256, 313, 101, 47,
|
||||
22, 285, 41, 313, 313, 313, 313, 333, 281, 204,
|
||||
283, 313, 289, 313, 300, 298, 301, 288, 313, 216,
|
||||
145, 313, 114, 313, 313, 201, 128, 313, 313, 313,
|
||||
256, 313, 101, 47, 22, 285, 41, 313, 313, 313,
|
||||
313, 287, 281, 204, 283, 315, 289, 313, 300, 298,
|
||||
301, 247, 248, 249, 2, 313, 313, 313, 313, 313,
|
||||
6, 87, 259, 313, 313, 19, 112, 313, 14, 258,
|
||||
217, 261, 218, 313, 15, 39, 313, 14, 14, 42,
|
||||
43, 286, 12, 15, 15, 313, 313, 313, 42, 43,
|
||||
286, 12, 313, 313, 313, 313, 293, 294, 295, 296,
|
||||
308, 27, 313, 313, 315, 293, 294, 295, 296, 313,
|
||||
247, 248, 249, 2, 313, 313, 313, 110, 313, 6,
|
||||
87, 313, 313, 313, 313, 112, 313, 313, 148, 217,
|
||||
261, 218, 313, 42, 43, 286, 12, 313, 42, 43,
|
||||
286, 12, 313, 313, 313, 313, 313, 313, 313, 313,
|
||||
293, 294, 295, 296, 313, 293, 294, 295, 296, 309,
|
||||
27, 313, 313, 240, 241, 242, 133, 223, 313, 247,
|
||||
248, 249, 1, 313, 482, 313, 313, 482, 6, 87,
|
||||
3, 482, 466, 313, 112, 313, 276, 313, 217, 261,
|
||||
218, 288, 313, 216, 313, 313, 114, 313, 313, 201,
|
||||
132, 313, 313, 313, 313, 313, 101, 313, 466, 313,
|
||||
313, 466, 313, 482, 313, 466, 281, 204, 283, 313,
|
||||
289, 313, 300, 298, 301, 313, 288, 313, 216, 313,
|
||||
200, 114, 313, 313, 201, 123, 313, 313, 313, 313,
|
||||
313, 101, 365, 313, 313, 313, 230, 313, 313, 313,
|
||||
313, 281, 204, 283, 14, 289, 313, 300, 298, 301,
|
||||
15, 313, 288, 446, 216, 313, 169, 114, 313, 313,
|
||||
201, 124, 313, 313, 313, 446, 256, 101, 313, 47,
|
||||
22, 285, 41, 313, 313, 313, 313, 281, 204, 283,
|
||||
313, 289, 313, 300, 298, 301, 313, 288, 313, 216,
|
||||
313, 313, 114, 313, 313, 201, 125, 313, 313, 313,
|
||||
313, 313, 101, 313, 313, 313, 313, 313, 313, 313,
|
||||
313, 313, 281, 204, 283, 313, 289, 313, 300, 298,
|
||||
301, 313, 313, 288, 313, 216, 313, 313, 114, 313,
|
||||
313, 201, 126, 313, 313, 313, 313, 313, 101, 313,
|
||||
313, 313, 313, 313, 313, 313, 313, 313, 281, 204,
|
||||
283, 313, 289, 313, 300, 298, 301, 313, 288, 313,
|
||||
216, 313, 313, 114, 313, 313, 201, 127, 313, 313,
|
||||
313, 313, 313, 101, 313, 313, 313, 313, 313, 313,
|
||||
313, 313, 313, 281, 204, 283, 313, 289, 313, 300,
|
||||
298, 301, 313, 313, 288, 313, 216, 223, 313, 114,
|
||||
313, 313, 201, 131, 482, 313, 313, 482, 313, 101,
|
||||
313, 482, 466, 313, 313, 313, 276, 313, 313, 281,
|
||||
204, 283, 313, 289, 313, 300, 298, 301, 313, 313,
|
||||
409, 313, 313, 313, 313, 313, 313, 313, 466, 313,
|
||||
313, 466, 313, 482, 223, 466, 292, 313, 313, 313,
|
||||
313, 482, 313, 313, 482, 313, 313, 36, 482, 466,
|
||||
313, 223, 446, 276, 409, 409, 409, 409, 482, 313,
|
||||
313, 482, 313, 313, 446, 482, 466, 313, 313, 30,
|
||||
276, 409, 409, 409, 409, 466, 482, 313, 466, 482,
|
||||
482, 313, 466, 482, 466, 313, 313, 313, 276, 313,
|
||||
313, 313, 466, 313, 313, 466, 332, 482, 313, 466,
|
||||
313, 313, 313, 313, 313, 331, 42, 43, 286, 12,
|
||||
466, 313, 313, 466, 313, 482, 313, 466, 313, 42,
|
||||
43, 286, 12, 293, 294, 295, 296, 307, 313, 42,
|
||||
43, 286, 12, 185, 313, 313, 293, 294, 295, 296,
|
||||
186, 313, 313, 313, 322, 313, 293, 294, 295, 296,
|
||||
42, 43, 286, 12, 31, 313, 42, 43, 286, 12,
|
||||
313, 334, 313, 42, 43, 286, 12, 293, 294, 295,
|
||||
296, 313, 313, 293, 294, 295, 296, 313, 313, 313,
|
||||
256, 300, 298, 301, 393, 38, 314, 288, 314, 216,
|
||||
314, 314, 114, 207, 319, 201, 119, 72, 314, 314,
|
||||
314, 314, 101, 221, 184, 273, 274, 156, 314, 314,
|
||||
314, 95, 281, 204, 283, 314, 289, 256, 300, 298,
|
||||
301, 314, 314, 314, 288, 314, 216, 314, 314, 108,
|
||||
206, 319, 201, 122, 51, 314, 120, 314, 314, 101,
|
||||
314, 184, 273, 274, 314, 314, 314, 314, 314, 281,
|
||||
204, 283, 314, 289, 314, 300, 298, 301, 288, 314,
|
||||
216, 314, 314, 114, 314, 314, 201, 122, 67, 314,
|
||||
314, 314, 314, 101, 314, 314, 273, 274, 314, 314,
|
||||
314, 314, 314, 281, 204, 283, 314, 289, 314, 300,
|
||||
298, 301, 288, 314, 216, 314, 314, 114, 212, 314,
|
||||
201, 122, 67, 314, 314, 314, 314, 101, 314, 314,
|
||||
273, 274, 314, 314, 314, 314, 314, 281, 204, 283,
|
||||
314, 289, 314, 300, 298, 301, 288, 314, 216, 314,
|
||||
314, 114, 205, 314, 201, 119, 72, 314, 314, 314,
|
||||
314, 101, 314, 314, 273, 274, 314, 314, 314, 314,
|
||||
314, 281, 204, 283, 314, 289, 314, 300, 298, 301,
|
||||
314, 314, 314, 288, 314, 216, 314, 314, 114, 314,
|
||||
318, 201, 122, 78, 314, 314, 314, 314, 101, 314,
|
||||
482, 273, 274, 482, 314, 314, 314, 482, 281, 204,
|
||||
283, 314, 289, 209, 211, 298, 301, 288, 314, 216,
|
||||
314, 314, 108, 314, 314, 201, 122, 58, 314, 238,
|
||||
314, 314, 101, 314, 314, 273, 274, 314, 314, 482,
|
||||
314, 314, 281, 204, 283, 314, 289, 314, 300, 298,
|
||||
301, 288, 314, 216, 314, 314, 114, 314, 314, 201,
|
||||
118, 64, 314, 314, 314, 314, 101, 314, 314, 273,
|
||||
274, 314, 314, 314, 314, 314, 281, 204, 283, 314,
|
||||
289, 314, 300, 298, 301, 288, 314, 216, 314, 314,
|
||||
114, 314, 314, 196, 117, 59, 314, 314, 314, 314,
|
||||
101, 314, 314, 273, 274, 314, 314, 314, 314, 314,
|
||||
281, 204, 283, 314, 289, 314, 300, 298, 301, 288,
|
||||
314, 216, 314, 314, 114, 314, 314, 201, 104, 84,
|
||||
314, 314, 314, 314, 101, 314, 314, 273, 274, 314,
|
||||
314, 314, 314, 314, 281, 204, 283, 314, 289, 314,
|
||||
300, 298, 301, 288, 314, 216, 314, 314, 114, 314,
|
||||
314, 201, 105, 83, 314, 314, 314, 314, 101, 314,
|
||||
314, 273, 274, 314, 314, 314, 314, 314, 281, 204,
|
||||
283, 314, 289, 314, 300, 298, 301, 288, 314, 216,
|
||||
314, 314, 114, 314, 314, 201, 122, 55, 314, 314,
|
||||
314, 314, 101, 314, 314, 273, 274, 314, 314, 314,
|
||||
314, 314, 281, 204, 283, 314, 289, 314, 300, 298,
|
||||
301, 288, 314, 216, 314, 314, 114, 314, 314, 201,
|
||||
122, 66, 314, 314, 314, 314, 101, 314, 314, 273,
|
||||
274, 314, 314, 314, 314, 314, 281, 204, 283, 314,
|
||||
289, 314, 300, 298, 301, 288, 314, 216, 314, 314,
|
||||
114, 314, 314, 201, 104, 56, 314, 314, 314, 314,
|
||||
101, 314, 314, 273, 274, 314, 314, 314, 314, 314,
|
||||
281, 204, 283, 314, 289, 314, 300, 298, 301, 288,
|
||||
314, 216, 314, 314, 114, 314, 314, 201, 122, 65,
|
||||
314, 314, 314, 314, 101, 314, 314, 273, 274, 314,
|
||||
314, 314, 314, 314, 281, 204, 283, 314, 289, 314,
|
||||
300, 298, 301, 288, 314, 216, 314, 314, 114, 314,
|
||||
314, 201, 122, 57, 314, 314, 314, 314, 101, 314,
|
||||
314, 273, 274, 314, 314, 314, 314, 314, 281, 204,
|
||||
283, 314, 289, 314, 300, 298, 301, 288, 314, 216,
|
||||
314, 314, 114, 314, 314, 201, 122, 58, 314, 314,
|
||||
314, 314, 101, 314, 314, 273, 274, 314, 314, 314,
|
||||
314, 314, 281, 204, 283, 314, 289, 314, 300, 298,
|
||||
301, 288, 314, 216, 314, 314, 114, 314, 314, 201,
|
||||
122, 68, 314, 314, 314, 314, 101, 314, 314, 273,
|
||||
274, 314, 314, 314, 314, 314, 281, 204, 283, 314,
|
||||
289, 314, 300, 298, 301, 288, 314, 216, 314, 314,
|
||||
114, 314, 314, 201, 122, 69, 314, 314, 314, 314,
|
||||
101, 314, 314, 273, 274, 314, 314, 314, 314, 314,
|
||||
281, 204, 283, 314, 289, 314, 300, 298, 301, 288,
|
||||
314, 216, 314, 314, 114, 314, 314, 201, 122, 70,
|
||||
314, 314, 314, 314, 101, 314, 314, 273, 274, 314,
|
||||
314, 314, 314, 314, 281, 204, 283, 314, 289, 314,
|
||||
300, 298, 301, 288, 314, 216, 314, 314, 114, 314,
|
||||
314, 201, 122, 71, 314, 314, 314, 314, 101, 314,
|
||||
314, 273, 274, 314, 314, 314, 314, 314, 281, 204,
|
||||
283, 314, 289, 314, 300, 298, 301, 288, 314, 216,
|
||||
314, 314, 114, 314, 314, 201, 122, 73, 314, 314,
|
||||
314, 314, 101, 314, 314, 273, 274, 314, 314, 314,
|
||||
314, 314, 281, 204, 283, 314, 289, 314, 300, 298,
|
||||
301, 288, 314, 216, 314, 314, 114, 314, 314, 195,
|
||||
122, 61, 314, 314, 314, 314, 101, 314, 314, 273,
|
||||
274, 314, 314, 314, 314, 314, 281, 204, 283, 314,
|
||||
289, 314, 300, 298, 301, 288, 314, 216, 314, 314,
|
||||
114, 314, 314, 201, 122, 62, 314, 314, 314, 314,
|
||||
101, 314, 314, 273, 274, 314, 314, 314, 314, 314,
|
||||
281, 204, 283, 314, 289, 314, 300, 298, 301, 288,
|
||||
314, 216, 314, 314, 114, 314, 314, 201, 122, 63,
|
||||
314, 314, 314, 314, 101, 314, 314, 273, 274, 314,
|
||||
314, 314, 314, 314, 281, 204, 283, 314, 289, 314,
|
||||
300, 298, 301, 288, 314, 216, 314, 314, 114, 314,
|
||||
314, 201, 122, 74, 314, 314, 314, 314, 101, 314,
|
||||
314, 273, 274, 314, 314, 314, 314, 314, 281, 204,
|
||||
283, 314, 289, 314, 300, 298, 301, 288, 314, 216,
|
||||
314, 314, 114, 314, 314, 201, 122, 75, 314, 314,
|
||||
314, 314, 101, 314, 314, 273, 274, 314, 314, 314,
|
||||
314, 314, 281, 204, 283, 314, 289, 314, 300, 298,
|
||||
301, 288, 314, 216, 314, 314, 114, 314, 314, 201,
|
||||
122, 76, 314, 314, 314, 314, 101, 314, 314, 273,
|
||||
274, 314, 314, 314, 314, 314, 281, 204, 283, 314,
|
||||
289, 314, 300, 298, 301, 288, 314, 216, 314, 314,
|
||||
114, 314, 314, 201, 122, 77, 314, 314, 314, 314,
|
||||
101, 314, 314, 273, 274, 314, 314, 314, 314, 314,
|
||||
281, 204, 283, 314, 289, 314, 300, 298, 301, 288,
|
||||
314, 216, 314, 314, 114, 314, 314, 201, 122, 79,
|
||||
314, 314, 314, 314, 101, 314, 314, 273, 274, 314,
|
||||
314, 314, 314, 314, 281, 204, 283, 314, 289, 314,
|
||||
210, 298, 301, 288, 314, 216, 314, 314, 114, 314,
|
||||
314, 201, 122, 80, 314, 314, 314, 314, 101, 314,
|
||||
314, 273, 274, 314, 314, 314, 314, 314, 281, 204,
|
||||
283, 314, 289, 314, 300, 298, 301, 288, 314, 216,
|
||||
314, 314, 114, 314, 314, 201, 122, 81, 314, 314,
|
||||
314, 314, 101, 314, 314, 273, 274, 314, 314, 314,
|
||||
314, 314, 281, 204, 283, 314, 289, 314, 300, 298,
|
||||
301, 288, 314, 216, 314, 314, 114, 314, 314, 201,
|
||||
122, 82, 314, 314, 314, 314, 101, 314, 314, 273,
|
||||
274, 314, 314, 314, 314, 314, 281, 204, 283, 314,
|
||||
289, 314, 300, 298, 301, 288, 314, 216, 314, 314,
|
||||
114, 314, 314, 201, 122, 50, 314, 314, 314, 314,
|
||||
101, 314, 314, 273, 274, 314, 314, 314, 314, 314,
|
||||
281, 204, 283, 314, 289, 314, 300, 298, 301, 288,
|
||||
314, 216, 314, 314, 114, 314, 314, 201, 122, 52,
|
||||
314, 314, 314, 314, 101, 314, 314, 273, 274, 314,
|
||||
314, 314, 314, 314, 281, 204, 283, 314, 289, 314,
|
||||
300, 298, 301, 288, 314, 216, 168, 314, 114, 314,
|
||||
314, 201, 134, 314, 314, 314, 256, 314, 101, 47,
|
||||
22, 285, 41, 314, 314, 314, 314, 333, 281, 204,
|
||||
283, 314, 289, 314, 300, 298, 301, 288, 314, 216,
|
||||
145, 314, 114, 314, 314, 201, 128, 314, 314, 314,
|
||||
256, 314, 101, 47, 22, 285, 41, 314, 314, 314,
|
||||
314, 287, 281, 204, 283, 315, 289, 314, 300, 298,
|
||||
301, 247, 248, 249, 2, 314, 313, 314, 314, 314,
|
||||
6, 87, 259, 314, 314, 19, 112, 314, 14, 258,
|
||||
217, 261, 218, 314, 15, 39, 314, 14, 14, 42,
|
||||
43, 286, 12, 15, 15, 314, 314, 314, 42, 43,
|
||||
286, 12, 314, 314, 314, 314, 293, 294, 295, 296,
|
||||
308, 27, 314, 314, 315, 293, 294, 295, 296, 314,
|
||||
247, 248, 249, 2, 314, 313, 314, 110, 314, 6,
|
||||
87, 314, 314, 314, 314, 112, 314, 314, 148, 217,
|
||||
261, 218, 314, 42, 43, 286, 12, 314, 42, 43,
|
||||
286, 12, 314, 314, 314, 314, 314, 314, 314, 314,
|
||||
293, 294, 295, 296, 314, 293, 294, 295, 296, 309,
|
||||
27, 314, 314, 240, 241, 242, 133, 223, 314, 247,
|
||||
248, 249, 1, 314, 482, 314, 314, 482, 6, 87,
|
||||
3, 482, 466, 314, 112, 314, 276, 314, 217, 261,
|
||||
218, 288, 314, 216, 314, 314, 114, 314, 314, 201,
|
||||
132, 314, 314, 314, 314, 314, 101, 314, 466, 314,
|
||||
314, 466, 314, 482, 314, 466, 281, 204, 283, 314,
|
||||
289, 314, 300, 298, 301, 314, 288, 314, 216, 314,
|
||||
200, 114, 314, 314, 201, 123, 314, 314, 314, 314,
|
||||
314, 101, 365, 314, 314, 314, 230, 314, 314, 314,
|
||||
314, 281, 204, 283, 14, 289, 314, 300, 298, 301,
|
||||
15, 314, 288, 446, 216, 314, 169, 114, 314, 314,
|
||||
201, 124, 314, 314, 314, 446, 256, 101, 314, 47,
|
||||
22, 285, 41, 314, 314, 314, 314, 281, 204, 283,
|
||||
314, 289, 314, 300, 298, 301, 314, 288, 314, 216,
|
||||
314, 314, 114, 314, 314, 201, 125, 314, 314, 314,
|
||||
314, 314, 101, 314, 314, 314, 314, 314, 314, 314,
|
||||
314, 314, 281, 204, 283, 314, 289, 314, 300, 298,
|
||||
301, 314, 314, 288, 314, 216, 314, 314, 114, 314,
|
||||
314, 201, 126, 314, 314, 314, 314, 314, 101, 314,
|
||||
314, 314, 314, 314, 314, 314, 314, 314, 281, 204,
|
||||
283, 314, 289, 314, 300, 298, 301, 314, 288, 314,
|
||||
216, 314, 314, 114, 314, 314, 201, 127, 314, 314,
|
||||
314, 314, 314, 101, 314, 314, 314, 314, 314, 314,
|
||||
314, 314, 314, 281, 204, 283, 314, 289, 314, 300,
|
||||
298, 301, 314, 314, 288, 314, 216, 223, 314, 114,
|
||||
314, 314, 201, 131, 482, 314, 314, 482, 314, 101,
|
||||
314, 482, 466, 314, 314, 314, 276, 314, 314, 281,
|
||||
204, 283, 314, 289, 314, 300, 298, 301, 314, 314,
|
||||
409, 314, 314, 314, 314, 314, 314, 314, 466, 314,
|
||||
314, 466, 314, 482, 223, 466, 292, 314, 314, 314,
|
||||
314, 482, 314, 314, 482, 314, 314, 36, 482, 466,
|
||||
314, 223, 446, 276, 409, 409, 409, 409, 482, 314,
|
||||
314, 482, 314, 314, 446, 482, 466, 314, 314, 30,
|
||||
276, 409, 409, 409, 409, 466, 482, 314, 466, 482,
|
||||
482, 314, 466, 482, 466, 314, 314, 314, 276, 314,
|
||||
314, 314, 466, 314, 314, 466, 332, 482, 314, 466,
|
||||
314, 314, 314, 314, 314, 331, 42, 43, 286, 12,
|
||||
466, 314, 314, 466, 314, 482, 314, 466, 314, 42,
|
||||
43, 286, 12, 293, 294, 295, 296, 307, 314, 42,
|
||||
43, 286, 12, 185, 314, 314, 293, 294, 295, 296,
|
||||
186, 314, 314, 314, 322, 314, 293, 294, 295, 296,
|
||||
42, 43, 286, 12, 31, 314, 42, 43, 286, 12,
|
||||
314, 334, 314, 42, 43, 286, 12, 293, 294, 295,
|
||||
296, 314, 314, 293, 294, 295, 296, 314, 314, 314,
|
||||
293, 294, 295, 296, 42, 43, 286, 12, 42, 43,
|
||||
286, 12, 482, 313, 313, 482, 313, 313, 313, 482,
|
||||
466, 293, 294, 295, 296, 293, 294, 295, 296, 313,
|
||||
313, 313, 259, 313, 313, 19, 313, 313, 313, 258,
|
||||
313, 313, 313, 313, 313, 313, 466, 313, 14, 466,
|
||||
150, 482, 313, 466, 15,
|
||||
286, 12, 482, 314, 314, 482, 314, 314, 314, 482,
|
||||
466, 293, 294, 295, 296, 293, 294, 295, 296, 314,
|
||||
314, 314, 259, 314, 314, 19, 314, 314, 314, 258,
|
||||
314, 314, 314, 314, 314, 314, 466, 314, 14, 466,
|
||||
150, 482, 314, 466, 15,
|
||||
);
|
||||
public static $yy_lookahead = array(
|
||||
2, 80, 100, 13, 102, 103, 1, 9, 10, 11,
|
||||
@@ -1180,45 +1180,45 @@ public static $yy_action = array(
|
||||
array(),
|
||||
);
|
||||
public static $yy_default = array(
|
||||
350, 539, 539, 539, 524, 524, 539, 501, 501, 539,
|
||||
452, 539, 539, 539, 539, 539, 539, 539, 539, 539,
|
||||
539, 539, 539, 539, 539, 539, 539, 539, 539, 539,
|
||||
539, 539, 539, 539, 539, 539, 539, 539, 539, 539,
|
||||
539, 539, 539, 539, 539, 539, 539, 539, 539, 539,
|
||||
390, 369, 390, 539, 539, 539, 395, 539, 539, 539,
|
||||
363, 539, 539, 539, 539, 539, 374, 500, 413, 420,
|
||||
499, 525, 527, 526, 419, 421, 418, 422, 451, 449,
|
||||
397, 401, 402, 392, 395, 363, 433, 539, 390, 539,
|
||||
390, 390, 514, 454, 390, 390, 539, 539, 381, 340,
|
||||
453, 466, 539, 404, 404, 404, 466, 466, 454, 390,
|
||||
539, 390, 390, 384, 454, 539, 539, 404, 404, 404,
|
||||
350, 540, 540, 540, 525, 525, 540, 501, 501, 524,
|
||||
452, 540, 540, 540, 540, 540, 540, 540, 540, 540,
|
||||
540, 540, 540, 540, 540, 540, 540, 540, 540, 540,
|
||||
540, 540, 540, 540, 540, 540, 540, 540, 540, 540,
|
||||
540, 540, 540, 540, 540, 540, 540, 540, 540, 540,
|
||||
390, 369, 390, 540, 540, 540, 395, 540, 540, 540,
|
||||
363, 540, 540, 540, 540, 540, 374, 500, 413, 420,
|
||||
499, 526, 528, 527, 419, 421, 418, 422, 451, 449,
|
||||
397, 401, 402, 392, 395, 363, 433, 540, 390, 540,
|
||||
390, 390, 514, 454, 390, 390, 540, 540, 381, 340,
|
||||
453, 466, 540, 404, 404, 404, 466, 466, 454, 390,
|
||||
540, 390, 390, 384, 454, 540, 540, 404, 404, 404,
|
||||
371, 386, 404, 411, 424, 425, 426, 412, 417, 454,
|
||||
511, 424, 410, 348, 508, 453, 453, 453, 453, 453,
|
||||
539, 468, 466, 482, 360, 370, 539, 373, 539, 378,
|
||||
539, 379, 463, 464, 364, 366, 367, 368, 492, 466,
|
||||
540, 468, 466, 482, 360, 370, 540, 373, 540, 378,
|
||||
540, 379, 463, 464, 364, 366, 367, 368, 492, 466,
|
||||
491, 494, 493, 457, 458, 459, 460, 380, 376, 377,
|
||||
372, 382, 502, 385, 387, 503, 442, 466, 488, 515,
|
||||
512, 348, 507, 507, 507, 466, 466, 433, 429, 433,
|
||||
423, 423, 467, 433, 433, 423, 423, 346, 539, 539,
|
||||
539, 423, 433, 443, 539, 539, 539, 539, 429, 539,
|
||||
461, 461, 539, 429, 539, 539, 539, 539, 539, 539,
|
||||
539, 539, 539, 539, 429, 431, 539, 513, 539, 482,
|
||||
539, 539, 539, 539, 539, 438, 539, 539, 539, 398,
|
||||
423, 423, 467, 433, 433, 423, 423, 346, 540, 540,
|
||||
540, 423, 433, 443, 540, 540, 540, 540, 429, 540,
|
||||
461, 461, 540, 429, 540, 540, 540, 540, 540, 540,
|
||||
540, 540, 540, 540, 429, 431, 540, 513, 540, 482,
|
||||
540, 540, 540, 540, 540, 438, 540, 540, 540, 398,
|
||||
341, 342, 343, 344, 345, 347, 349, 351, 352, 353,
|
||||
354, 355, 356, 357, 359, 388, 389, 484, 485, 486,
|
||||
506, 383, 504, 505, 427, 436, 437, 446, 447, 465,
|
||||
469, 470, 471, 405, 406, 407, 408, 409, 428, 430,
|
||||
432, 434, 438, 439, 440, 414, 415, 416, 441, 444,
|
||||
445, 479, 477, 516, 517, 518, 519, 455, 456, 490,
|
||||
461, 462, 483, 498, 358, 489, 535, 536, 528, 529,
|
||||
530, 533, 532, 534, 537, 538, 531, 521, 523, 522,
|
||||
461, 462, 483, 498, 358, 489, 536, 537, 529, 530,
|
||||
531, 534, 533, 535, 538, 539, 532, 521, 523, 522,
|
||||
520, 495, 480, 478, 476, 473, 474, 475, 481, 496,
|
||||
497, 435, 472, 510, 487, 482, 391, 375, 399, 403,
|
||||
);
|
||||
const YYNOCODE = 113;
|
||||
const YYSTACKDEPTH = 500;
|
||||
const YYNSTATE = 340;
|
||||
const YYNRULE = 199;
|
||||
const YYNRULE = 200;
|
||||
const YYERRORSYMBOL = 60;
|
||||
const YYERRSYMDT = 'yy0';
|
||||
const YYFALLBACK = 0;
|
||||
@@ -1463,6 +1463,7 @@ public static $yy_action = array(
|
||||
'arraydef ::= ARRAYOPEN arrayelements CLOSEP',
|
||||
'arrayelements ::= arrayelement',
|
||||
'arrayelements ::= arrayelements COMMA arrayelement',
|
||||
'arrayelements ::= arrayelements COMMA',
|
||||
'arrayelements ::=',
|
||||
'arrayelement ::= value APTR expr',
|
||||
'arrayelement ::= ID APTR expr',
|
||||
@@ -1977,6 +1978,7 @@ public static $yy_action = array(
|
||||
array( 0 => 94, 1 => 3 ),
|
||||
array( 0 => 108, 1 => 1 ),
|
||||
array( 0 => 108, 1 => 3 ),
|
||||
array( 0 => 108, 1 => 2 ),
|
||||
array( 0 => 108, 1 => 0 ),
|
||||
array( 0 => 109, 1 => 3 ),
|
||||
array( 0 => 109, 1 => 3 ),
|
||||
@@ -2022,7 +2024,7 @@ public static $yy_action = array(
|
||||
106 => 6,
|
||||
122 => 6,
|
||||
182 => 6,
|
||||
187 => 6,
|
||||
188 => 6,
|
||||
7 => 7,
|
||||
8 => 8,
|
||||
9 => 9,
|
||||
@@ -2131,7 +2133,7 @@ public static $yy_action = array(
|
||||
123 => 123,
|
||||
124 => 124,
|
||||
126 => 126,
|
||||
184 => 126,
|
||||
185 => 126,
|
||||
127 => 127,
|
||||
128 => 128,
|
||||
129 => 129,
|
||||
@@ -2149,7 +2151,7 @@ public static $yy_action = array(
|
||||
141 => 141,
|
||||
142 => 142,
|
||||
143 => 143,
|
||||
188 => 143,
|
||||
189 => 143,
|
||||
144 => 144,
|
||||
146 => 146,
|
||||
147 => 147,
|
||||
@@ -2181,18 +2183,19 @@ public static $yy_action = array(
|
||||
180 => 180,
|
||||
181 => 180,
|
||||
183 => 183,
|
||||
185 => 185,
|
||||
184 => 184,
|
||||
186 => 186,
|
||||
189 => 189,
|
||||
187 => 187,
|
||||
190 => 190,
|
||||
191 => 191,
|
||||
192 => 192,
|
||||
195 => 192,
|
||||
193 => 193,
|
||||
196 => 193,
|
||||
194 => 194,
|
||||
197 => 197,
|
||||
197 => 194,
|
||||
195 => 195,
|
||||
198 => 198,
|
||||
199 => 199,
|
||||
);
|
||||
// line 245 "src/Parser/TemplateParser.y"
|
||||
public function yy_r0(){
|
||||
@@ -2961,46 +2964,50 @@ public static $yy_action = array(
|
||||
public function yy_r183(){
|
||||
$this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor;
|
||||
}
|
||||
// line 1328 "src/Parser/TemplateParser.y"
|
||||
public function yy_r185(){
|
||||
$this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'=>'.$this->yystack[$this->yyidx + 0]->minor;
|
||||
// line 1324 "src/Parser/TemplateParser.y"
|
||||
public function yy_r184(){
|
||||
$this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.',';
|
||||
}
|
||||
// line 1332 "src/Parser/TemplateParser.y"
|
||||
public function yy_r186(){
|
||||
public function yy_r186(){
|
||||
$this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'=>'.$this->yystack[$this->yyidx + 0]->minor;
|
||||
}
|
||||
// line 1336 "src/Parser/TemplateParser.y"
|
||||
public function yy_r187(){
|
||||
$this->_retvalue = '\''.$this->yystack[$this->yyidx + -2]->minor.'\'=>'.$this->yystack[$this->yyidx + 0]->minor;
|
||||
}
|
||||
// line 1348 "src/Parser/TemplateParser.y"
|
||||
public function yy_r189(){
|
||||
// line 1352 "src/Parser/TemplateParser.y"
|
||||
public function yy_r190(){
|
||||
$this->compiler->leaveDoubleQuote();
|
||||
$this->_retvalue = $this->yystack[$this->yyidx + -1]->minor->to_smarty_php($this);
|
||||
}
|
||||
// line 1354 "src/Parser/TemplateParser.y"
|
||||
public function yy_r190(){
|
||||
// line 1358 "src/Parser/TemplateParser.y"
|
||||
public function yy_r191(){
|
||||
$this->yystack[$this->yyidx + -1]->minor->append_subtree($this, $this->yystack[$this->yyidx + 0]->minor);
|
||||
$this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;
|
||||
}
|
||||
// line 1359 "src/Parser/TemplateParser.y"
|
||||
public function yy_r191(){
|
||||
$this->_retvalue = new Dq($this, $this->yystack[$this->yyidx + 0]->minor);
|
||||
}
|
||||
// line 1363 "src/Parser/TemplateParser.y"
|
||||
public function yy_r192(){
|
||||
$this->_retvalue = new Code('(string)'.$this->yystack[$this->yyidx + -1]->minor);
|
||||
$this->_retvalue = new Dq($this, $this->yystack[$this->yyidx + 0]->minor);
|
||||
}
|
||||
// line 1367 "src/Parser/TemplateParser.y"
|
||||
public function yy_r193(){
|
||||
$this->_retvalue = new Code('(string)('.$this->yystack[$this->yyidx + -1]->minor.')');
|
||||
$this->_retvalue = new Code('(string)'.$this->yystack[$this->yyidx + -1]->minor);
|
||||
}
|
||||
// line 1371 "src/Parser/TemplateParser.y"
|
||||
public function yy_r194(){
|
||||
$this->_retvalue = new Code('(string)$_smarty_tpl->getValue(\''. substr($this->yystack[$this->yyidx + 0]->minor,1) .'\')');
|
||||
$this->_retvalue = new Code('(string)('.$this->yystack[$this->yyidx + -1]->minor.')');
|
||||
}
|
||||
// line 1383 "src/Parser/TemplateParser.y"
|
||||
public function yy_r197(){
|
||||
$this->_retvalue = new Tag($this, $this->yystack[$this->yyidx + 0]->minor);
|
||||
// line 1375 "src/Parser/TemplateParser.y"
|
||||
public function yy_r195(){
|
||||
$this->_retvalue = new Code('(string)$_smarty_tpl->getValue(\''. substr($this->yystack[$this->yyidx + 0]->minor,1) .'\')');
|
||||
}
|
||||
// line 1387 "src/Parser/TemplateParser.y"
|
||||
public function yy_r198(){
|
||||
$this->_retvalue = new Tag($this, $this->yystack[$this->yyidx + 0]->minor);
|
||||
}
|
||||
// line 1391 "src/Parser/TemplateParser.y"
|
||||
public function yy_r199(){
|
||||
$this->_retvalue = new DqContent($this->yystack[$this->yyidx + 0]->minor);
|
||||
}
|
||||
|
||||
|
||||
@@ -1321,6 +1321,10 @@ arrayelements(res) ::= arrayelements(a1) COMMA arrayelement(a). {
|
||||
res = a1.','.a;
|
||||
}
|
||||
|
||||
arrayelements(res) ::= arrayelements(a) COMMA. {
|
||||
res = a.',';
|
||||
}
|
||||
|
||||
arrayelements ::= . {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class StringEval extends RecompiledPlugin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function populate(\Smarty\Template\Source $source, \Smarty\Template $_template = null)
|
||||
public function populate(\Smarty\Template\Source $source, ?\Smarty\Template $_template = null)
|
||||
{
|
||||
$source->uid = sha1($source->name);
|
||||
$source->timestamp = $source->exists = true;
|
||||
|
||||
@@ -54,7 +54,7 @@ class Smarty extends \Smarty\TemplateBase {
|
||||
/**
|
||||
* smarty version
|
||||
*/
|
||||
const SMARTY_VERSION = '5.4.3';
|
||||
const SMARTY_VERSION = '5.7.0';
|
||||
|
||||
/**
|
||||
* define caching modes
|
||||
|
||||
@@ -154,7 +154,6 @@ class Template extends TemplateBase {
|
||||
if ($this->smarty->debugging) {
|
||||
$this->smarty->getDebug()->start_template($this, $display);
|
||||
}
|
||||
// exit;
|
||||
// checks if template exists
|
||||
if ($this->compile_check && !$this->getSource()->exists) {
|
||||
throw new Exception(
|
||||
|
||||
@@ -104,7 +104,7 @@ abstract class TemplateBase extends Data {
|
||||
}
|
||||
// register the object
|
||||
$smarty->registered_objects[$object_name] =
|
||||
[$object, (array)$allowed_methods_properties, (boolean)$format, (array)$block_methods];
|
||||
[$object, (array)$allowed_methods_properties, (bool)$format, (array)$block_methods];
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Smarty {\Smarty\Smarty::SMARTY_VERSION} Debug Console
|
||||
<h1>Smarty {$smarty.version} Debug Console
|
||||
- {if isset($template_name)}{$template_name|debug_print_var nofilter} {/if}{if !empty($template_data)}Total Time {$execution_time|string_format:"%.5f"}{/if}</h1>
|
||||
|
||||
{if !empty($template_data)}
|
||||
|
||||
@@ -5,22 +5,26 @@ declare(strict_types=1);
|
||||
namespace tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\Attributes\TestDox;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
|
||||
/**
|
||||
* Test class for Smarty
|
||||
* @coversDefaultClass \Smarty
|
||||
* @testdox \Smarty method tests for extended smarty plugins
|
||||
*/
|
||||
#[TestDox("\Smarty method tests for extended smarty plugins")]
|
||||
#[CoversClass(\Smarty\Smarty::class)]
|
||||
final class SmartyExtendedTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @testdox Output\Form\Elements Class tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSmartyExtended()
|
||||
#[Test]
|
||||
#[TestDox("Test Smarty Extended rendering")]
|
||||
public function testSmartyExtended(): void
|
||||
{
|
||||
define('BASE', str_replace('/configs', '', __DIR__) . DIRECTORY_SEPARATOR);
|
||||
$locale = 'ja_JP.UTF-8';
|
||||
@@ -49,6 +53,8 @@ final class SmartyExtendedTest extends TestCase
|
||||
'HTML_TITLE' => 'Smarty v5 tst',
|
||||
// smarty test
|
||||
'SMARTY_TEST' => 'Test Data',
|
||||
'TRANSLATED_ORIGINAL' => 'Are we translated?',
|
||||
'TRANSLATED_REPLACED' => 'Yes, we are translated!',
|
||||
'TRANSLATE_TEST' => $l10n->__('Are we translated?'),
|
||||
'TRANSLATE_TEST_FUNCTION' => _gettext('Are we translated?'),
|
||||
'TRANSLATE_TEST_SMARTY' => $l10n->__('Are we translated?'),
|
||||
@@ -153,13 +159,16 @@ final class SmartyExtendedTest extends TestCase
|
||||
</div>
|
||||
<div>
|
||||
<b>Outside translation test</b><br>
|
||||
TRANSLATION CLASS (OUT): Are we translated?<br>
|
||||
TRANSLATION CLASS (OUT FUNCTION): Are we translated?<br>
|
||||
TRANSLATION CLASS (SMARTY): Are we translated?<br>
|
||||
TRANSLATED ORIGINAL: Are we translated?<br>
|
||||
TRANSLATED REPLACED: Yes, we are translated!<br>
|
||||
TRANSLATION CLASS (OUT): Yes, we are translated!<br>
|
||||
TRANSLATION CLASS (OUT FUNCTION): Yes, we are translated!<br>
|
||||
TRANSLATION CLASS (SMARTY): Yes, we are translated!<br>
|
||||
</div>
|
||||
<div>
|
||||
<b>Translate Test with replace:</b><br>
|
||||
ORIGINAL: Original with string: %1 (Replaced)<br>
|
||||
TRANSLATED: Translated with string: %1 (Replaced)<br>
|
||||
TRANSLATED: Translated with string: Replaced<br>
|
||||
TRANSLATED (escape): Translated with string: on<br>
|
||||
Capture test: INPUT TEST<br>
|
||||
@@ -196,6 +205,9 @@ final class SmartyExtendedTest extends TestCase
|
||||
<div>LOOP OUTPUT: 4</div>
|
||||
<div>LOOP OUTPUT: 5</div>
|
||||
</div>
|
||||
<div>
|
||||
Drop Down simple
|
||||
</div>
|
||||
<div>
|
||||
<select id="drop_down_test" name="drop_down_test">
|
||||
<option label="Foo" value="foo">Foo</option>
|
||||
@@ -204,6 +216,9 @@ final class SmartyExtendedTest extends TestCase
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
Drop Down nested
|
||||
</div>
|
||||
<div>
|
||||
<select id="drop_down_test_nested" name="drop_down_test_nested">
|
||||
<option label="選択してください" value="" selected="selected">選択してください</option>
|
||||
@@ -222,19 +237,28 @@ final class SmartyExtendedTest extends TestCase
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
radio plain
|
||||
</div>
|
||||
<div>
|
||||
<label><input type="radio" name="radio_test" value="0" />On</label>
|
||||
<label><input type="radio" name="radio_test" value="1" />Off</label>
|
||||
<label><input type="radio" name="radio_test" value="-1" checked="checked" />Undefined</label>
|
||||
</div>
|
||||
<div>
|
||||
checkbox plain
|
||||
</div>
|
||||
<div>
|
||||
<label><input type="checkbox" name="checkbox_test[]" value="0" />On</label>
|
||||
<label><input type="checkbox" name="checkbox_test[]" value="1" checked="checked" />Off</label>
|
||||
<label><input type="checkbox" name="checkbox_test[]" value="-1" checked="checked" />Undefined</label>
|
||||
</div>
|
||||
<div>
|
||||
<label><input type="checkbox" name="checkbox_test_pos[]" value="0" checked="checked" />On</label>
|
||||
<label><input type="checkbox" name="checkbox_test_pos[]" value="1" />Off</label>
|
||||
checkbox pos
|
||||
</div>
|
||||
<div>
|
||||
<label><input type="checkbox" name="checkbox_test_pos[A]" value="0" checked="checked" />On</label>
|
||||
<label><input type="checkbox" name="checkbox_test_pos[B]" value="1" />Off</label>
|
||||
<label><input type="checkbox" name="checkbox_test_pos[]" value="-1" checked="checked" />Undefined</label>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -23,5 +23,8 @@ msgstr "Translated"
|
||||
msgid "Original with string: %1"
|
||||
msgstr "Translated with string: %1"
|
||||
|
||||
msgid "Are we translated?"
|
||||
msgstr "Yes, we are translated!"
|
||||
|
||||
#msgid ""
|
||||
#msgstr ""
|
||||
|
||||
Binary file not shown.
@@ -26,6 +26,8 @@ BASE: {$BASE}<br>
|
||||
</div>
|
||||
<div>
|
||||
<b>Outside translation test</b><br>
|
||||
TRANSLATED ORIGINAL: {$TRANSLATED_ORIGINAL}<br>
|
||||
TRANSLATED REPLACED: {$TRANSLATED_REPLACED}<br>
|
||||
TRANSLATION CLASS (OUT): {$TRANSLATE_TEST}<br>
|
||||
TRANSLATION CLASS (OUT FUNCTION): {$TRANSLATE_TEST_FUNCTION}<br>
|
||||
TRANSLATION CLASS (SMARTY): {$TRANSLATE_TEST_SMARTY}<br>
|
||||
@@ -33,6 +35,7 @@ BASE: {$BASE}<br>
|
||||
<div>
|
||||
<b>Translate Test with replace:</b><br>
|
||||
ORIGINAL: Original with string: %1 ({$replace})<br>
|
||||
TRANSLATED: Translated with string: %1 ({$replace})<br>
|
||||
TRANSLATED: {t 1=$replace}Original with string: %1{/t}<br>
|
||||
TRANSLATED (escape): {t escape=on 1=$replace}Original with string: %1{/t}<br>
|
||||
{capture assign="extra_title"}{t}INPUT TEST{/t}{/capture}
|
||||
|
||||
@@ -18,6 +18,8 @@ BASE: {$BASE}<br>
|
||||
</div>
|
||||
<div>
|
||||
<b>Outside translation test</b><br>
|
||||
TRANSLATED ORIGINAL: {$TRANSLATED_ORIGINAL}<br>
|
||||
TRANSLATED REPLACED: {$TRANSLATED_REPLACED}<br>
|
||||
TRANSLATION CLASS (OUT): {$TRANSLATE_TEST}<br>
|
||||
TRANSLATION CLASS (OUT FUNCTION): {$TRANSLATE_TEST_FUNCTION}<br>
|
||||
TRANSLATION CLASS (SMARTY): {$TRANSLATE_TEST_SMARTY}<br>
|
||||
@@ -25,6 +27,7 @@ BASE: {$BASE}<br>
|
||||
<div>
|
||||
<b>Translate Test with replace:</b><br>
|
||||
ORIGINAL: Original with string: %1 ({$replace})<br>
|
||||
TRANSLATED: Translated with string: %1 ({$replace})<br>
|
||||
TRANSLATED: {t 1=$replace}Original with string: %1{/t}<br>
|
||||
TRANSLATED (escape): {t escape=on 1=$replace}Original with string: %1{/t}<br>
|
||||
{capture assign="extra_title"}{t}INPUT TEST{/t}{/capture}
|
||||
|
||||
@@ -74,6 +74,8 @@ $CONTENT_DATA = [
|
||||
'HTML_TITLE' => 'Smarty v5 tst',
|
||||
// smarty test
|
||||
'SMARTY_TEST' => 'Test Data',
|
||||
'TRANSLATED_ORIGINAL' => 'Are we translated?',
|
||||
'TRANSLATED_REPLACED' => 'Yes, we are translated!',
|
||||
'TRANSLATE_TEST' => $l10n->__('Are we translated?'),
|
||||
'TRANSLATE_TEST_FUNCTION' => _gettext('Are we translated?'),
|
||||
'TRANSLATE_TEST_SMARTY' => $l10n->__('Are we translated?'),
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/home/clemens/.phive/phars/phpunit-10.3.5.phar
|
||||
Reference in New Issue
Block a user