diff options
187 files changed, 7261 insertions, 5870 deletions
diff --git a/composer.json b/composer.json index f89fb15b2..79b60771b 100644 --- a/composer.json +++ b/composer.json @@ -40,13 +40,12 @@ "smarty/smarty": "~3.1" }, "require-dev" : { - "php" : ">=7.0", - "phpunit/phpunit" : "~6.4.4", + "phpunit/phpunit" : "@stable", "behat/behat" : "@stable", "behat/mink-extension": "@stable", "behat/mink-goutte-driver": "@stable", - "php-mock/php-mock-phpunit": "^2.0", - "phpunit/dbunit": "^3.0" + "php-mock/php-mock-phpunit": "@stable", + "phpunit/dbunit": "@stable" }, "autoload" : { "psr-4" : { diff --git a/composer.lock b/composer.lock index 4a80d7d90..6f1af0fd7 100644 --- a/composer.lock +++ b/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "516114a0fbd804e5234ebeacbac30376", + "content-hash": "ca5770d3c97cc1d0375413eeb61758ab", "packages": [ { "name": "bshaffer/oauth2-server-php", @@ -640,16 +640,16 @@ }, { "name": "sabre/vobject", - "version": "4.1.5", + "version": "4.1.6", "source": { "type": "git", "url": "https://github.com/sabre-io/vobject.git", - "reference": "0928660e92d46d2d24336a6db320636aa3a75414" + "reference": "122cacbdea2c6133ac04db86ec05854beef75adf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/vobject/zipball/0928660e92d46d2d24336a6db320636aa3a75414", - "reference": "0928660e92d46d2d24336a6db320636aa3a75414", + "url": "https://api.github.com/repos/sabre-io/vobject/zipball/122cacbdea2c6133ac04db86ec05854beef75adf", + "reference": "122cacbdea2c6133ac04db86ec05854beef75adf", "shasum": "" }, "require": { @@ -733,7 +733,7 @@ "xCal", "xCard" ], - "time": "2018-03-08T21:06:39+00:00" + "time": "2018-04-20T07:22:50+00:00" }, { "name": "sabre/xml", @@ -863,16 +863,16 @@ }, { "name": "smarty/smarty", - "version": "v3.1.31", + "version": "v3.1.32", "source": { "type": "git", "url": "https://github.com/smarty-php/smarty.git", - "reference": "c7d42e4a327c402897dd587871434888fde1e7a9" + "reference": "ac9d4b587e5bf53381e21881820a9830765cb459" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/smarty-php/smarty/zipball/c7d42e4a327c402897dd587871434888fde1e7a9", - "reference": "c7d42e4a327c402897dd587871434888fde1e7a9", + "url": "https://api.github.com/repos/smarty-php/smarty/zipball/ac9d4b587e5bf53381e21881820a9830765cb459", + "reference": "ac9d4b587e5bf53381e21881820a9830765cb459", "shasum": "" }, "require": { @@ -912,7 +912,7 @@ "keywords": [ "templating" ], - "time": "2016-12-14T21:57:25+00:00" + "time": "2018-04-24T14:53:33+00:00" } ], "packages-dev": [ @@ -1118,27 +1118,27 @@ }, { "name": "behat/mink-browserkit-driver", - "version": "v1.3.2", + "version": "1.3.3", "source": { "type": "git", "url": "https://github.com/minkphp/MinkBrowserKitDriver.git", - "reference": "10e67fb4a295efcd62ea0bf16025a85ea19534fb" + "reference": "1b9a7ce903cfdaaec5fb32bfdbb26118343662eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/minkphp/MinkBrowserKitDriver/zipball/10e67fb4a295efcd62ea0bf16025a85ea19534fb", - "reference": "10e67fb4a295efcd62ea0bf16025a85ea19534fb", + "url": "https://api.github.com/repos/minkphp/MinkBrowserKitDriver/zipball/1b9a7ce903cfdaaec5fb32bfdbb26118343662eb", + "reference": "1b9a7ce903cfdaaec5fb32bfdbb26118343662eb", "shasum": "" }, "require": { "behat/mink": "^1.7.1@dev", "php": ">=5.3.6", - "symfony/browser-kit": "~2.3|~3.0", - "symfony/dom-crawler": "~2.3|~3.0" + "symfony/browser-kit": "~2.3|~3.0|~4.0", + "symfony/dom-crawler": "~2.3|~3.0|~4.0" }, "require-dev": { - "silex/silex": "~1.2", - "symfony/phpunit-bridge": "~2.7|~3.0" + "mink/driver-testsuite": "dev-master", + "symfony/http-kernel": "~2.3|~3.0|~4.0" }, "type": "mink-driver", "extra": { @@ -1170,7 +1170,7 @@ "browser", "testing" ], - "time": "2016-03-05T08:59:47+00:00" + "time": "2018-05-02T09:25:31+00:00" }, { "name": "behat/mink-extension", @@ -1472,16 +1472,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.3.0", + "version": "6.3.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699" + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699", - "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", "shasum": "" }, "require": { @@ -1491,7 +1491,7 @@ }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "^4.0 || ^5.0", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", "psr/log": "^1.0" }, "suggest": { @@ -1500,7 +1500,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.2-dev" + "dev-master": "6.3-dev" } }, "autoload": { @@ -1533,7 +1533,7 @@ "rest", "web service" ], - "time": "2017-06-22T18:50:49+00:00" + "time": "2018-04-22T15:46:56+00:00" }, { "name": "guzzlehttp/promises", @@ -1914,25 +1914,28 @@ }, { "name": "php-mock/php-mock-phpunit", - "version": "2.0.1", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/php-mock/php-mock-phpunit.git", - "reference": "b42fc41ecb7538564067527f6c30b8854f149d32" + "reference": "ff1cc1d4e7478ce74221e05742588619bee84f69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-mock/php-mock-phpunit/zipball/b42fc41ecb7538564067527f6c30b8854f149d32", - "reference": "b42fc41ecb7538564067527f6c30b8854f149d32", + "url": "https://api.github.com/repos/php-mock/php-mock-phpunit/zipball/ff1cc1d4e7478ce74221e05742588619bee84f69", + "reference": "ff1cc1d4e7478ce74221e05742588619bee84f69", "shasum": "" }, "require": { "php": ">=7", "php-mock/php-mock-integration": "^2", - "phpunit/phpunit": "^6 <6.5" + "phpunit/phpunit": "^6 || ^7" }, "type": "library", "autoload": { + "files": [ + "autoload.php" + ], "psr-4": { "phpmock\\phpunit\\": "classes/" } @@ -1961,7 +1964,7 @@ "test", "test double" ], - "time": "2017-12-02T09:49:02+00:00" + "time": "2018-04-06T13:54:43+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -2111,23 +2114,23 @@ }, { "name": "phpspec/prophecy", - "version": "1.7.5", + "version": "1.7.6", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401" + "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/dfd6be44111a7c41c2e884a336cc4f461b3b2401", - "reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { @@ -2170,7 +2173,7 @@ "spy", "stub" ], - "time": "2018-02-19T10:16:54+00:00" + "time": "2018-04-18T13:57:24+00:00" }, { "name": "phpunit/dbunit", @@ -2226,16 +2229,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "5.3.0", + "version": "5.3.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1" + "reference": "c89677919c5dd6d3b3852f230a663118762218ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/661f34d0bd3f1a7225ef491a70a020ad23a057a1", - "reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac", + "reference": "c89677919c5dd6d3b3852f230a663118762218ac", "shasum": "" }, "require": { @@ -2285,7 +2288,7 @@ "testing", "xunit" ], - "time": "2017-12-06T09:29:45+00:00" + "time": "2018-04-06T15:36:58+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2475,16 +2478,16 @@ }, { "name": "phpunit/phpunit", - "version": "6.4.4", + "version": "6.5.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "562f7dc75d46510a4ed5d16189ae57fbe45a9932" + "reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/562f7dc75d46510a4ed5d16189ae57fbe45a9932", - "reference": "562f7dc75d46510a4ed5d16189ae57fbe45a9932", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4f21a3c6b97c42952fd5c2837bb354ec0199b97b", + "reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b", "shasum": "" }, "require": { @@ -2498,12 +2501,12 @@ "phar-io/version": "^1.0", "php": "^7.0", "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^5.2.2", - "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-code-coverage": "^5.3", + "phpunit/php-file-iterator": "^1.4.3", "phpunit/php-text-template": "^1.2.1", "phpunit/php-timer": "^1.0.9", - "phpunit/phpunit-mock-objects": "^4.0.3", - "sebastian/comparator": "^2.0.2", + "phpunit/phpunit-mock-objects": "^5.0.5", + "sebastian/comparator": "^2.1", "sebastian/diff": "^2.0", "sebastian/environment": "^3.1", "sebastian/exporter": "^3.1", @@ -2529,7 +2532,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.4.x-dev" + "dev-master": "6.5.x-dev" } }, "autoload": { @@ -2555,33 +2558,33 @@ "testing", "xunit" ], - "time": "2017-11-08T11:26:09+00:00" + "time": "2018-04-10T11:38:34+00:00" }, { "name": "phpunit/phpunit-mock-objects", - "version": "4.0.4", + "version": "5.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "2f789b59ab89669015ad984afa350c4ec577ade0" + "reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/2f789b59ab89669015ad984afa350c4ec577ade0", - "reference": "2f789b59ab89669015ad984afa350c4ec577ade0", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/33fd41a76e746b8fa96d00b49a23dadfa8334cdf", + "reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.5", "php": "^7.0", "phpunit/php-text-template": "^1.2.1", - "sebastian/exporter": "^3.0" + "sebastian/exporter": "^3.1" }, "conflict": { "phpunit/phpunit": "<6.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^6.5" }, "suggest": { "ext-soap": "*" @@ -2589,7 +2592,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "5.0.x-dev" } }, "autoload": { @@ -2604,7 +2607,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -2614,7 +2617,7 @@ "mock", "xunit" ], - "time": "2017-08-03T14:08:16+00:00" + "time": "2018-01-06T05:45:45+00:00" }, { "name": "psr/container", @@ -3276,16 +3279,16 @@ }, { "name": "symfony/browser-kit", - "version": "v3.4.6", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "490f27762705c8489bd042fe3e9377a191dba9b4" + "reference": "840bb6f0d5b3701fd768b68adf7193c2d0f98f79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/490f27762705c8489bd042fe3e9377a191dba9b4", - "reference": "490f27762705c8489bd042fe3e9377a191dba9b4", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/840bb6f0d5b3701fd768b68adf7193c2d0f98f79", + "reference": "840bb6f0d5b3701fd768b68adf7193c2d0f98f79", "shasum": "" }, "require": { @@ -3329,11 +3332,11 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:37:34+00:00" + "time": "2018-03-19T22:32:39+00:00" }, { "name": "symfony/class-loader", - "version": "v3.4.6", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/class-loader.git", @@ -3389,16 +3392,16 @@ }, { "name": "symfony/config", - "version": "v3.4.6", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "05e10567b529476a006b00746c5f538f1636810e" + "reference": "7c2a9d44f4433863e9bca682e7f03609234657f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/05e10567b529476a006b00746c5f538f1636810e", - "reference": "05e10567b529476a006b00746c5f538f1636810e", + "url": "https://api.github.com/repos/symfony/config/zipball/7c2a9d44f4433863e9bca682e7f03609234657f9", + "reference": "7c2a9d44f4433863e9bca682e7f03609234657f9", "shasum": "" }, "require": { @@ -3448,20 +3451,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2018-02-14T10:03:57+00:00" + "time": "2018-03-19T22:32:39+00:00" }, { "name": "symfony/console", - "version": "v3.4.6", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "067339e9b8ec30d5f19f5950208893ff026b94f7" + "reference": "5b1fdfa8eb93464bcc36c34da39cedffef822cdf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/067339e9b8ec30d5f19f5950208893ff026b94f7", - "reference": "067339e9b8ec30d5f19f5950208893ff026b94f7", + "url": "https://api.github.com/repos/symfony/console/zipball/5b1fdfa8eb93464bcc36c34da39cedffef822cdf", + "reference": "5b1fdfa8eb93464bcc36c34da39cedffef822cdf", "shasum": "" }, "require": { @@ -3482,7 +3485,7 @@ "symfony/process": "~3.3|~4.0" }, "suggest": { - "psr/log": "For using the console logger", + "psr/log-implementation": "For using the console logger", "symfony/event-dispatcher": "", "symfony/lock": "", "symfony/process": "" @@ -3517,20 +3520,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-02-26T15:46:28+00:00" + "time": "2018-04-30T01:22:56+00:00" }, { "name": "symfony/css-selector", - "version": "v3.4.6", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "544655f1fc078a9cd839fdda2b7b1e64627c826a" + "reference": "519a80d7c1d95c6cc0b67f686d15fe27c6910de0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/544655f1fc078a9cd839fdda2b7b1e64627c826a", - "reference": "544655f1fc078a9cd839fdda2b7b1e64627c826a", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/519a80d7c1d95c6cc0b67f686d15fe27c6910de0", + "reference": "519a80d7c1d95c6cc0b67f686d15fe27c6910de0", "shasum": "" }, "require": { @@ -3570,20 +3573,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2018-02-03T14:55:07+00:00" + "time": "2018-03-19T22:32:39+00:00" }, { "name": "symfony/debug", - "version": "v3.4.6", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "9b1071f86e79e1999b3d3675d2e0e7684268b9bc" + "reference": "1b95888cfd996484527cb41e8952d9a5eaf7454f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/9b1071f86e79e1999b3d3675d2e0e7684268b9bc", - "reference": "9b1071f86e79e1999b3d3675d2e0e7684268b9bc", + "url": "https://api.github.com/repos/symfony/debug/zipball/1b95888cfd996484527cb41e8952d9a5eaf7454f", + "reference": "1b95888cfd996484527cb41e8952d9a5eaf7454f", "shasum": "" }, "require": { @@ -3626,20 +3629,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-02-28T21:49:22+00:00" + "time": "2018-04-30T16:53:52+00:00" }, { "name": "symfony/dependency-injection", - "version": "v3.4.6", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "12e901abc1cb0d637a0e5abe9923471361d96b07" + "reference": "54ff9d78b56429f9a1ac12e60bfb6d169c0468e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/12e901abc1cb0d637a0e5abe9923471361d96b07", - "reference": "12e901abc1cb0d637a0e5abe9923471361d96b07", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/54ff9d78b56429f9a1ac12e60bfb6d169c0468e3", + "reference": "54ff9d78b56429f9a1ac12e60bfb6d169c0468e3", "shasum": "" }, "require": { @@ -3697,20 +3700,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2018-03-04T03:54:53+00:00" + "time": "2018-04-29T14:04:08+00:00" }, { "name": "symfony/dom-crawler", - "version": "v3.4.6", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "2bb5d3101cc01f4fe580e536daf4f1959bc2d24d" + "reference": "1a4cffeb059226ff6bee9f48acb388faf674afff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/2bb5d3101cc01f4fe580e536daf4f1959bc2d24d", - "reference": "2bb5d3101cc01f4fe580e536daf4f1959bc2d24d", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/1a4cffeb059226ff6bee9f48acb388faf674afff", + "reference": "1a4cffeb059226ff6bee9f48acb388faf674afff", "shasum": "" }, "require": { @@ -3753,20 +3756,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2018-02-22T10:48:49+00:00" + "time": "2018-03-19T22:32:39+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v3.4.6", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "58990682ac3fdc1f563b7e705452921372aad11d" + "reference": "fdd5abcebd1061ec647089c6c41a07ed60af09f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/58990682ac3fdc1f563b7e705452921372aad11d", - "reference": "58990682ac3fdc1f563b7e705452921372aad11d", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/fdd5abcebd1061ec647089c6c41a07ed60af09f8", + "reference": "fdd5abcebd1061ec647089c6c41a07ed60af09f8", "shasum": "" }, "require": { @@ -3816,11 +3819,11 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2018-02-14T10:03:57+00:00" + "time": "2018-04-06T07:35:25+00:00" }, { "name": "symfony/filesystem", - "version": "v3.4.6", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", @@ -3869,16 +3872,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.7.0", + "version": "v1.8.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b" + "reference": "3296adf6a6454a050679cde90f95350ad604b171" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/78be803ce01e55d3491c1397cf1c64beb9c1b63b", - "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", + "reference": "3296adf6a6454a050679cde90f95350ad604b171", "shasum": "" }, "require": { @@ -3890,7 +3893,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "1.8-dev" } }, "autoload": { @@ -3924,20 +3927,20 @@ "portable", "shim" ], - "time": "2018-01-30T19:27:44+00:00" + "time": "2018-04-26T10:06:28+00:00" }, { "name": "symfony/translation", - "version": "v3.4.6", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "80e19eaf12cbb546ac40384e5c55c36306823e57" + "reference": "d4af50f46cd8171fd5c1cdebdb9a8bbcd8078c6c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/80e19eaf12cbb546ac40384e5c55c36306823e57", - "reference": "80e19eaf12cbb546ac40384e5c55c36306823e57", + "url": "https://api.github.com/repos/symfony/translation/zipball/d4af50f46cd8171fd5c1cdebdb9a8bbcd8078c6c", + "reference": "d4af50f46cd8171fd5c1cdebdb9a8bbcd8078c6c", "shasum": "" }, "require": { @@ -3958,7 +3961,7 @@ "symfony/yaml": "~3.4|~4.0" }, "suggest": { - "psr/log": "To use logging capability in translator", + "psr/log-implementation": "To use logging capability in translator", "symfony/config": "", "symfony/yaml": "" }, @@ -3992,20 +3995,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2018-02-22T06:28:18+00:00" + "time": "2018-04-30T01:22:56+00:00" }, { "name": "symfony/yaml", - "version": "v3.4.6", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "6af42631dcf89e9c616242c900d6c52bd53bd1bb" + "reference": "033cfa61ef06ee0847e056e530201842b6e926c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/6af42631dcf89e9c616242c900d6c52bd53bd1bb", - "reference": "6af42631dcf89e9c616242c900d6c52bd53bd1bb", + "url": "https://api.github.com/repos/symfony/yaml/zipball/033cfa61ef06ee0847e056e530201842b6e926c3", + "reference": "033cfa61ef06ee0847e056e530201842b6e926c3", "shasum": "" }, "require": { @@ -4050,7 +4053,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-02-16T09:50:28+00:00" + "time": "2018-04-08T08:21:29+00:00" }, { "name": "theseer/tokenizer", @@ -4094,16 +4097,16 @@ }, { "name": "webmozart/assert", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", "shasum": "" }, "require": { @@ -4140,15 +4143,18 @@ "check", "validate" ], - "time": "2016-11-23T20:04:58+00:00" + "time": "2018-01-29T19:49:41+00:00" } ], "aliases": [], "minimum-stability": "stable", "stability-flags": { + "phpunit/phpunit": 0, "behat/behat": 0, "behat/mink-extension": 0, - "behat/mink-goutte-driver": 0 + "behat/mink-goutte-driver": 0, + "php-mock/php-mock-phpunit": 0, + "phpunit/dbunit": 0 }, "prefer-stable": false, "prefer-lowest": false, @@ -4160,7 +4166,5 @@ "ext-xml": "*", "ext-openssl": "*" }, - "platform-dev": { - "php": ">=5.6 || >=7.0" - } + "platform-dev": [] } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 6ce7bf350..ea47f731d 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -657,17 +657,17 @@ }, { "name": "sabre/vobject", - "version": "4.1.5", - "version_normalized": "4.1.5.0", + "version": "4.1.6", + "version_normalized": "4.1.6.0", "source": { "type": "git", "url": "https://github.com/sabre-io/vobject.git", - "reference": "0928660e92d46d2d24336a6db320636aa3a75414" + "reference": "122cacbdea2c6133ac04db86ec05854beef75adf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/vobject/zipball/0928660e92d46d2d24336a6db320636aa3a75414", - "reference": "0928660e92d46d2d24336a6db320636aa3a75414", + "url": "https://api.github.com/repos/sabre-io/vobject/zipball/122cacbdea2c6133ac04db86ec05854beef75adf", + "reference": "122cacbdea2c6133ac04db86ec05854beef75adf", "shasum": "" }, "require": { @@ -682,7 +682,7 @@ "suggest": { "hoa/bench": "If you would like to run the benchmark scripts" }, - "time": "2018-03-08T21:06:39+00:00", + "time": "2018-04-20T07:22:50+00:00", "bin": [ "bin/vobject", "bin/generate_vcards" @@ -886,23 +886,23 @@ }, { "name": "smarty/smarty", - "version": "v3.1.31", - "version_normalized": "3.1.31.0", + "version": "v3.1.32", + "version_normalized": "3.1.32.0", "source": { "type": "git", "url": "https://github.com/smarty-php/smarty.git", - "reference": "c7d42e4a327c402897dd587871434888fde1e7a9" + "reference": "ac9d4b587e5bf53381e21881820a9830765cb459" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/smarty-php/smarty/zipball/c7d42e4a327c402897dd587871434888fde1e7a9", - "reference": "c7d42e4a327c402897dd587871434888fde1e7a9", + "url": "https://api.github.com/repos/smarty-php/smarty/zipball/ac9d4b587e5bf53381e21881820a9830765cb459", + "reference": "ac9d4b587e5bf53381e21881820a9830765cb459", "shasum": "" }, "require": { "php": ">=5.2" }, - "time": "2016-12-14T21:57:25+00:00", + "time": "2018-04-24T14:53:33+00:00", "type": "library", "extra": { "branch-alias": { diff --git a/vendor/sabre/vobject/CHANGELOG.md b/vendor/sabre/vobject/CHANGELOG.md index 269b3dbff..6cfec988e 100644 --- a/vendor/sabre/vobject/CHANGELOG.md +++ b/vendor/sabre/vobject/CHANGELOG.md @@ -1,10 +1,17 @@ ChangeLog ========= +4.1.6 (2018-04-20) +------------------ + +* #406, #407, #408, #409: Another round of performance improvements in serialization of properties (@gharlan, @staabm) +* #410: Fixes in iTip for handling `BYDAY=SA,SO` (@gharlan) +* #381: Fixes in iTip handling of `SCHEDULE-FORCE-SEND` (@alecpl) + 4.1.5 (2018-03-08) ------------------ -* Serialization: Performance boost for long properties (@gharlan) +* #404: Serialization: Performance boost for long properties (@gharlan) 4.1.4 (2017-12-22) ------------------ diff --git a/vendor/sabre/vobject/lib/ITip/Broker.php b/vendor/sabre/vobject/lib/ITip/Broker.php index b9a30611b..b954cdc8d 100644 --- a/vendor/sabre/vobject/lib/ITip/Broker.php +++ b/vendor/sabre/vobject/lib/ITip/Broker.php @@ -897,6 +897,9 @@ class Broker { if ($key === 'INTERVAL' && $val == 1) { continue; } + if (is_array($val)) { + $val = implode(',', $val); + } $rrule[] = "$key=$val"; } } @@ -936,9 +939,9 @@ class Broker { if (isset($attendees[$attendee->getNormalizedValue()])) { $attendees[$attendee->getNormalizedValue()]['instances'][$recurId] = [ - 'id' => $recurId, - 'partstat' => $partStat, - 'force-send' => $forceSend, + 'id' => $recurId, + 'partstat' => $partStat, + 'forceSend' => $forceSend, ]; } else { $attendees[$attendee->getNormalizedValue()] = [ diff --git a/vendor/sabre/vobject/lib/Parser/MimeDir.php b/vendor/sabre/vobject/lib/Parser/MimeDir.php index 78e5bf385..742641236 100644 --- a/vendor/sabre/vobject/lib/Parser/MimeDir.php +++ b/vendor/sabre/vobject/lib/Parser/MimeDir.php @@ -283,22 +283,22 @@ class MimeDir extends Parser { */ protected function readLine() { - if (!is_null($this->lineBuffer)) { + if (!\is_null($this->lineBuffer)) { $rawLine = $this->lineBuffer; $this->lineBuffer = null; } else { do { - $eof = feof($this->input); + $eof = \feof($this->input); - $rawLine = fgets($this->input); + $rawLine = \fgets($this->input); - if ($eof || (feof($this->input) && $rawLine === false)) { + if ($eof || (\feof($this->input) && $rawLine === false)) { throw new EofException('End of document reached prematurely'); } if ($rawLine === false) { throw new ParseException('Error reading from input stream'); } - $rawLine = rtrim($rawLine, "\r\n"); + $rawLine = \rtrim($rawLine, "\r\n"); } while ($rawLine === ''); // Skipping empty lines $this->lineIndex++; } @@ -309,14 +309,15 @@ class MimeDir extends Parser { // Looking ahead for folded lines. while (true) { - $nextLine = rtrim(fgets($this->input), "\r\n"); + $nextLine = \rtrim(\fgets($this->input), "\r\n"); $this->lineIndex++; if (!$nextLine) { break; } if ($nextLine[0] === "\t" || $nextLine[0] === " ") { - $line .= substr($nextLine, 1); - $rawLine .= "\n " . substr($nextLine, 1); + $curLine = \substr($nextLine, 1); + $line .= $curLine; + $rawLine .= "\n " . $curLine; } else { $this->lineBuffer = $nextLine; break; diff --git a/vendor/sabre/vobject/lib/Property.php b/vendor/sabre/vobject/lib/Property.php index 96855f1f7..3d1775fa2 100644 --- a/vendor/sabre/vobject/lib/Property.php +++ b/vendor/sabre/vobject/lib/Property.php @@ -246,20 +246,18 @@ abstract class Property extends Node { $str .= ':' . $this->getRawMimeDirValue(); - $out = ''; - while (strlen($str) > 0) { - if (strlen($str) > 75) { - $part = mb_strcut($str, 0, 75, 'utf-8'); - $out .= $part . "\r\n"; - $str = ' ' . substr($str, strlen($part)); - } else { - $out .= $str . "\r\n"; - $str = ''; - break; - } - } + $str = \preg_replace( + '/( + (?:^.)? # 1 additional byte in first line because of missing single space (see next line) + .{1,74} # max 75 bytes per line (1 byte is used for a single space added after every CRLF) + (?![\x80-\xbf]) # prevent splitting multibyte characters + )/x', + "$1\r\n ", + $str + ); - return $out; + // remove single space after last CRLF + return \substr($str, 0, -1); } diff --git a/vendor/sabre/vobject/lib/Property/Text.php b/vendor/sabre/vobject/lib/Property/Text.php index bb7ab34ee..47a86ccc9 100644 --- a/vendor/sabre/vobject/lib/Property/Text.php +++ b/vendor/sabre/vobject/lib/Property/Text.php @@ -213,16 +213,16 @@ class Text extends Property { $val = $this->getParts(); if (isset($this->minimumPropertyValues[$this->name])) { - $val = array_pad($val, $this->minimumPropertyValues[$this->name], ''); + $val = \array_pad($val, $this->minimumPropertyValues[$this->name], ''); } // Imploding multiple parts into a single value, and splitting the // values with ;. - if (count($val) > 1) { + if (\count($val) > 1) { foreach ($val as $k => $v) { - $val[$k] = str_replace(';', '\;', $v); + $val[$k] = \str_replace(';', '\;', $v); } - $val = implode(';', $val); + $val = \implode(';', $val); } else { $val = $val[0]; } @@ -242,7 +242,7 @@ class Text extends Property { // If the resulting value contains a \n, we must encode it as // quoted-printable. - if (strpos($val, "\n") !== false) { + if (\strpos($val, "\n") !== false) { $str .= ';ENCODING=QUOTED-PRINTABLE:'; $lastLine = $str; @@ -252,40 +252,39 @@ class Text extends Property { // encode newlines for us. Specifically, the \r\n sequence must in // vcards be encoded as =0D=OA and we must insert soft-newlines // every 75 bytes. - for ($ii = 0;$ii < strlen($val);$ii++) { - $ord = ord($val[$ii]); + for ($ii = 0;$ii < \strlen($val);$ii++) { + $ord = \ord($val[$ii]); // These characters are encoded as themselves. if ($ord >= 32 && $ord <= 126) { $lastLine .= $val[$ii]; } else { - $lastLine .= '=' . strtoupper(bin2hex($val[$ii])); + $lastLine .= '=' . \strtoupper(\bin2hex($val[$ii])); } - if (strlen($lastLine) >= 75) { + if (\strlen($lastLine) >= 75) { // Soft line break $out .= $lastLine . "=\r\n "; $lastLine = null; } } - if (!is_null($lastLine)) $out .= $lastLine . "\r\n"; + if (!\is_null($lastLine)) $out .= $lastLine . "\r\n"; return $out; } else { $str .= ':' . $val; - $out = ''; - while (strlen($str) > 0) { - if (strlen($str) > 75) { - $part = mb_strcut($str, 0, 75, 'utf-8'); - $out .= $part . "\r\n"; - $str = ' ' . substr($str, strlen($part)); - } else { - $out .= $str . "\r\n"; - $str = ''; - break; - } - } - return $out; + $str = \preg_replace( + '/( + (?:^.)? # 1 additional byte in first line because of missing single space (see next line) + .{1,74} # max 75 bytes per line (1 byte is used for a single space added after every CRLF) + (?![\x80-\xbf]) # prevent splitting multibyte characters + )/x', + "$1\r\n ", + $str + ); + + // remove single space after last CRLF + return \substr($str, 0, -1); } diff --git a/vendor/sabre/vobject/lib/Version.php b/vendor/sabre/vobject/lib/Version.php index 67e8a4037..074b06c4b 100644 --- a/vendor/sabre/vobject/lib/Version.php +++ b/vendor/sabre/vobject/lib/Version.php @@ -14,6 +14,6 @@ class Version { /** * Full version number. */ - const VERSION = '4.1.5'; + const VERSION = '4.1.6'; } diff --git a/vendor/smarty/smarty/COMPOSER_RELEASE_NOTES.txt b/vendor/smarty/smarty/COMPOSER_RELEASE_NOTES.txt index c943d9f2e..0644719c9 100644 --- a/vendor/smarty/smarty/COMPOSER_RELEASE_NOTES.txt +++ b/vendor/smarty/smarty/COMPOSER_RELEASE_NOTES.txt @@ -27,3 +27,5 @@ To retrieve the development and documentation folders add "smarty/smarty-dev": "~3.1@dev" } +If you are using (include) the composer generated autoloader.php which is located +in the /vendor folder it is no longer needed to require the Smarty.class.php file.
\ No newline at end of file diff --git a/vendor/smarty/smarty/INHERITANCE_RELEASE_NOTES.txt b/vendor/smarty/smarty/INHERITANCE_RELEASE_NOTES.txt index c415c4ccd..67936a81a 100644 --- a/vendor/smarty/smarty/INHERITANCE_RELEASE_NOTES.txt +++ b/vendor/smarty/smarty/INHERITANCE_RELEASE_NOTES.txt @@ -1,4 +1,11 @@ -3.1.31-dev +3.1.3" +New tags for inheritance parent and chilD +{parent} == {$smarty.block.parent} +{child} == {$smarty.block.child} +Both tags support the assign attribute like +{child assign=foo} + +3.1.31 New tags for inheritance parent and child {block_parent} == {$smarty.block.parent} {block_child} == {$smarty.block.child} @@ -7,7 +14,6 @@ Since 3.1.28 you can mix inheritance by extends resource with the {extends} tag. A template called by extends resource can extend a subtemplate or chain buy the {extends} tag. Since 3.1.31 this feature can be turned off by setting the new Smarty property Smarty::$extends_recursion to false. - 3.1.28 Starting with version 3.1.28 template inheritance is no longer a compile time process. All {block} tag parent/child relations are resolved at run time. @@ -63,7 +69,7 @@ the compiled code of {include} subtemplates gets also merged in compiled inherit Merging the code into a single compile template has some drawbacks. 1. You could not use variable file names in {include} Smarty would use the {include} of compilation time. 2. You could not use individual compile_id in {include} -3. Seperate caching of subtemplate was not possible +3. Separate caching of subtemplate was not possible 4. Any change of the template directory structure between calls was not necessarily seen. Starting with 3.1.15 some of the above conditions got checked and resulted in an exception. It turned out @@ -75,13 +81,11 @@ With this setting all {include} subtemplate will be merge into the compiled inhe could be rejected by exception. -If $smarty->inheritance_merge_compiled_includes = false; {include} subtemplate will not be merged. -You must now manually merge all {include} subtemplate which do contain {block} tags. This is done by setting the "inline" option. +If $smarty->inheritance_merge_compiled_includes = false; {include} subtemplate will not be merged.You must now manually merge all {include} subtemplate which do contain {block} tags. This is done by setting the "inline" option. {include file='foo.bar' inline} 1. In case of a variable file name like {include file=$foo inline} you must use the variable in a compile_id $smarty->compile_id = $foo; -2. If you use individual compile_id in {include file='foo.tpl' compile_id=$bar inline} it must be used in the - global compile_id as well $smarty->compile_id = $bar; +2. If you use individual compile_id in {include file='foo.tpl' compile_id=$bar inline} it must be used in the global compile_id as well $smarty->compile_id = $bar; 3. If call templates with different template_dir configurations and a parent could same named child template from different folders you must make the folder name part of the compile_id. diff --git a/vendor/smarty/smarty/NEW_FEATURES.txt b/vendor/smarty/smarty/NEW_FEATURES.txt index adbc1099b..7632b07ea 100644 --- a/vendor/smarty/smarty/NEW_FEATURES.txt +++ b/vendor/smarty/smarty/NEW_FEATURES.txt @@ -2,6 +2,53 @@ This file contains a brief description of new features which have been added to Smarty 3.1 +Smarty 3.1.32 New tags for inheritance parent and child + ========================================= + {parent} == {$smarty.block.parent} + {child} == {$smarty.block.child} + Both tags support the assign attribute like + {child assign=foo} + + Deprecate functions Smarty::muteExpectedErrors() and Smarty::unmuteExpectedErrors() + =================================================================================== + These functions to start a special error handler are no longer needed as Smarty does + no longer use error suppression like @filemtime(). + For backward compatibility the functions still can be called. + + Using literals containing Smarty's left and right delimiter + =========================================================== + New Methods + $smarty->setLiterals(array $literals) + $smarty->addLiterals(array $literals) + to define literals containing Smarty delimiter. This can avoid the need for extreme usage + of {literal} {/literal} tags. + A) Treat '{{' and '}}' as literal + If Smarty::$auto_literal is enabled + {{ foo }} + will be treated now as literal. (This does apply for any number of delimiter repeatations). + However {{foo}} is not an literal but will be interpreted as a recursive Smarty tag. + If you use + $smarty->setLiteral(array('{{','}}')); + {{foo}} is now a literal as well. + NOTE: In the last example nested Smarty tags starting with '{{' or ending with '}}' will not + work any longer, but this should be very very raw occouring restriction. + B) Example 2 + Assume your delimiter are '<-' , '->' and '<--' , '-->' shall be literals + $smarty->setLiteral(array('<--','-->')); + + + The capture buffers can now be accessed as array + ================================================ + {capture name='foo'} + bah + {\capture} + {capture name='buh'} + blar + {\capture} + {foreach $smarty.capture as $name => $buffer} + .... + {/foreach} + Smarty 3.1.31 New tags for inheritance parent and child ========================================= @@ -45,8 +92,7 @@ Smarty 3.1.30 {/foreach} The {foreach} loop is rendered while processing the compiled template, but $current is a nocache - variable. Normally the {if $current==$item.id} would fail as the $item variable is unkown in the - cached template. {make_nocache $item} does make the current $item value known in thee cached template. + variable. Normally the {if $current==$item.id} would fail as the $item variable is unknown in the cached template. {make_nocache $item} does make the current $item value known in thee cached template. {make_nocache} is ignored when caching is disabled or the variable does exists as nocache variable. @@ -81,8 +127,7 @@ Smarty 3.1.30 Supported scope are parent, tpl_root, smarty, global and root. A scope used together with the {include} tag will cause that with some exceptions any variable assignment within that sub-template will update/assign the variable in other scopes according - to the above rules. It does include also variables assigned by plugins, tags supporting the assign=foo - attribute and direct assignments in {if} and {while} like {if $foo=$bar}. + to the above rules. It does include also variables assigned by plugins, tags supporting the assign=foo attribute and direct assignments in {if} and {while} like {if $foo=$bar}. Excluded are the key and value variables of {foreach}, {for} loop variables , variables passed by attributes in {include} and direct increments/decrements like {$foo++}, {$foo--} @@ -132,8 +177,8 @@ Smarty 3.1.28 as the corresponding Smarty methods to get the content of another template. Example: $template->display(); Does display template of template object - $template->display('foo.tpl'); Does display template 'foo.bar' - + $template->display('foo.tpl'); Does display template 'foo.bar' + File: resource ============== Multiple template_dir entries can now be selected by a comma separated list of indices. diff --git a/vendor/smarty/smarty/README b/vendor/smarty/smarty/README index 08b397c3f..9a71519bd 100644 --- a/vendor/smarty/smarty/README +++ b/vendor/smarty/smarty/README @@ -176,7 +176,7 @@ backward compatible with Smarty 2, except for the following items: There are many things that are new to Smarty 3. Here are the notable items: - + LEXER/PARSER ============ @@ -197,8 +197,8 @@ is still supported for BC. Examples: {$x+$y} will output the sum of x and y. {$foo = strlen($bar)} function in assignment -{assign var=foo value= $x+$y} in attributes -{$foo = myfunct( ($x+$y)*3 )} as function parameter +{assign var=foo value= $x+$y} in attributes +{$foo = myfunct( ($x+$y)*3 )} as function parameter {$foo[$x+3]} as array index Smarty tags can be used as values within other tags. @@ -239,18 +239,18 @@ Examples: The original "dot" notation stays, and with improvements. Examples: -{$foo.a.b.c} => $foo['a']['b']['c'] +{$foo.a.b.c} => $foo['a']['b']['c'] {$foo.a.$b.c} => $foo['a'][$b]['c'] with variable index {$foo.a.{$b+4}.c} => $foo['a'][$b+4]['c'] with expression as index {$foo.a.{$b.c}} => $foo['a'][$b['c']] with nested index -note that { and } are used to address ambiguties when nesting the dot syntax. +note that { and } are used to address ambiguties when nesting the dot syntax. Variable names themselves can be variable and contain expressions. Examples: $foo normal variable -$foo_{$bar} variable name containing other variable -$foo_{$x+$y} variable name containing expressions +$foo_{$bar} variable name containing other variable +$foo_{$x+$y} variable name containing expressions $foo_{$bar}_buh_{$blar} variable name with multiple segments {$foo_{$x}} will output the variable $foo_1 if $x has a value of 1. @@ -260,12 +260,12 @@ Example: {$object->method1($x)->method2($y)} {for} tag added for looping (replacement for {section} tag): {for $x=0, $y=count($foo); $x<$y; $x++} .... {/for} Any number of statements can be used separated by comma as the first -inital expression at {for}. +initial expression at {for}. {for $x = $start to $end step $step} ... {/for}is in the SVN now . You can use also {for $x = $start to $end} ... {/for} -In this case the step value will be automaticall 1 or -1 depending on the start and end values. +In this case the step value will be automatically 1 or -1 depending on the start and end values. Instead of $start and $end you can use any valid expression. Inside the loop the following special vars can be accessed: $x@iteration = number of iteration @@ -290,7 +290,7 @@ $var@last true on last iteration The Smarty 2 {foreach} tag syntax is still supported. -NOTE: {$bar[foo]} still indicates a variable inside of a {section} named foo. +NOTE: {$bar[foo]} still indicates a variable inside of a {section} named foo. If you want to access an array element with index foo, you must use quotes such as {$bar['foo']}, or use the dot syntax {$bar.foo}. @@ -377,12 +377,12 @@ $smarty->display('string:This is my template, {$foo}!'); // php VARIABLE SCOPE / VARIABLE STORAGE ================================= -In Smarty 2, all assigned variables were stored within the Smarty object. -Therefore, all variables assigned in PHP were accessible by all subsequent +In Smarty 2, all assigned variables were stored within the Smarty object. +Therefore, all variables assigned in PHP were accessible by all subsequent fetch and display template calls. -In Smarty 3, we have the choice to assign variables to the main Smarty object, -to user-created data objects, and to user-created template objects. +In Smarty 3, we have the choice to assign variables to the main Smarty object, +to user-created data objects, and to user-created template objects. These objects can be chained. The object at the end of a chain can access all variables belonging to that template and all variables within the parent objects. The Smarty object can only be the root of a chain, but a chain can be isolated @@ -396,7 +396,7 @@ global variables. A Smarty data object can be created as follows: $data = $smarty->createData(); // create root data object $data->assign('foo','bar'); // assign variables as usual -$data->config_load('my.conf'); // load config file +$data->config_load('my.conf'); // load config file $data= $smarty->createData($smarty); // create data object having a parent link to the Smarty object @@ -414,7 +414,7 @@ The first parameter can be a template name, a smarty object or a data object. Examples: $tpl = $smarty->createTemplate('mytpl.tpl'); // create template object not linked to any parent $tpl->assign('foo','bar'); // directly assign variables -$tpl->config_load('my.conf'); // load config file +$tpl->config_load('my.conf'); // load config file $tpl = $smarty->createTemplate('mytpl.tpl',$smarty); // create template having a parent link to the Smarty object $tpl = $smarty->createTemplate('mytpl.tpl',$data); // create template having a parent link to the $data object @@ -424,31 +424,31 @@ If the $parent parameter is not specified in these method calls, the template ob is will link back to the Smarty object as it's parent. If a template is called by an {include...} tag from another template, the -subtemplate links back to the calling template as it's parent. +subtemplate links back to the calling template as it's parent. All variables assigned locally or from a parent template are accessible. If the template creates or modifies a variable by using the {assign var=foo...} or {$foo=...} tags, these new values are only known locally (local scope). When the template exits, none of the new variables or modifications can be seen in the -parent template(s). This is same behavior as in Smarty 2. +parent template(s). This is same behavior as in Smarty 2. With Smarty 3, we can assign variables with a scope attribute which allows the availablility of these new variables or modifications globally (ie in the parent templates.) -Possible scopes are local, parent, root and global. +Possible scopes are local, parent, root and global. Examples: {assign var=foo value='bar'} // no scope is specified, the default 'local' {$foo='bar'} // same, local scope {assign var=foo value='bar' scope='local'} // same, local scope -{assign var=foo value='bar' scope='parent'} // Values will be available to the parent object +{assign var=foo value='bar' scope='parent'} // Values will be available to the parent object {$foo='bar' scope='parent'} // (normally the calling template) -{assign var=foo value='bar' scope='root'} // Values will be exported up to the root object, so they can +{assign var=foo value='bar' scope='root'} // Values will be exported up to the root object, so they can {$foo='bar' scope='root'} // be seen from all templates using the same root. -{assign var=foo value='bar' scope='global'} // Values will be exported to global variable storage, +{assign var=foo value='bar' scope='global'} // Values will be exported to global variable storage, {$foo='bar' scope='global'} // they are available to any and all templates. @@ -460,8 +460,8 @@ included template. PLUGINS ======= -Smarty 3 plugins follow the same coding rules as in Smarty 2. -The main difference is that the template object is now passed in place of the smarty object. +Smarty 3 plugins follow the same coding rules as in Smarty 2. +The main difference is that the template object is now passed in place of the smarty object. The smarty object can be still be accessed through $template->smarty. smarty_plugintype_name (array $params, Smarty_Internal_Template $template) @@ -473,7 +473,7 @@ TEMPLATE INHERITANCE: ===================== With template inheritance you can define blocks, which are areas that can be -overriden by child templates, so your templates could look like this: +overridden by child templates, so your templates could look like this: parent.tpl: <html> @@ -491,14 +491,14 @@ parent.tpl: </html> child.tpl: -{extends file='parent.tpl'} +{extends file='parent.tpl'} {block name='title'} Child title {/block} grandchild.tpl: -{extends file='child.tpl'} -{block name='title'}Home - {$smarty.block.parent}{/block} +{extends file='child.tpl'} +{block name='title'}Home - {$smarty.block.parent}{/block} {block name='page-title'}My home{/block} {block name='content'} {foreach $images as $img} @@ -508,10 +508,10 @@ grandchild.tpl: We redefined all the blocks here, however in the title block we used {$smarty.block.parent}, which tells Smarty to insert the default content from the parent template in its place. -The content block was overriden to display the image files, and page-title has also be -overriden to display a completely different title. +The content block was overridden to display the image files, and page-title has also be +overridden to display a completely different title. -If we render grandchild.tpl we will get this: +If we render grandchild.tpl we will get this: <html> <head> <title>Home - Child title</title> @@ -529,8 +529,8 @@ If we render grandchild.tpl we will get this: NOTE: In the child templates everything outside the {extends} or {block} tag sections is ignored. -The inheritance tree can be as big as you want (meaning you can extend a file that -extends another one that extends another one and so on..), but be aware that all files +The inheritance tree can be as big as you want (meaning you can extend a file that +extends another one that extends another one and so on..), but be aware that all files have to be checked for modifications at runtime so the more inheritance the more overhead you add. Instead of defining the parent/child relationships with the {extends} tag in the child template you @@ -538,7 +538,7 @@ can use the resource as follow: $smarty->display('extends:parent.tpl|child.tpl|grandchild.tpl'); -Child {block} tags may optionally have a append or prepend attribute. In this case the parent block content +Child {block} tags may optionally have a append or prepend attribute. In this case the parent block content is appended or prepended to the child block content. {block name='title' append} My title {/block} diff --git a/vendor/smarty/smarty/README.md b/vendor/smarty/smarty/README.md index 5783eb3e0..24baae4c2 100644 --- a/vendor/smarty/smarty/README.md +++ b/vendor/smarty/smarty/README.md @@ -1,5 +1,12 @@ -#Smarty 3 template engine -##Distribution repository +# Smarty 3 template engine +[smarty.net](https://www.smarty.net/) + +## Documentation + +For documentation see +[www.smarty.net/docs/en/](https://www.smarty.net/docs/en/) + +## Distribution repository > Smarty 3.1.28 introduces run time template inheritance @@ -10,7 +17,7 @@ Smarty versions 3.1.11 or later are now on github and can be installed with Comp The "smarty/smarty" package will start at libs/.... subfolder. -To get the latest stable version of Smarty 3.1 use +To get the latest stable version of Smarty 3.1 use: ```json "require": { @@ -20,7 +27,7 @@ To get the latest stable version of Smarty 3.1 use in your composer.json file. -To get the trunk version use +To get the trunk version use: ```json "require": { @@ -28,7 +35,7 @@ To get the trunk version use } ``` -For a specific version use something like +For a specific version use something like: ```json "require": { @@ -36,7 +43,7 @@ For a specific version use something like } ``` -PHPUnit test can be installed by corresponding composer entries like +PHPUnit test can be installed by corresponding composer entries like: ```json "require": { @@ -44,7 +51,7 @@ PHPUnit test can be installed by corresponding composer entries like } ``` -Similar applies for the lexer/parser generator +Similar applies for the lexer/parser generator. ```json "require": { @@ -52,7 +59,7 @@ Similar applies for the lexer/parser generator } ``` -Or you could use +Or you could use: ```json "require": { @@ -60,6 +67,6 @@ Or you could use } ``` -Which is a wrapper to install all 3 packages +Which is a wrapper to install all 3 packages. -Composer can also be used for Smarty2 versions 2.6.24 to 2.6.28 +Composer can also be used for Smarty2 versions 2.6.24 to 2.6.30. diff --git a/vendor/smarty/smarty/SMARTY_2_BC_NOTES.txt b/vendor/smarty/smarty/SMARTY_2_BC_NOTES.txt index 79a2cb1b6..fd36bd33b 100644 --- a/vendor/smarty/smarty/SMARTY_2_BC_NOTES.txt +++ b/vendor/smarty/smarty/SMARTY_2_BC_NOTES.txt @@ -2,8 +2,8 @@ == Syntax == -Smarty 3 API has a new syntax. Much of the Smarty 2 syntax is supported -by a wrapper but deprecated. See the README that comes with Smarty 3 for more +Smarty 3 API has a new syntax. Much of the Smarty 2 syntax is supported +by a wrapper but deprecated. See the README that comes with Smarty 3 for more information. The {$array|@mod} syntax has always been a bit confusing, where an "@" is required @@ -32,9 +32,9 @@ Makes Javascript/CSS easier to work with, eliminating the need for {literal}. This can be disabled by setting $smarty->auto_literal = false; == Unquoted Strings == -Smarty 2 was a bit more forgiving (and ambiguous) when it comes to unquoted strings -in parameters. Smarty3 is more restrictive. You can still pass strings without quotes -so long as they contain no special characters. (anything outside of A-Za-z0-9_) +Smarty 2 was a bit more forgiving (and ambiguous) when it comes to unquoted strings +in parameters. Smarty3 is more restrictive. You can still pass strings without quotes +so long as they contain no special characters. (anything outside of A-Za-z0-9_) For example filename strings must be quoted <source lang="smarty"> @@ -42,16 +42,16 @@ For example filename strings must be quoted </source> == Extending the Smarty class == -Smarty 3 makes use of the __construct method for initialization. If you are extending -the Smarty class, its constructor is not called implicitly if the your child class defines -its own constructor. In order to run Smarty's constructor, a call to parent::__construct() -within your child constructor is required. +Smarty 3 makes use of the __construct method for initialization. If you are extending +the Smarty class, its constructor is not called implicitly if the your child class defines +its own constructor. In order to run Smarty's constructor, a call to parent::__construct() +within your child constructor is required. <source lang="php"> class MySmarty extends Smarty { function __construct() { parent::__construct(); - + // your initialization code goes here } @@ -59,36 +59,36 @@ class MySmarty extends Smarty { </source> == Autoloader == -Smarty 3 does register its own autoloader with spl_autoload_register. If your code has -an existing __autoload function then this function must be explicitly registered on -the __autoload stack. See http://us3.php.net/manual/en/function.spl-autoload-register.php +Smarty 3 does register its own autoloader with spl_autoload_register. If your code has +an existing __autoload function then this function must be explicitly registered on +the __autoload stack. See http://us3.php.net/manual/en/function.spl-autoload-register.php for further details. == Plugin Filenames == -Smarty 3 optionally supports the PHP spl_autoloader. The autoloader requires filenames -to be lower case. Because of this, Smarty plugin file names must also be lowercase. +Smarty 3 optionally supports the PHP spl_autoloader. The autoloader requires filenames +to be lower case. Because of this, Smarty plugin file names must also be lowercase. In Smarty 2, mixed case file names did work. == Scope of Special Smarty Variables == -In Smarty 2 the special Smarty variables $smarty.section... and $smarty.foreach... -had global scope. If you had loops with the same name in subtemplates you could accidentally +In Smarty 2 the special Smarty variables $smarty.section... and $smarty.foreach... +had global scope. If you had loops with the same name in subtemplates you could accidentally overwrite values of parent template. -In Smarty 3 these special Smarty variable have only local scope in the template which -is defining the loop. If you need their value in a subtemplate you have to pass them +In Smarty 3 these special Smarty variable have only local scope in the template which +is defining the loop. If you need their value in a subtemplate you have to pass them as parameter. <source lang="smarty"> {include file='path/foo.tpl' index=$smarty.section.foo.index} </source> == SMARTY_RESOURCE_CHAR_SET == -Smarty 3 sets the constant SMARTY_RESOURCE_CHAR_SET to utf-8 as default template charset. -This is now used also on modifiers like escape as default charset. If your templates use -other charsets make sure that you define the constant accordingly. Otherwise you may not +Smarty 3 sets the constant SMARTY_RESOURCE_CHAR_SET to utf-8 as default template charset. +This is now used also on modifiers like escape as default charset. If your templates use +other charsets make sure that you define the constant accordingly. Otherwise you may not get any output. == newline at {if} tags == -A \n was added to the compiled code of the {if},{else},{elseif},{/if} tags to get output of newlines as expected by the template source. +A \n was added to the compiled code of the {if},{else},{elseif},{/if} tags to get output of newlines as expected by the template source. If one of the {if} tags is at the line end you will now get a newline in the HTML output. == trigger_error() == @@ -96,7 +96,7 @@ The API function trigger_error() has been removed because it did just map to PHP However it's still included in the Smarty2 API wrapper. == Smarty constants == -The constants +The constants SMARTY_PHP_PASSTHRU SMARTY_PHP_QUOTE SMARTY_PHP_REMOVE diff --git a/vendor/smarty/smarty/SMARTY_3.0_BC_NOTES.txt b/vendor/smarty/smarty/SMARTY_3.0_BC_NOTES.txt index fd8b540c2..24bdec61a 100644 --- a/vendor/smarty/smarty/SMARTY_3.0_BC_NOTES.txt +++ b/vendor/smarty/smarty/SMARTY_3.0_BC_NOTES.txt @@ -1,14 +1,14 @@ == Smarty2 backward compatibility == -All Smarty2 specific API functions and deprecated functionallity has been moved +All Smarty2 specific API functions and deprecated functionality has been moved to the SmartyBC class. == {php} Tag == -The {php} tag is no longer available in the standard Smarty calls. -The use of {php} tags is deprecated and only available in the SmartyBC class. +The {php} tag is no longer available in the standard Smarty calls. +The use of {php} tags is deprecated and only available in the SmartyBC class. == {include_php} Tag == -The {include_php} tag is no longer available in the standard Smarty calls. -The use of {include_php} tags is deprecated and only available in the SmartyBC class. +The {include_php} tag is no longer available in the standard Smarty calls. +The use of {include_php} tags is deprecated and only available in the SmartyBC class. == php template resource == The support of the php template resource is removed. diff --git a/vendor/smarty/smarty/SMARTY_3.1_NOTES.txt b/vendor/smarty/smarty/SMARTY_3.1_NOTES.txt index 57709f0d7..d7c23ccc4 100644 --- a/vendor/smarty/smarty/SMARTY_3.1_NOTES.txt +++ b/vendor/smarty/smarty/SMARTY_3.1_NOTES.txt @@ -50,7 +50,7 @@ The escape modifier now knows the $double_encode option, which will prevent entities from being encoded again. The capitalize modifier now know the $lc_rest option, which makes sure -all letters following a captial letter are lower-cased. +all letters following a capital letter are lower-cased. The count_sentences modifier now accepts (.?!) as legitimate endings of a sentence - previously only (.) was @@ -62,7 +62,7 @@ entity. default_template_handler_func -The invocation of $smarty->$default_template_handler_func had to be +The invocation of $smarty->$default_template_handler_func had to be altered. Instead of a Smarty_Internal_Template, the fifth argument is now provided with the Smarty instance. New footprint: @@ -71,14 +71,14 @@ now provided with the Smarty instance. New footprint: * Default Template Handler * * called when Smarty's file: resource is unable to load a requested file - * + * * @param string $type resource type (e.g. "file", "string", "eval", "resource") * @param string $name resource name (e.g. "foo/bar.tpl") * @param string &$content template's content * @param integer &$modified template's modification time * @param Smarty $smarty Smarty instance - * @return string|boolean path to file or boolean true if $content and $modified - * have been filled, boolean false if no default template + * @return string|boolean path to file or boolean true if $content and $modified + * have been filled, boolean false if no default template * could be loaded */ function default_template_handler_func($type, $name, &$content, &$modified, Smarty $smarty) { @@ -126,7 +126,7 @@ run on variable output. SYNTAX: {setfilter filter1|filter2|filter3....} Smarty3 will lookup up matching filters in the following search order: -1. varibale filter plugin in plugins_dir. +1. variable filter plugin in plugins_dir. 2. a valid modifier. A modifier specification will also accept additional parameter like filter2:'foo' 3. a PHP function @@ -186,8 +186,8 @@ Note that old-fashioned registration of $cache_handler is not possible anymore. As the functionality had not been ported to Smarty 3.0.x properly, it has been dropped from 3.1 completely. -Locking facilities have been implemented to avoid concurrent cache -generation. Enable cache locking by setting +Locking facilities have been implemented to avoid concurrent cache +generation. Enable cache locking by setting $smarty->cache_locking = true; Relative Paths in Templates (File-Resource) @@ -258,7 +258,7 @@ default_config_handler_func() has been introduced. default_plugin_handler_func() -An optional default_plugin_handler_func() can be defined which gets called +An optional default_plugin_handler_func() can be defined which gets called by the compiler on tags which can't be resolved internally or by plugins. The default_plugin_handler() can map tags to plugins on the fly. diff --git a/vendor/smarty/smarty/change_log.txt b/vendor/smarty/smarty/change_log.txt index 1d42b0a76..5765a1718 100644 --- a/vendor/smarty/smarty/change_log.txt +++ b/vendor/smarty/smarty/change_log.txt @@ -1,4 +1,145 @@ -===== 3.1.31 ===== (14.12.2016) +===== 3.1.32 ===== (24.04.2018) +24.04.2018 + - bugfix possible Security Vulnerability in Smarty_Security class. + +26.03.2018 + - bugfix plugins may not be loaded if {function} or {block} tags are executed in nocache mode + https://github.com/smarty-php/smarty/issues/371 + +26.03.2018 + - new feature {parent} = {$smarty.block.parent} {child} = {$smarty.block.child} + +23.03.2018 + - bugfix preg_replace could fail on large content resulting in a blank page https://github.com/smarty-php/smarty/issues/417 + +21.03.2018 + - bugfix {$smarty.section...} used outside {section}{/section} showed incorrect values if {section}{/section} was called inside + another loop https://github.com/smarty-php/smarty/issues/422 + - bugfix short form of {section} attributes did not work https://github.com/smarty-php/smarty/issues/428 + +17.03.2018 + - improvement Smarty::compileAllTemplates() exit with a non-zero status code if max errors is reached https://github.com/smarty-php/smarty/pull/402 + +16.03.2018 + - bugfix extends resource did not work with user defined left/right delimiter https://github.com/smarty-php/smarty/issues/419 + +22.11.2017 + - bugfix {break} and {continue} could fail if {foreach}{/foreach} did contain other + looping tags like {for}, {section} and {while} https://github.com/smarty-php/smarty/issues/323 + +20.11.2017 + - bugfix rework of newline spacing between tag code and template text. + now again identical with Smarty2 (forum topic 26878) + - replacement of " by ' + +05.11.2017 + - lexer/parser optimization + - code cleanup and optimizations + - bugfix {$smarty.section.name.loop} used together with {$smarty.section.name.total} could produce + wrong results (forum topic 27041) + +26.10.2017 + - bugfix Smarty version was not filled in header comment of compiled and cached files + - optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR + - deprecate functions Smarty::muteExpectedErrors() and Smarty::unmuteExpectedErrors() + as Smarty does no longer use error suppression like @filemtime(). + for backward compatibility code is moved from Smarty class to an external class and still can be + called. + - correction of PHPDoc blocks + - minor code cleanup + +21.10.2017 + - bugfix custom delimiters could fail since modification of version 3.1.32-dev-23 + https://github.com/smarty-php/smarty/issues/394 + +18.10.2017 + - bugfix fix implementation of unclosed block tag in double quoted string of 12.10.2017 + https://github.com/smarty-php/smarty/issues/396 https://github.com/smarty-php/smarty/issues/397 + https://github.com/smarty-php/smarty/issues/391 https://github.com/smarty-php/smarty/issues/392 + +12.10.2017 + - bugfix $smarty.block.child and $smarty.block.parent could not be used like any + $smarty special variable https://github.com/smarty-php/smarty/issues/393 + - unclosed block tag in double quoted string must throw compiler exception. + https://github.com/smarty-php/smarty/issues/391 https://github.com/smarty-php/smarty/issues/392 + +07.10.2017 + - bugfix modification of 9.8.2017 did fail on some recursive + tag nesting. https://github.com/smarty-php/smarty/issues/389 + +26.8.2017 + - bugfix chained modifier failed when last modifier parameter is a signed value + https://github.com/smarty-php/smarty/issues/327 + - bugfix templates filepath with multibyte characters did not work + https://github.com/smarty-php/smarty/issues/385 + - bugfix {make_nocache} did display code if the template did not contain other nocache code + https://github.com/smarty-php/smarty/issues/369 + +09.8.2017 + - improvement repeated delimiter like {{ and }} will be treated as literal + https://groups.google.com/forum/#!topic/smarty-developers/h9r82Bx4KZw + +05.8.2017 + - bugfix wordwrap modifier could fail if used in nocache code. + converted plugin file shared.mb_wordwrap.php into modifier.mb_wordwrap.php + - cleanup of _getSmartyObj() + +31.7.2017 + - Call clearstatcache() after mkdir() failure https://github.com/smarty-php/smarty/pull/379 + +30.7.2017 + - rewrite mkdir() bugfix to retry automatically see https://github.com/smarty-php/smarty/pull/377 + https://github.com/smarty-php/smarty/pull/379 + +21.7.2017 + - security possible PHP code injection on custom resources at display() or fetch() + calls if the resource does not sanitize the template name + - bugfix fix 'mkdir(): File exists' error on create directory from parallel + processes https://github.com/smarty-php/smarty/pull/377 + - bugfix solve preg_match() hhvm parameter problem https://github.com/smarty-php/smarty/pull/372 + +27.5.2017 + - bugfix change compiled code for registered function and modifiers to called as callable to allow closures + https://github.com/smarty-php/smarty/pull/368, https://github.com/smarty-php/smarty/issues/273 + - bugfix https://github.com/smarty-php/smarty/pull/368 did break the default plugin handler + - improvement replace phpversion() by PHP_VERSION constant. + https://github.com/smarty-php/smarty/pull/363 + +21.5.2017 + - performance store flag for already required shared plugin functions in static variable or + Smarty's $_cache to improve performance when plugins are often called + https://github.com/smarty-php/smarty/commit/51e0d5cd405d764a4ea257d1bac1fb1205f74528#commitcomment-22280086 + - bugfix remove special treatment of classes implementing ArrayAccess in {foreach} + https://github.com/smarty-php/smarty/issues/332 + - bugfix remove deleted files by clear_cache() and clear_compiled_template() from + ACP cache if present, add some is_file() checks to avoid possible warnings on filemtime() + caused by above functions. + https://github.com/smarty-php/smarty/issues/341 + - bugfix version 3.1.31 did fail under PHP 5.2 + https://github.com/smarty-php/smarty/issues/365 + +19.5.2017 + - change properties $accessMap and $obsoleteProperties from private to protected + https://github.com/smarty-php/smarty/issues/351 + - new feature The named capture buffers can now be accessed also as array + See NEWS_FEATURES.txt https://github.com/smarty-php/smarty/issues/366 + - improvement check if ini_get() and ini_set() not disabled + https://github.com/smarty-php/smarty/pull/362 + +24.4.2017 + - fix spelling https://github.com/smarty-php/smarty/commit/e3eda8a5f5653d8abb960eb1bc47e3eca679b1b4#commitcomment-21803095 + +17.4.2017 + - correct generated code on empty() and isset() call, observe change PHP behaviour since PHP 5.5 + https://github.com/smarty-php/smarty/issues/347 + +14.4.2017 + - merge pull requests https://github.com/smarty-php/smarty/pull/349, https://github.com/smarty-php/smarty/pull/322 and https://github.com/smarty-php/smarty/pull/337 to fix spelling and annotation + +13.4.2017 + - bugfix array_merge() parameter should be checked https://github.com/smarty-php/smarty/issues/350 + +===== 3.1.31 ===== (14.12.2016) 23.11.2016 - move template object cache into static variables @@ -36,7 +177,7 @@ 19.10.2016 - bugfix {make_nocache $var} did fail when variable value did contain '\' https://github.com/smarty-php/smarty/issues/305 - bugfix {make_nocache $var} remove spaces from variable value https://github.com/smarty-php/smarty/issues/304 - + 12.10.2016 - bugfix {include} with template names including variable or constants could fail after bugfix from 28.09.2016 https://github.com/smarty-php/smarty/issues/302 @@ -95,7 +236,7 @@ 01.09.2016 - performance require_once should be called only once for shared plugins https://github.com/smarty-php/smarty/issues/280 - + 26.08.2016 - bugfix change of 23.08.2016 failed on linux when use_include_path = true @@ -118,47 +259,47 @@ - bugfix update of 04.08.2016 was incomplete 05.08.2016 - - bugfix compiling of templates failed when the Smarty delimiter did contain '/' https://github.com/smarty-php/smarty/issues/264 + - bugfix compiling of templates failed when the Smarty delimiter did contain '/' https://github.com/smarty-php/smarty/issues/264 - updated error checking at template and config default handler - + 04.08.2016 - improvement move template function source parameter into extension - + 26.07.2016 - optimization unneeded loading of compiled resource - + 24.07.2016 - regression this->addPluginsDir('/abs/path/to/dir') adding absolute path without trailing '/' did fail https://github.com/smarty-php/smarty/issues/260 - + 23.07.2016 - bugfix setTemplateDir('/') and setTemplateDir('') did create wrong absolute filepath https://github.com/smarty-php/smarty/issues/245 - optimization of filepath normalization - improvement remove double function declaration in plugin shared.escape_special_cars.php https://github.com/smarty-php/smarty/issues/229 - + 19.07.2016 - bugfix multiple {include} with relative filepath within {block}{/block} could fail https://github.com/smarty-php/smarty/issues/246 - bugfix {math} shell injection vulnerability patch provided by Tim Weber - + 18.07.2016 - bugfix {foreach} if key variable and item@key attribute have been used both the key variable was not updated https://github.com/smarty-php/smarty/issues/254 - bugfix modifier on plugins like {plugin|modifier ... } did fail when the plugin does return an array https://github.com/smarty-php/smarty/issues/228 - bugfix avoid opcache_invalidate to result in ErrorException when opcache.restrict_api is not empty https://github.com/smarty-php/smarty/pull/244 - bugfix multiple {include} with relative filepath within {block}{/block} could fail https://github.com/smarty-php/smarty/issues/246 - + 14.07.2016 - bugfix wrong parameter on compileAllTemplates() and compileAllConfig() https://github.com/smarty-php/smarty/issues/231 - + 13.07.2016 - bugfix PHP 7 compatibility on registered compiler plugins https://github.com/smarty-php/smarty/issues/241 - update testInstall() https://github.com/smarty-php/smarty/issues/248https://github.com/smarty-php/smarty/issues/248 - bugfix enable debugging could fail when template objects did already exists https://github.com/smarty-php/smarty/issues/237 - bugfix template function data should be merged when loading subtemplate https://github.com/smarty-php/smarty/issues/240 - bugfix wrong parameter on compileAllTemplates() https://github.com/smarty-php/smarty/issues/231 - + 12.07.2016 - bugfix {foreach} item variable must be created also on empty from array https://github.com/smarty-php/smarty/issues/238 and https://github.com/smarty-php/smarty/issues/239 - bugfix enableSecurity() must init cache flags https://github.com/smarty-php/smarty/issues/247 - + 27.05.2016 - bugfix/improvement of compileAlltemplates() follow symlinks in template folder (PHP >= 5.3.1) https://github.com/smarty-php/smarty/issues/224 clear internal cache and expension handler for each template to avoid possible conflicts https://github.com/smarty-php/smarty/issues/231 @@ -201,26 +342,26 @@ 11.03.2016 - optimization of capture and security handling - improvement $smarty->clearCompiledTemplate() should return on recompiled or uncompiled resources - + 10.03.2016 - optimization of resource processing - + 09.03.2016 - improvement rework of 'scope' attribute handling see see NEW_FEATURES.txt https://github.com/smarty-php/smarty/issues/194 https://github.com/smarty-php/smarty/issues/186 https://github.com/smarty-php/smarty/issues/179 - bugfix correct Autoloader update of 2.3.2014 https://github.com/smarty-php/smarty/issues/199 - + 04.03.2016 - bugfix change from 01.03.2016 will cause $smarty->isCached(..) failure if called multiple time for same template (forum topic 25935) - + 02.03.2016 - revert autoloader optimizations because of unexplainable warning when using plugins https://github.com/smarty-php/smarty/issues/199 - + 01.03.2016 - bugfix template objects must be cached on $smarty->fetch('foo.tpl) calls incase the template is fetched multiple times (forum topic 25909) - + 25.02.2016 - bugfix wrong _realpath with 4 or more parent-directories https://github.com/smarty-php/smarty/issues/190 - optimization of _realpath @@ -229,10 +370,10 @@ 20.02.2016 - bugfix {strip} must keep space between hmtl tags. Broken by changes of 10.2.2016 https://github.com/smarty-php/smarty/issues/184 - new feature/bugfix {foreach}{section} add 'properties' attribute to force compilation of loop properties - see NEW_FEATURES.txt https://github.com/smarty-php/smarty/issues/189 - + see NEW_FEATURES.txt https://github.com/smarty-php/smarty/issues/189 + 19.02.2016 - - revert output buffer flushing on display, echo content again because possible problems when PHP files had + - revert output buffer flushing on display, echo content again because possible problems when PHP files had characters (newline} after ?> at file end https://github.com/smarty-php/smarty/issues/187 14.02.2016 @@ -243,33 +384,33 @@ - optimization make compiler tag object cache static for higher compilation speed 11.02.2016 - - improvement added KnockoutJS comments to trimwhitespace outputfilter https://github.com/smarty-php/smarty/issues/82 + - improvement added KnockoutJS comments to trimwhitespace outputfilter https://github.com/smarty-php/smarty/issues/82 https://github.com/smarty-php/smarty/pull/181 - + 10.02.2016 - bugfix {strip} must keep space on output creating smarty tags within html tags https://github.com/smarty-php/smarty/issues/177 - bugfix wrong precedence on special if conditions like '$foo is ... by $bar' could cause wrong code https://github.com/smarty-php/smarty/issues/178 - improvement because of ambiguities the inline constant support has been removed from the $foo.bar syntax https://github.com/smarty-php/smarty/issues/149 - - bugfix other {strip} error with output tags between hmtl https://github.com/smarty-php/smarty/issues/180 + - bugfix other {strip} error with output tags between hmtl https://github.com/smarty-php/smarty/issues/180 09.02.2016 - move some code from parser into compiler - reformat all code for unique style - update/bugfix scope attribute handling reworked. Read the newfeatures.txt file - + 05.02.2016 - improvement internal compiler changes - + 01.02.2016 - bugfix {foreach} compilation failed when $smarty->merge_compiled_includes = true and pre-filters are used. 29.01.2016 - bugfix implement replacement code for _tag_stack property https://github.com/smarty-php/smarty/issues/151 - + 28.01.2016 - bugfix allow windows network filepath or wrapper (forum topic 25876) https://github.com/smarty-php/smarty/issues/170 - bugfix if fetch('foo.tpl') is called on a template object the $parent parameter should default to the calling template object https://github.com/smarty-php/smarty/issues/152 - + 27.01.2016 - revert bugfix compiling {section} did create warning - bugfix {$smarty.section.customer.loop} did throw compiler error https://github.com/smarty-php/smarty/issues/161 @@ -279,7 +420,7 @@ - bugfix {extends} with relative file path did not work https://github.com/smarty-php/smarty/issues/154 https://github.com/smarty-php/smarty/issues/158 - bugfix {capture} data could not been seen in other templates with {$smarty.capture.name} https://github.com/smarty-php/smarty/issues/153 - + 26.01.2016 - improvement observe Smarty::$_CHARSET in debugging console https://github.com/smarty-php/smarty/issues/169 - bugfix compiling {section} did create warning @@ -289,28 +430,28 @@ - update scope handling - optimize block plugin compiler - improvement runtime checks if registered block plugins are callable - + 01.01.2016 - remove Smarty::$resource_cache_mode property - + 31.12.2015 - optimization of {assign}, {if} and {while} compiled code - + 30.12.2015 - bugfix plugin names starting with "php" did not compile https://github.com/smarty-php/smarty/issues/147 29.12.2015 - bugfix Smarty::error_reporting was not observed when display() or fetch() was called on template objects https://github.com/smarty-php/smarty/issues/145 - + 28.12.2015 - optimization of {foreach} code size and processing - + 27.12.2015 - improve inheritance code - update external methods - code fixes - PHPdoc updates - + 25.12.2015 - compile {block} tag code and its processing into classes - optimization replace hhvm extension by inline code @@ -324,45 +465,45 @@ - optimization move internal method decodeProperties back into template object - optimization move subtemplate processing back into template object - new feature Caching does now observe the template_dir setting and will create separate cache files if required - + 22.12.2015 - change $xxx_dir properties from private to protected in case Smarty class gets extended - code optimizations - + 21.12.2015 - bugfix a filepath starting with '/' or '\' on windows should normalize to the root dir of current working drive https://github.com/smarty-php/smarty/issues/134 - optimization of filepath normalization - bugfix {strip} must remove all blanks between html tags https://github.com/smarty-php/smarty/issues/136 - + ===== 3.1.29 ===== (21.12.2015) 21.12.2015 - optimization improve speed of filetime checks on extends and extendsall resource - + 20.12.2015 - bugfix failure when the default resource type was set to 'extendsall' https://github.com/smarty-php/smarty/issues/123 - update compilation of Smarty special variables - bugfix add addition check for OS type on normalization of file path https://github.com/smarty-php/smarty/issues/134 - bugfix the source uid of the extendsall resource must contain $template_dir settings https://github.com/smarty-php/smarty/issues/123 - + 19.12.2015 - bugfix using $smarty.capture.foo in expressions could fail https://github.com/smarty-php/smarty/pull/138 - bugfix broken PHP 5.2 compatibility https://github.com/smarty-php/smarty/issues/139 - remove no longer used code - improvement make sure that compiled and cache templates never can contain a trailing '?>? - + 18.12.2015 - bugfix regression when modifier parameter was followed by math https://github.com/smarty-php/smarty/issues/132 - + 17.12.2015 - bugfix {$smarty.capture.nameFail} did lowercase capture name https://github.com/smarty-php/smarty/issues/135 - bugfix using {block append/prepend} on same block in multiple levels of inheritance templates could fail (forum topic 25827) - bugfix text content consisting of just a single '0' like in {if true}0{/if} was suppressed (forum topic 25834) - + 16.12.2015 - bugfix {foreach} did fail if from atrribute is a Generator class https://github.com/smarty-php/smarty/issues/128 - bugfix direct access $smarty->template_dir = 'foo'; should call Smarty::setTemplateDir() https://github.com/smarty-php/smarty/issues/121 - + 15.12.2015 - bugfix {$smarty.cookies.foo} did return the $_COOKIE array not the 'foo' value https://github.com/smarty-php/smarty/issues/122 - bugfix a call to clearAllCache() and other should clear all internal template object caches (forum topic 25828) @@ -370,25 +511,25 @@ 14.12.2015 - bugfix {$smarty.config.foo} broken in 3.1.28 https://github.com/smarty-php/smarty/issues/120 - bugfix multiple calls of {section} with same name droped E_NOTICE error https://github.com/smarty-php/smarty/issues/118 - + ===== 3.1.28 ===== (13.12.2015) 13.12.2015 - bugfix {foreach} and {section} with uppercase characters in name attribute did not work (forum topic 25819) - bugfix $smarty->debugging_ctrl = 'URL' did not work (forum topic 25811) - bugfix Debug Console could display incorrect data when using subtemplates - + 09.12.2015 - bugfix Smarty did fail under PHP 7.0.0 with use_include_path = true; - + 09.12.2015 - bugfix {strip} should exclude some html tags from stripping, related to fix for https://github.com/smarty-php/smarty/issues/111 - + 08.12.2015 - bugfix internal template function data got stored in wrong compiled file https://github.com/smarty-php/smarty/issues/114 - + 05.12.2015 -bugfix {strip} should insert a single space https://github.com/smarty-php/smarty/issues/111 - + 25.11.2015 -bugfix a left delimter like '[%' did fail on [%$var_[%$variable%]%] (forum topic 25798) @@ -397,7 +538,7 @@ 01.11.2015 - update config file processing - + 31.10.2015 - bugfix add missing $trusted_dir property to SmartyBC class (forum topic 25751) @@ -421,7 +562,7 @@ 18.09.2015 - bugfix {if $foo instanceof $bar} failed to compile if 2nd value is a variable https://github.com/smarty-php/smarty/issues/92 - + 17.09.2015 - bugfix {foreach} first attribute was not correctly reset since commit 05a8fa2 of 02.08.2015 https://github.com/smarty-php/smarty/issues/90 @@ -435,7 +576,7 @@ - move code of {call} processing back into Smarty_Internal_Template class - improvement invalidate OPCACHE for cleared compiled and cached template files (forum topic 25557) - bugfix unintended multiple debug windows (forum topic 25699) - + 30.08.2015 - size optimization move some runtime functions into extension - optimize inline template processing @@ -584,10 +725,10 @@ 01.06.2015 - bugfix <?xml ... ?> including template variables broken since 3.1.22 https://github.com/smarty-php/smarty/issues/47 - + 27.05.2015 - bugfix {include} with variable file name must not create by default individual cache file (since 3.1.22) https://github.com/smarty-php/smarty/issues/43 - + 24.05.2015 - bugfix if condition string 'neq' broken due to a typo https://github.com/smarty-php/smarty/issues/42 @@ -595,11 +736,11 @@ 23.05.2015 - improvement on php_handling to allow very large PHP sections, better error handling - improvement allow extreme large comment sections (forum 25538) - + 21.05.2015 - bugfix broken PHP 5.2 compatibility when compiling <?php tags https://github.com/smarty-php/smarty/issues/40 - bugfix named {foreach} comparison like $smarty.foreach.foobar.index > 1 did compile into wrong code https://github.com/smarty-php/smarty/issues/41 - + 19.05.2015 - bugfix compiler did overwrite existing variable value when setting the nocache attribute https://github.com/smarty-php/smarty/issues/39 - bugfix output filter trimwhitespace could run into the pcre.backtrack_limit on large output (code.google issue 220) @@ -607,14 +748,14 @@ 18.05.2015 - improvement introduce shortcuts in lexer/parser rules for most frequent terms for higher - compilation speed + compilation speed 16.05.2015 - bugfix {php}{/php} did work just for single lines https://github.com/smarty-php/smarty/issues/33 - improvement remove not needed ?><?php transitions from compiled code - improvement reduce number of lexer tokens on operators and if conditions - improvement higher compilation speed by modified lexer/parser generator at "smarty/smarty-lexer" - + 13.05.2015 - improvement remove not needed ?><?php transitions from compiled code - improvement of debugging: @@ -623,7 +764,7 @@ - display Smarty version number - Truncate lenght of Origin display and extend strin value display to 80 character - bugfix in Smarty_Security 'nl2br' should be a trusted modifier, not PHP function (code.google issue 223) - + 12.05.2015 - bugfix {$smarty.constant.TEST} did fail on undefined constant https://github.com/smarty-php/smarty/issues/28 - bugfix access to undefined config variable like {#undef#} did fail https://github.com/smarty-php/smarty/issues/29 @@ -633,7 +774,7 @@ 12.05.2015 - bugfix of smaller performance issue introduce in 3.1.22 when caching is enabled - bugfix missig entry for smarty-temmplate-config in autoloader - + ===== 3.1.22 ===== tag was deleted because 3.1.22 did fail caused by the missing entry for smarty-temmplate-config in autoloader 10.05.2015 - bugfix custom cache resource did not observe compile_id and cache_id when $cache_locking == true @@ -647,14 +788,14 @@ 06.05.2015 - bugfix in 3.1.22-dev cache resource must not be loaded for subtemplates - bugfix/improvement in 3.1.22-dev cache locking did not work as expected - + 05.05.2015 - optimization on cache update when main template is modified - optimization move <?php ?> handling from parser to new compiler module 05.05.2015 - bugfix code could be messed up when {tags} are used in multiple attributes https://github.com/smarty-php/smarty/issues/23 - + 04.05.2015 - bugfix Smarty_Resource::parseResourceName incompatible with Google AppEngine (https://github.com/smarty-php/smarty/issues/22) - improvement use is_file() checks to avoid errors suppressed by @ which could still cause problems (https://github.com/smarty-php/smarty/issues/24) @@ -664,13 +805,13 @@ 28.04.2015 - bugfix plugins of merged subtemplates not loaded in 3.1.22-dev (forum topic 25508) - - 23.04.2015 + + 23.04.2015 - bugfix a nocache template variable used as parameter at {insert} was by mistake cached - + 20.04.2015 - bugfix at a template function containing nocache code a parmeter could overwrite a template variable of same name - + 27.03.2015 - bugfix Smarty_Security->allow_constants=false; did also disable true, false and null (change of 16.03.2015) - improvement added a whitelist for trusted constants to security Smarty_Security::$trusted_constants (forum topic 25471) @@ -678,39 +819,39 @@ 20.03.2015 - bugfix make sure that function properties get saved only in compiled files containing the fuction definition {forum topic 25452} - bugfix correct update of global variable values on exit of template functions. (reported under Smarty Developers) - + 16.03.2015 - bugfix problems with {function}{/function} and {call} tags in different subtemplate cache files {forum topic 25452} - bugfix Smarty_Security->allow_constants=false; did not disallow direct usage of defined constants like {SMARTY_DIR} {forum topic 25457} - bugfix {block}{/block} tags did not work inside double quoted strings https://github.com/smarty-php/smarty/issues/18 - - + + 15.03.2015 - bugfix $smarty->compile_check must be restored before rendering of a just updated cache file {forum 25452} - + 14.03.2015 - bugfix {nocache} {/nocache} tags corrupted code when used within a nocache section caused by a nocache template variable. - + - bugfix template functions defined with {function} in an included subtemplate could not be called in nocache mode with {call... nocache} if the subtemplate had it's own cache file {forum 25452} - + 10.03.2015 - bugfix {include ... nocache} whith variable file or compile_id attribute was not executed in nocache mode. - + 12.02.2015 - bugfix multiple Smarty::fetch() of same template when $smarty->merge_compiled_includes = true; could cause function already defined error - + 11.02.2015 - bugfix recursive {includes} did create E_NOTICE message when $smarty->merge_compiled_includes = true; (github issue #16) - + 22.01.2015 - new feature security can now control access to static methods and properties see also NEW_FEATURES.txt 21.01.2015 - bugfix clearCompiledTemplates(), clearAll() and clear() could try to delete whole drive at wrong path permissions because realpath() fail (forum 25397) - - bugfix 'self::' and 'parent::' was interpreted in template syntax as static class - + - bugfix 'self::' and 'parent::' was interpreted in template syntax as static class + 04.01.2015 - push last weeks changes to github @@ -721,10 +862,10 @@ - optimization restructure config file processing 31.12.2014 - - bugfix use function_exists('mb_get_info') for setting Smarty::$_MBSTRING. + - bugfix use function_exists('mb_get_info') for setting Smarty::$_MBSTRING. Function mb_split could be overloaded depending on php.ini mbstring.func_overload - - + + 29.12.2014 - new feature security can now limit the template nesting level by property $max_template_nesting see also NEW_FEATURES.txt (forum 25370) @@ -738,14 +879,14 @@ 13.12.2014 - improvement optimization of lexer and parser resulting in a up to 30% higher compiling speed - + 11.12.2014 - bugfix resolve parser ambiguity between constant print tag {CONST} and other smarty tags after change of 09.12.2014 - + 09.12.2014 - bugfix variables $null, $true and $false did not work after the change of 12.11.2014 (forum 25342) - bugfix call of template function by a variable name did not work after latest changes (forum 25342) - + 23.11.2014 - bugfix a plugin with attached modifier could fail if the tag was immediately followed by another Smarty tag (since 3.1.21) (forum 25326) @@ -763,12 +904,12 @@ 04.11.2014 - new feature $smarty->debugging = true; => overwrite existing Debug Console window (old behaviour) $smarty->debugging = 2; => individual Debug Console window by template name - + 03.11.2014 - bugfix Debug Console did not show included subtemplates since 3.1.17 (forum 25301) - bugfix Modifier debug_print_var did not limit recursion or prevent recursive object display at Debug Console (ATTENTION: parameter order has changed to be able to specify maximum recursion) - - bugfix Debug consol did not include subtemplate information with $smarty->merge_compiled_includes = true + - bugfix Debug consol did not include subtemplate information with $smarty->merge_compiled_includes = true - improvement The template variables are no longer displayed as objects on the Debug Console - improvement $smarty->createData($parent = null, $name = null) new optional name parameter for display at Debug Console - addition of some hooks for future extension of Debug Console @@ -785,7 +926,7 @@ 26.10.2014 - bugfix E_NOTICE message was created during compilation when ASP tags '<%' or '%>' are in template source text - bugfix merge_compiled_includes option failed when caching enables and same subtemplate was included cached and not cached - + ===== 3.1.21 ===== (18.10.2014) 18.10.2014 - composer moved to github @@ -812,143 +953,143 @@ ===== 3.1.20 ===== (09.10.2014) 08.10.2014 - bugfix security mode of "<script language=php>" must be controlled by $php_handling property (Thue Kristensen) - + 01.10.2014 - bugfix template resource of inheritance blocks could get invalid if the default resource type is not 'file'(Issue 202) - bugfix existing child {block} tag must override parent {block} tag append / prepend setting (topic 25259) - + 02.08.2014 - bugfix modifier wordwrap did output break string wrong if first word was exceeding length with cut = true (topic 25193) - + 24.07.2014 - bugfix cache clear when cache folder does not exist 16.07.2014 - enhancement remove BOM automatically from template source (topic 25161) - + 04.07.2014 - bugfix the bufix of 02.06.2014 broke correct handling of child templates with same name but different template folders in extends resource (issue 194 and topic 25099) - + ===== 3.1.19 ===== (30.06.2014) 20.06.2014 - bugfix template variables could not be passed as parameter in {include} when the include was in a {nocache} section (topic 25131) - + 17.06.2014 - bugfix large template text of some charsets could cause parsing errors (topic 24630) - + 08.06.2014 - bugfix registered objects did not work after spelling fixes of 06.06.2014 - bugfix {block} tags within {literal} .. {/literal} got not displayed correctly (topic 25024) - bugfix UNC WINDOWS PATH like "\\psf\path\to\dir" did not work as template directory (Issue 192) - bugfix {html_image} security check did fail on files relative to basedir (Issue 191) - + 06.06.2014 - fixed PHPUnit outputFilterTrimWhitespaceTests.php assertion of test result - fixed spelling, PHPDoc , minor errors, code cleanup - + 02.06.2014 - using multiple cwd with relative template dirs could result in identical compiled file names. (issue 194 and topic 25099) - + 19.04.2014 - bugfix calling createTemplate(template, data) with empty data array caused notice of array to string conversion (Issue 189) - bugfix clearCompiledTemplate() did not delete files on WINDOWS when a compile_id was specified - + 18.04.2014 - revert bugfix of 5.4.2014 because %-e date format is not supported on all operating systems ===== 3.1.18 ===== (07.04.2014) - 06.04.2014 + 06.04.2014 - bugfix template inheritance fail when using custom resource after patch of 8.3.2014 (Issue 187) - bugfix update of composer file (Issue 168 and 184) 05.04.2014 - bugfix default date format leads to extra spaces when displaying dates with single digit days (Issue 165) - + 26.03.2014 - bugfix Smart_Resource_Custom should not lowercase the resource name (Issue 183) - + 24.03.2014 - bugfix using a {foreach} property like @iteration could fail when used in inheritance parent templates (Issue 182) - + 20.03.2014 - bugfix $smarty->auto_literal and mbsting.func_overload 2, 6 or 7 did fail (forum topic 24899) - + 18.03.2014 - revert change of 17.03.2014 - + 17.03.2014 - bugfix $smarty->auto_literal and mbsting.func_overload 2, 6 or 7 did fail (forum topic 24899) - + 15.03.2014 - bugfix Smarty_CacheResource_Keyvaluestore did use different keys on read/writes and clearCache() calls (Issue 169) 13.03.2014 - bugfix clearXxx() change of 27.1.2014 did not work when specifing cache_id or compile_id (forum topic 24868 and 24867) - + ===== 3.1.17 ===== 08.03.2014 - bugfix relative file path {include} within {block} of child templates did throw exception on first call (Issue 177) - + 17.02.2014 - bugfix Smarty failed when executing PHP on HHVM (Hip Hop 2.4) because uniqid('',true) does return string with ',' (forum topic 20343) - + 16.02.2014 - bugfix a '//' or '\\' in template_dir path could produce wrong path on relative filepath in {include} (Issue 175) - + 05.02.2014 - bugfix shared.literal_compiler_param.php did throw an exception when literal did contain a '-' (smarty-developers group) - + 27.01.2014 - bugfix $smarty->debugging = true; did show the variable of the $smarty object not the variables used in display() call (forum topic 24764) - bugfix clearCompiledTemplate(), clearAll() and clear() should use realpath to avoid possible exception from RecursiveDirectoryIterator (Issue 171) - + 26.01.2014 - bugfix undo block nesting checks for {nocache} for reasons like forum topic 23280 (forum topic 24762) - + 18.01.2014 - bugfix the compiler did fail when using template inheritance and recursive {include} (smarty-developers group) - + 11.01.2014 - bugfix "* }" (spaces before right delimiter) was interpreted by mistake as comment end tag (Issue 170) - internals content cache should be clear when updating cache file - + 08.01.2014 - bugfix Smarty_CacheResource_Custom did not handle template resource type specifications on clearCache() calls (Issue 169) - bugfix SmartyBC.class.php should use require_once to load Smarty.class.php (forum topic 24683) - + ===== 3.1.16 ===== 15.12.2013 - bugfix {include} with {block} tag handling (forum topic 24599, 24594, 24682) (Issue 161) Read 3.1.16_RELEASE_NOTES for more details - enhancement additional debug output at $smarty->_parserdebug = true; - + 07.11.2013 - bugfix too restrictive handling of {include} within {block} tags. 3.1.15 did throw errors where 3.1.14 did not (forum topic 24599) - bugfix compiler could fail if PHP mbstring.func_overload is enabled (Issue 164) - + 28.10.2013 - bugfix variable resource name at custom resource plugin did not work within {block} tags (Issue 163) - bugfix notice "Trying to get property of non-object" removed (Issue 163) - bugfix correction of modifier capitalize fix from 3.10.2013 (issue 159) - - bugfix multiple {block}s with same name in parent did not work (forum topic 24631) - + - bugfix multiple {block}s with same name in parent did not work (forum topic 24631) + 20.10.2013 - bugfix a variable file name at {extends} tag did fail (forum topic 24618) - + 14.10.2013 - bugfix yesterdays fix could result in an undefined variable - + 13.10.2013 - bugfix variable names on {include} in template inheritance did unextepted error message (forum topic 24594) (Issue 161) -.- bugfix relative includes with same name like {include './foo.tpl'} from different folder failed (forum topic 24590)(Issue 161) +.- bugfix relative includes with same name like {include './foo.tpl'} from different folder failed (forum topic 24590)(Issue 161) 04.10.2013 - - bugfix variable file names at {extends} had been disbabled by mistake with the rewrite of + - bugfix variable file names at {extends} had been disbabled by mistake with the rewrite of template inheritance of 24.08.2013 (forum topic 24585) - + 03.10.2013 - bugfix loops using modifier capitalize did eat up memory (issue 159) - + ===== Smarty 3.1.15 ===== 01.10.2013 - use current delimiters in compiler error messages (issue 157) @@ -959,7 +1100,7 @@ 16.09.2013 - bugfix recompiled templates did not show on first request with zend opcache cache (forum topic 24320) - + 13.09.2013 - bugfix html_select_time defaulting error for the Meridian dropdown (forum topic 24549) @@ -977,7 +1118,7 @@ - The {strip} tag can now be placed outside {block} tags in child templates (forum topic 24289) - change SmartyException::$escape is now false by default - change PHP traceback has been remove for SmartyException and SmartyCompilerException - + 14.08.2013 - bugfix compiled filepath of config file did not observe different config_dir (forum topic 24493) @@ -1033,7 +1174,7 @@ 25.04.2013 - bugfix escape and wordrap modifier could be compiled into wrong code when used in {nocache}{/nocache} section but caching is disabled (Forum Topic 24260) - + 05.04.2013 - bugfix post filter must not run when compiling inheritance child blocks (Forum Topic 24094) - bugfix after the fix for Issue #130 compiler exceptions got double escaped (Forum Topic 24199) @@ -1063,7 +1204,7 @@ - bugfix wrong variable usage in smarty_internal_utility.php (Issue #125) 26.11.2012 -- bugfix global variable assigned within template function are not seen after template function exit (Forum Topic 23800) +- bugfix global variable assigned within template function are not seen after template function exit (Forum Topic 23800) 24.11.2012 - made SmartyBC loadable via composer (Issue #124) @@ -1095,7 +1236,7 @@ Either we get MBstring's full package, or we pretend it's not there at all. 21.08.2012 -- bugfix $auto_literal = false did not work with { block} tags in child templates +- bugfix $auto_literal = false did not work with { block} tags in child templates (problem was reintroduced after fix in 3.1.7)(Forum Topic 20581) 17.08.2012 @@ -1112,16 +1253,16 @@ - bugfix avoid PHP error on $smarty->configLoad(...) with invalid section specification (Forum Topic 22608) 30.07.2012 --bugfix {assign} in a nocache section should not overwrite existing variable values +-bugfix {assign} in a nocache section should not overwrite existing variable values during compilation (issue 109) - + 28.07.2012 - bugfix array access of config variables did not work (Forum Topic 22527) 19.07.2012 - bugfix the default plugin handler did create wrong compiled code for static class methods from external script files (issue 108) - + ===== Smarty-3.1.11 ===== 30.06.2012 - bugfix {block.. hide} did not work as nested child (Forum Topic 22216) @@ -1238,7 +1379,7 @@ - bugfix template inheritace did fail if mbstring.func_overload != 0 (issue 70) (Forum Topic 20680) 20.12.2011 -- bugfix template inheritance: {$smarty.block.child} in nested child {block} tags did not return +- bugfix template inheritance: {$smarty.block.child} in nested child {block} tags did not return content after {$smarty.block.child} (Forum Topic 20564) ===== Smarty-3.1.7 ===== @@ -1249,7 +1390,7 @@ - bugfix unregisterObject() raised notice when object to unregister did not exist - changed internals to use Smarty::$_MBSTRING ($_CHARSET, $_DATE_FORMAT) for better unit testing - added Smarty::$_UTF8_MODIFIER for proper PCRE charset handling (Forum Topic 20452) -- added Smarty_Security::isTrustedUri() and Smarty_Security::$trusted_uri to validate +- added Smarty_Security::isTrustedUri() and Smarty_Security::$trusted_uri to validate remote resource calls through {fetch} and {html_image} (Forum Topic 20627) 17.12.2011 @@ -1261,11 +1402,11 @@ 9.12.2011 - bugfix {capture} tags around recursive {include} calls did throw exception (Forum Topic 20549) - bugfix $auto_literal = false did not work with { block} tags in child templates (Forum Topic 20581) -- bugfix template inheritance: do not include code of {include} in overloaded {block} into compiled +- bugfix template inheritance: do not include code of {include} in overloaded {block} into compiled parent template (Issue #66} - bugfix template inheritance: {$smarty.block.child} in nested child {block} tags did not return expected result (Forum Topic 20564) - + ===== Smarty-3.1.6 ===== 30.11.2011 - bugfix is_cache() for individual cached subtemplates with $smarty->caching = CACHING_OFF did produce @@ -1275,7 +1416,7 @@ - bugfix added exception if the default plugin handler did return a not static callback (Forum Topic 20512) 25.11.2011 -- bugfix {html_select_date} and {html_slecet_time} did not default to current time if "time" was not specified +- bugfix {html_select_date} and {html_slecet_time} did not default to current time if "time" was not specified since r4432 (issue 60) 24.11.2011 @@ -1305,7 +1446,7 @@ 22.10.2011 - bugfix smarty_mb_from_unicode() would not decode unicode-points properly -- bugfix use catch Exception instead UnexpectedValueException in +- bugfix use catch Exception instead UnexpectedValueException in clearCompiledTemplate to be PHP 5.2 compatible 21.10.2011 @@ -1346,7 +1487,7 @@ 11.10.2011 - add runtime checks for not matching {capture}/{/capture} calls (Forum Topic 20120) - + 10.10.2011 - bugfix variable name typo in {html_options} and {html_checkboxes} (Issue #54) - bugfix <?xml> tag did create wrong output when caching enabled and the tag was in included subtemplate @@ -1374,7 +1515,7 @@ 04.10.2011 - bugfix assign() in plugins called in subtemplates did change value also in parent template -- bugfix of problem introduced with r4342 on math plugin +- bugfix of problem introduced with r4342 on math plugin - bugfix output filter should not run on individually cached subtemplates - add unloadFilter() method - bugfix has_nocache_code flag was not reset before compilation @@ -1415,7 +1556,7 @@ - remove unused properties - optimization use real function instead anonymous function for preg_replace_callback - bugfix a relative {include} in child template blocks failed -- bugfix direct setting of $template_dir, $config_dir, $plugins_dir in __construct() of an +- bugfix direct setting of $template_dir, $config_dir, $plugins_dir in __construct() of an extended Smarty class created problems - bugfix error muting was not implemented for cache locking @@ -1608,7 +1749,7 @@ - removed experimental setOption() getOption() methods - output returned content also on opening tag calls of block plugins - rewrite of default plugin handler -- compile code of variable filters for better performance +- compile code of variable filters for better performance 20/04/2011 - allow {php} {include_php} tags and PHP_ALLOW handling only with the SmartyBC class @@ -1645,7 +1786,7 @@ 21/02/2011 - added new new compile_check mode COMPILECHECK_CACHEMISS - corrected new cloning behaviour of createTemplate() -- do no longer store the compiler object as property in the compile_tag classes to avoid possible memory leaks +- do no longer store the compiler object as property in the compile_tag classes to avoid possible memory leaks during compilation 19/02/2011 @@ -1781,7 +1922,7 @@ 01/03/2011 - bugfix replace modifier did not work in 3.0.7 on systems without multibyte support -- bugfix {$smarty.template} could return in 3.0.7 parent template name instead of +- bugfix {$smarty.template} could return in 3.0.7 parent template name instead of child name when it needed to compile 25/02/2011 @@ -1950,7 +2091,7 @@ - reactivated $error_reporting property handling - fixed typo in compile_continue - fixed security in {fetch} plugin -- changed back plugin parameters to two. second is template object +- changed back plugin parameters to two. second is template object with transparent access to Smarty object - fixed {config_load} scoping form compile time to run time @@ -1972,7 +2113,7 @@ request_use_auto_globals security is enabled. 01/11/2010 -- bugfix related to E_NOTICE change. {if empty($foo)} did fail when $foo contained a string +- bugfix related to E_NOTICE change. {if empty($foo)} did fail when $foo contained a string 28/10/2010 - bugfix on compiling modifiers within $smarty special vars like {$smarty.post.{$foo|lower}} @@ -2133,7 +2274,7 @@ request_use_auto_globals 21/06/2010 - removed use of PHP shortags SMARTY_PHP_PASSTHRU mode -- improved speed of cache->clear() when a compile_id was specified and use_sub_dirs is true +- improved speed of cache->clear() when a compile_id was specified and use_sub_dirs is true 20/06/2010 - replace internal get_time() calls with standard PHP5 microtime(true) calls @@ -2193,13 +2334,13 @@ request_use_auto_globals - reverted the change 0f 30/04/2010. With the exception of forward references template functions can be again called by a standard tag. 10/05/2010 -- bugfix on {foreach} and {for} optimizations of 27/04/2010 +- bugfix on {foreach} and {for} optimizations of 27/04/2010 09/05/2010 -- update of template and config file parser because of minor parser generator bugs +- update of template and config file parser because of minor parser generator bugs 07/05/2010 -- bugfix on {insert} +- bugfix on {insert} 06/05/2010 - bugfix when merging compiled templates and objects are passed as parameter of the {include} tag @@ -2207,7 +2348,7 @@ request_use_auto_globals 05/05/2010 - bugfix on {insert} to cache parameter - implementation of $smarty->default_modifiers as in Smarty2 -- bugfix on getTemplateVars method +- bugfix on getTemplateVars method 01/05/2010 - bugfix on handling of variable method names at object chaning @@ -2239,7 +2380,7 @@ request_use_auto_globals - removed parser restrictions in using true,false and null as ID 07/04/2010 -- bugfix typo in smarty_internal_templatecompilerbase +- bugfix typo in smarty_internal_templatecompilerbase 31/03/2010 - compile locking by touching old compiled files to avoid concurrent compilations @@ -2251,7 +2392,7 @@ request_use_auto_globals 25/03/2010 - change of utility->compileAllTemplates() log messages -- bugfix on nocache code in {function} tags +- bugfix on nocache code in {function} tags - new method utility->compileAllConfig() to compile all config files 24/03/2010 @@ -2276,7 +2417,7 @@ request_use_auto_globals 16/03/2010 - bugfix on assign attribute at registered template objects - make handling of modifiers on expression BC to Smarty2 - + 15/03/2010 - bugfix on block plugin calls @@ -2295,7 +2436,7 @@ request_use_auto_globals - bugfix on nocache code in {block} tags if child template was included by {include} 27/02/2010 -- allow block tags inside double quoted string +- allow block tags inside double quoted string 26/02/2010 - cache modified check implemented @@ -2377,15 +2518,15 @@ request_use_auto_globals - bugfix on backslash within single quoted strings - bugfix allow absolute filepath for config files - bugfix on special Smarty variable $smarty.cookies -- revert handling of newline on no output tags like {if...} +- revert handling of newline on no output tags like {if...} - allow special characters in config file section names for Smarty2 BC 01/13/2010 -- bugfix on {if} tags +- bugfix on {if} tags 01/12/2010 - changed back modifier handling in parser. Some restrictions still apply: - if modifiers are used in side {if...} expression or in mathematical expressions + if modifiers are used in side {if...} expression or in mathematical expressions parentheses must be used. - bugfix the {function..} tag did not accept the name attribute in double quotes - closed possible security hole at <?php ... ?> tags @@ -2415,7 +2556,7 @@ request_use_auto_globals - bugfix for custom delimiter at extends resource and {extends} tag 01/05/2010 -- bugfix sha1() calculations at extends resource and some general improvments on sha1() handling +- bugfix sha1() calculations at extends resource and some general improvments on sha1() handling 01/03/2010 @@ -2445,7 +2586,7 @@ request_use_auto_globals - use sha1() for filepath encoding - updates on nocache_hash handling - internal change on merging some data -- fixed cache filename for custom resources +- fixed cache filename for custom resources 12/28/2009 - update for security fixes @@ -2597,12 +2738,12 @@ request_use_auto_globals - fixed preg_qoute on delimiters 11/09/2009 -- lexer/parser bugfix +- lexer/parser bugfix - new SMARTY_SPL_AUTOLOAD constant to control the autoloader option - bugfix for {function} block tags in included templates 11/08/2009 -- fixed alphanumeric array index +- fixed alphanumeric array index - bugfix on complex double quoted strings 11/05/2009 @@ -2620,7 +2761,7 @@ request_use_auto_globals - new security_class property (default is Smarty_Security) 11/02/2009 -- added neq,lte,gte,mod as aliases to if conditions +- added neq,lte,gte,mod as aliases to if conditions - throw exception on illegal Smarty() constructor calls 10/31/2009 @@ -2651,7 +2792,7 @@ request_use_auto_globals - added {$foo++}{$foo--} syntax - buxfix changed PHP "if (..):" to "if (..){" because of possible bad code when concenating PHP tags - autoload Smarty internal classes -- fixed file dependency for config files +- fixed file dependency for config files - some code optimizations - fixed function definitions on some autoloaded methods - fixed nocache variable inside if condition of {if} tag @@ -2662,7 +2803,7 @@ request_use_auto_globals 10/19/2009 - fixed compiled template merging on variable double quoted strings as name -- fixed bug in caching mode 2 and cache_lifetime -1 +- fixed bug in caching mode 2 and cache_lifetime -1 - fixed modifier support on block tags 10/17/2009 @@ -2861,7 +3002,7 @@ NOTICE: existing compiled template and cache files must be deleted 05/05/2009 - fixed E_STRICT incompabilities -- {function} tag bug fix +- {function} tag bug fix - security policy definitions have been moved from plugins folder to file Security.class.php in libs folder - added allow_super_global configuration to security @@ -2921,9 +3062,9 @@ NOTICE: existing compiled template and cache files must be deleted 04/10/2009 - check if mb string functions available otherwise fallback to normal string functions -- added global variable scope SMARTY_GLOBAL_SCOPE +- added global variable scope SMARTY_GLOBAL_SCOPE - enable 'variable' filter by default -- fixed {$smarty.block.parent.foo} +- fixed {$smarty.block.parent.foo} - implementation of a 'variable' filter as replacement for default modifier 04/09/2009 @@ -2963,7 +3104,7 @@ NOTICE: existing compiled template and cache files must be deleted 03/31/2009 - bugfix smarty.class and internal.security_handler -- added compile_check configuration +- added compile_check configuration - added setter/getter methods 03/30/2009 @@ -2996,7 +3137,7 @@ NOTICE: existing compiled template and cache files must be deleted - fixed exceptions in function plugins - fixed notice error in Smarty.class.php - allow chained objects to span multiple lines -- fixed error in modifiers +- fixed error in modifiers 03/20/2009 - moved /plugins folder into /libs folder @@ -3005,14 +3146,14 @@ NOTICE: existing compiled template and cache files must be deleted 03/19/2009 - allow array definition as modifier parameter -- changed modifier to use multi byte string funktions. +- changed modifier to use multi byte string funktions. 03/17/2009 -- bugfix +- bugfix 03/15/2009 - added {include_php} tag for BC -- removed @ error suppression +- removed @ error suppression - bugfix fetch did always repeat output of first call when calling same template several times - PHPunit tests extended @@ -3109,7 +3250,7 @@ NOTICE: existing compiled template and cache files must be deleted - changed search order on modifiers to look at plugins folder first - parser bug fix for modifier on array elements $foo.bar|modifier - parser bug fix on single quoted srings -- internal: splitted up compiler plugin files +- internal: splitted up compiler plugin files 02/01/2009 - allow method chaining on static classes @@ -3173,7 +3314,7 @@ NOTICE: existing compiled template and cache files must be deleted - optimization of plugin loading 12/30/2008 -- added compiler support of registered object +- added compiler support of registered object - added backtick support in doubled quoted strings for backward compatibility - some minor bug fixes and improvments @@ -3184,7 +3325,7 @@ NOTICE: existing compiled template and cache files must be deleted - finished work on (un)register_modifier method - plugin handling from plugins folder changed for modifier plugins deleted - internal.modifier.php -- added modifier chaining to parser +- added modifier chaining to parser 12/17/2008 - finished (un)register_function method diff --git a/vendor/smarty/smarty/composer.json b/vendor/smarty/smarty/composer.json new file mode 100644 index 000000000..5064c8ce3 --- /dev/null +++ b/vendor/smarty/smarty/composer.json @@ -0,0 +1,39 @@ +{ + "name": "smarty/smarty", + "type": "library", + "description": "Smarty - the compiling PHP template engine", + "keywords": ["templating"], + "homepage": "http://www.smarty.net", + "license": "LGPL-3.0", + "authors": [ + { + "name": "Monte Ohrt", + "email": "monte@ohrt.com" + }, + { + "name": "Uwe Tews", + "email": "uwe.tews@googlemail.com" + }, + { + "name": "Rodney Rehm", + "email": "rodney.rehm@medialize.de" + } + ], + "support": { + "irc": "irc://irc.freenode.org/smarty", + "issues": "https://github.com/smarty-php/smarty/issues", + "forum": "http://www.smarty.net/forums/" + }, + "require": { + "php": ">=5.2" + }, + "autoload": { + "files": ["libs/bootstrap.php"] + }, + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + } + +} diff --git a/vendor/smarty/smarty/demo/plugins/cacheresource.pdo.php b/vendor/smarty/smarty/demo/plugins/cacheresource.pdo.php index d1e2d6ace..24a94c1a0 100644 --- a/vendor/smarty/smarty/demo/plugins/cacheresource.pdo.php +++ b/vendor/smarty/smarty/demo/plugins/cacheresource.pdo.php @@ -91,7 +91,7 @@ class Smarty_CacheResource_Pdo extends Smarty_CacheResource_Custom * * @param PDO $pdo PDO : active connection * @param string $table : table (or view) name - * @param string $database : optionnal - if table is located in another db + * @param string $database : optional - if table is located in another db */ public function __construct(PDO $pdo, $table, $database = null) { diff --git a/vendor/smarty/smarty/error_reporting.ini b/vendor/smarty/smarty/error_reporting.ini new file mode 100644 index 000000000..496bbf5c2 --- /dev/null +++ b/vendor/smarty/smarty/error_reporting.ini @@ -0,0 +1 @@ +error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/Autoloader.php b/vendor/smarty/smarty/libs/Autoloader.php index d3b039caa..3a0da8faf 100644 --- a/vendor/smarty/smarty/libs/Autoloader.php +++ b/vendor/smarty/smarty/libs/Autoloader.php @@ -14,13 +14,13 @@ * require_once '...path/Autoloader.php'; * Smarty_Autoloader::register(); * or - * include '...path/bootstarp.php'; + * include '...path/bootstrap.php'; * * $smarty = new Smarty(); */ class Smarty_Autoloader { - /** + /** * Filepath to Smarty root * * @var string @@ -76,7 +76,7 @@ class Smarty_Autoloader self::$SMARTY_DIR = defined('SMARTY_DIR') ? SMARTY_DIR : dirname(__FILE__) . DIRECTORY_SEPARATOR; self::$SMARTY_SYSPLUGINS_DIR = defined('SMARTY_SYSPLUGINS_DIR') ? SMARTY_SYSPLUGINS_DIR : self::$SMARTY_DIR . 'sysplugins' . DIRECTORY_SEPARATOR; - if (version_compare(phpversion(), '5.3.0', '>=')) { + if (version_compare(PHP_VERSION, '5.3.0', '>=')) { spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend); } else { spl_autoload_register(array(__CLASS__, 'autoload')); diff --git a/vendor/smarty/smarty/libs/Smarty.class.php b/vendor/smarty/smarty/libs/Smarty.class.php index 57eedfb93..597fbbf0c 100644 --- a/vendor/smarty/smarty/libs/Smarty.class.php +++ b/vendor/smarty/smarty/libs/Smarty.class.php @@ -21,34 +21,44 @@ * smarty-discussion-subscribe@googlegroups.com * * @link http://www.smarty.net/ - * @copyright 2016 New Digital Group, Inc. - * @copyright 2016 Uwe Tews + * @copyright 2018 New Digital Group, Inc. + * @copyright 2018 Uwe Tews * @author Monte Ohrt <monte at ohrt dot com> - * @author Uwe Tews + * @author Uwe Tews <uwe dot tews at gmail dot com> * @author Rodney Rehm * @package Smarty - * @version 3.1.31 + * @version 3.1.32 */ - /** * set SMARTY_DIR to absolute path to Smarty library files. * Sets SMARTY_DIR only if user application has not already defined it. */ if (!defined('SMARTY_DIR')) { + /** + * + */ define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR); } - /** * set SMARTY_SYSPLUGINS_DIR to absolute path to Smarty internal plugins. * Sets SMARTY_SYSPLUGINS_DIR only if user application has not already defined it. */ if (!defined('SMARTY_SYSPLUGINS_DIR')) { + /** + * + */ define('SMARTY_SYSPLUGINS_DIR', SMARTY_DIR . 'sysplugins' . DIRECTORY_SEPARATOR); } if (!defined('SMARTY_PLUGINS_DIR')) { + /** + * + */ define('SMARTY_PLUGINS_DIR', SMARTY_DIR . 'plugins' . DIRECTORY_SEPARATOR); } if (!defined('SMARTY_MBSTRING')) { + /** + * + */ define('SMARTY_MBSTRING', function_exists('mb_get_info')); } if (!defined('SMARTY_RESOURCE_CHAR_SET')) { @@ -64,14 +74,12 @@ if (!defined('SMARTY_RESOURCE_DATE_FORMAT')) { */ define('SMARTY_RESOURCE_DATE_FORMAT', '%b %e, %Y'); } - /** * Load Smarty_Autoloader */ if (!class_exists('Smarty_Autoloader')) { - include __DIR__ . '/bootstrap.php'; + include dirname(__FILE__) . '/bootstrap.php'; } - /** * Load always needed external class files */ @@ -95,337 +103,196 @@ require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_resource_file.php'; * * @method int clearAllCache(int $exp_time = null, string $type = null) * @method int clearCache(string $template_name, string $cache_id = null, string $compile_id = null, int $exp_time = null, string $type = null) - * @method int compileAllTemplates(string $extension = '.tpl', bool $force_compile = false, int $time_limit = 0, int $max_errors = null) - * @method int compileAllConfig(string $extension = '.conf', bool $force_compile = false, int $time_limit = 0, int $max_errors = null) + * @method int compileAllTemplates(string $extension = '.tpl', bool $force_compile = false, int $time_limit = 0, $max_errors = null) + * @method int compileAllConfig(string $extension = '.conf', bool $force_compile = false, int $time_limit = 0, $max_errors = null) * @method int clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null) */ class Smarty extends Smarty_Internal_TemplateBase { - /**#@+ - * constant definitions - */ - /** * smarty version */ - const SMARTY_VERSION = '3.1.31'; - + const SMARTY_VERSION = '3.1.32'; /** * define variable scopes */ - const SCOPE_LOCAL = 1; - - const SCOPE_PARENT = 2; - + const SCOPE_LOCAL = 1; + const SCOPE_PARENT = 2; const SCOPE_TPL_ROOT = 4; - - const SCOPE_ROOT = 8; - - const SCOPE_SMARTY = 16; - - const SCOPE_GLOBAL = 32; - + const SCOPE_ROOT = 8; + const SCOPE_SMARTY = 16; + const SCOPE_GLOBAL = 32; /** * define caching modes */ - const CACHING_OFF = 0; - + const CACHING_OFF = 0; const CACHING_LIFETIME_CURRENT = 1; - - const CACHING_LIFETIME_SAVED = 2; - + const CACHING_LIFETIME_SAVED = 2; /** * define constant for clearing cache files be saved expiration dates */ - const CLEAR_EXPIRED = - 1; - + const CLEAR_EXPIRED = -1; /** * define compile check modes */ - const COMPILECHECK_OFF = 0; - - const COMPILECHECK_ON = 1; - + const COMPILECHECK_OFF = 0; + const COMPILECHECK_ON = 1; const COMPILECHECK_CACHEMISS = 2; - /** * define debug modes */ - const DEBUG_OFF = 0; - - const DEBUG_ON = 1; - + const DEBUG_OFF = 0; + const DEBUG_ON = 1; const DEBUG_INDIVIDUAL = 2; - /** * modes for handling of "<?php ... ?>" tags in templates. */ const PHP_PASSTHRU = 0; //-> print tags as plain text - - const PHP_QUOTE = 1; //-> escape tags as entities - - const PHP_REMOVE = 2; //-> escape tags as entities - - const PHP_ALLOW = 3; //-> escape tags as entities - + const PHP_QUOTE = 1; //-> escape tags as entities + const PHP_REMOVE = 2; //-> escape tags as entities + const PHP_ALLOW = 3; //-> escape tags as entities /** * filter types */ - const FILTER_POST = 'post'; - - const FILTER_PRE = 'pre'; - - const FILTER_OUTPUT = 'output'; - + const FILTER_POST = 'post'; + const FILTER_PRE = 'pre'; + const FILTER_OUTPUT = 'output'; const FILTER_VARIABLE = 'variable'; - /** * plugin types */ - const PLUGIN_FUNCTION = 'function'; - - const PLUGIN_BLOCK = 'block'; - - const PLUGIN_COMPILER = 'compiler'; - - const PLUGIN_MODIFIER = 'modifier'; - + const PLUGIN_FUNCTION = 'function'; + const PLUGIN_BLOCK = 'block'; + const PLUGIN_COMPILER = 'compiler'; + const PLUGIN_MODIFIER = 'modifier'; const PLUGIN_MODIFIERCOMPILER = 'modifiercompiler'; - - /** - * Resource caching modes - * (not used since 3.1.30) - */ - const RESOURCE_CACHE_OFF = 0; - - const RESOURCE_CACHE_AUTOMATIC = 1; // cache template objects by rules - - const RESOURCE_CACHE_TEMPLATE = 2; // cache all template objects - - const RESOURCE_CACHE_ON = 4; // cache source and compiled resources - - /**#@-*/ - /** * assigned global tpl vars */ public static $global_tpl_vars = array(); - - /** - * error handler returned by set_error_handler() in Smarty::muteExpectedErrors() - */ - public static $_previous_error_handler = null; - - /** - * contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors() - */ - public static $_muted_directories = array(); - /** * Flag denoting if Multibyte String functions are available */ public static $_MBSTRING = SMARTY_MBSTRING; - /** * The character set to adhere to (e.g. "UTF-8") */ public static $_CHARSET = SMARTY_RESOURCE_CHAR_SET; - /** * The date format to be used internally * (accepts date() and strftime()) */ public static $_DATE_FORMAT = SMARTY_RESOURCE_DATE_FORMAT; - /** * Flag denoting if PCRE should run in UTF-8 mode */ public static $_UTF8_MODIFIER = 'u'; - /** * Flag denoting if operating system is windows */ public static $_IS_WINDOWS = false; - - /**#@+ - * variables - */ - /** * auto literal on delimiters with whitespace * * @var boolean */ public $auto_literal = true; - /** * display error on not assigned variables * * @var boolean */ public $error_unassigned = false; - /** * look up relative file path in include_path * * @var boolean */ public $use_include_path = false; - - /** - * template directory - * - * @var array - */ - protected $template_dir = array('./templates/'); - - /** - * flags for normalized template directory entries - * - * @var array - */ - protected $_processedTemplateDir = array(); - /** * flag if template_dir is normalized * * @var bool */ public $_templateDirNormalized = false; - /** * joined template directory string used in cache keys * * @var string */ public $_joined_template_dir = null; - - /** - * config directory - * - * @var array - */ - protected $config_dir = array('./configs/'); - - /** - * flags for normalized template directory entries - * - * @var array - */ - protected $_processedConfigDir = array(); - /** * flag if config_dir is normalized * * @var bool */ public $_configDirNormalized = false; - /** * joined config directory string used in cache keys * * @var string */ public $_joined_config_dir = null; - /** * default template handler * * @var callable */ public $default_template_handler_func = null; - /** * default config handler * * @var callable */ public $default_config_handler_func = null; - /** * default plugin handler * * @var callable */ public $default_plugin_handler_func = null; - - /** - * compile directory - * - * @var string - */ - protected $compile_dir = './templates_c/'; - /** * flag if template_dir is normalized * * @var bool */ public $_compileDirNormalized = false; - - /** - * plugins directory - * - * @var array - */ - protected $plugins_dir = array(); - /** * flag if plugins_dir is normalized * * @var bool */ public $_pluginsDirNormalized = false; - - /** - * cache directory - * - * @var string - */ - protected $cache_dir = './cache/'; - /** * flag if template_dir is normalized * * @var bool */ public $_cacheDirNormalized = false; - /** * force template compiling? * * @var boolean */ public $force_compile = false; - - /** - * check template for modifications? - * - * @var boolean - */ - public $compile_check = true; - - /** + /** * use sub dirs for compiled/cached files? * * @var boolean */ public $use_sub_dirs = false; - /** * allow ambiguous resources (that are made unique by the resource handler) * * @var boolean */ public $allow_ambiguous_resources = false; - /** * merge compiled includes * * @var boolean */ public $merge_compiled_includes = false; - /* * flag for behaviour when extends: resource and {extends} tag are used simultaneous * if false disable execution of {extends} in templates called by extends resource. @@ -434,31 +301,30 @@ class Smarty extends Smarty_Internal_TemplateBase * @var boolean */ public $extends_recursion = true; - /** * force cache file creation * * @var boolean */ public $force_cache = false; - /** * template left-delimiter * * @var string */ public $left_delimiter = "{"; - /** * template right-delimiter * * @var string */ public $right_delimiter = "}"; - - /**#@+ - * security + /** + * array of strings which shall be treated as literal by compiler + * + * @var array string */ + public $literals = array(); /** * class name * This should be instance of Smarty_Security. @@ -467,29 +333,24 @@ class Smarty extends Smarty_Internal_TemplateBase * @see Smarty_Security */ public $security_class = 'Smarty_Security'; - /** * implementation of security class * * @var Smarty_Security */ public $security_policy = null; - /** * controls handling of PHP-blocks * * @var integer */ public $php_handling = self::PHP_PASSTHRU; - /** * controls if the php template file resource is allowed * * @var bool */ public $allow_php_templates = false; - - /**#@-*/ /** * debug mode * Setting this to true enables the debug-console. @@ -497,7 +358,6 @@ class Smarty extends Smarty_Internal_TemplateBase * @var boolean */ public $debugging = false; - /** * This determines if debugging is enable-able from the browser. * <ul> @@ -508,7 +368,6 @@ class Smarty extends Smarty_Internal_TemplateBase * @var string */ public $debugging_ctrl = 'NONE'; - /** * Name of debugging URL-param. * Only used when $debugging_ctrl is set to 'URL'. @@ -517,75 +376,54 @@ class Smarty extends Smarty_Internal_TemplateBase * @var string */ public $smarty_debug_id = 'SMARTY_DEBUG'; - /** * Path of debug template. * * @var string */ public $debug_tpl = null; - /** * When set, smarty uses this value as error_reporting-level. * * @var int */ public $error_reporting = null; - - /**#@+ - * config var settings - */ - /** * Controls whether variables with the same name overwrite each other. * * @var boolean */ public $config_overwrite = true; - /** * Controls whether config values of on/true/yes and off/false/no get converted to boolean. * * @var boolean */ public $config_booleanize = true; - /** * Controls whether hidden config sections/vars are read from the file. * * @var boolean */ public $config_read_hidden = false; - - /**#@-*/ - - /**#@+ - * resource locking - */ - /** * locking concurrent compiles * * @var boolean */ public $compile_locking = true; - /** * Controls whether cache resources should use locking mechanism * * @var boolean */ public $cache_locking = false; - /** * seconds to wait for acquiring a lock before ignoring the write lock * * @var float */ public $locking_timeout = 10; - - /**#@-*/ - /** * resource type used if none given * Must be an valid key of $registered_resources. @@ -593,7 +431,6 @@ class Smarty extends Smarty_Internal_TemplateBase * @var string */ public $default_resource_type = 'file'; - /** * caching type * Must be an element of $cache_resource_types. @@ -601,145 +438,160 @@ class Smarty extends Smarty_Internal_TemplateBase * @var string */ public $caching_type = 'file'; - /** * config type * * @var string */ public $default_config_type = 'file'; - /** * check If-Modified-Since headers * * @var boolean */ public $cache_modified_check = false; - /** * registered plugins * * @var array */ public $registered_plugins = array(); - /** * registered objects * * @var array */ public $registered_objects = array(); - /** * registered classes * * @var array */ public $registered_classes = array(); - /** * registered filters * * @var array */ public $registered_filters = array(); - /** * registered resources * * @var array */ public $registered_resources = array(); - /** * registered cache resources * * @var array */ public $registered_cache_resources = array(); - /** * autoload filter * * @var array */ public $autoload_filters = array(); - /** * default modifier * * @var array */ public $default_modifiers = array(); - /** * autoescape variable output * * @var boolean */ public $escape_html = false; - /** * start time for execution time calculation * * @var int */ public $start_time = 0; - /** * required by the compiler for BC * * @var string */ public $_current_file = null; - /** * internal flag to enable parser debugging * * @var bool */ public $_parserdebug = false; - /** * This object type (Smarty = 1, template = 2, data = 4) * * @var int */ public $_objType = 1; - /** * Debug object * * @var Smarty_Internal_Debug */ public $_debug = null; - /** - * Directory separator + * template directory + * + * @var array + */ + protected $template_dir = array('./templates/'); + /** + * flags for normalized template directory entries + * + * @var array + */ + protected $_processedTemplateDir = array(); + /** + * config directory + * + * @var array + */ + protected $config_dir = array('./configs/'); + /** + * flags for normalized template directory entries + * + * @var array + */ + protected $_processedConfigDir = array(); + /** + * compile directory * * @var string */ - public $ds = DIRECTORY_SEPARATOR; - + protected $compile_dir = './templates_c/'; + /** + * plugins directory + * + * @var array + */ + protected $plugins_dir = array(); + /** + * cache directory + * + * @var string + */ + protected $cache_dir = './cache/'; /** * removed properties * * @var string[] */ - private $obsoleteProperties = array('resource_caching', 'template_resource_caching', 'direct_access_security', - '_dir_perms', '_file_perms', 'plugin_search_order', - 'inheritance_merge_compiled_includes', 'resource_cache_mode',); - + protected $obsoleteProperties = array('resource_caching', 'template_resource_caching', 'direct_access_security', + '_dir_perms', '_file_perms', 'plugin_search_order', + 'inheritance_merge_compiled_includes', 'resource_cache_mode',); /** * List of private properties which will call getter/setter on a direct access * * @var string[] */ - private $accessMap = array('template_dir' => 'TemplateDir', 'config_dir' => 'ConfigDir', - 'plugins_dir' => 'PluginsDir', 'compile_dir' => 'CompileDir', - 'cache_dir' => 'CacheDir',); - - /**#@-*/ + protected $accessMap = array('template_dir' => 'TemplateDir', 'config_dir' => 'ConfigDir', + 'plugins_dir' => 'PluginsDir', 'compile_dir' => 'CompileDir', + 'cache_dir' => 'CacheDir',); /** * Initialize new Smarty object @@ -752,11 +604,9 @@ class Smarty extends Smarty_Internal_TemplateBase mb_internal_encoding(Smarty::$_CHARSET); } $this->start_time = microtime(true); - if (isset($_SERVER[ 'SCRIPT_NAME' ])) { Smarty::$global_tpl_vars[ 'SCRIPT_NAME' ] = new Smarty_Variable($_SERVER[ 'SCRIPT_NAME' ]); } - // Check if we're running on windows Smarty::$_IS_WINDOWS = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; // let PCRE (preg_*) treat strings as ISO-8859-1 if we're not dealing with UTF-8 @@ -766,11 +616,33 @@ class Smarty extends Smarty_Internal_TemplateBase } /** + * Enable error handler to mute expected messages + * + * @return boolean + * @deprecated + */ + public static function muteExpectedErrors() + { + return Smarty_Internal_ErrorHandler::muteExpectedErrors(); + } + + /** + * Disable error handler muting expected messages + * + * @deprecated + */ + public static function unmuteExpectedErrors() + { + restore_error_handler(); + } + + /** * Check if a template resource exists * * @param string $resource_name template name * - * @return boolean status + * @return bool status + * @throws \SmartyException */ public function templateExists($resource_name) { @@ -801,28 +673,6 @@ class Smarty extends Smarty_Internal_TemplateBase public function disableSecurity() { $this->security_policy = null; - - return $this; - } - - /** - * Set template directory - * - * @param string|array $template_dir directory(s) of template sources - * @param bool $isConfig true for config_dir - * - * @return \Smarty current Smarty instance for chaining - */ - public function setTemplateDir($template_dir, $isConfig = false) - { - if ($isConfig) { - $this->config_dir = array(); - $this->_processedConfigDir = array(); - } else { - $this->template_dir = array(); - $this->_processedTemplateDir = array(); - } - $this->addTemplateDir($template_dir, null, $isConfig); return $this; } @@ -886,7 +736,7 @@ class Smarty extends Smarty_Internal_TemplateBase $dir = &$this->template_dir; } if ($isConfig ? !$this->_configDirNormalized : !$this->_templateDirNormalized) { - $this->_nomalizeTemplateConfig($isConfig); + $this->_normalizeTemplateConfig($isConfig); } if ($index !== null) { return isset($dir[ $index ]) ? $dir[ $index ] : null; @@ -895,15 +745,24 @@ class Smarty extends Smarty_Internal_TemplateBase } /** - * Set config directory + * Set template directory * - * @param $config_dir + * @param string|array $template_dir directory(s) of template sources + * @param bool $isConfig true for config_dir * - * @return Smarty current Smarty instance for chaining + * @return \Smarty current Smarty instance for chaining */ - public function setConfigDir($config_dir) + public function setTemplateDir($template_dir, $isConfig = false) { - return $this->setTemplateDir($config_dir, true); + if ($isConfig) { + $this->config_dir = array(); + $this->_processedConfigDir = array(); + } else { + $this->template_dir = array(); + $this->_processedTemplateDir = array(); + } + $this->addTemplateDir($template_dir, null, $isConfig); + return $this; } /** @@ -932,23 +791,21 @@ class Smarty extends Smarty_Internal_TemplateBase } /** - * Set plugins directory + * Set config directory * - * @param string|array $plugins_dir directory(s) of plugins + * @param $config_dir * * @return Smarty current Smarty instance for chaining */ - public function setPluginsDir($plugins_dir) + public function setConfigDir($config_dir) { - $this->plugins_dir = (array) $plugins_dir; - $this->_pluginsDirNormalized = false; - return $this; + return $this->setTemplateDir($config_dir, true); } /** * Adds directory of plugin files * - * @param null|array $plugins_dir + * @param null|array|string $plugins_dir * * @return Smarty current Smarty instance for chaining */ @@ -957,7 +814,7 @@ class Smarty extends Smarty_Internal_TemplateBase if (empty($this->plugins_dir)) { $this->plugins_dir[] = SMARTY_PLUGINS_DIR; } - $this->plugins_dir = array_merge($this->plugins_dir, (array) $plugins_dir); + $this->plugins_dir = array_merge($this->plugins_dir, (array)$plugins_dir); $this->_pluginsDirNormalized = false; return $this; } @@ -975,10 +832,10 @@ class Smarty extends Smarty_Internal_TemplateBase } if (!$this->_pluginsDirNormalized) { if (!is_array($this->plugins_dir)) { - $this->plugins_dir = (array) $this->plugins_dir; + $this->plugins_dir = (array)$this->plugins_dir; } foreach ($this->plugins_dir as $k => $v) { - $this->plugins_dir[ $k ] = $this->_realpath(rtrim($v, "/\\") . $this->ds, true); + $this->plugins_dir[ $k ] = $this->_realpath(rtrim($v, "/\\") . DIRECTORY_SEPARATOR, true); } $this->_cache[ 'plugin_files' ] = array(); $this->_pluginsDirNormalized = true; @@ -987,15 +844,16 @@ class Smarty extends Smarty_Internal_TemplateBase } /** + * Set plugins directory * - * @param string $compile_dir directory to store compiled templates in + * @param string|array $plugins_dir directory(s) of plugins * - * @return Smarty current Smarty instance for chaining + * @return Smarty current Smarty instance for chaining */ - public function setCompileDir($compile_dir) + public function setPluginsDir($plugins_dir) { - $this->_normalizeDir('compile_dir', $compile_dir); - $this->_compileDirNormalized = true; + $this->plugins_dir = (array)$plugins_dir; + $this->_pluginsDirNormalized = false; return $this; } @@ -1014,16 +872,15 @@ class Smarty extends Smarty_Internal_TemplateBase } /** - * Set cache directory * - * @param string $cache_dir directory to store cached templates in + * @param string $compile_dir directory to store compiled templates in * * @return Smarty current Smarty instance for chaining */ - public function setCacheDir($cache_dir) + public function setCompileDir($compile_dir) { - $this->_normalizeDir('cache_dir', $cache_dir); - $this->_cacheDirNormalized = true; + $this->_normalizeDir('compile_dir', $compile_dir); + $this->_compileDirNormalized = true; return $this; } @@ -1042,46 +899,17 @@ class Smarty extends Smarty_Internal_TemplateBase } /** - * Normalize and set directory string - * - * @param string $dirName cache_dir or compile_dir - * @param string $dir filepath of folder - */ - private function _normalizeDir($dirName, $dir) - { - $this->{$dirName} = $this->_realpath(rtrim($dir, "/\\") . $this->ds, true); - if (!isset(Smarty::$_muted_directories[ $this->{$dirName} ])) { - Smarty::$_muted_directories[ $this->{$dirName} ] = null; - } - } - - /** - * Normalize template_dir or config_dir + * Set cache directory * - * @param bool $isConfig true for config_dir + * @param string $cache_dir directory to store cached templates in * + * @return Smarty current Smarty instance for chaining */ - private function _nomalizeTemplateConfig($isConfig) + public function setCacheDir($cache_dir) { - if ($isConfig) { - $processed = &$this->_processedConfigDir; - $dir = &$this->config_dir; - } else { - $processed = &$this->_processedTemplateDir; - $dir = &$this->template_dir; - } - if (!is_array($dir)) { - $dir = (array) $dir; - } - foreach ($dir as $k => $v) { - if (!isset($processed[ $k ])) { - $dir[ $k ] = $v = $this->_realpath(rtrim($v, "/\\") . $this->ds, true); - $processed[ $k ] = true; - } - } - $isConfig ? $this->_configDirNormalized = true : $this->_templateDirNormalized = true; - $isConfig ? $this->_joined_config_dir = join('#', $this->config_dir) : - $this->_joined_template_dir = join('#', $this->template_dir); + $this->_normalizeDir('cache_dir', $cache_dir); + $this->_cacheDirNormalized = true; + return $this; } /** @@ -1093,7 +921,8 @@ class Smarty extends Smarty_Internal_TemplateBase * @param object $parent next higher level of Smarty variables * @param boolean $do_clone flag is Smarty object shall be cloned * - * @return object template object + * @return \Smarty_Internal_Template template object + * @throws \SmartyException */ public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true) { @@ -1108,7 +937,7 @@ class Smarty extends Smarty_Internal_TemplateBase $data = null; } if (!$this->_templateDirNormalized) { - $this->_nomalizeTemplateConfig(false); + $this->_normalizeTemplateConfig(false); } $_templateId = $this->_getTemplateId($template, $cache_id, $compile_id); $tpl = null; @@ -1137,10 +966,10 @@ class Smarty extends Smarty_Internal_TemplateBase $tpl->tpl_vars[ $_key ] = new Smarty_Variable($_val); } } - if ($this->debugging || $this->debugging_ctrl == 'URL') { + if ($this->debugging || $this->debugging_ctrl === 'URL') { $tpl->smarty->_debug = new Smarty_Internal_Debug(); // check URL debugging control - if (!$this->debugging && $this->debugging_ctrl == 'URL') { + if (!$this->debugging && $this->debugging_ctrl === 'URL') { $tpl->smarty->_debug->debugUrl($tpl->smarty); } } @@ -1173,16 +1002,19 @@ class Smarty extends Smarty_Internal_TemplateBase * @param \Smarty_Internal_Template $template * * @return string + * @throws \SmartyException */ - public function _getTemplateId($template_name, $cache_id = null, $compile_id = null, $caching = null, + public function _getTemplateId($template_name, + $cache_id = null, + $compile_id = null, + $caching = null, Smarty_Internal_Template $template = null) { $template_name = (strpos($template_name, ':') === false) ? "{$this->default_resource_type}:{$template_name}" : $template_name; $cache_id = $cache_id === null ? $this->cache_id : $cache_id; $compile_id = $compile_id === null ? $this->compile_id : $compile_id; - $caching = (int) ($caching === null ? $this->caching : $caching); - + $caching = (int)($caching === null ? $this->caching : $caching); if ((isset($template) && strpos($template_name, ':.') !== false) || $this->allow_ambiguous_resources) { $_templateId = Smarty_Resource::getUniqueTemplateName((isset($template) ? $template : $this), $template_name) . @@ -1210,38 +1042,51 @@ class Smarty extends Smarty_Internal_TemplateBase */ public function _realpath($path, $realpath = null) { - $nds = $this->ds == '/' ? '\\' : '/'; - // normalize $this->ds - $path = str_replace($nds, $this->ds, $path); - preg_match('%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(?:[[:print:]]*))$%', - $path, $parts); + static $nds = null; + static $sepDotsep = null; + static $sepDot = null; + static $sepSep =null; + if (!isset($nds)) { + $nds = array('/' => '\\', '\\' => '/'); + $sepDotsep = DIRECTORY_SEPARATOR . '.' . DIRECTORY_SEPARATOR; + $sepDot = DIRECTORY_SEPARATOR . '.'; + $sepSep = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR; + } + // normalize DIRECTORY_SEPARATOR + $path = str_replace(array($nds[DIRECTORY_SEPARATOR], $sepDotsep), DIRECTORY_SEPARATOR, $path); + if (strpos($path,$sepDot) === false && (($realpath === false && $path[0] === '.') || $realpath === null) && $path[0] !== '\\') { + return $path; + } + preg_match('%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(.*))$%u', + $path, + $parts); $path = $parts[ 'path' ]; - if ($parts[ 'root' ] == '\\') { + if ($parts[ 'root' ] === '\\') { $parts[ 'root' ] = substr(getcwd(), 0, 2) . $parts[ 'root' ]; } else { if ($realpath !== null && !$parts[ 'root' ]) { - $path = getcwd() . $this->ds . $path; + $path = getcwd() . DIRECTORY_SEPARATOR . $path; } } - // remove noop 'DIRECTORY_SEPARATOR DIRECTORY_SEPARATOR' and 'DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR' patterns - $path = preg_replace('#([\\\\/]([.]?[\\\\/])+)#', $this->ds, $path); + // remove noop 'DIRECTORY_SEPARATOR DIRECTORY_SEPARATOR' and 'DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR' patterns + $path = str_replace(array($sepDotsep,$sepSep), DIRECTORY_SEPARATOR, $path); // resolve '..DIRECTORY_SEPARATOR' pattern, smallest first - if (strpos($path, '..' . $this->ds) != false && - preg_match_all('#(([.]?[\\\\/])*([.][.])[\\\\/]([.]?[\\\\/])*)+#', $path, $match) + if (strpos($path, '..' . DIRECTORY_SEPARATOR) !== false && + preg_match_all('#[\\\\/]([.][.][\\\\/])+#u', $path, $match) ) { $counts = array(); foreach ($match[ 0 ] as $m) { - $counts[] = (int) ((strlen($m) - 1) / 3); + $counts[] = (int)((strlen($m) - 1) / 3); } sort($counts); foreach ($counts as $count) { - $path = preg_replace('#(([\\\\/]([.]?[\\\\/])*[^\\\\/.]+){' . $count . - '}[\\\\/]([.]?[\\\\/])*([.][.][\\\\/]([.]?[\\\\/])*){' . $count . '})(?=[^.])#', - $this->ds, $path); + $path = preg_replace('#([\\\\/]+[^\\\\/]+){' . $count . + '}[\\\\/]+([.][.][\\\\/]+){' . $count . '}#u', + DIRECTORY_SEPARATOR, + $path); } } - - return $parts[ 'root' ] . $path; + return $realpath !== false ? $parts[ 'root' ] . $path : str_ireplace(getcwd(), '.', $parts[ 'root' ] . $path); } /** @@ -1254,24 +1099,6 @@ class Smarty extends Smarty_Internal_TemplateBase } /** - * Get Smarty object - * - * @return Smarty - */ - public function _getSmartyObj() - { - return $this; - } - - /** - * @param boolean $compile_check - */ - public function setCompileCheck($compile_check) - { - $this->compile_check = $compile_check; - } - - /** * @param boolean $use_sub_dirs */ public function setUseSubDirs($use_sub_dirs) @@ -1296,9 +1123,21 @@ class Smarty extends Smarty_Internal_TemplateBase } /** + * Return auto_literal flag + * + * @return boolean + */ + public function getAutoLiteral() + { + return $this->auto_literal; + } + + /** + * Set auto_literal flag + * * @param boolean $auto_literal */ - public function setAutoLiteral($auto_literal) + public function setAutoLiteral($auto_literal = true) { $this->auto_literal = $auto_literal; } @@ -1320,6 +1159,18 @@ class Smarty extends Smarty_Internal_TemplateBase } /** + * Get left delimiter + * + * @return string + */ + public function getLeftDelimiter() + { + return $this->left_delimiter; + } + + /** + * Set left delimiter + * * @param string $left_delimiter */ public function setLeftDelimiter($left_delimiter) @@ -1328,7 +1179,19 @@ class Smarty extends Smarty_Internal_TemplateBase } /** - * @param string $right_delimiter + * Get right delimiter + * + * @return string $right_delimiter + */ + public function getRightDelimiter() + { + return $this->right_delimiter; + } + + /** + * Set right delimiter + * + * @param string */ public function setRightDelimiter($right_delimiter) { @@ -1402,6 +1265,16 @@ class Smarty extends Smarty_Internal_TemplateBase } /** + * Get Smarty object + * + * @return Smarty + */ + public function _getSmartyObj() + { + return $this; + } + + /** * <<magic>> Generic getter. * Calls the appropriate getter function. * Issues an E_USER_NOTICE if no valid getter is found. @@ -1409,15 +1282,16 @@ class Smarty extends Smarty_Internal_TemplateBase * @param string $name property name * * @return mixed + * @throws \SmartyException */ public function __get($name) { if (isset($this->accessMap[ $name ])) { $method = 'get' . $this->accessMap[ $name ]; return $this->{$method}(); - } elseif (isset($this->_cache[ $name ])) { + } else if (isset($this->_cache[ $name ])) { return $this->_cache[ $name ]; - } elseif (in_array($name, $this->obsoleteProperties)) { + } else if (in_array($name, $this->obsoleteProperties)) { return null; } else { trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE); @@ -1432,13 +1306,15 @@ class Smarty extends Smarty_Internal_TemplateBase * * @param string $name property name * @param mixed $value parameter passed to setter + * + * @throws \SmartyException */ public function __set($name, $value) { if (isset($this->accessMap[ $name ])) { $method = 'set' . $this->accessMap[ $name ]; $this->{$method}($value); - } elseif (in_array($name, $this->obsoleteProperties)) { + } else if (in_array($name, $this->obsoleteProperties)) { return; } else { if (is_object($value) && method_exists($value, $name)) { @@ -1450,100 +1326,47 @@ class Smarty extends Smarty_Internal_TemplateBase } /** - * Error Handler to mute expected messages - * - * @link http://php.net/set_error_handler - * - * @param integer $errno Error level - * @param $errstr - * @param $errfile - * @param $errline - * @param $errcontext + * Normalize and set directory string * - * @return bool|void + * @param string $dirName cache_dir or compile_dir + * @param string $dir filepath of folder */ - public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext) + private function _normalizeDir($dirName, $dir) { - $_is_muted_directory = false; - - // add the SMARTY_DIR to the list of muted directories - if (!isset(Smarty::$_muted_directories[ SMARTY_DIR ])) { - $smarty_dir = realpath(SMARTY_DIR); - if ($smarty_dir !== false) { - Smarty::$_muted_directories[ SMARTY_DIR ] = - array('file' => $smarty_dir, 'length' => strlen($smarty_dir),); - } - } - - // walk the muted directories and test against $errfile - foreach (Smarty::$_muted_directories as $key => &$dir) { - if (!$dir) { - // resolve directory and length for speedy comparisons - $file = realpath($key); - if ($file === false) { - // this directory does not exist, remove and skip it - unset(Smarty::$_muted_directories[ $key ]); - continue; - } - $dir = array('file' => $file, 'length' => strlen($file),); - } - if (!strncmp($errfile, $dir[ 'file' ], $dir[ 'length' ])) { - $_is_muted_directory = true; - break; - } - } - // pass to next error handler if this error did not occur inside SMARTY_DIR - // or the error was within smarty but masked to be ignored - if (!$_is_muted_directory || ($errno && $errno & error_reporting())) { - if (Smarty::$_previous_error_handler) { - return call_user_func(Smarty::$_previous_error_handler, $errno, $errstr, $errfile, $errline, - $errcontext); - } else { - return false; + $this->{$dirName} = $this->_realpath(rtrim($dir, "/\\") . DIRECTORY_SEPARATOR, true); + if (class_exists('Smarty_Internal_ErrorHandler', false)) { + if (!isset(Smarty_Internal_ErrorHandler::$mutedDirectories[ $this->{$dirName} ])) { + Smarty_Internal_ErrorHandler::$mutedDirectories[ $this->{$dirName} ] = null; } } - return; } /** - * Enable error handler to mute expected messages + * Normalize template_dir or config_dir * - * @return void - */ - public static function muteExpectedErrors() - { - /* - error muting is done because some people implemented custom error_handlers using - http://php.net/set_error_handler and for some reason did not understand the following paragraph: - - It is important to remember that the standard PHP error handler is completely bypassed for the - error types specified by error_types unless the callback function returns FALSE. - error_reporting() settings will have no effect and your error handler will be called regardless - - however you are still able to read the current value of error_reporting and act appropriately. - Of particular note is that this value will be 0 if the statement that caused the error was - prepended by the @ error-control operator. - - Smarty deliberately uses @filemtime() over file_exists() and filemtime() in some places. Reasons include - - @filemtime() is almost twice as fast as using an additional file_exists() - - between file_exists() and filemtime() a possible race condition is opened, - which does not exist using the simple @filemtime() approach. - */ - $error_handler = array('Smarty', 'mutingErrorHandler'); - $previous = set_error_handler($error_handler); - - // avoid dead loops - if ($previous !== $error_handler) { - Smarty::$_previous_error_handler = $previous; - } - } - - /** - * Disable error handler muting expected messages + * @param bool $isConfig true for config_dir * - * @return void */ - public static function unmuteExpectedErrors() + private function _normalizeTemplateConfig($isConfig) { - restore_error_handler(); + if ($isConfig) { + $processed = &$this->_processedConfigDir; + $dir = &$this->config_dir; + } else { + $processed = &$this->_processedTemplateDir; + $dir = &$this->template_dir; + } + if (!is_array($dir)) { + $dir = (array)$dir; + } + foreach ($dir as $k => $v) { + if (!isset($processed[ $k ])) { + $dir[ $k ] = $v = $this->_realpath(rtrim($v, "/\\") . DIRECTORY_SEPARATOR, true); + $processed[ $k ] = true; + } + } + $isConfig ? $this->_configDirNormalized = true : $this->_templateDirNormalized = true; + $isConfig ? $this->_joined_config_dir = join('#', $this->config_dir) : + $this->_joined_template_dir = join('#', $this->template_dir); } } diff --git a/vendor/smarty/smarty/libs/SmartyBC.class.php b/vendor/smarty/smarty/libs/SmartyBC.class.php index 3955e4f24..f2230fc9c 100644 --- a/vendor/smarty/smarty/libs/SmartyBC.class.php +++ b/vendor/smarty/smarty/libs/SmartyBC.class.php @@ -100,6 +100,8 @@ class SmartyBC extends Smarty * @param string $function_impl the name of the PHP function to register * @param bool $cacheable * @param mixed $cache_attrs + * + * @throws \SmartyException */ public function register_function($function, $function_impl, $cacheable = true, $cache_attrs = null) { @@ -153,6 +155,8 @@ class SmartyBC extends Smarty * @param string $block_impl PHP function to register * @param bool $cacheable * @param mixed $cache_attrs + * + * @throws \SmartyException */ public function register_block($block, $block_impl, $cacheable = true, $cache_attrs = null) { @@ -175,6 +179,8 @@ class SmartyBC extends Smarty * @param string $function name of template function * @param string $function_impl name of PHP function to register * @param bool $cacheable + * + * @throws \SmartyException */ public function register_compiler_function($function, $function_impl, $cacheable = true) { @@ -196,6 +202,8 @@ class SmartyBC extends Smarty * * @param string $modifier name of template modifier * @param string $modifier_impl name of PHP function to register + * + * @throws \SmartyException */ public function register_modifier($modifier, $modifier_impl) { @@ -238,6 +246,8 @@ class SmartyBC extends Smarty * to a template before compiling * * @param callable $function + * + * @throws \SmartyException */ public function register_prefilter($function) { @@ -259,6 +269,8 @@ class SmartyBC extends Smarty * to a compiled template after compilation * * @param callable $function + * + * @throws \SmartyException */ public function register_postfilter($function) { @@ -280,6 +292,8 @@ class SmartyBC extends Smarty * to a template output * * @param callable $function + * + * @throws \SmartyException */ public function register_outputfilter($function) { @@ -301,6 +315,8 @@ class SmartyBC extends Smarty * * @param string $type filter type * @param string $name filter name + * + * @throws \SmartyException */ public function load_filter($type, $name) { @@ -341,7 +357,9 @@ class SmartyBC extends Smarty * @param string $cache_id * @param string $compile_id * - * @return boolean + * @return bool + * @throws \Exception + * @throws \SmartyException */ public function is_cached($tpl_file, $cache_id = null, $compile_id = null) { @@ -377,7 +395,8 @@ class SmartyBC extends Smarty * * @param string $tpl_file * - * @return boolean + * @return bool + * @throws \SmartyException */ public function template_exists($tpl_file) { diff --git a/vendor/smarty/smarty/libs/bootstrap.php b/vendor/smarty/smarty/libs/bootstrap.php index 32096087f..dad72fcb1 100644 --- a/vendor/smarty/smarty/libs/bootstrap.php +++ b/vendor/smarty/smarty/libs/bootstrap.php @@ -12,6 +12,6 @@ * Load and register Smarty Autoloader */ if (!class_exists('Smarty_Autoloader')) { - require __DIR__ . '/Autoloader.php'; + require dirname(__FILE__) . '/Autoloader.php'; } -Smarty_Autoloader::register(); +Smarty_Autoloader::register(true); diff --git a/vendor/smarty/smarty/libs/plugins/block.textformat.php b/vendor/smarty/smarty/libs/plugins/block.textformat.php index e2c5e3de4..310a420ee 100644 --- a/vendor/smarty/smarty/libs/plugins/block.textformat.php +++ b/vendor/smarty/smarty/libs/plugins/block.textformat.php @@ -5,22 +5,21 @@ * @package Smarty * @subpackage PluginsBlock */ - /** * Smarty {textformat}{/textformat} block plugin - * Type: block function<br> - * Name: textformat<br> + * Type: block function + * Name: textformat * Purpose: format text a certain way with preset styles - * or custom wrap/indent settings<br> + * or custom wrap/indent settings * Params: - * <pre> + * * - style - string (email) * - indent - integer (0) * - wrap - integer (80) * - wrap_char - string ("\n") * - indent_char - string (" ") * - wrap_boundary - boolean (true) - * </pre> + * * * @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat} * (Smarty online manual) @@ -32,14 +31,16 @@ * * @return string content re-formatted * @author Monte Ohrt <monte at ohrt dot com> + * @throws \SmartyException */ -function smarty_block_textformat($params, $content, $template, &$repeat) +function smarty_block_textformat($params, $content, Smarty_Internal_Template $template, &$repeat) { if (is_null($content)) { return; } - if (Smarty::$_MBSTRING && !is_callable('smarty_mb_wordwrap')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php'); + if (Smarty::$_MBSTRING) { + $template->_checkPlugins(array(array('function' => 'smarty_modifier_mb_wordwrap', + 'file' => SMARTY_PLUGINS_DIR . 'modifier.mb_wordwrap.php'))); } $style = null; @@ -71,11 +72,11 @@ function smarty_block_textformat($params, $content, $template, &$repeat) break; default: - trigger_error("textformat: unknown attribute '$_key'"); + trigger_error("textformat: unknown attribute '{$_key}'"); } } - if ($style == 'email') { + if ($style === 'email') { $wrap = 72; } // split into paragraphs @@ -87,15 +88,17 @@ function smarty_block_textformat($params, $content, $template, &$repeat) } // convert mult. spaces & special chars to single space $_paragraph = - preg_replace(array('!\s+!' . Smarty::$_UTF8_MODIFIER, '!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER), - array(' ', ''), $_paragraph); + preg_replace(array('!\s+!' . Smarty::$_UTF8_MODIFIER, + '!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER), + array(' ', + ''), $_paragraph); // indent first line if ($indent_first > 0) { $_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph; } // wordwrap sentences if (Smarty::$_MBSTRING) { - $_paragraph = smarty_mb_wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut); + $_paragraph = smarty_modifier_mb_wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut); } else { $_paragraph = wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut); } diff --git a/vendor/smarty/smarty/libs/plugins/function.counter.php b/vendor/smarty/smarty/libs/plugins/function.counter.php index bcc8f498c..9610362d9 100644 --- a/vendor/smarty/smarty/libs/plugins/function.counter.php +++ b/vendor/smarty/smarty/libs/plugins/function.counter.php @@ -8,8 +8,8 @@ /** * Smarty {counter} function plugin - * Type: function<br> - * Name: counter<br> + * Type: function + * Name: counter * Purpose: print out a counter value * * @author Monte Ohrt <monte at ohrt dot com> @@ -63,7 +63,7 @@ function smarty_function_counter($params, $template) $counter[ 'direction' ] = $params[ 'direction' ]; } - if ($counter[ 'direction' ] == "down") { + if ($counter[ 'direction' ] === 'down') { $counter[ 'count' ] -= $counter[ 'skip' ]; } else { $counter[ 'count' ] += $counter[ 'skip' ]; diff --git a/vendor/smarty/smarty/libs/plugins/function.cycle.php b/vendor/smarty/smarty/libs/plugins/function.cycle.php index a76d49aed..b871524fc 100644 --- a/vendor/smarty/smarty/libs/plugins/function.cycle.php +++ b/vendor/smarty/smarty/libs/plugins/function.cycle.php @@ -8,12 +8,12 @@ /** * Smarty {cycle} function plugin - * Type: function<br> - * Name: cycle<br> - * Date: May 3, 2002<br> - * Purpose: cycle through given values<br> + * Type: function + * Name: cycle + * Date: May 3, 2002 + * Purpose: cycle through given values * Params: - * <pre> + * * - name - name of cycle (optional) * - values - comma separated list of values to cycle, or an array of values to cycle * (this can be left out for subsequent calls) @@ -22,13 +22,13 @@ * - advance - boolean - whether or not to advance the cycle * - delimiter - the value delimiter, default is "," * - assign - boolean, assigns to template var instead of printed. - * </pre> - * Examples:<br> - * <pre> + * + * Examples: + * * {cycle values="#eeeeee,#d0d0d0d"} * {cycle name=row values="one,two,three" reset=true} * {cycle name=row} - * </pre> + * * * @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle} * (Smarty online manual) @@ -55,12 +55,12 @@ function smarty_function_cycle($params, $template) if (!isset($params[ 'values' ])) { if (!isset($cycle_vars[ $name ][ 'values' ])) { - trigger_error("cycle: missing 'values' parameter"); + trigger_error('cycle: missing \'values\' parameter'); return; } } else { - if (isset($cycle_vars[ $name ][ 'values' ]) && $cycle_vars[ $name ][ 'values' ] != $params[ 'values' ]) { + if (isset($cycle_vars[ $name ][ 'values' ]) && $cycle_vars[ $name ][ 'values' ] !== $params[ 'values' ]) { $cycle_vars[ $name ][ 'index' ] = 0; } $cycle_vars[ $name ][ 'values' ] = $params[ 'values' ]; diff --git a/vendor/smarty/smarty/libs/plugins/function.fetch.php b/vendor/smarty/smarty/libs/plugins/function.fetch.php index cb60dd918..9539e1fcc 100644 --- a/vendor/smarty/smarty/libs/plugins/function.fetch.php +++ b/vendor/smarty/smarty/libs/plugins/function.fetch.php @@ -8,8 +8,8 @@ /** * Smarty {fetch} plugin - * Type: function<br> - * Name: fetch<br> + * Type: function + * Name: fetch * Purpose: fetch file, web or ftp data and display results * * @link http://www.smarty.net/manual/en/language.function.fetch.php {fetch} @@ -25,7 +25,7 @@ function smarty_function_fetch($params, $template) { if (empty($params[ 'file' ])) { - trigger_error("[plugin] fetch parameter 'file' cannot be empty", E_USER_NOTICE); + trigger_error('[plugin] fetch parameter \'file\' cannot be empty', E_USER_NOTICE); return; } @@ -55,15 +55,15 @@ function smarty_function_fetch($params, $template) } $content = ''; - if ($protocol == 'http') { + if ($protocol === 'http') { // http fetch if ($uri_parts = parse_url($params[ 'file' ])) { // set defaults $host = $server_name = $uri_parts[ 'host' ]; $timeout = 30; - $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*"; - $agent = "Smarty Template Engine " . Smarty::SMARTY_VERSION; - $referer = ""; + $accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*'; + $agent = 'Smarty Template Engine ' . Smarty::SMARTY_VERSION; + $referer = ''; $uri = !empty($uri_parts[ 'path' ]) ? $uri_parts[ 'path' ] : '/'; $uri .= !empty($uri_parts[ 'query' ]) ? '?' . $uri_parts[ 'query' ] : ''; $_is_proxy = false; @@ -81,29 +81,29 @@ function smarty_function_fetch($params, $template) // loop through parameters, setup headers foreach ($params as $param_key => $param_value) { switch ($param_key) { - case "file": - case "assign": - case "assign_headers": + case 'file': + case 'assign': + case 'assign_headers': break; - case "user": + case 'user': if (!empty($param_value)) { $user = $param_value; } break; - case "pass": + case 'pass': if (!empty($param_value)) { $pass = $param_value; } break; - case "accept": + case 'accept': if (!empty($param_value)) { $accept = $param_value; } break; - case "header": + case 'header': if (!empty($param_value)) { if (!preg_match('![\w\d-]+: .+!', $param_value)) { - trigger_error("[plugin] invalid header format '" . $param_value . "'", E_USER_NOTICE); + trigger_error("[plugin] invalid header format '{$param_value}'", E_USER_NOTICE); return; } else { @@ -111,41 +111,41 @@ function smarty_function_fetch($params, $template) } } break; - case "proxy_host": + case 'proxy_host': if (!empty($param_value)) { $proxy_host = $param_value; } break; - case "proxy_port": + case 'proxy_port': if (!preg_match('!\D!', $param_value)) { $proxy_port = (int) $param_value; } else { - trigger_error("[plugin] invalid value for attribute '" . $param_key . "'", E_USER_NOTICE); + trigger_error("[plugin] invalid value for attribute '{$param_key }'", E_USER_NOTICE); return; } break; - case "agent": + case 'agent': if (!empty($param_value)) { $agent = $param_value; } break; - case "referer": + case 'referer': if (!empty($param_value)) { $referer = $param_value; } break; - case "timeout": + case 'timeout': if (!preg_match('!\D!', $param_value)) { $timeout = (int) $param_value; } else { - trigger_error("[plugin] invalid value for attribute '" . $param_key . "'", E_USER_NOTICE); + trigger_error("[plugin] invalid value for attribute '{$param_key}'", E_USER_NOTICE); return; } break; default: - trigger_error("[plugin] unrecognized attribute '" . $param_key . "'", E_USER_NOTICE); + trigger_error("[plugin] unrecognized attribute '{$param_key}'", E_USER_NOTICE); return; } @@ -185,7 +185,7 @@ function smarty_function_fetch($params, $template) } } if (!empty($user) && !empty($pass)) { - fputs($fp, "Authorization: BASIC " . base64_encode("$user:$pass") . "\r\n"); + fputs($fp, 'Authorization: BASIC ' . base64_encode("$user:$pass") . "\r\n"); } fputs($fp, "\r\n"); diff --git a/vendor/smarty/smarty/libs/plugins/function.html_checkboxes.php b/vendor/smarty/smarty/libs/plugins/function.html_checkboxes.php index 04ce45733..d654caba6 100644 --- a/vendor/smarty/smarty/libs/plugins/function.html_checkboxes.php +++ b/vendor/smarty/smarty/libs/plugins/function.html_checkboxes.php @@ -5,22 +5,21 @@ * @package Smarty * @subpackage PluginsFunction */ - /** * Smarty {html_checkboxes} function plugin - * File: function.html_checkboxes.php<br> - * Type: function<br> - * Name: html_checkboxes<br> - * Date: 24.Feb.2003<br> - * Purpose: Prints out a list of checkbox input types<br> + * File: function.html_checkboxes.php + * Type: function + * Name: html_checkboxes + * Date: 24.Feb.2003 + * Purpose: Prints out a list of checkbox input types * Examples: - * <pre> + * * {html_checkboxes values=$ids output=$names} * {html_checkboxes values=$ids name='box' separator='<br>' output=$names} * {html_checkboxes values=$ids checked=$checked separator='<br>' output=$names} - * </pre> + * * Params: - * <pre> + * * - name (optional) - string default "checkbox" * - values (required) - array * - options (optional) - associative array @@ -29,7 +28,7 @@ * - output (optional) - the output next to each checkbox * - assign (optional) - assign the output as an array to this variable * - escape (optional) - escape the content (not value), defaults to true - * </pre> + * * * @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes} * (Smarty online manual) @@ -37,17 +36,17 @@ * @author credits to Monte Ohrt <monte at ohrt dot com> * @version 1.0 * - * @param array $params parameters - * @param object $template template object + * @param array $params parameters + * @param Smarty_Internal_Template $template template object * * @return string * @uses smarty_function_escape_special_chars() + * @throws \SmartyException */ -function smarty_function_html_checkboxes($params, $template) +function smarty_function_html_checkboxes($params, Smarty_Internal_Template $template) { - if (!is_callable('smarty_function_escape_special_chars')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'); - } + $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); $name = 'checkbox'; $values = null; @@ -89,11 +88,11 @@ function smarty_function_html_checkboxes($params, $template) $selected = array(); foreach ($_val as $_sel) { if (is_object($_sel)) { - if (method_exists($_sel, "__toString")) { + if (method_exists($_sel, '__toString')) { $_sel = smarty_function_escape_special_chars((string) $_sel->__toString()); } else { - trigger_error("html_checkboxes: selected attribute contains an object of class '" . - get_class($_sel) . "' without __toString() method", E_USER_NOTICE); + trigger_error('html_checkboxes: selected attribute contains an object of class \'' . + get_class($_sel) . '\' without __toString() method', E_USER_NOTICE); continue; } } else { @@ -102,11 +101,11 @@ function smarty_function_html_checkboxes($params, $template) $selected[ $_sel ] = true; } } elseif (is_object($_val)) { - if (method_exists($_val, "__toString")) { + if (method_exists($_val, '__toString')) { $selected = smarty_function_escape_special_chars((string) $_val->__toString()); } else { - trigger_error("html_checkboxes: selected attribute is an object of class '" . get_class($_val) . - "' without __toString() method", E_USER_NOTICE); + trigger_error('html_checkboxes: selected attribute is an object of class \'' . get_class($_val) . + '\' without __toString() method', E_USER_NOTICE); } } else { $selected = smarty_function_escape_special_chars((string) $_val); @@ -129,7 +128,7 @@ function smarty_function_html_checkboxes($params, $template) case 'readonly': if (!empty($params[ 'strict' ])) { if (!is_scalar($_val)) { - trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", + trigger_error("html_options: {$_key} attribute must be a scalar, only boolean true or string '{$_key}' will actually add the attribute", E_USER_NOTICE); } @@ -145,7 +144,7 @@ function smarty_function_html_checkboxes($params, $template) if (!is_array($_val)) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; } else { - trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + trigger_error("html_checkboxes: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); } break; } @@ -178,18 +177,30 @@ function smarty_function_html_checkboxes($params, $template) return implode("\n", $_html_result); } } - +/** + * @param $name + * @param $value + * @param $output + * @param $selected + * @param $extra + * @param $separator + * @param $labels + * @param $label_ids + * @param bool $escape + * + * @return string + */ function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, - $label_ids, $escape = true) + $label_ids, $escape = true) { $_output = ''; if (is_object($value)) { - if (method_exists($value, "__toString")) { + if (method_exists($value, '__toString')) { $value = (string) $value->__toString(); } else { - trigger_error("html_options: value is an object of class '" . get_class($value) . - "' without __toString() method", E_USER_NOTICE); + trigger_error('html_options: value is an object of class \'' . get_class($value) . + '\' without __toString() method', E_USER_NOTICE); return ''; } @@ -198,11 +209,11 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte } if (is_object($output)) { - if (method_exists($output, "__toString")) { + if (method_exists($output, '__toString')) { $output = (string) $output->__toString(); } else { - trigger_error("html_options: output is an object of class '" . get_class($output) . - "' without __toString() method", E_USER_NOTICE); + trigger_error('html_options: output is an object of class \'' . get_class($output) . + '\' without __toString() method', E_USER_NOTICE); return ''; } diff --git a/vendor/smarty/smarty/libs/plugins/function.html_image.php b/vendor/smarty/smarty/libs/plugins/function.html_image.php index 6da8fc544..4fda72eef 100644 --- a/vendor/smarty/smarty/libs/plugins/function.html_image.php +++ b/vendor/smarty/smarty/libs/plugins/function.html_image.php @@ -8,20 +8,20 @@ /** * Smarty {html_image} function plugin - * Type: function<br> - * Name: html_image<br> - * Date: Feb 24, 2003<br> - * Purpose: format HTML tags for the image<br> - * Examples: {html_image file="/images/masthead.gif"}<br> - * Output: <img src="/images/masthead.gif" width=400 height=23><br> + * Type: function + * Name: html_image + * Date: Feb 24, 2003 + * Purpose: format HTML tags for the image + * Examples: {html_image file="/images/masthead.gif"} + * Output: <img src="/images/masthead.gif" width=400 height=23> * Params: - * <pre> + * * - file - (required) - file (and path) of image * - height - (optional) - image height (default actual height) * - width - (optional) - image width (default actual width) * - basedir - (optional) - base directory for absolute paths, default is environment variable DOCUMENT_ROOT * - path_prefix - prefix for path output (optional, default empty) - * </pre> + * * * @link http://www.smarty.net/manual/en/language.function.html.image.php {html_image} * (Smarty online manual) @@ -36,11 +36,10 @@ * @return string * @uses smarty_function_escape_special_chars() */ -function smarty_function_html_image($params, $template) +function smarty_function_html_image($params, Smarty_Internal_Template $template) { - if (!is_callable('smarty_function_escape_special_chars')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'); - } + $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); $alt = ''; $file = ''; @@ -66,7 +65,7 @@ function smarty_function_html_image($params, $template) if (!is_array($_val)) { $$_key = smarty_function_escape_special_chars($_val); } else { - throw new SmartyException ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + throw new SmartyException ("html_image: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); } break; @@ -80,19 +79,19 @@ function smarty_function_html_image($params, $template) if (!is_array($_val)) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; } else { - throw new SmartyException ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + throw new SmartyException ("html_image: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); } break; } } if (empty($file)) { - trigger_error("html_image: missing 'file' parameter", E_USER_NOTICE); + trigger_error('html_image: missing \'file\' parameter', E_USER_NOTICE); return; } - if ($file[ 0 ] == '/') { + if ($file[ 0 ] === '/') { $_image_path = $basedir . $file; } else { $_image_path = $file; @@ -126,15 +125,15 @@ function smarty_function_html_image($params, $template) // FIXME: (rodneyrehm) getimagesize() loads the complete file off a remote resource, use custom [jpg,png,gif]header reader! if (!$_image_data = @getimagesize($_image_path)) { if (!file_exists($_image_path)) { - trigger_error("html_image: unable to find '$_image_path'", E_USER_NOTICE); + trigger_error("html_image: unable to find '{$_image_path}'", E_USER_NOTICE); return; } elseif (!is_readable($_image_path)) { - trigger_error("html_image: unable to read '$_image_path'", E_USER_NOTICE); + trigger_error("html_image: unable to read '{$_image_path}'", E_USER_NOTICE); return; } else { - trigger_error("html_image: '$_image_path' is not a valid image file", E_USER_NOTICE); + trigger_error("html_image: '{$_image_path}' is not a valid image file", E_USER_NOTICE); return; } diff --git a/vendor/smarty/smarty/libs/plugins/function.html_options.php b/vendor/smarty/smarty/libs/plugins/function.html_options.php index bc8f36e0b..b8b986493 100644 --- a/vendor/smarty/smarty/libs/plugins/function.html_options.php +++ b/vendor/smarty/smarty/libs/plugins/function.html_options.php @@ -5,15 +5,14 @@ * @package Smarty * @subpackage PluginsFunction */ - /** * Smarty {html_options} function plugin - * Type: function<br> - * Name: html_options<br> + * Type: function + * Name: html_options * Purpose: Prints the list of <option> tags generated from - * the passed parameters<br> + * the passed parameters * Params: - * <pre> + * * - name (optional) - string default "select" * - values (required) - if no options supplied) - array * - options (required) - if no values supplied) - associative array @@ -21,23 +20,25 @@ * - output (required) - if not options supplied) - array * - id (optional) - string default not set * - class (optional) - string default not set - * </pre> + * * * @link http://www.smarty.net/manual/en/language.function.html.options.php {html_image} * (Smarty online manual) * @author Monte Ohrt <monte at ohrt dot com> * @author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de> * - * @param array $params parameters + * @param array $params parameters + * + * @param \Smarty_Internal_Template $template * * @return string * @uses smarty_function_escape_special_chars() + * @throws \SmartyException */ -function smarty_function_html_options($params) +function smarty_function_html_options($params, Smarty_Internal_Template $template) { - if (!is_callable('smarty_function_escape_special_chars')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'); - } + $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); $name = null; $values = null; @@ -71,11 +72,11 @@ function smarty_function_html_options($params) $selected = array(); foreach ($_val as $_sel) { if (is_object($_sel)) { - if (method_exists($_sel, "__toString")) { + if (method_exists($_sel, '__toString')) { $_sel = smarty_function_escape_special_chars((string) $_sel->__toString()); } else { - trigger_error("html_options: selected attribute contains an object of class '" . - get_class($_sel) . "' without __toString() method", E_USER_NOTICE); + trigger_error('html_options: selected attribute contains an object of class \'' . + get_class($_sel) . '\' without __toString() method', E_USER_NOTICE); continue; } } else { @@ -84,11 +85,11 @@ function smarty_function_html_options($params) $selected[ $_sel ] = true; } } elseif (is_object($_val)) { - if (method_exists($_val, "__toString")) { + if (method_exists($_val, '__toString')) { $selected = smarty_function_escape_special_chars((string) $_val->__toString()); } else { - trigger_error("html_options: selected attribute is an object of class '" . get_class($_val) . - "' without __toString() method", E_USER_NOTICE); + trigger_error('html_options: selected attribute is an object of class \'' . get_class($_val) . + '\' without __toString() method', E_USER_NOTICE); } } else { $selected = smarty_function_escape_special_chars((string) $_val); @@ -102,7 +103,7 @@ function smarty_function_html_options($params) case 'readonly': if (!empty($params[ 'strict' ])) { if (!is_scalar($_val)) { - trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", + trigger_error("html_options: {$_key} attribute must be a scalar, only boolean true or string '{$_key}' will actually add the attribute", E_USER_NOTICE); } @@ -118,7 +119,7 @@ function smarty_function_html_options($params) if (!is_array($_val)) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; } else { - trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + trigger_error("html_options: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); } break; } @@ -154,7 +155,16 @@ function smarty_function_html_options($params) return $_html_result; } - +/** + * @param $key + * @param $value + * @param $selected + * @param $id + * @param $class + * @param $idx + * + * @return string + */ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, &$idx) { if (!is_array($value)) { @@ -170,11 +180,11 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c $_html_class = !empty($class) ? ' class="' . $class . ' option"' : ''; $_html_id = !empty($id) ? ' id="' . $id . '-' . $idx . '"' : ''; if (is_object($value)) { - if (method_exists($value, "__toString")) { + if (method_exists($value, '__toString')) { $value = smarty_function_escape_special_chars((string) $value->__toString()); } else { - trigger_error("html_options: value is an object of class '" . get_class($value) . - "' without __toString() method", E_USER_NOTICE); + trigger_error('html_options: value is an object of class \'' . get_class($value) . + '\' without __toString() method', E_USER_NOTICE); return ''; } @@ -193,7 +203,16 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c return $_html_result; } - +/** + * @param $key + * @param $values + * @param $selected + * @param $id + * @param $class + * @param $idx + * + * @return string + */ function smarty_function_html_options_optgroup($key, $values, $selected, $id, $class, &$idx) { $optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n"; diff --git a/vendor/smarty/smarty/libs/plugins/function.html_radios.php b/vendor/smarty/smarty/libs/plugins/function.html_radios.php index 6ef84328a..37feec63e 100644 --- a/vendor/smarty/smarty/libs/plugins/function.html_radios.php +++ b/vendor/smarty/smarty/libs/plugins/function.html_radios.php @@ -5,16 +5,15 @@ * @package Smarty * @subpackage PluginsFunction */ - /** * Smarty {html_radios} function plugin - * File: function.html_radios.php<br> - * Type: function<br> - * Name: html_radios<br> - * Date: 24.Feb.2003<br> - * Purpose: Prints out a list of radio input types<br> + * File: function.html_radios.php + * Type: function + * Name: html_radios + * Date: 24.Feb.2003 + * Purpose: Prints out a list of radio input types * Params: - * <pre> + * * - name (optional) - string default "radio" * - values (required) - array * - options (required) - associative array @@ -23,13 +22,13 @@ * - output (optional) - the output next to each radio button * - assign (optional) - assign the output as an array to this variable * - escape (optional) - escape the content (not value), defaults to true - * </pre> + * * Examples: - * <pre> + * * {html_radios values=$ids output=$names} * {html_radios values=$ids name='box' separator='<br>' output=$names} * {html_radios values=$ids checked=$checked separator='<br>' output=$names} - * </pre> + * * * @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios} * (Smarty online manual) @@ -42,12 +41,12 @@ * * @return string * @uses smarty_function_escape_special_chars() + * @throws \SmartyException */ -function smarty_function_html_radios($params, $template) +function smarty_function_html_radios($params, Smarty_Internal_Template $template) { - if (!is_callable('smarty_function_escape_special_chars')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'); - } + $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); $name = 'radio'; $values = null; @@ -72,11 +71,11 @@ function smarty_function_html_radios($params, $template) if (is_array($_val)) { trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING); } elseif (is_object($_val)) { - if (method_exists($_val, "__toString")) { + if (method_exists($_val, '__toString')) { $selected = smarty_function_escape_special_chars((string) $_val->__toString()); } else { - trigger_error("html_radios: selected attribute is an object of class '" . get_class($_val) . - "' without __toString() method", E_USER_NOTICE); + trigger_error('html_radios: selected attribute is an object of class \'' . get_class($_val) . + '\' without __toString() method', E_USER_NOTICE); } } else { $selected = (string) $_val; @@ -114,7 +113,7 @@ function smarty_function_html_radios($params, $template) case 'readonly': if (!empty($params[ 'strict' ])) { if (!is_scalar($_val)) { - trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", + trigger_error("html_options: {$_key} attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE); } @@ -130,7 +129,7 @@ function smarty_function_html_radios($params, $template) if (!is_array($_val)) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; } else { - trigger_error("html_radios: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + trigger_error("html_radios: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); } break; } @@ -165,18 +164,30 @@ function smarty_function_html_radios($params, $template) return implode("\n", $_html_result); } } - +/** + * @param $name + * @param $value + * @param $output + * @param $selected + * @param $extra + * @param $separator + * @param $labels + * @param $label_ids + * @param $escape + * + * @return string + */ function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, - $escape) + $escape) { $_output = ''; if (is_object($value)) { - if (method_exists($value, "__toString")) { + if (method_exists($value, '__toString')) { $value = (string) $value->__toString(); } else { - trigger_error("html_options: value is an object of class '" . get_class($value) . - "' without __toString() method", E_USER_NOTICE); + trigger_error('html_options: value is an object of class \'' . get_class($value) . + '\' without __toString() method', E_USER_NOTICE); return ''; } @@ -185,11 +196,11 @@ function smarty_function_html_radios_output($name, $value, $output, $selected, $ } if (is_object($output)) { - if (method_exists($output, "__toString")) { + if (method_exists($output, '__toString')) { $output = (string) $output->__toString(); } else { - trigger_error("html_options: output is an object of class '" . get_class($output) . - "' without __toString() method", E_USER_NOTICE); + trigger_error('html_options: output is an object of class \'' . get_class($output) . + '\' without __toString() method', E_USER_NOTICE); return ''; } diff --git a/vendor/smarty/smarty/libs/plugins/function.html_select_date.php b/vendor/smarty/smarty/libs/plugins/function.html_select_date.php index 3a48da0bb..1d63800e1 100644 --- a/vendor/smarty/smarty/libs/plugins/function.html_select_date.php +++ b/vendor/smarty/smarty/libs/plugins/function.html_select_date.php @@ -5,14 +5,13 @@ * @package Smarty * @subpackage PluginsFunction */ - /** * Smarty {html_select_date} plugin - * Type: function<br> - * Name: html_select_date<br> + * Type: function + * Name: html_select_date * Purpose: Prints the dropdowns for date selection. * ChangeLog: - * <pre> + * * - 1.0 initial release * - 1.1 added support for +/- N syntax for begin * and end year values. (Monte) @@ -28,7 +27,7 @@ * of 0000-00-00 dates (cybot, boots) * - 2.0 complete rewrite for performance, * added attributes month_names, *_id - * </pre> + * * * @link http://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date} * (Smarty online manual) @@ -37,18 +36,17 @@ * @author Monte Ohrt <monte at ohrt dot com> * @author Rodney Rehm * - * @param array $params parameters + * @param array $params parameters + * + * @param \Smarty_Internal_Template $template * * @return string + * @throws \SmartyException */ -function smarty_function_html_select_date($params) +function smarty_function_html_select_date($params, Smarty_Internal_Template $template) { - if (!is_callable('smarty_function_escape_special_chars')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'); - } - if (!is_callable('smarty_make_timestamp')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'); - } + $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); // generate timestamps used for month names only static $_month_timestamps = null; static $_current_year = null; @@ -61,18 +59,18 @@ function smarty_function_html_select_date($params) } /* Default values. */ - $prefix = "Date_"; + $prefix = 'Date_'; $start_year = null; $end_year = null; $display_days = true; $display_months = true; $display_years = true; - $month_format = "%B"; + $month_format = '%B'; /* Write months as numbers by default GL */ - $month_value_format = "%m"; - $day_format = "%02d"; + $month_value_format = '%m'; + $day_format = '%02d'; /* Write day values using this format MB */ - $day_value_format = "%d"; + $day_value_format = '%d'; $year_as_text = false; /* Display years in reverse order? Ie. 2000,1999,.... */ $reverse_years = false; @@ -113,15 +111,17 @@ function smarty_function_html_select_date($params) switch ($_key) { case 'time': if (!is_array($_value) && $_value !== null) { + $template->_checkPlugins(array(array('function' => 'smarty_make_timestamp', + 'file' => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'))); $time = smarty_make_timestamp($_value); } break; case 'month_names': - if (is_array($_value) && count($_value) == 12) { + if (is_array($_value) && count($_value) === 12) { $$_key = $_value; } else { - trigger_error("html_select_date: month_names must be an array of 12 strings", E_USER_NOTICE); + trigger_error('html_select_date: month_names must be an array of 12 strings', E_USER_NOTICE); } break; @@ -166,7 +166,7 @@ function smarty_function_html_select_date($params) if (!is_array($_value)) { $extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"'; } else { - trigger_error("html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + trigger_error("html_select_date: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); } break; } @@ -177,7 +177,9 @@ function smarty_function_html_select_date($params) if (isset($params[ 'time' ]) && is_array($params[ 'time' ])) { if (isset($params[ 'time' ][ $prefix . 'Year' ])) { // $_REQUEST[$field_array] given - foreach (array('Y' => 'Year', 'm' => 'Month', 'd' => 'Day') as $_elementKey => $_elementName) { + foreach (array('Y' => 'Year', + 'm' => 'Month', + 'd' => 'Day') as $_elementKey => $_elementName) { $_variableName = '_' . strtolower($_elementName); $$_variableName = isset($params[ 'time' ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $prefix . $_elementName ] : @@ -185,7 +187,9 @@ function smarty_function_html_select_date($params) } } elseif (isset($params[ 'time' ][ $field_array ][ $prefix . 'Year' ])) { // $_REQUEST given - foreach (array('Y' => 'Year', 'm' => 'Month', 'd' => 'Day') as $_elementKey => $_elementName) { + foreach (array('Y' => 'Year', + 'm' => 'Month', + 'd' => 'Day') as $_elementKey => $_elementName) { $_variableName = '_' . strtolower($_elementName); $$_variableName = isset($params[ 'time' ][ $field_array ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $field_array ][ $prefix . $_elementName ] : date($_elementKey); @@ -206,14 +210,15 @@ function smarty_function_html_select_date($params) // make syntax "+N" or "-N" work with $start_year and $end_year // Note preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match) is slower than trim+substr - foreach (array('start', 'end') as $key) { + foreach (array('start', + 'end') as $key) { $key .= '_year'; $t = $$key; if ($t === null) { $$key = (int) $_current_year; - } elseif ($t[ 0 ] == '+') { + } elseif ($t[ 0 ] === '+') { $$key = (int) ($_current_year + (int) trim(substr($t, 1))); - } elseif ($t[ 0 ] == '-') { + } elseif ($t[ 0 ] === '-') { $$key = (int) ($_current_year - (int) trim(substr($t, 1))); } else { $$key = (int) $$key; @@ -301,8 +306,8 @@ function smarty_function_html_select_date($params) for ($i = 1; $i <= 12; $i ++) { $_val = sprintf('%02d', $i); $_text = isset($month_names) ? smarty_function_escape_special_chars($month_names[ $i ]) : - ($month_format == "%m" ? $_val : strftime($month_format, $_month_timestamps[ $i ])); - $_value = $month_value_format == "%m" ? $_val : strftime($month_value_format, $_month_timestamps[ $i ]); + ($month_format === '%m' ? $_val : strftime($month_format, $_month_timestamps[ $i ])); + $_value = $month_value_format === '%m' ? $_val : strftime($month_value_format, $_month_timestamps[ $i ]); $_html_months .= '<option value="' . $_value . '"' . ($_val == $_month ? ' selected="selected"' : '') . '>' . $_text . '</option>' . $option_separator; } @@ -339,8 +344,8 @@ function smarty_function_html_select_date($params) for ($i = 1; $i <= 31; $i ++) { $_val = sprintf('%02d', $i); - $_text = $day_format == '%02d' ? $_val : sprintf($day_format, $i); - $_value = $day_value_format == '%02d' ? $_val : sprintf($day_value_format, $i); + $_text = $day_format === '%02d' ? $_val : sprintf($day_format, $i); + $_value = $day_value_format === '%02d' ? $_val : sprintf($day_value_format, $i); $_html_days .= '<option value="' . $_value . '"' . ($_val == $_day ? ' selected="selected"' : '') . '>' . $_text . '</option>' . $option_separator; } diff --git a/vendor/smarty/smarty/libs/plugins/function.html_select_time.php b/vendor/smarty/smarty/libs/plugins/function.html_select_time.php index 89f0406f6..f7c3816e3 100644 --- a/vendor/smarty/smarty/libs/plugins/function.html_select_time.php +++ b/vendor/smarty/smarty/libs/plugins/function.html_select_time.php @@ -5,11 +5,10 @@ * @package Smarty * @subpackage PluginsFunction */ - /** * Smarty {html_select_time} function plugin - * Type: function<br> - * Name: html_select_time<br> + * Type: function + * Name: html_select_time * Purpose: Prints the dropdowns for time selection * * @link http://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time} @@ -17,20 +16,19 @@ * @author Roberto Berto <roberto@berto.net> * @author Monte Ohrt <monte AT ohrt DOT com> * - * @param array $params parameters + * @param array $params parameters + * + * @param \Smarty_Internal_Template $template * * @return string * @uses smarty_make_timestamp() + * @throws \SmartyException */ -function smarty_function_html_select_time($params) +function smarty_function_html_select_time($params, Smarty_Internal_Template $template) { - if (!is_callable('smarty_function_escape_special_chars')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'); - } - if (!is_callable('smarty_make_timestamp')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'); - } - $prefix = "Time_"; + $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); + $prefix = 'Time_'; $field_array = null; $field_separator = "\n"; $option_separator = "\n"; @@ -80,6 +78,8 @@ function smarty_function_html_select_time($params) switch ($_key) { case 'time': if (!is_array($_value) && $_value !== null) { + $template->_checkPlugins(array(array('function' => 'smarty_make_timestamp', + 'file' => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'))); $time = smarty_make_timestamp($_value); } break; @@ -139,7 +139,7 @@ function smarty_function_html_select_time($params) if (!is_array($_value)) { $extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"'; } else { - trigger_error("html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + trigger_error("html_select_date: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); } break; } @@ -148,7 +148,9 @@ function smarty_function_html_select_time($params) if (isset($params[ 'time' ]) && is_array($params[ 'time' ])) { if (isset($params[ 'time' ][ $prefix . 'Hour' ])) { // $_REQUEST[$field_array] given - foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) { + foreach (array('H' => 'Hour', + 'i' => 'Minute', + 's' => 'Second') as $_elementKey => $_elementName) { $_variableName = '_' . strtolower($_elementName); $$_variableName = isset($params[ 'time' ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $prefix . $_elementName ] : @@ -161,7 +163,9 @@ function smarty_function_html_select_time($params) list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time)); } elseif (isset($params[ 'time' ][ $field_array ][ $prefix . 'Hour' ])) { // $_REQUEST given - foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) { + foreach (array('H' => 'Hour', + 'i' => 'Minute', + 's' => 'Second') as $_elementKey => $_elementName) { $_variableName = '_' . strtolower($_elementName); $$_variableName = isset($params[ 'time' ][ $field_array ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $field_array ][ $prefix . $_elementName ] : date($_elementKey); @@ -216,8 +220,8 @@ function smarty_function_html_select_time($params) $end = $use_24_hours ? 23 : 12; for ($i = $start; $i <= $end; $i ++) { $_val = sprintf('%02d', $i); - $_text = $hour_format == '%02d' ? $_val : sprintf($hour_format, $i); - $_value = $hour_value_format == '%02d' ? $_val : sprintf($hour_value_format, $i); + $_text = $hour_format === '%02d' ? $_val : sprintf($hour_format, $i); + $_value = $hour_value_format === '%02d' ? $_val : sprintf($hour_value_format, $i); if (!$use_24_hours) { $_hour12 = $_hour == 0 ? 12 : ($_hour <= 12 ? $_hour : $_hour - 12); @@ -263,8 +267,8 @@ function smarty_function_html_select_time($params) $selected = $_minute !== null ? ($_minute - $_minute % $minute_interval) : null; for ($i = 0; $i <= 59; $i += $minute_interval) { $_val = sprintf('%02d', $i); - $_text = $minute_format == '%02d' ? $_val : sprintf($minute_format, $i); - $_value = $minute_value_format == '%02d' ? $_val : sprintf($minute_value_format, $i); + $_text = $minute_format === '%02d' ? $_val : sprintf($minute_format, $i); + $_value = $minute_value_format === '%02d' ? $_val : sprintf($minute_value_format, $i); $_html_minutes .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') . '>' . $_text . '</option>' . $option_separator; } @@ -304,8 +308,8 @@ function smarty_function_html_select_time($params) $selected = $_second !== null ? ($_second - $_second % $second_interval) : null; for ($i = 0; $i <= 59; $i += $second_interval) { $_val = sprintf('%02d', $i); - $_text = $second_format == '%02d' ? $_val : sprintf($second_format, $i); - $_value = $second_value_format == '%02d' ? $_val : sprintf($second_value_format, $i); + $_text = $second_format === '%02d' ? $_val : sprintf($second_format, $i); + $_value = $second_value_format === '%02d' ? $_val : sprintf($second_value_format, $i); $_html_seconds .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') . '>' . $_text . '</option>' . $option_separator; } @@ -350,7 +354,10 @@ function smarty_function_html_select_time($params) } $_html = ''; - foreach (array('_html_hours', '_html_minutes', '_html_seconds', '_html_meridian') as $k) { + foreach (array('_html_hours', + '_html_minutes', + '_html_seconds', + '_html_meridian') as $k) { if (isset($$k)) { if ($_html) { $_html .= $field_separator; diff --git a/vendor/smarty/smarty/libs/plugins/function.html_table.php b/vendor/smarty/smarty/libs/plugins/function.html_table.php index 42e23e722..d9a9fd691 100644 --- a/vendor/smarty/smarty/libs/plugins/function.html_table.php +++ b/vendor/smarty/smarty/libs/plugins/function.html_table.php @@ -8,12 +8,12 @@ /** * Smarty {html_table} function plugin - * Type: function<br> - * Name: html_table<br> - * Date: Feb 17, 2003<br> - * Purpose: make an html table from an array of data<br> + * Type: function + * Name: html_table + * Date: Feb 17, 2003 + * Purpose: make an html table from an array of data * Params: - * <pre> + * * - loop - array to loop through * - cols - number of columns, comma separated list of column names * or array of column names @@ -28,13 +28,13 @@ * - hdir - horizontal direction (default: "right", means left-to-right) * - inner - inner loop (default "cols": print $loop line by line, * $loop will be printed column by column otherwise) - * </pre> + * * Examples: - * <pre> + * * {table loop=$data} * {table loop=$data cols=4 tr_attr='"bgcolor=red"'} * {table loop=$data cols="first,second,third" tr_attr=$colors} - * </pre> + * * * @author Monte Ohrt <monte at ohrt dot com> * @author credit to Messju Mohr <messju at lammfellpuschen dot de> @@ -127,7 +127,7 @@ function smarty_function_html_table($params) } if (is_array($cols)) { - $cols = ($hdir == 'right') ? $cols : array_reverse($cols); + $cols = ($hdir === 'right') ? $cols : array_reverse($cols); $output .= "<thead><tr>\n"; for ($r = 0; $r < $cols_count; $r ++) { @@ -141,11 +141,11 @@ function smarty_function_html_table($params) $output .= "<tbody>\n"; for ($r = 0; $r < $rows; $r ++) { $output .= "<tr" . smarty_function_html_table_cycle('tr', $tr_attr, $r) . ">\n"; - $rx = ($vdir == 'down') ? $r * $cols_count : ($rows - 1 - $r) * $cols_count; + $rx = ($vdir === 'down') ? $r * $cols_count : ($rows - 1 - $r) * $cols_count; for ($c = 0; $c < $cols_count; $c ++) { - $x = ($hdir == 'right') ? $rx + $c : $rx + $cols_count - 1 - $c; - if ($inner != 'cols') { + $x = ($hdir === 'right') ? $rx + $c : $rx + $cols_count - 1 - $c; + if ($inner !== 'cols') { /* shuffle x to loop over rows*/ $x = floor($x / $cols_count) + ($x % $cols_count) * $rows; } @@ -163,7 +163,13 @@ function smarty_function_html_table($params) return $output; } - +/** + * @param $name + * @param $var + * @param $no + * + * @return string + */ function smarty_function_html_table_cycle($name, $var, $no) { if (!is_array($var)) { diff --git a/vendor/smarty/smarty/libs/plugins/function.mailto.php b/vendor/smarty/smarty/libs/plugins/function.mailto.php index 9d2a5d2d5..0d817535a 100644 --- a/vendor/smarty/smarty/libs/plugins/function.mailto.php +++ b/vendor/smarty/smarty/libs/plugins/function.mailto.php @@ -8,35 +8,35 @@ /** * Smarty {mailto} function plugin - * Type: function<br> - * Name: mailto<br> + * Type: function + * Name: mailto * Date: May 21, 2002 - * Purpose: automate mailto address link creation, and optionally encode them.<br> + * Purpose: automate mailto address link creation, and optionally encode them. * Params: - * <pre> + * * - address - (required) - e-mail address * - text - (optional) - text to display, default is address * - encode - (optional) - can be one of: * * none : no encoding (default) * * javascript : encode with javascript * * javascript_charcode : encode with javascript charcode - * * hex : encode with hexidecimal (no javascript) + * * hex : encode with hexadecimal (no javascript) * - cc - (optional) - address(es) to carbon copy * - bcc - (optional) - address(es) to blind carbon copy * - subject - (optional) - e-mail subject * - newsgroups - (optional) - newsgroup(s) to post to * - followupto - (optional) - address(es) to follow up to * - extra - (optional) - extra tags for the href link - * </pre> + * * Examples: - * <pre> + * * {mailto address="me@domain.com"} * {mailto address="me@domain.com" encode="javascript"} * {mailto address="me@domain.com" encode="hex"} * {mailto address="me@domain.com" subject="Hello to you!"} * {mailto address="me@domain.com" cc="you@domain.com,they@domain.com"} * {mailto address="me@domain.com" extra='class="mailto"'} - * </pre> + * * * @link http://www.smarty.net/manual/en/language.function.mailto.php {mailto} * (Smarty online manual) @@ -103,7 +103,7 @@ function smarty_function_mailto($params) return; } // FIXME: (rodneyrehm) document.write() excues me what? 1998 has passed! - if ($encode == 'javascript') { + if ($encode === 'javascript') { $string = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');'; $js_encode = ''; @@ -112,7 +112,7 @@ function smarty_function_mailto($params) } return '<script type="text/javascript">eval(unescape(\'' . $js_encode . '\'))</script>'; - } elseif ($encode == 'javascript_charcode') { + } elseif ($encode === 'javascript_charcode') { $string = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>'; for ($x = 0, $y = strlen($string); $x < $y; $x ++) { @@ -123,7 +123,7 @@ function smarty_function_mailto($params) implode(',', $ord) . "))" . "}\n" . "</script>\n"; return $_ret; - } elseif ($encode == 'hex') { + } elseif ($encode === 'hex') { preg_match('!^(.*)(\?.*)$!', $address, $match); if (!empty($match[ 2 ])) { trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.", E_USER_WARNING); diff --git a/vendor/smarty/smarty/libs/plugins/function.math.php b/vendor/smarty/smarty/libs/plugins/function.math.php index fc5db335c..396ad085e 100644 --- a/vendor/smarty/smarty/libs/plugins/function.math.php +++ b/vendor/smarty/smarty/libs/plugins/function.math.php @@ -9,8 +9,8 @@ /** * Smarty {math} function plugin - * Type: function<br> - * Name: math<br> + * Type: function + * Name: math * Purpose: handle math computations in template * * @link http://www.smarty.net/manual/en/language.function.math.php {math} @@ -38,7 +38,7 @@ function smarty_function_math($params, $template) $equation = $params[ 'equation' ]; // make sure parenthesis are balanced - if (substr_count($equation, "(") != substr_count($equation, ")")) { + if (substr_count($equation, '(') !== substr_count($equation, ')')) { trigger_error("math: unbalanced parenthesis", E_USER_WARNING); return; @@ -59,9 +59,9 @@ function smarty_function_math($params, $template) } foreach ($params as $key => $val) { - if ($key != "equation" && $key != "format" && $key != "assign") { + if ($key !== 'equation' && $key !== 'format' && $key !== 'assign') { // make sure value is not empty - if (strlen($val) == 0) { + if (strlen($val) === 0) { trigger_error("math: parameter '{$key}' is empty", E_USER_WARNING); return; @@ -86,7 +86,7 @@ function smarty_function_math($params, $template) } foreach ($params as $key => $val) { - if ($key != "equation" && $key != "format" && $key != "assign") { + if ($key !== 'equation' && $key !== 'format' && $key !== 'assign') { $equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation); } } diff --git a/vendor/smarty/smarty/libs/plugins/modifier.capitalize.php b/vendor/smarty/smarty/libs/plugins/modifier.capitalize.php index 6513a0495..e354977b0 100644 --- a/vendor/smarty/smarty/libs/plugins/modifier.capitalize.php +++ b/vendor/smarty/smarty/libs/plugins/modifier.capitalize.php @@ -8,8 +8,8 @@ /** * Smarty capitalize modifier plugin - * Type: modifier<br> - * Name: capitalize<br> + * Type: modifier + * Name: capitalize * Purpose: capitalize words in the string * {@internal {$string|capitalize:true:true} is the fastest option for MBString enabled systems }} * @@ -72,7 +72,7 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals return $upper_string; } -/* +/* * * Bug: create_function() use exhausts memory when used in long loops * Fix: use declared functions for callbacks instead of using create_function() @@ -80,21 +80,38 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals * * @author Kyle Renfrow */ +/** + * @param $matches + * + * @return string + */ function smarty_mod_cap_mbconvert_cb($matches) { return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 2 ]), MB_CASE_UPPER, Smarty::$_CHARSET); } - +/** + * @param $matches + * + * @return string + */ function smarty_mod_cap_mbconvert2_cb($matches) { return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 3 ]), MB_CASE_UPPER, Smarty::$_CHARSET); } - +/** + * @param $matches + * + * @return string + */ function smarty_mod_cap_ucfirst_cb($matches) { return stripslashes($matches[ 1 ]) . ucfirst(stripslashes($matches[ 2 ])); } - +/** + * @param $matches + * + * @return string + */ function smarty_mod_cap_ucfirst2_cb($matches) { return stripslashes($matches[ 1 ]) . ucfirst(stripslashes($matches[ 3 ])); diff --git a/vendor/smarty/smarty/libs/plugins/modifier.date_format.php b/vendor/smarty/smarty/libs/plugins/modifier.date_format.php index bfe363c08..b45b2d4b8 100644 --- a/vendor/smarty/smarty/libs/plugins/modifier.date_format.php +++ b/vendor/smarty/smarty/libs/plugins/modifier.date_format.php @@ -8,10 +8,10 @@ /** * Smarty date_format modifier plugin - * Type: modifier<br> - * Name: date_format<br> - * Purpose: format datestamps via strftime<br> - * Input:<br> + * Type: modifier + * Name: date_format + * Purpose: format datestamps via strftime + * Input: * - string: input date string * - format: strftime format for output * - default_date: default date if $string is empty @@ -35,20 +35,36 @@ function smarty_modifier_date_format($string, $format = null, $default_date = '' /** * require_once the {@link shared.make_timestamp.php} plugin */ - if (!is_callable('smarty_make_timestamp')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'); + static $is_loaded = false; + if (!$is_loaded) { + if (!is_callable('smarty_make_timestamp')) { + require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'); + } + $is_loaded = true; } - if ($string != '' && $string != '0000-00-00' && $string != '0000-00-00 00:00:00') { + if ($string !== '' && $string !== '0000-00-00' && $string !== '0000-00-00 00:00:00') { $timestamp = smarty_make_timestamp($string); - } elseif ($default_date != '') { + } elseif ($default_date !== '') { $timestamp = smarty_make_timestamp($default_date); } else { return; } - if ($formatter == 'strftime' || ($formatter == 'auto' && strpos($format, '%') !== false)) { + if ($formatter === 'strftime' || ($formatter === 'auto' && strpos($format, '%') !== false)) { if (Smarty::$_IS_WINDOWS) { - $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T'); - $_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S'); + $_win_from = array('%D', + '%h', + '%n', + '%r', + '%R', + '%t', + '%T'); + $_win_to = array('%m/%d/%y', + '%b', + "\n", + '%I:%M:%S %p', + '%H:%M', + "\t", + '%H:%M:%S'); if (strpos($format, '%e') !== false) { $_win_from[] = '%e'; $_win_to[] = sprintf('%\' 2d', date('j', $timestamp)); diff --git a/vendor/smarty/smarty/libs/plugins/modifier.debug_print_var.php b/vendor/smarty/smarty/libs/plugins/modifier.debug_print_var.php index 34f85dcd5..2bd112154 100644 --- a/vendor/smarty/smarty/libs/plugins/modifier.debug_print_var.php +++ b/vendor/smarty/smarty/libs/plugins/modifier.debug_print_var.php @@ -8,8 +8,8 @@ /** * Smarty debug_print_var modifier plugin - * Type: modifier<br> - * Name: debug_print_var<br> + * Type: modifier + * Name: debug_print_var * Purpose: formats variable contents for display in the console * * @author Monte Ohrt <monte at ohrt dot com> @@ -28,7 +28,7 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = switch (gettype($var)) { case 'array' : $results = '<b>Array (' . count($var) . ')</b>'; - if ($depth == $max) { + if ($depth === $max) { break; } foreach ($var as $curr_key => $curr_val) { @@ -46,7 +46,7 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = $results .= ' called recursive'; break; } - if ($depth == $max) { + if ($depth === $max) { break; } $objects[] = $var; diff --git a/vendor/smarty/smarty/libs/plugins/modifier.escape.php b/vendor/smarty/smarty/libs/plugins/modifier.escape.php index 9c247b933..1ae87a7aa 100644 --- a/vendor/smarty/smarty/libs/plugins/modifier.escape.php +++ b/vendor/smarty/smarty/libs/plugins/modifier.escape.php @@ -8,8 +8,8 @@ /** * Smarty escape modifier plugin - * Type: modifier<br> - * Name: escape<br> + * Type: modifier + * Name: escape * Purpose: escape string for output * * @link http://www.smarty.net/docs/en/language.modifier.escape @@ -25,6 +25,8 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $double_encode = true) { static $_double_encode = null; + static $is_loaded_1 = false; + static $is_loaded_2 = false; if ($_double_encode === null) { $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>='); } @@ -46,7 +48,9 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ // php <5.2.3 - prevent double encoding $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); $string = htmlspecialchars($string, ENT_QUOTES, $char_set); - $string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string); + $string = str_replace(array('%%%SMARTY_START%%%', + '%%%SMARTY_END%%%'), array('&', + ';'), $string); return $string; } @@ -67,7 +71,9 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); $string = htmlspecialchars($string, ENT_QUOTES, $char_set); $string = - str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string); + str_replace(array('%%%SMARTY_START%%%', + '%%%SMARTY_END%%%'), array('&', + ';'), $string); return $string; } @@ -86,7 +92,9 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ } else { $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); $string = htmlentities($string, ENT_QUOTES, $char_set); - $string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string); + $string = str_replace(array('%%%SMARTY_START%%%', + '%%%SMARTY_END%%%'), array('&', + ';'), $string); return $string; } @@ -116,8 +124,11 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ case 'hexentity': $return = ''; if (Smarty::$_MBSTRING) { - if (!is_callable('smarty_mb_to_unicode')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'); + if (!$is_loaded_1) { + if (!is_callable('smarty_mb_to_unicode')) { + require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'); + } + $is_loaded_1 = true; } $return = ''; foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) { @@ -137,8 +148,11 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ case 'decentity': $return = ''; if (Smarty::$_MBSTRING) { - if (!is_callable('smarty_mb_to_unicode')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'); + if (!$is_loaded_1) { + if (!is_callable('smarty_mb_to_unicode')) { + require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'); + } + $is_loaded_1 = true; } $return = ''; foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) { @@ -157,25 +171,39 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ case 'javascript': // escape quotes and backslashes, newlines, etc. - return strtr($string, array('\\' => '\\\\', "'" => "\\'", '"' => '\\"', "\r" => '\\r', "\n" => '\\n', + return strtr($string, array('\\' => '\\\\', + "'" => "\\'", + '"' => '\\"', + "\r" => '\\r', + "\n" => '\\n', '</' => '<\/')); case 'mail': if (Smarty::$_MBSTRING) { - if (!is_callable('smarty_mb_str_replace')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'); + if (!$is_loaded_2) { + if (!is_callable('smarty_mb_str_replace')) { + require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'); + } + $is_loaded_2 = true; } - return smarty_mb_str_replace(array('@', '.'), array(' [AT] ', ' [DOT] '), $string); + return smarty_mb_str_replace(array('@', + '.'), array(' [AT] ', + ' [DOT] '), $string); } // no MBString fallback - return str_replace(array('@', '.'), array(' [AT] ', ' [DOT] '), $string); + return str_replace(array('@', + '.'), array(' [AT] ', + ' [DOT] '), $string); case 'nonstd': // escape non-standard chars, such as ms document quotes $return = ''; if (Smarty::$_MBSTRING) { - if (!is_callable('smarty_mb_to_unicode')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'); + if (!$is_loaded_1) { + if (!is_callable('smarty_mb_to_unicode')) { + require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'); + } + $is_loaded_1 = true; } foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) { if ($unicode >= 126) { diff --git a/vendor/smarty/smarty/libs/plugins/modifier.mb_wordwrap.php b/vendor/smarty/smarty/libs/plugins/modifier.mb_wordwrap.php new file mode 100644 index 000000000..93c6241ec --- /dev/null +++ b/vendor/smarty/smarty/libs/plugins/modifier.mb_wordwrap.php @@ -0,0 +1,75 @@ +<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifier + */ +/** + * Smarty wordwrap modifier plugin + * Type: modifier + * Name: mb_wordwrap + * Purpose: Wrap a string to a given number of characters + * + + * @link http://php.net/manual/en/function.wordwrap.php for similarity + * + * @param string $str the string to wrap + * @param int $width the width of the output + * @param string $break the character used to break the line + * @param boolean $cut ignored parameter, just for the sake of + * + * @return string wrapped string + * @author Rodney Rehm + */ +function smarty_modifier_mb_wordwrap($str, $width = 75, $break = "\n", $cut = false) +{ + // break words into tokens using white space as a delimiter + $tokens = preg_split('!(\s)!S' . Smarty::$_UTF8_MODIFIER, $str, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE); + $length = 0; + $t = ''; + $_previous = false; + $_space = false; + + foreach ($tokens as $_token) { + $token_length = mb_strlen($_token, Smarty::$_CHARSET); + $_tokens = array($_token); + if ($token_length > $width) { + if ($cut) { + $_tokens = preg_split('!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER, + $_token, + -1, + PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE); + } + } + + foreach ($_tokens as $token) { + $_space = !!preg_match('!^\s$!S' . Smarty::$_UTF8_MODIFIER, $token); + $token_length = mb_strlen($token, Smarty::$_CHARSET); + $length += $token_length; + + if ($length > $width) { + // remove space before inserted break + if ($_previous) { + $t = mb_substr($t, 0, -1, Smarty::$_CHARSET); + } + + if (!$_space) { + // add the break before the token + if (!empty($t)) { + $t .= $break; + } + $length = $token_length; + } + } else if ($token === "\n") { + // hard break must reset counters + $length = 0; + } + $_previous = $_space; + // add the token + $t .= $token; + } + } + + return $t; +} diff --git a/vendor/smarty/smarty/libs/plugins/modifier.regex_replace.php b/vendor/smarty/smarty/libs/plugins/modifier.regex_replace.php index 85f41fdda..479aba875 100644 --- a/vendor/smarty/smarty/libs/plugins/modifier.regex_replace.php +++ b/vendor/smarty/smarty/libs/plugins/modifier.regex_replace.php @@ -8,8 +8,8 @@ /** * Smarty regex_replace modifier plugin - * Type: modifier<br> - * Name: regex_replace<br> + * Type: modifier + * Name: regex_replace * Purpose: regular expression search/replace * * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php diff --git a/vendor/smarty/smarty/libs/plugins/modifier.replace.php b/vendor/smarty/smarty/libs/plugins/modifier.replace.php index 9dca259d5..a1b043b64 100644 --- a/vendor/smarty/smarty/libs/plugins/modifier.replace.php +++ b/vendor/smarty/smarty/libs/plugins/modifier.replace.php @@ -8,8 +8,8 @@ /** * Smarty replace modifier plugin - * Type: modifier<br> - * Name: replace<br> + * Type: modifier + * Name: replace * Purpose: simple search/replace * * @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual) @@ -24,11 +24,15 @@ */ function smarty_modifier_replace($string, $search, $replace) { + static $is_loaded = false; if (Smarty::$_MBSTRING) { - if (!is_callable('smarty_mb_str_replace')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'); + if (!$is_loaded) { + if (!is_callable('smarty_mb_str_replace')) { + require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'); + } + $is_loaded = true; } - return smarty_mb_str_replace($search, $replace, $string); + return smarty_mb_str_replace($search, $replace, $string); } return str_replace($search, $replace, $string); diff --git a/vendor/smarty/smarty/libs/plugins/modifier.spacify.php b/vendor/smarty/smarty/libs/plugins/modifier.spacify.php index e5c41ad8b..1e29fd553 100644 --- a/vendor/smarty/smarty/libs/plugins/modifier.spacify.php +++ b/vendor/smarty/smarty/libs/plugins/modifier.spacify.php @@ -8,8 +8,8 @@ /** * Smarty spacify modifier plugin - * Type: modifier<br> - * Name: spacify<br> + * Type: modifier + * Name: spacify * Purpose: add spaces between characters in a string * * @link http://smarty.php.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual) diff --git a/vendor/smarty/smarty/libs/plugins/modifier.truncate.php b/vendor/smarty/smarty/libs/plugins/modifier.truncate.php index 6fe844259..bb9df92d7 100644 --- a/vendor/smarty/smarty/libs/plugins/modifier.truncate.php +++ b/vendor/smarty/smarty/libs/plugins/modifier.truncate.php @@ -8,8 +8,8 @@ /** * Smarty truncate modifier plugin - * Type: modifier<br> - * Name: truncate<br> + * Type: modifier + * Name: truncate * Purpose: Truncate a string to a certain length if necessary, * optionally splitting in the middle of a word, and * appending the $etc string or inserting $etc into the middle. @@ -27,7 +27,7 @@ */ function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false) { - if ($length == 0) { + if ($length === 0) { return ''; } diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.cat.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.cat.php index db9d81fbf..919b03c39 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.cat.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.cat.php @@ -8,11 +8,11 @@ /** * Smarty cat modifier plugin - * Type: modifier<br> - * Name: cat<br> - * Date: Feb 24, 2003<br> - * Purpose: catenate a value to a variable<br> - * Input: string to catenate<br> + * Type: modifier + * Name: cat + * Date: Feb 24, 2003 + * Purpose: catenate a value to a variable + * Input: string to catenate * Example: {$var|cat:"foo"} * * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_characters.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_characters.php index 0a3ce257b..8116aa327 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_characters.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_characters.php @@ -8,8 +8,8 @@ /** * Smarty count_characters modifier plugin - * Type: modifier<br> - * Name: count_characteres<br> + * Type: modifier + * Name: count_characters * Purpose: count the number of characters in a text * * @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual) @@ -21,7 +21,7 @@ */ function smarty_modifiercompiler_count_characters($params) { - if (!isset($params[ 1 ]) || $params[ 1 ] != 'true') { + if (!isset($params[ 1 ]) || $params[ 1 ] !== 'true') { return 'preg_match_all(\'/[^\s]/' . Smarty::$_UTF8_MODIFIER . '\',' . $params[ 0 ] . ', $tmp)'; } if (Smarty::$_MBSTRING) { diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_paragraphs.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_paragraphs.php index f7f447763..1917d290a 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_paragraphs.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_paragraphs.php @@ -8,8 +8,8 @@ /** * Smarty count_paragraphs modifier plugin - * Type: modifier<br> - * Name: count_paragraphs<br> + * Type: modifier + * Name: count_paragraphs * Purpose: count the number of paragraphs in a text * * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_sentences.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_sentences.php index 20032925e..a782d8e0b 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_sentences.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_sentences.php @@ -8,7 +8,7 @@ /** * Smarty count_sentences modifier plugin - * Type: modifier<br> + * Type: modifier * Name: count_sentences * Purpose: count the number of sentences in a text * diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_words.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_words.php index f20a197cd..dc8500c75 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_words.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_words.php @@ -8,8 +8,8 @@ /** * Smarty count_words modifier plugin - * Type: modifier<br> - * Name: count_words<br> + * Type: modifier + * Name: count_words * Purpose: count the number of words in a text * * @link http://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual) diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.default.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.default.php index 2c4c00a37..9fe5d4da2 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.default.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.default.php @@ -8,8 +8,8 @@ /** * Smarty default modifier plugin - * Type: modifier<br> - * Name: default<br> + * Type: modifier + * Name: default * Purpose: designate default value for empty variables * * @link http://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual) diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.escape.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.escape.php index 11565c2d9..6a6e01637 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.escape.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.escape.php @@ -5,27 +5,27 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty escape modifier plugin - * Type: modifier<br> - * Name: escape<br> + * Type: modifier + * Name: escape * Purpose: escape string for output * * @link http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual) * @author Rodney Rehm * - * @param array $params parameters - * @param $compiler + * @param array $params parameters + * @param Smarty_Internal_TemplateCompilerBase $compiler * * @return string with compiled code + * @throws \SmartyException */ -function smarty_modifiercompiler_escape($params, $compiler) +function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompilerBase $compiler) { static $_double_encode = null; - if (!is_callable('smarty_literal_compiler_param')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.literal_compiler_param.php'); - } + static $is_loaded = false; + $compiler->template->_checkPlugins(array(array('function' => 'smarty_literal_compiler_param', + 'file' => SMARTY_PLUGINS_DIR . 'shared.literal_compiler_param.php'))); if ($_double_encode === null) { $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>='); } @@ -100,14 +100,14 @@ function smarty_modifiercompiler_escape($params, $compiler) // could not optimize |escape call, so fallback to regular plugin if ($compiler->template->caching && ($compiler->tag_nocache | $compiler->nocache)) { - $compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ 'escape' ][ 'modifier' ][ 'file' ] = + $compiler->required_plugins[ 'nocache' ][ 'escape' ][ 'modifier' ][ 'file' ] = SMARTY_PLUGINS_DIR . 'modifier.escape.php'; - $compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ 'escape' ][ 'modifier' ][ 'function' ] = + $compiler->required_plugins[ 'nocache' ][ 'escape' ][ 'modifier' ][ 'function' ] = 'smarty_modifier_escape'; } else { - $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ 'escape' ][ 'modifier' ][ 'file' ] = + $compiler->required_plugins[ 'compiled' ][ 'escape' ][ 'modifier' ][ 'file' ] = SMARTY_PLUGINS_DIR . 'modifier.escape.php'; - $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ 'escape' ][ 'modifier' ][ 'function' ] = + $compiler->required_plugins[ 'compiled' ][ 'escape' ][ 'modifier' ][ 'function' ] = 'smarty_modifier_escape'; } diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.from_charset.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.from_charset.php index e25a95749..b5732db42 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.from_charset.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.from_charset.php @@ -8,8 +8,8 @@ /** * Smarty from_charset modifier plugin - * Type: modifier<br> - * Name: from_charset<br> + * Type: modifier + * Name: from_charset * Purpose: convert character encoding from $charset to internal encoding * * @author Rodney Rehm diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.indent.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.indent.php index 851f18448..fede8aa74 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.indent.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.indent.php @@ -8,8 +8,8 @@ /** * Smarty indent modifier plugin - * Type: modifier<br> - * Name: indent<br> + * Type: modifier + * Name: indent * Purpose: indent lines of text * * @link http://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual) diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.lower.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.lower.php index a335eff7f..8c6c26a89 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.lower.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.lower.php @@ -8,8 +8,8 @@ /** * Smarty lower modifier plugin - * Type: modifier<br> - * Name: lower<br> + * Type: modifier + * Name: lower * Purpose: convert string to lowercase * * @link http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual) diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.noprint.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.noprint.php index 4906908b4..455cfe14b 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.noprint.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.noprint.php @@ -8,8 +8,8 @@ /** * Smarty noprint modifier plugin - * Type: modifier<br> - * Name: noprint<br> + * Type: modifier + * Name: noprint * Purpose: return an empty string * * @author Uwe Tews diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.string_format.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.string_format.php index bcf9883db..8d3bfa4e2 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.string_format.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.string_format.php @@ -8,8 +8,8 @@ /** * Smarty string_format modifier plugin - * Type: modifier<br> - * Name: string_format<br> + * Type: modifier + * Name: string_format * Purpose: format strings via sprintf * * @link http://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual) diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip.php index 8173eed8f..3b7ade5ed 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip.php @@ -8,11 +8,11 @@ /** * Smarty strip modifier plugin - * Type: modifier<br> - * Name: strip<br> + * Type: modifier + * Name: strip * Purpose: Replace all repeated spaces, newlines, tabs - * with a single space or supplied replacement string.<br> - * Example: {$var|strip} {$var|strip:" "}<br> + * with a single space or supplied replacement string. + * Example: {$var|strip} {$var|strip:" "} * Date: September 25th, 2002 * * @link http://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual) diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip_tags.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip_tags.php index e56bf9315..5ddca7a94 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip_tags.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip_tags.php @@ -8,8 +8,8 @@ /** * Smarty strip_tags modifier plugin - * Type: modifier<br> - * Name: strip_tags<br> + * Type: modifier + * Name: strip_tags * Purpose: strip html tags from text * * @link http://www.smarty.net/docs/en/language.modifier.strip.tags.tpl strip_tags (Smarty online manual) @@ -21,7 +21,7 @@ */ function smarty_modifiercompiler_strip_tags($params) { - if (!isset($params[ 1 ]) || $params[ 1 ] === true || trim($params[ 1 ], '"') == 'true') { + if (!isset($params[ 1 ]) || $params[ 1 ] === true || trim($params[ 1 ], '"') === 'true') { return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})"; } else { return 'strip_tags(' . $params[ 0 ] . ')'; diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.to_charset.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.to_charset.php index fea8d8273..889005712 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.to_charset.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.to_charset.php @@ -8,8 +8,8 @@ /** * Smarty to_charset modifier plugin - * Type: modifier<br> - * Name: to_charset<br> + * Type: modifier + * Name: to_charset * Purpose: convert character encoding from internal encoding to $charset * * @author Rodney Rehm diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.unescape.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.unescape.php index a3409bc73..5a94e0727 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.unescape.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.unescape.php @@ -8,8 +8,8 @@ /** * Smarty unescape modifier plugin - * Type: modifier<br> - * Name: unescape<br> + * Type: modifier + * Name: unescape * Purpose: unescape html entities * * @author Rodney Rehm @@ -26,7 +26,7 @@ function smarty_modifiercompiler_unescape($params) if (!isset($params[ 2 ])) { $params[ 2 ] = '\'' . addslashes(Smarty::$_CHARSET) . '\''; } else { - $params[ 2 ] = "'" . $params[ 2 ] . "'"; + $params[ 2 ] = "'{$params[ 2 ]}'"; } switch (trim($params[ 1 ], '"\'')) { diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.upper.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.upper.php index a083c4f7e..d0d5cc7c3 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.upper.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.upper.php @@ -8,8 +8,8 @@ /** * Smarty upper modifier plugin - * Type: modifier<br> - * Name: lower<br> + * Type: modifier + * Name: lower * Purpose: convert string to uppercase * * @link http://smarty.php.net/manual/en/language.modifier.upper.php lower (Smarty online manual) diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.wordwrap.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.wordwrap.php index 91849738e..94a0cf602 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.wordwrap.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.wordwrap.php @@ -5,22 +5,22 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty wordwrap modifier plugin - * Type: modifier<br> - * Name: wordwrap<br> + * Type: modifier + * Name: wordwrap * Purpose: wrap a string of text at a given length * * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual) * @author Uwe Tews * - * @param array $params parameters - * @param $compiler + * @param array $params parameters + * @param \Smarty_Internal_TemplateCompilerBase $compiler * * @return string with compiled code + * @throws \SmartyException */ -function smarty_modifiercompiler_wordwrap($params, $compiler) +function smarty_modifiercompiler_wordwrap($params, Smarty_Internal_TemplateCompilerBase $compiler) { if (!isset($params[ 1 ])) { $params[ 1 ] = 80; @@ -33,19 +33,7 @@ function smarty_modifiercompiler_wordwrap($params, $compiler) } $function = 'wordwrap'; if (Smarty::$_MBSTRING) { - if ($compiler->template->caching && ($compiler->tag_nocache | $compiler->nocache)) { - $compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ 'wordwrap' ][ 'modifier' ][ 'file' ] = - SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php'; - $compiler->template->required_plugins[ 'nocache' ][ 'wordwrap' ][ 'modifier' ][ 'function' ] = - 'smarty_mb_wordwrap'; - } else { - $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ 'wordwrap' ][ 'modifier' ][ 'file' ] = - SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php'; - $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ 'wordwrap' ][ 'modifier' ][ 'function' ] = - 'smarty_mb_wordwrap'; - } - $function = 'smarty_mb_wordwrap'; + $function = $compiler->getPlugin('mb_wordwrap','modifier'); } - return $function . '(' . $params[ 0 ] . ',' . $params[ 1 ] . ',' . $params[ 2 ] . ',' . $params[ 3 ] . ')'; } diff --git a/vendor/smarty/smarty/libs/plugins/outputfilter.trimwhitespace.php b/vendor/smarty/smarty/libs/plugins/outputfilter.trimwhitespace.php index 1a67123a4..70a66d3da 100644 --- a/vendor/smarty/smarty/libs/plugins/outputfilter.trimwhitespace.php +++ b/vendor/smarty/smarty/libs/plugins/outputfilter.trimwhitespace.php @@ -24,7 +24,7 @@ function smarty_outputfilter_trimwhitespace($source) $_offset = 0; // Unify Line-Breaks to \n - $source = preg_replace("/\015\012|\015|\012/", "\n", $source); + $source = preg_replace('/\015\012|\015|\012/', "\n", $source); // capture Internet Explorer and KnockoutJS Conditional Comments if (preg_match_all('#<!--((\[[^\]]+\]>.*?<!\[[^\]]+\])|(\s*/?ko\s+.+))-->#is', $source, $matches, diff --git a/vendor/smarty/smarty/libs/plugins/shared.escape_special_chars.php b/vendor/smarty/smarty/libs/plugins/shared.escape_special_chars.php index b68fe4b9d..1d4c7284b 100644 --- a/vendor/smarty/smarty/libs/plugins/shared.escape_special_chars.php +++ b/vendor/smarty/smarty/libs/plugins/shared.escape_special_chars.php @@ -8,7 +8,7 @@ /** * escape_special_chars common function - * Function: smarty_function_escape_special_chars<br> + * Function: smarty_function_escape_special_chars * Purpose: used by other smarty functions to escape * special chars except for already escaped ones * diff --git a/vendor/smarty/smarty/libs/plugins/shared.make_timestamp.php b/vendor/smarty/smarty/libs/plugins/shared.make_timestamp.php index 67f862441..eb064607d 100644 --- a/vendor/smarty/smarty/libs/plugins/shared.make_timestamp.php +++ b/vendor/smarty/smarty/libs/plugins/shared.make_timestamp.php @@ -7,7 +7,7 @@ */ /** - * Function: smarty_make_timestamp<br> + * Function: smarty_make_timestamp * Purpose: used by other smarty functions to make a timestamp from a string. * * @author Monte Ohrt <monte at ohrt dot com> @@ -25,7 +25,7 @@ function smarty_make_timestamp($string) (interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface) ) { return (int) $string->format('U'); // PHP 5.2 BC - } elseif (strlen($string) == 14 && ctype_digit($string)) { + } elseif (strlen($string) === 14 && ctype_digit($string)) { // it is mysql timestamp format of YYYYMMDDHHMMSS? return mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), substr($string, 4, 2), substr($string, 6, 2), substr($string, 0, 4)); @@ -35,7 +35,7 @@ function smarty_make_timestamp($string) } else { // strtotime should handle it $time = strtotime($string); - if ($time == - 1 || $time === false) { + if ($time === - 1 || $time === false) { // strtotime() was not able to parse $string, use "now": return time(); } diff --git a/vendor/smarty/smarty/libs/plugins/shared.mb_str_replace.php b/vendor/smarty/smarty/libs/plugins/shared.mb_str_replace.php index 0c3ffe258..300702933 100644 --- a/vendor/smarty/smarty/libs/plugins/shared.mb_str_replace.php +++ b/vendor/smarty/smarty/libs/plugins/shared.mb_str_replace.php @@ -6,14 +6,13 @@ * @subpackage PluginsShared */ if (!function_exists('smarty_mb_str_replace')) { - /** * Multibyte string replace * - * @param string $search the string to be searched - * @param string $replace the replacement string - * @param string $subject the source string - * @param int &$count number of matches found + * @param string|string[] $search the string to be searched + * @param string|string[] $replace the replacement string + * @param string $subject the source string + * @param int &$count number of matches found * * @return string replaced string * @author Rodney Rehm @@ -29,7 +28,7 @@ if (!function_exists('smarty_mb_str_replace')) { $string = smarty_mb_str_replace($search, $replace, $string, $c); $count += $c; } - } elseif (is_array($search)) { + } else if (is_array($search)) { if (!is_array($replace)) { foreach ($search as &$string) { $subject = smarty_mb_str_replace($string, $replace, $subject, $c); @@ -37,7 +36,7 @@ if (!function_exists('smarty_mb_str_replace')) { } } else { $n = max(count($search), count($replace)); - while ($n --) { + while ($n--) { $subject = smarty_mb_str_replace(current($search), current($replace), $subject, $c); $count += $c; next($search); @@ -49,7 +48,6 @@ if (!function_exists('smarty_mb_str_replace')) { $count = count($parts) - 1; $subject = implode($replace, $parts); } - return $subject; } } diff --git a/vendor/smarty/smarty/libs/plugins/shared.mb_unicode.php b/vendor/smarty/smarty/libs/plugins/shared.mb_unicode.php index 0f790b56a..7450148a4 100644 --- a/vendor/smarty/smarty/libs/plugins/shared.mb_unicode.php +++ b/vendor/smarty/smarty/libs/plugins/shared.mb_unicode.php @@ -20,12 +20,12 @@ function smarty_mb_to_unicode($string, $encoding = null) { if ($encoding) { - $expanded = mb_convert_encoding($string, "UTF-32BE", $encoding); + $expanded = mb_convert_encoding($string, 'UTF-32BE', $encoding); } else { - $expanded = mb_convert_encoding($string, "UTF-32BE"); + $expanded = mb_convert_encoding($string, 'UTF-32BE'); } - return unpack("N*", $expanded); + return unpack('N*', $expanded); } /** @@ -46,8 +46,8 @@ function smarty_mb_from_unicode($unicode, $encoding = null) $encoding = mb_internal_encoding(); } foreach ((array) $unicode as $utf32be) { - $character = pack("N*", $utf32be); - $t .= mb_convert_encoding($character, $encoding, "UTF-32BE"); + $character = pack('N*', $utf32be); + $t .= mb_convert_encoding($character, $encoding, 'UTF-32BE'); } return $t; diff --git a/vendor/smarty/smarty/libs/plugins/shared.mb_wordwrap.php b/vendor/smarty/smarty/libs/plugins/shared.mb_wordwrap.php deleted file mode 100644 index 21632a1c0..000000000 --- a/vendor/smarty/smarty/libs/plugins/shared.mb_wordwrap.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -/** - * Smarty shared plugin - * - * @package Smarty - * @subpackage PluginsShared - */ - -if (!function_exists('smarty_mb_wordwrap')) { - - /** - * Wrap a string to a given number of characters - * - * @link http://php.net/manual/en/function.wordwrap.php for similarity - * - * @param string $str the string to wrap - * @param int $width the width of the output - * @param string $break the character used to break the line - * @param boolean $cut ignored parameter, just for the sake of - * - * @return string wrapped string - * @author Rodney Rehm - */ - function smarty_mb_wordwrap($str, $width = 75, $break = "\n", $cut = false) - { - // break words into tokens using white space as a delimiter - $tokens = - preg_split('!(\s)!S' . Smarty::$_UTF8_MODIFIER, $str, - 1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE); - $length = 0; - $t = ''; - $_previous = false; - $_space = false; - - foreach ($tokens as $_token) { - $token_length = mb_strlen($_token, Smarty::$_CHARSET); - $_tokens = array($_token); - if ($token_length > $width) { - if ($cut) { - $_tokens = preg_split('!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER, $_token, - 1, - PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE); - } - } - - foreach ($_tokens as $token) { - $_space = !!preg_match('!^\s$!S' . Smarty::$_UTF8_MODIFIER, $token); - $token_length = mb_strlen($token, Smarty::$_CHARSET); - $length += $token_length; - - if ($length > $width) { - // remove space before inserted break - if ($_previous) { - $t = mb_substr($t, 0, - 1, Smarty::$_CHARSET); - } - - if (!$_space) { - // add the break before the token - if (!empty($t)) { - $t .= $break; - } - $length = $token_length; - } - } elseif ($token == "\n") { - // hard break must reset counters - $_previous = 0; - $length = 0; - } - $_previous = $_space; - // add the token - $t .= $token; - } - } - - return $t; - } -} diff --git a/vendor/smarty/smarty/libs/plugins/variablefilter.htmlspecialchars.php b/vendor/smarty/smarty/libs/plugins/variablefilter.htmlspecialchars.php index aecd1e7e7..3c85295db 100644 --- a/vendor/smarty/smarty/libs/plugins/variablefilter.htmlspecialchars.php +++ b/vendor/smarty/smarty/libs/plugins/variablefilter.htmlspecialchars.php @@ -5,15 +5,15 @@ * @package Smarty * @subpackage PluginsFilter */ - /** * Smarty htmlspecialchars variablefilter plugin * - * @param string $source input string + * @param string $source input string + * @param \Smarty_Internal_Template $template * * @return string filtered output */ -function smarty_variablefilter_htmlspecialchars($source) +function smarty_variablefilter_htmlspecialchars($source, Smarty_Internal_Template $template) { return htmlspecialchars($source, ENT_QUOTES, Smarty::$_CHARSET); } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_custom.php b/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_custom.php index 8f1290e49..7a5920f43 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_custom.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_custom.php @@ -138,7 +138,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource $_smarty_tpl->compile_id, $content, $timestamp); } if (isset($content)) { - eval("?>" . $content); + eval('?>' . $content); $cached->content = null; return true; } @@ -204,7 +204,8 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource * @param string $compile_id compile id * @param integer $exp_time expiration time (number of seconds, not timestamp) * - * @return integer number of cache files deleted + * @return int number of cache files deleted + * @throws \SmartyException */ public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php b/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php index bab1b5c09..ff065a278 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php @@ -104,7 +104,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource } } if (isset($content)) { - eval("?>" . $content); + eval('?>' . $content); return true; } @@ -180,7 +180,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource * @param string $compile_id compile id * @param integer $exp_time expiration time [being ignored] * - * @return integer number of cache files deleted [always -1] + * @return int number of cache files deleted [always -1] + * @throws \SmartyException * @uses buildCachedFilepath() to generate the CacheID * @uses invalidate() to mark CacheIDs parent chain as outdated * @uses delete() to remove CacheID from cache @@ -272,8 +273,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource */ protected function addMetaTimestamp(&$content) { - $mt = explode(" ", microtime()); - $ts = pack("NN", $mt[ 1 ], (int) ($mt[ 0 ] * 100000000)); + $mt = explode(' ', microtime()); + $ts = pack('NN', $mt[ 1 ], (int) ($mt[ 0 ] * 100000000)); $content = $ts . $content; } @@ -370,7 +371,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Translate a CacheID into the list of applicable InvalidationKeys. - * Splits "some|chain|into|an|array" into array( '#clearAll#', 'some', 'some|chain', 'some|chain|into', ... ) + * Splits 'some|chain|into|an|array' into array( '#clearAll#', 'some', 'some|chain', 'some|chain|into', ... ) * * @param string $cid CacheID to translate * @param string $resource_name template name diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_data.php b/vendor/smarty/smarty/libs/sysplugins/smarty_data.php index b9f5de9a5..743b117bf 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_data.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_data.php @@ -61,8 +61,8 @@ class Smarty_Data extends Smarty_Internal_Data foreach ($_parent as $_key => $_val) { $this->tpl_vars[ $_key ] = new Smarty_Variable($_val); } - } elseif ($_parent != null) { - throw new SmartyException("Wrong type for template variables"); + } elseif ($_parent !== null) { + throw new SmartyException('Wrong type for template variables'); } } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_block.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_block.php index a33ad1b11..780319f11 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_block.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_block.php @@ -38,7 +38,7 @@ class Smarty_Internal_Block public $prepend = false; /** - * Block calls {$smarty.block.child} + * Block calls $smarty.block.child * * @var bool */ @@ -67,7 +67,7 @@ class Smarty_Internal_Block /** * Smarty_Internal_Block constructor. - * - if outer level {block} of child template ($state == 1) save it as child root block + * - if outer level {block} of child template ($state === 1) save it as child root block * - otherwise process inheritance and render * * @param string $name block name diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php index 7df4ddffb..f6ef09306 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php @@ -7,7 +7,6 @@ * @author Uwe Tews * @author Rodney Rehm */ - /** * This class does contain all necessary methods for the HTML cache on file system * Implements the file system as resource for the HTML cache Version ussing nocache inserts. @@ -29,11 +28,14 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource { $source = &$_template->source; $smarty = &$_template->smarty; - $_compile_dir_sep = $smarty->use_sub_dirs ? $smarty->ds : '^'; + $_compile_dir_sep = $smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^'; $_filepath = sha1($source->uid . $smarty->_joined_template_dir); $cached->filepath = $smarty->getCacheDir(); if (isset($_template->cache_id)) { - $cached->filepath .= preg_replace(array('![^\w|]+!', '![|]+!'), array('_', $_compile_dir_sep), + $cached->filepath .= preg_replace(array('![^\w|]+!', + '![|]+!'), + array('_', + $_compile_dir_sep), $_template->cache_id) . $_compile_dir_sep; } if (isset($_template->compile_id)) { @@ -41,8 +43,10 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource } // if use_sub_dirs, break file into directories if ($smarty->use_sub_dirs) { - $cached->filepath .= $_filepath[ 0 ] . $_filepath[ 1 ] . $smarty->ds . $_filepath[ 2 ] . $_filepath[ 3 ] . $smarty->ds . - $_filepath[ 4 ] . $_filepath[ 5 ] . $smarty->ds; + $cached->filepath .= $_filepath[ 0 ] . $_filepath[ 1 ] . DIRECTORY_SEPARATOR . $_filepath[ 2 ] . + $_filepath[ 3 ] . + DIRECTORY_SEPARATOR . + $_filepath[ 4 ] . $_filepath[ 5 ] . DIRECTORY_SEPARATOR; } $cached->filepath .= $_filepath; $basename = $source->handler->getBasename($source); @@ -83,12 +87,13 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource * * @return boolean true or false if the cached content does not exist */ - public function process(Smarty_Internal_Template $_smarty_tpl, Smarty_Template_Cached $cached = null, + public function process(Smarty_Internal_Template $_smarty_tpl, + Smarty_Template_Cached $cached = null, $update = false) { $_smarty_tpl->cached->valid = false; if ($update && defined('HHVM_VERSION')) { - eval("?>" . file_get_contents($_smarty_tpl->cached->filepath)); + eval('?>' . file_get_contents($_smarty_tpl->cached->filepath)); return true; } else { return @include $_smarty_tpl->cached->filepath; @@ -101,16 +106,20 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource * @param Smarty_Internal_Template $_template template object * @param string $content content to cache * - * @return boolean success + * @return bool success + * @throws \SmartyException */ public function writeCachedContent(Smarty_Internal_Template $_template, $content) { - if ($_template->smarty->ext->_writeFile->writeFile($_template->cached->filepath, $content, + if ($_template->smarty->ext->_writeFile->writeFile($_template->cached->filepath, + $content, $_template->smarty) === true ) { - if (function_exists('opcache_invalidate') && strlen(ini_get("opcache.restrict_api")) < 1) { + if (function_exists('opcache_invalidate') && + (!function_exists('ini_get') || strlen(ini_get('opcache.restrict_api'))) < 1 + ) { opcache_invalidate($_template->cached->filepath, true); - } elseif (function_exists('apc_compile_file')) { + } else if (function_exists('apc_compile_file')) { apc_compile_file($_template->cached->filepath); } $cached = $_template->cached; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_append.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_append.php index 8539d6b2a..b3689e918 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_append.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_append.php @@ -24,6 +24,7 @@ class Smarty_Internal_Compile_Append extends Smarty_Internal_Compile_Assign * @param array $parameter array with compilation parameter * * @return string compiled code + * @throws \SmartyCompilerException */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php index 3bd33847b..cb2ea4257 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php @@ -71,7 +71,7 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase $_scope = $compiler->convertScope($_attr, $this->valid_scopes); } // optional parameter - $_params = ""; + $_params = ''; if ($_nocache || $_scope) { $_params .= ' ,' . var_export($_nocache, true); } @@ -85,9 +85,9 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase $output .= "settype(\$_tmp_array, 'array');\n"; $output .= "}\n"; $output .= "\$_tmp_array{$parameter['smarty_internal_index']} = {$_attr['value']};\n"; - $output .= "\$_smarty_tpl->_assignInScope({$_var}, \$_tmp_array{$_params});\n?>"; + $output .= "\$_smarty_tpl->_assignInScope({$_var}, \$_tmp_array{$_params});?>"; } else { - $output = "<?php \$_smarty_tpl->_assignInScope({$_var}, {$_attr['value']}{$_params});\n?>"; + $output = "<?php \$_smarty_tpl->_assignInScope({$_var}, {$_attr['value']}{$_params});?>"; } return $output; } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php index 5098d62fe..88d6f37e9 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php @@ -22,7 +22,6 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher * @see Smarty_Internal_CompileBase */ public $required_attributes = array('name'); - /** * Attribute definition: Overwrites base class. * @@ -30,7 +29,6 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher * @see Smarty_Internal_CompileBase */ public $shorttag_order = array('name'); - /** * Attribute definition: Overwrites base class. * @@ -38,7 +36,6 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher * @see Smarty_Internal_CompileBase */ public $option_flags = array('hide', 'nocache'); - /** * Attribute definition: Overwrites base class. * @@ -48,27 +45,19 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher public $optional_attributes = array('assign'); /** - * Saved compiler object - * - * @var Smarty_Internal_TemplateCompilerBase - */ - public $compiler = null; - - /** * Compiles code for the {block} tag * * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * @param array $parameter array with compilation parameter * - * @return bool true */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) { if (!isset($compiler->_cache[ 'blockNesting' ])) { $compiler->_cache[ 'blockNesting' ] = 0; } - if ($compiler->_cache[ 'blockNesting' ] == 0) { + if ($compiler->_cache[ 'blockNesting' ] === 0) { // make sure that inheritance gets initialized in template code $this->registerInit($compiler); $this->option_flags = array('hide', 'nocache', 'append', 'prepend'); @@ -77,30 +66,24 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher } // check and get attributes $_attr = $this->getAttributes($compiler, $args); - $compiler->_cache[ 'blockNesting' ] ++; + ++$compiler->_cache[ 'blockNesting' ]; $_className = 'Block_' . preg_replace('![^\w]+!', '_', uniqid(rand(), true)); $compiler->_cache[ 'blockName' ][ $compiler->_cache[ 'blockNesting' ] ] = $_attr[ 'name' ]; $compiler->_cache[ 'blockClass' ][ $compiler->_cache[ 'blockNesting' ] ] = $_className; $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ] = array(); $compiler->_cache[ 'blockParams' ][ 1 ][ 'subBlocks' ][ trim($_attr[ 'name' ], '"\'') ][] = $_className; - $this->openTag($compiler, 'block', array($_attr, $compiler->nocache, $compiler->parser->current_buffer, - $compiler->template->compiled->has_nocache_code, - $compiler->template->caching)); - // must whole block be nocache ? - if ($compiler->tag_nocache) { - $i = 0; - } + $this->openTag($compiler, + 'block', + array($_attr, $compiler->nocache, $compiler->parser->current_buffer, + $compiler->template->compiled->has_nocache_code, + $compiler->template->caching)); + $compiler->saveRequiredPlugins(true); $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; - // $compiler->suppressNocacheProcessing = true; - if ($_attr[ 'nocache' ] === true) { - //$compiler->trigger_template_error('nocache option not allowed', $compiler->parser->lex->taglineno); - } $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); $compiler->template->compiled->has_nocache_code = false; $compiler->suppressNocacheProcessing = true; } } - /** * Smarty Internal Plugin Compile BlockClose Class * @@ -126,7 +109,7 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_ $_assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : null; unset($_attr[ 'assign' ], $_attr[ 'name' ]); foreach ($_attr as $name => $stat) { - if ((is_bool($stat) && $stat !== false) || (!is_bool($stat) && $stat != 'false')) { + if ((is_bool($stat) && $stat !== false) || (!is_bool($stat) && $stat !== 'false')) { $_block[ $name ] = 'true'; } } @@ -144,7 +127,8 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_ $output .= "public \${$property} = " . var_export($value,true) .";\n"; } $output .= "public function callBlock(Smarty_Internal_Template \$_smarty_tpl) {\n"; - //$output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\n"; + $output .= $compiler->compileRequiredPlugins(); + $compiler->restoreRequiredPlugins(); if ($compiler->template->compiled->has_nocache_code) { $output .= "\$_smarty_tpl->cached->hashes['{$compiler->template->compiled->nocache_hash}'] = true;\n"; } @@ -167,32 +151,22 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_ $compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser, $output)); - $compiler->blockOrFunctionCode .= $f = $compiler->parser->current_buffer->to_smarty_php($compiler->parser); + $compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser); $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); - // nocache plugins must be copied - if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) { - foreach ($compiler->template->compiled->required_plugins[ 'nocache' ] as $plugin => $tmp) { - foreach ($tmp as $type => $data) { - $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin ][ $type ] = - $data; - } - } - } - // restore old status $compiler->template->compiled->has_nocache_code = $_has_nocache_code; $compiler->tag_nocache = $compiler->nocache; $compiler->nocache = $_nocache; $compiler->parser->current_buffer = $_buffer; $output = "<?php \n"; - if ($compiler->_cache[ 'blockNesting' ] == 1) { + if ($compiler->_cache[ 'blockNesting' ] === 1) { $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name);\n"; } else { $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name, \$this->tplIndex);\n"; } $output .= "?>\n"; - $compiler->_cache[ 'blockNesting' ] --; - if ($compiler->_cache[ 'blockNesting' ] == 0) { + --$compiler->_cache[ 'blockNesting' ]; + if ($compiler->_cache[ 'blockNesting' ] === 0) { unset($compiler->_cache[ 'blockNesting' ]); } $compiler->has_code = true; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_child.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_child.php index bb070ebe3..1708f6482 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_child.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_child.php @@ -9,46 +9,16 @@ */ /** - * Smarty Internal Plugin Compile Block Parent Class + * Smarty Internal Plugin Compile Block Child Class * * @author Uwe Tews <uwe.tews@googlemail.com> */ -class Smarty_Internal_Compile_Block_Child extends Smarty_Internal_CompileBase +class Smarty_Internal_Compile_Block_Child extends Smarty_Internal_Compile_Child { /** - * Attribute definition: Overwrites base class. + * Tag name * - * @var array - * @see Smarty_Internal_CompileBase + * @var string */ - public $option_flags = array(); - - /** - * Saved compiler object - * - * @var Smarty_Internal_TemplateCompilerBase - */ - public $compiler = null; - - /** - * Compiles code for the {block_parent} tag - * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter - * - * @return bool true - */ - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) - { - if (!isset($compiler->_cache[ 'blockNesting' ])) { - $compiler->trigger_template_error(' tag {$smarty.block.child} used outside {block} tags ', - $compiler->parser->lex->taglineno); - } - $compiler->has_code = true; - $compiler->suppressNocacheProcessing = true; - $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ][ 'callsChild' ] = 'true'; - $output = "<?php \n\$_smarty_tpl->inheritance->callChild(\$_smarty_tpl, \$this);\n?>\n"; - return $output; - } + public $tag = 'block_child'; }
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_parent.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_parent.php index 0ec1e8485..4f094ad61 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_parent.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_parent.php @@ -13,61 +13,19 @@ * * @author Uwe Tews <uwe.tews@googlemail.com> */ -class Smarty_Internal_Compile_Block_Parent extends Smarty_Internal_Compile_Shared_Inheritance +class Smarty_Internal_Compile_Block_Parent extends Smarty_Internal_Compile_Child { - - /** - * Attribute definition: Overwrites base class. - * - * @var array - * @see Smarty_Internal_CompileBase - */ - public $optional_attributes = array('name'); - - /** - * Attribute definition: Overwrites base class. - * - * @var array - * @see Smarty_Internal_CompileBase - */ - public $shorttag_order = array('name'); - /** - * Attribute definition: Overwrites base class. + * Tag name * - * @var array - * @see Smarty_Internal_CompileBase + * @var string */ - public $option_flags = array(); + public $tag = 'block_parent'; /** - * Saved compiler object - * - * @var Smarty_Internal_TemplateCompilerBase - */ - public $compiler = null; - - /** - * Compiles code for the {block_parent} tag - * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * Block type * - * @return bool true + * @var string */ - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) - { - // check and get attributes - $_attr = $this->getAttributes($compiler, $args); - if (!isset($compiler->_cache[ 'blockNesting' ])) { - $compiler->trigger_template_error(' tag {$smarty.block.parent} used outside {block} tags ', - $compiler->parser->lex->taglineno); - } - $compiler->suppressNocacheProcessing = true; - $compiler->has_code = true; - $output = "<?php \n\$_smarty_tpl->inheritance->callParent(\$_smarty_tpl, \$this" . - (isset($_attr[ 'name' ]) ? ", {$_attr[ 'name' ]}" : '') . ");\n?>\n"; - return $output; - } + public $blockType = 'Parent'; }
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_break.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_break.php index 50157382a..09c25d238 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_break.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_break.php @@ -33,24 +33,34 @@ class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase public $shorttag_order = array('levels'); /** + * Tag name may be overloaded by Smarty_Internal_Compile_Continue + * + * @var string + */ + public $tag = 'break'; + + /** * Compiles code for the {break} tag * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code + * @throws \SmartyCompilerException */ - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { list($levels, $foreachLevels) = $this->checkLevels($args, $compiler); - $output = "<?php\n"; - if ($foreachLevels) { + $output = "<?php "; + if ($foreachLevels > 0 && $this->tag === 'continue') { + $foreachLevels--; + } + if ($foreachLevels > 0) { /* @var Smarty_Internal_Compile_Foreach $foreachCompiler */ $foreachCompiler = $compiler->getTagCompiler('foreach'); $output .= $foreachCompiler->compileRestore($foreachLevels); } - $output .= "break {$levels};?>"; + $output .= "{$this->tag} {$levels};?>"; return $output; } @@ -59,12 +69,11 @@ class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase * * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param string $tag tag name * * @return array * @throws \SmartyCompilerException */ - public function checkLevels($args, Smarty_Internal_TemplateCompilerBase $compiler, $tag = 'break') + public function checkLevels($args, Smarty_Internal_TemplateCompilerBase $compiler) { static $_is_loopy = array('for' => true, 'foreach' => true, 'while' => true, 'section' => true); // check and get attributes @@ -86,7 +95,7 @@ class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase $stack_count = count($compiler->_tag_stack) - 1; $foreachLevels = 0; $lastTag = ''; - while ($level_count >= 0 && $stack_count >= 0) { + while ($level_count > 0 && $stack_count >= 0) { if (isset($_is_loopy[ $compiler->_tag_stack[ $stack_count ][ 0 ] ])) { $lastTag = $compiler->_tag_stack[ $stack_count ][ 0 ]; if ($level_count === 0) { @@ -99,10 +108,10 @@ class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase } $stack_count --; } - if ($level_count != 0) { - $compiler->trigger_template_error("cannot {$tag} {$levels} level(s)", null, true); + if ($level_count !== 0) { + $compiler->trigger_template_error("cannot {$this->tag} {$levels} level(s)", null, true); } - if ($lastTag === 'foreach' && $tag === 'break') { + if ($lastTag === 'foreach' && $this->tag === 'break' && $foreachLevels > 0) { $foreachLevels --; } return array($levels, $foreachLevels); diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_call.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_call.php index 739df5eca..eb444d357 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_call.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_call.php @@ -57,7 +57,7 @@ class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase // output will be stored in a smarty variable instead of being displayed $_assign = $_attr[ 'assign' ]; } - //$_name = trim($_attr['name'], "'\""); + //$_name = trim($_attr['name'], "''"); $_name = $_attr[ 'name' ]; unset($_attr[ 'name' ], $_attr[ 'assign' ], $_attr[ 'nocache' ]); // set flag (compiled code of {function} must be included in cache file @@ -74,7 +74,7 @@ class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase $_paramsArray[] = "'$_key'=>$_value"; } } - $_params = 'array(' . implode(",", $_paramsArray) . ')'; + $_params = 'array(' . implode(',', $_paramsArray) . ')'; //$compiler->suppressNocacheProcessing = true; // was there an assign attribute if (isset($_assign)) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_capture.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_capture.php index 34fc55f9d..564b1f63e 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_capture.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_capture.php @@ -45,11 +45,11 @@ class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase public static function compileSpecialVariable($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter = null) { $tag = trim($parameter[ 0 ], '"\''); - $name = isset($parameter[ 1 ]) ? $compiler->getId($parameter[ 1 ]) : false; + $name = isset($parameter[ 1 ]) ? $compiler->getId($parameter[ 1 ]) : null; if (!$name) { - $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true); + //$compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true); } - return "\$_smarty_tpl->smarty->ext->_capture->getBuffer(\$_smarty_tpl, '{$name}')"; + return '$_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl'.(isset($name)?", '{$name}')":')'); } /** diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_child.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_child.php new file mode 100644 index 000000000..8c7bbdf05 --- /dev/null +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_child.php @@ -0,0 +1,77 @@ +<?php +/* + * This file is part of Smarty. + * + * (c) 2015 Uwe Tews + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Smarty Internal Plugin Compile Child Class + * + * @author Uwe Tews <uwe.tews@googlemail.com> + */ +class Smarty_Internal_Compile_Child extends Smarty_Internal_CompileBase +{ + /** + * Attribute definition: Overwrites base class. + * + * @var array + * @see Smarty_Internal_CompileBase + */ + public $optional_attributes = array('assign'); + + /** + * Tag name + * + * @var string + */ + public $tag = 'child'; + + /** + * Block type + * + * @var string + */ + public $blockType = 'Child'; + + /** + * Compiles code for the {child} tag + * + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object + * @param array $parameter array with compilation parameter + * + * @return string compiled code + * @throws \SmartyCompilerException + */ + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) + { + // check and get attributes + $_attr = $this->getAttributes($compiler, $args); + $tag = isset($parameter[0]) ? "'{$parameter[0]}'" : "'{{$this->tag}}'"; + if (!isset($compiler->_cache[ 'blockNesting' ])) { + $compiler->trigger_template_error("{$tag} used outside {block} tags ", + $compiler->parser->lex->taglineno); + } + $compiler->has_code = true; + $compiler->suppressNocacheProcessing = true; + if ($this->blockType === 'Child') { + $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ][ 'callsChild' ] = 'true'; + } + $_assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : null; + $output = "<?php \n"; + if (isset($_assign)) { + $output .= "ob_start();\n"; + } + $output .= '$_smarty_tpl->inheritance->call' . $this->blockType . '($_smarty_tpl, $this' . + ($this->blockType === 'Child' ? '' : ", {$tag}"). ");\n"; + if (isset($_assign)) { + $output .= "\$_smarty_tpl->assign({$_assign}, ob_get_clean());\n"; + } + $output .="?>\n"; + return $output; + } +}
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_continue.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_continue.php index 7492c7df2..19e5d4bee 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_continue.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_continue.php @@ -16,27 +16,10 @@ */ class Smarty_Internal_Compile_Continue extends Smarty_Internal_Compile_Break { - /** - * Compiles code for the {continue} tag - * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter - * - * @return string compiled code - * @throws \SmartyCompilerException - */ - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) - { - list($levels, $foreachLevels) = $this->checkLevels($args, $compiler, 'continue'); - $output = "<?php\n"; - if ($foreachLevels > 1) { - /* @var Smarty_Internal_Compile_Foreach $foreachCompiler */ - $foreachCompiler = $compiler->getTagCompiler('foreach'); - $output .= $foreachCompiler->compileRestore($foreachLevels - 1); - } - $output .= "continue {$levels};?>"; - return $output; - } + * Tag name + * + * @var string + */ + public $tag = 'continue'; } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_eval.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_eval.php index 97a3c29c5..550f194e0 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_eval.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_eval.php @@ -58,13 +58,12 @@ class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase } // create template object - $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'." . $_attr[ 'var' ] . - ", \$_smarty_tpl->smarty, \$_smarty_tpl);"; + $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'.{$_attr[ 'var' ]}, \$_smarty_tpl->smarty, \$_smarty_tpl);"; //was there an assign attribute? if (isset($_assign)) { $_output .= "\$_smarty_tpl->assign($_assign,\$_template->fetch());"; } else { - $_output .= "echo \$_template->fetch();"; + $_output .= 'echo $_template->fetch();'; } return "<?php $_output ?>"; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_extends.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_extends.php index 83cb80500..37bf8dd3f 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_extends.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_extends.php @@ -64,18 +64,18 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_Compile_Shared_Inh // add code to initialize inheritance $this->registerInit($compiler, true); $file = trim($_attr[ 'file' ], '\'"'); - if (strlen($file) > 8 && substr($file, 0, 8) == 'extends:') { + if (strlen($file) > 8 && substr($file, 0, 8) === 'extends:') { // generate code for each template $files = array_reverse(explode('|', substr($file, 8))); $i = 0; foreach ($files as $file) { - if ($file[ 0 ] == '"') { + if ($file[ 0 ] === '"') { $file = trim($file, '".'); } else { $file = "'{$file}'"; } $i ++; - if ($i == count($files) && isset($_attr[ 'extends_resource' ])) { + if ($i === count($files) && isset($_attr[ 'extends_resource' ])) { $this->compileEndChild($compiler); } $this->compileInclude($compiler, $file); @@ -95,21 +95,24 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_Compile_Shared_Inh * * @param \Smarty_Internal_TemplateCompilerBase $compiler * @param null|string $template optional inheritance parent template + * + * @throws \SmartyCompilerException + * @throws \SmartyException */ private function compileEndChild(Smarty_Internal_TemplateCompilerBase $compiler, $template = null) { $inlineUids = ''; if (isset($template) && $compiler->smarty->merge_compiled_includes) { $code = $compiler->compileTag('include', array($template, array('scope' => 'parent'))); - if (preg_match("/([,][\s]*['][a-z0-9]+['][,][\s]*[']content.*['])[)]/", $code, $match)) { + if (preg_match('/([,][\s]*[\'][a-z0-9]+[\'][,][\s]*[\']content.*[\'])[)]/', $code, $match)) { $inlineUids = $match[ 1 ]; } } $compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag($compiler->parser, - "<?php \$_smarty_tpl->inheritance->endChild(\$_smarty_tpl" . + '<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl' . (isset($template) ? - ', ' . $template . $inlineUids : - '') . ");\n?>\n"); + ", {$template}{$inlineUids}" : + '') . ");\n?>"); } /** @@ -117,6 +120,9 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_Compile_Shared_Inh * * @param \Smarty_Internal_TemplateCompilerBase $compiler * @param string $template subtemplate name + * + * @throws \SmartyCompilerException + * @throws \SmartyException */ private function compileInclude(Smarty_Internal_TemplateCompilerBase $compiler, $template) { @@ -129,16 +135,17 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_Compile_Shared_Inh /** * Create source code for {extends} from source components array * - * @param []\Smarty_Internal_Template_Source $components + * @param \Smarty_Internal_Template $template * * @return string */ - public static function extendsSourceArrayCode($components) + public static function extendsSourceArrayCode(Smarty_Internal_Template $template) { $resources = array(); - foreach ($components as $source) { + foreach ($template->source->components as $source) { $resources[] = $source->resource; } - return '{extends file=\'extends:' . join('|', $resources) . '\' extends_resource=true}'; + return $template->smarty->left_delimiter . 'extends file=\'extends:' . join('|', $resources) . + '\' extends_resource=true' . $template->smarty->right_delimiter; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php index e5e7c61c3..79848e521 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php @@ -35,7 +35,7 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase public function compile($args, $compiler, $parameter) { $compiler->loopNesting ++; - if ($parameter == 0) { + if ($parameter === 0) { $this->required_attributes = array('start', 'to'); $this->optional_attributes = array('max', 'step'); } else { @@ -47,7 +47,7 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase $_attr = $this->getAttributes($compiler, $args); $output = "<?php\n"; - if ($parameter == 1) { + if ($parameter === 1) { foreach ($_attr[ 'start' ] as $_statement) { if (is_array($_statement[ 'var' ])) { $var = $_statement[ 'var' ][ 'var' ]; @@ -89,10 +89,10 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase } $output .= "if (\$_smarty_tpl->tpl_vars[$var]->total > 0) {\n"; $output .= "for (\$_smarty_tpl->tpl_vars[$var]->value{$index} = $_statement[value], \$_smarty_tpl->tpl_vars[$var]->iteration = 1;\$_smarty_tpl->tpl_vars[$var]->iteration <= \$_smarty_tpl->tpl_vars[$var]->total;\$_smarty_tpl->tpl_vars[$var]->value{$index} += \$_smarty_tpl->tpl_vars[$var]->step, \$_smarty_tpl->tpl_vars[$var]->iteration++) {\n"; - $output .= "\$_smarty_tpl->tpl_vars[$var]->first = \$_smarty_tpl->tpl_vars[$var]->iteration == 1;"; - $output .= "\$_smarty_tpl->tpl_vars[$var]->last = \$_smarty_tpl->tpl_vars[$var]->iteration == \$_smarty_tpl->tpl_vars[$var]->total;"; + $output .= "\$_smarty_tpl->tpl_vars[$var]->first = \$_smarty_tpl->tpl_vars[$var]->iteration === 1;"; + $output .= "\$_smarty_tpl->tpl_vars[$var]->last = \$_smarty_tpl->tpl_vars[$var]->iteration === \$_smarty_tpl->tpl_vars[$var]->total;"; } - $output .= "?>"; + $output .= '?>'; $this->openTag($compiler, 'for', array('for', $compiler->nocache)); // maybe nocache because of nocache variables @@ -161,10 +161,10 @@ class Smarty_Internal_Compile_Forclose extends Smarty_Internal_CompileBase list($openTag, $compiler->nocache) = $this->closeTag($compiler, array('for', 'forelse')); $output = "<?php }\n"; - if ($openTag != 'forelse') { + if ($openTag !== 'forelse') { $output .= "}\n"; } - $output .= "?>\n"; + $output .= "?>"; return $output; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php index 5ddd42d8a..471e92c3e 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php @@ -78,14 +78,14 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo /** * Compiles code for the {foreach} tag * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code * @throws \SmartyCompilerException + * @throws \SmartyException */ - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { $compiler->loopNesting ++; // init @@ -118,7 +118,7 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo $fromName = $compiler->getVariableName($_attr[ 'from' ]); if ($fromName) { foreach (array('item', 'key') as $a) { - if (isset($attributes[ $a ]) && $attributes[ $a ] == $fromName) { + if (isset($attributes[ $a ]) && $attributes[ $a ] === $fromName) { $compiler->trigger_template_error("'{$a}' and 'from' may not have same variable name '{$fromName}'", null, true); } @@ -137,7 +137,7 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo if (!empty($this->matchResults[ 'named' ])) { $namedAttr = $this->matchResults[ 'named' ]; } - if (isset($_attr[ 'properties' ]) && preg_match_all("/['](.*?)[']/", $_attr[ 'properties' ], $match)) { + if (isset($_attr[ 'properties' ]) && preg_match_all('/[\'](.*?)[\']/', $_attr[ 'properties' ], $match)) { foreach ($match[ 1 ] as $prop) { if (in_array($prop, $this->itemProperties)) { $itemAttr[ $prop ] = true; @@ -229,7 +229,7 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo $output .= "{$itemVar}->first = !{$itemVar}->index;\n"; } if (isset($itemAttr[ 'last' ])) { - $output .= "{$itemVar}->last = {$itemVar}->iteration == {$itemVar}->total;\n"; + $output .= "{$itemVar}->last = {$itemVar}->iteration === {$itemVar}->total;\n"; } if (isset($foreachVar)) { if (isset($namedAttr[ 'iteration' ])) { @@ -242,13 +242,13 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo $output .= "{$foreachVar}->value['first'] = !{$foreachVar}->value['index'];\n"; } if (isset($namedAttr[ 'last' ])) { - $output .= "{$foreachVar}->value['last'] = {$foreachVar}->value['iteration'] == {$foreachVar}->value['total'];\n"; + $output .= "{$foreachVar}->value['last'] = {$foreachVar}->value['iteration'] === {$foreachVar}->value['total'];\n"; } } if (!empty($itemAttr)) { $output .= "{$local}saved = {$itemVar};\n"; } - $output .= "?>"; + $output .= '?>'; return $output; } @@ -262,7 +262,7 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo */ public function compileRestore($levels) { - return "\$_smarty_tpl->smarty->ext->_foreach->restore(\$_smarty_tpl, {$levels});\n"; + return "\$_smarty_tpl->smarty->ext->_foreach->restore(\$_smarty_tpl, {$levels});"; } } @@ -277,13 +277,12 @@ class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase /** * Compiles code for the {foreachelse} tag * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code */ - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { // check and get attributes $_attr = $this->getAttributes($compiler, $args); @@ -291,10 +290,10 @@ class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase list($openTag, $nocache, $local, $itemVar, $restore) = $this->closeTag($compiler, array('foreach')); $this->openTag($compiler, 'foreachelse', array('foreachelse', $nocache, $local, $itemVar, 0)); $output = "<?php\n"; - if ($restore == 2) { + if ($restore === 2) { $output .= "{$itemVar} = {$local}saved;\n"; } - $output .= "}\n} else {\n?>\n"; + $output .= "}\n} else {\n?>"; return $output; } } @@ -310,13 +309,13 @@ class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase /** * Compiles code for the {/foreach} tag * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code - */ - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) + * @throws \SmartyCompilerException + */ + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { $compiler->loopNesting --; // must endblock be nocache? @@ -328,7 +327,7 @@ class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase $this->closeTag($compiler, array('foreach', 'foreachelse')); $output = "<?php\n"; - if ($restore == 2) { + if ($restore === 2) { $output .= "{$itemVar} = {$local}saved;\n"; } if ($restore > 0) { @@ -338,7 +337,7 @@ class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase /* @var Smarty_Internal_Compile_Foreach $foreachCompiler */ $foreachCompiler = $compiler->getTagCompiler('foreach'); $output .= $foreachCompiler->compileRestore(1); - $output .= "?>\n"; + $output .= "?>"; return $output; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_function.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_function.php index b7cd9e1c0..909b767c8 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_function.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_function.php @@ -44,14 +44,13 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase /** * Compiles code for the {function} tag * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return bool true * @throws \SmartyCompilerException */ - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { // check and get attributes $_attr = $this->getAttributes($compiler, $args); @@ -60,7 +59,7 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase $compiler->trigger_template_error('nocache option not allowed', null, true); } unset($_attr[ 'nocache' ]); - $_name = trim($_attr[ 'name' ], "'\""); + $_name = trim($_attr[ 'name' ], '\'"'); $compiler->parent_compiler->tpl_function[ $_name ] = array(); $save = array($_attr, $compiler->parser->current_buffer, $compiler->template->compiled->has_nocache_code, $compiler->template->caching); @@ -68,6 +67,7 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase // Init temporary context $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); $compiler->template->compiled->has_nocache_code = false; + $compiler->saveRequiredPlugins(true); return true; } } @@ -91,18 +91,17 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase /** * Compiles code for the {/function} tag * - * @param array $args array with attributes from parser - * @param object|\Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param object|\Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return bool true */ - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { $this->compiler = $compiler; $saved_data = $this->closeTag($compiler, array('function')); $_attr = $saved_data[ 0 ]; - $_name = trim($_attr[ 'name' ], "'\""); + $_name = trim($_attr[ 'name' ], '\'"'); $compiler->parent_compiler->tpl_function[ $_name ][ 'compiled_filepath' ] = $compiler->parent_compiler->template->compiled->filepath; $compiler->parent_compiler->tpl_function[ $_name ][ 'uid' ] = $compiler->template->source->uid; @@ -118,7 +117,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase } } if (!empty($_paramsArray)) { - $_params = 'array(' . implode(",", $_paramsArray) . ')'; + $_params = 'array(' . implode(',', $_paramsArray) . ')'; $_paramsCode = "\$params = array_merge($_params, \$params);\n"; } else { $_paramsCode = ''; @@ -134,15 +133,16 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase $output = "<?php\n"; $output .= "/* {$_funcNameCaching} */\n"; $output .= "if (!function_exists('{$_funcNameCaching}')) {\n"; - $output .= "function {$_funcNameCaching} (\$_smarty_tpl,\$params) {\n"; + $output .= "function {$_funcNameCaching} (Smarty_Internal_Template \$_smarty_tpl,\$params) {\n"; $output .= "ob_start();\n"; + $output .= $compiler->compileRequiredPlugins(); $output .= "\$_smarty_tpl->compiled->has_nocache_code = true;\n"; $output .= $_paramsCode; - $output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}"; + $output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}\n"; $output .= "\$params = var_export(\$params, true);\n"; $output .= "echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php "; $output .= "\\\$_smarty_tpl->smarty->ext->_tplFunction->saveTemplateVariables(\\\$_smarty_tpl, '{$_name}');\nforeach (\$params as \\\$key => \\\$value) {\n\\\$_smarty_tpl->tpl_vars[\\\$key] = new Smarty_Variable(\\\$value, \\\$_smarty_tpl->isRenderingCache);\n}\n?>"; - $output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\n\";?>"; + $output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\";?>"; $compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser, $output)); @@ -166,9 +166,11 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase $output = "<?php\n"; $output .= "/* {$_funcName} */\n"; $output .= "if (!function_exists('{$_funcName}')) {\n"; - $output .= "function {$_funcName}(\$_smarty_tpl,\$params) {\n"; + $output .= "function {$_funcName}(Smarty_Internal_Template \$_smarty_tpl,\$params) {\n"; $output .= $_paramsCode; - $output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}?>"; + $output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}\n"; + $output .= $compiler->compileCheckPlugins(array_merge($compiler->required_plugins[ 'compiled' ], $compiler->required_plugins[ 'nocache' ])); + $output .= "?>\n"; $compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser, $output)); @@ -180,19 +182,10 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase new Smarty_Internal_ParseTree_Tag($compiler->parser, $output)); $compiler->parent_compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser); - // nocache plugins must be copied - if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) { - foreach ($compiler->template->compiled->required_plugins[ 'nocache' ] as $plugin => $tmp) { - foreach ($tmp as $type => $data) { - $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin ][ $type ] = - $data; - } - } - } - // restore old buffer - + // restore old buffer $compiler->parser->current_buffer = $saved_data[ 1 ]; // restore old status + $compiler->restoreRequiredPlugins(); $compiler->template->compiled->has_nocache_code = $saved_data[ 2 ]; $compiler->template->caching = $saved_data[ 3 ]; return true; @@ -200,7 +193,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase /** * Remove nocache code - * + * * @param $match * * @return string diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php index 14db55d4f..82436c266 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php @@ -34,8 +34,8 @@ class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase // must whole block be nocache ? $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; - if (!array_key_exists("if condition", $parameter)) { - $compiler->trigger_template_error("missing if condition", null, true); + if (!isset($parameter['if condition'])) { + $compiler->trigger_template_error('missing if condition', null, true); } if (is_array($parameter[ 'if condition' ])) { @@ -49,9 +49,9 @@ class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase $compiler->setNocacheInVariable($var); } $prefixVar = $compiler->getNewPrefixVariable(); - $_output = "<?php {$prefixVar} = " . $parameter[ 'if condition' ][ 'value' ] . ";?>\n"; + $_output = "<?php {$prefixVar} = {$parameter[ 'if condition' ][ 'value' ]};?>\n"; $assignAttr = array(); - $assignAttr[][ 'value' ] = "{$prefixVar}"; + $assignAttr[][ 'value' ] = $prefixVar; $assignCompiler = new Smarty_Internal_Compile_Assign(); if (is_array($parameter[ 'if condition' ][ 'var' ])) { $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; @@ -80,18 +80,17 @@ class Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase /** * Compiles code for the {else} tag * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code - */ - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) + */ + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif')); $this->openTag($compiler, 'else', array($nesting, $compiler->tag_nocache)); - return "<?php } else { ?>"; + return '<?php } else { ?>'; } } @@ -120,8 +119,8 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif')); - if (!array_key_exists("if condition", $parameter)) { - $compiler->trigger_template_error("missing elseif condition", null, true); + if (!isset($parameter['if condition'])) { + $compiler->trigger_template_error('missing elseif condition', null, true); } $assignCode = ''; @@ -138,10 +137,10 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase $compiler->setNocacheInVariable($var); } $prefixVar = $compiler->getNewPrefixVariable(); - $assignCode = "<?php {$prefixVar} = " . $parameter[ 'if condition' ][ 'value' ] . ";?>\n"; + $assignCode = "<?php {$prefixVar} = {$parameter[ 'if condition' ][ 'value' ]};?>\n"; $assignCompiler = new Smarty_Internal_Compile_Assign(); $assignAttr = array(); - $assignAttr[][ 'value' ] = "{$prefixVar}"; + $assignAttr[][ 'value' ] = $prefixVar; if (is_array($parameter[ 'if condition' ][ 'var' ])) { $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; $assignCode .= $assignCompiler->compile($assignAttr, $compiler, @@ -188,13 +187,12 @@ class Smarty_Internal_Compile_Ifclose extends Smarty_Internal_CompileBase /** * Compiles code for the {/if} tag * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code */ - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { // must endblock be nocache? if ($compiler->nocache) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include.php index a81b0c740..70f22546c 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include.php @@ -7,7 +7,6 @@ * @subpackage Compiler * @author Uwe Tews */ - /** * Smarty Internal Plugin Compile Include Class * @@ -20,7 +19,6 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase * caching mode to create nocache code but no cache file */ const CACHING_NOCACHE_CODE = 9999; - /** * Attribute definition: Overwrites base class. * @@ -28,7 +26,6 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase * @see Smarty_Internal_CompileBase */ public $required_attributes = array('file'); - /** * Attribute definition: Overwrites base class. * @@ -36,7 +33,6 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase * @see Smarty_Internal_CompileBase */ public $shorttag_order = array('file'); - /** * Attribute definition: Overwrites base class. * @@ -44,7 +40,6 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase * @see Smarty_Internal_CompileBase */ public $option_flags = array('nocache', 'inline', 'caching'); - /** * Attribute definition: Overwrites base class. * @@ -52,7 +47,6 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase * @see Smarty_Internal_CompileBase */ public $optional_attributes = array('_any'); - /** * Valid scope names * @@ -65,19 +59,19 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase /** * Compiles code for the {include} tag * - * @param array $args array with attributes from parser - * @param Smarty_Internal_SmartyTemplateCompiler $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param Smarty_Internal_SmartyTemplateCompiler $compiler compiler object * - * @throws SmartyCompilerException - * @return string compiled code + * @return string + * @throws \Exception + * @throws \SmartyCompilerException + * @throws \SmartyException */ - public function compile($args, Smarty_Internal_SmartyTemplateCompiler $compiler, $parameter) + public function compile($args, Smarty_Internal_SmartyTemplateCompiler $compiler) { $uid = $t_hash = null; // check and get attributes $_attr = $this->getAttributes($compiler, $args); - $fullResourceName = $source_resource = $_attr[ 'file' ]; $variable_template = false; $cache_tpl = false; @@ -90,11 +84,11 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase $variable_template = true; } if (!$variable_template) { - if ($type != 'string') { + if ($type !== 'string') { $fullResourceName = "{$type}:{$name}"; $compiled = $compiler->parent_compiler->template->compiled; if (isset($compiled->includes[ $fullResourceName ])) { - $compiled->includes[ $fullResourceName ] ++; + $compiled->includes[ $fullResourceName ]++; $cache_tpl = true; } else { if ("{$compiler->template->source->type}:{$compiler->template->source->name}" == @@ -116,10 +110,8 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase } else { $variable_template = true; } - // scope setup $_scope = $compiler->convertScope($_attr, $this->valid_scopes); - // set flag to cache subtemplate object when called within loop or template name is variable. if ($cache_tpl || $variable_template || $compiler->loopNesting > 0) { $_cache_tpl = 'true'; @@ -128,18 +120,14 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase } // assume caching is off $_caching = Smarty::CACHING_OFF; - $call_nocache = $compiler->tag_nocache || $compiler->nocache; - // caching was on and {include} is not in nocache mode if ($compiler->template->caching && !$compiler->nocache && !$compiler->tag_nocache) { $_caching = self::CACHING_NOCACHE_CODE; } - // flag if included template code should be merged into caller $merge_compiled_includes = ($compiler->smarty->merge_compiled_includes || $_attr[ 'inline' ] === true) && !$compiler->template->source->handler->recompiled; - if ($merge_compiled_includes) { // variable template name ? if ($variable_template) { @@ -150,7 +138,6 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase $merge_compiled_includes = false; } } - /* * if the {include} tag provides individual parameter for caching or compile_id * the subtemplate must not be included into the common cache file and is treated like @@ -158,7 +145,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase * */ if ($_attr[ 'nocache' ] !== true && $_attr[ 'caching' ]) { - $_caching = $_new_caching = (int) $_attr[ 'caching' ]; + $_caching = $_new_caching = (int)$_attr[ 'caching' ]; $call_nocache = true; } else { $_new_caching = Smarty::CACHING_LIFETIME_CURRENT; @@ -182,7 +169,6 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase } else { $_compile_id = '$_smarty_tpl->compile_id'; } - // if subtemplate will be called in nocache mode do not merge if ($compiler->template->caching && $call_nocache) { $merge_compiled_includes = false; @@ -200,7 +186,6 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase $_assign = $_attr[ 'assign' ]; } } - $has_compiled_template = false; if ($merge_compiled_includes) { $c_id = isset($_attr[ 'compile_id' ]) ? $_attr[ 'compile_id' ] : $compiler->template->compile_id; @@ -232,17 +217,17 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase $_vars = 'array(' . join(',', $_pairs) . ')'; } $update_compile_id = $compiler->template->caching && !$compiler->tag_nocache && !$compiler->nocache && - $_compile_id != '$_smarty_tpl->compile_id'; + $_compile_id !== '$_smarty_tpl->compile_id'; if ($has_compiled_template && !$call_nocache) { $_output = "<?php\n"; if ($update_compile_id) { $_output .= $compiler->makeNocacheCode("\$_compile_id_save[] = \$_smarty_tpl->compile_id;\n\$_smarty_tpl->compile_id = {$_compile_id};\n"); } - if (!empty($_attr) && $_caching == 9999 && $compiler->template->caching) { + if (!empty($_attr) && $_caching === 9999 && $compiler->template->caching) { $_vars_nc = "foreach ($_vars as \$ik => \$iv) {\n"; $_vars_nc .= "\$_smarty_tpl->tpl_vars[\$ik] = new Smarty_Variable(\$iv);\n"; $_vars_nc .= "}\n"; - $_output .= substr($compiler->processNocacheCode('<?php ' . $_vars_nc . "?>\n", true), 6, - 3); + $_output .= substr($compiler->processNocacheCode('<?php ' . $_vars_nc . "?>\n", true), 6, -3); } if (isset($_assign)) { $_output .= "ob_start();\n"; @@ -254,11 +239,9 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase if ($update_compile_id) { $_output .= $compiler->makeNocacheCode("\$_smarty_tpl->compile_id = array_pop(\$_compile_id_save);\n"); } - $_output .= "?>\n"; - + $_output .= "?>"; return $_output; } - if ($call_nocache) { $compiler->tag_nocache = true; } @@ -277,7 +260,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase if ($update_compile_id) { $_output .= "\$_smarty_tpl->compile_id = array_pop(\$_compile_id_save);\n"; } - $_output .= "?>\n"; + $_output .= "?>"; return $_output; } @@ -289,9 +272,12 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase * @param string $t_hash * * @return bool + * @throws \Exception + * @throws \SmartyException */ public function compileInlineTemplate(Smarty_Internal_SmartyTemplateCompiler $compiler, - Smarty_Internal_Template $tpl, $t_hash) + Smarty_Internal_Template $tpl, + $t_hash) { $uid = $tpl->source->type . $tpl->source->uid; if (!($tpl->source->handler->uncompiled) && $tpl->source->exists) { @@ -309,29 +295,30 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase $tpl->mustCompile = true; $compiler->parent_compiler->mergedSubTemplatesData[ $uid ][ $t_hash ][ 'nocache_hash' ] = $tpl->compiled->nocache_hash; - if ($compiler->template->source->type == 'file') { - $sourceInfo = $compiler->template->source->filepath; + if ($tpl->source->type === 'file') { + $sourceInfo = $tpl->source->filepath; } else { - $basename = $compiler->template->source->handler->getBasename($compiler->template->source); - $sourceInfo = $compiler->template->source->type . ':' . - ($basename ? $basename : $compiler->template->source->name); + $basename = $tpl->source->handler->getBasename($tpl->source); + $sourceInfo = $tpl->source->type . ':' . + ($basename ? $basename : $tpl->source->name); } // get compiled code $compiled_code = "<?php\n\n"; $compiled_code .= "/* Start inline template \"{$sourceInfo}\" =============================*/\n"; - $compiled_code .= "function {$tpl->compiled->unifunc} (\$_smarty_tpl) {\n"; + $compiled_code .= "function {$tpl->compiled->unifunc} (Smarty_Internal_Template \$_smarty_tpl) {\n"; $compiled_code .= "?>\n" . $tpl->compiler->compileTemplateSource($tpl, null, $compiler->parent_compiler); $compiled_code .= "<?php\n"; $compiled_code .= "}\n?>\n"; $compiled_code .= $tpl->compiler->postFilter($tpl->compiler->blockOrFunctionCode); $compiled_code .= "<?php\n\n"; $compiled_code .= "/* End inline template \"{$sourceInfo}\" =============================*/\n"; - $compiled_code .= "?>"; + $compiled_code .= '?>'; unset($tpl->compiler); if ($tpl->compiled->has_nocache_code) { // replace nocache_hash $compiled_code = - str_replace("{$tpl->compiled->nocache_hash}", $compiler->template->compiled->nocache_hash, + str_replace("{$tpl->compiled->nocache_hash}", + $compiler->template->compiled->nocache_hash, $compiled_code); $compiler->template->compiled->has_nocache_code = true; } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include_php.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include_php.php index 77586da8b..e0aca93b3 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include_php.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include_php.php @@ -7,7 +7,6 @@ * @subpackage Compiler * @author Uwe Tews */ - /** * Smarty Internal Plugin Compile Insert Class * @@ -57,7 +56,6 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase } // check and get attributes $_attr = $this->getAttributes($compiler, $args); - /** @var Smarty_Internal_Template $_smarty_tpl * used in evaluated code */ @@ -74,8 +72,8 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase $_dir = $compiler->smarty->trusted_dir; } if (!empty($_dir)) { - foreach ((array) $_dir as $_script_dir) { - $_path = $compiler->smarty->_realpath($_script_dir . $compiler->smarty->ds . $_file, true); + foreach ((array)$_dir as $_script_dir) { + $_path = $compiler->smarty->_realpath($_script_dir . DIRECTORY_SEPARATOR . $_file, true); if (file_exists($_path)) { $_filepath = $_path; break; @@ -83,25 +81,22 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase } } } - if ($_filepath == false) { + if ($_filepath === false) { $compiler->trigger_template_error("{include_php} file '{$_file}' is not readable", null, true); } - if (isset($compiler->smarty->security_policy)) { $compiler->smarty->security_policy->isTrustedPHPDir($_filepath); } - if (isset($_attr[ 'assign' ])) { // output will be stored in a smarty variable instead of being displayed $_assign = $_attr[ 'assign' ]; } $_once = '_once'; if (isset($_attr[ 'once' ])) { - if ($_attr[ 'once' ] == 'false') { + if ($_attr[ 'once' ] === 'false') { $_once = ''; } } - if (isset($_assign)) { return "<?php ob_start();\ninclude{$_once} ('{$_filepath}');\n\$_smarty_tpl->assign({$_assign},ob_get_clean());\n?>"; } else { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_insert.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_insert.php index 02ef67c3a..e71abdce3 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_insert.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_insert.php @@ -1,5 +1,4 @@ <?php - /** * Smarty Internal Plugin Compile Insert * Compiles the {insert} tag @@ -24,7 +23,6 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase * @see Smarty_Internal_CompileBase */ public $required_attributes = array('name'); - /** * Attribute definition: Overwrites base class. * @@ -32,7 +30,6 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase * @see Smarty_Internal_CompileBase */ public $shorttag_order = array('name'); - /** * Attribute definition: Overwrites base class. * @@ -49,14 +46,12 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase * * @return string compiled code * @throws \SmartyCompilerException + * @throws \SmartyException */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { // check and get attributes $_attr = $this->getAttributes($compiler, $args); - //Does tag create output - $compiler->has_output = isset($_attr[ 'assign' ]) ? false : true; - $nocacheParam = $compiler->template->caching && ($compiler->tag_nocache || $compiler->nocache); if (!$nocacheParam) { // do not compile as nocache code @@ -66,7 +61,6 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase $_smarty_tpl = $compiler->template; $_name = null; $_script = null; - $_output = '<?php '; // save possible attributes eval('$_name = @' . $_attr[ 'name' ] . ';'); @@ -74,7 +68,7 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase // output will be stored in a smarty variable instead of being displayed $_assign = $_attr[ 'assign' ]; // create variable to make sure that the compiler knows about its nocache status - $var = trim($_attr[ 'assign' ], "'"); + $var = trim($_attr[ 'assign' ], '\''); if (isset($compiler->template->tpl_vars[ $var ])) { $compiler->template->tpl_vars[ $var ]->nocache = true; } else { @@ -96,8 +90,8 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase $_dir = $compiler->smarty instanceof SmartyBC ? $compiler->smarty->trusted_dir : null; } if (!empty($_dir)) { - foreach ((array) $_dir as $_script_dir) { - $_script_dir = rtrim($_script_dir, '/\\') . $compiler->smarty->ds; + foreach ((array)$_dir as $_script_dir) { + $_script_dir = rtrim($_script_dir, '/\\') . DIRECTORY_SEPARATOR; if (file_exists($_script_dir . $_script)) { $_filepath = $_script_dir . $_script; break; @@ -105,7 +99,7 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase } } } - if ($_filepath == false) { + if ($_filepath === false) { $compiler->trigger_template_error("{insert} missing script file '{$_script}'", null, true); } // code for script file loading @@ -113,7 +107,8 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase require_once $_filepath; if (!is_callable($_function)) { $compiler->trigger_template_error(" {insert} function '{$_function}' is not callable in script file '{$_script}'", - null, true); + null, + true); } } else { $_filepath = 'null'; @@ -122,7 +117,8 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase if (!is_callable($_function)) { // try plugin if (!$_function = $compiler->getPlugin($_name, 'insert')) { - $compiler->trigger_template_error("{insert} no function or plugin found for '{$_name}'", null, + $compiler->trigger_template_error("{insert} no function or plugin found for '{$_name}'", + null, true); } } @@ -149,7 +145,6 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase $_output .= "echo {$_function}({$_params},\$_smarty_tpl);?>"; } } - return $_output; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_ldelim.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_ldelim.php index 7251dcd6c..c22e1a637 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_ldelim.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_ldelim.php @@ -16,7 +16,7 @@ */ class Smarty_Internal_Compile_Ldelim extends Smarty_Internal_CompileBase { - /** + /** * Compiles code for the {ldelim} tag * This tag does output the left delimiter * @@ -32,9 +32,6 @@ class Smarty_Internal_Compile_Ldelim extends Smarty_Internal_CompileBase if ($_attr[ 'nocache' ] === true) { $compiler->trigger_template_error('nocache option not allowed', null, true); } - // this tag does not return compiled code - $compiler->has_code = true; - return $compiler->smarty->left_delimiter; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php index 720dd68b3..f793ecbbf 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php @@ -41,20 +41,18 @@ class Smarty_Internal_Compile_Make_Nocache extends Smarty_Internal_CompileBase /** * Compiles code for the {make_nocache} tag * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code - * @throws \SmartyCompilerException - */ - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) + */ + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { // check and get attributes $_attr = $this->getAttributes($compiler, $args); if ($compiler->template->caching) { $output = "<?php \$_smarty_tpl->smarty->ext->_make_nocache->save(\$_smarty_tpl, {$_attr[ 'var' ]});\n?>\n"; - $compiler->has_code = true; + $compiler->template->compiled->has_nocache_code = true; $compiler->suppressNocacheProcessing = true; return $output; } else { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_parent.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_parent.php new file mode 100644 index 000000000..052479aef --- /dev/null +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_parent.php @@ -0,0 +1,32 @@ +<?php +/* + * This file is part of Smarty. + * + * (c) 2015 Uwe Tews + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Smarty Internal Plugin Compile Parent Class + * + * @author Uwe Tews <uwe.tews@googlemail.com> + */ +class Smarty_Internal_Compile_Parent extends Smarty_Internal_Compile_Child +{ + + /** + * Tag name + * + * @var string + */ + public $tag = 'parent'; + + /** + * Block type + * + * @var string + */ + public $blockType = 'Parent'; +}
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php index 617564276..6c3f05aaa 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php @@ -41,17 +41,19 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi * @param string $function PHP function name * * @return string compiled code + * @throws \SmartyCompilerException + * @throws \SmartyException */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $function = null) { - if (!isset($tag[ 5 ]) || substr($tag, - 5) != 'close') { + if (!isset($tag[ 5 ]) || substr($tag, - 5) !== 'close') { // opening tag of block plugin // check and get attributes $_attr = $this->getAttributes($compiler, $args); $this->nesting ++; unset($_attr[ 'nocache' ]); list($callback, $_paramsArray, $callable) = $this->setup($compiler, $_attr, $tag, $function); - $_params = 'array(' . implode(",", $_paramsArray) . ')'; + $_params = 'array(' . implode(',', $_paramsArray) . ')'; // compile code $output = "<?php "; @@ -63,7 +65,7 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi $output .= "if (!is_callable({$callable})) {\nthrow new SmartyException('block tag \'{$tag}\' not callable or registered');\n}\n"; } $output .= "\$_smarty_tpl->smarty->_cache['_tag_stack'][] = array('{$tag}', {$_params});\n"; - $output .= "\$_block_repeat=true;\necho {$callback}({$_params}, null, \$_smarty_tpl, \$_block_repeat);\nwhile (\$_block_repeat) {\nob_start();\n?>"; + $output .= "\$_block_repeat=true;\necho {$callback}({$_params}, null, \$_smarty_tpl, \$_block_repeat);\nwhile (\$_block_repeat) {\nob_start();?>"; $this->openTag($compiler, $tag, array($_params, $compiler->nocache, $callback)); // maybe nocache because of nocache variables or nocache plugin $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; @@ -74,8 +76,6 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi } // closing tag of block plugin, restore nocache list($_params, $compiler->nocache, $callback) = $this->closeTag($compiler, substr($tag, 0, - 5)); - //Does tag create output - $compiler->has_output = isset($_params[ 'assign' ]) ? false : true; // compile code if (!isset($parameter[ 'modifier_list' ])) { $mod_pre = $mod_post = $mod_content = ''; @@ -88,13 +88,10 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi array('modifierlist' => $parameter[ 'modifier_list' ], 'value' => 'ob_get_clean()')) . ";\n"; } - $output = "<?php " . $mod_content . "\$_block_repeat=false;\n" . $mod_pre . - "echo {$callback}({$_params}, " . $mod_content2 . - ", \$_smarty_tpl, \$_block_repeat);\n" . $mod_post . "}\n"; - $output .= "array_pop(\$_smarty_tpl->smarty->_cache['_tag_stack']);"; - $output .= "?>"; + $output = "<?php {$mod_content}\$_block_repeat=false;\n{$mod_pre}echo {$callback}({$_params}, {$mod_content2}, \$_smarty_tpl, \$_block_repeat);\n{$mod_post}}\n"; + $output .= 'array_pop($_smarty_tpl->smarty->_cache[\'_tag_stack\']);?>'; } - return $output . "\n"; + return $output; } /** diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php index bf569be3a..5161da645 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php @@ -76,6 +76,8 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com * * @param array $attributes * @param \Smarty_Internal_TemplateCompilerBase $compiler + * + * @throws \SmartyException */ public function scanForProperties($attributes, Smarty_Internal_TemplateCompilerBase $compiler) { @@ -110,8 +112,9 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com public function buildPropertyPreg($named, $attributes) { if ($named) { - $this->resultOffsets[ 'named' ] = $this->startOffset + 3; - $this->propertyPreg .= "([\$]smarty[.]{$this->tagName}[.]{$attributes['name']}[.]("; + $this->resultOffsets[ 'named' ] = $this->startOffset + 4; + $this->propertyPreg .= "(([\$]smarty[.]{$this->tagName}[.]" . ($this->tagName === 'section' ? "|[\[]\s*" : '') + . "){$attributes['name']}[.]("; $properties = $this->nameProperties; } else { $this->resultOffsets[ 'item' ] = $this->startOffset + 3; @@ -161,6 +164,8 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com * Find matches in all parent template source * * @param \Smarty_Internal_TemplateCompilerBase $compiler + * + * @throws \SmartyException */ public function matchParentTemplateSource(Smarty_Internal_TemplateCompilerBase $compiler) { @@ -171,7 +176,7 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com if ($compiler !== $nextCompiler) { // get template source $_content = $nextCompiler->template->source->getContent(); - if ($_content != '') { + if ($_content !== '') { // run pre filter if required if ((isset($nextCompiler->smarty->autoload_filters[ 'pre' ]) || isset($nextCompiler->smarty->registered_filters[ 'pre' ])) diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php index 26529bb68..9e9c65f59 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php @@ -42,6 +42,8 @@ class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_Co * @param string $function PHP function name * * @return string compiled code + * @throws \SmartyCompilerException + * @throws \SmartyException */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $function) { @@ -58,7 +60,7 @@ class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_Co $_paramsArray[] = "'$_key'=>$_value"; } } - $_params = 'array(' . implode(",", $_paramsArray) . ')'; + $_params = 'array(' . implode(',', $_paramsArray) . ')'; // compile code $output = "{$function}({$_params},\$_smarty_tpl)"; if (!empty($parameter[ 'modifierlist' ])) { @@ -66,8 +68,6 @@ class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_Co array('modifierlist' => $parameter[ 'modifierlist' ], 'value' => $output)); } - //Does tag create output - $compiler->has_output = true; $output = "<?php echo {$output};?>\n"; return $output; } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php index 2ee88db48..e83b7a243 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php @@ -26,6 +26,7 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa * * @return string compiled code * @throws \SmartyCompilerException + * @throws \SmartyException */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) { @@ -34,6 +35,7 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa $output = $parameter[ 'value' ]; // loop over list of modifiers foreach ($parameter[ 'modifierlist' ] as $single_modifier) { + /* @var string $modifier */ $modifier = $single_modifier[ 0 ]; $single_modifier[ 0 ] = $output; $params = implode(',', $single_modifier); @@ -48,20 +50,13 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa case 1: // registered modifier if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])) { - $function = - $compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ]; - if (!is_array($function)) { - $output = "{$function}({$params})"; - } else { - if (is_object($function[ 0 ])) { - $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . - $modifier . '\'][0][0]->' . $function[ 1 ] . '(' . $params . ')'; - } else { - $output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')'; - } + if (is_callable($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ])) { + $output = + sprintf('call_user_func_array($_smarty_tpl->registered_plugins[ \'%s\' ][ %s ][ 0 ], array( %s ))', + Smarty::PLUGIN_MODIFIER, var_export($modifier, true), $params); + $compiler->known_modifier_type[ $modifier ] = $type; + break 2; } - $compiler->known_modifier_type[ $modifier ] = $type; - break 2; } break; case 2: @@ -135,8 +130,8 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa } } } - if (isset($compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) || - isset($compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) + if (isset($compiler->required_plugins[ 'nocache' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) || + isset($compiler->required_plugins[ 'compiled' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) ) { // was a plugin $compiler->known_modifier_type[ $modifier ] = 4; @@ -148,10 +143,10 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa } } if (!isset($compiler->known_modifier_type[ $modifier ])) { - $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", null, true); + $compiler->trigger_template_error("unknown modifier '{$modifier}'", null, true); } } return $output; } -} +}
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php index 7f78a421e..8d6c7e397 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php @@ -34,14 +34,13 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co * @param string $method name of method to call * * @return string compiled code + * @throws \SmartyCompilerException + * @throws \SmartyException */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $method) { // check and get attributes $_attr = $this->getAttributes($compiler, $args); - //Does tag create output - $compiler->has_output = isset($_attr[ 'assign' ]) ? false : true; - unset($_attr[ 'nocache' ]); $_assign = null; if (isset($_attr[ 'assign' ])) { @@ -60,10 +59,10 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co $_paramsArray[] = "'$_key'=>$_value"; } } - $_params = 'array(' . implode(",", $_paramsArray) . ')'; + $_params = 'array(' . implode(',', $_paramsArray) . ')'; $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params},\$_smarty_tpl)"; } else { - $_params = implode(",", $_attr); + $_params = implode(',', $_attr); $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})"; } } else { @@ -74,9 +73,6 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co $output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => $parameter[ 'modifierlist' ], 'value' => $output)); } - //Does tag create output - $compiler->has_output = isset($_attr[ 'assign' ]) ? false : true; - if (empty($_assign)) { return "<?php echo {$output};?>\n"; } else { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_php.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_php.php index 8bff8499f..1d100f0d2 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_php.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_php.php @@ -40,38 +40,34 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase // check and get attributes $_attr = $this->getAttributes($compiler, $args); $compiler->has_code = false; - if ($_attr[ 'type' ] == 'xml') { + if ($_attr[ 'type' ] === 'xml') { $compiler->tag_nocache = true; $output = addcslashes($_attr[ 'code' ], "'\\"); $compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser, - $compiler->processNocacheCode("<?php echo '" . - $output . - "';?>", + $compiler->processNocacheCode("<?php echo '{$output}';?>", true))); return ''; } - if ($_attr[ 'type' ] != 'tag') { - if ($compiler->php_handling == Smarty::PHP_REMOVE) { + if ($_attr[ 'type' ] !== 'tag') { + if ($compiler->php_handling === Smarty::PHP_REMOVE) { return ''; - } elseif ($compiler->php_handling == Smarty::PHP_QUOTE) { + } elseif ($compiler->php_handling === Smarty::PHP_QUOTE) { $output = preg_replace_callback('#(<\?(?:php|=)?)|(<%)|(<script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*>)|(\?>)|(%>)|(<\/script>)#i', array($this, 'quote'), $_attr[ 'code' ]); $compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Text($output)); return ''; - } elseif ($compiler->php_handling == Smarty::PHP_PASSTHRU || $_attr[ 'type' ] == 'unmatched') { + } elseif ($compiler->php_handling === Smarty::PHP_PASSTHRU || $_attr[ 'type' ] === 'unmatched') { $compiler->tag_nocache = true; $output = addcslashes($_attr[ 'code' ], "'\\"); $compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser, - $compiler->processNocacheCode("<?php echo '" . - $output . - "';?>", + $compiler->processNocacheCode("<?php echo '{$output}';?>", true))); return ''; - } elseif ($compiler->php_handling == Smarty::PHP_ALLOW) { + } elseif ($compiler->php_handling === Smarty::PHP_ALLOW) { if (!($compiler->smarty instanceof SmartyBC)) { $compiler->trigger_template_error('$smarty->php_handling PHP_ALLOW not allowed. Use SmartyBC to enable it', null, true); @@ -91,10 +87,10 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase $rdel = preg_quote($compiler->smarty->right_delimiter, '#'); preg_match("#^({$ldel}php\\s*)((.)*?)({$rdel})#", $_attr[ 'code' ], $match); if (!empty($match[ 2 ])) { - if ('nocache' == trim($match[ 2 ])) { + if ('nocache' === trim($match[ 2 ])) { $compiler->tag_nocache = true; } else { - $compiler->trigger_template_error("illegal value of option flag \"{$match[2]}\"", null, true); + $compiler->trigger_template_error("illegal value of option flag '{$match[2]}'", null, true); } } return preg_replace(array("#^{$ldel}\\s*php\\s*(.)*?{$rdel}#", "#{$ldel}\\s*/\\s*php\\s*{$rdel}$#"), @@ -107,9 +103,11 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase * * This code has been moved from lexer here fo easier debugging and maintenance * - * @param $lex + * @param Smarty_Internal_Templatelexer $lex + * + * @throws \SmartyCompilerException */ - public function parsePhp($lex) + public function parsePhp(Smarty_Internal_Templatelexer $lex) { $lex->token = Smarty_Internal_Templateparser::TP_PHP; $close = 0; @@ -142,16 +140,16 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase return; } $closeTag = "{$lex->smarty->left_delimiter}/php{$lex->smarty->right_delimiter}"; - if ($lex->value == $closeTag) { + if ($lex->value === $closeTag) { $lex->compiler->trigger_template_error("unexpected closing tag '{$closeTag}'"); } $lex->phpType = 'tag'; } - if ($lex->phpType == 'unmatched') { + if ($lex->phpType === 'unmatched') { return; } - if (($lex->phpType == 'php' || $lex->phpType == 'asp') && - ($lex->compiler->php_handling == Smarty::PHP_PASSTHRU || $lex->compiler->php_handling == Smarty::PHP_QUOTE) + if (($lex->phpType === 'php' || $lex->phpType === 'asp') && + ($lex->compiler->php_handling === Smarty::PHP_PASSTHRU || $lex->compiler->php_handling === Smarty::PHP_QUOTE) ) { return; } @@ -171,7 +169,7 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase $body = false; } else { $start = $pos + strlen($value); - $phpCommentStart = $value == '/*'; + $phpCommentStart = $value === '/*'; if ($phpCommentStart) { $phpCommentEnd = preg_match('~([*][/])~', $lex->data, $match, PREG_OFFSET_CAPTURE, $start); if ($phpCommentEnd) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php index 811996bcc..2dde69488 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php @@ -67,7 +67,7 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C preg_match_all('/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/', $single_default_modifier, $mod_array); for ($i = 0, $count = count($mod_array[ 0 ]); $i < $count; $i ++) { - if ($mod_array[ 0 ][ $i ] != ':') { + if ($mod_array[ 0 ][ $i ] !== ':') { $modifierlist[ $key ][] = $mod_array[ 0 ][ $i ]; } } @@ -100,18 +100,18 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C if (isset($compiler->smarty->autoload_filters[ Smarty::FILTER_VARIABLE ])) { foreach ((array) $compiler->template->smarty->autoload_filters[ Smarty::FILTER_VARIABLE ] as $name) { - $result = $this->compile_output_filter($compiler, $name, $output); + $result = $this->compile_variable_filter($compiler, $name, $output); if ($result !== false) { $output = $result; } else { // not found, throw exception - throw new SmartyException("Unable to load filter '{$name}'"); + throw new SmartyException("Unable to load variable filter '{$name}'"); } } } foreach ($compiler->variable_filters as $filter) { - if (count($filter) == 1 && - ($result = $this->compile_output_filter($compiler, $filter[ 0 ], $output)) !== false + if (count($filter) === 1 && + ($result = $this->compile_variable_filter($compiler, $filter[ 0 ], $output)) !== false ) { $output = $result; } else { @@ -120,9 +120,7 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C } } } - - $compiler->has_output = true; - $output = "<?php echo {$output};?>"; + $output = "<?php echo {$output};?>\n"; } return $output; @@ -134,29 +132,16 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C * @param string $output embedded output * * @return string + * @throws \SmartyException */ - private function compile_output_filter(Smarty_Internal_TemplateCompilerBase $compiler, $name, $output) + private function compile_variable_filter(Smarty_Internal_TemplateCompilerBase $compiler, $name, $output) { - $plugin_name = "smarty_variablefilter_{$name}"; - $path = $compiler->smarty->loadPlugin($plugin_name); - if ($path) { - /** - if ($compiler->template->caching) { - $compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $name ][ Smarty::FILTER_VARIABLE ][ 'file' ] = - $path; - $compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $name ][ Smarty::FILTER_VARIABLE ][ 'function' ] = - $plugin_name; - } else { - $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $name ][ Smarty::FILTER_VARIABLE ][ 'file' ] = - $path; - $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $name ][ Smarty::FILTER_VARIABLE ][ 'function' ] = - $plugin_name; - } - * */ - return "{$plugin_name}({$output},\$_smarty_tpl)"; - } else { + $function= $compiler->getPlugin($name, 'variablefilter'); + if ($function) { + return "{$function}({$output},\$_smarty_tpl)"; + } else { // not found return false; - } + } } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php index 987bc96f3..bd88f1bf1 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php @@ -61,7 +61,7 @@ class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_C if (is_int($_key)) { $_paramsArray[] = "$_key=>$_value"; } elseif ($compiler->template->caching && in_array($_key, $tag_info[ 2 ])) { - $_value = str_replace("'", "^#^", $_value); + $_value = str_replace('\'', "^#^", $_value); $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^"; } else { $_paramsArray[] = "'$_key'=>$_value"; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php index 7a4cbb7f7..467f9a49a 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php @@ -33,6 +33,8 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna * @param string $tag name of function * * @return string compiled code + * @throws \SmartyCompilerException + * @throws \SmartyException */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag) { @@ -41,10 +43,12 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna unset($_attr[ 'nocache' ]); if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ])) { $tag_info = $compiler->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ]; + $is_registered = true; } else { - $tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ]; + $tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ]; + $is_registered = false; } - // not cachable? + // not cacheable? $compiler->tag_nocache = $compiler->tag_nocache || !$tag_info[ 1 ]; // convert attributes into parameter array string $_paramsArray = array(); @@ -52,31 +56,31 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna if (is_int($_key)) { $_paramsArray[] = "$_key=>$_value"; } elseif ($compiler->template->caching && in_array($_key, $tag_info[ 2 ])) { - $_value = str_replace("'", "^#^", $_value); + $_value = str_replace('\'', "^#^", $_value); $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^"; } else { $_paramsArray[] = "'$_key'=>$_value"; } } - $_params = 'array(' . implode(",", $_paramsArray) . ')'; - $function = $tag_info[ 0 ]; + $_params = 'array(' . implode(',', $_paramsArray) . ')'; // compile code - if (!is_array($function)) { - $output = "{$function}({$_params},\$_smarty_tpl)"; - } elseif (is_object($function[ 0 ])) { + if ($is_registered) { $output = - "\$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0][0]->{$function[1]}({$_params},\$_smarty_tpl)"; + "call_user_func_array( \$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0], array( {$_params},\$_smarty_tpl ) )"; } else { - $output = "{$function[0]}::{$function[1]}({$_params},\$_smarty_tpl)"; + $function = $tag_info[ 0 ]; + if (!is_array($function)) { + $output = "{$function}({$_params},\$_smarty_tpl)"; + } else { + $output = "{$function[0]}::{$function[1]}({$_params},\$_smarty_tpl)"; + } } if (!empty($parameter[ 'modifierlist' ])) { $output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => $parameter[ 'modifierlist' ], 'value' => $output)); } - //Does tag create output - $compiler->has_output = true; $output = "<?php echo {$output};?>\n"; return $output; } -} +}
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_rdelim.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_rdelim.php index 2e6b43c17..e3d034da1 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_rdelim.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_rdelim.php @@ -14,7 +14,7 @@ * @package Smarty * @subpackage Compiler */ -class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_CompileBase +class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_Compile_Ldelim { /** * Compiles code for the {rdelim} tag @@ -28,13 +28,7 @@ class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_CompileBase */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { - $_attr = $this->getAttributes($compiler, $args); - if ($_attr[ 'nocache' ] === true) { - $compiler->trigger_template_error('nocache option not allowed', null, true); - } - // this tag does not return compiled code - $compiler->has_code = true; - + parent::compile($args,$compiler); return $compiler->smarty->right_delimiter; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php index c3701fc63..6e80e0fde 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php @@ -84,6 +84,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo * * @return string compiled code * @throws \SmartyCompilerException + * @throws \SmartyException */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { @@ -103,8 +104,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo // maybe nocache because of nocache variables $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; - $initLocal = - array('saved' => "isset(\$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}']) ? \$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}'] : false",); + $initLocal = array(); $initNamedProperty = array(); $initFor = array(); $incFor = array(); @@ -140,12 +140,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $v = "(is_array(@\$_loop=$attr_value) ? count(\$_loop) : max(0, (int) \$_loop))"; $t = 1; } - if (isset($namedAttr[ 'loop' ])) { - $initNamedProperty[ 'loop' ] = "'loop' => {$v}"; - if ($t == 1) { - $v = "{$sectionVar}->value['loop']"; - } - } elseif ($t == 1) { + if ($t === 1) { $initLocal[ 'loop' ] = $v; $v = "{$local}loop"; } @@ -162,11 +157,11 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo case 'step': if (is_numeric($attr_value)) { $v = (int) $attr_value; - $v = ($v == 0) ? 1 : $v; + $v = ($v === 0) ? 1 : $v; $t = 0; break; } - $initLocal[ 'step' ] = "((int)@$attr_value) == 0 ? 1 : (int)@$attr_value"; + $initLocal[ 'step' ] = "((int)@$attr_value) === 0 ? 1 : (int)@$attr_value"; $v = "{$local}step"; $t = 2; break; @@ -182,7 +177,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $t = 3; break; } - if ($t == 3 && $compiler->getId($attr_value)) { + if ($t === 3 && $compiler->getId($attr_value)) { $t = 1; } $propValue[ $attr_name ] = $v; @@ -198,8 +193,8 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $incFor[ 'iteration' ] = "{$propValue['iteration']}++"; $initFor[ 'iteration' ] = "{$propValue['iteration']} = 1"; - if ($propType[ 'step' ] == 0) { - if ($propValue[ 'step' ] == 1) { + if ($propType[ 'step' ] === 0) { + if ($propValue[ 'step' ] === 1) { $incFor[ 'index' ] = "{$sectionVar}->value['index']++"; } elseif ($propValue[ 'step' ] > 1) { $incFor[ 'index' ] = "{$sectionVar}->value['index'] += {$propValue['step']}"; @@ -213,7 +208,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo if (!isset($propValue[ 'max' ])) { $propValue[ 'max' ] = $propValue[ 'loop' ]; $propType[ 'max' ] = $propType[ 'loop' ]; - } elseif ($propType[ 'max' ] != 0) { + } elseif ($propType[ 'max' ] !== 0) { $propValue[ 'max' ] = "{$propValue['max']} < 0 ? {$propValue['loop']} : {$propValue['max']}"; $propType[ 'max' ] = 1; } else { @@ -226,11 +221,11 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo if (!isset($propValue[ 'start' ])) { $start_code = array(1 => "{$propValue['step']} > 0 ? ", 2 => '0', 3 => ' : ', 4 => $propValue[ 'loop' ], 5 => ' - 1'); - if ($propType[ 'loop' ] == 0) { + if ($propType[ 'loop' ] === 0) { $start_code[ 5 ] = ''; $start_code[ 4 ] = $propValue[ 'loop' ] - 1; } - if ($propType[ 'step' ] == 0) { + if ($propType[ 'step' ] === 0) { if ($propValue[ 'step' ] > 0) { $start_code = array(1 => '0'); $propType[ 'start' ] = 0; @@ -248,9 +243,9 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo 5 => ' : ', 6 => '-1', 7 => ', ', 8 => "{$propValue['start']} + {$propValue['loop']}", 10 => ')', 11 => ' : ', 12 => 'min(', 13 => $propValue[ 'start' ], 14 => ', ', 15 => "{$propValue['step']} > 0 ? ", 16 => $propValue[ 'loop' ], 17 => ' : ', - 18 => $propType[ 'loop' ] == 0 ? $propValue[ 'loop' ] - 1 : "{$propValue['loop']} - 1", + 18 => $propType[ 'loop' ] === 0 ? $propValue[ 'loop' ] - 1 : "{$propValue['loop']} - 1", 19 => ')'); - if ($propType[ 'step' ] == 0) { + if ($propType[ 'step' ] === 0) { $start_code[ 3 ] = $start_code[ 5 ] = $start_code[ 15 ] = $start_code[ 17 ] = ''; if ($propValue[ 'step' ] > 0) { $start_code[ 6 ] = $start_code[ 18 ] = ''; @@ -258,8 +253,8 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $start_code[ 4 ] = $start_code[ 16 ] = ''; } } - if ($propType[ 'start' ] == 0) { - if ($propType[ 'loop' ] == 0) { + if ($propType[ 'start' ] === 0) { + if ($propType[ 'loop' ] === 0) { $start_code[ 8 ] = $propValue[ 'start' ] + $propValue[ 'loop' ]; } $propType[ 'start' ] = $propType[ 'step' ] + $propType[ 'loop' ]; @@ -268,7 +263,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo for ($i = 11; $i <= 19; $i ++) { $start_code[ $i ] = ''; } - if ($propType[ 'start' ] == 0) { + if ($propType[ 'start' ] === 0) { $start_code = array(max($propValue[ 'step' ] > 0 ? 0 : - 1, $propValue[ 'start' ] + $propValue[ 'loop' ])); } @@ -276,7 +271,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo for ($i = 1; $i <= 11; $i ++) { $start_code[ $i ] = ''; } - if ($propType[ 'start' ] == 0) { + if ($propType[ 'start' ] === 0) { $start_code = array(min($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] : $propValue[ 'loop' ] - 1, $propValue[ 'start' ])); @@ -285,7 +280,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo } $propValue[ 'start' ] = join('', $start_code); } - if ($propType[ 'start' ] != 0) { + if ($propType[ 'start' ] !== 0) { $initLocal[ 'start' ] = $propValue[ 'start' ]; $propValue[ 'start' ] = "{$local}start"; } @@ -298,7 +293,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo } else { $propType[ 'total' ] = $propType[ 'start' ] + $propType[ 'loop' ] + $propType[ 'step' ] + $propType[ 'max' ]; - if ($propType[ 'total' ] == 0) { + if ($propType[ 'total' ] === 0) { $propValue[ 'total' ] = min(ceil(($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] - $propValue[ 'start' ] : (int) $propValue[ 'start' ] + 1) / abs($propValue[ 'step' ])), $propValue[ 'max' ]); @@ -310,17 +305,17 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo if (!isset($propValue[ 'max' ])) { $total_code[ 1 ] = $total_code[ 17 ] = ''; } - if ($propType[ 'loop' ] + $propType[ 'start' ] == 0) { + if ($propType[ 'loop' ] + $propType[ 'start' ] === 0) { $total_code[ 5 ] = $propValue[ 'loop' ] - $propValue[ 'start' ]; $total_code[ 6 ] = $total_code[ 7 ] = ''; } - if ($propType[ 'start' ] == 0) { + if ($propType[ 'start' ] === 0) { $total_code[ 9 ] = (int) $propValue[ 'start' ] + 1; $total_code[ 10 ] = ''; } - if ($propType[ 'step' ] == 0) { + if ($propType[ 'step' ] === 0) { $total_code[ 13 ] = $total_code[ 15 ] = ''; - if ($propValue[ 'step' ] == 1 || $propValue[ 'step' ] == - 1) { + if ($propValue[ 'step' ] === 1 || $propValue[ 'step' ] === - 1) { $total_code[ 2 ] = $total_code[ 12 ] = $total_code[ 14 ] = $total_code[ 16 ] = ''; } elseif ($propValue[ 'step' ] < 0) { $total_code[ 14 ] = - $propValue[ 'step' ]; @@ -337,7 +332,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo } if (isset($namedAttr[ 'loop' ])) { - $initNamedProperty[ 'loop' ] = "'loop' => {$propValue['total']}"; + $initNamedProperty[ 'loop' ] = "'loop' => {$propValue['loop']}"; } if (isset($namedAttr[ 'total' ])) { $initNamedProperty[ 'total' ] = "'total' => {$propValue['total']}"; @@ -357,9 +352,9 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $_vars = 'array(' . join(', ', $initNamedProperty) . ')'; $output .= "{$sectionVar} = new Smarty_Variable({$_vars});\n"; - $cond_code = "{$propValue['total']} != 0"; - if ($propType[ 'total' ] == 0) { - if ($propValue[ 'total' ] == 0) { + $cond_code = "{$propValue['total']} !== 0"; + if ($propType[ 'total' ] === 0) { + if ($propValue[ 'total' ] === 0) { $cond_code = 'false'; } else { $cond_code = 'true'; @@ -368,7 +363,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo if ($propType[ 'show' ] > 0) { $output .= "{$local}show = {$propValue['show']} ? {$cond_code} : false;\n"; $output .= "if ({$local}show) {\n"; - } elseif ($propValue[ 'show' ] == 'true') { + } elseif ($propValue[ 'show' ] === 'true') { $output .= "if ({$cond_code}) {\n"; } else { $output .= "if (false) {\n"; @@ -387,12 +382,12 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $output .= "{$sectionVar}->value['index_next'] = {$propValue['index']} + {$propValue['step']};\n"; } if (isset($namedAttr[ 'first' ])) { - $output .= "{$sectionVar}->value['first'] = ({$propValue['iteration']} == 1);\n"; + $output .= "{$sectionVar}->value['first'] = ({$propValue['iteration']} === 1);\n"; } if (isset($namedAttr[ 'last' ])) { - $output .= "{$sectionVar}->value['last'] = ({$propValue['iteration']} == {$propValue['total']});\n"; + $output .= "{$sectionVar}->value['last'] = ({$propValue['iteration']} === {$propValue['total']});\n"; } - $output .= "?>"; + $output .= '?>'; return $output; } @@ -454,15 +449,12 @@ class Smarty_Internal_Compile_Sectionclose extends Smarty_Internal_CompileBase $this->closeTag($compiler, array('section', 'sectionelse')); $output = "<?php\n"; - if ($openTag == 'sectionelse') { + if ($openTag === 'sectionelse') { $output .= "}\n"; } else { $output .= "}\n}\n"; } - $output .= "if ({$local}saved) {\n"; - $output .= "{$sectionVar} = {$local}saved;\n"; - $output .= "}\n"; - $output .= "?>"; + $output .= '?>'; return $output; } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php index c95576596..a32173cd6 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php @@ -17,30 +17,32 @@ class Smarty_Internal_Compile_Shared_Inheritance extends Smarty_Internal_CompileBase { /** - * Register post compile callback to compile inheritance initialization code + * Compile inheritance initialization code as prefix * * @param \Smarty_Internal_TemplateCompilerBase $compiler * @param bool|false $initChildSequence if true force child template */ - public function registerInit(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false) + static function postCompile(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false) { - if ($initChildSequence || !isset($compiler->_cache[ 'inheritanceInit' ])) { - $compiler->registerPostCompileCallback(array('Smarty_Internal_Compile_Shared_Inheritance', 'postCompile'), - array($initChildSequence), 'inheritanceInit', $initChildSequence); - - $compiler->_cache[ 'inheritanceInit' ] = true; - } + $compiler->prefixCompiledCode .= "<?php \$_smarty_tpl->_loadInheritance();\n\$_smarty_tpl->inheritance->init(\$_smarty_tpl, " . + var_export($initChildSequence, true) . ");\n?>\n"; } /** - * Compile inheritance initialization code as prefix + * Register post compile callback to compile inheritance initialization code * * @param \Smarty_Internal_TemplateCompilerBase $compiler * @param bool|false $initChildSequence if true force child template */ - static function postCompile(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false) + public function registerInit(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false) { - $compiler->prefixCompiledCode .= "<?php \$_smarty_tpl->_loadInheritance();\n\$_smarty_tpl->inheritance->init(\$_smarty_tpl, " . - var_export($initChildSequence, true) . ");\n?>\n"; + if ($initChildSequence || !isset($compiler->_cache['inheritanceInit'])) { + $compiler->registerPostCompileCallback(array('Smarty_Internal_Compile_Shared_Inheritance', 'postCompile'), + array($initChildSequence), + 'inheritanceInit', + $initChildSequence); + + $compiler->_cache['inheritanceInit'] = true; + } } }
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_while.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_while.php index 6025798c5..328d6551d 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_while.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_while.php @@ -33,8 +33,8 @@ class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase $_attr = $this->getAttributes($compiler, $args); $this->openTag($compiler, 'while', $compiler->nocache); - if (!array_key_exists("if condition", $parameter)) { - $compiler->trigger_template_error("missing while condition", null, true); + if (!array_key_exists('if condition', $parameter)) { + $compiler->trigger_template_error('missing while condition', null, true); } // maybe nocache because of nocache variables @@ -52,15 +52,15 @@ class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase $prefixVar = $compiler->getNewPrefixVariable(); $assignCompiler = new Smarty_Internal_Compile_Assign(); $assignAttr = array(); - $assignAttr[][ 'value' ] = "{$prefixVar}"; + $assignAttr[][ 'value' ] = $prefixVar; if (is_array($parameter[ 'if condition' ][ 'var' ])) { $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; - $_output = "<?php while ({$prefixVar} = " . $parameter[ 'if condition' ][ 'value' ] . ") {?>"; + $_output = "<?php while ({$prefixVar} = {$parameter[ 'if condition' ][ 'value' ]}) {?>"; $_output .= $assignCompiler->compile($assignAttr, $compiler, array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])); } else { $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ]; - $_output = "<?php while ({$prefixVar} = " . $parameter[ 'if condition' ][ 'value' ] . ") {?>"; + $_output = "<?php while ({$prefixVar} = {$parameter[ 'if condition' ][ 'value' ]}) {?>"; $_output .= $assignCompiler->compile($assignAttr, $compiler, array()); } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compilebase.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compilebase.php index 08aab6f4e..656672b98 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compilebase.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compilebase.php @@ -45,15 +45,15 @@ abstract class Smarty_Internal_CompileBase public $option_flags = array('nocache'); /** - * Mapping array for boolqn option value - * + * Mapping array for boolean option value + * * @var array */ public $optionMap = array(1 => true, 0 => false, 'true' => true, 'false' => false); /** * Mapping array with attributes as key - * + * * @var array */ public $mapCache = array(); @@ -117,11 +117,11 @@ abstract class Smarty_Internal_CompileBase // 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); + $compiler->trigger_template_error("missing '{$attr}' attribute", null, true); } } // check for not allowed attributes - if ($this->optional_attributes != array('_any')) { + if ($this->optional_attributes !== array('_any')) { if (!isset($this->mapCache[ 'all' ])) { $this->mapCache[ 'all' ] = array_fill_keys(array_merge($this->required_attributes, $this->optional_attributes, @@ -129,7 +129,7 @@ abstract class Smarty_Internal_CompileBase } foreach ($_indexed_attr as $key => $dummy) { if (!isset($this->mapCache[ 'all' ][ $key ]) && $key !== 0) { - $compiler->trigger_template_error("unexpected \"" . $key . "\" attribute", null, true); + $compiler->trigger_template_error("unexpected '{$key}' attribute", null, true); } } } @@ -183,13 +183,12 @@ abstract class Smarty_Internal_CompileBase } } // wrong nesting of tags - $compiler->trigger_template_error("unclosed {$compiler->smarty->left_delimiter}" . $_openTag . - "{$compiler->smarty->right_delimiter} tag"); + $compiler->trigger_template_error("unclosed '{$compiler->smarty->left_delimiter}{$_openTag}{$compiler->smarty->right_delimiter}' tag"); return; } // wrong nesting of tags - $compiler->trigger_template_error("unexpected closing tag", null, true); + $compiler->trigger_template_error('unexpected closing tag', null, true); return; } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_config_file_compiler.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_config_file_compiler.php index b1ef958cd..ada38869d 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_config_file_compiler.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_config_file_compiler.php @@ -97,33 +97,38 @@ class Smarty_Internal_Config_File_Compiler * @param Smarty_Internal_Template $template * * @return bool true if compiling succeeded, false if it failed + * @throws \SmartyException */ public function compileTemplate(Smarty_Internal_Template $template) { $this->template = $template; $this->template->compiled->file_dependency[ $this->template->source->uid ] = - array($this->template->source->filepath, $this->template->source->getTimeStamp(), + array($this->template->source->filepath, + $this->template->source->getTimeStamp(), $this->template->source->type); if ($this->smarty->debugging) { - if (!isset( $this->smarty->_debug)) { - $this->smarty->_debug = new Smarty_Internal_Debug(); + if (!isset($this->smarty->_debug)) { + $this->smarty->_debug = new Smarty_Internal_Debug(); } $this->smarty->_debug->start_compile($this->template); } // init the lexer/parser to compile the config file - /* @var Smarty_Internal_ConfigFileLexer $this->lex */ - $this->lex = new $this->lexer_class(str_replace(array("\r\n", "\r"), "\n", $template->source->getContent()) . "\n", - $this); - /* @var Smarty_Internal_ConfigFileParser $this->parser */ + /* @var Smarty_Internal_ConfigFileLexer $this ->lex */ + $this->lex = new $this->lexer_class(str_replace(array("\r\n", + "\r"), "\n", $template->source->getContent()) . "\n", + $this); + /* @var Smarty_Internal_ConfigFileParser $this ->parser */ $this->parser = new $this->parser_class($this->lex, $this); - if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { + if (function_exists('mb_internal_encoding') + && function_exists('ini_get') + && ((int) ini_get('mbstring.func_overload')) & 2 + ) { $mbEncoding = mb_internal_encoding(); mb_internal_encoding('ASCII'); } else { $mbEncoding = null; } - if ($this->smarty->_parserdebug) { $this->parser->PrintTrace(); } @@ -147,7 +152,7 @@ class Smarty_Internal_Config_File_Compiler $template_header = "<?php /* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") . "\n"; - $template_header .= " compiled from \"" . $this->template->source->filepath . "\" */ ?>\n"; + $template_header .= " compiled from '{$this->template->source->filepath}' */ ?>\n"; $code = '<?php $_smarty_tpl->smarty->ext->configLoad->_loadConfigVars($_smarty_tpl, ' . var_export($this->config_data, true) . '); ?>'; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfilelexer.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfilelexer.php index 7869ef384..454c9f828 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfilelexer.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfilelexer.php @@ -21,90 +21,72 @@ */ class Smarty_Internal_Configfilelexer { + const START = 1; + const VALUE = 2; + const NAKED_STRING_VALUE = 3; + const COMMENT = 4; + const SECTION = 5; + const TRIPPLE = 6; /** * Source * * @var string */ public $data; - /** * Source length * * @var int */ public $dataLength = null; - /** * byte counter * * @var int */ public $counter; - /** * token number * * @var int */ public $token; - /** * token value * * @var string */ public $value; - /** * current line * * @var int */ public $line; - /** * state number * * @var int */ public $state = 1; - /** * Smarty object * * @var Smarty */ public $smarty = null; - - /** - * compiler object - * - * @var Smarty_Internal_Config_File_Compiler - */ - private $compiler = null; - - /** - * copy of config_booleanize - * - * @var bool - */ - private $configBooleanize = false; - /** * trace file * * @var resource */ public $yyTraceFILE; - /** * trace prompt * * @var string */ public $yyTracePrompt; - /** * state names * @@ -112,31 +94,38 @@ class Smarty_Internal_Configfilelexer */ public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', 6 => 'TRIPPLE'); - + /** + * token names + * + * @var array + */ + public $smarty_token_names = array( // Text for parser error messages + ); + /** + * compiler object + * + * @var Smarty_Internal_Config_File_Compiler + */ + private $compiler = null; + /** + * copy of config_booleanize + * + * @var bool + */ + private $configBooleanize = false; /** * storage for assembled token patterns * * @var string */ private $yy_global_pattern1 = null; - private $yy_global_pattern2 = null; - private $yy_global_pattern3 = null; - private $yy_global_pattern4 = null; - private $yy_global_pattern5 = null; - private $yy_global_pattern6 = null; - - /** - * token names - * - * @var array - */ - public $smarty_token_names = array( // Text for parser error messages - ); + private $_yy_state = 1; + private $_yy_stack = array(); /** * constructor @@ -158,16 +147,17 @@ class Smarty_Internal_Configfilelexer $this->configBooleanize = $this->smarty->config_booleanize; } + public function replace($input) + { + return $input; + } // end function + public function PrintTrace() { $this->yyTraceFILE = fopen('php://output', 'w'); $this->yyTracePrompt = '<br>'; } - private $_yy_state = 1; - - private $_yy_stack = array(); - public function yylex() { return $this->{'yylex' . $this->_yy_state}(); @@ -176,14 +166,18 @@ class Smarty_Internal_Configfilelexer public function yypushstate($state) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, + fprintf($this->yyTraceFILE, + "%sState push %s\n", + $this->yyTracePrompt, isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state); } array_push($this->_yy_stack, $this->_yy_state); $this->_yy_state = $state; if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, + fprintf($this->yyTraceFILE, + "%snew State %s\n", + $this->yyTracePrompt, isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state); } @@ -192,13 +186,17 @@ class Smarty_Internal_Configfilelexer public function yypopstate() { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, + fprintf($this->yyTraceFILE, + "%sState pop %s\n", + $this->yyTracePrompt, isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state); } $this->_yy_state = array_pop($this->_yy_stack); if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, + fprintf($this->yyTraceFILE, + "%snew State %s\n", + $this->yyTracePrompt, isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state); } @@ -208,7 +206,9 @@ class Smarty_Internal_Configfilelexer { $this->_yy_state = $state; if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, + fprintf($this->yyTraceFILE, + "%sState set %s\n", + $this->yyTracePrompt, isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state); } @@ -218,7 +218,7 @@ class Smarty_Internal_Configfilelexer { if (!isset($this->yy_global_pattern1)) { $this->yy_global_pattern1 = - "/\G(#|;)|\G(\\[)|\G(\\])|\G(=)|\G([ \t\r]+)|\G(\n)|\G([0-9]*[a-zA-Z_]\\w*)|\G([\S\s])/isS"; + $this->replace("/\G(#|;)|\G(\\[)|\G(\\])|\G(=)|\G([ \t\r]+)|\G(\n)|\G([0-9]*[a-zA-Z_]\\w*)|\G([\S\s])/isS"); } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -226,17 +226,18 @@ class Smarty_Internal_Configfilelexer if ($this->counter >= $this->dataLength) { return false; // end of input } - do { - if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, null, $this->counter)) { + if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, 0, $this->counter)) { if (!isset($yymatches[ 0 ][ 1 ])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($yymatches); } if (empty($yymatches)) { - throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . - substr($this->data, $this->counter, 5) . '... state START'); + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, + 5) . '... state START'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -247,11 +248,11 @@ class Smarty_Internal_Configfilelexer $this->line += substr_count($this->value, "\n"); // accept this token return true; - } elseif ($r === true) { + } else if ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } elseif ($r === false) { + } else if ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -261,63 +262,53 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ]); } break; - } - while (true); - } // end function - - const START = 1; + } while (true); + } function yy_r1_1() { - $this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART; $this->yypushstate(self::COMMENT); } function yy_r1_2() { - $this->token = Smarty_Internal_Configfileparser::TPC_OPENB; $this->yypushstate(self::SECTION); } function yy_r1_3() { - $this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB; } function yy_r1_4() { - $this->token = Smarty_Internal_Configfileparser::TPC_EQUAL; $this->yypushstate(self::VALUE); - } + } // end function function yy_r1_5() { - return false; } function yy_r1_6() { - $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE; } function yy_r1_7() { - $this->token = Smarty_Internal_Configfileparser::TPC_ID; } function yy_r1_8() { - $this->token = Smarty_Internal_Configfileparser::TPC_OTHER; } @@ -325,7 +316,7 @@ class Smarty_Internal_Configfilelexer { if (!isset($this->yy_global_pattern2)) { $this->yy_global_pattern2 = - "/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS"; + $this->replace("/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS"); } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -333,17 +324,18 @@ class Smarty_Internal_Configfilelexer if ($this->counter >= $this->dataLength) { return false; // end of input } - do { - if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, null, $this->counter)) { + if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, 0, $this->counter)) { if (!isset($yymatches[ 0 ][ 1 ])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($yymatches); } if (empty($yymatches)) { - throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . - substr($this->data, $this->counter, 5) . '... state VALUE'); + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, + 5) . '... state VALUE'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -354,11 +346,11 @@ class Smarty_Internal_Configfilelexer $this->line += substr_count($this->value, "\n"); // accept this token return true; - } elseif ($r === true) { + } else if ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } elseif ($r === false) { + } else if ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -368,62 +360,52 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ]); } break; - } - while (true); - } // end function - - const VALUE = 2; + } while (true); + } function yy_r2_1() { - return false; } function yy_r2_2() { - $this->token = Smarty_Internal_Configfileparser::TPC_FLOAT; $this->yypopstate(); } function yy_r2_3() { - $this->token = Smarty_Internal_Configfileparser::TPC_INT; $this->yypopstate(); } function yy_r2_4() { - $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES; $this->yypushstate(self::TRIPPLE); } function yy_r2_5() { - $this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING; $this->yypopstate(); } function yy_r2_6() { - $this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING; $this->yypopstate(); - } + } // end function function yy_r2_7() { - if (!$this->configBooleanize || - !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no")) - ) { + !in_array(strtolower($this->value), array('true', 'false', 'on', 'off', 'yes', 'no'))) { $this->yypopstate(); $this->yypushstate(self::NAKED_STRING_VALUE); return true; //reprocess in new state @@ -435,23 +417,21 @@ class Smarty_Internal_Configfilelexer function yy_r2_8() { - $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; $this->yypopstate(); } function yy_r2_9() { - $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; - $this->value = ""; + $this->value = ''; $this->yypopstate(); - } + } // end function public function yylex3() { if (!isset($this->yy_global_pattern3)) { - $this->yy_global_pattern3 = "/\G([^\n]+?(?=[ \t\r]*\n))/isS"; + $this->yy_global_pattern3 = $this->replace("/\G([^\n]+?(?=[ \t\r]*\n))/isS"); } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -459,17 +439,18 @@ class Smarty_Internal_Configfilelexer if ($this->counter >= $this->dataLength) { return false; // end of input } - do { - if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, null, $this->counter)) { + if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, 0, $this->counter)) { if (!isset($yymatches[ 0 ][ 1 ])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($yymatches); } if (empty($yymatches)) { - throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . - substr($this->data, $this->counter, 5) . '... state NAKED_STRING_VALUE'); + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, + 5) . '... state NAKED_STRING_VALUE'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -480,11 +461,11 @@ class Smarty_Internal_Configfilelexer $this->line += substr_count($this->value, "\n"); // accept this token return true; - } elseif ($r === true) { + } else if ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } elseif ($r === false) { + } else if ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -494,18 +475,15 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ]); } break; - } - while (true); - } // end function - - const NAKED_STRING_VALUE = 3; + } while (true); + } function yy_r3_1() { - $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; $this->yypopstate(); } @@ -513,7 +491,7 @@ class Smarty_Internal_Configfilelexer public function yylex4() { if (!isset($this->yy_global_pattern4)) { - $this->yy_global_pattern4 = "/\G([ \t\r]+)|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS"; + $this->yy_global_pattern4 = $this->replace("/\G([ \t\r]+)|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS"); } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -521,17 +499,18 @@ class Smarty_Internal_Configfilelexer if ($this->counter >= $this->dataLength) { return false; // end of input } - do { - if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, null, $this->counter)) { + if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, 0, $this->counter)) { if (!isset($yymatches[ 0 ][ 1 ])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($yymatches); } if (empty($yymatches)) { - throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . - substr($this->data, $this->counter, 5) . '... state COMMENT'); + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, + 5) . '... state COMMENT'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -542,11 +521,11 @@ class Smarty_Internal_Configfilelexer $this->line += substr_count($this->value, "\n"); // accept this token return true; - } elseif ($r === true) { + } else if ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } elseif ($r === false) { + } else if ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -556,30 +535,25 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ]); } break; - } - while (true); - } // end function - - const COMMENT = 4; + } while (true); + } function yy_r4_1() { - return false; } function yy_r4_2() { - $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; - } + } // end function function yy_r4_3() { - $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE; $this->yypopstate(); } @@ -587,7 +561,7 @@ class Smarty_Internal_Configfilelexer public function yylex5() { if (!isset($this->yy_global_pattern5)) { - $this->yy_global_pattern5 = "/\G(\\.)|\G(.*?(?=[\.=[\]\r\n]))/isS"; + $this->yy_global_pattern5 = $this->replace("/\G(\\.)|\G(.*?(?=[\.=[\]\r\n]))/isS"); } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -595,17 +569,18 @@ class Smarty_Internal_Configfilelexer if ($this->counter >= $this->dataLength) { return false; // end of input } - do { - if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, null, $this->counter)) { + if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, 0, $this->counter)) { if (!isset($yymatches[ 0 ][ 1 ])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($yymatches); } if (empty($yymatches)) { - throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . - substr($this->data, $this->counter, 5) . '... state SECTION'); + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, + 5) . '... state SECTION'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -616,11 +591,11 @@ class Smarty_Internal_Configfilelexer $this->line += substr_count($this->value, "\n"); // accept this token return true; - } elseif ($r === true) { + } else if ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } elseif ($r === false) { + } else if ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -630,32 +605,28 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ]); } break; - } - while (true); - } // end function - - const SECTION = 5; + } while (true); + } function yy_r5_1() { - $this->token = Smarty_Internal_Configfileparser::TPC_DOT; } function yy_r5_2() { - $this->token = Smarty_Internal_Configfileparser::TPC_SECTION; $this->yypopstate(); - } + } // end function public function yylex6() { if (!isset($this->yy_global_pattern6)) { - $this->yy_global_pattern6 = "/\G(\"\"\"(?=[ \t\r]*[\n#;]))|\G([\S\s])/isS"; + $this->yy_global_pattern6 = $this->replace("/\G(\"\"\"(?=[ \t\r]*[\n#;]))|\G([\S\s])/isS"); } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -663,17 +634,18 @@ class Smarty_Internal_Configfilelexer if ($this->counter >= $this->dataLength) { return false; // end of input } - do { - if (preg_match($this->yy_global_pattern6, $this->data, $yymatches, null, $this->counter)) { + if (preg_match($this->yy_global_pattern6, $this->data, $yymatches, 0, $this->counter)) { if (!isset($yymatches[ 0 ][ 1 ])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($yymatches); } if (empty($yymatches)) { - throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . - substr($this->data, $this->counter, 5) . '... state TRIPPLE'); + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, + 5) . '... state TRIPPLE'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -684,11 +656,11 @@ class Smarty_Internal_Configfilelexer $this->line += substr_count($this->value, "\n"); // accept this token return true; - } elseif ($r === true) { + } else if ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } elseif ($r === false) { + } else if ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -698,18 +670,15 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ]); } break; - } - while (true); - } // end function - - const TRIPPLE = 6; + } while (true); + } function yy_r6_1() { - $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END; $this->yypopstate(); $this->yypushstate(self::START); @@ -717,16 +686,14 @@ class Smarty_Internal_Configfilelexer function yy_r6_2() { - $to = strlen($this->data); preg_match("/\"\"\"[ \t\r]*[\n#;]/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); if (isset($match[ 0 ][ 1 ])) { $to = $match[ 0 ][ 1 ]; } else { - $this->compiler->trigger_template_error("missing or misspelled literal closing tag"); + $this->compiler->trigger_template_error('missing or misspelled literal closing tag'); } $this->value = substr($this->data, $this->counter, $to - $this->counter); $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT; } - } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfileparser.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfileparser.php index b7551a2b5..1c76f7bc8 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfileparser.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfileparser.php @@ -1,70 +1,5 @@ <?php -class TPC_yyToken implements ArrayAccess -{ - public $string = ''; - - public $metadata = array(); - - public function __construct($s, $m = array()) - { - if ($s instanceof TPC_yyToken) { - $this->string = $s->string; - $this->metadata = $s->metadata; - } else { - $this->string = (string) $s; - if ($m instanceof TPC_yyToken) { - $this->metadata = $m->metadata; - } elseif (is_array($m)) { - $this->metadata = $m; - } - } - } - - public function __toString() - { - return $this->string; - } - - public function offsetExists($offset) - { - return isset($this->metadata[ $offset ]); - } - - public function offsetGet($offset) - { - return $this->metadata[ $offset ]; - } - - public function offsetSet($offset, $value) - { - if ($offset === null) { - if (isset($value[ 0 ])) { - $x = ($value instanceof TPC_yyToken) ? $value->metadata : $value; - $this->metadata = array_merge($this->metadata, $x); - - return; - } - $offset = count($this->metadata); - } - if ($value === null) { - return; - } - if ($value instanceof TPC_yyToken) { - if ($value->metadata) { - $this->metadata[ $offset ] = $value->metadata; - } - } elseif ($value) { - $this->metadata[ $offset ] = $value; - } - } - - public function offsetUnset($offset) - { - unset($this->metadata[ $offset ]); - } -} - class TPC_yyStackEntry { public $stateno; /* The state-number */ @@ -74,8 +9,6 @@ class TPC_yyStackEntry ** is the value of the token */ } -; - #line 12 "../smarty/lexer/smarty_internal_configfileparser.y" /** @@ -91,74 +24,250 @@ class TPC_yyStackEntry class Smarty_Internal_Configfileparser { #line 25 "../smarty/lexer/smarty_internal_configfileparser.y" - + const TPC_OPENB = 1; + const TPC_SECTION = 2; + const TPC_CLOSEB = 3; + const TPC_DOT = 4; + const TPC_ID = 5; + const TPC_EQUAL = 6; + const TPC_FLOAT = 7; + const TPC_INT = 8; + const TPC_BOOL = 9; + const TPC_SINGLE_QUOTED_STRING = 10; + const TPC_DOUBLE_QUOTED_STRING = 11; + const TPC_TRIPPLE_QUOTES = 12; + const TPC_TRIPPLE_TEXT = 13; + const TPC_TRIPPLE_QUOTES_END = 14; + const TPC_NAKED_STRING = 15; + const TPC_OTHER = 16; + const TPC_NEWLINE = 17; + const TPC_COMMENTSTART = 18; + const YY_NO_ACTION = 60; + const YY_ACCEPT_ACTION = 59; + const YY_ERROR_ACTION = 58; + const YY_SZ_ACTTAB = 38; + const YY_SHIFT_USE_DFLT = -8; + const YY_SHIFT_MAX = 19; + const YY_REDUCE_USE_DFLT = -21; + const YY_REDUCE_MAX = 10; + const YYNOCODE = 29; + const YYSTACKDEPTH = 100; + const YYNSTATE = 36; + const YYNRULE = 22; + const YYERRORSYMBOL = 19; + const YYERRSYMDT = 'yy0'; + const YYFALLBACK = 0; + static public $yy_action = array( + 29, 30, 34, 33, 24, 13, 19, 25, 35, 21, + 59, 8, 3, 1, 20, 12, 14, 31, 20, 12, + 15, 17, 23, 18, 27, 26, 4, 5, 6, 32, + 2, 11, 28, 22, 16, 9, 7, 10, + ); + static public $yy_lookahead = array( + 7, 8, 9, 10, 11, 12, 5, 27, 15, 16, + 20, 21, 23, 23, 17, 18, 13, 14, 17, 18, + 15, 2, 17, 4, 25, 26, 6, 3, 3, 14, + 23, 1, 24, 17, 2, 25, 22, 25, + ); + static public $yy_shift_ofst = array( + -8, 1, 1, 1, -7, -3, -3, 30, -8, -8, + -8, 19, 5, 3, 15, 16, 24, 25, 32, 20, + ); + static public $yy_reduce_ofst = array( + -10, -1, -1, -1, -20, 10, 12, 8, 14, 7, + -11, + ); + static public $yyExpectedTokens = array( + array(), + array(5, 17, 18,), + array(5, 17, 18,), + array(5, 17, 18,), + array(7, 8, 9, 10, 11, 12, 15, 16,), + array(17, 18,), + array(17, 18,), + array(1,), + array(), + array(), + array(), + array(2, 4,), + array(15, 17,), + array(13, 14,), + array(14,), + array(17,), + array(3,), + array(3,), + array(2,), + array(6,), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + ); + static public $yy_default = array( + 44, 37, 41, 40, 58, 58, 58, 36, 39, 44, + 44, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 55, 54, 57, 56, 50, 45, 43, 42, 38, 46, + 47, 52, 51, 49, 48, 53, + ); + public static $yyFallback = array(); + public static $yyRuleName = array( + 'start ::= global_vars sections', + 'global_vars ::= var_list', + 'sections ::= sections section', + 'sections ::=', + 'section ::= OPENB SECTION CLOSEB newline var_list', + 'section ::= OPENB DOT SECTION CLOSEB newline var_list', + 'var_list ::= var_list newline', + 'var_list ::= var_list var', + 'var_list ::=', + 'var ::= ID EQUAL value', + 'value ::= FLOAT', + 'value ::= INT', + 'value ::= BOOL', + 'value ::= SINGLE_QUOTED_STRING', + 'value ::= DOUBLE_QUOTED_STRING', + 'value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END', + 'value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END', + 'value ::= NAKED_STRING', + 'value ::= OTHER', + 'newline ::= NEWLINE', + 'newline ::= COMMENTSTART NEWLINE', + 'newline ::= COMMENTSTART NAKED_STRING NEWLINE', + ); + public static $yyRuleInfo = array( + array(0 => 20, 1 => 2), + array(0 => 21, 1 => 1), + array(0 => 22, 1 => 2), + array(0 => 22, 1 => 0), + array(0 => 24, 1 => 5), + array(0 => 24, 1 => 6), + array(0 => 23, 1 => 2), + array(0 => 23, 1 => 2), + array(0 => 23, 1 => 0), + array(0 => 26, 1 => 3), + array(0 => 27, 1 => 1), + array(0 => 27, 1 => 1), + array(0 => 27, 1 => 1), + array(0 => 27, 1 => 1), + array(0 => 27, 1 => 1), + array(0 => 27, 1 => 3), + array(0 => 27, 1 => 2), + array(0 => 27, 1 => 1), + array(0 => 27, 1 => 1), + array(0 => 25, 1 => 1), + array(0 => 25, 1 => 2), + array(0 => 25, 1 => 3), + ); + public static $yyReduceMap = array( + 0 => 0, + 2 => 0, + 3 => 0, + 19 => 0, + 20 => 0, + 21 => 0, + 1 => 1, + 4 => 4, + 5 => 5, + 6 => 6, + 7 => 7, + 8 => 8, + 9 => 9, + 10 => 10, + 11 => 11, + 12 => 12, + 13 => 13, + 14 => 14, + 15 => 15, + 16 => 16, + 17 => 17, + 18 => 17, + ); + /** + * helper map + * + * @var array + */ + private static $escapes_single = array('\\' => '\\', + '\'' => '\''); /** * result status * * @var bool */ public $successful = true; - /** * return value * * @var mixed */ public $retvalue = 0; - /** * @var */ public $yymajor; - /** - * lexer object + * compiler object * - * @var Smarty_Internal_Configfilelexer + * @var Smarty_Internal_Config_File_Compiler */ - private $lex; - + public $compiler = null; /** - * internal error flag + * smarty object * - * @var bool + * @var Smarty */ - private $internalError = false; - + public $smarty = null; + public $yyTraceFILE; + public $yyTracePrompt; + public $yyidx; + public $yyerrcnt; + public $yystack = array(); + public $yyTokenName = array( + '$', 'OPENB', 'SECTION', 'CLOSEB', + 'DOT', 'ID', 'EQUAL', 'FLOAT', + 'INT', 'BOOL', 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING', + 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT', 'TRIPPLE_QUOTES_END', 'NAKED_STRING', + 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error', + 'start', 'global_vars', 'sections', 'var_list', + 'section', 'newline', 'var', 'value', + ); /** - * compiler object + * lexer object * - * @var Smarty_Internal_Config_File_Compiler + * @var Smarty_Internal_Configfilelexer */ - public $compiler = null; - + private $lex; /** - * smarty object + * internal error flag * - * @var Smarty + * @var bool */ - public $smarty = null; - + private $internalError = false; /** * copy of config_overwrite property * * @var bool */ private $configOverwrite = false; - /** * copy of config_read_hidden property * * @var bool */ private $configReadHidden = false; - - /** - * helper map - * - * @var array - */ - private static $escapes_single = Array('\\' => '\\', '\'' => '\''); + private $_retvalue; /** * constructor @@ -175,22 +284,12 @@ class Smarty_Internal_Configfileparser $this->configReadHidden = $this->smarty->config_read_hidden; } - /** - * parse optional boolean keywords - * - * @param string $str - * - * @return bool - */ - private function parse_bool($str) + public static function yy_destructor($yymajor, $yypminor) { - $str = strtolower($str); - if (in_array($str, array('on', 'yes', 'true'))) { - $res = true; - } else { - $res = false; + switch ($yymajor) { + default: + break; /* If no destructor action specified: do nothing */ } - return $res; } /** @@ -205,10 +304,8 @@ class Smarty_Internal_Configfileparser private static function parse_single_quoted_string($qstr) { $escaped_string = substr($qstr, 1, strlen($qstr) - 2); //remove outer quotes - - $ss = preg_split('/(\\\\.)/', $escaped_string, - 1, PREG_SPLIT_DELIM_CAPTURE); - - $str = ""; + $ss = preg_split('/(\\\\.)/', $escaped_string, -1, PREG_SPLIT_DELIM_CAPTURE); + $str = ''; foreach ($ss as $s) { if (strlen($s) === 2 && $s[ 0 ] === '\\') { if (isset(self::$escapes_single[ $s[ 1 ] ])) { @@ -218,8 +315,7 @@ class Smarty_Internal_Configfileparser $str .= $s; } return $str; - } - + } /* Index of top element in stack */ /** * parse double quoted string * @@ -231,8 +327,7 @@ class Smarty_Internal_Configfileparser { $inner_str = substr($qstr, 1, strlen($qstr) - 2); return stripcslashes($inner_str); - } - + } /* Shifts left before out of the error */ /** * parse triple quoted string * @@ -243,153 +338,12 @@ class Smarty_Internal_Configfileparser private static function parse_tripple_double_quoted_string($qstr) { return stripcslashes($qstr); - } - - /** - * set a config variable in target array - * - * @param array $var - * @param array $target_array - */ - private function set_var(Array $var, Array &$target_array) - { - $key = $var[ "key" ]; - $value = $var[ "value" ]; - - if ($this->configOverwrite || !isset($target_array[ 'vars' ][ $key ])) { - $target_array[ 'vars' ][ $key ] = $value; - } else { - settype($target_array[ 'vars' ][ $key ], 'array'); - $target_array[ 'vars' ][ $key ][] = $value; - } - } - - /** - * add config variable to global vars - * - * @param array $vars - */ - private function add_global_vars(Array $vars) - { - if (!isset($this->compiler->config_data[ 'vars' ])) { - $this->compiler->config_data[ 'vars' ] = Array(); - } - foreach ($vars as $var) { - $this->set_var($var, $this->compiler->config_data); - } - } - - /** - * add config variable to section - * - * @param string $section_name - * @param array $vars - */ - private function add_section_vars($section_name, Array $vars) - { - if (!isset($this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ])) { - $this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ] = Array(); - } - foreach ($vars as $var) { - $this->set_var($var, $this->compiler->config_data[ 'sections' ][ $section_name ]); - } - } - - const TPC_OPENB = 1; - - const TPC_SECTION = 2; - - const TPC_CLOSEB = 3; - - const TPC_DOT = 4; - - const TPC_ID = 5; - - const TPC_EQUAL = 6; - - const TPC_FLOAT = 7; - - const TPC_INT = 8; - - const TPC_BOOL = 9; - - const TPC_SINGLE_QUOTED_STRING = 10; - - const TPC_DOUBLE_QUOTED_STRING = 11; - - const TPC_TRIPPLE_QUOTES = 12; - - const TPC_TRIPPLE_TEXT = 13; - - const TPC_TRIPPLE_QUOTES_END = 14; - - const TPC_NAKED_STRING = 15; - - const TPC_OTHER = 16; - - const TPC_NEWLINE = 17; - - const TPC_COMMENTSTART = 18; - - const YY_NO_ACTION = 60; - - const YY_ACCEPT_ACTION = 59; - - const YY_ERROR_ACTION = 58; - - const YY_SZ_ACTTAB = 38; - - static public $yy_action = array(29, 30, 34, 33, 24, 13, 19, 25, 35, 21, 59, 8, 3, 1, 20, 12, 14, 31, 20, 12, 15, - 17, 23, 18, 27, 26, 4, 5, 6, 32, 2, 11, 28, 22, 16, 9, 7, 10,); - - static public $yy_lookahead = array(7, 8, 9, 10, 11, 12, 5, 27, 15, 16, 20, 21, 23, 23, 17, 18, 13, 14, 17, 18, 15, - 2, 17, 4, 25, 26, 6, 3, 3, 14, 23, 1, 24, 17, 2, 25, 22, 25,); - - const YY_SHIFT_USE_DFLT = - 8; - - const YY_SHIFT_MAX = 19; - - static public $yy_shift_ofst = array(- 8, 1, 1, 1, - 7, - 3, - 3, 30, - 8, - 8, - 8, 19, 5, 3, 15, 16, 24, 25, 32, - 20,); - - const YY_REDUCE_USE_DFLT = - 21; - - const YY_REDUCE_MAX = 10; - - static public $yy_reduce_ofst = array(- 10, - 1, - 1, - 1, - 20, 10, 12, 8, 14, 7, - 11,); - - static public $yyExpectedTokens = array(array(), array(5, 17, 18,), array(5, 17, 18,), array(5, 17, 18,), - array(7, 8, 9, 10, 11, 12, 15, 16,), array(17, 18,), array(17, 18,), - array(1,), array(), array(), array(), array(2, 4,), array(15, 17,), - array(13, 14,), array(14,), array(17,), array(3,), array(3,), array(2,), - array(6,), array(), array(), array(), array(), array(), array(), array(), - array(), array(), array(), array(), array(), array(), array(), array(), - array(),); - - static public $yy_default = array(44, 37, 41, 40, 58, 58, 58, 36, 39, 44, 44, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 55, 54, 57, 56, 50, 45, 43, 42, 38, 46, 47, 52, 51, 49, 48, 53,); - - const YYNOCODE = 29; - - const YYSTACKDEPTH = 100; - - const YYNSTATE = 36; - - const YYNRULE = 22; - - const YYERRORSYMBOL = 19; - - const YYERRSYMDT = 'yy0'; - - const YYFALLBACK = 0; - - public static $yyFallback = array(); - + } /* The parser's stack */ public function Trace($TraceFILE, $zTracePrompt) { if (!$TraceFILE) { $zTracePrompt = 0; - } elseif (!$zTracePrompt) { + } else if (!$zTracePrompt) { $TraceFILE = 0; } $this->yyTraceFILE = $TraceFILE; @@ -402,31 +356,6 @@ class Smarty_Internal_Configfileparser $this->yyTracePrompt = '<br>'; } - public $yyTraceFILE; - - public $yyTracePrompt; - - public $yyidx; /* Index of top element in stack */ - public $yyerrcnt; /* Shifts left before out of the error */ - public $yystack = array(); /* The parser's stack */ - - public $yyTokenName = array('$', 'OPENB', 'SECTION', 'CLOSEB', 'DOT', 'ID', 'EQUAL', 'FLOAT', 'INT', 'BOOL', - 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING', 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT', - 'TRIPPLE_QUOTES_END', 'NAKED_STRING', 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error', - 'start', 'global_vars', 'sections', 'var_list', 'section', 'newline', 'var', 'value',); - - public static $yyRuleName = array('start ::= global_vars sections', 'global_vars ::= var_list', - 'sections ::= sections section', 'sections ::=', - 'section ::= OPENB SECTION CLOSEB newline var_list', - 'section ::= OPENB DOT SECTION CLOSEB newline var_list', - 'var_list ::= var_list newline', 'var_list ::= var_list var', 'var_list ::=', - 'var ::= ID EQUAL value', 'value ::= FLOAT', 'value ::= INT', 'value ::= BOOL', - 'value ::= SINGLE_QUOTED_STRING', 'value ::= DOUBLE_QUOTED_STRING', - 'value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END', - 'value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END', 'value ::= NAKED_STRING', - 'value ::= OTHER', 'newline ::= NEWLINE', 'newline ::= COMMENTSTART NEWLINE', - 'newline ::= COMMENTSTART NAKED_STRING NEWLINE',); - public function tokenName($tokenType) { if ($tokenType === 0) { @@ -435,15 +364,7 @@ class Smarty_Internal_Configfileparser if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) { return $this->yyTokenName[ $tokenType ]; } else { - return "Unknown"; - } - } - - public static function yy_destructor($yymajor, $yypminor) - { - switch ($yymajor) { - default: - break; /* If no destructor action specified: do nothing */ + return 'Unknown'; } } @@ -454,12 +375,13 @@ class Smarty_Internal_Configfileparser } $yytos = array_pop($this->yystack); if ($this->yyTraceFILE && $this->yyidx >= 0) { - fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . "\n"); + fwrite($this->yyTraceFILE, + $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . + "\n"); } $yymajor = $yytos->major; self::yy_destructor($yymajor, $yytos->minor); - $this->yyidx --; - + $this->yyidx--; return $yymajor; } @@ -496,7 +418,7 @@ class Smarty_Internal_Configfileparser // reduce action $done = 0; do { - if ($done ++ == 100) { + if ($done++ === 100) { $this->yyidx = $yyidx; $this->yystack = $stack; // too much recursion prevents proper detection @@ -505,8 +427,9 @@ class Smarty_Internal_Configfileparser } $yyruleno = $yyact - self::YYNSTATE; $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; - $nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, - self::$yyRuleInfo[ $yyruleno ][ 0 ]); + $nextstate = $this->yy_find_reduce_action( + $this->yystack[ $this->yyidx ]->stateno, + self::$yyRuleInfo[ $yyruleno ][ 0 ]); if (isset(self::$yyExpectedTokens[ $nextstate ])) { $expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]); if (isset($res4[ $nextstate ][ $token ])) { @@ -517,8 +440,7 @@ class Smarty_Internal_Configfileparser } } else { if ($res4[ $nextstate ][ $token ] = - in_array($token, self::$yyExpectedTokens[ $nextstate ], true) - ) { + in_array($token, self::$yyExpectedTokens[ $nextstate ], true)) { $this->yyidx = $yyidx; $this->yystack = $stack; return array_unique($expected); @@ -527,20 +449,20 @@ class Smarty_Internal_Configfileparser } if ($nextstate < self::YYNSTATE) { // we need to shift a non-terminal - $this->yyidx ++; + $this->yyidx++; $x = new TPC_yyStackEntry; $x->stateno = $nextstate; $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ]; $this->yystack[ $this->yyidx ] = $x; continue 2; - } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) { + } else if ($nextstate === self::YYNSTATE + self::YYNRULE + 1) { $this->yyidx = $yyidx; $this->yystack = $stack; // the last token was just ignored, we can't accept // by ignoring input, this is in essence ignoring a // syntax error! return array_unique($expected); - } elseif ($nextstate === self::YY_NO_ACTION) { + } else if ($nextstate === self::YY_NO_ACTION) { $this->yyidx = $yyidx; $this->yystack = $stack; // input accepted, but not shifted (I guess) @@ -548,15 +470,12 @@ class Smarty_Internal_Configfileparser } else { $yyact = $nextstate; } - } - while (true); + } while (true); } break; - } - while (true); + } while (true); $this->yyidx = $yyidx; $this->yystack = $stack; - return array_unique($expected); } @@ -585,7 +504,7 @@ class Smarty_Internal_Configfileparser // reduce action $done = 0; do { - if ($done ++ == 100) { + if ($done++ === 100) { $this->yyidx = $yyidx; $this->yystack = $stack; // too much recursion prevents proper detection @@ -594,8 +513,9 @@ class Smarty_Internal_Configfileparser } $yyruleno = $yyact - self::YYNSTATE; $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; - $nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, - self::$yyRuleInfo[ $yyruleno ][ 0 ]); + $nextstate = $this->yy_find_reduce_action( + $this->yystack[ $this->yyidx ]->stateno, + self::$yyRuleInfo[ $yyruleno ][ 0 ]); if (isset($res2[ $nextstate ][ $token ])) { if ($res2[ $nextstate ][ $token ]) { $this->yyidx = $yyidx; @@ -604,9 +524,9 @@ class Smarty_Internal_Configfileparser } } else { if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ]) && - in_array($token, self::$yyExpectedTokens[ $nextstate ], - true)) - ) { + in_array($token, + self::$yyExpectedTokens[ $nextstate ], + true))) { $this->yyidx = $yyidx; $this->yystack = $stack; return true; @@ -614,13 +534,13 @@ class Smarty_Internal_Configfileparser } if ($nextstate < self::YYNSTATE) { // we need to shift a non-terminal - $this->yyidx ++; + $this->yyidx++; $x = new TPC_yyStackEntry; $x->stateno = $nextstate; $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ]; $this->yystack[ $this->yyidx ] = $x; continue 2; - } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) { + } else if ($nextstate === self::YYNSTATE + self::YYNRULE + 1) { $this->yyidx = $yyidx; $this->yystack = $stack; if (!$token) { @@ -631,7 +551,7 @@ class Smarty_Internal_Configfileparser // by ignoring input, this is in essence ignoring a // syntax error! return false; - } elseif ($nextstate === self::YY_NO_ACTION) { + } else if ($nextstate === self::YY_NO_ACTION) { $this->yyidx = $yyidx; $this->yystack = $stack; // input accepted, but not shifted (I guess) @@ -639,22 +559,18 @@ class Smarty_Internal_Configfileparser } else { $yyact = $nextstate; } - } - while (true); + } while (true); } break; - } - while (true); + } while (true); $this->yyidx = $yyidx; $this->yystack = $stack; - return true; } public function yy_find_shift_action($iLookAhead) { $stateno = $this->yystack[ $this->yyidx ]->stateno; - /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */ if (!isset(self::$yy_shift_ofst[ $stateno ])) { // no shift actions @@ -664,23 +580,22 @@ class Smarty_Internal_Configfileparser if ($i === self::YY_SHIFT_USE_DFLT) { return self::$yy_default[ $stateno ]; } - if ($iLookAhead == self::YYNOCODE) { + if ($iLookAhead === self::YYNOCODE) { return self::YY_NO_ACTION; } $i += $iLookAhead; - if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) { - if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) && - ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0 - ) { + if ($i < 0 || $i >= self::YY_SZ_ACTTAB || + self::$yy_lookahead[ $i ] != $iLookAhead) { + if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) + && ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0) { if ($this->yyTraceFILE) { fwrite($this->yyTraceFILE, - $this->yyTracePrompt . "FALLBACK " . $this->yyTokenName[ $iLookAhead ] . " => " . + $this->yyTracePrompt . 'FALLBACK ' . + $this->yyTokenName[ $iLookAhead ] . ' => ' . $this->yyTokenName[ $iFallback ] . "\n"); } - return $this->yy_find_shift_action($iFallback); } - return self::$yy_default[ $stateno ]; } else { return self::$yy_action[ $i ]; @@ -690,19 +605,19 @@ class Smarty_Internal_Configfileparser public function yy_find_reduce_action($stateno, $iLookAhead) { /* $stateno = $this->yystack[$this->yyidx]->stateno; */ - if (!isset(self::$yy_reduce_ofst[ $stateno ])) { return self::$yy_default[ $stateno ]; } $i = self::$yy_reduce_ofst[ $stateno ]; - if ($i == self::YY_REDUCE_USE_DFLT) { + if ($i === self::YY_REDUCE_USE_DFLT) { return self::$yy_default[ $stateno ]; } - if ($iLookAhead == self::YYNOCODE) { + if ($iLookAhead === self::YYNOCODE) { return self::YY_NO_ACTION; } $i += $iLookAhead; - if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) { + if ($i < 0 || $i >= self::YY_SZ_ACTTAB || + self::$yy_lookahead[ $i ] != $iLookAhead) { return self::$yy_default[ $stateno ]; } else { return self::$yy_action[ $i ]; @@ -711,9 +626,9 @@ class Smarty_Internal_Configfileparser public function yy_shift($yyNewState, $yyMajor, $yypMinor) { - $this->yyidx ++; + $this->yyidx++; if ($this->yyidx >= self::YYSTACKDEPTH) { - $this->yyidx --; + $this->yyidx--; if ($this->yyTraceFILE) { fprintf($this->yyTraceFILE, "%sStack Overflow!\n", $this->yyTracePrompt); } @@ -721,10 +636,8 @@ class Smarty_Internal_Configfileparser $this->yy_pop_parser_stack(); } #line 239 "../smarty/lexer/smarty_internal_configfileparser.y" - $this->internalError = true; - $this->compiler->trigger_config_file_error("Stack overflow in configfile parser"); - + $this->compiler->trigger_config_file_error('Stack overflow in configfile parser'); return; } $yytos = new TPC_yyStackEntry; @@ -733,141 +646,132 @@ class Smarty_Internal_Configfileparser $yytos->minor = $yypMinor; $this->yystack[] = $yytos; if ($this->yyTraceFILE && $this->yyidx > 0) { - fprintf($this->yyTraceFILE, "%sShift %d\n", $this->yyTracePrompt, $yyNewState); + fprintf($this->yyTraceFILE, + "%sShift %d\n", + $this->yyTracePrompt, + $yyNewState); fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt); - for ($i = 1; $i <= $this->yyidx; $i ++) { - fprintf($this->yyTraceFILE, " %s", $this->yyTokenName[ $this->yystack[ $i ]->major ]); + for ($i = 1; $i <= $this->yyidx; $i++) { + fprintf($this->yyTraceFILE, + " %s", + $this->yyTokenName[ $this->yystack[ $i ]->major ]); } fwrite($this->yyTraceFILE, "\n"); } } - public static $yyRuleInfo = array(array(0 => 20, 1 => 2), array(0 => 21, 1 => 1), array(0 => 22, 1 => 2), - array(0 => 22, 1 => 0), array(0 => 24, 1 => 5), array(0 => 24, 1 => 6), - array(0 => 23, 1 => 2), array(0 => 23, 1 => 2), array(0 => 23, 1 => 0), - array(0 => 26, 1 => 3), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), - array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), - array(0 => 27, 1 => 3), array(0 => 27, 1 => 2), array(0 => 27, 1 => 1), - array(0 => 27, 1 => 1), array(0 => 25, 1 => 1), array(0 => 25, 1 => 2), - array(0 => 25, 1 => 3),); - - public static $yyReduceMap = array(0 => 0, 2 => 0, 3 => 0, 19 => 0, 20 => 0, 21 => 0, 1 => 1, 4 => 4, 5 => 5, - 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, - 15 => 15, 16 => 16, 17 => 17, 18 => 17,); - - #line 245 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r0() { $this->_retvalue = null; } - #line 250 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r1() { $this->add_global_vars($this->yystack[ $this->yyidx + 0 ]->minor); $this->_retvalue = null; } - #line 264 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r4() { - $this->add_section_vars($this->yystack[ $this->yyidx + - 3 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor); + $this->add_section_vars($this->yystack[ $this->yyidx + -3 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor); $this->_retvalue = null; } - #line 269 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 245 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r5() { if ($this->configReadHidden) { - $this->add_section_vars($this->yystack[ $this->yyidx + - 3 ]->minor, + $this->add_section_vars($this->yystack[ $this->yyidx + -3 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor); } $this->_retvalue = null; } - #line 277 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 250 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r6() { - $this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor; + $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 281 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 264 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r7() { $this->_retvalue = - array_merge($this->yystack[ $this->yyidx + - 1 ]->minor, Array($this->yystack[ $this->yyidx + 0 ]->minor)); + array_merge($this->yystack[ $this->yyidx + -1 ]->minor, array($this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 285 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 269 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r8() { - $this->_retvalue = Array(); + $this->_retvalue = array(); } - #line 291 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 277 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r9() { - $this->_retvalue = Array("key" => $this->yystack[ $this->yyidx + - 2 ]->minor, - "value" => $this->yystack[ $this->yyidx + 0 ]->minor); + $this->_retvalue = array('key' => $this->yystack[ $this->yyidx + -2 ]->minor, + 'value' => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 296 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 281 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r10() { - $this->_retvalue = (float) $this->yystack[ $this->yyidx + 0 ]->minor; + $this->_retvalue = (float)$this->yystack[ $this->yyidx + 0 ]->minor; } - #line 300 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 285 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r11() { - $this->_retvalue = (int) $this->yystack[ $this->yyidx + 0 ]->minor; + $this->_retvalue = (int)$this->yystack[ $this->yyidx + 0 ]->minor; } - #line 304 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 291 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r12() { $this->_retvalue = $this->parse_bool($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 308 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 296 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r13() { $this->_retvalue = self::parse_single_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 312 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 300 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r14() { $this->_retvalue = self::parse_double_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 316 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 304 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r15() { - $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[ $this->yyidx + - 1 ]->minor); + $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[ $this->yyidx + -1 ]->minor); } - #line 320 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 308 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r16() { $this->_retvalue = ''; } - #line 324 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 312 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r17() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - private $_retvalue; - + #line 316 "../smarty/lexer/smarty_internal_configfileparser.y" public function yy_reduce($yyruleno) { - if ($this->yyTraceFILE && $yyruleno >= 0 && $yyruleno < count(self::$yyRuleName)) { - fprintf($this->yyTraceFILE, "%sReduce (%d) [%s].\n", $this->yyTracePrompt, $yyruleno, + if ($this->yyTraceFILE && $yyruleno >= 0 + && $yyruleno < count(self::$yyRuleName)) { + fprintf($this->yyTraceFILE, + "%sReduce (%d) [%s].\n", + $this->yyTracePrompt, + $yyruleno, self::$yyRuleName[ $yyruleno ]); } - $this->_retvalue = $yy_lefthand_side = null; if (isset(self::$yyReduceMap[ $yyruleno ])) { // call the action @@ -878,14 +782,14 @@ class Smarty_Internal_Configfileparser $yygoto = self::$yyRuleInfo[ $yyruleno ][ 0 ]; $yysize = self::$yyRuleInfo[ $yyruleno ][ 1 ]; $this->yyidx -= $yysize; - for ($i = $yysize; $i; $i --) { + for ($i = $yysize; $i; $i--) { // pop all of the right-hand side parameters array_pop($this->yystack); } $yyact = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, $yygoto); if ($yyact < self::YYNSTATE) { if (!$this->yyTraceFILE && $yysize) { - $this->yyidx ++; + $this->yyidx++; $x = new TPC_yyStackEntry; $x->stateno = $yyact; $x->major = $yygoto; @@ -894,11 +798,12 @@ class Smarty_Internal_Configfileparser } else { $this->yy_shift($yyact, $yygoto, $yy_lefthand_side); } - } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) { + } else if ($yyact === self::YYNSTATE + self::YYNRULE + 1) { $this->yy_accept(); } } + #line 320 "../smarty/lexer/smarty_internal_configfileparser.y" public function yy_parse_failed() { if ($this->yyTraceFILE) { @@ -909,10 +814,10 @@ class Smarty_Internal_Configfileparser } } + #line 324 "../smarty/lexer/smarty_internal_configfileparser.y" public function yy_syntax_error($yymajor, $TOKEN) { #line 232 "../smarty/lexer/smarty_internal_configfileparser.y" - $this->internalError = true; $this->yymajor = $yymajor; $this->compiler->trigger_config_file_error(); @@ -927,7 +832,6 @@ class Smarty_Internal_Configfileparser $this->yy_pop_parser_stack(); } #line 225 "../smarty/lexer/smarty_internal_configfileparser.y" - $this->successful = !$this->internalError; $this->internalError = false; $this->retvalue = $this->_retvalue; @@ -936,10 +840,9 @@ class Smarty_Internal_Configfileparser public function doParse($yymajor, $yytokenvalue) { $yyerrorhit = 0; /* True if yymajor has invoked an error */ - if ($this->yyidx === null || $this->yyidx < 0) { $this->yyidx = 0; - $this->yyerrcnt = - 1; + $this->yyerrcnt = -1; $x = new TPC_yyStackEntry; $x->stateno = 0; $x->major = 0; @@ -947,53 +850,61 @@ class Smarty_Internal_Configfileparser $this->yystack[] = $x; } $yyendofinput = ($yymajor == 0); - if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sInput %s\n", $this->yyTracePrompt, $this->yyTokenName[ $yymajor ]); + fprintf($this->yyTraceFILE, + "%sInput %s\n", + $this->yyTracePrompt, + $this->yyTokenName[ $yymajor ]); } - do { $yyact = $this->yy_find_shift_action($yymajor); - if ($yymajor < self::YYERRORSYMBOL && !$this->yy_is_expected_token($yymajor)) { + if ($yymajor < self::YYERRORSYMBOL && + !$this->yy_is_expected_token($yymajor)) { // force a syntax error $yyact = self::YY_ERROR_ACTION; } if ($yyact < self::YYNSTATE) { $this->yy_shift($yyact, $yymajor, $yytokenvalue); - $this->yyerrcnt --; + $this->yyerrcnt--; if ($yyendofinput && $this->yyidx >= 0) { $yymajor = 0; } else { $yymajor = self::YYNOCODE; } - } elseif ($yyact < self::YYNSTATE + self::YYNRULE) { + } else if ($yyact < self::YYNSTATE + self::YYNRULE) { $this->yy_reduce($yyact - self::YYNSTATE); - } elseif ($yyact == self::YY_ERROR_ACTION) { + } else if ($yyact === self::YY_ERROR_ACTION) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sSyntax Error!\n", $this->yyTracePrompt); + fprintf($this->yyTraceFILE, + "%sSyntax Error!\n", + $this->yyTracePrompt); } if (self::YYERRORSYMBOL) { if ($this->yyerrcnt < 0) { $this->yy_syntax_error($yymajor, $yytokenvalue); } $yymx = $this->yystack[ $this->yyidx ]->major; - if ($yymx == self::YYERRORSYMBOL || $yyerrorhit) { + if ($yymx === self::YYERRORSYMBOL || $yyerrorhit) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sDiscard input token %s\n", $this->yyTracePrompt, + fprintf($this->yyTraceFILE, + "%sDiscard input token %s\n", + $this->yyTracePrompt, $this->yyTokenName[ $yymajor ]); } $this->yy_destructor($yymajor, $yytokenvalue); $yymajor = self::YYNOCODE; } else { - while ($this->yyidx >= 0 && $yymx != self::YYERRORSYMBOL && - ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE) { + while ($this->yyidx >= 0 && + $yymx !== self::YYERRORSYMBOL && + ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE + ) { $this->yy_pop_parser_stack(); } if ($this->yyidx < 0 || $yymajor == 0) { $this->yy_destructor($yymajor, $yytokenvalue); $this->yy_parse_failed(); $yymajor = self::YYNOCODE; - } elseif ($yymx != self::YYERRORSYMBOL) { + } else if ($yymx !== self::YYERRORSYMBOL) { $u2 = 0; $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2); } @@ -1015,8 +926,74 @@ class Smarty_Internal_Configfileparser $this->yy_accept(); $yymajor = self::YYNOCODE; } + } while ($yymajor !== self::YYNOCODE && $this->yyidx >= 0); + } + + /** + * parse optional boolean keywords + * + * @param string $str + * + * @return bool + */ + private function parse_bool($str) + { + $str = strtolower($str); + if (in_array($str, array('on', 'yes', 'true'))) { + $res = true; + } else { + $res = false; + } + return $res; + } + + /** + * set a config variable in target array + * + * @param array $var + * @param array $target_array + */ + private function set_var(array $var, array &$target_array) + { + $key = $var[ 'key' ]; + $value = $var[ 'value' ]; + if ($this->configOverwrite || !isset($target_array[ 'vars' ][ $key ])) { + $target_array[ 'vars' ][ $key ] = $value; + } else { + settype($target_array[ 'vars' ][ $key ], 'array'); + $target_array[ 'vars' ][ $key ][] = $value; + } + } + + /** + * add config variable to global vars + * + * @param array $vars + */ + private function add_global_vars(array $vars) + { + if (!isset($this->compiler->config_data[ 'vars' ])) { + $this->compiler->config_data[ 'vars' ] = array(); + } + foreach ($vars as $var) { + $this->set_var($var, $this->compiler->config_data); + } + } + + /** + * add config variable to section + * + * @param string $section_name + * @param array $vars + */ + private function add_section_vars($section_name, array $vars) + { + if (!isset($this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ])) { + $this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ] = array(); + } + foreach ($vars as $var) { + $this->set_var($var, $this->compiler->config_data[ 'sections' ][ $section_name ]); } - while ($yymajor != self::YYNOCODE && $this->yyidx >= 0); } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_data.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_data.php index fd9c3020b..37b917b14 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_data.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_data.php @@ -19,6 +19,7 @@ * The following methods will be dynamically loaded by the extension handler when they are called. * They are located in a corresponding Smarty_Internal_Method_xxxx class * + * @method mixed _getConfigVariable(string $varName, bool $errorEnable = true) * @method mixed getConfigVariable(string $varName, bool $errorEnable = true) * @method mixed getConfigVars(string $varName = null, bool $searchParents = true) * @method mixed getGlobal(string $varName = null) @@ -28,7 +29,7 @@ * @method Smarty_Internal_Data clearConfig(string $varName = null) * @method Smarty_Internal_Data configLoad(string $config_file, mixed $sections = null, string $scope = 'local') */ -class Smarty_Internal_Data +abstract class Smarty_Internal_Data { /** * This object type (Smarty = 1, template = 2, data = 4) @@ -54,7 +55,7 @@ class Smarty_Internal_Data /** * parent template (if any) * - * @var Smarty|Smarty_Internal_Template|Smarty_Internal_Data + * @var Smarty|Smarty_Internal_Template|Smarty_Data */ public $parent = null; @@ -100,7 +101,7 @@ class Smarty_Internal_Data $this->assign($_key, $_val, $nocache); } } else { - if ($tpl_var != '') { + if ($tpl_var !== '') { if ($this->_objType === 2) { /** @var Smarty_Internal_Template $this */ $this->_assignInScope($tpl_var, $value, $nocache); diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_debug.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_debug.php index f16bd3fb1..c826a1786 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_debug.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_debug.php @@ -193,6 +193,9 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data * * @param Smarty_Internal_Template|Smarty $obj object to debug * @param bool $full + * + * @throws \Exception + * @throws \SmartyException */ public function display_debug($obj, $full = false) { @@ -210,7 +213,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data // init properties by hand as user may have edited the original Smarty class $debObj->setPluginsDir(is_dir(__DIR__ . '/../plugins') ? __DIR__ . '/../plugins' : $smarty->getPluginsDir()); $debObj->force_compile = false; - $debObj->compile_check = true; + $debObj->compile_check = Smarty::COMPILECHECK_ON; $debObj->left_delimiter = '{'; $debObj->right_delimiter = '}'; $debObj->security_policy = null; @@ -224,7 +227,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data $debObj->autoload_filters = array(); $debObj->default_modifiers = array(); $debObj->escape_html = true; - $debObj->caching = false; + $debObj->caching = Smarty::CACHING_OFF; $debObj->compile_id = null; $debObj->cache_id = null; // prepare information of assigned variables @@ -239,7 +242,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data if ($obj->_isTplObj()) { $_template->assign('template_name', $obj->source->type . ':' . $obj->source->name); } - if ($obj->_objType == 1 || $full) { + if ($obj->_objType === 1 || $full) { $_template->assign('template_data', $this->template_data[ $this->index ]); } else { $_template->assign('template_data', null); @@ -247,7 +250,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data $_template->assign('assigned_vars', $_assigned_vars); $_template->assign('config_vars', $_config_vars); $_template->assign('execution_time', microtime(true) - $smarty->start_time); - $_template->assign('display_mode', $debugging == 2 || !$full); + $_template->assign('display_mode', $debugging === 2 || !$full); $_template->assign('offset', $this->offset * 50); echo $_template->fetch(); if (isset($full)) { @@ -281,15 +284,15 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data $tpl_vars = array(); foreach ($obj->tpl_vars as $key => $var) { foreach ($var as $varkey => $varvalue) { - if ($varkey == 'value') { + if ($varkey === 'value') { $tpl_vars[ $key ][ $varkey ] = $varvalue; } else { - if ($varkey == 'nocache') { - if ($varvalue == true) { + if ($varkey === 'nocache') { + if ($varvalue === true) { $tpl_vars[ $key ][ $varkey ] = $varvalue; } } else { - if ($varkey != 'scope' || $varvalue !== 0) { + if ($varkey !== 'scope' || $varvalue !== 0) { $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue; } } @@ -323,15 +326,15 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data foreach (Smarty::$global_tpl_vars as $key => $var) { if (!array_key_exists($key, $tpl_vars)) { foreach ($var as $varkey => $varvalue) { - if ($varkey == 'value') { + if ($varkey === 'value') { $tpl_vars[ $key ][ $varkey ] = $varvalue; } else { - if ($varkey == 'nocache') { - if ($varvalue == true) { + if ($varkey === 'nocache') { + if ($varvalue === true) { $tpl_vars[ $key ][ $varkey ] = $varvalue; } } else { - if ($varkey != 'scope' || $varvalue !== 0) { + if ($varkey !== 'scope' || $varvalue !== 0) { $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue; } } @@ -356,7 +359,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data { static $_is_stringy = array('string' => true, 'eval' => true); // calculate Uid if not already done - if ($template->source->uid == '') { + if ($template->source->uid === '') { $template->source->filepath; } $key = $template->source->uid; @@ -386,7 +389,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data public function ignore(Smarty_Internal_Template $template) { // calculate Uid if not already done - if ($template->source->uid == '') { + if ($template->source->uid === '') { $template->source->filepath; } $this->ignore_uid[ $template->source->uid ] = true; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_errorhandler.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_errorhandler.php new file mode 100644 index 000000000..831421833 --- /dev/null +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_errorhandler.php @@ -0,0 +1,112 @@ +<?php + +/** + * Smarty error handler + * + * + * @package Smarty + * @subpackage PluginsInternal + * @author Uwe Tews + * + * @deprecated +Smarty does no longer use @filemtime() + */ +class Smarty_Internal_ErrorHandler +{ + /** + * contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors() + */ + public static $mutedDirectories = array(); + /** + * error handler returned by set_error_handler() in self::muteExpectedErrors() + */ + private static $previousErrorHandler = null; + + /** + * Enable error handler to mute expected messages + * + * @return boolean + */ + public static function muteExpectedErrors() + { + /* + error muting is done because some people implemented custom error_handlers using + http://php.net/set_error_handler and for some reason did not understand the following paragraph: + + It is important to remember that the standard PHP error handler is completely bypassed for the + error types specified by error_types unless the callback function returns FALSE. + error_reporting() settings will have no effect and your error handler will be called regardless - + however you are still able to read the current value of error_reporting and act appropriately. + Of particular note is that this value will be 0 if the statement that caused the error was + prepended by the @ error-control operator. + + Smarty deliberately uses @filemtime() over file_exists() and filemtime() in some places. Reasons include + - @filemtime() is almost twice as fast as using an additional file_exists() + - between file_exists() and filemtime() a possible race condition is opened, + which does not exist using the simple @filemtime() approach. + */ + $error_handler = array('Smarty_Internal_ErrorHandler', 'mutingErrorHandler'); + $previous = set_error_handler($error_handler); + // avoid dead loops + if ($previous !== $error_handler) { + self::$previousErrorHandler = $previous; + } + } + + /** + * Error Handler to mute expected messages + * + * @link http://php.net/set_error_handler + * + * @param integer $errno Error level + * @param $errstr + * @param $errfile + * @param $errline + * @param $errcontext + * + * @return bool + */ + public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext) + { + $_is_muted_directory = false; + // add the SMARTY_DIR to the list of muted directories + if (!isset(self::$mutedDirectories[ SMARTY_DIR ])) { + $smarty_dir = realpath(SMARTY_DIR); + if ($smarty_dir !== false) { + self::$mutedDirectories[ SMARTY_DIR ] = + array('file' => $smarty_dir, 'length' => strlen($smarty_dir),); + } + } + // walk the muted directories and test against $errfile + foreach (self::$mutedDirectories as $key => &$dir) { + if (!$dir) { + // resolve directory and length for speedy comparisons + $file = realpath($key); + if ($file === false) { + // this directory does not exist, remove and skip it + unset(self::$mutedDirectories[ $key ]); + continue; + } + $dir = array('file' => $file, 'length' => strlen($file),); + } + if (!strncmp($errfile, $dir[ 'file' ], $dir[ 'length' ])) { + $_is_muted_directory = true; + break; + } + } + // pass to next error handler if this error did not occur inside SMARTY_DIR + // or the error was within smarty but masked to be ignored + if (!$_is_muted_directory || ($errno && $errno & error_reporting())) { + if (self::$previousErrorHandler) { + return call_user_func(self::$previousErrorHandler, + $errno, + $errstr, + $errfile, + $errline, + $errcontext); + } else { + return false; + } + } + } +}
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php index 340e6dee1..90d3b81ea 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php @@ -27,14 +27,15 @@ * Method extensions * @property Smarty_Internal_Method_GetTemplateVars $getTemplateVars * @property Smarty_Internal_Method_Append $append - * @property Smarty_Internal_Method_AppendByRef $appendByRef - * @property Smarty_Internal_Method_AssignGlobal $assignGlobal - * @property Smarty_Internal_Method_AssignByRef $assignByRef - * @property Smarty_Internal_Method_LoadFilter $loadFilter - * @property Smarty_Internal_Method_LoadPlugin $loadPlugin - * @property Smarty_Internal_Method_RegisterFilter $registerFilter - * @property Smarty_Internal_Method_RegisterObject $registerObject - * @property Smarty_Internal_Method_RegisterPlugin $registerPlugin + * @property Smarty_Internal_Method_AppendByRef $appendByRef + * @property Smarty_Internal_Method_AssignGlobal $assignGlobal + * @property Smarty_Internal_Method_AssignByRef $assignByRef + * @property Smarty_Internal_Method_LoadFilter $loadFilter + * @property Smarty_Internal_Method_LoadPlugin $loadPlugin + * @property Smarty_Internal_Method_RegisterFilter $registerFilter + * @property Smarty_Internal_Method_RegisterObject $registerObject + * @property Smarty_Internal_Method_RegisterPlugin $registerPlugin + * @property mixed|\Smarty_Template_Cached configLoad */ class Smarty_Internal_Extension_Handler { @@ -47,9 +48,9 @@ class Smarty_Internal_Extension_Handler * * @var array */ - private $_property_info = array('AutoloadFilters' => 0, 'DefaultModifiers' => 0, 'ConfigVars' => 0, - 'DebugTemplate' => 0, 'RegisteredObject' => 0, 'StreamVariable' => 0, - 'TemplateVars' => 0,);# + private $_property_info = array('AutoloadFilters' => 0, 'DefaultModifiers' => 0, 'ConfigVars' => 0, + 'DebugTemplate' => 0, 'RegisteredObject' => 0, 'StreamVariable' => 0, + 'TemplateVars' => 0, 'Literals' => 'Literals',);# private $resolvedProperties = array(); @@ -68,38 +69,62 @@ class Smarty_Internal_Extension_Handler /* @var Smarty $data ->smarty */ $smarty = isset($data->smarty) ? $data->smarty : $data; if (!isset($smarty->ext->$name)) { - $class = 'Smarty_Internal_Method_' . $this->upperCase($name); - if (preg_match('/^(set|get)([A-Z].*)$/', $name, $match)) { - $pn = ''; - if (!isset($this->_property_info[ $prop = $match[ 2 ] ])) { - // convert camel case to underscored name - $this->resolvedProperties[ $prop ] = $pn = strtolower(join('_', - preg_split('/([A-Z][^A-Z]*)/', $prop, - - 1, PREG_SPLIT_NO_EMPTY | - PREG_SPLIT_DELIM_CAPTURE))); - $this->_property_info[ $prop ] = - property_exists($data, $pn) ? 1 : ($data->_isTplObj() && property_exists($smarty, $pn) ? 2 : 0); + if (preg_match('/^((set|get)|(.*?))([A-Z].*)$/', $name, $match)) { + $basename = $this->upperCase($match[4]); + if (!isset($smarty->ext->$basename) && isset($this->_property_info[ $basename ]) && + is_string($this->_property_info[ $basename ])) { + $class = 'Smarty_Internal_Method_' . $this->_property_info[ $basename ]; + if (class_exists($class)) { + $classObj = new $class(); + $methodes = get_class_methods($classObj); + foreach ($methodes as $method) { + $smarty->ext->$method = $classObj; + } + } } - if ($this->_property_info[ $prop ]) { - $pn = $this->resolvedProperties[ $prop ]; - if ($match[ 1 ] == 'get') { - return $this->_property_info[ $prop ] == 1 ? $data->$pn : $data->smarty->$pn; - } else { - return $this->_property_info[ $prop ] == 1 ? $data->$pn = $args[ 0 ] : - $data->smarty->$pn = $args[ 0 ]; + if (!empty($match[2]) && !isset($smarty->ext->$name)) { + $class = 'Smarty_Internal_Method_' . $this->upperCase($name); + if (!class_exists($class)) { + $objType = $data->_objType; + $propertyType = false; + if (!isset($this->resolvedProperties[ $match[0] ][ $objType ])) { + $property = isset($this->resolvedProperties['property'][ $basename ]) ? + $this->resolvedProperties['property'][ $basename ] : + $property = $this->resolvedProperties['property'][ $basename ] = strtolower(join('_', + preg_split('/([A-Z][^A-Z]*)/', + $basename, + -1, + PREG_SPLIT_NO_EMPTY | + PREG_SPLIT_DELIM_CAPTURE))); + + if ($property !== false) { + if (property_exists($data, $property)) { + $propertyType = $this->resolvedProperties[ $match[0] ][ $objType ] = 1; + } else if (property_exists($smarty, $property)) { + $propertyType = $this->resolvedProperties[ $match[0] ][ $objType ] = 2; + } else { + $this->resolvedProperties['property'][ $basename ] = $property = false; + } + } + } else { + $propertyType = $this->resolvedProperties[ $match[0] ][ $objType ]; + $property = $this->resolvedProperties['property'][ $basename ]; + } + if ($propertyType) { + $obj = $propertyType === 1 ? $data : $smarty; + if ($match[2] === 'get') { + return $obj->$property; + } else if ($match[2] === 'set') { + return $obj->$property = $args[0]; + } + } } - } elseif (!class_exists($class)) { - throw new SmartyException("property '$pn' does not exist."); } } - if (class_exists($class)) { - $callback = array($smarty->ext->$name = new $class(), $name); - } - } else { - $callback = array($smarty->ext->$name, $name); } + $callback = array($smarty->ext->$name, $name); array_unshift($args, $data); - if (isset($callback) && $callback[ 0 ]->objMap | $data->_objType) { + if (isset($callback) && $callback[0]->objMap | $data->_objType) { return call_user_func_array($callback, $args); } return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), $args); @@ -120,19 +145,6 @@ class Smarty_Internal_Extension_Handler } /** - * set extension property - * - * @param string $property_name property name - * @param mixed $value value - * - * @throws SmartyException - */ - public function __set($property_name, $value) - { - $this->$property_name = $value; - } - - /** * get extension object * * @param string $property_name property name @@ -143,7 +155,7 @@ class Smarty_Internal_Extension_Handler public function __get($property_name) { // object properties of runtime template extensions will start with '_' - if ($property_name[ 0 ] == '_') { + if ($property_name[0] === '_') { $class = 'Smarty_Internal_Runtime' . $this->upperCase($property_name); } else { $class = 'Smarty_Internal_Method_' . $this->upperCase($property_name); @@ -155,6 +167,19 @@ class Smarty_Internal_Extension_Handler } /** + * set extension property + * + * @param string $property_name property name + * @param mixed $value value + * + * @throws SmartyException + */ + public function __set($property_name, $value) + { + $this->$property_name = $value; + } + + /** * Call error handler for undefined method * * @param string $name unknown method-name diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php index 3eef8a28c..7bd75bfb5 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php @@ -11,7 +11,6 @@ */ class Smarty_Internal_Method_AddAutoloadFilters extends Smarty_Internal_Method_SetAutoloadFilters { - /** * Add autoload filters * @@ -25,6 +24,7 @@ class Smarty_Internal_Method_AddAutoloadFilters extends Smarty_Internal_Method_S * the appropriate types * * @return \Smarty|\Smarty_Internal_Template + * @throws \SmartyException */ public function addAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_append.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_append.php index af6935919..a1422cf5a 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_append.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_append.php @@ -38,12 +38,12 @@ class Smarty_Internal_Method_Append if (is_array($tpl_var)) { // $tpl_var is an array, ignore $value foreach ($tpl_var as $_key => $_val) { - if ($_key != '') { + if ($_key !== '') { $this->append($data, $_key, $_val, $merge, $nocache); } } } else { - if ($tpl_var != '' && isset($value)) { + if ($tpl_var !== '' && isset($value)) { if (!isset($data->tpl_vars[ $tpl_var ])) { $tpl_var_inst = $data->ext->getTemplateVars->_getVariable($data, $tpl_var, null, true, false); if ($tpl_var_inst instanceof Smarty_Undefined_Variable) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_appendbyref.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_appendbyref.php index 532ac9509..9185a8e83 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_appendbyref.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_appendbyref.php @@ -27,7 +27,7 @@ class Smarty_Internal_Method_AppendByRef */ public static function appendByRef(Smarty_Internal_Data $data, $tpl_var, &$value, $merge = false) { - if ($tpl_var != '' && isset($value)) { + if ($tpl_var !== '' && isset($value)) { if (!isset($data->tpl_vars[ $tpl_var ])) { $data->tpl_vars[ $tpl_var ] = new Smarty_Variable(); } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignbyref.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignbyref.php index 0060bbc5f..1c513ce99 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignbyref.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignbyref.php @@ -24,7 +24,7 @@ class Smarty_Internal_Method_AssignByRef */ public function assignByRef(Smarty_Internal_Data $data, $tpl_var, &$value, $nocache) { - if ($tpl_var != '') { + if ($tpl_var !== '') { $data->tpl_vars[ $tpl_var ] = new Smarty_Variable(null, $nocache); $data->tpl_vars[ $tpl_var ]->value = &$value; if ($data->_isTplObj() && $data->scope) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignglobal.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignglobal.php index 3c2b26049..0e1690418 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignglobal.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignglobal.php @@ -30,7 +30,7 @@ class Smarty_Internal_Method_AssignGlobal */ public function assignGlobal(Smarty_Internal_Data $data, $varName, $value = null, $nocache = false) { - if ($varName != '') { + if ($varName !== '') { Smarty::$global_tpl_vars[ $varName ] = new Smarty_Variable($value, $nocache); $ptr = $data; while ($ptr->_isTplObj()) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallcache.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallcache.php index 5879f9a06..9641e2baa 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallcache.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallcache.php @@ -28,7 +28,8 @@ class Smarty_Internal_Method_ClearAllCache * @param integer $exp_time expiration time * @param string $type resource type * - * @return integer number of cache files deleted + * @return int number of cache files deleted + * @throws \SmartyException */ public function clearAllCache(Smarty $smarty, $exp_time = null, $type = null) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcache.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcache.php index 95649a777..6d56c13d5 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcache.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcache.php @@ -31,7 +31,8 @@ class Smarty_Internal_Method_ClearCache * @param integer $exp_time expiration time * @param string $type resource type * - * @return integer number of cache files deleted + * @return int number of cache files deleted + * @throws \SmartyException */ public function clearCache(Smarty $smarty, $template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null) diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php index a1f1a80bb..c019c59db 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php @@ -29,27 +29,27 @@ class Smarty_Internal_Method_ClearCompiledTemplate * @param string $compile_id compile id * @param integer $exp_time expiration time * - * @return integer number of template files deleted + * @return int number of template files deleted + * @throws \SmartyException */ public function clearCompiledTemplate(Smarty $smarty, $resource_name = null, $compile_id = null, $exp_time = null) { // clear template objects cache $smarty->_clearTemplateCache(); - $_compile_dir = $smarty->getCompileDir(); - if ($_compile_dir == '/') { //We should never want to delete this! + if ($_compile_dir === '/') { //We should never want to delete this! return 0; } $_compile_id = isset($compile_id) ? preg_replace('![^\w]+!', '_', $compile_id) : null; - $_dir_sep = $smarty->use_sub_dirs ? $smarty->ds : '^'; + $_dir_sep = $smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^'; if (isset($resource_name)) { $_save_stat = $smarty->caching; - $smarty->caching = false; + $smarty->caching = Smarty::CACHING_OFF; /* @var Smarty_Internal_Template $tpl */ $tpl = $smarty->createTemplate($resource_name); $smarty->caching = $_save_stat; if (!$tpl->source->handler->uncompiled && !$tpl->source->handler->recompiled && $tpl->source->exists) { - $_resource_part_1 = basename(str_replace('^', $smarty->ds, $tpl->compiled->filepath)); + $_resource_part_1 = basename(str_replace('^', DIRECTORY_SEPARATOR, $tpl->compiled->filepath)); $_resource_part_1_length = strlen($_resource_part_1); } else { return 0; @@ -75,10 +75,10 @@ class Smarty_Internal_Method_ClearCompiledTemplate } $_compile = new RecursiveIteratorIterator($_compileDirs, RecursiveIteratorIterator::CHILD_FIRST); foreach ($_compile as $_file) { - if (substr(basename($_file->getPathname()), 0, 1) == '.') { + if (substr(basename($_file->getPathname()), 0, 1) === '.') { continue; } - $_filepath = (string) $_file; + $_filepath = (string)$_file; if ($_file->isDir()) { if (!$_compile->isDot()) { // delete folder if empty @@ -93,26 +93,32 @@ class Smarty_Internal_Method_ClearCompiledTemplate if ((!isset($_compile_id) || (isset($_filepath[ $_compile_id_part_length ]) && $a = !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length))) && (!isset($resource_name) || (isset($_filepath[ $_resource_part_1_length ]) && - substr_compare($_filepath, $_resource_part_1, - - $_resource_part_1_length, $_resource_part_1_length) == + substr_compare($_filepath, + $_resource_part_1, + -$_resource_part_1_length, + $_resource_part_1_length) === 0) || (isset($_filepath[ $_resource_part_2_length ]) && - substr_compare($_filepath, $_resource_part_2, - - $_resource_part_2_length, - $_resource_part_2_length) == 0)) + substr_compare($_filepath, + $_resource_part_2, + -$_resource_part_2_length, + $_resource_part_2_length) === 0)) ) { if (isset($exp_time)) { - if (time() - @filemtime($_filepath) >= $exp_time) { + if (is_file($_filepath) && time() - filemtime($_filepath) >= $exp_time) { $unlink = true; } } else { $unlink = true; } } - - if ($unlink && @unlink($_filepath)) { - $_count ++; - if (function_exists('opcache_invalidate') && strlen(ini_get("opcache.restrict_api")) < 1) { + if ($unlink && is_file($_filepath) && @unlink($_filepath)) { + $_count++; + if (function_exists('opcache_invalidate') + && (!function_exists('ini_get') || strlen(ini_get('opcache.restrict_api')) < 1) + ) { opcache_invalidate($_filepath, true); + } else if (function_exists('apc_delete_file')) { + apc_delete_file($_filepath); } } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php index 0abed2124..64912599f 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php @@ -1,5 +1,4 @@ <?php - /** * Smarty Method CompileAllTemplates * @@ -31,7 +30,10 @@ class Smarty_Internal_Method_CompileAllTemplates * * @return integer number of template files recompiled */ - public function compileAllTemplates(Smarty $smarty, $extension = '.tpl', $force_compile = false, $time_limit = 0, + public function compileAllTemplates(Smarty $smarty, + $extension = '.tpl', + $force_compile = false, + $time_limit = 0, $max_errors = null) { return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors); @@ -49,7 +51,11 @@ class Smarty_Internal_Method_CompileAllTemplates * * @return int number of template files compiled */ - protected function compileAll(Smarty $smarty, $extension, $force_compile, $time_limit, $max_errors, + protected function compileAll(Smarty $smarty, + $extension, + $force_compile, + $time_limit, + $max_errors, $isConfig = false) { // switch off time limit @@ -66,20 +72,20 @@ class Smarty_Internal_Method_CompileAllTemplates $_dir_2 = new RecursiveIteratorIterator($_dir_1); foreach ($_dir_2 as $_fileinfo) { $_file = $_fileinfo->getFilename(); - if (substr(basename($_fileinfo->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) { + if (substr(basename($_fileinfo->getPathname()), 0, 1) === '.' || strpos($_file, '.svn') !== false) { continue; } - if (!substr_compare($_file, $extension, - strlen($extension)) == 0) { + if (!substr_compare($_file, $extension, -strlen($extension)) === 0) { continue; } - if ($_fileinfo->getPath() !== substr($_dir, 0, - 1)) { - $_file = substr($_fileinfo->getPath(), strlen($_dir)) . $smarty->ds . $_file; + if ($_fileinfo->getPath() !== substr($_dir, 0, -1)) { + $_file = substr($_fileinfo->getPath(), strlen($_dir)) . DIRECTORY_SEPARATOR . $_file; } echo "\n<br>", $_dir, '---', $_file; flush(); $_start_time = microtime(true); $_smarty = clone $smarty; - // + // $_smarty->_cache = array(); $_smarty->ext = new Smarty_Internal_Extension_Handler(); $_smarty->ext->objType = $_smarty->_objType; @@ -92,7 +98,7 @@ class Smarty_Internal_Method_CompileAllTemplates $isConfig ? Smarty_Template_Config::load($_tpl) : Smarty_Template_Source::load($_tpl); if ($_tpl->mustCompile()) { $_tpl->compileTemplateSource(); - $_count ++; + $_count++; echo ' compiled in ', microtime(true) - $_start_time, ' seconds'; flush(); } else { @@ -102,14 +108,14 @@ class Smarty_Internal_Method_CompileAllTemplates } catch (Exception $e) { echo "\n<br> ------>Error: ", $e->getMessage(), "<br><br>\n"; - $_error_count ++; + $_error_count++; } // free memory unset($_tpl); $_smarty->_clearTemplateCache(); - if ($max_errors !== null && $_error_count == $max_errors) { + if ($max_errors !== null && $_error_count === $max_errors) { echo "\n<br><br>too many errors\n"; - exit(); + exit(1); } } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_configload.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_configload.php index 6113eaf98..eb8672fe9 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_configload.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_configload.php @@ -30,7 +30,7 @@ class Smarty_Internal_Method_ConfigLoad * section or null * * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template - * @throws \SmartyException + * @throws \Exception */ public function configLoad(Smarty_Internal_Data $data, $config_file, $sections = null) { @@ -52,7 +52,7 @@ class Smarty_Internal_Method_ConfigLoad * shall be loaded * * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template - * @throws \SmartyException + * @throws \Exception */ public function _loadConfigFile(Smarty_Internal_Data $data, $config_file, $sections = null, $scope = 0) { @@ -83,7 +83,7 @@ class Smarty_Internal_Method_ConfigLoad $this->_assignConfigVars($tpl->parent->config_vars, $tpl, $new_config_vars); $tagScope = $tpl->source->scope; if ($tagScope >= 0) { - if ($tagScope == Smarty::SCOPE_LOCAL) { + if ($tagScope === Smarty::SCOPE_LOCAL) { $this->_updateVarStack($tpl, $new_config_vars); $tagScope = 0; if (!$tpl->scope) { @@ -94,6 +94,7 @@ class Smarty_Internal_Method_ConfigLoad $mergedScope = $tagScope | $tpl->scope; if ($mergedScope) { // update scopes + /* @var \Smarty_Internal_Template|\Smarty|\Smarty_Internal_Data $ptr */ foreach ($tpl->smarty->ext->_updateScope->_getAffectedScopes($tpl->parent, $mergedScope) as $ptr) { $this->_assignConfigVars($ptr->config_vars, $tpl, $new_config_vars); if ($tagScope && $ptr->_isTplObj() && isset($tpl->_cache[ 'varStack' ])) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php index d945a01e3..b957b60d2 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php @@ -11,7 +11,6 @@ */ class Smarty_Internal_Method_GetAutoloadFilters extends Smarty_Internal_Method_SetAutoloadFilters { - /** * Get autoload filters * @@ -22,8 +21,9 @@ class Smarty_Internal_Method_GetAutoloadFilters extends Smarty_Internal_Method_S * for. Defaults to all autoload * filters * - * @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type + * @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type * was specified + * @throws \SmartyException */ public function getAutoloadFilters(Smarty_Internal_TemplateBase $obj, $type = null) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getglobal.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getglobal.php index 7a8a9bc71..0f00da53c 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getglobal.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getglobal.php @@ -24,9 +24,9 @@ class Smarty_Internal_Method_GetGlobal * @api Smarty::getGlobal() * * @param \Smarty_Internal_Data $data - * @param string $varName variable name or null + * @param string $varName variable name or null * - * @return string variable value or or array of variables + * @return string|array variable value or or array of variables */ public function getGlobal(Smarty_Internal_Data $data, $varName = null) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettags.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettags.php index 5718b69e9..afaa4b913 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettags.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettags.php @@ -28,6 +28,7 @@ class Smarty_Internal_Method_GetTags * @param null|string|Smarty_Internal_Template $template * * @return array of tag/attributes + * @throws \Exception * @throws \SmartyException */ public function getTags(Smarty_Internal_TemplateBase $obj, $template = null) @@ -52,11 +53,11 @@ class Smarty_Internal_Method_GetTags $tpl->_cache[ 'used_tags' ] = array(); $tpl->smarty->merge_compiled_includes = false; $tpl->smarty->disableSecurity(); - $tpl->caching = false; + $tpl->caching = Smarty::CACHING_OFF; $tpl->loadCompiler(); $tpl->compiler->compileTemplate($tpl); return $tpl->_cache[ 'used_tags' ]; } - throw new SmartyException("Missing template specification"); + throw new SmartyException('Missing template specification'); } }
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php index 1759646f3..510bab0fc 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php @@ -53,7 +53,7 @@ class Smarty_Internal_Method_GetTemplateVars } } // not found, try at parent - if ($searchParents) { + if ($searchParents && isset($_ptr->parent)) { $_ptr = $_ptr->parent; } else { $_ptr = null; @@ -93,7 +93,7 @@ class Smarty_Internal_Method_GetTemplateVars return $_ptr->tpl_vars[ $varName ]; } // not found, try at parent - if ($searchParents) { + if ($searchParents && isset($_ptr->parent)) { $_ptr = $_ptr->parent; } else { $_ptr = null; @@ -103,14 +103,11 @@ class Smarty_Internal_Method_GetTemplateVars // found it, return it return Smarty::$global_tpl_vars[ $varName ]; } - /* @var \Smarty $smarty */ - $smarty = isset($data->smarty) ? $data->smarty : $data; - if ($smarty->error_unassigned && $errorEnable) { + if ($errorEnable && $data->_getSmartyObj()->error_unassigned) { // force a notice $x = $$varName; } return new Smarty_Undefined_Variable; } - }
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_literals.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_literals.php new file mode 100644 index 000000000..08e1a473b --- /dev/null +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_literals.php @@ -0,0 +1,98 @@ +<?php + +/** + * Smarty Method GetLiterals + * + * Smarty::getLiterals() method + * + * @package Smarty + * @subpackage PluginsInternal + * @author Uwe Tews + */ +class Smarty_Internal_Method_Literals +{ + /** + * Valid for Smarty and template object + * + * @var int + */ + public $objMap = 3; + + /** + * Get literals + * + * @api Smarty::getLiterals() + * + * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj + * + * @return array list of literals + */ + public function getLiterals(Smarty_Internal_TemplateBase $obj) + { + $smarty = $obj->_getSmartyObj(); + return (array)$smarty->literals; + } + + /** + * Add literals + * + * @api Smarty::addLiterals() + * + * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj + * @param array|string $literals literal or list of literals + * to add + * + * @return \Smarty|\Smarty_Internal_Template + * @throws \SmartyException + */ + public function addLiterals(Smarty_Internal_TemplateBase $obj, $literals = null) + { + if (isset($literals)) { + $this->set($obj->_getSmartyObj(), (array)$literals); + } + return $obj; + } + + /** + * Set literals + * + * @api Smarty::setLiterals() + * + * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj + * @param array|string $literals literal or list of literals + * to set + * + * @return \Smarty|\Smarty_Internal_Template + * @throws \SmartyException + */ + public function setLiterals(Smarty_Internal_TemplateBase $obj, $literals = null) + { + $smarty = $obj->_getSmartyObj(); + $smarty->literals = array(); + if (!empty($literals)) { + $this->set($smarty, (array)$literals); + } + return $obj; + } + + /** + * common setter for literals for easier handling of duplicates the + * Smarty::$literals array gets filled with identical key values + * + * @param \Smarty $smarty + * @param array $literals + * + * @throws \SmartyException + */ + private function set(Smarty $smarty, $literals) + { + $literals = array_combine($literals, $literals); + $error = isset($literals[ $smarty->left_delimiter ]) ? array($smarty->left_delimiter) : array(); + $error = isset($literals[ $smarty->right_delimiter ]) ? $error[] = $smarty->right_delimiter : $error; + if (!empty($error)) { + throw new SmartyException('User defined literal(s) "' . $error . + '" may not be identical with left or right delimiter'); + } + $smarty->literals = array_merge((array)$smarty->literals, (array)$literals); + } +}
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadfilter.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadfilter.php index d092d876e..239fd6dd3 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadfilter.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadfilter.php @@ -58,7 +58,7 @@ class Smarty_Internal_Method_LoadFilter return true; } } - throw new SmartyException("{$type}filter \"{$name}\" not found or callable"); + throw new SmartyException("{$type}filter '{$name}' not found or callable"); } /** @@ -71,7 +71,7 @@ class Smarty_Internal_Method_LoadFilter public function _checkFilterType($type) { if (!isset($this->filterTypes[ $type ])) { - throw new SmartyException("Illegal filter type \"{$type}\""); + throw new SmartyException("Illegal filter type '{$type}'"); } } }
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadplugin.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadplugin.php index 50f3bfc2c..2454d9c9c 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadplugin.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadplugin.php @@ -76,7 +76,7 @@ class Smarty_Internal_Method_LoadPlugin } } $_file_names = array($_plugin_filename); - if ($_lower_filename != $_plugin_filename) { + if ($_lower_filename !== $_plugin_filename) { $_file_names[] = $_lower_filename; } $_p_dirs = $smarty->getPluginsDir(); diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_mustcompile.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_mustcompile.php index 0950ba9cf..62c16f626 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_mustcompile.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_mustcompile.php @@ -41,7 +41,7 @@ class Smarty_Internal_Method_MustCompile if ($_template->mustCompile === null) { $_template->mustCompile = (!$_template->source->handler->uncompiled && ($_template->smarty->force_compile || $_template->source->handler->recompiled || - !$_template->compiled->exists || ($_template->smarty->compile_check && + !$_template->compiled->exists || ($_template->compile_check && $_template->compiled->getTimeStamp() < $_template->source->getTimeStamp()))); } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php index 43088a1d4..c8c5ae73f 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php @@ -35,7 +35,7 @@ class Smarty_Internal_Method_RegisterDefaultConfigHandler if (is_callable($callback)) { $smarty->default_config_handler_func = $callback; } else { - throw new SmartyException("Default config handler not callable"); + throw new SmartyException('Default config handler not callable'); } return $obj; } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php index 569ea1062..4c5d396ed 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php @@ -35,7 +35,7 @@ class Smarty_Internal_Method_RegisterDefaultTemplateHandler if (is_callable($callback)) { $smarty->default_template_handler_func = $callback; } else { - throw new SmartyException("Default template handler not callable"); + throw new SmartyException('Default template handler not callable'); } return $obj; } @@ -62,7 +62,7 @@ class Smarty_Internal_Method_RegisterDefaultTemplateHandler if ($source->exists) { $source->timestamp = filemtime($_return); } else { - throw new SmartyException("Default handler: Unable to load " . + throw new SmartyException('Default handler: Unable to load ' . ($source->isConfig ? 'config' : 'template') . " default file '{$_return}' for '{$source->type}:{$source->name}'"); } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerfilter.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerfilter.php index ea8f75a85..77e41f37c 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerfilter.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerfilter.php @@ -46,7 +46,7 @@ class Smarty_Internal_Method_RegisterFilter $this->_checkFilterType($type); $name = isset($name) ? $name : $this->_getFilterName($callback); if (!is_callable($callback)) { - throw new SmartyException("{$type}filter \"{$name}\" not callable"); + throw new SmartyException("{$type}filter '{$name}' not callable"); } $smarty->registered_filters[ $type ][ $name ] = $callback; return $obj; @@ -82,7 +82,7 @@ class Smarty_Internal_Method_RegisterFilter public function _checkFilterType($type) { if (!isset($this->filterTypes[ $type ])) { - throw new SmartyException("Illegal filter type \"{$type}\""); + throw new SmartyException("Illegal filter type '{$type}'"); } } }
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php index 91f065920..64bf0ef15 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php @@ -40,9 +40,9 @@ class Smarty_Internal_Method_RegisterPlugin { $smarty = $obj->_getSmartyObj(); if (isset($smarty->registered_plugins[ $type ][ $name ])) { - throw new SmartyException("Plugin tag \"{$name}\" already registered"); + throw new SmartyException("Plugin tag '{$name}' already registered"); } elseif (!is_callable($callback)) { - throw new SmartyException("Plugin \"{$name}\" not callable"); + throw new SmartyException("Plugin '{$name}' not callable"); } else { $smarty->registered_plugins[ $type ][ $name ] = array($callback, (bool) $cacheable, (array) $cache_attr); } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php index df5ca6405..29653b08e 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php @@ -38,6 +38,7 @@ class Smarty_Internal_Method_SetAutoloadFilters * the appropriate types * * @return \Smarty|\Smarty_Internal_Template + * @throws \SmartyException */ public function setAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null) { @@ -64,7 +65,7 @@ class Smarty_Internal_Method_SetAutoloadFilters public function _checkFilterType($type) { if (!isset($this->filterTypes[ $type ])) { - throw new SmartyException("Illegal filter type \"{$type}\""); + throw new SmartyException("Illegal filter type '{$type}'"); } } }
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php index 9aa1d229b..1a5fdf19b 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php @@ -22,7 +22,8 @@ class Smarty_Internal_Method_UnloadFilter extends Smarty_Internal_Method_LoadFil * @param string $type filter type * @param string $name filter name * - * @return bool + * @return Smarty_Internal_TemplateBase + * @throws \SmartyException */ public function unloadFilter(Smarty_Internal_TemplateBase $obj, $type, $name) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php index c5b88f57d..fcc4e5d89 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php @@ -23,6 +23,7 @@ class Smarty_Internal_Method_UnregisterFilter extends Smarty_Internal_Method_Reg * @param callback|string $callback * * @return \Smarty|\Smarty_Internal_Template + * @throws \SmartyException */ public function unregisterFilter(Smarty_Internal_TemplateBase $obj, $type, $callback) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_nocache_insert.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_nocache_insert.php index 65fc143cd..2629d51f7 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_nocache_insert.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_nocache_insert.php @@ -30,7 +30,7 @@ class Smarty_Internal_Nocache_Insert public static function compile($_function, $_attr, $_template, $_script, $_assign = null) { $_output = '<?php '; - if ($_script != 'null') { + if ($_script !== 'null') { // script which must be included // code for script file loading $_output .= "require_once '{$_script}';"; @@ -38,16 +38,15 @@ class Smarty_Internal_Nocache_Insert // call insert if (isset($_assign)) { $_output .= "\$_smarty_tpl->assign('{$_assign}' , {$_function} (" . var_export($_attr, true) . - ",\$_smarty_tpl), true);?>"; + ',\$_smarty_tpl), true);?>'; } else { - $_output .= "echo {$_function}(" . var_export($_attr, true) . ",\$_smarty_tpl);?>"; + $_output .= "echo {$_function}(" . var_export($_attr, true) . ',$_smarty_tpl);?>'; } $_tpl = $_template; while ($_tpl->_isSubTpl()) { $_tpl = $_tpl->parent; } - return "/*%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/" . $_output . - "/*/%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/"; + return "/*%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/{$_output}/*/%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/"; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree.php index 32c9df094..b3e202efb 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree.php @@ -1,7 +1,7 @@ <?php /** - * Smarty Internal Plugin Templateparser Parsetrees - * These are classes to build parsetrees in the template parser + * Smarty Internal Plugin Templateparser Parsetree + * These are classes to build parsetree in the template parser * * @package Smarty * @subpackage Compiler diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_code.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_code.php index d0f0b3fd9..7bd0bc45c 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_code.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_code.php @@ -37,6 +37,6 @@ class Smarty_Internal_ParseTree_Code extends Smarty_Internal_ParseTree */ public function to_smarty_php(Smarty_Internal_Templateparser $parser) { - return sprintf("(%s)", $this->data); + return sprintf('(%s)', $this->data); } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dq.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dq.php index 8c2e0d993..a57e629c6 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dq.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dq.php @@ -74,8 +74,8 @@ class Smarty_Internal_ParseTree_Dq extends Smarty_Internal_ParseTree { $code = ''; foreach ($this->subtrees as $subtree) { - if ($code !== "") { - $code .= "."; + if ($code !== '') { + $code .= '.'; } if ($subtree instanceof Smarty_Internal_ParseTree_Tag) { $more_php = $subtree->assign_to_var($parser); diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_tag.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_tag.php index 9058aabfb..8e19ec294 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_tag.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_tag.php @@ -62,7 +62,7 @@ class Smarty_Internal_ParseTree_Tag extends Smarty_Internal_ParseTree $var = $parser->compiler->getNewPrefixVariable(); $tmp = $parser->compiler->appendCode('<?php ob_start();?>', $this->data); $tmp = $parser->compiler->appendCode($tmp, "<?php {$var}=ob_get_clean();?>"); - $parser->compiler->prefix_code[] = sprintf("%s", $tmp); + $parser->compiler->prefix_code[] = sprintf('%s', $tmp); return $var; } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php index f6032351e..26612d4c7 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php @@ -91,14 +91,14 @@ class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Text) { $subtree = $this->subtrees[ $key ]->to_smarty_php($parser); while ($key + 1 < $cnt && ($this->subtrees[ $key + 1 ] instanceof Smarty_Internal_ParseTree_Text || - $this->subtrees[ $key + 1 ]->data == '')) { + $this->subtrees[ $key + 1 ]->data === '')) { $key ++; - if ($this->subtrees[ $key ]->data == '') { + if ($this->subtrees[ $key ]->data === '') { continue; } $subtree .= $this->subtrees[ $key ]->to_smarty_php($parser); } - if ($subtree == '') { + if ($subtree === '') { continue; } $code .= preg_replace('/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/', "<?php echo '\$1'; ?>\n", @@ -108,14 +108,14 @@ class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Tag) { $subtree = $this->subtrees[ $key ]->to_smarty_php($parser); while ($key + 1 < $cnt && ($this->subtrees[ $key + 1 ] instanceof Smarty_Internal_ParseTree_Tag || - $this->subtrees[ $key + 1 ]->data == '')) { + $this->subtrees[ $key + 1 ]->data === '')) { $key ++; - if ($this->subtrees[ $key ]->data == '') { + if ($this->subtrees[ $key ]->data === '') { continue; } $subtree = $parser->compiler->appendCode($subtree, $this->subtrees[ $key ]->to_smarty_php($parser)); } - if ($subtree == '') { + if ($subtree === '') { continue; } $code .= $subtree; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_extends.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_extends.php index 4f1f09ea5..23a624729 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_extends.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_extends.php @@ -42,7 +42,7 @@ class Smarty_Internal_Resource_Extends extends Smarty_Resource foreach ($components as $component) { /* @var \Smarty_Template_Source $_s */ $_s = Smarty_Template_Source::load(null, $smarty, $component); - if ($_s->type == 'php') { + if ($_s->type === 'php') { throw new SmartyException("Resource type {$_s->type} cannot be used with the extends resource type"); } $sources[ $_s->uid ] = $_s; @@ -118,6 +118,9 @@ class Smarty_Internal_Resource_Extends extends Smarty_Resource * * @return bool */ + /** + * @return bool + */ public function checkTimestamps() { return false; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_file.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_file.php index a58771a17..9dcda7fcb 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_file.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_file.php @@ -30,32 +30,32 @@ class Smarty_Internal_Resource_File extends Smarty_Resource { $file = $source->name; // absolute file ? - if ($file[ 0 ] == '/' || $file[ 1 ] == ':') { + if ($file[ 0 ] === '/' || $file[ 1 ] === ':') { $file = $source->smarty->_realpath($file, true); return is_file($file) ? $file : false; } // go relative to a given template? - if ($file[ 0 ] == '.' && $_template && $_template->_isSubTpl() && + if ($file[ 0 ] === '.' && $_template && $_template->_isSubTpl() && preg_match('#^[.]{1,2}[\\\/]#', $file) ) { - if ($_template->parent->source->type != 'file' && $_template->parent->source->type != 'extends' && + if ($_template->parent->source->type !== 'file' && $_template->parent->source->type !== 'extends' && !isset($_template->parent->_cache[ 'allow_relative_path' ]) ) { throw new SmartyException("Template '{$file}' cannot be relative to template of resource type '{$_template->parent->source->type}'"); } // normalize path - $path = $source->smarty->_realpath(dirname($_template->parent->source->filepath) . $source->smarty->ds . $file); + $path = $source->smarty->_realpath(dirname($_template->parent->source->filepath) . DIRECTORY_SEPARATOR . $file); // files relative to a template only get one shot return is_file($path) ? $path : false; } - // normalize $source->smarty->ds - if (strpos($file, $source->smarty->ds == '/' ? '\\' : '/') !== false) { - $file = str_replace($source->smarty->ds == '/' ? '\\' : '/', $source->smarty->ds, $file); + // normalize DIRECTORY_SEPARATOR + if (strpos($file, DIRECTORY_SEPARATOR === '/' ? '\\' : '/') !== false) { + $file = str_replace(DIRECTORY_SEPARATOR === '/' ? '\\' : '/', DIRECTORY_SEPARATOR, $file); } $_directories = $source->smarty->getTemplateDir(null, $source->isConfig); // template_dir index? - if ($file[ 0 ] == '[' && preg_match('#^\[([^\]]+)\](.+)$#', $file, $fileMatch)) { + if ($file[ 0 ] === '[' && preg_match('#^\[([^\]]+)\](.+)$#', $file, $fileMatch)) { $file = $fileMatch[ 2 ]; $_indices = explode(',', $fileMatch[ 1 ]); $_index_dirs = array(); @@ -90,7 +90,7 @@ class Smarty_Internal_Resource_File extends Smarty_Resource foreach ($_directories as $_directory) { $path = $_directory . $file; if (is_file($path)) { - return (strpos($path, '.' . $source->smarty->ds) !== false) ? $source->smarty->_realpath($path) : $path; + return (strpos($path, '.' . DIRECTORY_SEPARATOR) !== false) ? $source->smarty->_realpath($path) : $path; } } if (!isset($_index_dirs)) { @@ -112,6 +112,8 @@ class Smarty_Internal_Resource_File extends Smarty_Resource * * @param Smarty_Template_Source $source source object * @param Smarty_Internal_Template $_template template object + * + * @throws \SmartyException */ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_php.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_php.php index 52e7096b3..6f685abe4 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_php.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_php.php @@ -19,25 +19,25 @@ class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File public $uncompiled = true; /** - * container for short_open_tag directive's value before executing PHP templates + * Resource does implement populateCompiledFilepath() method * - * @var string + * @var bool */ - protected $short_open_tag; + public $hasCompiledHandler = true; /** - * Resource does implement populateCompiledFilepath() method + * container for short_open_tag directive's value before executing PHP templates * - * @var bool + * @var string */ - public $hasCompiledHandler = true; + protected $short_open_tag; /** * Create a new PHP Resource */ public function __construct() { - $this->short_open_tag = ini_get('short_open_tag'); + $this->short_open_tag = function_exists('ini_get') ? ini_get('short_open_tag') : 1; } /** @@ -57,6 +57,23 @@ class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File } /** + * populate compiled object with compiled filepath + * + * @param Smarty_Template_Compiled $compiled compiled object + * @param Smarty_Internal_Template $_template template object (is ignored) + */ + public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template) + { + $compiled->filepath = $_template->source->filepath; + $compiled->timestamp = $_template->source->timestamp; + $compiled->exists = $_template->source->exists; + $compiled->file_dependency[ $_template->source->uid ] = + array($compiled->filepath, + $compiled->timestamp, + $_template->source->type,); + } + + /** * Render and output the template (without using the compiler) * * @param Smarty_Template_Source $source source object @@ -68,10 +85,10 @@ class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File public function renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template) { if (!$source->smarty->allow_php_templates) { - throw new SmartyException("PHP templates are disabled"); + throw new SmartyException('PHP templates are disabled'); } if (!$source->exists) { - throw new SmartyException("Unable to load template {$source->type} '{$source->name}'" . + throw new SmartyException("Unable to load template '{$source->type}:{$source->name}'" . ($_template->_isSubTpl() ? " in '{$_template->parent->template_resource}'" : '')); } @@ -79,28 +96,16 @@ class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File extract($_template->getTemplateVars()); // include PHP template with short open tags enabled - ini_set('short_open_tag', '1'); + if (function_exists('ini_set')) { + ini_set('short_open_tag', '1'); + } /** @var Smarty_Internal_Template $_smarty_template * used in included file */ $_smarty_template = $_template; include($source->filepath); - ini_set('short_open_tag', $this->short_open_tag); - } - - /** - * populate compiled object with compiled filepath - * - * @param Smarty_Template_Compiled $compiled compiled object - * @param Smarty_Internal_Template $_template template object (is ignored) - */ - public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template) - { - $compiled->filepath = $_template->source->filepath; - $compiled->timestamp = $_template->source->timestamp; - $compiled->exists = $_template->source->exists; - $compiled->file_dependency[ $_template->source->uid ] = - array($compiled->filepath, $compiled->timestamp, - $_template->source->type,); + if (function_exists('ini_set')) { + ini_set('short_open_tag', $this->short_open_tag); + } } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_stream.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_stream.php index b4248fbb5..f358db01d 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_stream.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_stream.php @@ -26,6 +26,7 @@ class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled * @param Smarty_Internal_Template $_template template object * * @return void + * @throws \SmartyException */ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_string.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_string.php index f2610d9d6..0175d5182 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_string.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_string.php @@ -99,6 +99,9 @@ class Smarty_Internal_Resource_String extends Smarty_Resource * * @return bool */ + /** + * @return bool + */ public function checkTimestamps() { return false; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php index a91874a9f..dfbf7115b 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php @@ -16,6 +16,9 @@ class Smarty_Internal_Runtime_CacheModify * @param \Smarty_Template_Cached $cached * @param \Smarty_Internal_Template $_template * @param string $content + * + * @throws \Exception + * @throws \SmartyException */ public function cacheModifiedCheck(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php index 7b7a9f685..a9ff5789a 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php @@ -1,5 +1,4 @@ <?php - /** * Smarty cache resource file clear method * @@ -7,7 +6,6 @@ * @subpackage PluginsInternal * @author Uwe Tews */ - /** * Smarty Internal Runtime Cache Resource File Class * @@ -34,7 +32,7 @@ class Smarty_Internal_Runtime_CacheResourceFile $_dir_sep = $smarty->use_sub_dirs ? '/' : '^'; $_compile_id_offset = $smarty->use_sub_dirs ? 3 : 0; $_dir = $smarty->getCacheDir(); - if ($_dir == '/') { //We should never want to delete this! + if ($_dir === '/') { //We should never want to delete this! return 0; } $_dir_length = strlen($_dir); @@ -43,19 +41,17 @@ class Smarty_Internal_Runtime_CacheResourceFile $_cache_id_parts_count = count($_cache_id_parts); if ($smarty->use_sub_dirs) { foreach ($_cache_id_parts as $id_part) { - $_dir .= $id_part . $smarty->ds; + $_dir .= $id_part . DIRECTORY_SEPARATOR; } } } if (isset($resource_name)) { $_save_stat = $smarty->caching; - $smarty->caching = true; + $smarty->caching = Smarty::CACHING_LIFETIME_CURRENT; $tpl = new $smarty->template_class($resource_name, $smarty); $smarty->caching = $_save_stat; - // remove from template cache $tpl->source; // have the template registered before unset() - if ($tpl->source->exists) { $_resourcename_parts = basename(str_replace('^', '/', $tpl->cached->filepath)); } else { @@ -68,10 +64,10 @@ class Smarty_Internal_Runtime_CacheResourceFile $_cacheDirs = new RecursiveDirectoryIterator($_dir); $_cache = new RecursiveIteratorIterator($_cacheDirs, RecursiveIteratorIterator::CHILD_FIRST); foreach ($_cache as $_file) { - if (substr(basename($_file->getPathname()), 0, 1) == '.') { + if (substr(basename($_file->getPathname()), 0, 1) === '.') { continue; } - $_filepath = (string) $_file; + $_filepath = (string)$_file; // directory ? if ($_file->isDir()) { if (!$_cache->isDot()) { @@ -87,13 +83,13 @@ class Smarty_Internal_Runtime_CacheResourceFile $_parts_count = count($_parts); // check name if (isset($resource_name)) { - if ($_parts[ $_parts_count - 1 ] != $_resourcename_parts) { + if ($_parts[ $_parts_count - 1 ] !== $_resourcename_parts) { continue; } } // check compile id if (isset($_compile_id) && (!isset($_parts[ $_parts_count - 2 - $_compile_id_offset ]) || - $_parts[ $_parts_count - 2 - $_compile_id_offset ] != $_compile_id) + $_parts[ $_parts_count - 2 - $_compile_id_offset ] !== $_compile_id) ) { continue; } @@ -105,28 +101,34 @@ class Smarty_Internal_Runtime_CacheResourceFile if ($_parts_count < $_cache_id_parts_count) { continue; } - for ($i = 0; $i < $_cache_id_parts_count; $i ++) { - if ($_parts[ $i ] != $_cache_id_parts[ $i ]) { + for ($i = 0; $i < $_cache_id_parts_count; $i++) { + if ($_parts[ $i ] !== $_cache_id_parts[ $i ]) { continue 2; } } } - // expired ? - if (isset($exp_time)) { - if ($exp_time < 0) { - preg_match('#\'cache_lifetime\' =>\s*(\d*)#', file_get_contents($_file), $match); - if ($_time < (@filemtime($_file) + $match[ 1 ])) { - continue; - } - } else { - if ($_time - @filemtime($_file) < $exp_time) { - continue; + if (is_file($_filepath)) { + // expired ? + if (isset($exp_time)) { + if ($exp_time < 0) { + preg_match('#\'cache_lifetime\' =>\s*(\d*)#', file_get_contents($_filepath), $match); + if ($_time < (filemtime($_filepath) + $match[ 1 ])) { + continue; + } + } else { + if ($_time - filemtime($_filepath) < $exp_time) { + continue; + } } } - } - $_count += @unlink($_filepath) ? 1 : 0; - if (function_exists('opcache_invalidate') && strlen(ini_get("opcache.restrict_api")) < 1) { - opcache_invalidate($_filepath, true); + $_count += @unlink($_filepath) ? 1 : 0; + if (function_exists('opcache_invalidate') + && (!function_exists('ini_get') || strlen(ini_get("opcache.restrict_api")) < 1) + ) { + opcache_invalidate($_filepath, true); + } else if (function_exists('apc_delete_file')) { + apc_delete_file($_filepath); + } } } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_capture.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_capture.php index 69f1ce0cf..80ffa35b2 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_capture.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_capture.php @@ -64,7 +64,9 @@ class Smarty_Internal_Runtime_Capture if (!$this->isRegistered) { $this->register($_template); } - $this->captureStack[] = array($buffer, $assign, $append); + $this->captureStack[] = array($buffer, + $assign, + $append); $this->captureCount ++; ob_start(); } @@ -76,8 +78,10 @@ class Smarty_Internal_Runtime_Capture */ private function register(Smarty_Internal_Template $_template) { - $_template->startRenderCallbacks[] = array($this, 'startRender'); - $_template->endRenderCallbacks[] = array($this, 'endRender'); + $_template->startRenderCallbacks[] = array($this, + 'startRender'); + $_template->endRenderCallbacks[] = array($this, + 'endRender'); $this->startRender($_template); $this->isRegistered = true; } @@ -126,20 +130,24 @@ class Smarty_Internal_Runtime_Capture */ public function error(Smarty_Internal_Template $_template) { - throw new SmartyException("Not matching {capture}{/capture} in \"{$_template->template_resource}\""); + throw new SmartyException("Not matching {capture}{/capture} in '{$_template->template_resource}'"); } /** - * Return content of named capture buffer + * Return content of named capture buffer by key or as array * * @param \Smarty_Internal_Template $_template - * @param $name + * @param string|null $name * - * @return null + * @return string|string[]|null */ - public function getBuffer(Smarty_Internal_Template $_template, $name) + public function getBuffer(Smarty_Internal_Template $_template, $name = null) { - return isset($this->namedBuffer[ $name ]) ? $this->namedBuffer[ $name ] : null; + if (isset($name)) { + return isset($this->namedBuffer[ $name ]) ? $this->namedBuffer[ $name ] : null; + } else { + return $this->namedBuffer; + } } /** diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php index e363712a6..f792496f9 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php @@ -41,58 +41,55 @@ class Smarty_Internal_Runtime_CodeFrame $properties[ 'cache_lifetime' ] = $_template->cache_lifetime; } $output = "<?php\n"; - $output .= "/* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") . - "\n from \"" . $_template->source->filepath . "\" */\n\n"; + $output .= "/* Smarty version {$properties[ 'version' ]}, created on " . strftime("%Y-%m-%d %H:%M:%S") . + "\n from '" . str_replace('*/','* /',$_template->source->filepath) . "' */\n\n"; $output .= "/* @var Smarty_Internal_Template \$_smarty_tpl */\n"; $dec = "\$_smarty_tpl->_decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' . - ($cache ? 'true' : 'false') . ")"; + ($cache ? 'true' : 'false') . ')'; $output .= "if ({$dec}) {\n"; $output .= "function {$properties['unifunc']} (Smarty_Internal_Template \$_smarty_tpl) {\n"; if (!$cache && !empty($compiler->tpl_function)) { - $output .= "\$_smarty_tpl->smarty->ext->_tplFunction->registerTplFunctions(\$_smarty_tpl, " . - var_export($compiler->tpl_function, true) . ");\n"; + $output .= '$_smarty_tpl->smarty->ext->_tplFunction->registerTplFunctions($_smarty_tpl, '; + $output .= var_export($compiler->tpl_function, true); + $output .= ");\n"; } if ($cache && isset($_template->smarty->ext->_tplFunction)) { $output .= "\$_smarty_tpl->smarty->ext->_tplFunction->registerTplFunctions(\$_smarty_tpl, " . var_export($_template->smarty->ext->_tplFunction->getTplFunction($_template), true) . ");\n"; } - // include code for plugins - if (!$cache) { - if (!empty($_template->compiled->required_plugins[ 'compiled' ])) { - foreach ($_template->compiled->required_plugins[ 'compiled' ] as $tmp) { - foreach ($tmp as $data) { - $file = addslashes($data[ 'file' ]); - if (is_array($data[ 'function' ])) { - $output .= "if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n"; - } else { - $output .= "if (!is_callable('{$data['function']}')) require_once '{$file}';\n"; - } - } - } - } - if ($_template->caching && !empty($_template->compiled->required_plugins[ 'nocache' ])) { - $_template->compiled->has_nocache_code = true; - $output .= "echo '/*%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/<?php \$_smarty = \$_smarty_tpl->smarty; "; - foreach ($_template->compiled->required_plugins[ 'nocache' ] as $tmp) { - foreach ($tmp as $data) { - $file = addslashes($data[ 'file' ]); - if (is_array($data[ 'function' ])) { - $output .= addslashes("if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n"); - } else { - $output .= addslashes("if (!is_callable('{$data['function']}')) require_once '{$file}';\n"); - } - } - } - $output .= "?>/*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/';\n"; - } + // include code for required plugins + if (!$cache && isset($compiler)) { + $output .= $compiler->compileRequiredPlugins(); } - $output .= "?>\n"; + $output .= "?>"; $output .= $content; $output .= "<?php }\n?>"; $output .= $functions; $output .= "<?php }\n"; // remove unneeded PHP tags - return preg_replace(array('/\s*\?>[\n]?<\?php\s*/', '/\?>\s*$/'), array("\n", ''), $output); + if (preg_match('/\s*\?>[\n]?<\?php\s*/', $output)) { + $curr_split = preg_split('/\s*\?>[\n]?<\?php\s*/', + $output); + preg_match_all('/\s*\?>[\n]?<\?php\s*/', + $output, + $curr_parts); + $output = ''; + foreach ($curr_split as $idx => $curr_output) { + $output .= $curr_output; + if (isset($curr_parts[ 0 ][ $idx ])) { + $output .= "\n"; + } + } + } + if (preg_match('/\?>\s*$/', $output)) { + $curr_split = preg_split('/\?>\s*$/', + $output); + $output = ''; + foreach ($curr_split as $idx => $curr_output) { + $output .= $curr_output; + } + } + return $output; } }
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php index f6cfa7c44..9d7d2db2e 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php @@ -48,11 +48,11 @@ class Smarty_Internal_Runtime_FilterHandler // loaded class of filter plugin $callback = array($plugin_name, 'execute'); } else { - throw new SmartyException("Auto load {$type}-filter plugin method \"{$plugin_name}::execute\" not callable"); + throw new SmartyException("Auto load {$type}-filter plugin method '{$plugin_name}::execute' not callable"); } } else { // nothing found, throw exception - throw new SmartyException("Unable to auto load {$type}-filter plugin \"{$plugin_name}\""); + throw new SmartyException("Unable to auto load {$type}-filter plugin '{$plugin_name}'"); } $content = call_user_func($callback, $content, $template); } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_foreach.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_foreach.php index 1e8655d92..8b60768bc 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_foreach.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_foreach.php @@ -50,7 +50,8 @@ class Smarty_Internal_Runtime_Foreach $total = empty($from) ? 0 : (($needTotal || isset($properties[ 'total' ])) ? count($from) : 1); } if (isset($tpl->tpl_vars[ $item ])) { - $saveVars[ 'item' ] = array($item, $tpl->tpl_vars[ $item ]); + $saveVars[ 'item' ] = array($item, + $tpl->tpl_vars[ $item ]); } $tpl->tpl_vars[ $item ] = new Smarty_Variable(null, $tpl->isRenderingCache); if ($total === 0) { @@ -58,7 +59,8 @@ class Smarty_Internal_Runtime_Foreach } else { if ($key) { if (isset($tpl->tpl_vars[ $key ])) { - $saveVars[ 'key' ] = array($key, $tpl->tpl_vars[ $key ]); + $saveVars[ 'key' ] = array($key, + $tpl->tpl_vars[ $key ]); } $tpl->tpl_vars[ $key ] = new Smarty_Variable(null, $tpl->isRenderingCache); } @@ -69,7 +71,8 @@ class Smarty_Internal_Runtime_Foreach if ($name) { $namedVar = "__smarty_foreach_{$name}"; if (isset($tpl->tpl_vars[ $namedVar ])) { - $saveVars[ 'named' ] = array($namedVar, $tpl->tpl_vars[ $namedVar ]); + $saveVars[ 'named' ] = array($namedVar, + $tpl->tpl_vars[ $namedVar ]); } $namedProp = array(); if (isset($properties[ 'total' ])) { @@ -91,6 +94,33 @@ class Smarty_Internal_Runtime_Foreach } /** + * + * [util function] counts an array, arrayAccess/traversable or PDOStatement object + * + * @param mixed $value + * + * @return int the count for arrays and objects that implement countable, 1 for other objects that don't, and 0 + * for empty elements + */ + public function count($value) + { + if ($value instanceof IteratorAggregate) { + // Note: getIterator() returns a Traversable, not an Iterator + // thus rewind() and valid() methods may not be present + return iterator_count($value->getIterator()); + } elseif ($value instanceof Iterator) { + return $value instanceof Generator ? 1 : iterator_count($value); + } elseif ($value instanceof Countable) { + return count($value); + } elseif ($value instanceof PDOStatement) { + return $value->rowCount(); + } elseif ($value instanceof Traversable) { + return iterator_count($value); + } + return count((array) $value); + } + + /** * Restore saved variables * * will be called by {break n} or {continue n} for the required number of levels @@ -114,36 +144,8 @@ class Smarty_Internal_Runtime_Foreach $tpl->tpl_vars[ $saveVars[ 'named' ][ 0 ] ] = $saveVars[ 'named' ][ 1 ]; } } - $levels--; + $levels --; } } - /* - * - * [util function] counts an array, arrayAccess/traversable or PDOStatement object - * - * @param mixed $value - * - * @return int the count for arrays and objects that implement countable, 1 for other objects that don't, and 0 - * for empty elements - */ - public function count($value) - { - if ($value instanceof Countable) { - return count($value); - } elseif ($value instanceof IteratorAggregate) { - // Note: getIterator() returns a Traversable, not an Iterator - // thus rewind() and valid() methods may not be present - return iterator_count($value->getIterator()); - } elseif ($value instanceof Iterator) { - return $value instanceof Generator ? 1 : iterator_count($value); - } elseif ($value instanceof PDOStatement) { - return $value->rowCount(); - } elseif ($value instanceof Traversable) { - return iterator_count($value); - } elseif ($value instanceof ArrayAccess) { - return $value->offsetExists(0) ? 1 : 0; - } - return count((array) $value); - } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php index e12b0c57c..54b1bb3d5 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php @@ -21,49 +21,42 @@ class Smarty_Internal_Runtime_GetIncludePath * @var string */ public $_include_path = ''; - /** * include path directory cache * * @var array */ public $_include_dirs = array(); - /** * include path directory cache * * @var array */ public $_user_dirs = array(); - /** * stream cache * - * @var string[] + * @var string[][] */ public $isFile = array(); - /** * stream cache * * @var string[] */ public $isPath = array(); - /** * stream cache * * @var int[] */ public $number = array(); - /** * status cache * * @var bool */ public $_has_stream_include = null; - /** * Number for array index * @@ -81,13 +74,13 @@ class Smarty_Internal_Runtime_GetIncludePath public function isNewIncludePath(Smarty $smarty) { $_i_path = get_include_path(); - if ($this->_include_path != $_i_path) { + if ($this->_include_path !== $_i_path) { $this->_include_dirs = array(); $this->_include_path = $_i_path; - $_dirs = (array) explode(PATH_SEPARATOR, $_i_path); + $_dirs = (array)explode(PATH_SEPARATOR, $_i_path); foreach ($_dirs as $_path) { if (is_dir($_path)) { - $this->_include_dirs[] = $smarty->_realpath($_path . $smarty->ds, true); + $this->_include_dirs[] = $smarty->_realpath($_path . DIRECTORY_SEPARATOR, true); } } return true; @@ -128,7 +121,7 @@ class Smarty_Internal_Runtime_GetIncludePath } // try PHP include_path foreach ($dirs as $dir) { - $dir_n = isset($this->number[ $dir ]) ? $this->number[ $dir ] : $this->number[ $dir ] = $this->counter ++; + $dir_n = isset($this->number[ $dir ]) ? $this->number[ $dir ] : $this->number[ $dir ] = $this->counter++; if (isset($this->isFile[ $dir_n ][ $file ])) { if ($this->isFile[ $dir_n ][ $file ]) { return $this->isFile[ $dir_n ][ $file ]; @@ -143,9 +136,9 @@ class Smarty_Internal_Runtime_GetIncludePath $dir = $this->_user_dirs[ $dir_n ]; } } else { - if ($dir[ 0 ] == '/' || $dir[ 1 ] == ':') { + if ($dir[ 0 ] === '/' || $dir[ 1 ] === ':') { $dir = str_ireplace(getcwd(), '.', $dir); - if ($dir[ 0 ] == '/' || $dir[ 1 ] == ':') { + if ($dir[ 0 ] === '/' || $dir[ 1 ] === ':') { $this->_user_dirs[ $dir_n ] = false; continue; } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php index 7ec5924e6..b593b78eb 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php @@ -46,7 +46,6 @@ class Smarty_Internal_Runtime_Inheritance /** * Array of template source objects - * - key template index * * @var Smarty_Template_Source[] */ @@ -70,12 +69,12 @@ class Smarty_Internal_Runtime_Inheritance public function init(Smarty_Internal_Template $tpl, $initChild, $blockNames = array()) { // if called while executing parent template it must be a sub-template with new inheritance root - if ($initChild && $this->state == 3 && (strpos($tpl->template_resource, 'extendsall') === false)) { + if ($initChild && $this->state === 3 && (strpos($tpl->template_resource, 'extendsall') === false)) { $tpl->inheritance = new Smarty_Internal_Runtime_Inheritance(); $tpl->inheritance->init($tpl, $initChild, $blockNames); return; } - $this->tplIndex ++; + ++$this->tplIndex; $this->sources[ $this->tplIndex ] = $tpl->source; // start of child sub template(s) @@ -85,12 +84,12 @@ class Smarty_Internal_Runtime_Inheritance //grab any output of child templates ob_start(); } - $this->inheritanceLevel ++; + ++$this->inheritanceLevel; // $tpl->startRenderCallbacks[ 'inheritance' ] = array($this, 'subTemplateStart'); // $tpl->endRenderCallbacks[ 'inheritance' ] = array($this, 'subTemplateEnd'); } // if state was waiting for parent change state to parent - if ($this->state == 2) { + if ($this->state === 2) { $this->state = 3; } } @@ -100,32 +99,46 @@ class Smarty_Internal_Runtime_Inheritance * - if outer level is reached flush output buffer and switch to wait for parent template state * * @param \Smarty_Internal_Template $tpl - * @param null|string $template optinal name of inheritance parent template + * @param null|string $template optional name of inheritance parent template * @param null|string $uid uid of inline template * @param null|string $func function call name of inline template + * + * @throws \Exception + * @throws \SmartyException */ public function endChild(Smarty_Internal_Template $tpl, $template = null, $uid = null, $func = null) { - $this->inheritanceLevel --; + --$this->inheritanceLevel; if (!$this->inheritanceLevel) { ob_end_clean(); $this->state = 2; } - if (isset($template) && (($tpl->parent->_isTplObj() && $tpl->parent->source->type !== 'extends') || $tpl->smarty->extends_recursion)) { - $tpl->_subTemplateRender($template, $tpl->cache_id, $tpl->compile_id, $tpl->caching ? 9999 : 0, - $tpl->cache_lifetime, array(), 2, false, $uid, $func); + if (isset($template) && (($tpl->parent->_isTplObj() && $tpl->parent->source->type !== 'extends') || + $tpl->smarty->extends_recursion)) { + $tpl->_subTemplateRender($template, + $tpl->cache_id, + $tpl->compile_id, + $tpl->caching ? 9999 : 0, + $tpl->cache_lifetime, + array(), + 2, + false, + $uid, + $func); } } /** * Smarty_Internal_Block constructor. - * - if outer level {block} of child template ($state == 1) save it as child root block + * - if outer level {block} of child template ($state === 1) save it as child root block * - otherwise process inheritance and render * * @param \Smarty_Internal_Template $tpl * @param $className * @param string $name * @param int|null $tplIndex index of outer level {block} if nested + * + * @throws \SmartyException */ public function instanceBlock(Smarty_Internal_Template $tpl, $className, $name, $tplIndex = null) { @@ -133,7 +146,7 @@ class Smarty_Internal_Runtime_Inheritance if (isset($this->childRoot[ $name ])) { $block->child = $this->childRoot[ $name ]; } - if ($this->state == 1) { + if ($this->state === 1) { $this->childRoot[ $name ] = $block; return; } @@ -164,7 +177,7 @@ class Smarty_Internal_Runtime_Inheritance } $block->parent = $parent; if ($block->append && !$block->prepend && isset($parent)) { - $this->callParent($tpl, $block); + $this->callParent($tpl, $block, '\'{block append}\''); } if ($block->callsChild || !isset($block->child) || ($block->child->hide && !isset($block->child->child))) { $this->callBlock($block, $tpl); @@ -172,7 +185,7 @@ class Smarty_Internal_Runtime_Inheritance $this->process($tpl, $block->child, $block); } if ($block->prepend && isset($parent)) { - $this->callParent($tpl, $block); + $this->callParent($tpl, $block, '{block prepend}'); if ($block->append) { if ($block->callsChild || !isset($block->child) || ($block->child->hide && !isset($block->child->child)) @@ -187,10 +200,13 @@ class Smarty_Internal_Runtime_Inheritance } /** - * Render child on {$smarty.block.child} + * Render child on \$smarty.block.child * * @param \Smarty_Internal_Template $tpl * @param \Smarty_Internal_Block $block + * + * @return null|string block content + * @throws \SmartyException */ public function callChild(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block) { @@ -200,34 +216,27 @@ class Smarty_Internal_Runtime_Inheritance } /** - * Render parent on {$smarty.block.parent} or {block append/prepend} * + * Render parent block on \$smarty.block.parent or {block append/prepend} * * @param \Smarty_Internal_Template $tpl * @param \Smarty_Internal_Block $block + * @param string $tag * - * @param null $name - * + * @return null|string block content * @throws \SmartyException */ - public function callParent(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block, $name = null) + public function callParent(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block, $tag) { - if (isset($name)) { - $block = $block->parent; - while (isset($block)) { - if (isset($block->subBlocks[ $name ])) { - } else { - $block = $block->parent; - } - } - return; - } else if (isset($block->parent)) { + if (isset($block->parent)) { $this->callBlock($block->parent, $tpl); } else { - throw new SmartyException("inheritance: illegal {\$smarty.block.parent} or {block append/prepend} used in parent template '{$tpl->inheritance->sources[$block->tplIndex]->filepath}' block '{$block->name}'"); + throw new SmartyException("inheritance: illegal '{$tag}' used in child template '{$tpl->inheritance->sources[$block->tplIndex]->filepath}' block '{$block->name}'"); } } /** + * render block + * * @param \Smarty_Internal_Block $block * @param \Smarty_Internal_Template $tpl */ diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php index f6b36f2a5..b86563cb3 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php @@ -120,15 +120,13 @@ class Smarty_Internal_Runtime_TplFunction } // add template function code to cache file if (isset($tplPtr->cached)) { - /* @var Smarty_Template_Cached $cache */ - $cache = $tplPtr->cached; - $content = $cache->read($tplPtr); + $content = $tplPtr->cached->read($tplPtr); if ($content) { // check if we must update file dependency if (!preg_match("/'{$funcParam['uid']}'(.*?)'nocache_hash'/", $content, $match2)) { $content = preg_replace("/('file_dependency'(.*?)\()/", "\\1{$match1[0]}", $content); } - $tplPtr->smarty->ext->_updateCache->write($cache, $tplPtr, + $tplPtr->smarty->ext->_updateCache->write($tplPtr, preg_replace('/\s*\?>\s*$/', "\n", $content) . "\n" . preg_replace(array('/^\s*<\?php\s+/', '/\s*\?>\s*$/',), "\n", diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php index ceee3b718..bb3e4e138 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php @@ -22,6 +22,41 @@ class Smarty_Internal_Runtime_UpdateCache } /** + * Cache was invalid , so render from compiled and write to cache + * + * @param \Smarty_Template_Cached $cached + * @param \Smarty_Internal_Template $_template + * @param $no_output_filter + * + * @throws \Exception + */ + public function updateCache(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $no_output_filter) + { + ob_start(); + if (!isset($_template->compiled)) { + $_template->loadCompiled(); + } + $_template->compiled->render($_template); + if ($_template->smarty->debugging) { + $_template->smarty->_debug->start_cache($_template); + } + $this->removeNoCacheHash($cached, $_template, $no_output_filter); + $compile_check = (int)$_template->compile_check; + $_template->compile_check = Smarty::COMPILECHECK_OFF; + if ($_template->_isSubTpl()) { + $_template->compiled->unifunc = $_template->parent->compiled->unifunc; + } + if (!$_template->cached->processed) { + $_template->cached->process($_template, true); + } + $_template->compile_check = $compile_check; + $cached->getRenderedTemplateCode($_template); + if ($_template->smarty->debugging) { + $_template->smarty->_debug->end_cache($_template); + } + } + + /** * Sanitize content and write it to cache resource * * @param \Smarty_Template_Cached $cached @@ -30,35 +65,47 @@ class Smarty_Internal_Runtime_UpdateCache * * @throws \SmartyException */ - public function removeNoCacheHash(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, + public function removeNoCacheHash(Smarty_Template_Cached $cached, + Smarty_Internal_Template $_template, $no_output_filter) { + $php_pattern = '/(<%|%>|<\?php|<\?|\?>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>)/'; $content = ob_get_clean(); - unset($cached->hashes[ $_template->compiled->nocache_hash ]); - if (!empty($cached->hashes)) { - $hash_array = array(); - foreach ($cached->hashes as $hash => $foo) { - $hash_array[] = "/{$hash}/"; - } - $content = preg_replace($hash_array, $_template->compiled->nocache_hash, $content); - } + $hash_array = $cached->hashes; + $hash_array[$_template->compiled->nocache_hash] = true; + $hash_array = array_keys($hash_array); + $nocache_hash = '(' . implode('|', $hash_array) . ')'; $_template->cached->has_nocache_code = false; // get text between non-cached items $cache_split = - preg_split("!/\*%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*/!s", + preg_split("!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s", $content); // get non-cached items - preg_match_all("!/\*%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*/!s", - $content, $cache_parts); + preg_match_all("!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s", + $content, + $cache_parts); $content = ''; // loop over items, stitch back together foreach ($cache_split as $curr_idx => $curr_split) { - // escape PHP tags in template content - $content .= preg_replace('/(<%|%>|<\?php|<\?|\?>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>)/', - "<?php echo '\$1'; ?>\n", $curr_split); + if (preg_match($php_pattern, $curr_split)) { + // escape PHP tags in template content + $php_split = preg_split($php_pattern, + $curr_split); + preg_match_all($php_pattern, + $curr_split, + $php_parts); + foreach ($php_split as $idx_php => $curr_php) { + $content .= $curr_php; + if (isset($php_parts[ 0 ][ $idx_php ])) { + $content .= "<?php echo '{$php_parts[ 1 ][ $idx_php ]}'; ?>\n"; + } + } + } else { + $content .= $curr_split; + } if (isset($cache_parts[ 0 ][ $curr_idx ])) { $_template->cached->has_nocache_code = true; - $content .= $cache_parts[ 1 ][ $curr_idx ]; + $content .= $cache_parts[ 2 ][ $curr_idx ]; } } if (!$no_output_filter && !$_template->cached->has_nocache_code && @@ -68,77 +115,43 @@ class Smarty_Internal_Runtime_UpdateCache $content = $_template->smarty->ext->_filterHandler->runFilter('output', $content, $_template); } // write cache file content - $this->writeCachedContent($cached, $_template, $content); - } - - /** - * Cache was invalid , so render from compiled and write to cache - * - * @param \Smarty_Template_Cached $cached - * @param \Smarty_Internal_Template $_template - * @param $no_output_filter - * - * @throws \Exception - */ - public function updateCache(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $no_output_filter) - { - ob_start(); - if (!isset($_template->compiled)) { - $_template->loadCompiled(); - } - $_template->compiled->render($_template); - if ($_template->smarty->debugging) { - $_template->smarty->_debug->start_cache($_template); - } - $this->removeNoCacheHash($cached, $_template, $no_output_filter); - $compile_check = $_template->smarty->compile_check; - $_template->smarty->compile_check = false; - if ($_template->_isSubTpl()) { - $_template->compiled->unifunc = $_template->parent->compiled->unifunc; - } - if (!$_template->cached->processed) { - $_template->cached->process($_template, true); - } - $_template->smarty->compile_check = $compile_check; - $cached->getRenderedTemplateCode($_template); - if ($_template->smarty->debugging) { - $_template->smarty->_debug->end_cache($_template); - } + $this->writeCachedContent($_template, $content); } /** * Writes the content to cache resource * - * @param \Smarty_Template_Cached $cached * @param Smarty_Internal_Template $_template * @param string $content * * @return bool */ - public function writeCachedContent(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content) + public function writeCachedContent(Smarty_Internal_Template $_template, $content) { - if ($_template->source->handler->recompiled || !($_template->caching == Smarty::CACHING_LIFETIME_CURRENT || - $_template->caching == Smarty::CACHING_LIFETIME_SAVED) + if ($_template->source->handler->recompiled || !$_template->caching ) { // don't write cache file return false; } + if (!isset($_template->cached)) { + $_template->loadCached(); + } $content = $_template->smarty->ext->_codeFrame->create($_template, $content, '', true); - return $this->write($cached, $_template, $content); + return $this->write($_template, $content); } /** * Write this cache object to handler * - * @param \Smarty_Template_Cached $cached * @param Smarty_Internal_Template $_template template object * @param string $content content to cache * * @return bool success */ - public function write(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content) + public function write(Smarty_Internal_Template $_template, $content) { if (!$_template->source->handler->recompiled) { + $cached = $_template->cached; if ($cached->handler->writeCachedContent($_template, $content)) { $cached->content = null; $cached->timestamp = time(); @@ -161,5 +174,4 @@ class Smarty_Internal_Runtime_UpdateCache return false; } - }
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php index 79885321b..2d62c60bb 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php @@ -82,7 +82,7 @@ class Smarty_Internal_Runtime_UpdateScope } /** - * Update varibale in other scope + * Update variable in other scope * * @param array $tpl_vars template variable array * @param \Smarty_Internal_Template $from diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_writefile.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_writefile.php index 7c462c6ca..dc9019f49 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_writefile.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_writefile.php @@ -6,7 +6,6 @@ * @subpackage PluginsInternal * @author Monte Ohrt */ - /** * Smarty Internal Write File Class * @@ -35,20 +34,30 @@ class Smarty_Internal_Runtime_WriteFile if ($_file_perms !== null) { $old_umask = umask(0); } - $_dirpath = dirname($_filepath); // if subdirs, create dir structure - if ($_dirpath !== '.' && !file_exists($_dirpath)) { - mkdir($_dirpath, $_dir_perms, true); + if ($_dirpath !== '.') { + $i = 0; + // loop if concurrency problem occurs + // see https://bugs.php.net/bug.php?id=35326 + while (!is_dir($_dirpath)) { + if (@mkdir($_dirpath, $_dir_perms, true)) { + break; + } + clearstatcache(); + if (++$i === 3) { + error_reporting($_error_reporting); + throw new SmartyException("unable to create directory {$_dirpath}"); + } + sleep(1); + } } - // write to tmp file, then move to overt file lock race condition - $_tmp_file = $_dirpath . $smarty->ds . str_replace(array('.', ','), '_', uniqid('wrt', true)); + $_tmp_file = $_dirpath . DIRECTORY_SEPARATOR . str_replace(array('.', ','), '_', uniqid('wrt', true)); if (!file_put_contents($_tmp_file, $_contents)) { error_reporting($_error_reporting); throw new SmartyException("unable to write file {$_tmp_file}"); } - /* * Windows' rename() fails if the destination exists, * Linux' rename() properly handles the overwrite. @@ -85,7 +94,6 @@ class Smarty_Internal_Runtime_WriteFile umask($old_umask); } error_reporting($_error_reporting); - return true; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php index 8cd37dd56..bdf74065d 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php @@ -89,12 +89,16 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom then written to compiled files. */ // init the lexer/parser to compile the template $this->parser = - new $this->parser_class(new $this->lexer_class(str_replace(array("\r\n", "\r"), "\n", $_content), $this), + new $this->parser_class(new $this->lexer_class(str_replace(array("\r\n", + "\r"), "\n", $_content), $this), $this); if ($isTemplateSource && $this->template->caching) { $this->parser->insertPhpCode("<?php\n\$_smarty_tpl->compiled->nocache_hash = '{$this->nocache_hash}';\n?>\n"); } - if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { + if (function_exists('mb_internal_encoding') + && function_exists('ini_get') + && ((int) ini_get('mbstring.func_overload')) & 2 + ) { $mbEncoding = mb_internal_encoding(); mb_internal_encoding('ASCII'); } else { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php index f950606df..21f60f991 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php @@ -17,6 +17,7 @@ * @property Smarty_Template_Compiled $compiled * @property Smarty_Template_Cached $cached * @property Smarty_Internal_TemplateCompilerBase $compiler + * @property mixed|\Smarty_Template_Cached registered_plugins * * The following methods will be dynamically loaded by the extension handler when they are called. * They are located in a corresponding Smarty_Internal_Method_xxxx class @@ -110,16 +111,18 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase public static $tplObjCache = array(); /** - * Template object cache for Smarty::isCached() == true + * Template object cache for Smarty::isCached() === true * * @var Smarty_Internal_Template[] */ public static $isCacheTplObj = array(); /** - * Subtemplate Info Cache + * Sub template Info Cache + * - index name + * - value use count * - * @var string[]int[] + * @var int[] */ public static $subTplInfo = array(); @@ -148,11 +151,9 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase // Smarty parameter $this->cache_id = $_cache_id === null ? $this->smarty->cache_id : $_cache_id; $this->compile_id = $_compile_id === null ? $this->smarty->compile_id : $_compile_id; - $this->caching = $_caching === null ? $this->smarty->caching : $_caching; - if ($this->caching === true) { - $this->caching = Smarty::CACHING_LIFETIME_CURRENT; - } + $this->caching = (int)($_caching === null ? $this->smarty->caching : $_caching); $this->cache_lifetime = $_cache_lifetime === null ? $this->smarty->cache_lifetime : $_cache_lifetime; + $this->compile_check = (int)$smarty->compile_check; $this->parent = $_parent; // Template resource $this->template_resource = $template_resource; @@ -170,6 +171,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase * @param null|bool $display true: display, false: fetch null: sub-template * * @return string + * @throws \Exception * @throws \SmartyException */ public function render($no_output_filter = true, $display = null) @@ -187,12 +189,10 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase } // disable caching for evaluated code if ($this->source->handler->recompiled) { - $this->caching = false; + $this->caching = Smarty::CACHING_OFF; } // read from cache or render - $isCacheTpl = - $this->caching == Smarty::CACHING_LIFETIME_CURRENT || $this->caching == Smarty::CACHING_LIFETIME_SAVED; - if ($isCacheTpl) { + if ($this->caching === Smarty::CACHING_LIFETIME_CURRENT || $this->caching === Smarty::CACHING_LIFETIME_SAVED) { if (!isset($this->cached) || $this->cached->cache_id !== $this->cache_id || $this->cached->compile_id !== $this->compile_id ) { @@ -234,15 +234,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase $this->smarty->_debug->display_debug($this, true); } } - if ($this->_isSubTpl()) { - foreach ($this->compiled->required_plugins as $code => $tmp1) { - foreach ($tmp1 as $name => $tmp) { - foreach ($tmp as $type => $data) { - $this->parent->compiled->required_plugins[ $code ][ $name ][ $type ] = $data; - } - } - } - } if (!$no_output_filter && (!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) && (isset($this->smarty->autoload_filters[ 'output' ]) || @@ -269,6 +260,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase * @param string $uid file dependency uid * @param string $content_func function name * + * @throws \Exception + * @throws \SmartyException */ public function _subTemplateRender($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $scope, $forceTplCache, $uid = null, $content_func = null) @@ -278,7 +271,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase $smarty = &$this->smarty; $_templateId = $smarty->_getTemplateId($template, $cache_id, $compile_id, $caching, $tpl); // recursive call ? - if (isset($tpl->templateId) ? $tpl->templateId : $tpl->_getTemplateId() != $_templateId) { + if (isset($tpl->templateId) ? $tpl->templateId : $tpl->_getTemplateId() !== $_templateId) { // already in template cache? if (isset(self::$tplObjCache[ $_templateId ])) { // copy data from cached object @@ -293,7 +286,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase } else { unset($tpl->compiled); } - if ($caching != 9999 && isset($cachedTpl->cached)) { + if ($caching !== 9999 && isset($cachedTpl->cached)) { $tpl->cached = $cachedTpl->cached; } else { unset($tpl->cached); @@ -315,7 +308,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase $tpl->source = Smarty_Template_Source::load($tpl); unset($tpl->compiled); } - if ($caching != 9999) { + if ($caching !== 9999) { unset($tpl->cached); } } @@ -343,7 +336,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase $tpl->tpl_vars[ $_key ] = new Smarty_Variable($_val, $this->isRenderingCache); } } - if ($tpl->caching == 9999) { + if ($tpl->caching === 9999) { if (!isset($tpl->compiled)) { $this->loadCompiled(true); } @@ -427,6 +420,39 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase } /** + * Check if plugins are callable require file otherwise + * + * @param array $plugins required plugins + * + * @throws \SmartyException + */ + public function _checkPlugins($plugins) { + static $checked = array(); + foreach($plugins as $plugin) { + $name = join('::', (array)$plugin[ 'function' ]); + if (!isset($checked[$name])) { + if (!is_callable($plugin['function'])) { + if (is_file($plugin['file'])) { + require_once $plugin['file']; + if (is_callable($plugin['function'])) { + $checked[ $name ] = true; + } + } + } else { + $checked[ $name ] = true; + } + } + if (!isset($checked[ $name ])) { + if (false !== $this->smarty->loadPlugin($name)) { + $checked[ $name ] = true; + } else { + throw new SmartyException("Plugin '{$name}' not callable"); + } + } + } + } + + /** * This function is executed automatically when a compiled or cached template file is included * - Decode saved properties from compiled template and cache files * - Check if compiled or cache file is valid @@ -451,12 +477,12 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase } $is_valid = true; if (!empty($properties[ 'file_dependency' ]) && - ((!$cache && $tpl->smarty->compile_check) || $tpl->smarty->compile_check == 1) + ((!$cache && $tpl->compile_check) || $tpl->compile_check === Smarty::COMPILECHECK_ON) ) { // check file dependencies at compiled code foreach ($properties[ 'file_dependency' ] as $_file_to_check) { - if ($_file_to_check[ 2 ] == 'file' || $_file_to_check[ 2 ] == 'php') { - if ($tpl->source->filepath == $_file_to_check[ 0 ]) { + if ($_file_to_check[ 2 ] === 'file' || $_file_to_check[ 2 ] === 'php') { + if ($tpl->source->filepath === $_file_to_check[ 0 ]) { // do not recheck current template continue; //$mtime = $tpl->source->getTimeStamp(); @@ -521,13 +547,14 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase */ public function writeCachedContent($content) { - return $this->smarty->ext->_updateCache->writeCachedContent($this->cached, $this, $content); + return $this->smarty->ext->_updateCache->writeCachedContent($this, $content); } /** * Get unique template id * * @return string + * @throws \SmartyException */ public function _getTemplateId() { @@ -540,7 +567,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase */ public function capture_error() { - throw new SmartyException("Not matching {capture} open/close in \"{$this->template_resource}\""); + throw new SmartyException("Not matching {capture} open/close in '{$this->template_resource}'"); } /** diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php index c026a6644..6b959404c 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php @@ -21,10 +21,12 @@ * * @method Smarty_Internal_TemplateBase addAutoloadFilters(mixed $filters, string $type = null) * @method Smarty_Internal_TemplateBase addDefaultModifier(mixed $modifiers) + * @method Smarty_Internal_TemplateBase addLiterals(mixed $literals) * @method Smarty_Internal_TemplateBase createData(Smarty_Internal_Data $parent = null, string $name = null) * @method array getAutoloadFilters(string $type = null) * @method string getDebugTemplate() * @method array getDefaultModifier() + * @method array getLiterals() * @method array getTags(mixed $template = null) * @method object getRegisteredObject(string $object_name) * @method Smarty_Internal_TemplateBase registerCacheResource(string $name, Smarty_CacheResource $resource_handler) @@ -35,14 +37,14 @@ * @method Smarty_Internal_TemplateBase registerResource(string $name, mixed $resource_handler) * @method Smarty_Internal_TemplateBase setAutoloadFilters(mixed $filters, string $type = null) * @method Smarty_Internal_TemplateBase setDebugTemplate(string $tpl_name) - * @method Smarty_Internal_TemplateBase setDefaultModifier(mixed $modifiers) + * @method Smarty_Internal_TemplateBase setDefaultModifiers(mixed $modifiers) + * @method Smarty_Internal_TemplateBase setLiterals(mixed $literals) * @method Smarty_Internal_TemplateBase unloadFilter(string $type, string $name) * @method Smarty_Internal_TemplateBase unregisterCacheResource(string $name) * @method Smarty_Internal_TemplateBase unregisterObject(string $object_name) * @method Smarty_Internal_TemplateBase unregisterPlugin(string $type, string $name) * @method Smarty_Internal_TemplateBase unregisterFilter(string $type, mixed $callback) * @method Smarty_Internal_TemplateBase unregisterResource(string $name) - * @method Smarty _getSmartyObj() */ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { @@ -65,9 +67,16 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data /** * caching enabled * - * @var boolean + * @var int */ - public $caching = false; + public $caching = Smarty::CACHING_OFF; + + /** + * check template for modifications? + * + * @var int + */ + public $compile_check = Smarty::COMPILECHECK_ON; /** * cache lifetime in seconds @@ -115,6 +124,9 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data * @param mixed $cache_id cache id to be used with this template * @param mixed $compile_id compile id to be used with this template * @param object $parent next higher level of Smarty variables + * + * @throws \Exception + * @throws \SmartyException */ public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) { @@ -133,7 +145,9 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data * @param mixed $compile_id compile id to be used with this template * @param object $parent next higher level of Smarty variables * - * @return boolean cache status + * @return bool cache status + * @throws \Exception + * @throws \SmartyException */ public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null) { @@ -173,26 +187,28 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data $saveVars = false; $template = $smarty->createTemplate($template, $cache_id, $compile_id, $parent ? $parent : $this, false); - if ($this->_objType == 1) { + if ($this->_objType === 1) { // set caching in template object $template->caching = $this->caching; } } + // make sure we have integer values + $template->caching = (int)$template->caching; // fetch template content $level = ob_get_level(); try { $_smarty_old_error_level = isset($smarty->error_reporting) ? error_reporting($smarty->error_reporting) : null; - if ($this->_objType == 2) { + if ($this->_objType === 2) { /* @var Smarty_Internal_Template $this */ $template->tplFunctions = $this->tplFunctions; $template->inheritance = $this->inheritance; } /* @var Smarty_Internal_Template $parent */ - if (isset($parent->_objType) && ($parent->_objType == 2) && !empty($parent->tplFunctions)) { + if (isset($parent->_objType) && ($parent->_objType === 2) && !empty($parent->tplFunctions)) { $template->tplFunctions = array_merge($parent->tplFunctions, $template->tplFunctions); } - if ($function == 2) { + if ($function === 2) { if ($template->caching) { // return cache status of template if (!isset($template->cached)) { @@ -320,11 +336,19 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data } /** - * @param boolean $caching + * @param int $compile_check + */ + public function setCompileCheck($compile_check) + { + $this->compile_check = (int)$compile_check; + } + + /** + * @param int $caching */ public function setCaching($caching) { - $this->caching = $caching; + $this->caching = (int)$caching; } /** diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php index 158d654c7..0d7284a0a 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -1,5 +1,4 @@ <?php - /** * Smarty Internal Plugin Smarty Template Compiler Base * This file contains the basic classes and methods for compiling Smarty templates with lexer/parser @@ -22,28 +21,36 @@ */ abstract class Smarty_Internal_TemplateCompilerBase { - + /** + * compile tag objects cache + * + * @var array + */ + static $_tag_objects = array(); + /** + * counter for prefix variable number + * + * @var int + */ + public static $prefixVariableNumber = 0; /** * Smarty object * * @var Smarty */ public $smarty = null; - /** * Parser object * * @var Smarty_Internal_Templateparser */ public $parser = null; - /** * hash for nocache sections * * @var mixed */ public $nocache_hash = null; - /** * suppress generation of nocache code * @@ -52,11 +59,11 @@ abstract class Smarty_Internal_TemplateCompilerBase public $suppressNocacheProcessing = false; /** - * compile tag objects cache + * caching enabled (copied from template object) * - * @var array + * @var int */ - static $_tag_objects = array(); + public $caching = 0; /** * tag stack @@ -64,175 +71,174 @@ abstract class Smarty_Internal_TemplateCompilerBase * @var array */ public $_tag_stack = array(); - + /** + * tag stack count + * + * @var array + */ + public $_tag_stack_count = array(); + /** + * Plugins used by template + * + * @var array + */ + public $required_plugins = array('compiled' => array(), 'nocache' => array()); + /** + * Required plugins stack + * + * @var array + */ + public $required_plugins_stack = array(); /** * current template * * @var Smarty_Internal_Template */ public $template = null; - /** * merged included sub template data * * @var array */ public $mergedSubTemplatesData = array(); - /** * merged sub template code * * @var array */ public $mergedSubTemplatesCode = array(); - /** * collected template properties during compilation * * @var array */ public $templateProperties = array(); - /** * source line offset for error messages * * @var int */ public $trace_line_offset = 0; - /** * trace uid * * @var string */ public $trace_uid = ''; - /** * trace file path * * @var string */ public $trace_filepath = ''; - /** * stack for tracing file and line of nested {block} tags * * @var array */ public $trace_stack = array(); - /** * plugins loaded by default plugin handler * * @var array */ public $default_handler_plugins = array(); - /** * saved preprocessed modifier list * * @var mixed */ public $default_modifier_list = null; - /** * force compilation of complete template as nocache * * @var boolean */ public $forceNocache = false; - /** * flag if compiled template file shall we written * * @var bool */ public $write_compiled_code = true; - /** * Template functions * * @var array */ public $tpl_function = array(); - /** * called sub functions from template function * * @var array */ public $called_functions = array(); - /** * compiled template or block function code * * @var string */ public $blockOrFunctionCode = ''; - /** * php_handling setting either from Smarty or security * * @var int */ public $php_handling = 0; - /** * flags for used modifier plugins * * @var array */ public $modifier_plugins = array(); - /** * type of already compiled modifier * * @var array */ public $known_modifier_type = array(); - /** * parent compiler object for merged subtemplates and template functions * * @var Smarty_Internal_TemplateCompilerBase */ public $parent_compiler = null; - /** * Flag true when compiling nocache section * * @var bool */ public $nocache = false; - /** * Flag true when tag is compiled as nocache * * @var bool */ public $tag_nocache = false; - /** * Compiled tag prefix code * * @var array */ public $prefix_code = array(); - + /** + * used prefix variables by current compiled tag + * + * @var array + */ + public $usedPrefixVariables = array(); /** * Prefix code stack * * @var array */ public $prefixCodeStack = array(); - /** * Tag has compiled code * * @var bool */ public $has_code = false; - /** * A variable string was compiled * @@ -241,70 +247,74 @@ abstract class Smarty_Internal_TemplateCompilerBase public $has_variable_string = false; /** - * Tag creates output - * - * @var bool - */ - public $has_output = false; - - /** * Stack for {setfilter} {/setfilter} * * @var array */ public $variable_filter_stack = array(); - /** * variable filters for {setfilter} {/setfilter} * * @var array */ public $variable_filters = array(); - /** * Nesting count of looping tags like {foreach}, {for}, {section}, {while} * * @var int */ public $loopNesting = 0; - /** * Strip preg pattern * * @var string */ public $stripRegEx = '![\t ]*[\r\n]+[\t ]*!'; - /** * plugin search order * * @var array */ - public $plugin_search_order = array('function', 'block', 'compiler', 'class'); - + public $plugin_search_order = array('function', + 'block', + 'compiler', + 'class'); /** * General storage area for tag compiler plugins * * @var array */ public $_cache = array(); - /** - * counter for prefix variable number + * Lexer preg pattern for left delimiter + * + * @var string + */ + private $ldelPreg = '[{]'; + /** + * Lexer preg pattern for right delimiter + * + * @var string + */ + private $rdelPreg = '[}]'; + /** + * Length of right delimiter * * @var int */ - public static $prefixVariableNumber = 0; - + private $rdelLength = 0; /** - * method to compile a Smarty template + * Length of left delimiter * - * @param mixed $_content template source - * @param bool $isTemplateSource + * @var int + */ + private $ldelLength = 0; + /** + * Lexer preg pattern for user literals * - * @return bool true if compiling succeeded, false if it failed + * @var string */ - abstract protected function doCompile($_content, $isTemplateSource = false); + private $literalPreg = ''; /** * Initialize compiler @@ -314,7 +324,10 @@ abstract class Smarty_Internal_TemplateCompilerBase public function __construct(Smarty $smarty) { $this->smarty = $smarty; - $this->nocache_hash = str_replace(array('.', ','), '_', uniqid(rand(), true)); + $this->nocache_hash = str_replace(array('.', + ','), + '_', + uniqid(rand(), true)); } /** @@ -327,15 +340,18 @@ abstract class Smarty_Internal_TemplateCompilerBase * @return bool true if compiling succeeded, false if it failed * @throws \Exception */ - public function compileTemplate(Smarty_Internal_Template $template, $nocache = null, + public function compileTemplate(Smarty_Internal_Template $template, + $nocache = null, Smarty_Internal_TemplateCompilerBase $parent_compiler = null) { // get code frame of compiled template $_compiled_code = $template->smarty->ext->_codeFrame->create($template, - $this->compileTemplateSource($template, $nocache, + $this->compileTemplateSource($template, + $nocache, $parent_compiler), $this->postFilter($this->blockOrFunctionCode) . - join('', $this->mergedSubTemplatesCode), false, + join('', $this->mergedSubTemplatesCode), + false, $this); return $_compiled_code; } @@ -350,7 +366,8 @@ abstract class Smarty_Internal_TemplateCompilerBase * @return string * @throws \Exception */ - public function compileTemplateSource(Smarty_Internal_Template $template, $nocache = null, + public function compileTemplateSource(Smarty_Internal_Template $template, + $nocache = null, Smarty_Internal_TemplateCompilerBase $parent_compiler = null) { try { @@ -377,6 +394,7 @@ abstract class Smarty_Internal_TemplateCompilerBase } else { $this->nocache_hash = $template->compiled->nocache_hash; } + $this->caching = $template->caching; // flag for nocache sections $this->nocache = $nocache; $this->tag_nocache = false; @@ -387,7 +405,8 @@ abstract class Smarty_Internal_TemplateCompilerBase // add file dependency if ($this->smarty->merge_compiled_includes || $this->template->source->handler->checkTimestamps()) { $this->parent_compiler->template->compiled->file_dependency[ $this->template->source->uid ] = - array($this->template->source->filepath, $this->template->source->getTimeStamp(), + array($this->template->source->filepath, + $this->template->source->getTimeStamp(), $this->template->source->type,); } $this->smarty->_current_file = $this->template->source->filepath; @@ -396,7 +415,7 @@ abstract class Smarty_Internal_TemplateCompilerBase // we have array of inheritance templates by extends: resource // generate corresponding source code sequence $_content = - Smarty_Internal_Compile_Extends::extendsSourceArrayCode($this->template->source->components); + Smarty_Internal_Compile_Extends::extendsSourceArrayCode($this->template); } else { // get template source $_content = $this->template->source->getContent(); @@ -453,7 +472,7 @@ abstract class Smarty_Internal_TemplateCompilerBase public function preFilter($_content) { // run pre filter if required - if ($_content != '' && + if ($_content !== '' && ((isset($this->smarty->autoload_filters[ 'pre' ]) || isset($this->smarty->registered_filters[ 'pre' ]))) ) { return $this->smarty->ext->_filterHandler->runFilter('pre', $_content, $this->template); @@ -489,257 +508,6 @@ abstract class Smarty_Internal_TemplateCompilerBase } /** - * Compile Tag - * - * @param string $tag tag name - * @param array $args array with tag attributes - * @param array $parameter array with compilation parameter - * - * @throws SmartyCompilerException - * @throws SmartyException - * @return string compiled code - */ - private function compileTag2($tag, $args, $parameter) - { - $plugin_type = ''; - // $args contains the attributes parsed and compiled by the lexer/parser - // assume that tag does compile into code, but creates no HTML output - $this->has_code = true; - $this->has_output = false; - // log tag/attributes - if (isset($this->smarty->_cache[ 'get_used_tags' ])) { - $this->template->_cache[ 'used_tags' ][] = array($tag, $args); - } - // check nocache option flag - foreach ($args as $arg) { - if (!is_array($arg)) { - if ($arg === "'nocache'" || $arg === 'nocache') { - $this->tag_nocache = true; - } - } else { - foreach ($arg as $k => $v) { - if (($k === "'nocache'" || $k === 'nocache') && (trim($v, "'\" ") == 'true')) { - $this->tag_nocache = true; - } - } - } - } - // compile the smarty tag (required compile classes to compile the tag are auto loaded) - if (($_output = $this->callTagCompiler($tag, $args, $parameter)) === false) { - if (isset($this->parent_compiler->tpl_function[ $tag ]) || - (isset ($this->template->smarty->ext->_tplFunction) && $this->template->smarty->ext->_tplFunction->getTplFunction($this->template, $tag) !== false)) { - // template defined by {template} tag - $args[ '_attr' ][ 'name' ] = "'" . $tag . "'"; - $_output = $this->callTagCompiler('call', $args, $parameter); - } - } - if ($_output !== false) { - if ($_output !== true) { - // did we get compiled code - if ($this->has_code) { - // Does it create output? - if ($this->has_output) { - $_output .= "\n"; - } - // return compiled code - return $_output; - } - } - // tag did not produce compiled code - return null; - } else { - // map_named attributes - if (isset($args[ '_attr' ])) { - foreach ($args[ '_attr' ] as $key => $attribute) { - if (is_array($attribute)) { - $args = array_merge($args, $attribute); - } - } - } - // not an internal compiler tag - if (strlen($tag) < 6 || substr($tag, - 5) != 'close') { - // check if tag is a registered object - if (isset($this->smarty->registered_objects[ $tag ]) && isset($parameter[ 'object_method' ])) { - $method = $parameter[ 'object_method' ]; - if (!in_array($method, $this->smarty->registered_objects[ $tag ][ 3 ]) && - (empty($this->smarty->registered_objects[ $tag ][ 1 ]) || - in_array($method, $this->smarty->registered_objects[ $tag ][ 1 ])) - ) { - return $this->callTagCompiler('private_object_function', $args, $parameter, $tag, $method); - } elseif (in_array($method, $this->smarty->registered_objects[ $tag ][ 3 ])) { - return $this->callTagCompiler('private_object_block_function', $args, $parameter, $tag, - $method); - } else { - // throw exception - $this->trigger_template_error('not allowed method "' . $method . '" in registered object "' . - $tag . '"', null, true); - } - } - // check if tag is registered - foreach (array(Smarty::PLUGIN_COMPILER, Smarty::PLUGIN_FUNCTION, Smarty::PLUGIN_BLOCK,) as $plugin_type) - { - if (isset($this->smarty->registered_plugins[ $plugin_type ][ $tag ])) { - // if compiler function plugin call it now - if ($plugin_type == Smarty::PLUGIN_COMPILER) { - $new_args = array(); - foreach ($args as $key => $mixed) { - if (is_array($mixed)) { - $new_args = array_merge($new_args, $mixed); - } else { - $new_args[ $key ] = $mixed; - } - } - if (!$this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 1 ]) { - $this->tag_nocache = true; - } - return call_user_func_array($this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 0 ], - array($new_args, $this)); - } - // compile registered function or block function - if ($plugin_type == Smarty::PLUGIN_FUNCTION || $plugin_type == Smarty::PLUGIN_BLOCK) { - return $this->callTagCompiler('private_registered_' . $plugin_type, $args, $parameter, - $tag); - } - } - } - // check plugins from plugins folder - foreach ($this->plugin_search_order as $plugin_type) { - if ($plugin_type == Smarty::PLUGIN_COMPILER && - $this->smarty->loadPlugin('smarty_compiler_' . $tag) && - (!isset($this->smarty->security_policy) || - $this->smarty->security_policy->isTrustedTag($tag, $this)) - ) { - $plugin = 'smarty_compiler_' . $tag; - if (is_callable($plugin)) { - // convert arguments format for old compiler plugins - $new_args = array(); - foreach ($args as $key => $mixed) { - if (is_array($mixed)) { - $new_args = array_merge($new_args, $mixed); - } else { - $new_args[ $key ] = $mixed; - } - } - - return $plugin($new_args, $this->smarty); - } - if (class_exists($plugin, false)) { - $plugin_object = new $plugin; - if (method_exists($plugin_object, 'compile')) { - return $plugin_object->compile($args, $this); - } - } - throw new SmartyException("Plugin \"{$tag}\" not callable"); - } else { - if ($function = $this->getPlugin($tag, $plugin_type)) { - if (!isset($this->smarty->security_policy) || - $this->smarty->security_policy->isTrustedTag($tag, $this) - ) { - return $this->callTagCompiler('private_' . $plugin_type . '_plugin', $args, $parameter, - $tag, $function); - } - } - } - } - if (is_callable($this->smarty->default_plugin_handler_func)) { - $found = false; - // look for already resolved tags - foreach ($this->plugin_search_order as $plugin_type) { - if (isset($this->default_handler_plugins[ $plugin_type ][ $tag ])) { - $found = true; - break; - } - } - if (!$found) { - // call default handler - foreach ($this->plugin_search_order as $plugin_type) { - if ($this->getPluginFromDefaultHandler($tag, $plugin_type)) { - $found = true; - break; - } - } - } - if ($found) { - // if compiler function plugin call it now - if ($plugin_type == Smarty::PLUGIN_COMPILER) { - $new_args = array(); - foreach ($args as $mixed) { - $new_args = array_merge($new_args, $mixed); - } - return call_user_func_array($this->default_handler_plugins[ $plugin_type ][ $tag ][ 0 ], - array($new_args, $this)); - } else { - return $this->callTagCompiler('private_registered_' . $plugin_type, $args, $parameter, - $tag); - } - } - } - } else { - // compile closing tag of block function - $base_tag = substr($tag, 0, - 5); - // check if closing tag is a registered object - if (isset($this->smarty->registered_objects[ $base_tag ]) && isset($parameter[ 'object_method' ])) { - $method = $parameter[ 'object_method' ]; - if (in_array($method, $this->smarty->registered_objects[ $base_tag ][ 3 ])) { - return $this->callTagCompiler('private_object_block_function', $args, $parameter, $tag, - $method); - } else { - // throw exception - $this->trigger_template_error('not allowed closing tag method "' . $method . - '" in registered object "' . $base_tag . '"', null, true); - } - } - // registered block tag ? - if (isset($this->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $base_tag ]) || - isset($this->default_handler_plugins[ Smarty::PLUGIN_BLOCK ][ $base_tag ]) - ) { - return $this->callTagCompiler('private_registered_block', $args, $parameter, $tag); - } - // registered function tag ? - if (isset($this->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ])) { - return $this->callTagCompiler('private_registered_function', $args, $parameter, $tag); - } - // block plugin? - if ($function = $this->getPlugin($base_tag, Smarty::PLUGIN_BLOCK)) { - return $this->callTagCompiler('private_block_plugin', $args, $parameter, $tag, $function); - } - // function plugin? - if ($function = $this->getPlugin($tag, Smarty::PLUGIN_FUNCTION)) { - if (!isset($this->smarty->security_policy) || - $this->smarty->security_policy->isTrustedTag($tag, $this) - ) { - return $this->callTagCompiler('private_function_plugin', $args, $parameter, $tag, $function); - } - } - // registered compiler plugin ? - if (isset($this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ])) { - // if compiler function plugin call it now - $args = array(); - if (!$this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 1 ]) { - $this->tag_nocache = true; - } - return call_user_func_array($this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 0 ], - array($args, $this)); - } - if ($this->smarty->loadPlugin('smarty_compiler_' . $tag)) { - $plugin = 'smarty_compiler_' . $tag; - if (is_callable($plugin)) { - return $plugin($args, $this->smarty); - } - if (class_exists($plugin, false)) { - $plugin_object = new $plugin; - if (method_exists($plugin_object, 'compile')) { - return $plugin_object->compile($args, $this); - } - } - throw new SmartyException("Plugin \"{$tag}\" not callable"); - } - } - $this->trigger_template_error("unknown tag \"" . $tag . "\"", null, true); - } - } - - /** * compile variable * * @param string $variable @@ -748,11 +516,14 @@ abstract class Smarty_Internal_TemplateCompilerBase */ public function compileVariable($variable) { - if (strpos($variable, '(') == 0) { + if (!strpos($variable, '(')) { // not a variable variable $var = trim($variable, '\''); $this->tag_nocache = $this->tag_nocache | - $this->template->ext->getTemplateVars->_getVariable($this->template, $var, null, true, + $this->template->ext->getTemplateVars->_getVariable($this->template, + $var, + null, + true, false)->nocache; // todo $this->template->compiled->properties['variables'][$var] = $this->tag_nocache | $this->nocache; } @@ -779,6 +550,7 @@ abstract class Smarty_Internal_TemplateCompilerBase * @param array $parameter * * @return string + * @throws \SmartyCompilerException */ public function compilePHPFunctionCall($name, $parameter) { @@ -789,28 +561,33 @@ abstract class Smarty_Internal_TemplateCompilerBase $func_name = strtolower($name); $par = implode(',', $parameter); $parHasFuction = strpos($par, '(') !== false; - if ($func_name == 'isset') { - if (count($parameter) == 0) { - $this->trigger_template_error('Illegal number of paramer in "isset()"'); + if ($func_name === 'isset') { + if (count($parameter) === 0) { + $this->trigger_template_error('Illegal number of parameter in "isset()"'); } if ($parHasFuction) { - $prefixVar = $this->getNewPrefixVariable(); - $this->appendPrefixCode("<?php $prefixVar" . '=' . $par . ';?>'); - $isset_par = $prefixVar; + $pa = array(); + foreach ($parameter as $p) { + $pa[] = (strpos($p, '(') === false) ? ('isset(' . $p . ')') : ('(' . $p . ' !== null )'); + } + return '(' . implode(' && ', $pa) . ')'; } else { $isset_par = str_replace("')->value", "',null,true,false)->value", $par); } - return $name . "(" . $isset_par . ")"; - } elseif (in_array($func_name, array('empty', 'reset', 'current', 'end', 'prev', 'next'))) { - if (count($parameter) != 1) { - $this->trigger_template_error('Illegal number of paramer in "empty()"'); + return $name . '(' . $isset_par . ')'; + } else if (in_array($func_name, + array('empty', + 'reset', + 'current', + 'end', + 'prev', + 'next'))) { + if (count($parameter) !== 1) { + $this->trigger_template_error("Illegal number of parameter in '{$func_name()}'"); } - if ($func_name == 'empty') { - if ($parHasFuction) { - $prefixVar = $this->getNewPrefixVariable(); - $this->appendPrefixCode("<?php $prefixVar" . '=' . $par . ';?>'); - - return $func_name . '(' . $prefixVar . ')'; + if ($func_name === 'empty') { + if ($parHasFuction && version_compare(PHP_VERSION, '5.5.0', '<')) { + return '(' . $parameter[ 0 ] . ' === false )'; } else { return $func_name . '(' . str_replace("')->value", "',null,true,false)->value", $parameter[ 0 ]) . ')'; @@ -819,10 +596,10 @@ abstract class Smarty_Internal_TemplateCompilerBase return $func_name . '(' . $parameter[ 0 ] . ')'; } } else { - return $name . "(" . implode(',', $parameter) . ")"; + return $name . '(' . implode(',', $parameter) . ')'; } } else { - $this->trigger_template_error("unknown function \"" . $name . "\""); + $this->trigger_template_error("unknown function '{$name}'"); } } } @@ -838,7 +615,7 @@ abstract class Smarty_Internal_TemplateCompilerBase */ public function processText($text) { - if ((string) $text != '') { + if ((string)$text !== '') { $store = array(); $_store = 0; if ($this->parser->strip) { @@ -846,37 +623,39 @@ abstract class Smarty_Internal_TemplateCompilerBase // capture html elements not to be messed with $_offset = 0; if (preg_match_all('#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is', - $text, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { + $text, + $matches, + PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { foreach ($matches as $match) { $store[] = $match[ 0 ][ 0 ]; $_length = strlen($match[ 0 ][ 0 ]); $replace = '@!@SMARTY:' . $_store . ':SMARTY@!@'; $text = substr_replace($text, $replace, $match[ 0 ][ 1 ] - $_offset, $_length); - $_offset += $_length - strlen($replace); - $_store ++; + ++$_store; } } $expressions = array(// replace multiple spaces between tags by a single space - '#(:SMARTY@!@|>)[\040\011]+(?=@!@SMARTY:|<)#s' => '\1 \2', + '#(:SMARTY@!@|>)[\040\011]+(?=@!@SMARTY:|<)#s' => '\1 \2', // remove newline between tags - '#(:SMARTY@!@|>)[\040\011]*[\n]\s*(?=@!@SMARTY:|<)#s' => '\1\2', + '#(:SMARTY@!@|>)[\040\011]*[\n]\s*(?=@!@SMARTY:|<)#s' => '\1\2', // remove multiple spaces between attributes (but not in attribute values!) '#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5', - '#>[\040\011]+$#Ss' => '> ', '#>[\040\011]*[\n]\s*$#Ss' => '>', - $this->stripRegEx => '',); - + '#>[\040\011]+$#Ss' => '> ', + '#>[\040\011]*[\n]\s*$#Ss' => '>', + $this->stripRegEx => '',); $text = preg_replace(array_keys($expressions), array_values($expressions), $text); $_offset = 0; - if (preg_match_all('#@!@SMARTY:([0-9]+):SMARTY@!@#is', $text, $matches, + if (preg_match_all('#@!@SMARTY:([0-9]+):SMARTY@!@#is', + $text, + $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { foreach ($matches as $match) { $_length = strlen($match[ 0 ][ 0 ]); $replace = $store[ $match[ 1 ][ 0 ] ]; $text = substr_replace($text, $replace, $match[ 0 ][ 1 ] + $_offset, $_length); - $_offset += strlen($replace) - $_length; - $_store ++; + ++$_store; } } } else { @@ -900,10 +679,12 @@ abstract class Smarty_Internal_TemplateCompilerBase * @param mixed $param2 optional parameter * @param mixed $param3 optional parameter * - * @return string|bool compiled code or false + * @return bool|string compiled code or false + * @throws \SmartyCompilerException */ public function callTagCompiler($tag, $args, $param1 = null, $param2 = null, $param3 = null) { + /* @var Smarty_Internal_CompileBase $tagCompiler */ $tagCompiler = $this->getTagCompiler($tag); // compile this tag return $tagCompiler === false ? false : $tagCompiler->compile($args, $this, $param1, $param2, $param3); @@ -917,7 +698,8 @@ abstract class Smarty_Internal_TemplateCompilerBase * * @param string $tag tag name * - * @return Smarty_Internal_CompileBase|bool tag compiler object or false if not found + * @return bool|\Smarty_Internal_CompileBase tag compiler object or false if not found + * @throws \SmartyCompilerException */ public function getTagCompiler($tag) { @@ -945,65 +727,62 @@ abstract class Smarty_Internal_TemplateCompilerBase * @param string $plugin_type type of plugin * * @return string call name of function + * @throws \SmartyException */ public function getPlugin($plugin_name, $plugin_type) { $function = null; - if ($this->template->caching && ($this->nocache || $this->tag_nocache)) { - if (isset($this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ])) { + if ($this->caching && ($this->nocache || $this->tag_nocache)) { + if (isset($this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ])) { $function = - $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'function' ]; - } elseif (isset($this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ])) { - $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ] = - $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ]; + $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'function' ]; + } else if (isset($this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ])) { + $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ] = + $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ]; $function = - $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'function' ]; + $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'function' ]; } } else { - if (isset($this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ])) { + if (isset($this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ])) { $function = - $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'function' ]; - } elseif (isset($this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ])) { - $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ] = - $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ]; + $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'function' ]; + } else if (isset($this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ])) { + $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ] = + $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ]; $function = - $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'function' ]; + $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'function' ]; } } if (isset($function)) { - if ($plugin_type == 'modifier') { + if ($plugin_type === 'modifier') { $this->modifier_plugins[ $plugin_name ] = true; } - return $function; } // loop through plugin dirs and find the plugin $function = 'smarty_' . $plugin_type . '_' . $plugin_name; $file = $this->smarty->loadPlugin($function, false); - if (is_string($file)) { - if ($this->template->caching && ($this->nocache || $this->tag_nocache)) { - $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'file' ] = + if ($this->caching && ($this->nocache || $this->tag_nocache)) { + $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'file' ] = $file; - $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'function' ] = + $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'function' ] = $function; } else { - $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'file' ] = + $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'file' ] = $file; - $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'function' ] = + $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'function' ] = $function; } - if ($plugin_type == 'modifier') { + if ($plugin_type === 'modifier') { $this->modifier_plugins[ $plugin_name ] = true; } - return $function; } if (is_callable($function)) { // plugin function is defined in the script return $function; } - return false; } @@ -1013,7 +792,8 @@ abstract class Smarty_Internal_TemplateCompilerBase * @param string $tag name of tag * @param string $plugin_type type of plugin * - * @return boolean true if found + * @return bool true if found + * @throws \SmartyCompilerException */ public function getPluginFromDefaultHandler($tag, $plugin_type) { @@ -1021,36 +801,41 @@ abstract class Smarty_Internal_TemplateCompilerBase $script = null; $cacheable = true; $result = call_user_func_array($this->smarty->default_plugin_handler_func, - array($tag, $plugin_type, $this->template, &$callback, &$script, &$cacheable,)); + array($tag, + $plugin_type, + $this->template, + &$callback, + &$script, + &$cacheable,)); if ($result) { $this->tag_nocache = $this->tag_nocache || !$cacheable; if ($script !== null) { if (is_file($script)) { - if ($this->template->caching && ($this->nocache || $this->tag_nocache)) { - $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $tag ][ $plugin_type ][ 'file' ] = + if ($this->caching && ($this->nocache || $this->tag_nocache)) { + $this->required_plugins[ 'nocache' ][ $tag ][ $plugin_type ][ 'file' ] = $script; - $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $tag ][ $plugin_type ][ 'function' ] = + $this->required_plugins[ 'nocache' ][ $tag ][ $plugin_type ][ 'function' ] = $callback; } else { - $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $tag ][ $plugin_type ][ 'file' ] = + $this->required_plugins[ 'compiled' ][ $tag ][ $plugin_type ][ 'file' ] = $script; - $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $tag ][ $plugin_type ][ 'function' ] = + $this->required_plugins[ 'compiled' ][ $tag ][ $plugin_type ][ 'function' ] = $callback; } require_once $script; } else { - $this->trigger_template_error("Default plugin handler: Returned script file \"{$script}\" for \"{$tag}\" not found"); + $this->trigger_template_error("Default plugin handler: Returned script file '{$script}' for '{$tag}' not found"); } } if (is_callable($callback)) { - $this->default_handler_plugins[ $plugin_type ][ $tag ] = array($callback, true, array()); - + $this->default_handler_plugins[ $plugin_type ][ $tag ] = array($callback, + true, + array()); return true; } else { - $this->trigger_template_error("Default plugin handler: Returned callback for \"{$tag}\" not callable"); + $this->trigger_template_error("Default plugin handler: Returned callback for '{$tag}' not callable"); } } - return false; } @@ -1064,9 +849,9 @@ abstract class Smarty_Internal_TemplateCompilerBase */ public function appendCode($left, $right) { - if (preg_match('/\s*\?>\s*$/', $left) && preg_match('/^\s*<\?php\s+/', $right)) { - $left = preg_replace('/\s*\?>\s*$/', "\n", $left); - $left .= preg_replace('/^\s*<\?php\s+/', '', $right); + if (preg_match('/\s*\?>\s?$/D', $left) && preg_match('/^<\?php\s+/', $right)) { + $left = preg_replace('/\s*\?>\s?$/D', "\n", $left); + $left .= preg_replace('/^<\?php\s+/', '', $right); } else { $left .= $right; } @@ -1089,19 +874,18 @@ abstract class Smarty_Internal_TemplateCompilerBase // If the template is not evaluated and we have a nocache section and or a nocache tag if ($is_code && !empty($content)) { // generate replacement code - if ((!($this->template->source->handler->recompiled) || $this->forceNocache) && $this->template->caching && + if ((!($this->template->source->handler->recompiled) || $this->forceNocache) && $this->caching && !$this->suppressNocacheProcessing && ($this->nocache || $this->tag_nocache) ) { $this->template->compiled->has_nocache_code = true; $_output = addcslashes($content, '\'\\'); - $_output = str_replace("^#^", "'", $_output); - $_output = "<?php echo '/*%%SmartyNocache:{$this->nocache_hash}%%*/" . $_output . - "/*/%%SmartyNocache:{$this->nocache_hash}%%*/';?>\n"; + $_output = str_replace('^#^', '\'', $_output); + $_output = "<?php echo '/*%%SmartyNocache:{$this->nocache_hash}%%*/{$_output}/*/%%SmartyNocache:{$this->nocache_hash}%%*/';?>\n"; // make sure we include modifier plugins for nocache code foreach ($this->modifier_plugins as $plugin_name => $dummy) { - if (isset($this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ 'modifier' ])) { - $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ 'modifier' ] = - $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ 'modifier' ]; + if (isset($this->required_plugins[ 'compiled' ][ $plugin_name ][ 'modifier' ])) { + $this->required_plugins[ 'nocache' ][ $plugin_name ][ 'modifier' ] = + $this->required_plugins[ 'compiled' ][ $plugin_name ][ 'modifier' ]; } } } else { @@ -1113,7 +897,6 @@ abstract class Smarty_Internal_TemplateCompilerBase $this->modifier_plugins = array(); $this->suppressNocacheProcessing = false; $this->tag_nocache = false; - return $_output; } @@ -1176,11 +959,11 @@ abstract class Smarty_Internal_TemplateCompilerBase { $_scope = 0; if (isset($_attr[ 'scope' ])) { - $_scopeName = trim($_attr[ 'scope' ], "'\""); + $_scopeName = trim($_attr[ 'scope' ], '\'"'); if (is_numeric($_scopeName) && in_array($_scopeName, $validScopes)) { $_scope = $_scopeName; - } elseif (is_string($_scopeName)) { - $_scopeName = trim($_scopeName, "'\""); + } else if (is_string($_scopeName)) { + $_scopeName = trim($_scopeName, '\'"'); $_scope = isset($validScopes[ $_scopeName ]) ? $validScopes[ $_scopeName ] : false; } else { $_scope = false; @@ -1203,7 +986,7 @@ abstract class Smarty_Internal_TemplateCompilerBase public function makeNocacheCode($code) { return "echo '/*%%SmartyNocache:{$this->nocache_hash}%%*/<?php " . - str_replace("^#^", "'", addcslashes($code, '\'\\')) . + str_replace('^#^', '\'', addcslashes($code, '\'\\')) . "?>/*/%%SmartyNocache:{$this->nocache_hash}%%*/';\n"; } @@ -1225,22 +1008,23 @@ abstract class Smarty_Internal_TemplateCompilerBase if ($tagline === true) { // get line number of Tag $line = $lex->taglineno; - } elseif (!isset($line)) { + } else if (!isset($line)) { // get template source line which has error $line = $lex->line; } else { - $line = (int) $line; + $line = (int)$line; } - - if (in_array($this->template->source->type, array('eval', 'string'))) { - $templateName = $this->template->source->type . ':' . trim(preg_replace('![\t\r\n]+!', ' ', + if (in_array($this->template->source->type, + array('eval', + 'string'))) { + $templateName = $this->template->source->type . ':' . trim(preg_replace('![\t\r\n]+!', + ' ', strlen($lex->data) > 40 ? substr($lex->data, 0, 40) . '...' : $lex->data)); } else { $templateName = $this->template->source->type . ':' . $this->template->source->filepath; } - // $line += $this->trace_line_offset; $match = preg_split("/\n/", $lex->data); $error_text = @@ -1268,6 +1052,11 @@ abstract class Smarty_Internal_TemplateCompilerBase $error_text .= ', expected one of: ' . implode(' , ', $expect); } } + if ($this->smarty->_parserdebug) { + $this->parser->errorRunDown(); + echo ob_get_clean(); + flush(); + } $e = new SmartyCompilerException($error_text); $e->line = $line; $e->source = trim(preg_replace('![\t\r\n]+!', ' ', $match[ $line - 1 ])); @@ -1289,6 +1078,142 @@ abstract class Smarty_Internal_TemplateCompilerBase } /** + * enter double quoted string + * - save tag stack count + */ + public function enterDoubleQuote() + { + array_push($this->_tag_stack_count, $this->getTagStackCount()); + } + + /** + * Return tag stack count + * + * @return int + */ + public function getTagStackCount() + { + return count($this->_tag_stack); + } + + /** + * @param $lexerPreg + * + * @return mixed + */ + public function replaceDelimiter($lexerPreg) + { + return str_replace(array('SMARTYldel', 'SMARTYliteral', 'SMARTYrdel', 'SMARTYautoliteral', 'SMARTYal'), + array($this->ldelPreg, $this->literalPreg, $this->rdelPreg, + $this->smarty->getAutoLiteral() ? '{1,}' : '{9}', + $this->smarty->getAutoLiteral() ? '' : '\\s*'), + $lexerPreg); + } + + /** + * Build lexer regular expressions for left and right delimiter and user defined literals + */ + public function initDelimiterPreg() + { + $ldel = $this->smarty->getLeftDelimiter(); + $this->ldelLength = strlen($ldel); + $this->ldelPreg = ''; + foreach (str_split($ldel, 1) as $chr) { + $this->ldelPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']'; + } + $rdel = $this->smarty->getRightDelimiter(); + $this->rdelLength = strlen($rdel); + $this->rdelPreg = ''; + foreach (str_split($rdel, 1) as $chr) { + $this->rdelPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']'; + } + $literals = $this->smarty->getLiterals(); + if (!empty($literals)) { + foreach ($literals as $key => $literal) { + $literalPreg = ''; + foreach (str_split($literal, 1) as $chr) { + $literalPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']'; + } + $literals[ $key ] = $literalPreg; + } + $this->literalPreg = '|' . implode('|', $literals); + } else { + $this->literalPreg = ''; + } + } + + /** + * leave double quoted string + * - throw exception if block in string was not closed + * + * @throws \SmartyCompilerException + */ + public function leaveDoubleQuote() + { + if (array_pop($this->_tag_stack_count) !== $this->getTagStackCount()) { + $tag = $this->getOpenBlockTag(); + $this->trigger_template_error("unclosed '{{$tag}}' in doubled quoted string", + null, + true); + } + } + + /** + * Get left delimiter preg + * + * @return string + */ + public function getLdelPreg() + { + return $this->ldelPreg; + } + + /** + * Get right delimiter preg + * + * @return string + */ + public function getRdelPreg() + { + return $this->rdelPreg; + } + + /** + * Get length of left delimiter + * + * @return int + */ + public function getLdelLength() + { + return $this->ldelLength; + } + + /** + * Get length of right delimiter + * + * @return int + */ + public function getRdelLength() + { + return $this->rdelLength; + } + + /** + * Get name of current open block tag + * + * @return string|boolean + */ + public function getOpenBlockTag() + { + $tagCount = $this->getTagStackCount(); + if ($tagCount) { + return $this->_tag_stack[ $tagCount - 1 ][ 0 ]; + } else { + return false; + } + } + + /** * Check if $value contains variable elements * * @param mixed $value @@ -1321,7 +1246,7 @@ abstract class Smarty_Internal_TemplateCompilerBase */ public function getNewPrefixVariable() { - self::$prefixVariableNumber ++; + ++self::$prefixVariableNumber; return $this->getPrefixVariable(); } @@ -1362,4 +1287,345 @@ abstract class Smarty_Internal_TemplateCompilerBase return $code; } + /** + * Save current required plugins + * + * @param bool $init if true init required plugins + */ + public function saveRequiredPlugins($init=false) + { + $this->required_plugins_stack[] = $this->required_plugins; + if ($init) { + $this->required_plugins = array('compiled' => array(), 'nocache' => array()); + } + } + + /** + * Restore required plugins + */ + public function restoreRequiredPlugins() + { + $this->required_plugins = array_pop($this->required_plugins_stack); + } + + /** + * Compile code to call Smarty_Internal_Template::_checkPlugins() + * for required plugins + * + * @return string + */ + public function compileRequiredPlugins() + { + $code = $this->compileCheckPlugins($this->required_plugins[ 'compiled' ]); + if ($this->caching && !empty($this->required_plugins[ 'nocache' ])) { + $code .= $this->makeNocacheCode($this->compileCheckPlugins($this->required_plugins[ 'nocache' ])); + } + return $code; + } + + /** + * Compile code to call Smarty_Internal_Template::_checkPlugins + * - checks if plugin is callable require otherwise + * + * @param $requiredPlugins + * + * @return string + */ + public function compileCheckPlugins($requiredPlugins) + { + if (!empty($requiredPlugins)) { + $plugins = array(); + foreach ($requiredPlugins as $plugin) { + foreach ($plugin as $data) { + $plugins[] = $data; + } + } + return '$_smarty_tpl->_checkPlugins(' . $this->getVarExport($plugins) . ');' . "\n"; + } else { + return ''; + } + } + + /** + * method to compile a Smarty template + * + * @param mixed $_content template source + * @param bool $isTemplateSource + * + * @return bool true if compiling succeeded, false if it failed + */ + abstract protected function doCompile($_content, $isTemplateSource = false); + + /** + * Compile Tag + * + * @param string $tag tag name + * @param array $args array with tag attributes + * @param array $parameter array with compilation parameter + * + * @throws SmartyCompilerException + * @throws SmartyException + * @return string compiled code + */ + private function compileTag2($tag, $args, $parameter) + { + $plugin_type = ''; + // $args contains the attributes parsed and compiled by the lexer/parser + // assume that tag does compile into code, but creates no HTML output + $this->has_code = true; + // log tag/attributes + if (isset($this->smarty->_cache[ 'get_used_tags' ])) { + $this->template->_cache[ 'used_tags' ][] = array($tag, + $args); + } + // check nocache option flag + foreach ($args as $arg) { + if (!is_array($arg)) { + if ($arg === "'nocache'" || $arg === 'nocache') { + $this->tag_nocache = true; + } + } else { + foreach ($arg as $k => $v) { + if (($k === "'nocache'" || $k === 'nocache') && (trim($v, "'\" ") === 'true')) { + $this->tag_nocache = true; + } + } + } + } + // compile the smarty tag (required compile classes to compile the tag are auto loaded) + if (($_output = $this->callTagCompiler($tag, $args, $parameter)) === false) { + if (isset($this->parent_compiler->tpl_function[ $tag ]) || + (isset ($this->template->smarty->ext->_tplFunction) && + $this->template->smarty->ext->_tplFunction->getTplFunction($this->template, $tag) !== false) + ) { + // template defined by {template} tag + $args[ '_attr' ][ 'name' ] = "'{$tag}'"; + $_output = $this->callTagCompiler('call', $args, $parameter); + } + } + if ($_output !== false) { + if ($_output !== true) { + // did we get compiled code + if ($this->has_code) { + // return compiled code + return $_output; + } + } + // tag did not produce compiled code + return null; + } else { + // map_named attributes + if (isset($args[ '_attr' ])) { + foreach ($args[ '_attr' ] as $key => $attribute) { + if (is_array($attribute)) { + $args = array_merge($args, $attribute); + } + } + } + // not an internal compiler tag + if (strlen($tag) < 6 || substr($tag, -5) !== 'close') { + // check if tag is a registered object + if (isset($this->smarty->registered_objects[ $tag ]) && isset($parameter[ 'object_method' ])) { + $method = $parameter[ 'object_method' ]; + if (!in_array($method, $this->smarty->registered_objects[ $tag ][ 3 ]) && + (empty($this->smarty->registered_objects[ $tag ][ 1 ]) || + in_array($method, $this->smarty->registered_objects[ $tag ][ 1 ])) + ) { + return $this->callTagCompiler('private_object_function', $args, $parameter, $tag, $method); + } else if (in_array($method, $this->smarty->registered_objects[ $tag ][ 3 ])) { + return $this->callTagCompiler('private_object_block_function', + $args, + $parameter, + $tag, + $method); + } else { + // throw exception + $this->trigger_template_error('not allowed method "' . $method . '" in registered object "' . + $tag . '"', + null, + true); + } + } + // check if tag is registered + foreach (array(Smarty::PLUGIN_COMPILER, + Smarty::PLUGIN_FUNCTION, + Smarty::PLUGIN_BLOCK,) as $plugin_type) { + if (isset($this->smarty->registered_plugins[ $plugin_type ][ $tag ])) { + // if compiler function plugin call it now + if ($plugin_type === Smarty::PLUGIN_COMPILER) { + $new_args = array(); + foreach ($args as $key => $mixed) { + if (is_array($mixed)) { + $new_args = array_merge($new_args, $mixed); + } else { + $new_args[ $key ] = $mixed; + } + } + if (!$this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 1 ]) { + $this->tag_nocache = true; + } + return call_user_func_array($this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 0 ], + array($new_args, + $this)); + } + // compile registered function or block function + if ($plugin_type === Smarty::PLUGIN_FUNCTION || $plugin_type === Smarty::PLUGIN_BLOCK) { + return $this->callTagCompiler('private_registered_' . $plugin_type, + $args, + $parameter, + $tag); + } + } + } + // check plugins from plugins folder + foreach ($this->plugin_search_order as $plugin_type) { + if ($plugin_type === Smarty::PLUGIN_COMPILER && + $this->smarty->loadPlugin('smarty_compiler_' . $tag) && + (!isset($this->smarty->security_policy) || + $this->smarty->security_policy->isTrustedTag($tag, $this)) + ) { + $plugin = 'smarty_compiler_' . $tag; + if (is_callable($plugin)) { + // convert arguments format for old compiler plugins + $new_args = array(); + foreach ($args as $key => $mixed) { + if (is_array($mixed)) { + $new_args = array_merge($new_args, $mixed); + } else { + $new_args[ $key ] = $mixed; + } + } + return $plugin($new_args, $this->smarty); + } + if (class_exists($plugin, false)) { + $plugin_object = new $plugin; + if (method_exists($plugin_object, 'compile')) { + return $plugin_object->compile($args, $this); + } + } + throw new SmartyException("Plugin '{$tag}' not callable"); + } else { + if ($function = $this->getPlugin($tag, $plugin_type)) { + if (!isset($this->smarty->security_policy) || + $this->smarty->security_policy->isTrustedTag($tag, $this) + ) { + return $this->callTagCompiler('private_' . $plugin_type . '_plugin', + $args, + $parameter, + $tag, + $function); + } + } + } + } + if (is_callable($this->smarty->default_plugin_handler_func)) { + $found = false; + // look for already resolved tags + foreach ($this->plugin_search_order as $plugin_type) { + if (isset($this->default_handler_plugins[ $plugin_type ][ $tag ])) { + $found = true; + break; + } + } + if (!$found) { + // call default handler + foreach ($this->plugin_search_order as $plugin_type) { + if ($this->getPluginFromDefaultHandler($tag, $plugin_type)) { + $found = true; + break; + } + } + } + if ($found) { + // if compiler function plugin call it now + if ($plugin_type === Smarty::PLUGIN_COMPILER) { + $new_args = array(); + foreach ($args as $key => $mixed) { + if (is_array($mixed)) { + $new_args = array_merge($new_args, $mixed); + } else { + $new_args[ $key ] = $mixed; + } + } + return call_user_func_array($this->default_handler_plugins[ $plugin_type ][ $tag ][ 0 ], + array($new_args, + $this)); + } else { + return $this->callTagCompiler('private_registered_' . $plugin_type, + $args, + $parameter, + $tag); + } + } + } + } else { + // compile closing tag of block function + $base_tag = substr($tag, 0, -5); + // check if closing tag is a registered object + if (isset($this->smarty->registered_objects[ $base_tag ]) && isset($parameter[ 'object_method' ])) { + $method = $parameter[ 'object_method' ]; + if (in_array($method, $this->smarty->registered_objects[ $base_tag ][ 3 ])) { + return $this->callTagCompiler('private_object_block_function', + $args, + $parameter, + $tag, + $method); + } else { + // throw exception + $this->trigger_template_error('not allowed closing tag method "' . $method . + '" in registered object "' . $base_tag . '"', + null, + true); + } + } + // registered block tag ? + if (isset($this->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $base_tag ]) || + isset($this->default_handler_plugins[ Smarty::PLUGIN_BLOCK ][ $base_tag ]) + ) { + return $this->callTagCompiler('private_registered_block', $args, $parameter, $tag); + } + // registered function tag ? + if (isset($this->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ])) { + return $this->callTagCompiler('private_registered_function', $args, $parameter, $tag); + } + // block plugin? + if ($function = $this->getPlugin($base_tag, Smarty::PLUGIN_BLOCK)) { + return $this->callTagCompiler('private_block_plugin', $args, $parameter, $tag, $function); + } + // function plugin? + if ($function = $this->getPlugin($tag, Smarty::PLUGIN_FUNCTION)) { + if (!isset($this->smarty->security_policy) || + $this->smarty->security_policy->isTrustedTag($tag, $this) + ) { + return $this->callTagCompiler('private_function_plugin', $args, $parameter, $tag, $function); + } + } + // registered compiler plugin ? + if (isset($this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ])) { + // if compiler function plugin call it now + $args = array(); + if (!$this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 1 ]) { + $this->tag_nocache = true; + } + return call_user_func_array($this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 0 ], + array($args, + $this)); + } + if ($this->smarty->loadPlugin('smarty_compiler_' . $tag)) { + $plugin = 'smarty_compiler_' . $tag; + if (is_callable($plugin)) { + return $plugin($args, $this->smarty); + } + if (class_exists($plugin, false)) { + $plugin_object = new $plugin; + if (method_exists($plugin_object, 'compile')) { + return $plugin_object->compile($args, $this); + } + } + throw new SmartyException("Plugin '{$tag}' not callable"); + } + } + $this->trigger_template_error("unknown tag '{$tag}'", null, true); + } + } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php index 8e870b75c..3045a7b0c 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php @@ -18,231 +18,237 @@ */ class Smarty_Internal_Templatelexer { + const TEXT = 1; + const TAG = 2; + const TAGBODY = 3; + const LITERAL = 4; + const DOUBLEQUOTEDSTRING = 5; /** * Source * * @var string */ public $data; - /** * Source length * * @var int */ public $dataLength = null; - /** * byte counter * * @var int */ public $counter; - /** * token number * * @var int */ public $token; - /** * token value * * @var string */ public $value; - /** * current line * * @var int */ public $line; - /** * tag start line * * @var */ public $taglineno; - /** * php code type * * @var string */ public $phpType = ''; - - /** - * escaped left delimiter - * - * @var string - */ - public $ldel = ''; - - /** - * escaped left delimiter length - * - * @var int - */ - public $ldel_length = 0; - - /** - * escaped right delimiter - * - * @var string - */ - public $rdel = ''; - - /** - * escaped right delimiter length - * - * @var int - */ - public $rdel_length = 0; - /** * state number * * @var int */ public $state = 1; - /** * Smarty object * * @var Smarty */ public $smarty = null; - /** * compiler object * * @var Smarty_Internal_TemplateCompilerBase */ public $compiler = null; - - /** - * literal tag nesting level - * - * @var int - */ - private $literal_cnt = 0; - - /** - * PHP start tag string - * - * @var string - */ - /** * trace file * * @var resource */ public $yyTraceFILE; - /** * trace prompt * * @var string */ public $yyTracePrompt; - /** * XML flag true while processing xml * * @var bool */ public $is_xml = false; - /** * state names * * @var array */ public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',); - /** - * storage for assembled token patterns + * token names + * + * @var array + */ + public $smarty_token_names = array( // Text for parser error messages + 'NOT' => '(!,not)', + 'OPENP' => '(', + 'CLOSEP' => ')', + 'OPENB' => '[', + 'CLOSEB' => ']', + 'PTR' => '->', + 'APTR' => '=>', + 'EQUAL' => '=', + 'NUMBER' => 'number', + 'UNIMATH' => '+" , "-', + 'MATH' => '*" , "/" , "%', + 'INCDEC' => '++" , "--', + 'SPACE' => ' ', + 'DOLLAR' => '$', + 'SEMICOLON' => ';', + 'COLON' => ':', + 'DOUBLECOLON' => '::', + 'AT' => '@', + 'HATCH' => '#', + 'QUOTE' => '"', + 'BACKTICK' => '`', + 'VERT' => '"|" modifier', + 'DOT' => '.', + 'COMMA' => '","', + 'QMARK' => '"?"', + 'ID' => 'id, name', + 'TEXT' => 'text', + 'LDELSLASH' => '{/..} closing tag', + 'LDEL' => '{...} Smarty tag', + 'COMMENT' => 'comment', + 'AS' => 'as', + 'TO' => 'to', + 'PHP' => '"<?php", "<%", "{php}" tag', + 'LOGOP' => '"<", "==" ... logical operator', + 'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition', + 'SCOND' => '"is even" ... if condition', + ); + /** + * literal tag nesting level + * + * @var int + */ + private $literal_cnt = 0; + /** + * preg token pattern for state TEXT * * @var string */ private $yy_global_pattern1 = null; - + /** + * preg token pattern for state TAG + * + * @var string + */ private $yy_global_pattern2 = null; - + /** + * preg token pattern for state TAGBODY + * + * @var string + */ private $yy_global_pattern3 = null; - + /** + * preg token pattern for state LITERAL + * + * @var string + */ private $yy_global_pattern4 = null; - - private $yy_global_pattern5 = null; - /** - * token names + * preg token pattern for state DOUBLEQUOTEDSTRING * - * @var array + * @var null */ - public $smarty_token_names = array( // Text for parser error messages - 'NOT' => '(!,not)', 'OPENP' => '(', 'CLOSEP' => ')', 'OPENB' => '[', - 'CLOSEB' => ']', 'PTR' => '->', 'APTR' => '=>', 'EQUAL' => '=', - 'NUMBER' => 'number', 'UNIMATH' => '+" , "-', 'MATH' => '*" , "/" , "%', - 'INCDEC' => '++" , "--', 'SPACE' => ' ', 'DOLLAR' => '$', - 'SEMICOLON' => ';', 'COLON' => ':', 'DOUBLECOLON' => '::', 'AT' => '@', - 'HATCH' => '#', 'QUOTE' => '"', 'BACKTICK' => '`', - 'VERT' => '"|" modifier', 'DOT' => '.', 'COMMA' => '","', - 'QMARK' => '"?"', 'ID' => 'id, name', 'TEXT' => 'text', - 'LDELSLASH' => '{/..} closing tag', 'LDEL' => '{...} Smarty tag', - 'COMMENT' => 'comment', 'AS' => 'as', 'TO' => 'to', - 'PHP' => '"<?php", "<%", "{php}" tag', - 'LOGOP' => '"<", "==" ... logical operator', - 'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition', - 'SCOND' => '"is even" ... if condition',); + private $yy_global_pattern5 = null; + private $_yy_state = 1; + private $_yy_stack = array(); /** * constructor * - * @param string $data template source + * @param string $source template source * @param Smarty_Internal_TemplateCompilerBase $compiler */ - function __construct($data, Smarty_Internal_TemplateCompilerBase $compiler) + function __construct($source, Smarty_Internal_TemplateCompilerBase $compiler) { - $this->data = $data; - $this->dataLength = strlen($data); + $this->data = $source; + $this->dataLength = strlen($this->data); $this->counter = 0; if (preg_match('/^\xEF\xBB\xBF/i', $this->data, $match)) { $this->counter += strlen($match[ 0 ]); } $this->line = 1; - $this->smarty = $compiler->smarty; + $this->smarty = $compiler->template->smarty; $this->compiler = $compiler; - $this->ldel = preg_quote($this->smarty->left_delimiter, '/'); - $this->ldel_length = strlen($this->smarty->left_delimiter); - $this->rdel = preg_quote($this->smarty->right_delimiter, '/'); - $this->rdel_length = strlen($this->smarty->right_delimiter); - $this->smarty_token_names[ 'LDEL' ] = $this->smarty->left_delimiter; - $this->smarty_token_names[ 'RDEL' ] = $this->smarty->right_delimiter; + $this->compiler->initDelimiterPreg(); + $this->smarty_token_names[ 'LDEL' ] = $this->smarty->getLeftDelimiter(); + $this->smarty_token_names[ 'RDEL' ] = $this->smarty->getRightDelimiter(); } + /** + * open lexer/parser trace file + * + */ public function PrintTrace() { $this->yyTraceFILE = fopen('php://output', 'w'); $this->yyTracePrompt = '<br>'; } - /* - * Check if this tag is autoliteral + /** + * replace placeholders with runtime preg code + * + * @param string $preg + * + * @return string */ - public function isAutoLiteral() + public function replace($preg) { - return $this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ? - strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false; + return $this->compiler->replaceDelimiter($preg); } - private $_yy_state = 1; - - private $_yy_stack = array(); + /** + * check if current value is an autoliteral left delimiter + * + * @return bool + */ + public function isAutoLiteral() + { + return $this->smarty->getAutoLiteral() && isset($this->value[ $this->compiler->getLdelLength() ]) ? + strpos(" \n\t\r", $this->value[ $this->compiler->getLdelLength() ]) !== false : false; + } // end function public function yylex() { @@ -252,14 +258,18 @@ class Smarty_Internal_Templatelexer public function yypushstate($state) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, + fprintf($this->yyTraceFILE, + "%sState push %s\n", + $this->yyTracePrompt, isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state); } array_push($this->_yy_stack, $this->_yy_state); $this->_yy_state = $state; if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, + fprintf($this->yyTraceFILE, + "%snew State %s\n", + $this->yyTracePrompt, isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state); } @@ -268,13 +278,17 @@ class Smarty_Internal_Templatelexer public function yypopstate() { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, + fprintf($this->yyTraceFILE, + "%sState pop %s\n", + $this->yyTracePrompt, isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state); } $this->_yy_state = array_pop($this->_yy_stack); if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, + fprintf($this->yyTraceFILE, + "%snew State %s\n", + $this->yyTracePrompt, isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state); } @@ -284,20 +298,19 @@ class Smarty_Internal_Templatelexer { $this->_yy_state = $state; if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, + fprintf($this->yyTraceFILE, + "%sState set %s\n", + $this->yyTracePrompt, isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state); } } - public function yylex1() +public function yylex1() { if (!isset($this->yy_global_pattern1)) { $this->yy_global_pattern1 = - "/\G([{][}])|\G(" . $this->ldel . "[*])|\G((" . $this->ldel . "\\s*php([ ].*?)?" . $this->rdel . ")|(" . - $this->ldel . "\\s*[\/]php" . $this->rdel . "))|\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . - ")|\G(" . $this->ldel . "\\s*)|\G(\\s*" . $this->rdel . - ")|\G((<[?]((php\\s+|=)|\\s+))|(<[%])|(<[?]xml\\s+)|(<script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*>)|([?][>])|([%][>]))|\G([\S\s])/isS"; + $this->replace("/\G([{][}])|\G((SMARTYldel)SMARTYal[*])|\G((SMARTYldel)SMARTYalphp([ ].*?)?SMARTYrdel|(SMARTYldel)SMARTYal[\/]phpSMARTYrdel)|\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([<][?]((php\\s+|=)|\\s+)|[<][%]|[<][?]xml\\s+|[<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>]|[?][>]|[%][>])|\G((.*?)(?=((SMARTYldel)SMARTYal|[<][?]((php\\s+|=)|\\s+)|[<][%]|[<][?]xml\\s+|[<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>]|[?][>]|[%][>]SMARTYliteral))|[\s\S]+)/isS"); } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -305,17 +318,18 @@ class Smarty_Internal_Templatelexer if ($this->counter >= $this->dataLength) { return false; // end of input } - do { - if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, null, $this->counter)) { + if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, 0, $this->counter)) { if (!isset($yymatches[ 0 ][ 1 ])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($yymatches); } if (empty($yymatches)) { - throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . - substr($this->data, $this->counter, 5) . '... state TEXT'); + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, + 5) . '... state TEXT'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -326,11 +340,11 @@ class Smarty_Internal_Templatelexer $this->line += substr_count($this->value, "\n"); // accept this token return true; - } elseif ($r === true) { + } else if ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } elseif ($r === false) { + } else if ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -340,101 +354,77 @@ class Smarty_Internal_Templatelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ]); } break; - } - while (true); - } // end function - - const TEXT = 1; + } while (true); + } function yy_r1_1() { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; } function yy_r1_2() { - - preg_match("/[*]{$this->rdel}/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); + preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/", + $this->data, + $match, + PREG_OFFSET_CAPTURE, + $this->counter); if (isset($match[ 0 ][ 1 ])) { $to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]); } else { - $this->compiler->trigger_template_error("missing or misspelled comment closing tag '*{$this->smarty->right_delimiter}'"); + $this->compiler->trigger_template_error("missing or misspelled comment closing tag '{$this->smarty->getRightDelimiter()}'"); } $this->value = substr($this->data, $this->counter, $to - $this->counter); return false; } - function yy_r1_3() + function yy_r1_4() { - $this->compiler->getTagCompiler('private_php')->parsePhp($this); } - function yy_r1_7() + function yy_r1_8() { - - if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ? - strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false - ) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART; - $this->yypushstate(self::LITERAL); - } + $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r1_8() + function yy_r1_10() { - - if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ? - strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false - ) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->yypushstate(self::TAG); - return true; - } + $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART; + $this->yypushstate(self::LITERAL); } - function yy_r1_9() + function yy_r1_12() { + $this->token = Smarty_Internal_Templateparser::TP_LITERALEND; + $this->yypushstate(self::LITERAL); + } // end function - $this->token = Smarty_Internal_Templateparser::TP_TEXT; + function yy_r1_14() + { + $this->yypushstate(self::TAG); + return true; } - function yy_r1_10() + function yy_r1_16() { - $this->compiler->getTagCompiler('private_php')->parsePhp($this); } function yy_r1_19() { - - $to = $this->dataLength; - preg_match("/($this->ldel)|(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|(<script\s+language\s*=\s*[\"']?\s*php\s*[\"']?\s*>)|([?][>])|([%][>])/i", - $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); - if (isset($match[ 0 ][ 1 ])) { - $to = $match[ 0 ][ 1 ]; - } - $this->value = substr($this->data, $this->counter, $to - $this->counter); $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - public function yylex2() +public function yylex2() { if (!isset($this->yy_global_pattern2)) { $this->yy_global_pattern2 = - "/\G(" . $this->ldel . "\\s*(if|elseif|else if|while)\\s+)|\G(" . $this->ldel . "\\s*for\\s+)|\G(" . - $this->ldel . "\\s*foreach(?![^\s]))|\G(" . $this->ldel . "\\s*setfilter\\s+)|\G(" . $this->ldel . - "\\s*make_nocache\\s+)|\G(" . $this->ldel . "\\s*[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*" . $this->rdel . - ")|\G(" . $this->ldel . "\\s*[\/](?:(?!block)[0-9]*[a-zA-Z_]\\w*)\\s*" . $this->rdel . ")|\G(" . - $this->ldel . "\\s*[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*" . $this->rdel . ")|\G(" . $this->ldel . - "\\s*[\/])|\G(" . $this->ldel . "\\s*)/isS"; + $this->replace("/\G((SMARTYldel)SMARTYal(if|elseif|else if|while)\\s+)|\G((SMARTYldel)SMARTYalfor\\s+)|\G((SMARTYldel)SMARTYalforeach(?![^\s]))|\G((SMARTYldel)SMARTYalsetfilter\\s+)|\G((SMARTYldel)SMARTYalmake_nocache\\s+)|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[$]smarty\\.block\\.(child|parent)\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/][0-9]*[a-zA-Z_]\\w*\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal)/isS"); } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -442,17 +432,18 @@ class Smarty_Internal_Templatelexer if ($this->counter >= $this->dataLength) { return false; // end of input } - do { - if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, null, $this->counter)) { + if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, 0, $this->counter)) { if (!isset($yymatches[ 0 ][ 1 ])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($yymatches); } if (empty($yymatches)) { - throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . - substr($this->data, $this->counter, 5) . '... state TAG'); + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, + 5) . '... state TAG'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -463,11 +454,11 @@ class Smarty_Internal_Templatelexer $this->line += substr_count($this->value, "\n"); // accept this token return true; - } elseif ($r === true) { + } else if ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } elseif ($r === false) { + } else if ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -477,107 +468,102 @@ class Smarty_Internal_Templatelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ]); } break; - } - while (true); - } // end function - - const TAG = 2; + } while (true); + } function yy_r2_1() { - $this->token = Smarty_Internal_Templateparser::TP_LDELIF; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r2_3() + function yy_r2_4() { - $this->token = Smarty_Internal_Templateparser::TP_LDELFOR; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r2_4() + function yy_r2_6() { - $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r2_5() + function yy_r2_8() { - $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r2_6() + function yy_r2_10() { - $this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r2_7() + function yy_r2_12() { - $this->yypopstate(); $this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG; $this->taglineno = $this->line; } - function yy_r2_9() + function yy_r2_15() { + $this->yypopstate(); + $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT; + $this->taglineno = $this->line; + } + function yy_r2_18() + { $this->yypopstate(); $this->token = Smarty_Internal_Templateparser::TP_CLOSETAG; $this->taglineno = $this->line; } - function yy_r2_10() + function yy_r2_20() { - - if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] == self::TEXT) { + if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] === self::TEXT) { $this->yypopstate(); $this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT; $this->taglineno = $this->line; } else { - $this->value = $this->smarty->left_delimiter; + $this->value = $this->smarty->getLeftDelimiter(); $this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - } + } // end function - function yy_r2_12() + function yy_r2_23() { - $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r2_13() + function yy_r2_25() { - $this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - public function yylex3() +public function yylex3() { if (!isset($this->yy_global_pattern3)) { - $this->yy_global_pattern3 = "/\G(\\s*" . $this->rdel . ")|\G(" . $this->ldel . - "\\s*)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$]smarty\\.block\\.(child|parent))|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*(([!=][=]{1,2})|([<][=>]?)|([>][=]?)|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\\s+)|\G(\\s+(is\\s+(not\\s+)?(odd|even|div)\\s+by)\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G(([!]\\s*)|(not\\s+))|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|])|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G([\S\s])/isS"; + $this->yy_global_pattern3 = + $this->replace("/\G(\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*([!=][=]{1,2}|[<][=>]?|[>][=]?|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even|div)\\s+by\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G([!]\\s*|not\\s+)|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|][@]?)|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G([\S\s])/isS"); } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -585,17 +571,18 @@ class Smarty_Internal_Templatelexer if ($this->counter >= $this->dataLength) { return false; // end of input } - do { - if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, null, $this->counter)) { + if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, 0, $this->counter)) { if (!isset($yymatches[ 0 ][ 1 ])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($yymatches); } if (empty($yymatches)) { - throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . - substr($this->data, $this->counter, 5) . '... state TAGBODY'); + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, + 5) . '... state TAGBODY'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -606,11 +593,11 @@ class Smarty_Internal_Templatelexer $this->line += substr_count($this->value, "\n"); // accept this token return true; - } elseif ($r === true) { + } else if ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } elseif ($r === false) { + } else if ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -620,213 +607,168 @@ class Smarty_Internal_Templatelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ]); } break; - } - while (true); - } // end function - - const TAGBODY = 3; + } while (true); + } function yy_r3_1() { - $this->token = Smarty_Internal_Templateparser::TP_RDEL; $this->yypopstate(); } function yy_r3_2() { - - if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ? - strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false - ) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->yypushstate(self::TAG); - return true; - } + $this->yypushstate(self::TAG); + return true; } - function yy_r3_3() + function yy_r3_4() { - $this->token = Smarty_Internal_Templateparser::TP_QUOTE; $this->yypushstate(self::DOUBLEQUOTEDSTRING); - } - - function yy_r3_4() - { - - $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING; + $this->compiler->enterDoubleQuote(); } function yy_r3_5() { - - $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT; - $this->taglineno = $this->line; + $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING; } - function yy_r3_7() + function yy_r3_6() { - $this->token = Smarty_Internal_Templateparser::TP_DOLLARID; } - function yy_r3_8() + function yy_r3_7() { - $this->token = Smarty_Internal_Templateparser::TP_DOLLAR; } - function yy_r3_9() + function yy_r3_8() { - $this->token = Smarty_Internal_Templateparser::TP_ISIN; } - function yy_r3_10() + function yy_r3_9() { - $this->token = Smarty_Internal_Templateparser::TP_AS; } - function yy_r3_11() + function yy_r3_10() { - $this->token = Smarty_Internal_Templateparser::TP_TO; } - function yy_r3_12() + function yy_r3_11() { - $this->token = Smarty_Internal_Templateparser::TP_STEP; } - function yy_r3_13() + function yy_r3_12() { - $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF; } - function yy_r3_14() + function yy_r3_13() { - $this->token = Smarty_Internal_Templateparser::TP_LOGOP; } - function yy_r3_19() + function yy_r3_15() { - $this->token = Smarty_Internal_Templateparser::TP_SLOGOP; } - function yy_r3_21() + function yy_r3_17() { - $this->token = Smarty_Internal_Templateparser::TP_TLOGOP; } - function yy_r3_25() + function yy_r3_20() { - $this->token = Smarty_Internal_Templateparser::TP_SINGLECOND; } - function yy_r3_28() + function yy_r3_23() { - $this->token = Smarty_Internal_Templateparser::TP_NOT; } - function yy_r3_31() + function yy_r3_24() { - $this->token = Smarty_Internal_Templateparser::TP_TYPECAST; } - function yy_r3_35() + function yy_r3_28() { - $this->token = Smarty_Internal_Templateparser::TP_OPENP; } - function yy_r3_36() + function yy_r3_29() { - $this->token = Smarty_Internal_Templateparser::TP_CLOSEP; } - function yy_r3_37() + function yy_r3_30() { - $this->token = Smarty_Internal_Templateparser::TP_OPENB; } - function yy_r3_38() + function yy_r3_31() { - $this->token = Smarty_Internal_Templateparser::TP_CLOSEB; } - function yy_r3_39() + function yy_r3_32() { - $this->token = Smarty_Internal_Templateparser::TP_PTR; } - function yy_r3_40() + function yy_r3_33() { - $this->token = Smarty_Internal_Templateparser::TP_APTR; } - function yy_r3_41() + function yy_r3_34() { - $this->token = Smarty_Internal_Templateparser::TP_EQUAL; } - function yy_r3_42() + function yy_r3_35() { - $this->token = Smarty_Internal_Templateparser::TP_INCDEC; } - function yy_r3_44() + function yy_r3_37() { - $this->token = Smarty_Internal_Templateparser::TP_UNIMATH; } - function yy_r3_46() + function yy_r3_39() { - $this->token = Smarty_Internal_Templateparser::TP_MATH; } - function yy_r3_48() + function yy_r3_41() { - $this->token = Smarty_Internal_Templateparser::TP_AT; } - function yy_r3_49() + function yy_r3_42() { - $this->token = Smarty_Internal_Templateparser::TP_HATCH; } - function yy_r3_50() + function yy_r3_43() { - // resolve conflicts with shorttag and right_delimiter starting with '=' - if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->rdel_length) == - $this->smarty->right_delimiter - ) { - preg_match("/\s+/", $this->value, $match); + if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) === + $this->smarty->getRightDelimiter()) { + preg_match('/\s+/', $this->value, $match); $this->value = $match[ 0 ]; $this->token = Smarty_Internal_Templateparser::TP_SPACE; } else { @@ -834,97 +776,82 @@ class Smarty_Internal_Templatelexer } } - function yy_r3_51() + function yy_r3_44() { - $this->token = Smarty_Internal_Templateparser::TP_NAMESPACE; } - function yy_r3_54() + function yy_r3_47() { - $this->token = Smarty_Internal_Templateparser::TP_ID; } - function yy_r3_55() + function yy_r3_48() { - $this->token = Smarty_Internal_Templateparser::TP_INTEGER; } - function yy_r3_56() + function yy_r3_49() { - $this->token = Smarty_Internal_Templateparser::TP_BACKTICK; $this->yypopstate(); } - function yy_r3_57() + function yy_r3_50() { - $this->token = Smarty_Internal_Templateparser::TP_VERT; } - function yy_r3_58() + function yy_r3_51() { - $this->token = Smarty_Internal_Templateparser::TP_DOT; } - function yy_r3_59() + function yy_r3_52() { - $this->token = Smarty_Internal_Templateparser::TP_COMMA; } - function yy_r3_60() + function yy_r3_53() { - $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON; } - function yy_r3_61() + function yy_r3_54() { - $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON; } - function yy_r3_62() + function yy_r3_55() { - $this->token = Smarty_Internal_Templateparser::TP_COLON; } - function yy_r3_63() + function yy_r3_56() { - $this->token = Smarty_Internal_Templateparser::TP_QMARK; } - function yy_r3_64() + function yy_r3_57() { - $this->token = Smarty_Internal_Templateparser::TP_HEX; } - function yy_r3_65() + function yy_r3_58() { - $this->token = Smarty_Internal_Templateparser::TP_SPACE; - } + } // end function - function yy_r3_66() + function yy_r3_59() { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - public function yylex4() +public function yylex4() { if (!isset($this->yy_global_pattern4)) { $this->yy_global_pattern4 = - "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/]literal\\s*" . - $this->rdel . ")|\G([\S\s])/isS"; + $this->replace("/\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((.*?)(?=(SMARTYldel)SMARTYal[\/]?literalSMARTYrdel))/isS"); } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -932,17 +859,18 @@ class Smarty_Internal_Templatelexer if ($this->counter >= $this->dataLength) { return false; // end of input } - do { - if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, null, $this->counter)) { + if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, 0, $this->counter)) { if (!isset($yymatches[ 0 ][ 1 ])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($yymatches); } if (empty($yymatches)) { - throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . - substr($this->data, $this->counter, 5) . '... state LITERAL'); + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, + 5) . '... state LITERAL'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -953,11 +881,11 @@ class Smarty_Internal_Templatelexer $this->line += substr_count($this->value, "\n"); // accept this token return true; - } elseif ($r === true) { + } else if ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } elseif ($r === false) { + } else if ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -967,27 +895,23 @@ class Smarty_Internal_Templatelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ]); } break; - } - while (true); - } // end function - - const LITERAL = 4; + } while (true); + } function yy_r4_1() { - - $this->literal_cnt ++; + $this->literal_cnt++; $this->token = Smarty_Internal_Templateparser::TP_LITERAL; } - function yy_r4_2() + function yy_r4_3() { - if ($this->literal_cnt) { - $this->literal_cnt --; + $this->literal_cnt--; $this->token = Smarty_Internal_Templateparser::TP_LITERAL; } else { $this->token = Smarty_Internal_Templateparser::TP_LITERALEND; @@ -995,30 +919,16 @@ class Smarty_Internal_Templatelexer } } - function yy_r4_3() + function yy_r4_5() { - - $to = $this->dataLength; - preg_match("/{$this->ldel}[\/]?literal{$this->rdel}/i", $this->data, $match, PREG_OFFSET_CAPTURE, - $this->counter); - if (isset($match[ 0 ][ 1 ])) { - $to = $match[ 0 ][ 1 ]; - } else { - $this->compiler->trigger_template_error("missing or misspelled literal closing tag"); - } - $this->value = substr($this->data, $this->counter, $to - $this->counter); $this->token = Smarty_Internal_Templateparser::TP_LITERAL; - } + } // end function - public function yylex5() +public function yylex5() { if (!isset($this->yy_global_pattern5)) { $this->yy_global_pattern5 = - "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/]literal\\s*" . - $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/])|\G(" . $this->ldel . "\\s*[0-9]*[a-zA-Z_]\\w*)|\G(" . - $this->ldel . - "\\s*)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=(" . - $this->ldel . "|\\$|`\\$|\")))|\G([\S\s])/isS"; + $this->replace("/\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=((SMARTYldel)SMARTYal|\\$|`\\$|\"SMARTYliteral)))/isS"); } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -1026,17 +936,18 @@ class Smarty_Internal_Templatelexer if ($this->counter >= $this->dataLength) { return false; // end of input } - do { - if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, null, $this->counter)) { + if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, 0, $this->counter)) { if (!isset($yymatches[ 0 ][ 1 ])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($yymatches); } if (empty($yymatches)) { - throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . - substr($this->data, $this->counter, 5) . '... state DOUBLEQUOTEDSTRING'); + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, + 5) . '... state DOUBLEQUOTEDSTRING'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -1047,11 +958,11 @@ class Smarty_Internal_Templatelexer $this->line += substr_count($this->value, "\n"); // accept this token return true; - } elseif ($r === true) { + } else if ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } elseif ($r === false) { + } else if ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -1061,109 +972,75 @@ class Smarty_Internal_Templatelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ]); } break; - } - while (true); - } // end function - - const DOUBLEQUOTEDSTRING = 5; + } while (true); + } function yy_r5_1() { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r5_2() + function yy_r5_3() { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r5_3() + function yy_r5_5() { - - if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ? - strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false - ) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->yypushstate(self::TAG); - return true; - } + $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r5_4() + function yy_r5_7() { - - if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ? - strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false - ) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->yypushstate(self::TAG); - return true; - } + $this->yypushstate(self::TAG); + return true; } - function yy_r5_5() + function yy_r5_9() { - - if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ? - strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false - ) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LDEL; - $this->taglineno = $this->line; - $this->yypushstate(self::TAGBODY); - } + $this->yypushstate(self::TAG); + return true; } - function yy_r5_6() + function yy_r5_11() { + $this->token = Smarty_Internal_Templateparser::TP_LDEL; + $this->taglineno = $this->line; + $this->yypushstate(self::TAGBODY); + } + function yy_r5_13() + { $this->token = Smarty_Internal_Templateparser::TP_QUOTE; $this->yypopstate(); } - function yy_r5_7() + function yy_r5_14() { - $this->token = Smarty_Internal_Templateparser::TP_BACKTICK; - $this->value = substr($this->value, 0, - 1); + $this->value = substr($this->value, 0, -1); $this->yypushstate(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r5_8() + function yy_r5_15() { - $this->token = Smarty_Internal_Templateparser::TP_DOLLARID; } - function yy_r5_9() + function yy_r5_16() { - - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } - - function yy_r5_10() - { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r5_14() + function yy_r5_17() { - - $to = $this->dataLength; - $this->value = substr($this->data, $this->counter, $to - $this->counter); $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - }
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php index bc74fe440..d8219daed 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php @@ -1,70 +1,5 @@ <?php -class TP_yyToken implements ArrayAccess -{ - public $string = ''; - - public $metadata = array(); - - public function __construct($s, $m = array()) - { - if ($s instanceof TP_yyToken) { - $this->string = $s->string; - $this->metadata = $s->metadata; - } else { - $this->string = (string) $s; - if ($m instanceof TP_yyToken) { - $this->metadata = $m->metadata; - } elseif (is_array($m)) { - $this->metadata = $m; - } - } - } - - public function __toString() - { - return $this->string; - } - - public function offsetExists($offset) - { - return isset($this->metadata[ $offset ]); - } - - public function offsetGet($offset) - { - return $this->metadata[ $offset ]; - } - - public function offsetSet($offset, $value) - { - if ($offset === null) { - if (isset($value[ 0 ])) { - $x = ($value instanceof TP_yyToken) ? $value->metadata : $value; - $this->metadata = array_merge($this->metadata, $x); - - return; - } - $offset = count($this->metadata); - } - if ($value === null) { - return; - } - if ($value instanceof TP_yyToken) { - if ($value->metadata) { - $this->metadata[ $offset ] = $value->metadata; - } - } elseif ($value) { - $this->metadata[ $offset ] = $value; - } - } - - public function offsetUnset($offset) - { - unset($this->metadata[ $offset ]); - } -} - class TP_yyStackEntry { public $stateno; /* The state-number */ @@ -75,7 +10,6 @@ class TP_yyStackEntry } ; - #line 11 "../smarty/lexer/smarty_internal_templateparser.y" /** @@ -89,129 +23,1629 @@ class TP_yyStackEntry class Smarty_Internal_Templateparser { #line 23 "../smarty/lexer/smarty_internal_templateparser.y" - - const Err1 = "Security error: Call to private object member not allowed"; - - const Err2 = "Security error: Call to dynamic object member not allowed"; - - const Err3 = "PHP in template not allowed. Use SmartyBC to enable it"; - + const Err1 = 'Security error: Call to private object member not allowed'; + const Err2 = 'Security error: Call to dynamic object member not allowed'; + const Err3 = 'PHP in template not allowed. Use SmartyBC to enable it'; + const TP_VERT = 1; + const TP_COLON = 2; + const TP_UNIMATH = 3; + const TP_PHP = 4; + const TP_TEXT = 5; + const TP_STRIPON = 6; + const TP_STRIPOFF = 7; + const TP_LITERALSTART = 8; + const TP_LITERALEND = 9; + const TP_LITERAL = 10; + const TP_SIMPELOUTPUT = 11; + const TP_SIMPLETAG = 12; + const TP_SMARTYBLOCKCHILDPARENT = 13; + const TP_LDEL = 14; + const TP_RDEL = 15; + const TP_DOLLARID = 16; + const TP_EQUAL = 17; + const TP_ID = 18; + const TP_PTR = 19; + const TP_LDELMAKENOCACHE = 20; + const TP_LDELIF = 21; + const TP_LDELFOR = 22; + const TP_SEMICOLON = 23; + const TP_INCDEC = 24; + const TP_TO = 25; + const TP_STEP = 26; + const TP_LDELFOREACH = 27; + const TP_SPACE = 28; + const TP_AS = 29; + const TP_APTR = 30; + const TP_LDELSETFILTER = 31; + const TP_CLOSETAG = 32; + const TP_LDELSLASH = 33; + const TP_ATTR = 34; + const TP_INTEGER = 35; + const TP_COMMA = 36; + const TP_OPENP = 37; + const TP_CLOSEP = 38; + const TP_MATH = 39; + const TP_ISIN = 40; + const TP_QMARK = 41; + const TP_NOT = 42; + const TP_TYPECAST = 43; + const TP_HEX = 44; + const TP_DOT = 45; + const TP_INSTANCEOF = 46; + const TP_SINGLEQUOTESTRING = 47; + const TP_DOUBLECOLON = 48; + const TP_NAMESPACE = 49; + const TP_AT = 50; + const TP_HATCH = 51; + const TP_OPENB = 52; + const TP_CLOSEB = 53; + const TP_DOLLAR = 54; + const TP_LOGOP = 55; + const TP_SLOGOP = 56; + const TP_TLOGOP = 57; + const TP_SINGLECOND = 58; + const TP_QUOTE = 59; + const TP_BACKTICK = 60; + const YY_NO_ACTION = 511; + const YY_ACCEPT_ACTION = 510; + const YY_ERROR_ACTION = 509; + const YY_SZ_ACTTAB = 2178; + const YY_SHIFT_USE_DFLT = -23; + const YY_SHIFT_MAX = 227; + const YY_REDUCE_USE_DFLT = -68; + const YY_REDUCE_MAX = 176; + const YYNOCODE = 108; + const YYSTACKDEPTH = 500; + const YYNSTATE = 323; + const YYNRULE = 186; + const YYERRORSYMBOL = 61; + const YYERRSYMDT = 'yy0'; + const YYFALLBACK = 0; /** * result status * * @var bool */ public $successful = true; - /** * return value * * @var mixed */ public $retvalue = 0; - /** * @var */ public $yymajor; - /** * last index of array variable * * @var mixed */ public $last_index; - /** * last variable name * * @var string */ public $last_variable; - /** * root parse tree buffer * * @var Smarty_Internal_ParseTree */ public $root_buffer; - /** * current parse tree object * * @var Smarty_Internal_ParseTree */ public $current_buffer; - /** * lexer object * * @var Smarty_Internal_Templatelexer */ public $lex; - /** * internal error flag * * @var bool */ private $internalError = false; - /** * {strip} status * * @var bool */ public $strip = false; - /** * compiler object * * @var Smarty_Internal_TemplateCompilerBase */ public $compiler = null; - /** * smarty object * * @var Smarty */ public $smarty = null; - /** * template object * * @var Smarty_Internal_Template */ public $template = null; - /** * block nesting level * * @var int */ public $block_nesting_level = 0; - /** * security object * * @var Smarty_Security */ public $security = null; - /** * template prefix array * * @var \Smarty_Internal_ParseTree[] */ public $template_prefix = array(); - /** - * security object + * template prefix array * * @var \Smarty_Internal_ParseTree[] */ public $template_postfix = array(); + static public $yy_action = array( + 43, 266, 267, 379, 115, 203, 33, 201, 274, 275, + 281, 1, 13, 124, 93, 183, 379, 217, 6, 79, + 253, 89, 379, 16, 102, 425, 304, 252, 218, 249, + 211, 129, 190, 302, 26, 213, 425, 33, 11, 39, + 42, 283, 209, 13, 223, 385, 195, 233, 77, 3, + 236, 290, 43, 385, 170, 385, 75, 17, 385, 94, + 274, 275, 281, 1, 385, 128, 385, 196, 385, 217, + 6, 79, 80, 298, 158, 210, 102, 156, 174, 133, + 218, 249, 211, 85, 208, 290, 28, 264, 101, 264, + 199, 39, 42, 283, 209, 31, 312, 182, 195, 259, + 77, 3, 43, 290, 23, 172, 239, 174, 75, 288, + 274, 275, 281, 1, 167, 127, 256, 196, 248, 217, + 6, 79, 345, 40, 20, 305, 102, 248, 345, 157, + 218, 249, 211, 83, 208, 290, 26, 8, 174, 264, + 74, 39, 42, 283, 209, 131, 312, 292, 195, 74, + 77, 3, 43, 290, 295, 99, 243, 174, 75, 345, + 274, 275, 281, 1, 15, 126, 86, 196, 248, 217, + 6, 79, 345, 322, 161, 289, 102, 87, 345, 165, + 218, 249, 211, 290, 208, 115, 26, 128, 255, 221, + 74, 39, 42, 283, 209, 93, 312, 210, 195, 162, + 77, 3, 43, 290, 254, 235, 247, 304, 75, 27, + 274, 275, 281, 1, 172, 127, 425, 177, 248, 217, + 6, 79, 77, 174, 250, 290, 102, 425, 198, 14, + 218, 249, 211, 248, 208, 34, 26, 222, 206, 139, + 74, 39, 42, 283, 209, 198, 312, 23, 195, 291, + 77, 3, 43, 290, 300, 74, 198, 438, 75, 346, + 274, 275, 281, 1, 438, 127, 176, 196, 267, 217, + 6, 79, 346, 161, 289, 290, 102, 23, 346, 238, + 218, 249, 211, 33, 178, 263, 26, 160, 289, 13, + 37, 39, 42, 283, 209, 198, 312, 212, 195, 250, + 77, 3, 43, 290, 216, 189, 155, 97, 75, 381, + 274, 275, 281, 1, 149, 127, 264, 179, 18, 217, + 6, 79, 381, 94, 97, 237, 102, 140, 381, 251, + 218, 249, 211, 4, 194, 94, 26, 264, 198, 37, + 30, 39, 42, 283, 209, 198, 312, 212, 195, 129, + 77, 3, 43, 290, 219, 172, 11, 97, 75, 378, + 274, 275, 281, 1, 101, 127, 438, 186, 210, 217, + 6, 79, 378, 438, 12, 163, 102, 220, 378, 425, + 218, 249, 211, 302, 208, 213, 26, 225, 215, 187, + 425, 39, 42, 283, 209, 234, 312, 7, 195, 212, + 77, 3, 43, 290, 134, 9, 240, 425, 75, 97, + 274, 275, 281, 1, 264, 91, 109, 76, 425, 217, + 6, 79, 253, 293, 426, 16, 102, 251, 198, 252, + 218, 249, 211, 198, 208, 426, 26, 148, 198, 135, + 132, 39, 42, 283, 209, 143, 312, 264, 195, 264, + 77, 3, 43, 290, 138, 264, 205, 24, 75, 166, + 274, 275, 281, 1, 264, 125, 276, 196, 19, 217, + 6, 79, 454, 153, 13, 454, 102, 168, 290, 454, + 218, 249, 211, 174, 208, 314, 5, 136, 210, 251, + 152, 39, 42, 283, 209, 268, 312, 213, 195, 308, + 77, 3, 43, 290, 94, 169, 111, 144, 75, 251, + 274, 275, 281, 1, 229, 128, 7, 196, 313, 217, + 6, 79, 510, 90, 175, 111, 102, 164, 289, 174, + 218, 249, 211, 101, 208, 265, 28, 32, 128, 150, + 261, 39, 42, 283, 209, 10, 312, 317, 195, 224, + 77, 21, 269, 290, 232, 230, 282, 114, 75, 307, + 214, 213, 279, 22, 84, 103, 246, 181, 92, 64, + 260, 262, 454, 77, 93, 454, 290, 257, 316, 454, + 438, 228, 311, 197, 309, 78, 304, 271, 272, 273, + 270, 121, 258, 310, 274, 275, 281, 1, 17, 280, + 110, 284, 81, 217, 6, 79, 438, 146, 94, 438, + 102, 454, 151, 438, 218, 249, 211, 307, 214, 213, + 279, 278, 84, 103, 104, 180, 92, 56, 263, 159, + 130, 152, 93, 295, 137, 257, 316, 295, 251, 88, + 311, 197, 309, 82, 304, 307, 295, 213, 303, 295, + 100, 295, 295, 193, 105, 59, 295, 295, 295, 295, + 93, 295, 295, 257, 316, 295, 295, 295, 311, 197, + 309, 307, 304, 213, 277, 295, 100, 103, 295, 181, + 92, 64, 200, 297, 295, 253, 93, 295, 16, 257, + 316, 295, 252, 295, 311, 197, 309, 295, 304, 295, + 299, 295, 295, 295, 295, 295, 274, 275, 281, 2, + 295, 301, 295, 295, 295, 217, 6, 79, 253, 295, + 295, 16, 102, 299, 204, 252, 218, 249, 211, 274, + 275, 281, 2, 295, 301, 33, 295, 154, 217, 6, + 79, 13, 295, 295, 295, 102, 295, 295, 295, 218, + 249, 211, 295, 295, 286, 25, 307, 295, 213, 295, + 295, 100, 295, 295, 193, 105, 59, 295, 295, 295, + 295, 93, 295, 295, 257, 316, 295, 287, 25, 311, + 197, 309, 307, 304, 213, 295, 454, 100, 295, 454, + 193, 118, 67, 454, 296, 253, 295, 93, 16, 295, + 257, 316, 252, 295, 295, 311, 197, 309, 295, 304, + 295, 295, 307, 295, 213, 295, 188, 100, 295, 295, + 193, 118, 67, 295, 295, 454, 295, 93, 295, 295, + 257, 316, 295, 295, 226, 311, 197, 309, 295, 304, + 295, 295, 307, 295, 213, 295, 192, 100, 295, 295, + 193, 118, 67, 295, 295, 295, 295, 93, 295, 295, + 257, 316, 295, 295, 295, 311, 197, 309, 295, 304, + 295, 295, 307, 295, 213, 295, 191, 98, 295, 295, + 193, 118, 46, 295, 108, 295, 295, 93, 295, 295, + 257, 316, 295, 295, 295, 311, 197, 309, 307, 304, + 213, 295, 295, 98, 295, 295, 193, 118, 47, 295, + 219, 295, 295, 93, 295, 295, 257, 316, 295, 295, + 295, 311, 197, 309, 307, 304, 213, 295, 295, 100, + 295, 295, 193, 118, 45, 295, 295, 295, 295, 93, + 295, 295, 257, 316, 295, 295, 295, 311, 197, 309, + 295, 304, 295, 295, 307, 295, 213, 295, 295, 100, + 295, 295, 193, 118, 70, 295, 295, 295, 295, 93, + 295, 295, 257, 316, 295, 295, 295, 311, 197, 309, + 307, 304, 213, 295, 295, 100, 295, 295, 193, 118, + 49, 295, 295, 295, 295, 93, 295, 295, 257, 316, + 295, 295, 295, 311, 197, 309, 307, 304, 213, 295, + 295, 100, 295, 295, 193, 96, 66, 295, 295, 295, + 295, 93, 295, 295, 257, 316, 295, 295, 295, 311, + 197, 309, 295, 304, 295, 295, 307, 295, 213, 295, + 295, 100, 295, 295, 193, 118, 44, 295, 295, 295, + 295, 93, 295, 295, 257, 316, 295, 295, 295, 311, + 197, 309, 307, 304, 213, 295, 295, 100, 295, 295, + 193, 118, 58, 295, 295, 295, 295, 93, 295, 295, + 257, 316, 295, 295, 295, 311, 197, 309, 307, 304, + 213, 295, 295, 100, 295, 295, 193, 118, 54, 295, + 295, 295, 295, 93, 295, 295, 257, 316, 295, 295, + 295, 311, 197, 309, 295, 304, 295, 295, 307, 295, + 213, 295, 295, 100, 295, 295, 193, 118, 71, 295, + 295, 295, 295, 93, 295, 295, 257, 316, 295, 295, + 295, 311, 197, 309, 307, 304, 213, 295, 295, 100, + 295, 295, 193, 118, 65, 295, 295, 295, 295, 93, + 295, 295, 257, 316, 295, 295, 295, 311, 197, 309, + 307, 304, 213, 295, 295, 100, 295, 295, 193, 96, + 57, 295, 295, 295, 295, 93, 295, 295, 257, 316, + 295, 295, 295, 311, 197, 309, 295, 304, 295, 295, + 307, 295, 213, 295, 295, 100, 295, 295, 185, 106, + 53, 295, 295, 295, 295, 93, 295, 295, 257, 316, + 295, 295, 295, 311, 197, 309, 307, 304, 213, 295, + 295, 100, 295, 295, 193, 118, 60, 295, 295, 295, + 295, 93, 295, 295, 257, 316, 295, 295, 295, 311, + 197, 309, 307, 304, 213, 295, 295, 100, 295, 295, + 193, 118, 73, 295, 295, 295, 295, 93, 295, 295, + 257, 316, 295, 295, 295, 311, 197, 309, 295, 304, + 295, 295, 307, 295, 213, 295, 295, 100, 295, 295, + 193, 118, 55, 295, 295, 295, 295, 93, 295, 295, + 257, 316, 295, 295, 295, 311, 197, 309, 307, 304, + 213, 295, 295, 100, 295, 295, 193, 95, 68, 295, + 295, 295, 295, 93, 295, 295, 257, 316, 295, 295, + 295, 311, 197, 309, 307, 304, 213, 295, 295, 100, + 295, 295, 193, 118, 69, 295, 295, 295, 295, 93, + 295, 295, 257, 316, 295, 295, 295, 311, 197, 309, + 295, 304, 295, 295, 307, 295, 213, 295, 295, 100, + 295, 295, 193, 118, 51, 295, 295, 295, 295, 93, + 295, 295, 257, 316, 295, 295, 295, 311, 197, 309, + 307, 304, 213, 295, 295, 100, 295, 295, 184, 118, + 52, 295, 295, 295, 295, 93, 295, 295, 257, 316, + 295, 295, 295, 311, 197, 309, 307, 304, 213, 295, + 295, 100, 295, 295, 193, 118, 47, 295, 295, 295, + 295, 93, 295, 295, 257, 316, 295, 295, 295, 311, + 197, 309, 295, 304, 295, 295, 307, 295, 213, 295, + 295, 100, 295, 295, 193, 118, 50, 295, 295, 295, + 295, 93, 295, 295, 257, 316, 295, 295, 295, 311, + 197, 309, 307, 304, 213, 295, 295, 100, 295, 295, + 193, 118, 62, 295, 295, 295, 295, 93, 295, 295, + 257, 316, 295, 295, 295, 311, 197, 309, 307, 304, + 213, 295, 295, 100, 295, 295, 193, 118, 63, 295, + 295, 295, 295, 93, 295, 295, 257, 316, 295, 295, + 295, 311, 197, 309, 295, 304, 295, 295, 307, 295, + 213, 295, 295, 100, 295, 295, 193, 118, 61, 295, + 295, 295, 295, 93, 295, 295, 257, 316, 295, 295, + 295, 311, 197, 309, 307, 304, 213, 295, 295, 100, + 295, 295, 193, 118, 48, 295, 295, 295, 295, 93, + 295, 295, 257, 316, 391, 391, 391, 311, 197, 309, + 307, 304, 213, 295, 295, 100, 295, 295, 193, 118, + 72, 295, 295, 295, 295, 93, 295, 295, 257, 316, + 295, 295, 295, 311, 197, 309, 295, 304, 295, 295, + 425, 295, 391, 391, 295, 295, 295, 295, 307, 295, + 213, 425, 198, 100, 38, 295, 193, 112, 391, 391, + 391, 391, 38, 93, 295, 295, 295, 306, 295, 295, + 295, 311, 197, 309, 295, 304, 295, 35, 307, 33, + 213, 295, 295, 100, 295, 13, 193, 120, 295, 295, + 41, 36, 198, 93, 38, 295, 295, 231, 41, 36, + 295, 311, 197, 309, 295, 304, 319, 318, 315, 245, + 295, 207, 295, 295, 319, 318, 315, 245, 295, 33, + 454, 295, 295, 454, 295, 13, 207, 454, 438, 295, + 41, 36, 295, 295, 295, 454, 295, 295, 454, 295, + 295, 14, 454, 438, 295, 295, 319, 318, 315, 245, + 295, 198, 295, 38, 438, 295, 295, 438, 307, 454, + 213, 438, 320, 100, 295, 241, 193, 122, 295, 438, + 295, 295, 438, 93, 454, 295, 438, 295, 198, 295, + 38, 311, 197, 309, 295, 304, 307, 295, 213, 41, + 36, 100, 295, 295, 193, 117, 295, 295, 295, 295, + 295, 93, 295, 295, 295, 319, 318, 315, 245, 311, + 197, 309, 207, 304, 295, 295, 41, 36, 295, 295, + 295, 454, 295, 295, 454, 295, 295, 4, 454, 438, + 295, 295, 319, 318, 315, 245, 295, 294, 295, 295, + 295, 307, 295, 213, 295, 295, 100, 295, 295, 193, + 123, 295, 295, 295, 295, 438, 93, 295, 438, 141, + 454, 295, 438, 167, 311, 197, 309, 295, 304, 264, + 295, 295, 40, 20, 305, 295, 295, 307, 295, 213, + 295, 198, 100, 38, 295, 193, 116, 174, 307, 295, + 213, 295, 93, 100, 295, 295, 193, 113, 295, 295, + 311, 197, 309, 93, 304, 295, 198, 295, 38, 295, + 295, 311, 197, 309, 295, 304, 307, 295, 213, 41, + 36, 100, 295, 295, 193, 119, 295, 295, 295, 295, + 295, 93, 295, 321, 145, 319, 318, 315, 245, 311, + 197, 309, 207, 304, 41, 36, 295, 295, 295, 295, + 295, 454, 295, 295, 454, 295, 295, 295, 454, 438, + 319, 318, 315, 245, 198, 295, 38, 295, 198, 295, + 38, 295, 198, 295, 38, 295, 295, 295, 242, 295, + 295, 295, 285, 295, 295, 438, 171, 295, 438, 295, + 454, 295, 438, 295, 295, 295, 295, 454, 295, 295, + 454, 295, 41, 36, 454, 438, 41, 36, 295, 295, + 41, 36, 198, 295, 38, 295, 295, 295, 319, 318, + 315, 245, 319, 318, 315, 245, 319, 318, 315, 245, + 295, 438, 295, 147, 438, 295, 454, 167, 438, 295, + 295, 295, 295, 264, 295, 295, 40, 20, 305, 227, + 41, 36, 295, 295, 295, 295, 295, 295, 295, 295, + 295, 174, 295, 295, 295, 295, 319, 318, 315, 245, + 198, 295, 38, 295, 198, 295, 38, 142, 198, 295, + 38, 167, 295, 295, 173, 295, 295, 264, 295, 295, + 40, 20, 305, 295, 295, 295, 107, 295, 198, 29, + 38, 295, 198, 295, 38, 174, 295, 295, 41, 36, + 295, 295, 41, 36, 295, 244, 41, 36, 295, 295, + 295, 295, 295, 295, 319, 318, 315, 245, 319, 318, + 315, 245, 319, 318, 315, 245, 41, 36, 295, 295, + 41, 36, 295, 295, 295, 295, 295, 295, 295, 295, + 295, 295, 319, 318, 315, 245, 319, 318, 315, 245, + 198, 295, 295, 295, 295, 295, 295, 295, 295, 295, + 295, 295, 295, 295, 349, 295, 295, 295, 202, 295, + 295, 295, 295, 295, 295, 295, 295, 33, 295, 295, + 295, 295, 295, 13, 295, 295, 425, 295, 295, 295, + 295, 295, 295, 295, 295, 295, 295, 425, + ); + static public $yy_lookahead = array( + 3, 9, 10, 15, 71, 17, 28, 74, 11, 12, + 13, 14, 34, 16, 81, 18, 28, 20, 21, 22, + 11, 82, 34, 14, 27, 37, 93, 18, 31, 32, + 33, 45, 35, 66, 37, 68, 48, 28, 52, 42, + 43, 44, 45, 34, 47, 15, 49, 16, 51, 52, + 53, 54, 3, 23, 77, 25, 59, 17, 28, 19, + 11, 12, 13, 14, 34, 16, 36, 18, 38, 20, + 21, 22, 105, 106, 94, 45, 27, 73, 101, 73, + 31, 32, 33, 77, 35, 54, 37, 83, 48, 83, + 65, 42, 43, 44, 45, 14, 47, 16, 49, 18, + 51, 52, 3, 54, 36, 101, 38, 101, 59, 15, + 11, 12, 13, 14, 77, 16, 35, 18, 24, 20, + 21, 22, 28, 86, 87, 88, 27, 24, 34, 73, + 31, 32, 33, 77, 35, 54, 37, 36, 101, 83, + 46, 42, 43, 44, 45, 16, 47, 70, 49, 46, + 51, 52, 3, 54, 53, 81, 53, 101, 59, 15, + 11, 12, 13, 14, 23, 16, 37, 18, 24, 20, + 21, 22, 28, 99, 97, 98, 27, 36, 34, 82, + 31, 32, 33, 54, 35, 71, 37, 16, 74, 18, + 46, 42, 43, 44, 45, 81, 47, 45, 49, 77, + 51, 52, 3, 54, 90, 53, 18, 93, 59, 30, + 11, 12, 13, 14, 101, 16, 37, 18, 24, 20, + 21, 22, 51, 101, 102, 54, 27, 48, 1, 17, + 31, 32, 33, 24, 35, 14, 37, 16, 50, 18, + 46, 42, 43, 44, 45, 1, 47, 36, 49, 38, + 51, 52, 3, 54, 60, 46, 1, 45, 59, 15, + 11, 12, 13, 14, 52, 16, 8, 18, 10, 20, + 21, 22, 28, 97, 98, 54, 27, 36, 34, 38, + 31, 32, 33, 28, 35, 95, 37, 97, 98, 34, + 2, 42, 43, 44, 45, 1, 47, 71, 49, 102, + 51, 52, 3, 54, 78, 79, 73, 81, 59, 15, + 11, 12, 13, 14, 71, 16, 83, 18, 17, 20, + 21, 22, 28, 19, 81, 24, 27, 73, 34, 96, + 31, 32, 33, 17, 35, 19, 37, 83, 1, 2, + 17, 42, 43, 44, 45, 1, 47, 71, 49, 45, + 51, 52, 3, 54, 78, 101, 52, 81, 59, 15, + 11, 12, 13, 14, 48, 16, 45, 18, 45, 20, + 21, 22, 28, 52, 14, 16, 27, 18, 34, 37, + 31, 32, 33, 66, 35, 68, 37, 45, 64, 65, + 48, 42, 43, 44, 45, 53, 47, 37, 49, 71, + 51, 52, 3, 54, 73, 37, 78, 37, 59, 81, + 11, 12, 13, 14, 83, 16, 48, 18, 48, 20, + 21, 22, 11, 106, 37, 14, 27, 96, 1, 18, + 31, 32, 33, 1, 35, 48, 37, 73, 1, 73, + 16, 42, 43, 44, 45, 73, 47, 83, 49, 83, + 51, 52, 3, 54, 73, 83, 19, 30, 59, 77, + 11, 12, 13, 14, 83, 16, 70, 18, 28, 20, + 21, 22, 11, 94, 34, 14, 27, 82, 54, 18, + 31, 32, 33, 101, 35, 53, 37, 94, 45, 96, + 94, 42, 43, 44, 45, 66, 47, 68, 49, 92, + 51, 52, 3, 54, 19, 77, 99, 94, 59, 96, + 11, 12, 13, 14, 38, 16, 37, 18, 92, 20, + 21, 22, 62, 63, 18, 99, 27, 97, 98, 101, + 31, 32, 33, 48, 35, 16, 37, 25, 16, 51, + 18, 42, 43, 44, 45, 37, 47, 18, 49, 18, + 51, 41, 9, 54, 53, 53, 15, 18, 59, 66, + 67, 68, 69, 2, 71, 72, 18, 74, 75, 76, + 18, 49, 11, 51, 81, 14, 54, 84, 85, 18, + 19, 18, 89, 90, 91, 18, 93, 4, 5, 6, + 7, 8, 18, 35, 11, 12, 13, 14, 17, 15, + 18, 35, 81, 20, 21, 22, 45, 51, 19, 48, + 27, 50, 94, 52, 31, 32, 33, 66, 67, 68, + 69, 83, 71, 72, 80, 74, 75, 76, 95, 94, + 81, 94, 81, 107, 94, 84, 85, 107, 96, 94, + 89, 90, 91, 81, 93, 66, 107, 68, 98, 107, + 71, 107, 107, 74, 75, 76, 107, 107, 107, 107, + 81, 107, 107, 84, 85, 107, 107, 107, 89, 90, + 91, 66, 93, 68, 69, 107, 71, 72, 107, 74, + 75, 76, 103, 104, 107, 11, 81, 107, 14, 84, + 85, 107, 18, 107, 89, 90, 91, 107, 93, 107, + 5, 107, 107, 107, 107, 107, 11, 12, 13, 14, + 107, 16, 107, 107, 107, 20, 21, 22, 11, 107, + 107, 14, 27, 5, 50, 18, 31, 32, 33, 11, + 12, 13, 14, 107, 16, 28, 107, 30, 20, 21, + 22, 34, 107, 107, 107, 27, 107, 107, 107, 31, + 32, 33, 107, 107, 59, 60, 66, 107, 68, 107, + 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, + 107, 81, 107, 107, 84, 85, 107, 59, 60, 89, + 90, 91, 66, 93, 68, 107, 11, 71, 107, 14, + 74, 75, 76, 18, 104, 11, 107, 81, 14, 107, + 84, 85, 18, 107, 107, 89, 90, 91, 107, 93, + 107, 107, 66, 107, 68, 107, 100, 71, 107, 107, + 74, 75, 76, 107, 107, 50, 107, 81, 107, 107, + 84, 85, 107, 107, 50, 89, 90, 91, 107, 93, + 107, 107, 66, 107, 68, 107, 100, 71, 107, 107, + 74, 75, 76, 107, 107, 107, 107, 81, 107, 107, + 84, 85, 107, 107, 107, 89, 90, 91, 107, 93, + 107, 107, 66, 107, 68, 107, 100, 71, 107, 107, + 74, 75, 76, 107, 78, 107, 107, 81, 107, 107, + 84, 85, 107, 107, 107, 89, 90, 91, 66, 93, + 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, + 78, 107, 107, 81, 107, 107, 84, 85, 107, 107, + 107, 89, 90, 91, 66, 93, 68, 107, 107, 71, + 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, + 107, 107, 84, 85, 107, 107, 107, 89, 90, 91, + 107, 93, 107, 107, 66, 107, 68, 107, 107, 71, + 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, + 107, 107, 84, 85, 107, 107, 107, 89, 90, 91, + 66, 93, 68, 107, 107, 71, 107, 107, 74, 75, + 76, 107, 107, 107, 107, 81, 107, 107, 84, 85, + 107, 107, 107, 89, 90, 91, 66, 93, 68, 107, + 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, + 107, 81, 107, 107, 84, 85, 107, 107, 107, 89, + 90, 91, 107, 93, 107, 107, 66, 107, 68, 107, + 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, + 107, 81, 107, 107, 84, 85, 107, 107, 107, 89, + 90, 91, 66, 93, 68, 107, 107, 71, 107, 107, + 74, 75, 76, 107, 107, 107, 107, 81, 107, 107, + 84, 85, 107, 107, 107, 89, 90, 91, 66, 93, + 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, + 107, 107, 107, 81, 107, 107, 84, 85, 107, 107, + 107, 89, 90, 91, 107, 93, 107, 107, 66, 107, + 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, + 107, 107, 107, 81, 107, 107, 84, 85, 107, 107, + 107, 89, 90, 91, 66, 93, 68, 107, 107, 71, + 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, + 107, 107, 84, 85, 107, 107, 107, 89, 90, 91, + 66, 93, 68, 107, 107, 71, 107, 107, 74, 75, + 76, 107, 107, 107, 107, 81, 107, 107, 84, 85, + 107, 107, 107, 89, 90, 91, 107, 93, 107, 107, + 66, 107, 68, 107, 107, 71, 107, 107, 74, 75, + 76, 107, 107, 107, 107, 81, 107, 107, 84, 85, + 107, 107, 107, 89, 90, 91, 66, 93, 68, 107, + 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, + 107, 81, 107, 107, 84, 85, 107, 107, 107, 89, + 90, 91, 66, 93, 68, 107, 107, 71, 107, 107, + 74, 75, 76, 107, 107, 107, 107, 81, 107, 107, + 84, 85, 107, 107, 107, 89, 90, 91, 107, 93, + 107, 107, 66, 107, 68, 107, 107, 71, 107, 107, + 74, 75, 76, 107, 107, 107, 107, 81, 107, 107, + 84, 85, 107, 107, 107, 89, 90, 91, 66, 93, + 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, + 107, 107, 107, 81, 107, 107, 84, 85, 107, 107, + 107, 89, 90, 91, 66, 93, 68, 107, 107, 71, + 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, + 107, 107, 84, 85, 107, 107, 107, 89, 90, 91, + 107, 93, 107, 107, 66, 107, 68, 107, 107, 71, + 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, + 107, 107, 84, 85, 107, 107, 107, 89, 90, 91, + 66, 93, 68, 107, 107, 71, 107, 107, 74, 75, + 76, 107, 107, 107, 107, 81, 107, 107, 84, 85, + 107, 107, 107, 89, 90, 91, 66, 93, 68, 107, + 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, + 107, 81, 107, 107, 84, 85, 107, 107, 107, 89, + 90, 91, 107, 93, 107, 107, 66, 107, 68, 107, + 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, + 107, 81, 107, 107, 84, 85, 107, 107, 107, 89, + 90, 91, 66, 93, 68, 107, 107, 71, 107, 107, + 74, 75, 76, 107, 107, 107, 107, 81, 107, 107, + 84, 85, 107, 107, 107, 89, 90, 91, 66, 93, + 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, + 107, 107, 107, 81, 107, 107, 84, 85, 107, 107, + 107, 89, 90, 91, 107, 93, 107, 107, 66, 107, + 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, + 107, 107, 107, 81, 107, 107, 84, 85, 107, 107, + 107, 89, 90, 91, 66, 93, 68, 107, 107, 71, + 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, + 107, 107, 84, 85, 1, 2, 3, 89, 90, 91, + 66, 93, 68, 107, 107, 71, 107, 107, 74, 75, + 76, 107, 107, 107, 107, 81, 107, 107, 84, 85, + 107, 107, 107, 89, 90, 91, 107, 93, 107, 107, + 37, 107, 39, 40, 107, 107, 107, 107, 66, 107, + 68, 48, 1, 71, 3, 107, 74, 75, 55, 56, + 57, 58, 3, 81, 107, 107, 107, 85, 107, 107, + 107, 89, 90, 91, 107, 93, 107, 26, 66, 28, + 68, 107, 107, 71, 107, 34, 74, 75, 107, 107, + 39, 40, 1, 81, 3, 107, 107, 85, 39, 40, + 107, 89, 90, 91, 107, 93, 55, 56, 57, 58, + 107, 2, 107, 107, 55, 56, 57, 58, 107, 28, + 11, 107, 107, 14, 107, 34, 2, 18, 19, 107, + 39, 40, 107, 107, 107, 11, 107, 107, 14, 107, + 107, 17, 18, 19, 107, 107, 55, 56, 57, 58, + 107, 1, 107, 3, 45, 107, 107, 48, 66, 50, + 68, 52, 53, 71, 107, 15, 74, 75, 107, 45, + 107, 107, 48, 81, 50, 107, 52, 107, 1, 107, + 3, 89, 90, 91, 107, 93, 66, 107, 68, 39, + 40, 71, 107, 107, 74, 75, 107, 107, 107, 107, + 107, 81, 107, 107, 107, 55, 56, 57, 58, 89, + 90, 91, 2, 93, 107, 107, 39, 40, 107, 107, + 107, 11, 107, 107, 14, 107, 107, 17, 18, 19, + 107, 107, 55, 56, 57, 58, 107, 60, 107, 107, + 107, 66, 107, 68, 107, 107, 71, 107, 107, 74, + 75, 107, 107, 107, 107, 45, 81, 107, 48, 73, + 50, 107, 52, 77, 89, 90, 91, 107, 93, 83, + 107, 107, 86, 87, 88, 107, 107, 66, 107, 68, + 107, 1, 71, 3, 107, 74, 75, 101, 66, 107, + 68, 107, 81, 71, 107, 107, 74, 75, 107, 107, + 89, 90, 91, 81, 93, 107, 1, 107, 3, 107, + 107, 89, 90, 91, 107, 93, 66, 107, 68, 39, + 40, 71, 107, 107, 74, 75, 107, 107, 107, 107, + 107, 81, 107, 53, 29, 55, 56, 57, 58, 89, + 90, 91, 2, 93, 39, 40, 107, 107, 107, 107, + 107, 11, 107, 107, 14, 107, 107, 107, 18, 19, + 55, 56, 57, 58, 1, 107, 3, 107, 1, 107, + 3, 107, 1, 107, 3, 107, 107, 107, 15, 107, + 107, 107, 15, 107, 107, 45, 15, 107, 48, 107, + 50, 107, 52, 107, 107, 107, 107, 11, 107, 107, + 14, 107, 39, 40, 18, 19, 39, 40, 107, 107, + 39, 40, 1, 107, 3, 107, 107, 107, 55, 56, + 57, 58, 55, 56, 57, 58, 55, 56, 57, 58, + 107, 45, 107, 73, 48, 107, 50, 77, 52, 107, + 107, 107, 107, 83, 107, 107, 86, 87, 88, 38, + 39, 40, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 101, 107, 107, 107, 107, 55, 56, 57, 58, + 1, 107, 3, 107, 1, 107, 3, 73, 1, 107, + 3, 77, 107, 107, 15, 107, 107, 83, 107, 107, + 86, 87, 88, 107, 107, 107, 23, 107, 1, 2, + 3, 107, 1, 107, 3, 101, 107, 107, 39, 40, + 107, 107, 39, 40, 107, 38, 39, 40, 107, 107, + 107, 107, 107, 107, 55, 56, 57, 58, 55, 56, + 57, 58, 55, 56, 57, 58, 39, 40, 107, 107, + 39, 40, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 55, 56, 57, 58, 55, 56, 57, 58, + 1, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 15, 107, 107, 107, 19, 107, + 107, 107, 107, 107, 107, 107, 107, 28, 107, 107, + 107, 107, 107, 34, 107, 107, 37, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 48, + ); + static public $yy_shift_ofst = array( + -23, 399, 399, 349, 99, 449, 449, 99, 349, 99, + 99, -3, 99, 99, 249, 99, 99, 99, 99, 299, + 99, 149, 199, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 299, 99, 99, 49, 49, 499, 499, + 499, 499, 499, 499, 1621, 1661, 1661, 1981, 2067, 2039, + 2047, 2043, 1747, 1850, 1720, 1941, 1937, 1875, 1933, 2071, + 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, + 2071, 2071, 1629, 1629, 522, 695, 2129, 171, 255, 129, + 718, 707, 9, 255, 316, 255, 129, 129, 304, 337, + 583, 1780, 244, 784, 221, 344, 294, 411, 40, 411, + 485, 359, 440, -22, -22, 427, 432, 424, -22, 359, + 437, 589, 227, 227, 227, 589, 227, 227, 227, 227, + -23, -23, -23, -23, 1679, 1694, 561, 1910, 1956, 81, + 674, 212, 461, -22, -22, -22, -14, -14, -22, 360, + -22, -22, -22, -22, -14, 31, 321, -22, -22, 301, + 321, -14, -14, -14, 31, -22, -22, -22, -14, -14, + 589, 589, 227, 508, 589, 288, 227, 227, 288, 227, + 227, -23, -23, -23, -23, -23, -23, 1573, 30, -12, + 94, 144, 775, 342, 194, 103, 179, 258, 211, 141, + 152, 68, 241, 209, 323, 387, 370, 368, 188, -8, + 101, 556, 567, 563, 552, 539, 548, 574, 443, 558, + 566, 582, 581, 584, 541, 543, 512, 519, 506, 476, + 479, 488, 508, 502, 501, 531, 529, 510, + ); + static public $yy_reduce_ofst = array( + 460, 493, 551, 579, 605, 832, 806, 776, 690, 746, + 716, 1134, 1216, 1242, 1160, 1298, 1022, 1052, 1078, 1104, + 1268, 1488, 1514, 1432, 1462, 1324, 1350, 1406, 1380, 1186, + 888, 996, 970, 940, 914, 858, 1552, 1582, 1745, 1690, + 1781, 1820, 1792, 1662, 1974, 1930, 1756, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 114, -33, 6, -67, 56, 226, + 317, 233, 331, 254, 77, 4, 276, 328, 190, 122, + 429, 396, -23, 393, 74, -23, -23, 393, 176, 413, + 176, 407, 381, 366, 364, -23, -23, 243, 372, 426, + 428, 430, -23, -23, 382, 176, -23, -23, -23, -23, + -23, 324, -23, -23, 537, 537, 537, 537, 537, 549, + 542, 537, 537, 538, 538, 538, 533, 533, 538, 540, + 538, 538, 538, 538, 533, 521, 518, 538, 538, 544, + 535, 533, 533, 533, 562, 538, 538, 538, 533, 533, + 550, 550, 113, 545, 550, 197, 113, 113, 197, 113, + 113, 379, 395, -20, 97, -61, 25, + ); + static public $yyExpectedTokens = array( + array(), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 53, 54, + 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 54, 59,), + array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 54, 59,), + array(1, 3, 26, 28, 34, 39, 40, 55, 56, 57, 58,), + array(1, 3, 28, 34, 39, 40, 55, 56, 57, 58,), + array(1, 3, 28, 34, 39, 40, 55, 56, 57, 58,), + array(1, 3, 38, 39, 40, 55, 56, 57, 58,), + array(1, 2, 3, 39, 40, 55, 56, 57, 58,), + array(1, 3, 15, 39, 40, 55, 56, 57, 58,), + array(1, 3, 38, 39, 40, 55, 56, 57, 58,), + array(1, 3, 23, 39, 40, 55, 56, 57, 58,), + array(1, 3, 39, 40, 55, 56, 57, 58, 60,), + array(1, 3, 39, 40, 53, 55, 56, 57, 58,), + array(1, 3, 15, 39, 40, 55, 56, 57, 58,), + array(1, 3, 15, 39, 40, 55, 56, 57, 58,), + array(1, 3, 15, 39, 40, 55, 56, 57, 58,), + array(1, 3, 29, 39, 40, 55, 56, 57, 58,), + array(1, 3, 15, 39, 40, 55, 56, 57, 58,), + array(1, 3, 39, 40, 55, 56, 57, 58,), + array(1, 3, 39, 40, 55, 56, 57, 58,), + array(1, 3, 39, 40, 55, 56, 57, 58,), + array(1, 3, 39, 40, 55, 56, 57, 58,), + array(1, 3, 39, 40, 55, 56, 57, 58,), + array(1, 3, 39, 40, 55, 56, 57, 58,), + array(1, 3, 39, 40, 55, 56, 57, 58,), + array(1, 3, 39, 40, 55, 56, 57, 58,), + array(1, 3, 39, 40, 55, 56, 57, 58,), + array(1, 3, 39, 40, 55, 56, 57, 58,), + array(1, 3, 39, 40, 55, 56, 57, 58,), + array(1, 3, 39, 40, 55, 56, 57, 58,), + array(1, 3, 39, 40, 55, 56, 57, 58,), + array(3, 39, 40, 55, 56, 57, 58,), + array(3, 39, 40, 55, 56, 57, 58,), + array(16, 18, 49, 51, 54,), + array(5, 11, 12, 13, 14, 16, 20, 21, 22, 27, 31, 32, 33, 59, 60,), + array(1, 15, 19, 28, 34, 37, 48,), + array(16, 18, 51, 54,), + array(1, 28, 34,), + array(16, 37, 54,), + array(5, 11, 12, 13, 14, 16, 20, 21, 22, 27, 31, 32, 33, 59, 60,), + array(11, 14, 18, 28, 30, 34,), + array(11, 14, 18, 28, 34,), + array(1, 28, 34,), + array(17, 19, 48,), + array(1, 28, 34,), + array(16, 37, 54,), + array(16, 37, 54,), + array(19, 45, 52,), + array(1, 2,), + array(4, 5, 6, 7, 8, 11, 12, 13, 14, 20, 21, 22, 27, 31, 32, 33,), + array(2, 11, 14, 17, 18, 19, 45, 48, 50, 52,), + array(1, 15, 28, 34,), + array(11, 14, 18, 50,), + array(14, 16, 18, 54,), + array(1, 15, 28, 34,), + array(1, 15, 28, 34,), + array(11, 14, 18,), + array(17, 19, 48,), + array(11, 14, 18,), + array(19, 48,), + array(16, 18,), + array(28, 34,), + array(28, 34,), + array(28, 34,), + array(1, 30,), + array(1, 53,), + array(16, 54,), + array(28, 34,), + array(16, 18,), + array(1, 19,), + array(19,), + array(1,), + array(1,), + array(1,), + array(19,), + array(1,), + array(1,), + array(1,), + array(1,), + array(), + array(), + array(), + array(), + array(2, 11, 14, 18, 19, 45, 48, 50, 52, 53,), + array(2, 11, 14, 17, 18, 19, 45, 48, 50, 52,), + array(2, 11, 14, 18, 19, 45, 48, 50, 52,), + array(2, 11, 14, 18, 19, 45, 48, 50, 52,), + array(11, 14, 18, 19, 45, 48, 50, 52,), + array(14, 16, 18, 35, 54,), + array(11, 14, 18, 50,), + array(17, 45, 52,), + array(11, 14, 18,), + array(28, 34,), + array(28, 34,), + array(28, 34,), + array(45, 52,), + array(45, 52,), + array(28, 34,), + array(14, 37,), + array(28, 34,), + array(28, 34,), + array(28, 34,), + array(28, 34,), + array(45, 52,), + array(16, 54,), + array(45, 52,), + array(28, 34,), + array(28, 34,), + array(17, 24,), + array(45, 52,), + array(45, 52,), + array(45, 52,), + array(45, 52,), + array(16, 54,), + array(28, 34,), + array(28, 34,), + array(28, 34,), + array(45, 52,), + array(45, 52,), + array(19,), + array(19,), + array(1,), + array(37,), + array(19,), + array(2,), + array(1,), + array(1,), + array(2,), + array(1,), + array(1,), + array(), + array(), + array(), + array(), + array(), + array(), + array(1, 2, 3, 37, 39, 40, 48, 55, 56, 57, 58,), + array(15, 23, 25, 28, 34, 36, 38, 45,), + array(15, 17, 28, 34, 37, 48,), + array(15, 24, 28, 34, 46,), + array(15, 24, 28, 34, 46,), + array(11, 14, 18, 50,), + array(37, 45, 48, 53,), + array(24, 46, 60,), + array(24, 46, 53,), + array(30, 37, 48,), + array(8, 10,), + array(36, 38,), + array(23, 36,), + array(45, 53,), + array(36, 38,), + array(36, 38,), + array(24, 46,), + array(17, 45,), + array(37, 48,), + array(37, 48,), + array(37, 48,), + array(18, 50,), + array(9, 10,), + array(36, 53,), + array(51,), + array(18,), + array(18,), + array(18,), + array(18,), + array(18,), + array(18,), + array(45,), + array(35,), + array(35,), + array(18,), + array(17,), + array(15,), + array(15,), + array(9,), + array(25,), + array(16,), + array(18,), + array(38,), + array(37,), + array(51,), + array(37,), + array(53,), + array(53,), + array(18,), + array(18,), + array(41,), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + ); + static public $yy_default = array( + 334, 509, 509, 494, 509, 509, 509, 473, 509, 473, + 473, 509, 509, 509, 509, 509, 509, 509, 509, 509, + 509, 509, 509, 509, 509, 509, 509, 509, 509, 509, + 509, 509, 509, 509, 509, 509, 509, 509, 509, 509, + 509, 509, 509, 509, 375, 375, 354, 509, 509, 509, + 509, 509, 509, 509, 509, 509, 347, 380, 509, 497, + 386, 495, 496, 471, 347, 359, 380, 472, 377, 397, + 382, 387, 401, 402, 509, 509, 413, 509, 375, 509, + 509, 375, 375, 375, 428, 375, 509, 509, 485, 366, + 323, 427, 389, 438, 509, 389, 389, 438, 428, 438, + 428, 509, 375, 375, 375, 389, 389, 509, 356, 509, + 369, 482, 400, 406, 371, 428, 396, 405, 389, 392, + 480, 332, 404, 393, 427, 427, 427, 427, 427, 509, + 440, 454, 438, 348, 364, 344, 436, 463, 365, 438, + 352, 355, 361, 357, 464, 509, 433, 362, 358, 509, + 431, 434, 435, 466, 509, 363, 350, 351, 465, 432, + 486, 460, 367, 438, 483, 475, 372, 395, 474, 370, + 422, 438, 479, 438, 479, 479, 332, 413, 409, 413, + 403, 403, 439, 413, 403, 403, 413, 330, 509, 509, + 409, 509, 509, 403, 409, 423, 413, 509, 509, 509, + 509, 509, 509, 509, 509, 509, 509, 509, 409, 509, + 411, 509, 509, 509, 509, 509, 383, 509, 509, 509, + 484, 509, 454, 418, 509, 509, 509, 415, 376, 388, + 447, 481, 446, 454, 445, 448, 453, 360, 468, 469, + 384, 459, 444, 450, 415, 490, 476, 477, 407, 368, + 478, 456, 457, 458, 416, 417, 443, 390, 391, 442, + 441, 425, 426, 437, 374, 353, 329, 331, 333, 328, + 327, 324, 325, 326, 335, 336, 341, 343, 373, 340, + 339, 337, 338, 408, 410, 506, 498, 499, 505, 461, + 455, 470, 342, 500, 503, 491, 493, 492, 501, 508, + 502, 504, 507, 462, 430, 398, 399, 421, 420, 419, + 412, 414, 418, 424, 451, 489, 394, 429, 488, 487, + 449, 452, 467, + ); + public static $yyFallback = array(); + public $yyTraceFILE; + public $yyTracePrompt; +public $yyidx; +public $yyerrcnt; +public $yystack = array(); + public $yyTokenName = array( + '$', 'VERT', 'COLON', 'UNIMATH', + 'PHP', 'TEXT', 'STRIPON', 'STRIPOFF', + 'LITERALSTART', 'LITERALEND', 'LITERAL', 'SIMPELOUTPUT', + 'SIMPLETAG', 'SMARTYBLOCKCHILDPARENT', 'LDEL', 'RDEL', + 'DOLLARID', 'EQUAL', 'ID', 'PTR', + 'LDELMAKENOCACHE', 'LDELIF', 'LDELFOR', 'SEMICOLON', + 'INCDEC', 'TO', 'STEP', 'LDELFOREACH', + 'SPACE', 'AS', 'APTR', 'LDELSETFILTER', + 'CLOSETAG', 'LDELSLASH', 'ATTR', 'INTEGER', + 'COMMA', 'OPENP', 'CLOSEP', 'MATH', + 'ISIN', 'QMARK', 'NOT', 'TYPECAST', + 'HEX', 'DOT', 'INSTANCEOF', 'SINGLEQUOTESTRING', + 'DOUBLECOLON', 'NAMESPACE', 'AT', 'HATCH', + 'OPENB', 'CLOSEB', 'DOLLAR', 'LOGOP', + 'SLOGOP', 'TLOGOP', 'SINGLECOND', 'QUOTE', + 'BACKTICK', 'error', 'start', 'template', + 'literal_e2', 'literal_e1', 'smartytag', 'tagbody', + 'tag', 'outattr', 'eqoutattr', 'varindexed', + 'output', 'attributes', 'variable', 'value', + 'expr', 'modifierlist', 'statement', 'statements', + 'foraction', 'varvar', 'modparameters', 'attribute', + 'ternary', 'array', 'tlop', 'lop', + 'scond', 'function', 'ns1', 'doublequoted_with_quotes', + 'static_class_access', 'object', 'arrayindex', 'indexdef', + 'varvarele', 'objectchain', 'objectelement', 'method', + 'params', 'modifier', 'modparameter', 'arrayelements', + 'arrayelement', 'doublequoted', 'doublequotedcontent', + ); + public static $yyRuleName = array( + 'start ::= template', + 'template ::= template PHP', + 'template ::= template TEXT', + 'template ::= template STRIPON', + 'template ::= template STRIPOFF', + 'template ::= template LITERALSTART literal_e2 LITERALEND', + 'literal_e2 ::= literal_e1 LITERALSTART literal_e1 LITERALEND', + 'literal_e2 ::= literal_e1', + 'literal_e1 ::= literal_e1 LITERAL', + 'literal_e1 ::=', + 'template ::= template smartytag', + 'template ::=', + 'smartytag ::= SIMPELOUTPUT', + 'smartytag ::= SIMPLETAG', + 'smartytag ::= SMARTYBLOCKCHILDPARENT', + 'smartytag ::= LDEL tagbody RDEL', + 'smartytag ::= tag RDEL', + 'tagbody ::= outattr', + 'tagbody ::= DOLLARID eqoutattr', + 'tagbody ::= varindexed eqoutattr', + 'eqoutattr ::= EQUAL outattr', + 'outattr ::= output attributes', + 'output ::= variable', + 'output ::= value', + 'output ::= expr', + 'tag ::= LDEL ID attributes', + 'tag ::= LDEL ID', + 'tag ::= LDEL ID modifierlist attributes', + 'tag ::= LDEL ID PTR ID attributes', + 'tag ::= LDEL ID PTR ID modifierlist attributes', + 'tag ::= LDELMAKENOCACHE DOLLARID', + 'tag ::= LDELIF expr', + 'tag ::= LDELIF expr attributes', + 'tag ::= LDELIF statement', + 'tag ::= LDELIF statement attributes', + 'tag ::= LDELFOR statements SEMICOLON expr SEMICOLON varindexed foraction attributes', + 'foraction ::= EQUAL expr', + 'foraction ::= INCDEC', + 'tag ::= LDELFOR statement TO expr attributes', + 'tag ::= LDELFOR statement TO expr STEP expr attributes', + 'tag ::= LDELFOREACH SPACE expr AS varvar attributes', + 'tag ::= LDELFOREACH SPACE expr AS varvar APTR varvar attributes', + 'tag ::= LDELFOREACH attributes', + 'tag ::= LDELSETFILTER ID modparameters', + 'tag ::= LDELSETFILTER ID modparameters modifierlist', + 'smartytag ::= CLOSETAG', + 'tag ::= LDELSLASH ID', + 'tag ::= LDELSLASH ID modifierlist', + 'tag ::= LDELSLASH ID PTR ID', + 'tag ::= LDELSLASH ID PTR ID modifierlist', + 'attributes ::= attributes attribute', + 'attributes ::= attribute', + 'attributes ::=', + 'attribute ::= SPACE ID EQUAL ID', + 'attribute ::= ATTR expr', + 'attribute ::= ATTR value', + 'attribute ::= SPACE ID', + 'attribute ::= SPACE expr', + 'attribute ::= SPACE value', + 'attribute ::= SPACE INTEGER EQUAL expr', + 'statements ::= statement', + 'statements ::= statements COMMA statement', + 'statement ::= DOLLARID EQUAL INTEGER', + 'statement ::= DOLLARID EQUAL expr', + 'statement ::= varindexed EQUAL expr', + 'statement ::= OPENP statement CLOSEP', + 'expr ::= value', + 'expr ::= ternary', + 'expr ::= DOLLARID COLON ID', + 'expr ::= expr MATH value', + 'expr ::= expr UNIMATH value', + 'expr ::= array', + 'expr ::= expr modifierlist', + 'expr ::= expr tlop value', + 'expr ::= expr lop expr', + 'expr ::= expr scond', + 'expr ::= expr ISIN array', + 'expr ::= expr ISIN value', + 'ternary ::= OPENP expr CLOSEP QMARK DOLLARID COLON expr', + 'ternary ::= OPENP expr CLOSEP QMARK expr COLON expr', + 'value ::= variable', + 'value ::= UNIMATH value', + 'value ::= NOT value', + 'value ::= TYPECAST value', + 'value ::= variable INCDEC', + 'value ::= HEX', + 'value ::= INTEGER', + 'value ::= INTEGER DOT INTEGER', + 'value ::= INTEGER DOT', + 'value ::= DOT INTEGER', + 'value ::= ID', + 'value ::= function', + 'value ::= OPENP expr CLOSEP', + 'value ::= variable INSTANCEOF ns1', + 'value ::= variable INSTANCEOF variable', + 'value ::= SINGLEQUOTESTRING', + 'value ::= doublequoted_with_quotes', + 'value ::= varindexed DOUBLECOLON static_class_access', + 'value ::= smartytag', + 'value ::= value modifierlist', + 'value ::= NAMESPACE', + 'value ::= ns1 DOUBLECOLON static_class_access', + 'ns1 ::= ID', + 'ns1 ::= NAMESPACE', + 'variable ::= DOLLARID', + 'variable ::= varindexed', + 'variable ::= varvar AT ID', + 'variable ::= object', + 'variable ::= HATCH ID HATCH', + 'variable ::= HATCH ID HATCH arrayindex', + 'variable ::= HATCH variable HATCH', + 'variable ::= HATCH variable HATCH arrayindex', + 'varindexed ::= DOLLARID arrayindex', + 'varindexed ::= varvar arrayindex', + 'arrayindex ::= arrayindex indexdef', + 'arrayindex ::=', + 'indexdef ::= DOT DOLLARID', + 'indexdef ::= DOT varvar', + 'indexdef ::= DOT varvar AT ID', + 'indexdef ::= DOT ID', + 'indexdef ::= DOT INTEGER', + 'indexdef ::= DOT LDEL expr RDEL', + 'indexdef ::= OPENB ID CLOSEB', + 'indexdef ::= OPENB ID DOT ID CLOSEB', + 'indexdef ::= OPENB SINGLEQUOTESTRING CLOSEB', + 'indexdef ::= OPENB INTEGER CLOSEB', + 'indexdef ::= OPENB DOLLARID CLOSEB', + 'indexdef ::= OPENB variable CLOSEB', + 'indexdef ::= OPENB value CLOSEB', + 'indexdef ::= OPENB expr CLOSEB', + 'indexdef ::= OPENB CLOSEB', + 'varvar ::= DOLLARID', + 'varvar ::= DOLLAR', + 'varvar ::= varvar varvarele', + 'varvarele ::= ID', + 'varvarele ::= SIMPELOUTPUT', + 'varvarele ::= LDEL expr RDEL', + 'object ::= varindexed objectchain', + 'objectchain ::= objectelement', + 'objectchain ::= objectchain objectelement', + 'objectelement ::= PTR ID arrayindex', + 'objectelement ::= PTR varvar arrayindex', + 'objectelement ::= PTR LDEL expr RDEL arrayindex', + 'objectelement ::= PTR ID LDEL expr RDEL arrayindex', + 'objectelement ::= PTR method', + 'function ::= ns1 OPENP params CLOSEP', + 'method ::= ID OPENP params CLOSEP', + 'method ::= DOLLARID OPENP params CLOSEP', + 'params ::= params COMMA expr', + 'params ::= expr', + 'params ::=', + 'modifierlist ::= modifierlist modifier modparameters', + 'modifierlist ::= modifier modparameters', + 'modifier ::= VERT AT ID', + 'modifier ::= VERT ID', + 'modparameters ::= modparameters modparameter', + 'modparameters ::=', + 'modparameter ::= COLON value', + 'modparameter ::= COLON array', + 'static_class_access ::= method', + 'static_class_access ::= method objectchain', + 'static_class_access ::= ID', + 'static_class_access ::= DOLLARID arrayindex', + 'static_class_access ::= DOLLARID arrayindex objectchain', + 'lop ::= LOGOP', + 'lop ::= SLOGOP', + 'tlop ::= TLOGOP', + 'scond ::= SINGLECOND', + 'array ::= OPENB arrayelements CLOSEB', + 'arrayelements ::= arrayelement', + 'arrayelements ::= arrayelements COMMA arrayelement', + 'arrayelements ::=', + 'arrayelement ::= value APTR expr', + 'arrayelement ::= ID APTR expr', + 'arrayelement ::= expr', + 'doublequoted_with_quotes ::= QUOTE QUOTE', + 'doublequoted_with_quotes ::= QUOTE doublequoted QUOTE', + 'doublequoted ::= doublequoted doublequotedcontent', + 'doublequoted ::= doublequotedcontent', + 'doublequotedcontent ::= BACKTICK variable BACKTICK', + 'doublequotedcontent ::= BACKTICK expr BACKTICK', + 'doublequotedcontent ::= DOLLARID', + 'doublequotedcontent ::= LDEL variable RDEL', + 'doublequotedcontent ::= LDEL expr RDEL', + 'doublequotedcontent ::= smartytag', + 'doublequotedcontent ::= TEXT', + ); + public static $yyRuleInfo = array( + array(0 => 62, 1 => 1), + array(0 => 63, 1 => 2), + array(0 => 63, 1 => 2), + array(0 => 63, 1 => 2), + array(0 => 63, 1 => 2), + array(0 => 63, 1 => 4), + array(0 => 64, 1 => 4), + array(0 => 64, 1 => 1), + array(0 => 65, 1 => 2), + array(0 => 65, 1 => 0), + array(0 => 63, 1 => 2), + array(0 => 63, 1 => 0), + array(0 => 66, 1 => 1), + array(0 => 66, 1 => 1), + array(0 => 66, 1 => 1), + array(0 => 66, 1 => 3), + array(0 => 66, 1 => 2), + array(0 => 67, 1 => 1), + array(0 => 67, 1 => 2), + array(0 => 67, 1 => 2), + array(0 => 70, 1 => 2), + array(0 => 69, 1 => 2), + array(0 => 72, 1 => 1), + array(0 => 72, 1 => 1), + array(0 => 72, 1 => 1), + array(0 => 68, 1 => 3), + array(0 => 68, 1 => 2), + array(0 => 68, 1 => 4), + array(0 => 68, 1 => 5), + array(0 => 68, 1 => 6), + array(0 => 68, 1 => 2), + array(0 => 68, 1 => 2), + array(0 => 68, 1 => 3), + array(0 => 68, 1 => 2), + array(0 => 68, 1 => 3), + array(0 => 68, 1 => 8), + array(0 => 80, 1 => 2), + array(0 => 80, 1 => 1), + array(0 => 68, 1 => 5), + array(0 => 68, 1 => 7), + array(0 => 68, 1 => 6), + array(0 => 68, 1 => 8), + array(0 => 68, 1 => 2), + array(0 => 68, 1 => 3), + array(0 => 68, 1 => 4), + array(0 => 66, 1 => 1), + array(0 => 68, 1 => 2), + array(0 => 68, 1 => 3), + array(0 => 68, 1 => 4), + array(0 => 68, 1 => 5), + array(0 => 73, 1 => 2), + array(0 => 73, 1 => 1), + array(0 => 73, 1 => 0), + array(0 => 83, 1 => 4), + array(0 => 83, 1 => 2), + array(0 => 83, 1 => 2), + array(0 => 83, 1 => 2), + array(0 => 83, 1 => 2), + array(0 => 83, 1 => 2), + array(0 => 83, 1 => 4), + array(0 => 79, 1 => 1), + array(0 => 79, 1 => 3), + array(0 => 78, 1 => 3), + array(0 => 78, 1 => 3), + array(0 => 78, 1 => 3), + array(0 => 78, 1 => 3), + array(0 => 76, 1 => 1), + array(0 => 76, 1 => 1), + array(0 => 76, 1 => 3), + array(0 => 76, 1 => 3), + array(0 => 76, 1 => 3), + array(0 => 76, 1 => 1), + array(0 => 76, 1 => 2), + array(0 => 76, 1 => 3), + array(0 => 76, 1 => 3), + array(0 => 76, 1 => 2), + array(0 => 76, 1 => 3), + array(0 => 76, 1 => 3), + array(0 => 84, 1 => 7), + array(0 => 84, 1 => 7), + array(0 => 75, 1 => 1), + array(0 => 75, 1 => 2), + array(0 => 75, 1 => 2), + array(0 => 75, 1 => 2), + array(0 => 75, 1 => 2), + array(0 => 75, 1 => 1), + array(0 => 75, 1 => 1), + array(0 => 75, 1 => 3), + array(0 => 75, 1 => 2), + array(0 => 75, 1 => 2), + array(0 => 75, 1 => 1), + array(0 => 75, 1 => 1), + array(0 => 75, 1 => 3), + array(0 => 75, 1 => 3), + array(0 => 75, 1 => 3), + array(0 => 75, 1 => 1), + array(0 => 75, 1 => 1), + array(0 => 75, 1 => 3), + array(0 => 75, 1 => 1), + array(0 => 75, 1 => 2), + array(0 => 75, 1 => 1), + array(0 => 75, 1 => 3), + array(0 => 90, 1 => 1), + array(0 => 90, 1 => 1), + array(0 => 74, 1 => 1), + array(0 => 74, 1 => 1), + array(0 => 74, 1 => 3), + array(0 => 74, 1 => 1), + array(0 => 74, 1 => 3), + array(0 => 74, 1 => 4), + array(0 => 74, 1 => 3), + array(0 => 74, 1 => 4), + array(0 => 71, 1 => 2), + array(0 => 71, 1 => 2), + array(0 => 94, 1 => 2), + array(0 => 94, 1 => 0), + array(0 => 95, 1 => 2), + array(0 => 95, 1 => 2), + array(0 => 95, 1 => 4), + array(0 => 95, 1 => 2), + array(0 => 95, 1 => 2), + array(0 => 95, 1 => 4), + array(0 => 95, 1 => 3), + array(0 => 95, 1 => 5), + array(0 => 95, 1 => 3), + array(0 => 95, 1 => 3), + array(0 => 95, 1 => 3), + array(0 => 95, 1 => 3), + array(0 => 95, 1 => 3), + array(0 => 95, 1 => 3), + array(0 => 95, 1 => 2), + array(0 => 81, 1 => 1), + array(0 => 81, 1 => 1), + array(0 => 81, 1 => 2), + array(0 => 96, 1 => 1), + array(0 => 96, 1 => 1), + array(0 => 96, 1 => 3), + array(0 => 93, 1 => 2), + array(0 => 97, 1 => 1), + array(0 => 97, 1 => 2), + array(0 => 98, 1 => 3), + array(0 => 98, 1 => 3), + array(0 => 98, 1 => 5), + array(0 => 98, 1 => 6), + array(0 => 98, 1 => 2), + array(0 => 89, 1 => 4), + array(0 => 99, 1 => 4), + array(0 => 99, 1 => 4), + array(0 => 100, 1 => 3), + array(0 => 100, 1 => 1), + array(0 => 100, 1 => 0), + array(0 => 77, 1 => 3), + array(0 => 77, 1 => 2), + array(0 => 101, 1 => 3), + array(0 => 101, 1 => 2), + array(0 => 82, 1 => 2), + array(0 => 82, 1 => 0), + array(0 => 102, 1 => 2), + array(0 => 102, 1 => 2), + array(0 => 92, 1 => 1), + array(0 => 92, 1 => 2), + array(0 => 92, 1 => 1), + array(0 => 92, 1 => 2), + array(0 => 92, 1 => 3), + array(0 => 87, 1 => 1), + array(0 => 87, 1 => 1), + array(0 => 86, 1 => 1), + array(0 => 88, 1 => 1), + array(0 => 85, 1 => 3), + array(0 => 103, 1 => 1), + array(0 => 103, 1 => 3), + array(0 => 103, 1 => 0), + array(0 => 104, 1 => 3), + array(0 => 104, 1 => 3), + array(0 => 104, 1 => 1), + array(0 => 91, 1 => 2), + array(0 => 91, 1 => 3), + array(0 => 105, 1 => 2), + array(0 => 105, 1 => 1), + array(0 => 106, 1 => 3), + array(0 => 106, 1 => 3), + array(0 => 106, 1 => 1), + array(0 => 106, 1 => 3), + array(0 => 106, 1 => 3), + array(0 => 106, 1 => 1), + array(0 => 106, 1 => 1), + ); + public static $yyReduceMap = array( + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + 6 => 6, + 7 => 7, + 22 => 7, + 23 => 7, + 24 => 7, + 37 => 7, + 57 => 7, + 58 => 7, + 66 => 7, + 67 => 7, + 71 => 7, + 80 => 7, + 85 => 7, + 86 => 7, + 91 => 7, + 95 => 7, + 96 => 7, + 100 => 7, + 102 => 7, + 107 => 7, + 169 => 7, + 174 => 7, + 8 => 8, + 9 => 9, + 10 => 10, + 12 => 12, + 13 => 13, + 14 => 14, + 15 => 15, + 16 => 16, + 17 => 17, + 18 => 18, + 19 => 19, + 20 => 20, + 21 => 21, + 25 => 25, + 26 => 26, + 27 => 27, + 28 => 28, + 29 => 29, + 30 => 30, + 31 => 31, + 32 => 32, + 34 => 32, + 33 => 33, + 35 => 35, + 36 => 36, + 38 => 38, + 39 => 39, + 40 => 40, + 41 => 41, + 42 => 42, + 43 => 43, + 44 => 44, + 45 => 45, + 46 => 46, + 47 => 47, + 48 => 48, + 49 => 49, + 50 => 50, + 51 => 51, + 60 => 51, + 149 => 51, + 153 => 51, + 157 => 51, + 158 => 51, + 52 => 52, + 150 => 52, + 156 => 52, + 53 => 53, + 54 => 54, + 55 => 54, + 56 => 56, + 134 => 56, + 59 => 59, + 61 => 61, + 62 => 62, + 63 => 62, + 64 => 64, + 65 => 65, + 68 => 68, + 69 => 69, + 70 => 69, + 72 => 72, + 99 => 72, + 73 => 73, + 74 => 74, + 75 => 75, + 76 => 76, + 77 => 77, + 78 => 78, + 79 => 79, + 81 => 81, + 83 => 81, + 84 => 81, + 114 => 81, + 82 => 82, + 87 => 87, + 88 => 88, + 89 => 89, + 90 => 90, + 92 => 92, + 93 => 93, + 94 => 93, + 97 => 97, + 98 => 98, + 101 => 101, + 103 => 103, + 104 => 104, + 105 => 105, + 106 => 106, + 108 => 108, + 109 => 109, + 110 => 110, + 111 => 111, + 112 => 112, + 113 => 113, + 115 => 115, + 171 => 115, + 116 => 116, + 117 => 117, + 118 => 118, + 119 => 119, + 120 => 120, + 121 => 121, + 129 => 121, + 122 => 122, + 123 => 123, + 124 => 124, + 125 => 124, + 127 => 124, + 128 => 124, + 126 => 126, + 130 => 130, + 131 => 131, + 132 => 132, + 175 => 132, + 133 => 133, + 135 => 135, + 136 => 136, + 137 => 137, + 138 => 138, + 139 => 139, + 140 => 140, + 141 => 141, + 142 => 142, + 143 => 143, + 144 => 144, + 145 => 145, + 146 => 146, + 147 => 147, + 148 => 148, + 151 => 151, + 152 => 152, + 154 => 154, + 155 => 155, + 159 => 159, + 160 => 160, + 161 => 161, + 162 => 162, + 163 => 163, + 164 => 164, + 165 => 165, + 166 => 166, + 167 => 167, + 168 => 168, + 170 => 170, + 172 => 172, + 173 => 173, + 176 => 176, + 177 => 177, + 178 => 178, + 179 => 179, + 182 => 179, + 180 => 180, + 183 => 180, + 181 => 181, + 184 => 184, + 185 => 185, + ); /* Index of top element in stack */ + private $_retvalue; /* Shifts left before out of the error */ /** * constructor @@ -227,7 +1661,7 @@ class Smarty_Internal_Templateparser $this->smarty = $this->template->smarty; $this->security = isset($this->smarty->security_policy) ? $this->smarty->security_policy : false; $this->current_buffer = $this->root_buffer = new Smarty_Internal_ParseTree_Template(); - } + } /* The parser's stack */ /** * insert PHP code in current buffer @@ -240,6 +1674,20 @@ class Smarty_Internal_Templateparser } /** + * error rundown + * + */ + public function errorRunDown() + { + while ($this->yystack !== array()) { + $this->yy_pop_parser_stack(); + } + if (is_resource($this->yyTraceFILE)) { + fclose($this->yyTraceFILE); + } + } + + /** * merge PHP code with prefix code and return parse tree tag object * * @param string $code @@ -257,637 +1705,11 @@ class Smarty_Internal_Templateparser return new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp, true)); } - const TP_VERT = 1; - - const TP_COLON = 2; - - const TP_PHP = 3; - - const TP_TEXT = 4; - - const TP_STRIPON = 5; - - const TP_STRIPOFF = 6; - - const TP_LITERALSTART = 7; - - const TP_LITERALEND = 8; - - const TP_LITERAL = 9; - - const TP_RDEL = 10; - - const TP_SIMPELOUTPUT = 11; - - const TP_LDEL = 12; - - const TP_DOLLARID = 13; - - const TP_EQUAL = 14; - - const TP_SIMPLETAG = 15; - - const TP_ID = 16; - - const TP_PTR = 17; - - const TP_LDELMAKENOCACHE = 18; - - const TP_LDELIF = 19; - - const TP_LDELFOR = 20; - - const TP_SEMICOLON = 21; - - const TP_INCDEC = 22; - - const TP_TO = 23; - - const TP_STEP = 24; - - const TP_LDELFOREACH = 25; - - const TP_SPACE = 26; - - const TP_AS = 27; - - const TP_APTR = 28; - - const TP_LDELSETFILTER = 29; - - const TP_SMARTYBLOCKCHILDPARENT = 30; - - const TP_CLOSETAG = 31; - - const TP_LDELSLASH = 32; - - const TP_ATTR = 33; - - const TP_INTEGER = 34; - - const TP_COMMA = 35; - - const TP_OPENP = 36; - - const TP_CLOSEP = 37; - - const TP_MATH = 38; - - const TP_UNIMATH = 39; - - const TP_ISIN = 40; - - const TP_QMARK = 41; - - const TP_NOT = 42; - - const TP_TYPECAST = 43; - - const TP_HEX = 44; - - const TP_DOT = 45; - - const TP_INSTANCEOF = 46; - - const TP_SINGLEQUOTESTRING = 47; - - const TP_DOUBLECOLON = 48; - - const TP_NAMESPACE = 49; - - const TP_AT = 50; - - const TP_HATCH = 51; - - const TP_OPENB = 52; - - const TP_CLOSEB = 53; - - const TP_DOLLAR = 54; - - const TP_LOGOP = 55; - - const TP_SLOGOP = 56; - - const TP_TLOGOP = 57; - - const TP_SINGLECOND = 58; - - const TP_QUOTE = 59; - - const TP_BACKTICK = 60; - - const YY_NO_ACTION = 532; - - const YY_ACCEPT_ACTION = 531; - - const YY_ERROR_ACTION = 530; - - const YY_SZ_ACTTAB = 2114; - - static public $yy_action = array(268, 8, 132, 210, 245, 197, 183, 228, 7, 84, 176, 264, 275, 302, 112, 44, 36, 278, - 233, 136, 305, 221, 281, 203, 237, 26, 234, 202, 41, 104, 189, 39, 42, 256, 213, - 216, 224, 78, 207, 129, 82, 1, 316, 297, 102, 268, 8, 133, 79, 245, 80, 302, 228, - 7, 84, 330, 299, 82, 272, 112, 297, 273, 325, 233, 285, 305, 221, 214, 231, 34, 26, - 3, 101, 41, 230, 78, 39, 42, 256, 213, 35, 239, 314, 207, 300, 82, 1, 13, 297, 333, - 268, 8, 135, 79, 245, 201, 302, 228, 7, 84, 35, 85, 322, 109, 112, 29, 196, 13, - 233, 269, 305, 221, 237, 231, 249, 26, 136, 104, 41, 219, 78, 39, 42, 256, 213, - 459, 239, 267, 207, 355, 82, 1, 459, 297, 446, 268, 8, 135, 79, 245, 193, 302, 228, - 7, 84, 35, 446, 297, 28, 112, 247, 263, 13, 233, 82, 305, 221, 297, 231, 309, 26, - 185, 292, 41, 298, 78, 39, 42, 256, 213, 27, 239, 237, 207, 232, 82, 1, 104, 297, - 459, 268, 8, 135, 79, 245, 195, 459, 228, 7, 84, 446, 297, 283, 11, 112, 25, 188, - 282, 233, 236, 305, 221, 446, 204, 294, 26, 32, 318, 41, 90, 210, 39, 42, 256, 213, - 174, 239, 137, 207, 402, 82, 1, 210, 297, 9, 268, 8, 136, 79, 245, 201, 223, 228, - 7, 84, 402, 142, 235, 225, 112, 22, 227, 402, 233, 166, 305, 221, 35, 231, 27, 33, - 210, 101, 41, 13, 210, 39, 42, 256, 213, 361, 239, 302, 207, 399, 82, 1, 210, 297, - 101, 268, 8, 135, 79, 245, 201, 402, 228, 7, 84, 399, 235, 297, 109, 112, 447, 78, - 399, 233, 319, 305, 221, 402, 194, 172, 26, 279, 447, 41, 402, 307, 39, 42, 256, - 213, 182, 239, 16, 207, 296, 82, 1, 210, 297, 101, 268, 8, 131, 79, 245, 201, 357, - 228, 7, 84, 283, 11, 475, 475, 112, 282, 303, 475, 233, 24, 305, 221, 35, 231, 175, - 4, 279, 271, 41, 13, 109, 39, 42, 256, 213, 181, 239, 178, 207, 12, 82, 1, 16, 297, - 274, 268, 8, 135, 79, 245, 200, 475, 228, 7, 84, 475, 475, 283, 11, 112, 475, 189, - 282, 233, 210, 305, 221, 20, 231, 38, 26, 179, 292, 41, 148, 446, 39, 42, 256, 213, - 229, 239, 180, 207, 332, 82, 1, 446, 297, 190, 268, 8, 134, 79, 245, 201, 215, 228, - 7, 84, 168, 16, 188, 243, 112, 104, 189, 303, 233, 140, 305, 221, 325, 231, 255, - 26, 177, 214, 41, 218, 312, 39, 42, 256, 213, 277, 239, 128, 207, 101, 82, 1, 92, - 297, 2, 268, 8, 136, 79, 245, 201, 23, 228, 7, 84, 210, 108, 251, 184, 112, 297, - 304, 289, 233, 367, 305, 221, 137, 231, 315, 33, 220, 5, 41, 9, 5, 39, 42, 256, - 213, 35, 239, 189, 207, 113, 82, 311, 13, 297, 106, 446, 214, 212, 79, 116, 72, - 114, 258, 260, 261, 222, 102, 446, 214, 257, 280, 187, 308, 334, 270, 206, 242, - 152, 299, 210, 128, 83, 262, 250, 252, 253, 176, 332, 211, 329, 268, 8, 151, 143, - 245, 189, 178, 228, 7, 84, 210, 265, 332, 332, 112, 188, 21, 311, 233, 153, 305, - 221, 214, 212, 17, 122, 67, 114, 164, 141, 189, 13, 102, 149, 266, 257, 280, 183, - 332, 332, 270, 206, 242, 332, 299, 295, 44, 36, 278, 235, 311, 208, 279, 145, 169, - 214, 212, 91, 122, 67, 114, 189, 320, 332, 167, 102, 146, 139, 257, 280, 94, 171, - 159, 270, 206, 242, 332, 299, 210, 38, 311, 189, 332, 155, 209, 214, 212, 317, 122, - 53, 107, 123, 232, 332, 189, 102, 291, 400, 257, 280, 6, 217, 276, 270, 206, 242, - 311, 299, 297, 158, 313, 214, 212, 400, 122, 49, 107, 154, 117, 332, 400, 102, 30, - 446, 257, 280, 248, 332, 173, 270, 206, 242, 279, 299, 324, 446, 186, 292, 332, 95, - 279, 268, 10, 326, 170, 245, 88, 87, 228, 7, 84, 279, 138, 89, 279, 112, 86, 309, - 311, 233, 115, 305, 221, 214, 212, 254, 122, 67, 114, 105, 303, 163, 165, 102, 303, - 93, 257, 280, 303, 303, 303, 270, 206, 242, 303, 299, 303, 303, 303, 286, 19, 311, - 205, 303, 303, 303, 214, 212, 303, 116, 72, 114, 303, 43, 40, 37, 102, 303, 303, - 257, 280, 303, 303, 303, 270, 206, 242, 303, 299, 324, 327, 323, 288, 287, 303, - 303, 268, 10, 326, 331, 245, 303, 303, 228, 7, 84, 303, 303, 303, 303, 112, 303, - 303, 311, 233, 303, 305, 221, 214, 212, 303, 122, 70, 114, 303, 303, 303, 303, 102, - 303, 303, 257, 280, 303, 283, 11, 270, 206, 242, 282, 299, 303, 311, 303, 290, 19, - 303, 214, 212, 35, 122, 54, 114, 303, 303, 303, 13, 102, 162, 303, 257, 280, 183, - 303, 303, 270, 206, 242, 332, 299, 311, 44, 36, 278, 303, 214, 212, 303, 122, 68, - 114, 303, 303, 303, 303, 102, 189, 303, 257, 280, 303, 303, 303, 270, 206, 242, - 303, 299, 311, 303, 303, 303, 303, 214, 212, 303, 100, 73, 114, 303, 303, 303, 303, - 102, 303, 303, 257, 280, 303, 303, 303, 270, 206, 242, 303, 299, 311, 303, 303, - 303, 303, 214, 212, 303, 122, 77, 114, 303, 303, 303, 303, 102, 147, 303, 257, 280, - 183, 303, 303, 270, 206, 242, 332, 299, 311, 44, 36, 278, 303, 214, 212, 303, 122, - 76, 114, 303, 303, 303, 303, 102, 189, 303, 257, 280, 303, 303, 303, 270, 206, 242, - 303, 299, 311, 303, 303, 303, 303, 214, 212, 303, 99, 71, 114, 303, 303, 303, 303, - 102, 161, 303, 257, 280, 183, 303, 303, 270, 206, 242, 332, 299, 311, 44, 36, 278, - 303, 214, 212, 303, 122, 47, 114, 303, 303, 303, 303, 102, 189, 303, 257, 280, 303, - 303, 303, 270, 206, 242, 303, 299, 311, 303, 303, 303, 303, 214, 212, 303, 122, 59, - 114, 303, 303, 303, 303, 102, 150, 303, 257, 280, 183, 303, 303, 270, 206, 242, - 332, 299, 311, 44, 36, 278, 303, 214, 198, 303, 118, 55, 114, 303, 303, 303, 303, - 102, 189, 303, 257, 280, 303, 303, 303, 270, 206, 242, 303, 299, 311, 303, 303, - 303, 303, 214, 212, 303, 122, 69, 114, 303, 303, 303, 303, 102, 160, 303, 257, 280, - 183, 303, 303, 270, 206, 242, 332, 299, 311, 44, 36, 278, 303, 214, 97, 303, 81, - 48, 103, 303, 303, 303, 303, 102, 189, 303, 257, 280, 303, 303, 303, 270, 206, 242, - 303, 299, 311, 303, 303, 303, 303, 214, 212, 303, 122, 57, 114, 303, 303, 303, 303, - 102, 303, 303, 257, 280, 303, 303, 303, 270, 206, 242, 303, 299, 311, 303, 303, - 303, 303, 214, 212, 303, 122, 65, 114, 303, 303, 303, 303, 102, 303, 303, 257, 280, - 303, 303, 303, 270, 206, 242, 303, 299, 311, 303, 303, 303, 303, 214, 96, 303, 81, - 46, 103, 303, 303, 303, 303, 102, 303, 303, 257, 280, 303, 303, 303, 270, 206, 242, - 303, 299, 311, 303, 303, 303, 303, 214, 212, 303, 111, 50, 114, 303, 303, 303, 303, - 102, 303, 303, 257, 280, 303, 303, 303, 270, 206, 242, 303, 299, 311, 303, 303, - 303, 303, 214, 212, 303, 98, 61, 114, 303, 303, 303, 303, 102, 303, 303, 257, 280, - 303, 303, 303, 270, 206, 242, 303, 299, 311, 303, 303, 303, 303, 214, 199, 303, - 122, 56, 114, 303, 303, 303, 303, 102, 303, 303, 257, 280, 303, 303, 303, 270, 206, - 242, 303, 299, 311, 303, 303, 303, 303, 214, 212, 303, 122, 51, 114, 303, 303, 303, - 303, 102, 303, 303, 257, 280, 303, 303, 303, 270, 206, 242, 303, 299, 311, 303, - 303, 303, 303, 214, 212, 303, 122, 58, 114, 303, 303, 303, 303, 102, 303, 303, 257, - 280, 303, 303, 303, 270, 206, 242, 303, 299, 311, 303, 303, 303, 303, 214, 212, - 303, 122, 74, 114, 303, 303, 303, 303, 102, 303, 303, 257, 280, 303, 303, 303, 270, - 206, 242, 303, 299, 311, 303, 303, 303, 303, 214, 212, 303, 122, 62, 114, 303, 303, - 303, 303, 102, 303, 303, 257, 280, 303, 303, 303, 270, 206, 242, 303, 299, 311, - 303, 303, 303, 303, 214, 212, 303, 122, 60, 114, 303, 303, 303, 303, 102, 303, 303, - 257, 280, 303, 303, 303, 270, 206, 242, 303, 299, 311, 303, 303, 303, 303, 214, - 212, 303, 122, 45, 114, 303, 303, 303, 303, 102, 303, 303, 257, 280, 303, 303, 303, - 270, 206, 242, 303, 299, 311, 303, 303, 303, 303, 214, 212, 303, 122, 64, 114, 303, - 303, 303, 303, 102, 303, 303, 257, 280, 303, 303, 303, 270, 206, 242, 303, 299, - 311, 303, 303, 303, 303, 214, 212, 303, 122, 75, 114, 303, 303, 303, 303, 102, 303, - 303, 257, 280, 303, 303, 303, 270, 206, 242, 303, 299, 311, 303, 303, 303, 303, - 214, 212, 303, 122, 63, 114, 303, 303, 303, 303, 102, 303, 303, 257, 280, 303, 303, - 303, 270, 206, 242, 303, 299, 311, 303, 303, 303, 303, 214, 212, 303, 122, 66, 114, - 303, 303, 303, 303, 102, 303, 303, 257, 280, 303, 412, 412, 270, 206, 242, 303, - 299, 311, 303, 303, 303, 303, 214, 212, 303, 122, 53, 114, 303, 303, 303, 303, 102, - 303, 303, 257, 280, 210, 303, 303, 270, 206, 242, 303, 299, 446, 301, 412, 412, - 412, 303, 531, 52, 259, 260, 261, 222, 446, 303, 214, 303, 303, 35, 303, 412, 412, - 412, 412, 303, 13, 303, 303, 303, 303, 43, 40, 37, 210, 303, 303, 311, 303, 303, - 303, 303, 214, 212, 210, 130, 303, 114, 327, 323, 288, 287, 102, 303, 303, 303, - 241, 31, 303, 35, 270, 206, 242, 303, 299, 303, 13, 303, 303, 35, 303, 43, 40, 37, - 303, 303, 13, 303, 303, 303, 303, 43, 40, 37, 303, 303, 303, 311, 327, 323, 288, - 287, 214, 212, 210, 124, 303, 114, 327, 323, 288, 287, 102, 192, 303, 303, 310, - 303, 303, 303, 270, 206, 242, 311, 299, 226, 303, 303, 214, 212, 303, 120, 303, - 114, 475, 475, 303, 28, 102, 475, 459, 43, 40, 37, 303, 303, 270, 206, 242, 303, - 299, 303, 303, 303, 303, 303, 303, 311, 327, 323, 288, 287, 214, 212, 303, 126, - 303, 114, 459, 303, 303, 459, 102, 475, 303, 459, 226, 303, 303, 303, 270, 206, - 242, 303, 299, 475, 475, 226, 18, 303, 475, 459, 303, 303, 303, 303, 475, 475, 303, - 303, 226, 475, 459, 283, 11, 303, 303, 303, 282, 475, 475, 303, 303, 303, 475, 459, - 303, 303, 35, 459, 144, 303, 459, 303, 475, 13, 459, 303, 303, 303, 459, 303, 303, - 459, 311, 475, 303, 459, 321, 214, 212, 303, 119, 459, 114, 303, 459, 303, 475, - 102, 459, 303, 303, 303, 303, 303, 303, 270, 206, 242, 303, 299, 311, 210, 14, 303, - 303, 214, 212, 303, 127, 303, 114, 303, 284, 303, 303, 102, 129, 303, 303, 303, - 303, 102, 303, 270, 206, 242, 311, 299, 210, 303, 293, 214, 212, 299, 121, 303, - 114, 311, 43, 40, 37, 102, 214, 212, 303, 125, 303, 114, 303, 270, 206, 242, 102, - 299, 156, 327, 323, 288, 287, 210, 270, 206, 242, 210, 299, 43, 40, 37, 210, 303, - 303, 303, 244, 303, 303, 303, 303, 303, 303, 110, 303, 303, 327, 323, 288, 287, - 303, 303, 303, 303, 303, 303, 303, 303, 303, 303, 43, 40, 37, 210, 43, 40, 37, 210, - 303, 43, 40, 37, 240, 210, 303, 303, 191, 327, 323, 288, 287, 327, 323, 288, 287, - 303, 327, 323, 288, 287, 303, 306, 303, 303, 303, 303, 303, 303, 303, 303, 43, 40, - 37, 303, 43, 40, 37, 210, 303, 238, 43, 40, 37, 303, 303, 303, 303, 327, 323, 288, - 287, 327, 323, 288, 287, 15, 303, 327, 323, 288, 287, 303, 303, 303, 475, 475, 303, - 303, 303, 475, 459, 210, 303, 246, 43, 40, 37, 210, 303, 303, 303, 303, 303, 475, - 475, 283, 11, 303, 475, 459, 282, 327, 323, 288, 287, 303, 303, 303, 459, 303, 35, - 459, 157, 475, 303, 459, 303, 13, 43, 40, 37, 303, 303, 303, 43, 40, 37, 459, 303, - 303, 459, 303, 475, 328, 459, 327, 323, 288, 287, 303, 303, 327, 323, 288, 287, - 303, 406, 303, 303, 303, 303, 303, 303, 303, 303, 303, 303, 406, 303, 406, 303, - 303, 406, 303, 303, 303, 303, 303, 303, 406, 303, 406, 303, 406, 303, 303, 303, - 303, 303, 303, 303, 235,); - - static public $yy_lookahead = array(11, 12, 13, 1, 15, 16, 76, 18, 19, 20, 7, 8, 9, 22, 25, 85, 86, 87, 29, 13, 31, - 32, 16, 34, 75, 36, 77, 78, 39, 80, 100, 42, 43, 44, 45, 71, 47, 46, 49, 75, 51, - 52, 53, 54, 80, 11, 12, 13, 59, 15, 16, 22, 18, 19, 20, 49, 92, 51, 66, 25, 54, - 69, 65, 29, 30, 31, 32, 70, 34, 14, 36, 35, 17, 39, 16, 46, 42, 43, 44, 45, 26, - 47, 53, 49, 10, 51, 52, 33, 54, 53, 11, 12, 13, 59, 15, 16, 22, 18, 19, 20, 26, - 104, 105, 48, 25, 12, 13, 33, 29, 16, 31, 32, 75, 34, 77, 36, 13, 80, 39, 16, - 46, 42, 43, 44, 45, 45, 47, 34, 49, 10, 51, 52, 52, 54, 36, 11, 12, 13, 59, 15, - 16, 22, 18, 19, 20, 26, 48, 54, 14, 25, 13, 34, 33, 29, 51, 31, 32, 54, 34, 94, - 36, 96, 97, 39, 97, 46, 42, 43, 44, 45, 14, 47, 75, 49, 77, 51, 52, 80, 54, 45, - 11, 12, 13, 59, 15, 16, 52, 18, 19, 20, 36, 54, 11, 12, 25, 21, 100, 16, 29, 45, - 31, 32, 48, 34, 16, 36, 14, 53, 39, 35, 1, 42, 43, 44, 45, 93, 47, 45, 49, 10, - 51, 52, 1, 54, 52, 11, 12, 13, 59, 15, 16, 50, 18, 19, 20, 26, 27, 45, 50, 25, - 12, 13, 33, 29, 16, 31, 32, 26, 34, 14, 36, 1, 17, 39, 33, 1, 42, 43, 44, 45, - 10, 47, 22, 49, 10, 51, 52, 1, 54, 17, 11, 12, 13, 59, 15, 16, 10, 18, 19, 20, - 26, 45, 54, 48, 25, 36, 46, 33, 29, 53, 31, 32, 26, 34, 93, 36, 95, 48, 39, 33, - 60, 42, 43, 44, 45, 81, 47, 35, 49, 37, 51, 52, 1, 54, 17, 11, 12, 13, 59, 15, - 16, 10, 18, 19, 20, 11, 12, 11, 12, 25, 16, 101, 16, 29, 14, 31, 32, 26, 34, 93, - 36, 95, 22, 39, 33, 48, 42, 43, 44, 45, 81, 47, 76, 49, 41, 51, 52, 35, 54, 37, - 11, 12, 13, 59, 15, 16, 50, 18, 19, 20, 11, 12, 11, 12, 25, 16, 100, 16, 29, 1, - 31, 32, 28, 34, 2, 36, 96, 97, 39, 72, 36, 42, 43, 44, 45, 17, 47, 76, 49, 82, - 51, 52, 48, 54, 16, 11, 12, 13, 59, 15, 16, 50, 18, 19, 20, 75, 35, 100, 37, 25, - 80, 100, 101, 29, 13, 31, 32, 65, 34, 37, 36, 13, 70, 39, 16, 91, 42, 43, 44, - 45, 16, 47, 98, 49, 17, 51, 52, 36, 54, 36, 11, 12, 13, 59, 15, 16, 12, 18, 19, - 20, 1, 48, 4, 76, 25, 54, 16, 105, 29, 10, 31, 32, 45, 34, 53, 36, 17, 36, 39, - 52, 36, 42, 43, 44, 45, 26, 47, 100, 49, 16, 51, 65, 33, 54, 80, 36, 70, 71, 59, - 73, 74, 75, 64, 65, 66, 67, 80, 48, 70, 83, 84, 76, 98, 91, 88, 89, 90, 72, 92, - 1, 98, 16, 3, 4, 5, 6, 7, 82, 102, 103, 11, 12, 72, 72, 15, 100, 76, 18, 19, 20, - 1, 16, 82, 82, 25, 100, 28, 65, 29, 51, 31, 32, 70, 71, 26, 73, 74, 75, 72, 72, - 100, 33, 80, 72, 10, 83, 84, 76, 82, 82, 88, 89, 90, 82, 92, 16, 85, 86, 87, 45, - 65, 99, 95, 72, 51, 70, 71, 76, 73, 74, 75, 100, 53, 82, 93, 80, 72, 13, 83, 84, - 76, 93, 72, 88, 89, 90, 82, 92, 1, 2, 65, 100, 82, 72, 99, 70, 71, 53, 73, 74, - 75, 16, 77, 82, 100, 80, 16, 10, 83, 84, 36, 14, 34, 88, 89, 90, 65, 92, 54, 72, - 13, 70, 71, 26, 73, 74, 75, 72, 77, 82, 33, 80, 23, 36, 83, 84, 82, 82, 72, 88, - 89, 90, 95, 92, 4, 48, 96, 97, 82, 81, 95, 11, 12, 13, 93, 15, 80, 80, 18, 19, - 20, 95, 80, 80, 95, 25, 80, 94, 65, 29, 79, 31, 32, 70, 71, 8, 73, 74, 75, 68, - 106, 93, 93, 80, 106, 93, 83, 84, 106, 106, 106, 88, 89, 90, 106, 92, 106, 106, - 106, 59, 60, 65, 99, 106, 106, 106, 70, 71, 106, 73, 74, 75, 106, 38, 39, 40, - 80, 106, 106, 83, 84, 106, 106, 106, 88, 89, 90, 106, 92, 4, 55, 56, 57, 58, - 106, 106, 11, 12, 13, 103, 15, 106, 106, 18, 19, 20, 106, 106, 106, 106, 25, - 106, 106, 65, 29, 106, 31, 32, 70, 71, 106, 73, 74, 75, 106, 106, 106, 106, 80, - 106, 106, 83, 84, 106, 11, 12, 88, 89, 90, 16, 92, 106, 65, 106, 59, 60, 106, - 70, 71, 26, 73, 74, 75, 106, 106, 106, 33, 80, 72, 106, 83, 84, 76, 106, 106, - 88, 89, 90, 82, 92, 65, 85, 86, 87, 106, 70, 71, 106, 73, 74, 75, 106, 106, 106, - 106, 80, 100, 106, 83, 84, 106, 106, 106, 88, 89, 90, 106, 92, 65, 106, 106, - 106, 106, 70, 71, 106, 73, 74, 75, 106, 106, 106, 106, 80, 106, 106, 83, 84, - 106, 106, 106, 88, 89, 90, 106, 92, 65, 106, 106, 106, 106, 70, 71, 106, 73, 74, - 75, 106, 106, 106, 106, 80, 72, 106, 83, 84, 76, 106, 106, 88, 89, 90, 82, 92, - 65, 85, 86, 87, 106, 70, 71, 106, 73, 74, 75, 106, 106, 106, 106, 80, 100, 106, - 83, 84, 106, 106, 106, 88, 89, 90, 106, 92, 65, 106, 106, 106, 106, 70, 71, 106, - 73, 74, 75, 106, 106, 106, 106, 80, 72, 106, 83, 84, 76, 106, 106, 88, 89, 90, - 82, 92, 65, 85, 86, 87, 106, 70, 71, 106, 73, 74, 75, 106, 106, 106, 106, 80, - 100, 106, 83, 84, 106, 106, 106, 88, 89, 90, 106, 92, 65, 106, 106, 106, 106, - 70, 71, 106, 73, 74, 75, 106, 106, 106, 106, 80, 72, 106, 83, 84, 76, 106, 106, - 88, 89, 90, 82, 92, 65, 85, 86, 87, 106, 70, 71, 106, 73, 74, 75, 106, 106, 106, - 106, 80, 100, 106, 83, 84, 106, 106, 106, 88, 89, 90, 106, 92, 65, 106, 106, - 106, 106, 70, 71, 106, 73, 74, 75, 106, 106, 106, 106, 80, 72, 106, 83, 84, 76, - 106, 106, 88, 89, 90, 82, 92, 65, 85, 86, 87, 106, 70, 71, 106, 73, 74, 75, 106, - 106, 106, 106, 80, 100, 106, 83, 84, 106, 106, 106, 88, 89, 90, 106, 92, 65, - 106, 106, 106, 106, 70, 71, 106, 73, 74, 75, 106, 106, 106, 106, 80, 106, 106, - 83, 84, 106, 106, 106, 88, 89, 90, 106, 92, 65, 106, 106, 106, 106, 70, 71, 106, - 73, 74, 75, 106, 106, 106, 106, 80, 106, 106, 83, 84, 106, 106, 106, 88, 89, 90, - 106, 92, 65, 106, 106, 106, 106, 70, 71, 106, 73, 74, 75, 106, 106, 106, 106, - 80, 106, 106, 83, 84, 106, 106, 106, 88, 89, 90, 106, 92, 65, 106, 106, 106, - 106, 70, 71, 106, 73, 74, 75, 106, 106, 106, 106, 80, 106, 106, 83, 84, 106, - 106, 106, 88, 89, 90, 106, 92, 65, 106, 106, 106, 106, 70, 71, 106, 73, 74, 75, - 106, 106, 106, 106, 80, 106, 106, 83, 84, 106, 106, 106, 88, 89, 90, 106, 92, - 65, 106, 106, 106, 106, 70, 71, 106, 73, 74, 75, 106, 106, 106, 106, 80, 106, - 106, 83, 84, 106, 106, 106, 88, 89, 90, 106, 92, 65, 106, 106, 106, 106, 70, 71, - 106, 73, 74, 75, 106, 106, 106, 106, 80, 106, 106, 83, 84, 106, 106, 106, 88, - 89, 90, 106, 92, 65, 106, 106, 106, 106, 70, 71, 106, 73, 74, 75, 106, 106, 106, - 106, 80, 106, 106, 83, 84, 106, 106, 106, 88, 89, 90, 106, 92, 65, 106, 106, - 106, 106, 70, 71, 106, 73, 74, 75, 106, 106, 106, 106, 80, 106, 106, 83, 84, - 106, 106, 106, 88, 89, 90, 106, 92, 65, 106, 106, 106, 106, 70, 71, 106, 73, 74, - 75, 106, 106, 106, 106, 80, 106, 106, 83, 84, 106, 106, 106, 88, 89, 90, 106, - 92, 65, 106, 106, 106, 106, 70, 71, 106, 73, 74, 75, 106, 106, 106, 106, 80, - 106, 106, 83, 84, 106, 106, 106, 88, 89, 90, 106, 92, 65, 106, 106, 106, 106, - 70, 71, 106, 73, 74, 75, 106, 106, 106, 106, 80, 106, 106, 83, 84, 106, 106, - 106, 88, 89, 90, 106, 92, 65, 106, 106, 106, 106, 70, 71, 106, 73, 74, 75, 106, - 106, 106, 106, 80, 106, 106, 83, 84, 106, 106, 106, 88, 89, 90, 106, 92, 65, - 106, 106, 106, 106, 70, 71, 106, 73, 74, 75, 106, 106, 106, 106, 80, 106, 106, - 83, 84, 106, 106, 106, 88, 89, 90, 106, 92, 65, 106, 106, 106, 106, 70, 71, 106, - 73, 74, 75, 106, 106, 106, 106, 80, 106, 106, 83, 84, 106, 106, 106, 88, 89, 90, - 106, 92, 65, 106, 106, 106, 106, 70, 71, 106, 73, 74, 75, 106, 106, 106, 106, - 80, 106, 106, 83, 84, 106, 1, 2, 88, 89, 90, 106, 92, 65, 106, 106, 106, 106, - 70, 71, 106, 73, 74, 75, 106, 106, 106, 106, 80, 106, 106, 83, 84, 1, 106, 106, - 88, 89, 90, 106, 92, 36, 10, 38, 39, 40, 106, 62, 63, 64, 65, 66, 67, 48, 106, - 70, 106, 106, 26, 106, 55, 56, 57, 58, 106, 33, 106, 106, 106, 106, 38, 39, 40, - 1, 106, 106, 65, 106, 106, 106, 106, 70, 71, 1, 73, 106, 75, 55, 56, 57, 58, 80, - 106, 106, 106, 84, 24, 106, 26, 88, 89, 90, 106, 92, 106, 33, 106, 106, 26, 106, - 38, 39, 40, 106, 106, 33, 106, 106, 106, 106, 38, 39, 40, 106, 106, 106, 65, 55, - 56, 57, 58, 70, 71, 1, 73, 106, 75, 55, 56, 57, 58, 80, 10, 106, 106, 84, 106, - 106, 106, 88, 89, 90, 65, 92, 2, 106, 106, 70, 71, 106, 73, 106, 75, 11, 12, - 106, 14, 80, 16, 17, 38, 39, 40, 106, 106, 88, 89, 90, 106, 92, 106, 106, 106, - 106, 106, 106, 65, 55, 56, 57, 58, 70, 71, 106, 73, 106, 75, 45, 106, 106, 48, - 80, 50, 106, 52, 2, 106, 106, 106, 88, 89, 90, 106, 92, 11, 12, 2, 14, 106, 16, - 17, 106, 106, 106, 106, 11, 12, 106, 106, 2, 16, 17, 11, 12, 106, 106, 106, 16, - 11, 12, 106, 106, 106, 16, 17, 106, 106, 26, 45, 28, 106, 48, 106, 50, 33, 52, - 106, 106, 106, 45, 106, 106, 48, 65, 50, 106, 52, 53, 70, 71, 106, 73, 45, 75, - 106, 48, 106, 50, 80, 52, 106, 106, 106, 106, 106, 106, 88, 89, 90, 106, 92, 65, - 1, 2, 106, 106, 70, 71, 106, 73, 106, 75, 106, 71, 106, 106, 80, 75, 106, 106, - 106, 106, 80, 106, 88, 89, 90, 65, 92, 1, 106, 89, 70, 71, 92, 73, 106, 75, 65, - 38, 39, 40, 80, 70, 71, 106, 73, 106, 75, 106, 88, 89, 90, 80, 92, 27, 55, 56, - 57, 58, 1, 88, 89, 90, 1, 92, 38, 39, 40, 1, 106, 106, 106, 10, 106, 106, 106, - 106, 106, 106, 21, 106, 106, 55, 56, 57, 58, 106, 106, 106, 106, 106, 106, 106, - 106, 106, 106, 38, 39, 40, 1, 38, 39, 40, 1, 106, 38, 39, 40, 10, 1, 106, 106, - 10, 55, 56, 57, 58, 55, 56, 57, 58, 106, 55, 56, 57, 58, 106, 60, 106, 106, 106, - 106, 106, 106, 106, 106, 38, 39, 40, 106, 38, 39, 40, 1, 106, 37, 38, 39, 40, - 106, 106, 106, 106, 55, 56, 57, 58, 55, 56, 57, 58, 2, 106, 55, 56, 57, 58, 106, - 106, 106, 11, 12, 106, 106, 106, 16, 17, 1, 106, 37, 38, 39, 40, 1, 106, 106, - 106, 106, 106, 11, 12, 11, 12, 106, 16, 17, 16, 55, 56, 57, 58, 106, 106, 106, - 45, 106, 26, 48, 28, 50, 106, 52, 106, 33, 38, 39, 40, 106, 106, 106, 38, 39, - 40, 45, 106, 106, 48, 106, 50, 53, 52, 55, 56, 57, 58, 106, 106, 55, 56, 57, 58, - 106, 10, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 21, 106, 23, 106, - 106, 26, 106, 106, 106, 106, 106, 106, 33, 106, 35, 106, 37, 106, 106, 106, 106, - 106, 106, 106, 45,); - - const YY_SHIFT_USE_DFLT = - 12; - - const YY_SHIFT_MAX = 238; - - static public $yy_shift_ofst = array(519, 349, 79, 349, 304, 79, 79, 304, 34, - 11, 34, 79, 394, 79, 79, 124, 79, - 169, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 259, 79, 79, 79, 79, 79, 79, 169, - 79, 214, 214, 439, 439, 439, 439, 439, 439, 1617, 1577, 1627, 1627, 1627, 1627, - 1627, 519, 1944, 1978, 2012, 1903, 1938, 1677, 1836, 1934, 1863, 1898, 1894, - 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 695, - 695, 6, 660, 459, 311, 103, 221, 411, 745, 1766, 2016, 783, 783, 411, 221, 411, - 427, 221, 607, 74, 119, 209, 266, 254, 228, 181, 55, 314, 3, 314, 235, 418, - 418, 584, 250, 528, 378, 297, 54, 518, 54, 539, 2, 2, 2, 2, 2, 2, 2, 2, 2, 252, - 252, - 12, 1697, 1759, 1748, 1995, 1772, 2014, 93, 361, 359, 134, 54, 137, 54, - 137, 54, 54, 54, 54, 54, 54, 54, 54, 80, 54, 54, 137, 137, 54, 54, 54, 54, 54, - 172, 54, 172, 444, 172, 320, 80, 172, 172, 172, 54, 172, 172, 687, 594, 2, 252, - 2, 382, 382, 2, 2, 252, 252, 2, - 12, - 12, - 12, - 12, - 12, 1550, 2068, 617, - 316, 154, 29, 240, 354, 98, 174, 236, 192, 272, 413, 249, 322, 381, 188, 36, - - 9, 598, 554, 424, 533, 525, 441, 498, 505, 473, 458, 450, 421, 559, 610, 594, - 627, 605, 564, 534, 392, 388, 629, 117, 58, 156, 313,); - - const YY_REDUCE_USE_DFLT = - 71; - - const YY_REDUCE_MAX = 192; - - static public $yy_reduce_ofst = array(1530, 426, 482, 656, 545, 515, 623, 571, 1017, 961, 1101, 1325, 933, 793, 849, - 821, 1465, 1157, 1129, 1185, 1073, 989, 1045, 1241, 1381, 1437, 1493, 1409, - 1269, 1297, 1353, 1213, 708, 737, 905, 877, 765, 1606, 1556, 1632, 1808, 1797, - 1771, 1666, 1743, 886, 491, 830, 491, 746, 942, 998, 438, - 70, - 70, - 70, - - 70, - 70, - 70, - 70, - 70, - 70, - 70, - 70, - 70, - 70, - 70, - 70, - 70, - - 70, - 70, - 70, - 70, - 70, - 70, - 70, - 70, - 70, 1777, - 3, 524, 460, - - 36, 511, - 51, 362, 487, 575, 567, 586, 37, 445, 97, 65, 317, 321, 541, 541, - 276, 276, 276, 414, 246, 290, 246, - 8, 201, 290, 344, 422, 340, 276, 461, - 387, 290, 486, 276, 530, 276, 276, 276, 276, 276, 435, 276, 276, 276, 276, - 570, 290, 276, 122, 122, 122, 122, 122, 122, 602, 589, 122, 122, 574, 606, - 574, 603, 574, 574, 574, 574, 574, 574, 574, 574, 581, 574, 574, 597, 596, - 574, 574, 574, 574, 574, 593, 574, 593, 609, 593, 611, 608, 593, 593, 593, - 574, 593, 593, 631, 612, 96, 67, 96, 230, 230, 96, 96, 67, 67, 96, 269, 224, - 588, 508, 501,); - - static public $yyExpectedTokens = array(array(3, 4, 5, 6, 7, 11, 12, 15, 18, 19, 20, 25, 29, 31, 32,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 30, 31, 32, 34, 36, 39, 42, - 43, 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 53, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 30, 31, 32, 34, 36, 39, 42, - 43, 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 52, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 54, 59,), - array(11, 12, 13, 15, 16, 18, 19, 20, 25, 29, 31, 32, 34, 36, 39, 42, 43, - 44, 45, 47, 49, 51, 54, 59,), - array(1, 24, 26, 33, 38, 39, 40, 55, 56, 57, 58,), - array(1, 10, 26, 33, 38, 39, 40, 55, 56, 57, 58,), - array(1, 26, 33, 38, 39, 40, 55, 56, 57, 58,), - array(1, 26, 33, 38, 39, 40, 55, 56, 57, 58,), - array(1, 26, 33, 38, 39, 40, 55, 56, 57, 58,), - array(1, 26, 33, 38, 39, 40, 55, 56, 57, 58,), - array(1, 26, 33, 38, 39, 40, 55, 56, 57, 58,), - array(3, 4, 5, 6, 7, 11, 12, 15, 18, 19, 20, 25, 29, 31, 32,), - array(1, 37, 38, 39, 40, 55, 56, 57, 58,), - array(1, 37, 38, 39, 40, 55, 56, 57, 58,), - array(1, 38, 39, 40, 53, 55, 56, 57, 58,), - array(1, 38, 39, 40, 55, 56, 57, 58, 60,), - array(1, 10, 38, 39, 40, 55, 56, 57, 58,), - array(1, 10, 38, 39, 40, 55, 56, 57, 58,), - array(1, 2, 38, 39, 40, 55, 56, 57, 58,), - array(1, 10, 38, 39, 40, 55, 56, 57, 58,), - array(1, 27, 38, 39, 40, 55, 56, 57, 58,), - array(1, 10, 38, 39, 40, 55, 56, 57, 58,), - array(1, 21, 38, 39, 40, 55, 56, 57, 58,), - array(1, 38, 39, 40, 55, 56, 57, 58,), - array(1, 38, 39, 40, 55, 56, 57, 58,), - array(1, 38, 39, 40, 55, 56, 57, 58,), - array(1, 38, 39, 40, 55, 56, 57, 58,), - array(1, 38, 39, 40, 55, 56, 57, 58,), - array(1, 38, 39, 40, 55, 56, 57, 58,), - array(1, 38, 39, 40, 55, 56, 57, 58,), - array(1, 38, 39, 40, 55, 56, 57, 58,), - array(1, 38, 39, 40, 55, 56, 57, 58,), - array(1, 38, 39, 40, 55, 56, 57, 58,), - array(1, 38, 39, 40, 55, 56, 57, 58,), - array(1, 38, 39, 40, 55, 56, 57, 58,), array(38, 39, 40, 55, 56, 57, 58,), - array(38, 39, 40, 55, 56, 57, 58,), array(13, 16, 49, 51, 54,), - array(4, 11, 12, 13, 15, 18, 19, 20, 25, 29, 31, 32, 59, 60,), - array(1, 10, 17, 26, 33, 36, 48,), array(1, 10, 26, 33,), - array(13, 16, 51, 54,), array(1, 26, 33,), array(13, 36, 54,), - array(4, 11, 12, 13, 15, 18, 19, 20, 25, 29, 31, 32, 59, 60,), - array(11, 12, 16, 26, 28, 33,), array(11, 12, 16, 26, 28, 33,), - array(11, 12, 16, 26, 33,), array(11, 12, 16, 26, 33,), array(13, 36, 54,), - array(1, 26, 33,), array(13, 36, 54,), array(17, 45, 52,), - array(1, 26, 33,), array(1, 2,), array(10, 22, 26, 33, 46,), - array(10, 22, 26, 33, 46,), array(1, 10, 26, 27, 33,), - array(1, 10, 26, 33,), array(1, 10, 26, 33,), array(12, 13, 16, 54,), - array(11, 12, 16, 50,), array(14, 17, 48,), array(11, 12, 16,), - array(7, 8, 9,), array(11, 12, 16,), array(14, 17, 48,), array(13, 16,), - array(13, 16,), array(13, 54,), array(1, 10,), array(26, 33,), - array(1, 17,), array(17, 48,), array(26, 33,), array(1, 28,), - array(26, 33,), array(1, 53,), array(1,), array(1,), array(1,), array(1,), - array(1,), array(1,), array(1,), array(1,), array(1,), array(17,), - array(17,), array(), array(2, 11, 12, 14, 16, 17, 45, 48, 50, 52,), - array(2, 11, 12, 16, 17, 45, 48, 50, 52, 53,), - array(2, 11, 12, 14, 16, 17, 45, 48, 50, 52,), - array(2, 11, 12, 16, 17, 45, 48, 50, 52,), - array(2, 11, 12, 16, 17, 45, 48, 50, 52,), - array(11, 12, 16, 17, 45, 48, 50, 52,), array(12, 13, 16, 34, 54,), - array(11, 12, 16, 50,), array(11, 12, 16,), array(14, 45, 52,), - array(26, 33,), array(13, 54,), array(26, 33,), array(13, 54,), - array(26, 33,), array(26, 33,), array(26, 33,), array(26, 33,), - array(26, 33,), array(26, 33,), array(26, 33,), array(26, 33,), - array(45, 52,), array(26, 33,), array(26, 33,), array(13, 54,), - array(13, 54,), array(26, 33,), array(26, 33,), array(26, 33,), - array(26, 33,), array(26, 33,), array(45, 52,), array(26, 33,), - array(45, 52,), array(12, 36,), array(45, 52,), array(14, 22,), - array(45, 52,), array(45, 52,), array(45, 52,), array(45, 52,), - array(26, 33,), array(45, 52,), array(45, 52,), array(8,), array(36,), - array(1,), array(17,), array(1,), array(2,), array(2,), array(1,), - array(1,), array(17,), array(17,), array(1,), array(), array(), array(), - array(), array(), array(1, 2, 36, 38, 39, 40, 48, 55, 56, 57, 58,), - array(10, 21, 23, 26, 33, 35, 37, 45,), array(10, 14, 26, 33, 36, 48,), - array(11, 12, 16, 50,), array(36, 45, 48, 53,), array(22, 46, 53,), - array(22, 46, 60,), array(28, 36, 48,), array(36, 48,), array(21, 35,), - array(45, 53,), array(14, 45,), array(35, 37,), array(36, 48,), - array(36, 48,), array(35, 37,), array(35, 37,), array(16, 50,), - array(35, 53,), array(22, 46,), array(34,), array(10,), array(16,), - array(51,), array(16,), array(36,), array(51,), array(16,), array(16,), - array(4,), array(16,), array(53,), array(16,), array(16,), array(36,), - array(13,), array(16,), array(53,), array(45,), array(37,), array(16,), - array(23,), array(34,), array(16,), array(14,), array(41,), array(), - array(), array(), array(), array(), array(), array(), array(), array(), - array(), array(), array(), array(), array(), array(), array(), array(), - array(), array(), array(), array(), array(), array(), array(), array(), - array(), array(), array(), array(), array(), array(), array(), array(), - array(), array(), array(), array(), array(), array(), array(), array(), - array(), array(), array(), array(), array(), array(), array(), array(), - array(), array(), array(), array(), array(), array(), array(), array(), - array(), array(), array(), array(), array(), array(), array(), array(), - array(), array(), array(), array(), array(), array(), array(), array(), - array(), array(), array(), array(), array(), array(), array(), array(), - array(), array(), array(), array(), array(), array(), array(), array(), - array(), array(), array(), array(), array(), array(), array(),); - - static public $yy_default = array(338, 515, 494, 530, 530, 494, 494, 530, 530, 530, 530, 530, 530, 530, 530, 530, - 530, 530, 530, 530, 530, 530, 530, 530, 530, 530, 530, 530, 530, 530, 530, 530, - 530, 530, 530, 530, 530, 530, 530, 530, 530, 530, 530, 530, 530, 396, 530, 396, - 359, 372, 362, 396, 335, 530, 530, 530, 530, 530, 530, 530, 530, 401, 530, 530, - 377, 517, 492, 493, 418, 516, 403, 401, 518, 398, 407, 408, 423, 422, 530, 530, - 434, 410, 530, 396, 530, 530, 396, 396, 396, 396, 530, 396, 530, 506, 396, 386, - 424, 424, 410, 410, 410, 530, 459, 449, 459, 530, 459, 449, 530, 530, 530, 410, - 396, 390, 449, 396, 410, 374, 410, 417, 426, 425, 410, 392, 421, 414, 413, 427, - 503, 449, 501, 448, 448, 448, 448, 448, 448, 530, 461, 459, 475, 382, 530, 381, - 530, 369, 366, 364, 368, 360, 363, 358, 370, 452, 384, 356, 530, 530, 385, 375, - 380, 379, 373, 455, 376, 484, 459, 487, 530, 454, 453, 486, 485, 383, 456, 457, - 350, 459, 443, 481, 387, 495, 496, 416, 391, 507, 504, 393, 500, 500, 500, 459, - 459, 434, 430, 434, 460, 434, 424, 424, 434, 434, 530, 430, 430, 530, 530, 444, - 530, 530, 530, 530, 424, 530, 530, 530, 530, 530, 505, 530, 530, 530, 342, 530, - 439, 530, 530, 475, 530, 530, 530, 430, 530, 530, 404, 432, 530, 530, 436, 439, - 480, 502, 440, 490, 465, 365, 436, 475, 394, 405, 343, 344, 345, 346, 347, 409, - 429, 411, 337, 336, 339, 340, 341, 431, 348, 397, 353, 464, 354, 463, 435, 378, - 351, 349, 489, 352, 433, 462, 419, 477, 415, 446, 478, 479, 438, 388, 519, 511, - 510, 521, 520, 412, 482, 437, 498, 497, 491, 476, 483, 451, 526, 527, 428, 499, - 450, 389, 524, 523, 488, 458, 420, 442, 445, 371, 471, 468, 474, 467, 466, 469, - 472, 470, 522, 509, 529, 528, 525, 508, 473, 513, 447, 514, 395, 512, 441,); - - const YYNOCODE = 107; - - const YYSTACKDEPTH = 500; - - const YYNSTATE = 335; - - const YYNRULE = 195; - - const YYERRORSYMBOL = 61; - - const YYERRSYMDT = 'yy0'; - - const YYFALLBACK = 0; - - public static $yyFallback = array(); - public function Trace($TraceFILE, $zTracePrompt) { if (!$TraceFILE) { $zTracePrompt = 0; - } elseif (!$zTracePrompt) { + } else if (!$zTracePrompt) { $TraceFILE = 0; } $this->yyTraceFILE = $TraceFILE; @@ -900,136 +1722,6 @@ class Smarty_Internal_Templateparser $this->yyTracePrompt = '<br>'; } - public $yyTraceFILE; - - public $yyTracePrompt; - - public $yyidx; /* Index of top element in stack */ - public $yyerrcnt; /* Shifts left before out of the error */ - public $yystack = array(); /* The parser's stack */ - - public $yyTokenName = array('$', 'VERT', 'COLON', 'PHP', 'TEXT', 'STRIPON', 'STRIPOFF', 'LITERALSTART', - 'LITERALEND', 'LITERAL', 'RDEL', 'SIMPELOUTPUT', 'LDEL', 'DOLLARID', 'EQUAL', - 'SIMPLETAG', 'ID', 'PTR', 'LDELMAKENOCACHE', 'LDELIF', 'LDELFOR', 'SEMICOLON', 'INCDEC', - 'TO', 'STEP', 'LDELFOREACH', 'SPACE', 'AS', 'APTR', 'LDELSETFILTER', - 'SMARTYBLOCKCHILDPARENT', 'CLOSETAG', 'LDELSLASH', 'ATTR', 'INTEGER', 'COMMA', 'OPENP', - 'CLOSEP', 'MATH', 'UNIMATH', 'ISIN', 'QMARK', 'NOT', 'TYPECAST', 'HEX', 'DOT', - 'INSTANCEOF', 'SINGLEQUOTESTRING', 'DOUBLECOLON', 'NAMESPACE', 'AT', 'HATCH', 'OPENB', - 'CLOSEB', 'DOLLAR', 'LOGOP', 'SLOGOP', 'TLOGOP', 'SINGLECOND', 'QUOTE', 'BACKTICK', - 'error', 'start', 'template', 'template_element', 'smartytag', 'literal', - 'text_content', 'literal_elements', 'literal_element', 'tag', 'variable', 'attributes', - 'value', 'expr', 'varindexed', 'modifierlist', 'statement', 'statements', 'foraction', - 'varvar', 'modparameters', 'attribute', 'ternary', 'array', 'tlop', 'lop', 'scond', - 'function', 'ns1', 'doublequoted_with_quotes', 'static_class_access', 'object', - 'arrayindex', 'indexdef', 'varvarele', 'objectchain', 'objectelement', 'method', - 'params', 'modifier', 'modparameter', 'arrayelements', 'arrayelement', 'doublequoted', - 'doublequotedcontent',); - - public static $yyRuleName = array('start ::= template', 'template ::= template_element', - 'template ::= template template_element', 'template ::=', - 'template_element ::= smartytag', 'template_element ::= literal', - 'template_element ::= PHP', 'template_element ::= text_content', - 'text_content ::= TEXT', 'text_content ::= text_content TEXT', - 'template_element ::= STRIPON', 'template_element ::= STRIPOFF', - 'literal ::= LITERALSTART LITERALEND', - 'literal ::= LITERALSTART literal_elements LITERALEND', - 'literal_elements ::= literal_elements literal_element', 'literal_elements ::=', - 'literal_element ::= literal', 'literal_element ::= LITERAL', - 'smartytag ::= tag RDEL', 'smartytag ::= SIMPELOUTPUT', 'tag ::= LDEL variable', - 'tag ::= LDEL variable attributes', 'tag ::= LDEL value', - 'tag ::= LDEL value attributes', 'tag ::= LDEL expr', - 'tag ::= LDEL expr attributes', 'tag ::= LDEL DOLLARID EQUAL value', - 'tag ::= LDEL DOLLARID EQUAL expr', 'tag ::= LDEL DOLLARID EQUAL expr attributes', - 'tag ::= LDEL varindexed EQUAL expr attributes', 'smartytag ::= SIMPLETAG', - 'tag ::= LDEL ID attributes', 'tag ::= LDEL ID', - 'tag ::= LDEL ID modifierlist attributes', 'tag ::= LDEL ID PTR ID attributes', - 'tag ::= LDEL ID PTR ID modifierlist attributes', - 'tag ::= LDELMAKENOCACHE DOLLARID', 'tag ::= LDELIF expr', - 'tag ::= LDELIF expr attributes', 'tag ::= LDELIF statement', - 'tag ::= LDELIF statement attributes', - 'tag ::= LDELFOR statements SEMICOLON expr SEMICOLON varindexed foraction attributes', - 'foraction ::= EQUAL expr', 'foraction ::= INCDEC', - 'tag ::= LDELFOR statement TO expr attributes', - 'tag ::= LDELFOR statement TO expr STEP expr attributes', - 'tag ::= LDELFOREACH attributes', - 'tag ::= LDELFOREACH SPACE value AS varvar attributes', - 'tag ::= LDELFOREACH SPACE value AS varvar APTR varvar attributes', - 'tag ::= LDELFOREACH SPACE expr AS varvar attributes', - 'tag ::= LDELFOREACH SPACE expr AS varvar APTR varvar attributes', - 'tag ::= LDELSETFILTER ID modparameters', - 'tag ::= LDELSETFILTER ID modparameters modifierlist', - 'tag ::= LDEL SMARTYBLOCKCHILDPARENT', 'smartytag ::= CLOSETAG', - 'tag ::= LDELSLASH ID', 'tag ::= LDELSLASH ID modifierlist', - 'tag ::= LDELSLASH ID PTR ID', 'tag ::= LDELSLASH ID PTR ID modifierlist', - 'attributes ::= attributes attribute', 'attributes ::= attribute', - 'attributes ::=', 'attribute ::= SPACE ID EQUAL ID', 'attribute ::= ATTR expr', - 'attribute ::= ATTR value', 'attribute ::= SPACE ID', 'attribute ::= SPACE expr', - 'attribute ::= SPACE value', 'attribute ::= SPACE INTEGER EQUAL expr', - 'statements ::= statement', 'statements ::= statements COMMA statement', - 'statement ::= DOLLARID EQUAL INTEGER', 'statement ::= DOLLARID EQUAL expr', - 'statement ::= varindexed EQUAL expr', 'statement ::= OPENP statement CLOSEP', - 'expr ::= value', 'expr ::= ternary', 'expr ::= DOLLARID COLON ID', - 'expr ::= expr MATH value', 'expr ::= expr UNIMATH value', 'expr ::= array', - 'expr ::= expr modifierlist', 'expr ::= expr tlop value', - 'expr ::= expr lop expr', 'expr ::= expr scond', 'expr ::= expr ISIN array', - 'expr ::= expr ISIN value', - 'ternary ::= OPENP expr CLOSEP QMARK DOLLARID COLON expr', - 'ternary ::= OPENP expr CLOSEP QMARK expr COLON expr', 'value ::= variable', - 'value ::= UNIMATH value', 'value ::= NOT value', 'value ::= TYPECAST value', - 'value ::= variable INCDEC', 'value ::= HEX', 'value ::= INTEGER', - 'value ::= INTEGER DOT INTEGER', 'value ::= INTEGER DOT', 'value ::= DOT INTEGER', - 'value ::= ID', 'value ::= function', 'value ::= OPENP expr CLOSEP', - 'value ::= variable INSTANCEOF ns1', 'value ::= variable INSTANCEOF variable', - 'value ::= SINGLEQUOTESTRING', 'value ::= doublequoted_with_quotes', - 'value ::= varindexed DOUBLECOLON static_class_access', 'value ::= smartytag', - 'value ::= value modifierlist', 'value ::= NAMESPACE', - 'value ::= ns1 DOUBLECOLON static_class_access', 'ns1 ::= ID', - 'ns1 ::= NAMESPACE', 'variable ::= DOLLARID', 'variable ::= varindexed', - 'variable ::= varvar AT ID', 'variable ::= object', 'variable ::= HATCH ID HATCH', - 'variable ::= HATCH ID HATCH arrayindex', 'variable ::= HATCH variable HATCH', - 'variable ::= HATCH variable HATCH arrayindex', - 'varindexed ::= DOLLARID arrayindex', 'varindexed ::= varvar arrayindex', - 'arrayindex ::= arrayindex indexdef', 'arrayindex ::=', - 'indexdef ::= DOT DOLLARID', 'indexdef ::= DOT varvar', - 'indexdef ::= DOT varvar AT ID', 'indexdef ::= DOT ID', - 'indexdef ::= DOT INTEGER', 'indexdef ::= DOT LDEL expr RDEL', - 'indexdef ::= OPENB ID CLOSEB', 'indexdef ::= OPENB ID DOT ID CLOSEB', - 'indexdef ::= OPENB SINGLEQUOTESTRING CLOSEB', - 'indexdef ::= OPENB INTEGER CLOSEB', 'indexdef ::= OPENB DOLLARID CLOSEB', - 'indexdef ::= OPENB variable CLOSEB', 'indexdef ::= OPENB value CLOSEB', - 'indexdef ::= OPENB expr CLOSEB', 'indexdef ::= OPENB CLOSEB', - 'varvar ::= DOLLARID', 'varvar ::= DOLLAR', 'varvar ::= varvar varvarele', - 'varvarele ::= ID', 'varvarele ::= SIMPELOUTPUT', 'varvarele ::= LDEL expr RDEL', - 'object ::= varindexed objectchain', 'objectchain ::= objectelement', - 'objectchain ::= objectchain objectelement', - 'objectelement ::= PTR ID arrayindex', 'objectelement ::= PTR varvar arrayindex', - 'objectelement ::= PTR LDEL expr RDEL arrayindex', - 'objectelement ::= PTR ID LDEL expr RDEL arrayindex', - 'objectelement ::= PTR method', 'function ::= ns1 OPENP params CLOSEP', - 'method ::= ID OPENP params CLOSEP', 'method ::= DOLLARID OPENP params CLOSEP', - 'params ::= params COMMA expr', 'params ::= expr', 'params ::=', - 'modifierlist ::= modifierlist modifier modparameters', - 'modifierlist ::= modifier modparameters', 'modifier ::= VERT AT ID', - 'modifier ::= VERT ID', 'modparameters ::= modparameters modparameter', - 'modparameters ::=', 'modparameter ::= COLON value', - 'modparameter ::= COLON array', 'static_class_access ::= method', - 'static_class_access ::= method objectchain', 'static_class_access ::= ID', - 'static_class_access ::= DOLLARID arrayindex', - 'static_class_access ::= DOLLARID arrayindex objectchain', 'lop ::= LOGOP', - 'lop ::= SLOGOP', 'tlop ::= TLOGOP', 'scond ::= SINGLECOND', - 'array ::= OPENB arrayelements CLOSEB', 'arrayelements ::= arrayelement', - 'arrayelements ::= arrayelements COMMA arrayelement', 'arrayelements ::=', - 'arrayelement ::= value APTR expr', 'arrayelement ::= ID APTR expr', - 'arrayelement ::= expr', 'doublequoted_with_quotes ::= QUOTE QUOTE', - 'doublequoted_with_quotes ::= QUOTE doublequoted QUOTE', - 'doublequoted ::= doublequoted doublequotedcontent', - 'doublequoted ::= doublequotedcontent', - 'doublequotedcontent ::= BACKTICK variable BACKTICK', - 'doublequotedcontent ::= BACKTICK expr BACKTICK', - 'doublequotedcontent ::= DOLLARID', 'doublequotedcontent ::= LDEL variable RDEL', - 'doublequotedcontent ::= LDEL expr RDEL', 'doublequotedcontent ::= smartytag', - 'doublequotedcontent ::= TEXT',); - public function tokenName($tokenType) { if ($tokenType === 0) { @@ -1038,7 +1730,7 @@ class Smarty_Internal_Templateparser if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) { return $this->yyTokenName[ $tokenType ]; } else { - return "Unknown"; + return 'Unknown'; } } @@ -1057,12 +1749,13 @@ class Smarty_Internal_Templateparser } $yytos = array_pop($this->yystack); if ($this->yyTraceFILE && $this->yyidx >= 0) { - fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . "\n"); + fwrite($this->yyTraceFILE, + $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . + "\n"); } $yymajor = $yytos->major; self::yy_destructor($yymajor, $yytos->minor); - $this->yyidx --; - + $this->yyidx--; return $yymajor; } @@ -1099,7 +1792,7 @@ class Smarty_Internal_Templateparser // reduce action $done = 0; do { - if ($done ++ == 100) { + if ($done++ === 100) { $this->yyidx = $yyidx; $this->yystack = $stack; // too much recursion prevents proper detection @@ -1108,8 +1801,9 @@ class Smarty_Internal_Templateparser } $yyruleno = $yyact - self::YYNSTATE; $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; - $nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, - self::$yyRuleInfo[ $yyruleno ][ 0 ]); + $nextstate = $this->yy_find_reduce_action( + $this->yystack[ $this->yyidx ]->stateno, + self::$yyRuleInfo[ $yyruleno ][ 0 ]); if (isset(self::$yyExpectedTokens[ $nextstate ])) { $expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]); if (isset($res4[ $nextstate ][ $token ])) { @@ -1120,8 +1814,7 @@ class Smarty_Internal_Templateparser } } else { if ($res4[ $nextstate ][ $token ] = - in_array($token, self::$yyExpectedTokens[ $nextstate ], true) - ) { + in_array($token, self::$yyExpectedTokens[ $nextstate ], true)) { $this->yyidx = $yyidx; $this->yystack = $stack; return array_unique($expected); @@ -1130,20 +1823,20 @@ class Smarty_Internal_Templateparser } if ($nextstate < self::YYNSTATE) { // we need to shift a non-terminal - $this->yyidx ++; + $this->yyidx++; $x = new TP_yyStackEntry; $x->stateno = $nextstate; $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ]; $this->yystack[ $this->yyidx ] = $x; continue 2; - } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) { + } else if ($nextstate === self::YYNSTATE + self::YYNRULE + 1) { $this->yyidx = $yyidx; $this->yystack = $stack; // the last token was just ignored, we can't accept // by ignoring input, this is in essence ignoring a // syntax error! return array_unique($expected); - } elseif ($nextstate === self::YY_NO_ACTION) { + } else if ($nextstate === self::YY_NO_ACTION) { $this->yyidx = $yyidx; $this->yystack = $stack; // input accepted, but not shifted (I guess) @@ -1151,15 +1844,12 @@ class Smarty_Internal_Templateparser } else { $yyact = $nextstate; } - } - while (true); + } while (true); } break; - } - while (true); + } while (true); $this->yyidx = $yyidx; $this->yystack = $stack; - return array_unique($expected); } @@ -1188,7 +1878,7 @@ class Smarty_Internal_Templateparser // reduce action $done = 0; do { - if ($done ++ == 100) { + if ($done++ === 100) { $this->yyidx = $yyidx; $this->yystack = $stack; // too much recursion prevents proper detection @@ -1197,8 +1887,9 @@ class Smarty_Internal_Templateparser } $yyruleno = $yyact - self::YYNSTATE; $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; - $nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, - self::$yyRuleInfo[ $yyruleno ][ 0 ]); + $nextstate = $this->yy_find_reduce_action( + $this->yystack[ $this->yyidx ]->stateno, + self::$yyRuleInfo[ $yyruleno ][ 0 ]); if (isset($res2[ $nextstate ][ $token ])) { if ($res2[ $nextstate ][ $token ]) { $this->yyidx = $yyidx; @@ -1207,9 +1898,9 @@ class Smarty_Internal_Templateparser } } else { if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ]) && - in_array($token, self::$yyExpectedTokens[ $nextstate ], - true)) - ) { + in_array($token, + self::$yyExpectedTokens[ $nextstate ], + true))) { $this->yyidx = $yyidx; $this->yystack = $stack; return true; @@ -1217,13 +1908,13 @@ class Smarty_Internal_Templateparser } if ($nextstate < self::YYNSTATE) { // we need to shift a non-terminal - $this->yyidx ++; + $this->yyidx++; $x = new TP_yyStackEntry; $x->stateno = $nextstate; $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ]; $this->yystack[ $this->yyidx ] = $x; continue 2; - } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) { + } else if ($nextstate === self::YYNSTATE + self::YYNRULE + 1) { $this->yyidx = $yyidx; $this->yystack = $stack; if (!$token) { @@ -1234,7 +1925,7 @@ class Smarty_Internal_Templateparser // by ignoring input, this is in essence ignoring a // syntax error! return false; - } elseif ($nextstate === self::YY_NO_ACTION) { + } else if ($nextstate === self::YY_NO_ACTION) { $this->yyidx = $yyidx; $this->yystack = $stack; // input accepted, but not shifted (I guess) @@ -1242,22 +1933,18 @@ class Smarty_Internal_Templateparser } else { $yyact = $nextstate; } - } - while (true); + } while (true); } break; - } - while (true); + } while (true); $this->yyidx = $yyidx; $this->yystack = $stack; - return true; } public function yy_find_shift_action($iLookAhead) { $stateno = $this->yystack[ $this->yyidx ]->stateno; - /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */ if (!isset(self::$yy_shift_ofst[ $stateno ])) { // no shift actions @@ -1267,23 +1954,22 @@ class Smarty_Internal_Templateparser if ($i === self::YY_SHIFT_USE_DFLT) { return self::$yy_default[ $stateno ]; } - if ($iLookAhead == self::YYNOCODE) { + if ($iLookAhead === self::YYNOCODE) { return self::YY_NO_ACTION; } $i += $iLookAhead; - if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) { - if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) && - ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0 - ) { + if ($i < 0 || $i >= self::YY_SZ_ACTTAB || + self::$yy_lookahead[ $i ] != $iLookAhead) { + if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) + && ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0) { if ($this->yyTraceFILE) { fwrite($this->yyTraceFILE, - $this->yyTracePrompt . "FALLBACK " . $this->yyTokenName[ $iLookAhead ] . " => " . + $this->yyTracePrompt . 'FALLBACK ' . + $this->yyTokenName[ $iLookAhead ] . ' => ' . $this->yyTokenName[ $iFallback ] . "\n"); } - return $this->yy_find_shift_action($iFallback); } - return self::$yy_default[ $stateno ]; } else { return self::$yy_action[ $i ]; @@ -1293,41 +1979,41 @@ class Smarty_Internal_Templateparser public function yy_find_reduce_action($stateno, $iLookAhead) { /* $stateno = $this->yystack[$this->yyidx]->stateno; */ - if (!isset(self::$yy_reduce_ofst[ $stateno ])) { return self::$yy_default[ $stateno ]; } $i = self::$yy_reduce_ofst[ $stateno ]; - if ($i == self::YY_REDUCE_USE_DFLT) { + if ($i === self::YY_REDUCE_USE_DFLT) { return self::$yy_default[ $stateno ]; } - if ($iLookAhead == self::YYNOCODE) { + if ($iLookAhead === self::YYNOCODE) { return self::YY_NO_ACTION; } $i += $iLookAhead; - if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) { + if ($i < 0 || $i >= self::YY_SZ_ACTTAB || + self::$yy_lookahead[ $i ] != $iLookAhead) { return self::$yy_default[ $stateno ]; } else { return self::$yy_action[ $i ]; } } + #line 234 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_shift($yyNewState, $yyMajor, $yypMinor) { - $this->yyidx ++; + $this->yyidx++; if ($this->yyidx >= self::YYSTACKDEPTH) { - $this->yyidx --; + $this->yyidx--; if ($this->yyTraceFILE) { fprintf($this->yyTraceFILE, "%sStack Overflow!\n", $this->yyTracePrompt); } while ($this->yyidx >= 0) { $this->yy_pop_parser_stack(); } - #line 207 "../smarty/lexer/smarty_internal_templateparser.y" - + #line 221 "../smarty/lexer/smarty_internal_templateparser.y" $this->internalError = true; - $this->compiler->trigger_template_error("Stack overflow in template parser"); - + $this->compiler->trigger_template_error('Stack overflow in template parser'); return; } $yytos = new TP_yyStackEntry; @@ -1336,111 +2022,22 @@ class Smarty_Internal_Templateparser $yytos->minor = $yypMinor; $this->yystack[] = $yytos; if ($this->yyTraceFILE && $this->yyidx > 0) { - fprintf($this->yyTraceFILE, "%sShift %d\n", $this->yyTracePrompt, $yyNewState); + fprintf($this->yyTraceFILE, + "%sShift %d\n", + $this->yyTracePrompt, + $yyNewState); fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt); - for ($i = 1; $i <= $this->yyidx; $i ++) { - fprintf($this->yyTraceFILE, " %s", $this->yyTokenName[ $this->yystack[ $i ]->major ]); + for ($i = 1; $i <= $this->yyidx; $i++) { + fprintf($this->yyTraceFILE, + " %s", + $this->yyTokenName[ $this->yystack[ $i ]->major ]); } fwrite($this->yyTraceFILE, "\n"); } } - public static $yyRuleInfo = array(array(0 => 62, 1 => 1), array(0 => 63, 1 => 1), array(0 => 63, 1 => 2), - array(0 => 63, 1 => 0), array(0 => 64, 1 => 1), array(0 => 64, 1 => 1), - array(0 => 64, 1 => 1), array(0 => 64, 1 => 1), array(0 => 67, 1 => 1), - array(0 => 67, 1 => 2), array(0 => 64, 1 => 1), array(0 => 64, 1 => 1), - array(0 => 66, 1 => 2), array(0 => 66, 1 => 3), array(0 => 68, 1 => 2), - array(0 => 68, 1 => 0), array(0 => 69, 1 => 1), array(0 => 69, 1 => 1), - array(0 => 65, 1 => 2), array(0 => 65, 1 => 1), array(0 => 70, 1 => 2), - array(0 => 70, 1 => 3), array(0 => 70, 1 => 2), array(0 => 70, 1 => 3), - array(0 => 70, 1 => 2), array(0 => 70, 1 => 3), array(0 => 70, 1 => 4), - array(0 => 70, 1 => 4), array(0 => 70, 1 => 5), array(0 => 70, 1 => 5), - array(0 => 65, 1 => 1), array(0 => 70, 1 => 3), array(0 => 70, 1 => 2), - array(0 => 70, 1 => 4), array(0 => 70, 1 => 5), array(0 => 70, 1 => 6), - array(0 => 70, 1 => 2), array(0 => 70, 1 => 2), array(0 => 70, 1 => 3), - array(0 => 70, 1 => 2), array(0 => 70, 1 => 3), array(0 => 70, 1 => 8), - array(0 => 79, 1 => 2), array(0 => 79, 1 => 1), array(0 => 70, 1 => 5), - array(0 => 70, 1 => 7), array(0 => 70, 1 => 2), array(0 => 70, 1 => 6), - array(0 => 70, 1 => 8), array(0 => 70, 1 => 6), array(0 => 70, 1 => 8), - array(0 => 70, 1 => 3), array(0 => 70, 1 => 4), array(0 => 70, 1 => 2), - array(0 => 65, 1 => 1), array(0 => 70, 1 => 2), array(0 => 70, 1 => 3), - array(0 => 70, 1 => 4), array(0 => 70, 1 => 5), array(0 => 72, 1 => 2), - array(0 => 72, 1 => 1), array(0 => 72, 1 => 0), array(0 => 82, 1 => 4), - array(0 => 82, 1 => 2), array(0 => 82, 1 => 2), array(0 => 82, 1 => 2), - array(0 => 82, 1 => 2), array(0 => 82, 1 => 2), array(0 => 82, 1 => 4), - array(0 => 78, 1 => 1), array(0 => 78, 1 => 3), array(0 => 77, 1 => 3), - array(0 => 77, 1 => 3), array(0 => 77, 1 => 3), array(0 => 77, 1 => 3), - array(0 => 74, 1 => 1), array(0 => 74, 1 => 1), array(0 => 74, 1 => 3), - array(0 => 74, 1 => 3), array(0 => 74, 1 => 3), array(0 => 74, 1 => 1), - array(0 => 74, 1 => 2), array(0 => 74, 1 => 3), array(0 => 74, 1 => 3), - array(0 => 74, 1 => 2), array(0 => 74, 1 => 3), array(0 => 74, 1 => 3), - array(0 => 83, 1 => 7), array(0 => 83, 1 => 7), array(0 => 73, 1 => 1), - array(0 => 73, 1 => 2), array(0 => 73, 1 => 2), array(0 => 73, 1 => 2), - array(0 => 73, 1 => 2), array(0 => 73, 1 => 1), array(0 => 73, 1 => 1), - array(0 => 73, 1 => 3), array(0 => 73, 1 => 2), array(0 => 73, 1 => 2), - array(0 => 73, 1 => 1), array(0 => 73, 1 => 1), array(0 => 73, 1 => 3), - array(0 => 73, 1 => 3), array(0 => 73, 1 => 3), array(0 => 73, 1 => 1), - array(0 => 73, 1 => 1), array(0 => 73, 1 => 3), array(0 => 73, 1 => 1), - array(0 => 73, 1 => 2), array(0 => 73, 1 => 1), array(0 => 73, 1 => 3), - array(0 => 89, 1 => 1), array(0 => 89, 1 => 1), array(0 => 71, 1 => 1), - array(0 => 71, 1 => 1), array(0 => 71, 1 => 3), array(0 => 71, 1 => 1), - array(0 => 71, 1 => 3), array(0 => 71, 1 => 4), array(0 => 71, 1 => 3), - array(0 => 71, 1 => 4), array(0 => 75, 1 => 2), array(0 => 75, 1 => 2), - array(0 => 93, 1 => 2), array(0 => 93, 1 => 0), array(0 => 94, 1 => 2), - array(0 => 94, 1 => 2), array(0 => 94, 1 => 4), array(0 => 94, 1 => 2), - array(0 => 94, 1 => 2), array(0 => 94, 1 => 4), array(0 => 94, 1 => 3), - array(0 => 94, 1 => 5), array(0 => 94, 1 => 3), array(0 => 94, 1 => 3), - array(0 => 94, 1 => 3), array(0 => 94, 1 => 3), array(0 => 94, 1 => 3), - array(0 => 94, 1 => 3), array(0 => 94, 1 => 2), array(0 => 80, 1 => 1), - array(0 => 80, 1 => 1), array(0 => 80, 1 => 2), array(0 => 95, 1 => 1), - array(0 => 95, 1 => 1), array(0 => 95, 1 => 3), array(0 => 92, 1 => 2), - array(0 => 96, 1 => 1), array(0 => 96, 1 => 2), array(0 => 97, 1 => 3), - array(0 => 97, 1 => 3), array(0 => 97, 1 => 5), array(0 => 97, 1 => 6), - array(0 => 97, 1 => 2), array(0 => 88, 1 => 4), array(0 => 98, 1 => 4), - array(0 => 98, 1 => 4), array(0 => 99, 1 => 3), array(0 => 99, 1 => 1), - array(0 => 99, 1 => 0), array(0 => 76, 1 => 3), array(0 => 76, 1 => 2), - array(0 => 100, 1 => 3), array(0 => 100, 1 => 2), array(0 => 81, 1 => 2), - array(0 => 81, 1 => 0), array(0 => 101, 1 => 2), array(0 => 101, 1 => 2), - array(0 => 91, 1 => 1), array(0 => 91, 1 => 2), array(0 => 91, 1 => 1), - array(0 => 91, 1 => 2), array(0 => 91, 1 => 3), array(0 => 86, 1 => 1), - array(0 => 86, 1 => 1), array(0 => 85, 1 => 1), array(0 => 87, 1 => 1), - array(0 => 84, 1 => 3), array(0 => 102, 1 => 1), array(0 => 102, 1 => 3), - array(0 => 102, 1 => 0), array(0 => 103, 1 => 3), array(0 => 103, 1 => 3), - array(0 => 103, 1 => 1), array(0 => 90, 1 => 2), array(0 => 90, 1 => 3), - array(0 => 104, 1 => 2), array(0 => 104, 1 => 1), array(0 => 105, 1 => 3), - array(0 => 105, 1 => 3), array(0 => 105, 1 => 1), array(0 => 105, 1 => 3), - array(0 => 105, 1 => 3), array(0 => 105, 1 => 1), array(0 => 105, 1 => 1),); - - public static $yyReduceMap = array(0 => 0, 1 => 1, 2 => 2, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 16 => 8, 17 => 8, - 43 => 8, 66 => 8, 67 => 8, 75 => 8, 76 => 8, 80 => 8, 89 => 8, 94 => 8, 95 => 8, - 100 => 8, 104 => 8, 105 => 8, 109 => 8, 111 => 8, 116 => 8, 178 => 8, 183 => 8, - 9 => 9, 10 => 10, 11 => 11, 12 => 12, 15 => 12, 13 => 13, 74 => 13, 14 => 14, - 90 => 14, 92 => 14, 93 => 14, 123 => 14, 18 => 18, 19 => 19, 20 => 20, 22 => 20, - 24 => 20, 21 => 21, 23 => 21, 25 => 21, 26 => 26, 27 => 26, 28 => 28, 29 => 29, - 30 => 30, 31 => 31, 32 => 32, 33 => 33, 34 => 34, 35 => 35, 36 => 36, 37 => 37, - 38 => 38, 40 => 38, 39 => 39, 41 => 41, 42 => 42, 44 => 44, 45 => 45, 46 => 46, - 47 => 47, 49 => 47, 48 => 48, 50 => 48, 51 => 51, 52 => 52, 53 => 53, 54 => 54, - 55 => 55, 56 => 56, 57 => 57, 58 => 58, 59 => 59, 60 => 60, 69 => 60, 158 => 60, - 162 => 60, 166 => 60, 167 => 60, 61 => 61, 159 => 61, 165 => 61, 62 => 62, - 63 => 63, 64 => 63, 65 => 65, 143 => 65, 68 => 68, 70 => 70, 71 => 71, 72 => 71, - 73 => 73, 77 => 77, 78 => 78, 79 => 78, 81 => 81, 108 => 81, 82 => 82, 83 => 83, - 84 => 84, 85 => 85, 86 => 86, 87 => 87, 88 => 88, 91 => 91, 96 => 96, 97 => 97, - 98 => 98, 99 => 99, 101 => 101, 102 => 102, 103 => 102, 106 => 106, 107 => 107, - 110 => 110, 112 => 112, 113 => 113, 114 => 114, 115 => 115, 117 => 117, - 118 => 118, 119 => 119, 120 => 120, 121 => 121, 122 => 122, 124 => 124, - 180 => 124, 125 => 125, 126 => 126, 127 => 127, 128 => 128, 129 => 129, - 130 => 130, 138 => 130, 131 => 131, 132 => 132, 133 => 133, 134 => 133, - 136 => 133, 137 => 133, 135 => 135, 139 => 139, 140 => 140, 141 => 141, - 184 => 141, 142 => 142, 144 => 144, 145 => 145, 146 => 146, 147 => 147, - 148 => 148, 149 => 149, 150 => 150, 151 => 151, 152 => 152, 153 => 153, - 154 => 154, 155 => 155, 156 => 156, 157 => 157, 160 => 160, 161 => 161, - 163 => 163, 164 => 164, 168 => 168, 169 => 169, 170 => 170, 171 => 171, - 172 => 172, 173 => 173, 174 => 174, 175 => 175, 176 => 176, 177 => 177, - 179 => 179, 181 => 181, 182 => 182, 185 => 185, 186 => 186, 187 => 187, - 188 => 188, 189 => 188, 191 => 188, 190 => 190, 192 => 192, 193 => 193, - 194 => 194,); - - #line 218 "../smarty/lexer/smarty_internal_templateparser.y" + #line 242 "../smarty/lexer/smarty_internal_templateparser.y" + function yy_r0() { $this->root_buffer->prepend_array($this, $this->template_prefix); @@ -1448,431 +2045,472 @@ class Smarty_Internal_Templateparser $this->_retvalue = $this->root_buffer->to_smarty_php($this); } - #line 228 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r1() - { - if ($this->yystack[ $this->yyidx + 0 ]->minor != null) { - $this->current_buffer->append_subtree($this, $this->yystack[ $this->yyidx + 0 ]->minor); - } - } - - #line 235 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r2() - { - if ($this->yystack[ $this->yyidx + 0 ]->minor != null) { - // because of possible code injection - $this->current_buffer->append_subtree($this, $this->yystack[ $this->yyidx + 0 ]->minor); - } - } - - #line 249 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r4() - { - if ($this->compiler->has_code) { - $this->_retvalue = $this->mergePrefixCode($this->yystack[ $this->yyidx + 0 ]->minor); - } else { - $this->_retvalue = null; - } - $this->compiler->has_variable_string = false; - $this->block_nesting_level = count($this->compiler->_tag_stack); - } - - #line 260 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r5() - { - $this->_retvalue = new Smarty_Internal_ParseTree_Text($this->yystack[ $this->yyidx + 0 ]->minor); - } + #line 251 "../smarty/lexer/smarty_internal_templateparser.y" - #line 264 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r6() + function yy_r1() { $code = $this->compiler->compileTag('private_php', array(array('code' => $this->yystack[ $this->yyidx + 0 ]->minor), - array('type' => $this->lex->phpType)), array()); + array('type' => $this->lex->phpType)), + array()); if ($this->compiler->has_code && !empty($code)) { $tmp = ''; foreach ($this->compiler->prefix_code as $code) { $tmp .= $code; } $this->compiler->prefix_code = array(); - $this->_retvalue = - new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp . $code, true)); - } else { - $this->_retvalue = null; + $this->current_buffer->append_subtree($this, + new Smarty_Internal_ParseTree_Tag($this, + $this->compiler->processNocacheCode($tmp . + $code, + true))); } } - #line 275 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r7() + #line 255 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r2() { - $this->_retvalue = $this->compiler->processText($this->yystack[ $this->yyidx + 0 ]->minor); + $this->current_buffer->append_subtree($this, + $this->compiler->processText($this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 279 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r8() + #line 259 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r3() { - $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; + $this->strip = true; } - #line 283 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r9() + #line 264 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r4() { - $this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; + $this->strip = false; } - #line 288 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r10() + #line 269 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r5() { - $this->strip = true; + $this->current_buffer->append_subtree($this, + new Smarty_Internal_ParseTree_Text($this->yystack[ $this->yyidx + + -1 ]->minor)); } - #line 292 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r11() + #line 272 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r6() { - $this->strip = false; + $this->_retvalue = $this->yystack[ $this->yyidx + -3 ]->minor . $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 297 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r12() + #line 276 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r7() { - $this->_retvalue = ''; + $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 301 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r13() + #line 281 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r8() { - $this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor; + $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 305 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r14() + #line 285 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r9() { - $this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; + $this->_retvalue = ''; } - #line 321 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r18() + #line 297 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r10() { - $this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor; + if ($this->compiler->has_code) { + $this->current_buffer->append_subtree($this, + $this->mergePrefixCode($this->yystack[ $this->yyidx + 0 ]->minor)); + } + $this->compiler->has_variable_string = false; + $this->block_nesting_level = count($this->compiler->_tag_stack); } - #line 327 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r19() + #line 307 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r12() { - $var = - trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, $this->lex->ldel_length, - $this->lex->rdel_length), - ' $'); + $var = trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, + $this->compiler->getLdelLength(), + -$this->compiler->getRdelLength()), + ' $'); if (preg_match('/^(.*)(\s+nocache)$/', $var, $match)) { - $this->_retvalue = $this->compiler->compileTag('private_print_expression', array('nocache'), + $this->_retvalue = $this->compiler->compileTag('private_print_expression', + array('nocache'), array('value' => $this->compiler->compileVariable('\'' . $match[ 1 ] . '\''))); } else { - $this->_retvalue = $this->compiler->compileTag('private_print_expression', array(), + $this->_retvalue = $this->compiler->compileTag('private_print_expression', + array(), array('value' => $this->compiler->compileVariable('\'' . $var . '\''))); } } - #line 337 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r20() + #line 328 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r13() { - $this->_retvalue = $this->compiler->compileTag('private_print_expression', array(), - array('value' => $this->yystack[ $this->yyidx + 0 ]->minor)); + $tag = trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, + $this->compiler->getLdelLength(), + -$this->compiler->getRdelLength())); + if ($tag == 'strip') { + $this->strip = true; + $this->_retvalue = null;; + } else { + if (defined($tag)) { + if ($this->security) { + $this->security->isTrustedConstant($tag, $this->compiler); + } + $this->_retvalue = + $this->compiler->compileTag('private_print_expression', array(), array('value' => $tag)); + } else { + if (preg_match('/^(.*)(\s+nocache)$/', $tag, $match)) { + $this->_retvalue = $this->compiler->compileTag($match[ 1 ], array('\'nocache\'')); + } else { + $this->_retvalue = $this->compiler->compileTag($tag, array()); + } + } + } } - #line 341 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r21() + #line 339 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r14() { - $this->_retvalue = - $this->compiler->compileTag('private_print_expression', $this->yystack[ $this->yyidx + 0 ]->minor, - array('value' => $this->yystack[ $this->yyidx + - 1 ]->minor)); + $j = strrpos($this->yystack[ $this->yyidx + 0 ]->minor, '.'); + if ($this->yystack[ $this->yyidx + 0 ]->minor[ $j + 1 ] == 'c') { + // {$smarty.block.child} + $this->_retvalue = + $this->compiler->compileTag('child', array(), array($this->yystack[ $this->yyidx + 0 ]->minor));; + } else { + // {$smarty.block.parent} + $this->_retvalue = + $this->compiler->compileTag('parent', array(), array($this->yystack[ $this->yyidx + 0 ]->minor));; + } } - #line 364 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r26() + #line 343 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r15() { - $this->_retvalue = $this->compiler->compileTag('assign', array(array('value' => $this->yystack[ $this->yyidx + - 0 ]->minor), - array('var' => '\'' . - substr($this->yystack[ $this->yyidx + - - 2 ]->minor, - 1) . '\''))); + $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 372 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r28() + #line 347 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r16() + { + $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; + } + + #line 356 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r17() + { + $this->_retvalue = $this->compiler->compileTag('private_print_expression', + $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ], + array('value' => $this->yystack[ $this->yyidx + + 0 ]->minor[ 0 ])); + } + + #line 360 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r18() { $this->_retvalue = $this->compiler->compileTag('assign', array_merge(array(array('value' => $this->yystack[ $this->yyidx + - - 1 ]->minor), + 0 ]->minor[ 0 ]), array('var' => '\'' . substr($this->yystack[ $this->yyidx + - - 3 ]->minor, + -1 ]->minor, 1) . '\'')), - $this->yystack[ $this->yyidx + 0 ]->minor)); + $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ])); } - #line 376 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r29() + #line 364 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r19() { $this->_retvalue = $this->compiler->compileTag('assign', array_merge(array(array('value' => $this->yystack[ $this->yyidx + - - 1 ]->minor), + 0 ]->minor[ 0 ]), array('var' => $this->yystack[ $this->yyidx + - - 3 ]->minor[ 'var' ])), - $this->yystack[ $this->yyidx + 0 ]->minor), + -1 ]->minor[ 'var' ])), + $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]), array('smarty_internal_index' => $this->yystack[ $this->yyidx + - - 3 ]->minor[ 'smarty_internal_index' ])); + -1 ]->minor[ 'smarty_internal_index' ])); } - #line 381 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r30() + #line 368 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r20() { - $tag = - trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, $this->lex->ldel_length, - $this->lex->rdel_length)); - if ($tag == 'strip') { - $this->strip = true; - $this->_retvalue = null;; - } else { - if (defined($tag)) { - if ($this->security) { - $this->security->isTrustedConstant($tag, $this->compiler); - } - $this->_retvalue = - $this->compiler->compileTag('private_print_expression', array(), array('value' => $tag)); - } else { - if (preg_match('/^(.*)(\s+nocache)$/', $tag, $match)) { - $this->_retvalue = $this->compiler->compileTag($match[ 1 ], array("'nocache'")); - } else { - $this->_retvalue = $this->compiler->compileTag($tag, array()); - } - } - } + $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 403 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r31() + #line 383 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r21() { - if (defined($this->yystack[ $this->yyidx + - 1 ]->minor)) { + $this->_retvalue = array($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor); + } + + #line 393 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r25() + { + if (defined($this->yystack[ $this->yyidx + -1 ]->minor)) { if ($this->security) { - $this->security->isTrustedConstant($this->yystack[ $this->yyidx + - 1 ]->minor, $this->compiler); + $this->security->isTrustedConstant($this->yystack[ $this->yyidx + -1 ]->minor, $this->compiler); } - $this->_retvalue = - $this->compiler->compileTag('private_print_expression', $this->yystack[ $this->yyidx + 0 ]->minor, - array('value' => $this->yystack[ $this->yyidx + - 1 ]->minor)); + $this->_retvalue = $this->compiler->compileTag('private_print_expression', + $this->yystack[ $this->yyidx + 0 ]->minor, + array('value' => $this->yystack[ $this->yyidx + + -1 ]->minor)); } else { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + - 1 ]->minor, + $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor); } } - #line 413 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r32() + #line 406 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r26() { if (defined($this->yystack[ $this->yyidx + 0 ]->minor)) { if ($this->security) { $this->security->isTrustedConstant($this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler); } - $this->_retvalue = $this->compiler->compileTag('private_print_expression', array(), + $this->_retvalue = $this->compiler->compileTag('private_print_expression', + array(), array('value' => $this->yystack[ $this->yyidx + 0 ]->minor)); } else { $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + 0 ]->minor, array()); } } - #line 426 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r33() + #line 418 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r27() { - if (defined($this->yystack[ $this->yyidx + - 2 ]->minor)) { + if (defined($this->yystack[ $this->yyidx + -2 ]->minor)) { if ($this->security) { - $this->security->isTrustedConstant($this->yystack[ $this->yyidx + - 2 ]->minor, $this->compiler); + $this->security->isTrustedConstant($this->yystack[ $this->yyidx + -2 ]->minor, $this->compiler); } - $this->_retvalue = - $this->compiler->compileTag('private_print_expression', $this->yystack[ $this->yyidx + 0 ]->minor, - array('value' => $this->yystack[ $this->yyidx + - 2 ]->minor, - 'modifierlist' => $this->yystack[ $this->yyidx + - 1 ]->minor)); + $this->_retvalue = $this->compiler->compileTag('private_print_expression', + $this->yystack[ $this->yyidx + 0 ]->minor, + array('value' => $this->yystack[ $this->yyidx + + -2 ]->minor, + 'modifierlist' => $this->yystack[ $this->yyidx + + -1 ]->minor)); } else { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + - 2 ]->minor, + $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -2 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor, array('modifierlist' => $this->yystack[ $this->yyidx + - - 1 ]->minor)); + -1 ]->minor)); } } - #line 438 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r34() + #line 423 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r28() { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + - 3 ]->minor, + $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -3 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor, array('object_method' => $this->yystack[ $this->yyidx + - - 1 ]->minor)); + -1 ]->minor)); } - #line 443 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r35() + #line 428 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r29() { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + - 4 ]->minor, + $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -4 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor, - array('modifierlist' => $this->yystack[ $this->yyidx + - - 1 ]->minor, + array('modifierlist' => $this->yystack[ $this->yyidx + + -1 ]->minor, 'object_method' => $this->yystack[ $this->yyidx + - - 2 ]->minor)); + -2 ]->minor)); } - #line 448 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r36() + #line 433 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r30() { - $this->_retvalue = $this->compiler->compileTag('make_nocache', array(array('var' => '\'' . - substr($this->yystack[ $this->yyidx + - 0 ]->minor, - 1) . '\''))); + $this->_retvalue = $this->compiler->compileTag('make_nocache', + array(array('var' => '\'' . substr($this->yystack[ $this->yyidx + + 0 ]->minor, + 1) . '\''))); } - #line 453 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r37() + #line 438 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r31() { - $tag = trim(substr($this->yystack[ $this->yyidx + - 1 ]->minor, $this->lex->ldel_length)); - $this->_retvalue = $this->compiler->compileTag(($tag == 'else if') ? 'elseif' : $tag, array(), + $tag = trim(substr($this->yystack[ $this->yyidx + -1 ]->minor, $this->compiler->getLdelLength())); + $this->_retvalue = $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag, + array(), array('if condition' => $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 458 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r38() + #line 443 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r32() { - $tag = trim(substr($this->yystack[ $this->yyidx + - 2 ]->minor, $this->lex->ldel_length)); - $this->_retvalue = $this->compiler->compileTag(($tag == 'else if') ? 'elseif' : $tag, + $tag = trim(substr($this->yystack[ $this->yyidx + -2 ]->minor, $this->compiler->getLdelLength())); + $this->_retvalue = $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag, $this->yystack[ $this->yyidx + 0 ]->minor, array('if condition' => $this->yystack[ $this->yyidx + - - 1 ]->minor)); + -1 ]->minor)); } - #line 463 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r39() + #line 454 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r33() { - $tag = trim(substr($this->yystack[ $this->yyidx + - 1 ]->minor, $this->lex->ldel_length)); - $this->_retvalue = $this->compiler->compileTag(($tag == 'else if') ? 'elseif' : $tag, array(), + $tag = trim(substr($this->yystack[ $this->yyidx + -1 ]->minor, $this->compiler->getLdelLength())); + $this->_retvalue = $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag, + array(), array('if condition' => $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 474 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r41() + #line 458 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r35() { - $this->_retvalue = $this->compiler->compileTag('for', array_merge($this->yystack[ $this->yyidx + 0 ]->minor, - array(array('start' => $this->yystack[ $this->yyidx + - - 6 ]->minor), - array('ifexp' => $this->yystack[ $this->yyidx + - - 4 ]->minor), - array('var' => $this->yystack[ $this->yyidx + - - 2 ]->minor), - array('step' => $this->yystack[ $this->yyidx + - - 1 ]->minor))), + $this->_retvalue = $this->compiler->compileTag('for', + array_merge($this->yystack[ $this->yyidx + 0 ]->minor, + array(array('start' => $this->yystack[ $this->yyidx + + -6 ]->minor), + array('ifexp' => $this->yystack[ $this->yyidx + + -4 ]->minor), + array('var' => $this->yystack[ $this->yyidx + + -2 ]->minor), + array('step' => $this->yystack[ $this->yyidx + + -1 ]->minor))), 1); } - #line 478 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r42() + #line 466 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r36() { $this->_retvalue = '=' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 486 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r44() + #line 470 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r38() { - $this->_retvalue = $this->compiler->compileTag('for', array_merge($this->yystack[ $this->yyidx + 0 ]->minor, - array(array('start' => $this->yystack[ $this->yyidx + - - 3 ]->minor), - array('to' => $this->yystack[ $this->yyidx + - - 1 ]->minor))), + $this->_retvalue = $this->compiler->compileTag('for', + array_merge($this->yystack[ $this->yyidx + 0 ]->minor, + array(array('start' => $this->yystack[ $this->yyidx + + -3 ]->minor), + array('to' => $this->yystack[ $this->yyidx + + -1 ]->minor))), 0); } - #line 490 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r45() + #line 475 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r39() { - $this->_retvalue = $this->compiler->compileTag('for', array_merge($this->yystack[ $this->yyidx + 0 ]->minor, - array(array('start' => $this->yystack[ $this->yyidx + - - 5 ]->minor), - array('to' => $this->yystack[ $this->yyidx + - - 3 ]->minor), - array('step' => $this->yystack[ $this->yyidx + - - 1 ]->minor))), + $this->_retvalue = $this->compiler->compileTag('for', + array_merge($this->yystack[ $this->yyidx + 0 ]->minor, + array(array('start' => $this->yystack[ $this->yyidx + + -5 ]->minor), + array('to' => $this->yystack[ $this->yyidx + + -3 ]->minor), + array('step' => $this->yystack[ $this->yyidx + + -1 ]->minor))), 0); } - #line 495 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r46() + #line 479 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r40() { - $this->_retvalue = $this->compiler->compileTag('foreach', $this->yystack[ $this->yyidx + 0 ]->minor); + $this->_retvalue = $this->compiler->compileTag('foreach', + array_merge($this->yystack[ $this->yyidx + 0 ]->minor, + array(array('from' => $this->yystack[ $this->yyidx + + -3 ]->minor), + array('item' => $this->yystack[ $this->yyidx + + -1 ]->minor)))); } - #line 500 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r47() + #line 482 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r41() { - $this->_retvalue = $this->compiler->compileTag('foreach', array_merge($this->yystack[ $this->yyidx + 0 ]->minor, - array(array('from' => $this->yystack[ $this->yyidx + - - 3 ]->minor), - array('item' => $this->yystack[ $this->yyidx + - - 1 ]->minor)))); + $this->_retvalue = $this->compiler->compileTag('foreach', + array_merge($this->yystack[ $this->yyidx + 0 ]->minor, + array(array('from' => $this->yystack[ $this->yyidx + + -5 ]->minor), + array('item' => $this->yystack[ $this->yyidx + + -1 ]->minor), + array('key' => $this->yystack[ $this->yyidx + + -3 ]->minor)))); } - #line 504 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r48() + #line 487 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r42() { - $this->_retvalue = $this->compiler->compileTag('foreach', array_merge($this->yystack[ $this->yyidx + 0 ]->minor, - array(array('from' => $this->yystack[ $this->yyidx + - - 5 ]->minor), - array('item' => $this->yystack[ $this->yyidx + - - 1 ]->minor), - array('key' => $this->yystack[ $this->yyidx + - - 3 ]->minor)))); + $this->_retvalue = $this->compiler->compileTag('foreach', $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 517 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r51() + #line 491 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r43() { - $this->_retvalue = $this->compiler->compileTag('setfilter', array(), + $this->_retvalue = $this->compiler->compileTag('setfilter', + array(), array('modifier_list' => array(array_merge(array($this->yystack[ $this->yyidx + - - 1 ]->minor), + -1 ]->minor), $this->yystack[ $this->yyidx + 0 ]->minor)))); } - #line 521 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r52() + #line 497 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r44() { - $this->_retvalue = $this->compiler->compileTag('setfilter', array(), + $this->_retvalue = $this->compiler->compileTag('setfilter', + array(), array('modifier_list' => array_merge(array(array_merge(array($this->yystack[ $this->yyidx + - - 2 ]->minor), + -2 ]->minor), $this->yystack[ $this->yyidx + - - 1 ]->minor)), + -1 ]->minor)), $this->yystack[ $this->yyidx + 0 ]->minor))); } - #line 526 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r53() - { - $j = strrpos($this->yystack[ $this->yyidx + 0 ]->minor, '.'); - if ($this->yystack[ $this->yyidx + 0 ]->minor[ $j + 1 ] == 'c') { - // {$smarty.block.child} - $this->_retvalue = $this->compiler->compileTag('block_child', array());; - } else { - // {$smarty.block.parent} - $this->_retvalue = $this->compiler->compileTag('block_parent', array());; - } - } + #line 506 "../smarty/lexer/smarty_internal_templateparser.y" - #line 539 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r54() + function yy_r45() { - $tag = - trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, $this->lex->ldel_length, - $this->lex->rdel_length), - ' /'); - if ($tag == 'strip') { + $tag = trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, + $this->compiler->getLdelLength(), + -$this->compiler->getRdelLength()), + ' /'); + if ($tag === 'strip') { $this->strip = false; $this->_retvalue = null; } else { @@ -1880,222 +2518,269 @@ class Smarty_Internal_Templateparser } } - #line 548 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r55() + #line 510 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r46() { $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + 0 ]->minor . 'close', array()); } - #line 552 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r56() + #line 515 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r47() { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + - 1 ]->minor . 'close', array(), + $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -1 ]->minor . 'close', + array(), array('modifier_list' => $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 557 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r57() + #line 519 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r48() { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + - 2 ]->minor . 'close', array(), + $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -2 ]->minor . 'close', + array(), array('object_method' => $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 561 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r58() + #line 527 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r49() { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + - 3 ]->minor . 'close', array(), + $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -3 ]->minor . 'close', + array(), array('object_method' => $this->yystack[ $this->yyidx + - - 1 ]->minor, + -1 ]->minor, 'modifier_list' => $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 569 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r59() + #line 533 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r50() { - $this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor; + $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; $this->_retvalue[] = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 575 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r60() + #line 538 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r51() { $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 580 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r61() + #line 543 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r52() { $this->_retvalue = array(); } - #line 585 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r62() + #line 554 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r53() { if (defined($this->yystack[ $this->yyidx + 0 ]->minor)) { if ($this->security) { $this->security->isTrustedConstant($this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler); } $this->_retvalue = - array($this->yystack[ $this->yyidx + - 2 ]->minor => $this->yystack[ $this->yyidx + 0 ]->minor); + array($this->yystack[ $this->yyidx + -2 ]->minor => $this->yystack[ $this->yyidx + 0 ]->minor); } else { $this->_retvalue = - array($this->yystack[ $this->yyidx + - 2 ]->minor => '\'' . $this->yystack[ $this->yyidx + 0 ]->minor . - '\''); + array($this->yystack[ $this->yyidx + -2 ]->minor => '\'' . $this->yystack[ $this->yyidx + 0 ]->minor . + '\''); } } - #line 596 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r63() + #line 562 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r54() { $this->_retvalue = - array(trim($this->yystack[ $this->yyidx + - 1 ]->minor, " =\n\r\t") => $this->yystack[ $this->yyidx + - 0 ]->minor); + array(trim($this->yystack[ $this->yyidx + -1 ]->minor, " =\n\r\t") => $this->yystack[ $this->yyidx + + 0 ]->minor); } - #line 604 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r65() + #line 574 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r56() { $this->_retvalue = '\'' . $this->yystack[ $this->yyidx + 0 ]->minor . '\''; } - #line 616 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r68() + #line 587 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r59() { $this->_retvalue = - array($this->yystack[ $this->yyidx + - 2 ]->minor => $this->yystack[ $this->yyidx + 0 ]->minor); + array($this->yystack[ $this->yyidx + -2 ]->minor => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 629 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r70() + #line 592 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r61() { - $this->yystack[ $this->yyidx + - 2 ]->minor[] = $this->yystack[ $this->yyidx + 0 ]->minor; - $this->_retvalue = $this->yystack[ $this->yyidx + - 2 ]->minor; + $this->yystack[ $this->yyidx + -2 ]->minor[] = $this->yystack[ $this->yyidx + 0 ]->minor; + $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor; } - #line 634 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r71() + #line 599 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r62() { - $this->_retvalue = array('var' => '\'' . substr($this->yystack[ $this->yyidx + - 2 ]->minor, 1) . '\'', + $this->_retvalue = array('var' => '\'' . substr($this->yystack[ $this->yyidx + -2 ]->minor, 1) . '\'', 'value' => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 641 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r73() + #line 603 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r64() { - $this->_retvalue = array('var' => $this->yystack[ $this->yyidx + - 2 ]->minor, + $this->_retvalue = array('var' => $this->yystack[ $this->yyidx + -2 ]->minor, 'value' => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 665 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r77() + #line 623 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r65() + { + $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; + } + + #line 628 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r68() { $this->_retvalue = - '$_smarty_tpl->getStreamVariable(\'' . substr($this->yystack[ $this->yyidx + - 2 ]->minor, 1) . '://' . + '$_smarty_tpl->getStreamVariable(\'' . substr($this->yystack[ $this->yyidx + -2 ]->minor, 1) . '://' . $this->yystack[ $this->yyidx + 0 ]->minor . '\')'; } - #line 670 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r78() + #line 642 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r69() { $this->_retvalue = - $this->yystack[ $this->yyidx + - 2 ]->minor . trim($this->yystack[ $this->yyidx + - 1 ]->minor) . + $this->yystack[ $this->yyidx + -2 ]->minor . trim($this->yystack[ $this->yyidx + -1 ]->minor) . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 684 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r81() + #line 648 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r72() { - $this->_retvalue = $this->compiler->compileTag('private_modifier', array(), - array('value' => $this->yystack[ $this->yyidx + - 1 ]->minor, + $this->_retvalue = $this->compiler->compileTag('private_modifier', + array(), + array('value' => $this->yystack[ $this->yyidx + + -1 ]->minor, 'modifierlist' => $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 690 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r82() + #line 652 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r73() { $this->_retvalue = - $this->yystack[ $this->yyidx + - 1 ]->minor[ 'pre' ] . $this->yystack[ $this->yyidx + - 2 ]->minor . - $this->yystack[ $this->yyidx + - 1 ]->minor[ 'op' ] . $this->yystack[ $this->yyidx + 0 ]->minor . ')'; + $this->yystack[ $this->yyidx + -1 ]->minor[ 'pre' ] . $this->yystack[ $this->yyidx + -2 ]->minor . + $this->yystack[ $this->yyidx + -1 ]->minor[ 'op' ] . $this->yystack[ $this->yyidx + 0 ]->minor . ')'; } - #line 694 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r83() + #line 656 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r74() { - $this->_retvalue = $this->yystack[ $this->yyidx + - 2 ]->minor . $this->yystack[ $this->yyidx + - 1 ]->minor . + $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 698 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r84() + #line 660 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r75() { - $this->_retvalue = - $this->yystack[ $this->yyidx + 0 ]->minor . $this->yystack[ $this->yyidx + - 1 ]->minor . ')'; + $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor . $this->yystack[ $this->yyidx + -1 ]->minor . ')'; } - #line 702 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r85() + #line 664 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r76() { - $this->_retvalue = 'in_array(' . $this->yystack[ $this->yyidx + - 2 ]->minor . ',' . - $this->yystack[ $this->yyidx + 0 ]->minor . ')'; + $this->_retvalue = + 'in_array(' . $this->yystack[ $this->yyidx + -2 ]->minor . ',' . $this->yystack[ $this->yyidx + 0 ]->minor . + ')'; } - #line 706 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r86() + #line 672 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r77() { - $this->_retvalue = 'in_array(' . $this->yystack[ $this->yyidx + - 2 ]->minor . ',(array)' . + $this->_retvalue = 'in_array(' . $this->yystack[ $this->yyidx + -2 ]->minor . ',(array)' . $this->yystack[ $this->yyidx + 0 ]->minor . ')'; } - #line 714 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r87() + #line 676 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r78() { - $this->_retvalue = $this->yystack[ $this->yyidx + - 5 ]->minor . ' ? ' . $this->compiler->compileVariable('\'' . - substr($this->yystack[ $this->yyidx + - - 2 ]->minor, - 1) . - '\'') . + $this->_retvalue = $this->yystack[ $this->yyidx + -5 ]->minor . ' ? ' . $this->compiler->compileVariable('\'' . + substr($this->yystack[ $this->yyidx + + -2 ]->minor, + 1) . + '\'') . ' : ' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 718 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r88() + #line 686 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r79() { $this->_retvalue = - $this->yystack[ $this->yyidx + - 5 ]->minor . ' ? ' . $this->yystack[ $this->yyidx + - 2 ]->minor . ' : ' . + $this->yystack[ $this->yyidx + -5 ]->minor . ' ? ' . $this->yystack[ $this->yyidx + -2 ]->minor . ' : ' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 733 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r91() + #line 691 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r81() + { + $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; + } + + #line 712 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r82() { $this->_retvalue = '!' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 754 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r96() + #line 716 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r87() { - $this->_retvalue = - $this->yystack[ $this->yyidx + - 2 ]->minor . '.' . $this->yystack[ $this->yyidx + 0 ]->minor; + $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . '.' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 758 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r97() + #line 720 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r88() { - $this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor . '.'; + $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . '.'; } - #line 762 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r98() + #line 725 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r89() { $this->_retvalue = '.' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 767 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r99() + #line 742 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r90() { if (defined($this->yystack[ $this->yyidx + 0 ]->minor)) { if ($this->security) { @@ -2107,90 +2792,99 @@ class Smarty_Internal_Templateparser } } - #line 784 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r101() + #line 746 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r92() { - $this->_retvalue = "(" . $this->yystack[ $this->yyidx + - 1 ]->minor . ")"; + $this->_retvalue = '(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')'; } - #line 788 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r102() + #line 764 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r93() { - $this->_retvalue = $this->yystack[ $this->yyidx + - 2 ]->minor . $this->yystack[ $this->yyidx + - 1 ]->minor . + $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 806 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r106() + #line 775 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r97() { $prefixVar = $this->compiler->getNewPrefixVariable(); - if ($this->yystack[ $this->yyidx + - 2 ]->minor[ 'var' ] == '\'smarty\'') { - $this->compiler->appendPrefixCode("<?php $prefixVar" . ' = ' . - $this->compiler->compileTag('private_special_variable', array(), + if ($this->yystack[ $this->yyidx + -2 ]->minor[ 'var' ] === '\'smarty\'') { + $this->compiler->appendPrefixCode("<?php {$prefixVar} = " . + $this->compiler->compileTag('private_special_variable', + array(), $this->yystack[ $this->yyidx + - - 2 ]->minor[ 'smarty_internal_index' ]) . + -2 ]->minor[ 'smarty_internal_index' ]) . ';?>'); } else { - $this->compiler->appendPrefixCode("<?php $prefixVar" . ' = ' . + $this->compiler->appendPrefixCode("<?php {$prefixVar} = " . $this->compiler->compileVariable($this->yystack[ $this->yyidx + - - 2 ]->minor[ 'var' ]) . - $this->yystack[ $this->yyidx + - 2 ]->minor[ 'smarty_internal_index' ] . + -2 ]->minor[ 'var' ]) . + $this->yystack[ $this->yyidx + -2 ]->minor[ 'smarty_internal_index' ] . ';?>'); } $this->_retvalue = $prefixVar . '::' . $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ] . $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]; } - #line 817 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r107() + #line 792 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r98() { $prefixVar = $this->compiler->getNewPrefixVariable(); $tmp = $this->compiler->appendCode('<?php ob_start();?>', $this->yystack[ $this->yyidx + 0 ]->minor); - $this->compiler->appendPrefixCode($this->compiler->appendCode($tmp, "<?php $prefixVar" . '=ob_get_clean();?>')); + $this->compiler->appendPrefixCode($this->compiler->appendCode($tmp, "<?php {$prefixVar} = ob_get_clean();?>")); $this->_retvalue = $prefixVar; } - #line 834 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r110() + #line 811 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r101() { - if (!in_array(strtolower($this->yystack[ $this->yyidx + - 2 ]->minor), array('self', 'parent')) && - (!$this->security || - $this->security->isTrustedStaticClassAccess($this->yystack[ $this->yyidx + - 2 ]->minor, - $this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler)) - ) { - if (isset($this->smarty->registered_classes[ $this->yystack[ $this->yyidx + - 2 ]->minor ])) { + if (!in_array(strtolower($this->yystack[ $this->yyidx + -2 ]->minor), array('self', 'parent')) && + (!$this->security || $this->security->isTrustedStaticClassAccess($this->yystack[ $this->yyidx + -2 ]->minor, + $this->yystack[ $this->yyidx + 0 ]->minor, + $this->compiler))) { + if (isset($this->smarty->registered_classes[ $this->yystack[ $this->yyidx + -2 ]->minor ])) { $this->_retvalue = - $this->smarty->registered_classes[ $this->yystack[ $this->yyidx + - 2 ]->minor ] . '::' . + $this->smarty->registered_classes[ $this->yystack[ $this->yyidx + -2 ]->minor ] . '::' . $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ] . $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]; } else { - $this->_retvalue = $this->yystack[ $this->yyidx + - 2 ]->minor . '::' . - $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ] . - $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]; + $this->_retvalue = + $this->yystack[ $this->yyidx + -2 ]->minor . '::' . $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ] . + $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]; } } else { - $this->compiler->trigger_template_error("static class '" . $this->yystack[ $this->yyidx + - 2 ]->minor . - "' is undefined or not allowed by security setting"); + $this->compiler->trigger_template_error('static class \'' . $this->yystack[ $this->yyidx + -2 ]->minor . + '\' is undefined or not allowed by security setting'); } } - #line 853 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r112() + #line 822 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r103() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 864 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r113() + #line 825 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r104() { $this->_retvalue = $this->compiler->compileVariable('\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . '\''); } - #line 867 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r114() + #line 838 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r105() { - if ($this->yystack[ $this->yyidx + 0 ]->minor[ 'var' ] == '\'smarty\'') { - $smarty_var = $this->compiler->compileTag('private_special_variable', array(), + if ($this->yystack[ $this->yyidx + 0 ]->minor[ 'var' ] === '\'smarty\'') { + $smarty_var = $this->compiler->compileTag('private_special_variable', + array(), $this->yystack[ $this->yyidx + 0 ]->minor[ 'smarty_internal_index' ]); $this->_retvalue = $smarty_var; @@ -2203,480 +2897,556 @@ class Smarty_Internal_Templateparser } } - #line 880 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r115() + #line 848 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r106() { - $this->_retvalue = '$_smarty_tpl->tpl_vars[' . $this->yystack[ $this->yyidx + - 2 ]->minor . ']->' . + $this->_retvalue = '$_smarty_tpl->tpl_vars[' . $this->yystack[ $this->yyidx + -2 ]->minor . ']->' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 890 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r117() + #line 852 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r108() { $this->_retvalue = - $this->compiler->compileConfigVariable("'" . $this->yystack[ $this->yyidx + - 1 ]->minor . "'"); + $this->compiler->compileConfigVariable('\'' . $this->yystack[ $this->yyidx + -1 ]->minor . '\''); } - #line 894 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r118() + #line 856 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r109() { $this->_retvalue = '(is_array($tmp = ' . - $this->compiler->compileConfigVariable("'" . $this->yystack[ $this->yyidx + - 2 ]->minor . - "'") . ') ? $tmp' . + $this->compiler->compileConfigVariable('\'' . $this->yystack[ $this->yyidx + -2 ]->minor . + '\'') . ') ? $tmp' . $this->yystack[ $this->yyidx + 0 ]->minor . ' :null)'; } - #line 898 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r119() + #line 860 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r110() { - $this->_retvalue = $this->compiler->compileConfigVariable($this->yystack[ $this->yyidx + - 1 ]->minor); + $this->_retvalue = $this->compiler->compileConfigVariable($this->yystack[ $this->yyidx + -1 ]->minor); } - #line 902 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r120() + #line 864 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r111() { $this->_retvalue = - '(is_array($tmp = ' . $this->compiler->compileConfigVariable($this->yystack[ $this->yyidx + - 2 ]->minor) . + '(is_array($tmp = ' . $this->compiler->compileConfigVariable($this->yystack[ $this->yyidx + -2 ]->minor) . ') ? $tmp' . $this->yystack[ $this->yyidx + 0 ]->minor . ' : null)'; } - #line 906 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r121() + #line 867 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r112() { - $this->_retvalue = array('var' => '\'' . substr($this->yystack[ $this->yyidx + - 1 ]->minor, 1) . '\'', + $this->_retvalue = array('var' => '\'' . substr($this->yystack[ $this->yyidx + -1 ]->minor, 1) . '\'', 'smarty_internal_index' => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 909 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r122() + #line 880 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r113() { - $this->_retvalue = array('var' => $this->yystack[ $this->yyidx + - 1 ]->minor, + $this->_retvalue = array('var' => $this->yystack[ $this->yyidx + -1 ]->minor, 'smarty_internal_index' => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 922 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r124() + #line 886 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r115() { return; } - #line 928 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r125() + #line 889 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r116() { $this->_retvalue = '[' . $this->compiler->compileVariable('\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . '\'') . ']'; } - #line 931 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r126() + #line 893 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r117() { $this->_retvalue = '[' . $this->compiler->compileVariable($this->yystack[ $this->yyidx + 0 ]->minor) . ']'; } - #line 935 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r127() + #line 897 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r118() { - $this->_retvalue = '[' . $this->compiler->compileVariable($this->yystack[ $this->yyidx + - 2 ]->minor) . '->' . + $this->_retvalue = '[' . $this->compiler->compileVariable($this->yystack[ $this->yyidx + -2 ]->minor) . '->' . $this->yystack[ $this->yyidx + 0 ]->minor . ']'; } - #line 939 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r128() + #line 901 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r119() { - $this->_retvalue = "['" . $this->yystack[ $this->yyidx + 0 ]->minor . "']"; + $this->_retvalue = '[\'' . $this->yystack[ $this->yyidx + 0 ]->minor . '\']'; } - #line 943 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r129() + #line 906 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r120() { $this->_retvalue = '[' . $this->yystack[ $this->yyidx + 0 ]->minor . ']'; } - #line 948 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r130() + #line 911 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r121() { - $this->_retvalue = '[' . $this->yystack[ $this->yyidx + - 1 ]->minor . ']'; + $this->_retvalue = '[' . $this->yystack[ $this->yyidx + -1 ]->minor . ']'; } - #line 953 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r131() + #line 915 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r122() { - $this->_retvalue = '[' . $this->compiler->compileTag('private_special_variable', array(), '[\'section\'][\'' . - $this->yystack[ $this->yyidx + - - 1 ]->minor . - '\'][\'index\']') . - ']'; + $this->_retvalue = '[' . $this->compiler->compileTag('private_special_variable', + array(), + '[\'section\'][\'' . + $this->yystack[ $this->yyidx + -1 ]->minor . + '\'][\'index\']') . ']'; } - #line 957 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r132() + #line 918 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r123() { - $this->_retvalue = '[' . $this->compiler->compileTag('private_special_variable', array(), '[\'section\'][\'' . - $this->yystack[ $this->yyidx + - - 3 ]->minor . - '\'][\'' . - $this->yystack[ $this->yyidx + - - 1 ]->minor . - '\']') . ']'; + $this->_retvalue = '[' . $this->compiler->compileTag('private_special_variable', + array(), + '[\'section\'][\'' . + $this->yystack[ $this->yyidx + -3 ]->minor . '\'][\'' . + $this->yystack[ $this->yyidx + -1 ]->minor . '\']') . ']'; } - #line 960 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r133() + #line 924 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r124() { - $this->_retvalue = '[' . $this->yystack[ $this->yyidx + - 1 ]->minor . ']'; + $this->_retvalue = '[' . $this->yystack[ $this->yyidx + -1 ]->minor . ']'; } - #line 966 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r135() + #line 940 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r126() { $this->_retvalue = '[' . $this->compiler->compileVariable('\'' . - substr($this->yystack[ $this->yyidx + - 1 ]->minor, + substr($this->yystack[ $this->yyidx + -1 ]->minor, 1) . '\'') . ']';; } - #line 982 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r139() + #line 950 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r130() { $this->_retvalue = '[]'; } - #line 992 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r140() + #line 954 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r131() { $this->_retvalue = '\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . '\''; } - #line 996 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r141() + #line 959 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r132() { - $this->_retvalue = "''"; + $this->_retvalue = '\'\''; } - #line 1001 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r142() + #line 967 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r133() { - $this->_retvalue = - $this->yystack[ $this->yyidx + - 1 ]->minor . '.' . $this->yystack[ $this->yyidx + 0 ]->minor; + $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . '.' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1009 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r144() + #line 973 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r135() { - $var = - trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, $this->lex->ldel_length, - $this->lex->rdel_length), - ' $'); + $var = trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, + $this->compiler->getLdelLength(), + -$this->compiler->getRdelLength()), + ' $'); $this->_retvalue = $this->compiler->compileVariable('\'' . $var . '\''); } - #line 1015 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r145() + #line 980 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r136() { - $this->_retvalue = '(' . $this->yystack[ $this->yyidx + - 1 ]->minor . ')'; + $this->_retvalue = '(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')'; } - #line 1022 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r146() + #line 989 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r137() { - if ($this->yystack[ $this->yyidx + - 1 ]->minor[ 'var' ] == '\'smarty\'') { - $this->_retvalue = $this->compiler->compileTag('private_special_variable', array(), + if ($this->yystack[ $this->yyidx + -1 ]->minor[ 'var' ] === '\'smarty\'') { + $this->_retvalue = $this->compiler->compileTag('private_special_variable', + array(), $this->yystack[ $this->yyidx + - - 1 ]->minor[ 'smarty_internal_index' ]) . + -1 ]->minor[ 'smarty_internal_index' ]) . $this->yystack[ $this->yyidx + 0 ]->minor; } else { - $this->_retvalue = $this->compiler->compileVariable($this->yystack[ $this->yyidx + - 1 ]->minor[ 'var' ]) . - $this->yystack[ $this->yyidx + - 1 ]->minor[ 'smarty_internal_index' ] . + $this->_retvalue = $this->compiler->compileVariable($this->yystack[ $this->yyidx + -1 ]->minor[ 'var' ]) . + $this->yystack[ $this->yyidx + -1 ]->minor[ 'smarty_internal_index' ] . $this->yystack[ $this->yyidx + 0 ]->minor; } } - #line 1031 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r147() + #line 994 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r138() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1036 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r148() + #line 999 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r139() { - $this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; + $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1041 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r149() + #line 1006 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r140() { - if ($this->security && substr($this->yystack[ $this->yyidx + - 1 ]->minor, 0, 1) == '_') { + if ($this->security && substr($this->yystack[ $this->yyidx + -1 ]->minor, 0, 1) === '_') { $this->compiler->trigger_template_error(self::Err1); } $this->_retvalue = - '->' . $this->yystack[ $this->yyidx + - 1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; + '->' . $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1048 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r150() + #line 1013 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r141() { if ($this->security) { $this->compiler->trigger_template_error(self::Err2); } - $this->_retvalue = '->{' . $this->compiler->compileVariable($this->yystack[ $this->yyidx + - 1 ]->minor) . + $this->_retvalue = '->{' . $this->compiler->compileVariable($this->yystack[ $this->yyidx + -1 ]->minor) . $this->yystack[ $this->yyidx + 0 ]->minor . '}'; } - #line 1055 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r151() + #line 1020 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r142() { if ($this->security) { $this->compiler->trigger_template_error(self::Err2); } $this->_retvalue = - '->{' . $this->yystack[ $this->yyidx + - 2 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor . '}'; + '->{' . $this->yystack[ $this->yyidx + -2 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor . '}'; } - #line 1062 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r152() + #line 1028 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r143() { if ($this->security) { $this->compiler->trigger_template_error(self::Err2); } - $this->_retvalue = '->{\'' . $this->yystack[ $this->yyidx + - 4 ]->minor . '\'.' . - $this->yystack[ $this->yyidx + - 2 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor . - '}'; + $this->_retvalue = + '->{\'' . $this->yystack[ $this->yyidx + -4 ]->minor . '\'.' . $this->yystack[ $this->yyidx + -2 ]->minor . + $this->yystack[ $this->yyidx + 0 ]->minor . '}'; } - #line 1070 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r153() + #line 1036 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r144() { $this->_retvalue = '->' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1078 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r154() + #line 1044 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r145() { - $this->_retvalue = $this->compiler->compilePHPFunctionCall($this->yystack[ $this->yyidx + - 3 ]->minor, - $this->yystack[ $this->yyidx + - 1 ]->minor); + $this->_retvalue = $this->compiler->compilePHPFunctionCall($this->yystack[ $this->yyidx + -3 ]->minor, + $this->yystack[ $this->yyidx + -1 ]->minor); } - #line 1086 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r155() + #line 1051 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r146() { - if ($this->security && substr($this->yystack[ $this->yyidx + - 3 ]->minor, 0, 1) == '_') { + if ($this->security && substr($this->yystack[ $this->yyidx + -3 ]->minor, 0, 1) === '_') { $this->compiler->trigger_template_error(self::Err1); } - $this->_retvalue = $this->yystack[ $this->yyidx + - 3 ]->minor . "(" . - implode(',', $this->yystack[ $this->yyidx + - 1 ]->minor) . ")"; + $this->_retvalue = $this->yystack[ $this->yyidx + -3 ]->minor . '(' . + implode(',', $this->yystack[ $this->yyidx + -1 ]->minor) . ')'; } - #line 1093 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r156() + #line 1062 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r147() { if ($this->security) { $this->compiler->trigger_template_error(self::Err2); } $prefixVar = $this->compiler->getNewPrefixVariable(); - $this->compiler->appendPrefixCode("<?php $prefixVar" . '=' . $this->compiler->compileVariable('\'' . - substr($this->yystack[ $this->yyidx + - - 3 ]->minor, - 1) . - '\'') . ';?>'); - $this->_retvalue = $prefixVar . '(' . implode(',', $this->yystack[ $this->yyidx + - 1 ]->minor) . ')'; + $this->compiler->appendPrefixCode("<?php {$prefixVar} = " . $this->compiler->compileVariable('\'' . + substr($this->yystack[ $this->yyidx + + -3 ]->minor, + 1) . '\'') . + ';?>'); + $this->_retvalue = $prefixVar . '(' . implode(',', $this->yystack[ $this->yyidx + -1 ]->minor) . ')'; } - #line 1104 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r157() + #line 1079 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r148() { $this->_retvalue = - array_merge($this->yystack[ $this->yyidx + - 2 ]->minor, array($this->yystack[ $this->yyidx + 0 ]->minor)); + array_merge($this->yystack[ $this->yyidx + -2 ]->minor, array($this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 1121 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r160() + #line 1083 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r151() { - $this->_retvalue = array_merge($this->yystack[ $this->yyidx + - 2 ]->minor, - array(array_merge($this->yystack[ $this->yyidx + - 1 ]->minor, + $this->_retvalue = array_merge($this->yystack[ $this->yyidx + -2 ]->minor, + array(array_merge($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor))); } - #line 1125 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r161() + #line 1091 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r152() { $this->_retvalue = - array(array_merge($this->yystack[ $this->yyidx + - 1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor)); + array(array_merge($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 1133 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r163() + #line 1099 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r154() { $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 1141 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r164() + #line 1118 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r155() { $this->_retvalue = - array_merge($this->yystack[ $this->yyidx + - 1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor); + array_merge($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 1160 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r168() + #line 1123 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r159() { $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor, '', 'method'); } - #line 1165 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r169() + #line 1128 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r160() { $this->_retvalue = - array($this->yystack[ $this->yyidx + - 1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor, 'method'); + array($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor, 'method'); } - #line 1170 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r170() + #line 1133 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r161() { $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor, ''); } - #line 1175 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r171() + #line 1138 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r162() { $this->_retvalue = - array($this->yystack[ $this->yyidx + - 1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor, 'property'); + array($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor, 'property'); } - #line 1180 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r172() + #line 1144 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r163() { - $this->_retvalue = array($this->yystack[ $this->yyidx + - 2 ]->minor, - $this->yystack[ $this->yyidx + - 1 ]->minor . - $this->yystack[ $this->yyidx + 0 ]->minor, 'property'); + $this->_retvalue = array($this->yystack[ $this->yyidx + -2 ]->minor, + $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor, + 'property'); } - #line 1186 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r173() + #line 1148 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r164() { $this->_retvalue = ' ' . trim($this->yystack[ $this->yyidx + 0 ]->minor) . ' '; } - #line 1190 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r174() - { - static $lops = - array('eq' => ' == ', 'ne' => ' != ', 'neq' => ' != ', 'gt' => ' > ', 'ge' => ' >= ', 'gte' => ' >= ', - 'lt' => ' < ', 'le' => ' <= ', 'lte' => ' <= ', 'mod' => ' % ', 'and' => ' && ', 'or' => ' || ', - 'xor' => ' xor ',); + #line 1167 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r165() + { + static $lops = array( + 'eq' => ' == ', + 'ne' => ' != ', + 'neq' => ' != ', + 'gt' => ' > ', + 'ge' => ' >= ', + 'gte' => ' >= ', + 'lt' => ' < ', + 'le' => ' <= ', + 'lte' => ' <= ', + 'mod' => ' % ', + 'and' => ' && ', + 'or' => ' || ', + 'xor' => ' xor ', + ); $op = strtolower(preg_replace('/\s*/', '', $this->yystack[ $this->yyidx + 0 ]->minor)); $this->_retvalue = $lops[ $op ]; } - #line 1209 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r175() + #line 1180 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r166() { - static $tlops = - array('isdivby' => array('op' => ' % ', 'pre' => '!('), 'isnotdivby' => array('op' => ' % ', 'pre' => '('), - 'isevenby' => array('op' => ' / ', 'pre' => '!(1 & '), - 'isnotevenby' => array('op' => ' / ', 'pre' => '(1 & '), - 'isoddby' => array('op' => ' / ', 'pre' => '(1 & '), - 'isnotoddby' => array('op' => ' / ', 'pre' => '!(1 & '),); + static $tlops = array( + 'isdivby' => array('op' => ' % ', 'pre' => '!('), + 'isnotdivby' => array('op' => ' % ', 'pre' => '('), + 'isevenby' => array('op' => ' / ', 'pre' => '!(1 & '), + 'isnotevenby' => array('op' => ' / ', 'pre' => '(1 & '), + 'isoddby' => array('op' => ' / ', 'pre' => '(1 & '), + 'isnotoddby' => array('op' => ' / ', 'pre' => '!(1 & '), + ); $op = strtolower(preg_replace('/\s*/', '', $this->yystack[ $this->yyidx + 0 ]->minor)); $this->_retvalue = $tlops[ $op ]; } - #line 1222 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r176() + #line 1194 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r167() { - static $scond = - array('iseven' => '!(1 & ', 'isnoteven' => '(1 & ', 'isodd' => '(1 & ', 'isnotodd' => '!(1 & ',); + static $scond = array( + 'iseven' => '!(1 & ', + 'isnoteven' => '(1 & ', + 'isodd' => '(1 & ', + 'isnotodd' => '!(1 & ', + ); $op = strtolower(str_replace(' ', '', $this->yystack[ $this->yyidx + 0 ]->minor)); $this->_retvalue = $scond[ $op ]; } - #line 1236 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r177() + #line 1202 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r168() { - $this->_retvalue = 'array(' . $this->yystack[ $this->yyidx + - 1 ]->minor . ')'; + $this->_retvalue = 'array(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')'; } - #line 1244 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r179() + #line 1210 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r170() { - $this->_retvalue = - $this->yystack[ $this->yyidx + - 2 ]->minor . ',' . $this->yystack[ $this->yyidx + 0 ]->minor; + $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . ',' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1252 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r181() + #line 1214 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r172() { $this->_retvalue = - $this->yystack[ $this->yyidx + - 2 ]->minor . '=>' . $this->yystack[ $this->yyidx + 0 ]->minor; + $this->yystack[ $this->yyidx + -2 ]->minor . '=>' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1256 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r182() + #line 1230 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r173() { $this->_retvalue = - '\'' . $this->yystack[ $this->yyidx + - 2 ]->minor . '\'=>' . $this->yystack[ $this->yyidx + 0 ]->minor; + '\'' . $this->yystack[ $this->yyidx + -2 ]->minor . '\'=>' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1272 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r185() + #line 1236 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r176() { - $this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor->to_smarty_php($this); + $this->compiler->leaveDoubleQuote(); + $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor->to_smarty_php($this); } - #line 1277 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r186() + #line 1241 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r177() { - $this->yystack[ $this->yyidx + - 1 ]->minor->append_subtree($this, $this->yystack[ $this->yyidx + 0 ]->minor); - $this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor; + $this->yystack[ $this->yyidx + -1 ]->minor->append_subtree($this, $this->yystack[ $this->yyidx + 0 ]->minor); + $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 1282 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r187() + #line 1245 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r178() { $this->_retvalue = new Smarty_Internal_ParseTree_Dq($this, $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 1286 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r188() + #line 1249 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r179() { - $this->_retvalue = new Smarty_Internal_ParseTree_Code('(string)' . $this->yystack[ $this->yyidx + - 1 ]->minor); + $this->_retvalue = new Smarty_Internal_ParseTree_Code('(string)' . $this->yystack[ $this->yyidx + -1 ]->minor); } - #line 1294 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r190() + #line 1253 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r180() + { + $this->_retvalue = + new Smarty_Internal_ParseTree_Code('(string)(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')'); + } + + #line 1265 "../smarty/lexer/smarty_internal_templateparser.y" + + function yy_r181() { $this->_retvalue = new Smarty_Internal_ParseTree_Code('(string)$_smarty_tpl->tpl_vars[\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . '\']->value'); } - #line 1302 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r192() - { - $this->_retvalue = - new Smarty_Internal_ParseTree_Code('(string)(' . $this->yystack[ $this->yyidx + - 1 ]->minor . ')'); - } + #line 1269 "../smarty/lexer/smarty_internal_templateparser.y" - #line 1306 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r193() + function yy_r184() { $this->_retvalue = new Smarty_Internal_ParseTree_Tag($this, $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 1310 "../smarty/lexer/smarty_internal_templateparser.y" - function yy_r194() + function yy_r185() { $this->_retvalue = new Smarty_Internal_ParseTree_DqContent($this->yystack[ $this->yyidx + 0 ]->minor); } - private $_retvalue; - public function yy_reduce($yyruleno) { - if ($this->yyTraceFILE && $yyruleno >= 0 && $yyruleno < count(self::$yyRuleName)) { - fprintf($this->yyTraceFILE, "%sReduce (%d) [%s].\n", $this->yyTracePrompt, $yyruleno, + if ($this->yyTraceFILE && $yyruleno >= 0 + && $yyruleno < count(self::$yyRuleName)) { + fprintf($this->yyTraceFILE, + "%sReduce (%d) [%s].\n", + $this->yyTracePrompt, + $yyruleno, self::$yyRuleName[ $yyruleno ]); } - $this->_retvalue = $yy_lefthand_side = null; if (isset(self::$yyReduceMap[ $yyruleno ])) { // call the action @@ -2687,14 +3457,14 @@ class Smarty_Internal_Templateparser $yygoto = self::$yyRuleInfo[ $yyruleno ][ 0 ]; $yysize = self::$yyRuleInfo[ $yyruleno ][ 1 ]; $this->yyidx -= $yysize; - for ($i = $yysize; $i; $i --) { + for ($i = $yysize; $i; $i--) { // pop all of the right-hand side parameters array_pop($this->yystack); } $yyact = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, $yygoto); if ($yyact < self::YYNSTATE) { if (!$this->yyTraceFILE && $yysize) { - $this->yyidx ++; + $this->yyidx++; $x = new TP_yyStackEntry; $x->stateno = $yyact; $x->major = $yygoto; @@ -2703,7 +3473,7 @@ class Smarty_Internal_Templateparser } else { $this->yy_shift($yyact, $yygoto, $yy_lefthand_side); } - } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) { + } else if ($yyact === self::YYNSTATE + self::YYNRULE + 1) { $this->yy_accept(); } } @@ -2720,8 +3490,7 @@ class Smarty_Internal_Templateparser public function yy_syntax_error($yymajor, $TOKEN) { - #line 200 "../smarty/lexer/smarty_internal_templateparser.y" - + #line 214 "../smarty/lexer/smarty_internal_templateparser.y" $this->internalError = true; $this->yymajor = $yymajor; $this->compiler->trigger_template_error(); @@ -2735,8 +3504,7 @@ class Smarty_Internal_Templateparser while ($this->yyidx >= 0) { $this->yy_pop_parser_stack(); } - #line 193 "../smarty/lexer/smarty_internal_templateparser.y" - + #line 207 "../smarty/lexer/smarty_internal_templateparser.y" $this->successful = !$this->internalError; $this->internalError = false; $this->retvalue = $this->_retvalue; @@ -2745,10 +3513,9 @@ class Smarty_Internal_Templateparser public function doParse($yymajor, $yytokenvalue) { $yyerrorhit = 0; /* True if yymajor has invoked an error */ - if ($this->yyidx === null || $this->yyidx < 0) { $this->yyidx = 0; - $this->yyerrcnt = - 1; + $this->yyerrcnt = -1; $x = new TP_yyStackEntry; $x->stateno = 0; $x->major = 0; @@ -2756,53 +3523,61 @@ class Smarty_Internal_Templateparser $this->yystack[] = $x; } $yyendofinput = ($yymajor == 0); - if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sInput %s\n", $this->yyTracePrompt, $this->yyTokenName[ $yymajor ]); + fprintf($this->yyTraceFILE, + "%sInput %s\n", + $this->yyTracePrompt, + $this->yyTokenName[ $yymajor ]); } - do { $yyact = $this->yy_find_shift_action($yymajor); - if ($yymajor < self::YYERRORSYMBOL && !$this->yy_is_expected_token($yymajor)) { + if ($yymajor < self::YYERRORSYMBOL && + !$this->yy_is_expected_token($yymajor)) { // force a syntax error $yyact = self::YY_ERROR_ACTION; } if ($yyact < self::YYNSTATE) { $this->yy_shift($yyact, $yymajor, $yytokenvalue); - $this->yyerrcnt --; + $this->yyerrcnt--; if ($yyendofinput && $this->yyidx >= 0) { $yymajor = 0; } else { $yymajor = self::YYNOCODE; } - } elseif ($yyact < self::YYNSTATE + self::YYNRULE) { + } else if ($yyact < self::YYNSTATE + self::YYNRULE) { $this->yy_reduce($yyact - self::YYNSTATE); - } elseif ($yyact == self::YY_ERROR_ACTION) { + } else if ($yyact === self::YY_ERROR_ACTION) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sSyntax Error!\n", $this->yyTracePrompt); + fprintf($this->yyTraceFILE, + "%sSyntax Error!\n", + $this->yyTracePrompt); } if (self::YYERRORSYMBOL) { if ($this->yyerrcnt < 0) { $this->yy_syntax_error($yymajor, $yytokenvalue); } $yymx = $this->yystack[ $this->yyidx ]->major; - if ($yymx == self::YYERRORSYMBOL || $yyerrorhit) { + if ($yymx === self::YYERRORSYMBOL || $yyerrorhit) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sDiscard input token %s\n", $this->yyTracePrompt, + fprintf($this->yyTraceFILE, + "%sDiscard input token %s\n", + $this->yyTracePrompt, $this->yyTokenName[ $yymajor ]); } $this->yy_destructor($yymajor, $yytokenvalue); $yymajor = self::YYNOCODE; } else { - while ($this->yyidx >= 0 && $yymx != self::YYERRORSYMBOL && - ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE) { + while ($this->yyidx >= 0 && + $yymx !== self::YYERRORSYMBOL && + ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE + ) { $this->yy_pop_parser_stack(); } if ($this->yyidx < 0 || $yymajor == 0) { $this->yy_destructor($yymajor, $yytokenvalue); $this->yy_parse_failed(); $yymajor = self::YYNOCODE; - } elseif ($yymx != self::YYERRORSYMBOL) { + } else if ($yymx !== self::YYERRORSYMBOL) { $u2 = 0; $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2); } @@ -2824,8 +3599,7 @@ class Smarty_Internal_Templateparser $this->yy_accept(); $yymajor = self::YYNOCODE; } - } - while ($yymajor != self::YYNOCODE && $this->yyidx >= 0); + } while ($yymajor !== self::YYNOCODE && $this->yyidx >= 0); } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_testinstall.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_testinstall.php index 7cb575573..bea8b3a80 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_testinstall.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_testinstall.php @@ -28,15 +28,12 @@ class Smarty_Internal_TestInstall public static function testInstall(Smarty $smarty, &$errors = null) { $status = true; - if ($errors === null) { echo "<PRE>\n"; echo "Smarty Installation test...\n"; echo "Testing template directory...\n"; } - $_stream_resolve_include_path = function_exists('stream_resolve_include_path'); - // test if all registered template_dir are accessible foreach ($smarty->getTemplateDir() as $template_dir) { $_template_dir = $template_dir; @@ -50,12 +47,10 @@ class Smarty_Internal_TestInstall } else { $template_dir = $smarty->ext->_getIncludePath->getIncludePath($_template_dir, null, $smarty); } - if ($template_dir !== false) { if ($errors === null) { echo "$template_dir is OK.\n"; } - continue; } else { $status = false; @@ -66,7 +61,6 @@ class Smarty_Internal_TestInstall } else { $errors[ 'template_dir' ] = $message; } - continue; } } else { @@ -77,11 +71,9 @@ class Smarty_Internal_TestInstall } else { $errors[ 'template_dir' ] = $message; } - continue; } } - if (!is_dir($template_dir)) { $status = false; $message = "FAILED: $template_dir is not a directory"; @@ -90,7 +82,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'template_dir' ] = $message; } - } elseif (!is_readable($template_dir)) { + } else if (!is_readable($template_dir)) { $status = false; $message = "FAILED: $template_dir is not readable"; if ($errors === null) { @@ -104,11 +96,9 @@ class Smarty_Internal_TestInstall } } } - if ($errors === null) { echo "Testing compile directory...\n"; } - // test if registered compile_dir is accessible $__compile_dir = $smarty->getCompileDir(); $_compile_dir = realpath($__compile_dir); @@ -120,7 +110,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'compile_dir' ] = $message; } - } elseif (!is_dir($_compile_dir)) { + } else if (!is_dir($_compile_dir)) { $status = false; $message = "FAILED: {$_compile_dir} is not a directory"; if ($errors === null) { @@ -128,7 +118,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'compile_dir' ] = $message; } - } elseif (!is_readable($_compile_dir)) { + } else if (!is_readable($_compile_dir)) { $status = false; $message = "FAILED: {$_compile_dir} is not readable"; if ($errors === null) { @@ -136,7 +126,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'compile_dir' ] = $message; } - } elseif (!is_writable($_compile_dir)) { + } else if (!is_writable($_compile_dir)) { $status = false; $message = "FAILED: {$_compile_dir} is not writable"; if ($errors === null) { @@ -149,11 +139,9 @@ class Smarty_Internal_TestInstall echo "{$_compile_dir} is OK.\n"; } } - if ($errors === null) { echo "Testing plugins directory...\n"; } - // test if all registered plugins_dir are accessible // and if core plugins directory is still registered $_core_plugins_dir = realpath(dirname(__FILE__) . '/../plugins'); @@ -170,12 +158,10 @@ class Smarty_Internal_TestInstall } else { $plugin_dir = $smarty->ext->_getIncludePath->getIncludePath($_plugin_dir, null, $smarty); } - if ($plugin_dir !== false) { if ($errors === null) { echo "$plugin_dir is OK.\n"; } - continue; } else { $status = false; @@ -185,7 +171,6 @@ class Smarty_Internal_TestInstall } else { $errors[ 'plugins_dir' ] = $message; } - continue; } } else { @@ -196,11 +181,9 @@ class Smarty_Internal_TestInstall } else { $errors[ 'plugins_dir' ] = $message; } - continue; } } - if (!is_dir($plugin_dir)) { $status = false; $message = "FAILED: $plugin_dir is not a directory"; @@ -209,7 +192,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'plugins_dir' ] = $message; } - } elseif (!is_readable($plugin_dir)) { + } else if (!is_readable($plugin_dir)) { $status = false; $message = "FAILED: $plugin_dir is not readable"; if ($errors === null) { @@ -217,7 +200,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'plugins_dir' ] = $message; } - } elseif ($_core_plugins_dir && $_core_plugins_dir == realpath($plugin_dir)) { + } else if ($_core_plugins_dir && $_core_plugins_dir == realpath($plugin_dir)) { $_core_plugins_available = true; if ($errors === null) { echo "$plugin_dir is OK.\n"; @@ -233,15 +216,13 @@ class Smarty_Internal_TestInstall $message = "WARNING: Smarty's own libs/plugins is not available"; if ($errors === null) { echo $message . ".\n"; - } elseif (!isset($errors[ 'plugins_dir' ])) { + } else if (!isset($errors[ 'plugins_dir' ])) { $errors[ 'plugins_dir' ] = $message; } } - if ($errors === null) { echo "Testing cache directory...\n"; } - // test if all registered cache_dir is accessible $__cache_dir = $smarty->getCacheDir(); $_cache_dir = realpath($__cache_dir); @@ -253,7 +234,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'cache_dir' ] = $message; } - } elseif (!is_dir($_cache_dir)) { + } else if (!is_dir($_cache_dir)) { $status = false; $message = "FAILED: {$_cache_dir} is not a directory"; if ($errors === null) { @@ -261,7 +242,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'cache_dir' ] = $message; } - } elseif (!is_readable($_cache_dir)) { + } else if (!is_readable($_cache_dir)) { $status = false; $message = "FAILED: {$_cache_dir} is not readable"; if ($errors === null) { @@ -269,7 +250,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'cache_dir' ] = $message; } - } elseif (!is_writable($_cache_dir)) { + } else if (!is_writable($_cache_dir)) { $status = false; $message = "FAILED: {$_cache_dir} is not writable"; if ($errors === null) { @@ -282,11 +263,9 @@ class Smarty_Internal_TestInstall echo "{$_cache_dir} is OK.\n"; } } - if ($errors === null) { echo "Testing configs directory...\n"; } - // test if all registered config_dir are accessible foreach ($smarty->getConfigDir() as $config_dir) { $_config_dir = $config_dir; @@ -299,12 +278,10 @@ class Smarty_Internal_TestInstall } else { $config_dir = $smarty->ext->_getIncludePath->getIncludePath($_config_dir, null, $smarty); } - if ($config_dir !== false) { if ($errors === null) { echo "$config_dir is OK.\n"; } - continue; } else { $status = false; @@ -314,7 +291,6 @@ class Smarty_Internal_TestInstall } else { $errors[ 'config_dir' ] = $message; } - continue; } } else { @@ -325,11 +301,9 @@ class Smarty_Internal_TestInstall } else { $errors[ 'config_dir' ] = $message; } - continue; } } - if (!is_dir($config_dir)) { $status = false; $message = "FAILED: $config_dir is not a directory"; @@ -338,7 +312,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'config_dir' ] = $message; } - } elseif (!is_readable($config_dir)) { + } else if (!is_readable($config_dir)) { $status = false; $message = "FAILED: $config_dir is not readable"; if ($errors === null) { @@ -352,153 +326,165 @@ class Smarty_Internal_TestInstall } } } - if ($errors === null) { echo "Testing sysplugin files...\n"; } // test if sysplugins are available $source = SMARTY_SYSPLUGINS_DIR; if (is_dir($source)) { - $expectedSysplugins = array('smartycompilerexception.php' => true, 'smartyexception.php' => true, - 'smarty_cacheresource.php' => true, 'smarty_cacheresource_custom.php' => true, - 'smarty_cacheresource_keyvaluestore.php' => true, 'smarty_data.php' => true, - 'smarty_internal_block.php' => true, - 'smarty_internal_cacheresource_file.php' => true, - 'smarty_internal_compilebase.php' => true, - 'smarty_internal_compile_append.php' => true, - 'smarty_internal_compile_assign.php' => true, - 'smarty_internal_compile_block.php' => true, - 'smarty_internal_compile_block_child.php' => true, - 'smarty_internal_compile_block_parent.php' => true, - 'smarty_internal_compile_break.php' => true, - 'smarty_internal_compile_call.php' => true, - 'smarty_internal_compile_capture.php' => true, - 'smarty_internal_compile_config_load.php' => true, - 'smarty_internal_compile_continue.php' => true, - 'smarty_internal_compile_debug.php' => true, - 'smarty_internal_compile_eval.php' => true, - 'smarty_internal_compile_extends.php' => true, - 'smarty_internal_compile_for.php' => true, - 'smarty_internal_compile_foreach.php' => true, - 'smarty_internal_compile_function.php' => true, - 'smarty_internal_compile_if.php' => true, - 'smarty_internal_compile_include.php' => true, - 'smarty_internal_compile_include_php.php' => true, - 'smarty_internal_compile_insert.php' => true, - 'smarty_internal_compile_ldelim.php' => true, - 'smarty_internal_compile_make_nocache.php' => true, - 'smarty_internal_compile_nocache.php' => true, - 'smarty_internal_compile_private_block_plugin.php' => true, - 'smarty_internal_compile_private_foreachsection.php' => true, - 'smarty_internal_compile_private_function_plugin.php' => true, - 'smarty_internal_compile_private_modifier.php' => true, + $expectedSysplugins = array('smartycompilerexception.php' => true, + 'smartyexception.php' => true, + 'smarty_cacheresource.php' => true, + 'smarty_cacheresource_custom.php' => true, + 'smarty_cacheresource_keyvaluestore.php' => true, + 'smarty_data.php' => true, + 'smarty_internal_block.php' => true, + 'smarty_internal_cacheresource_file.php' => true, + 'smarty_internal_compilebase.php' => true, + 'smarty_internal_compile_append.php' => true, + 'smarty_internal_compile_assign.php' => true, + 'smarty_internal_compile_block.php' => true, + 'smarty_internal_compile_block_child.php' => true, + 'smarty_internal_compile_block_parent.php' => true, + 'smarty_internal_compile_child.php' => true, + 'smarty_internal_compile_parent.php' => true, + 'smarty_internal_compile_break.php' => true, + 'smarty_internal_compile_call.php' => true, + 'smarty_internal_compile_capture.php' => true, + 'smarty_internal_compile_config_load.php' => true, + 'smarty_internal_compile_continue.php' => true, + 'smarty_internal_compile_debug.php' => true, + 'smarty_internal_compile_eval.php' => true, + 'smarty_internal_compile_extends.php' => true, + 'smarty_internal_compile_for.php' => true, + 'smarty_internal_compile_foreach.php' => true, + 'smarty_internal_compile_function.php' => true, + 'smarty_internal_compile_if.php' => true, + 'smarty_internal_compile_include.php' => true, + 'smarty_internal_compile_include_php.php' => true, + 'smarty_internal_compile_insert.php' => true, + 'smarty_internal_compile_ldelim.php' => true, + 'smarty_internal_compile_make_nocache.php' => true, + 'smarty_internal_compile_nocache.php' => true, + 'smarty_internal_compile_private_block_plugin.php' => true, + 'smarty_internal_compile_private_foreachsection.php' => true, + 'smarty_internal_compile_private_function_plugin.php' => true, + 'smarty_internal_compile_private_modifier.php' => true, 'smarty_internal_compile_private_object_block_function.php' => true, - 'smarty_internal_compile_private_object_function.php' => true, - 'smarty_internal_compile_private_php.php' => true, - 'smarty_internal_compile_private_print_expression.php' => true, - 'smarty_internal_compile_private_registered_block.php' => true, - 'smarty_internal_compile_private_registered_function.php' => true, - 'smarty_internal_compile_private_special_variable.php' => true, - 'smarty_internal_compile_rdelim.php' => true, - 'smarty_internal_compile_section.php' => true, - 'smarty_internal_compile_setfilter.php' => true, - 'smarty_internal_compile_shared_inheritance.php' => true, - 'smarty_internal_compile_while.php' => true, - 'smarty_internal_configfilelexer.php' => true, - 'smarty_internal_configfileparser.php' => true, - 'smarty_internal_config_file_compiler.php' => true, - 'smarty_internal_data.php' => true, 'smarty_internal_debug.php' => true, - 'smarty_internal_extension_handler.php' => true, - 'smarty_internal_method_addautoloadfilters.php' => true, - 'smarty_internal_method_adddefaultmodifiers.php' => true, - 'smarty_internal_method_append.php' => true, - 'smarty_internal_method_appendbyref.php' => true, - 'smarty_internal_method_assignbyref.php' => true, - 'smarty_internal_method_assignglobal.php' => true, - 'smarty_internal_method_clearallassign.php' => true, - 'smarty_internal_method_clearallcache.php' => true, - 'smarty_internal_method_clearassign.php' => true, - 'smarty_internal_method_clearcache.php' => true, - 'smarty_internal_method_clearcompiledtemplate.php' => true, - 'smarty_internal_method_clearconfig.php' => true, - 'smarty_internal_method_compileallconfig.php' => true, - 'smarty_internal_method_compilealltemplates.php' => true, - 'smarty_internal_method_configload.php' => true, - 'smarty_internal_method_createdata.php' => true, - 'smarty_internal_method_getautoloadfilters.php' => true, - 'smarty_internal_method_getconfigvariable.php' => true, - 'smarty_internal_method_getconfigvars.php' => true, - 'smarty_internal_method_getdebugtemplate.php' => true, - 'smarty_internal_method_getdefaultmodifiers.php' => true, - 'smarty_internal_method_getglobal.php' => true, - 'smarty_internal_method_getregisteredobject.php' => true, - 'smarty_internal_method_getstreamvariable.php' => true, - 'smarty_internal_method_gettags.php' => true, - 'smarty_internal_method_gettemplatevars.php' => true, - 'smarty_internal_method_loadfilter.php' => true, - 'smarty_internal_method_loadplugin.php' => true, - 'smarty_internal_method_mustcompile.php' => true, - 'smarty_internal_method_registercacheresource.php' => true, - 'smarty_internal_method_registerclass.php' => true, - 'smarty_internal_method_registerdefaultconfighandler.php' => true, - 'smarty_internal_method_registerdefaultpluginhandler.php' => true, + 'smarty_internal_compile_private_object_function.php' => true, + 'smarty_internal_compile_private_php.php' => true, + 'smarty_internal_compile_private_print_expression.php' => true, + 'smarty_internal_compile_private_registered_block.php' => true, + 'smarty_internal_compile_private_registered_function.php' => true, + 'smarty_internal_compile_private_special_variable.php' => true, + 'smarty_internal_compile_rdelim.php' => true, + 'smarty_internal_compile_section.php' => true, + 'smarty_internal_compile_setfilter.php' => true, + 'smarty_internal_compile_shared_inheritance.php' => true, + 'smarty_internal_compile_while.php' => true, + 'smarty_internal_configfilelexer.php' => true, + 'smarty_internal_configfileparser.php' => true, + 'smarty_internal_config_file_compiler.php' => true, + 'smarty_internal_data.php' => true, + 'smarty_internal_debug.php' => true, + 'smarty_internal_errorhandler.php' => true, + 'smarty_internal_extension_handler.php' => true, + 'smarty_internal_method_addautoloadfilters.php' => true, + 'smarty_internal_method_adddefaultmodifiers.php' => true, + 'smarty_internal_method_append.php' => true, + 'smarty_internal_method_appendbyref.php' => true, + 'smarty_internal_method_assignbyref.php' => true, + 'smarty_internal_method_assignglobal.php' => true, + 'smarty_internal_method_clearallassign.php' => true, + 'smarty_internal_method_clearallcache.php' => true, + 'smarty_internal_method_clearassign.php' => true, + 'smarty_internal_method_clearcache.php' => true, + 'smarty_internal_method_clearcompiledtemplate.php' => true, + 'smarty_internal_method_clearconfig.php' => true, + 'smarty_internal_method_compileallconfig.php' => true, + 'smarty_internal_method_compilealltemplates.php' => true, + 'smarty_internal_method_configload.php' => true, + 'smarty_internal_method_createdata.php' => true, + 'smarty_internal_method_getautoloadfilters.php' => true, + 'smarty_internal_method_getconfigvariable.php' => true, + 'smarty_internal_method_getconfigvars.php' => true, + 'smarty_internal_method_getdebugtemplate.php' => true, + 'smarty_internal_method_getdefaultmodifiers.php' => true, + 'smarty_internal_method_getglobal.php' => true, + 'smarty_internal_method_getregisteredobject.php' => true, + 'smarty_internal_method_getstreamvariable.php' => true, + 'smarty_internal_method_gettags.php' => true, + 'smarty_internal_method_gettemplatevars.php' => true, + 'smarty_internal_method_literals.php' => true, + 'smarty_internal_method_loadfilter.php' => true, + 'smarty_internal_method_loadplugin.php' => true, + 'smarty_internal_method_mustcompile.php' => true, + 'smarty_internal_method_registercacheresource.php' => true, + 'smarty_internal_method_registerclass.php' => true, + 'smarty_internal_method_registerdefaultconfighandler.php' => true, + 'smarty_internal_method_registerdefaultpluginhandler.php' => true, 'smarty_internal_method_registerdefaulttemplatehandler.php' => true, - 'smarty_internal_method_registerfilter.php' => true, - 'smarty_internal_method_registerobject.php' => true, - 'smarty_internal_method_registerplugin.php' => true, - 'smarty_internal_method_registerresource.php' => true, - 'smarty_internal_method_setautoloadfilters.php' => true, - 'smarty_internal_method_setdebugtemplate.php' => true, - 'smarty_internal_method_setdefaultmodifiers.php' => true, - 'smarty_internal_method_unloadfilter.php' => true, - 'smarty_internal_method_unregistercacheresource.php' => true, - 'smarty_internal_method_unregisterfilter.php' => true, - 'smarty_internal_method_unregisterobject.php' => true, - 'smarty_internal_method_unregisterplugin.php' => true, - 'smarty_internal_method_unregisterresource.php' => true, - 'smarty_internal_nocache_insert.php' => true, - 'smarty_internal_parsetree.php' => true, - 'smarty_internal_parsetree_code.php' => true, - 'smarty_internal_parsetree_dq.php' => true, - 'smarty_internal_parsetree_dqcontent.php' => true, - 'smarty_internal_parsetree_tag.php' => true, - 'smarty_internal_parsetree_template.php' => true, - 'smarty_internal_parsetree_text.php' => true, - 'smarty_internal_resource_eval.php' => true, - 'smarty_internal_resource_extends.php' => true, - 'smarty_internal_resource_file.php' => true, - 'smarty_internal_resource_php.php' => true, - 'smarty_internal_resource_registered.php' => true, - 'smarty_internal_resource_stream.php' => true, - 'smarty_internal_resource_string.php' => true, - 'smarty_internal_runtime_cachemodify.php' => true, - 'smarty_internal_runtime_cacheresourcefile.php' => true, - 'smarty_internal_runtime_capture.php' => true, - 'smarty_internal_runtime_codeframe.php' => true, - 'smarty_internal_runtime_filterhandler.php' => true, - 'smarty_internal_runtime_foreach.php' => true, - 'smarty_internal_runtime_getincludepath.php' => true, - 'smarty_internal_runtime_inheritance.php' => true, - 'smarty_internal_runtime_make_nocache.php' => true, - 'smarty_internal_runtime_tplfunction.php' => true, - 'smarty_internal_runtime_updatecache.php' => true, - 'smarty_internal_runtime_updatescope.php' => true, - 'smarty_internal_runtime_writefile.php' => true, - 'smarty_internal_smartytemplatecompiler.php' => true, - 'smarty_internal_template.php' => true, - 'smarty_internal_templatebase.php' => true, - 'smarty_internal_templatecompilerbase.php' => true, - 'smarty_internal_templatelexer.php' => true, - 'smarty_internal_templateparser.php' => true, - 'smarty_internal_testinstall.php' => true, - 'smarty_internal_undefined.php' => true, 'smarty_resource.php' => true, - 'smarty_resource_custom.php' => true, 'smarty_resource_recompiled.php' => true, - 'smarty_resource_uncompiled.php' => true, 'smarty_security.php' => true, - 'smarty_template_cached.php' => true, 'smarty_template_compiled.php' => true, - 'smarty_template_config.php' => true, - 'smarty_template_resource_base.php' => true, - 'smarty_template_source.php' => true, 'smarty_undefined_variable.php' => true, - 'smarty_variable.php' => true,); + 'smarty_internal_method_registerfilter.php' => true, + 'smarty_internal_method_registerobject.php' => true, + 'smarty_internal_method_registerplugin.php' => true, + 'smarty_internal_method_registerresource.php' => true, + 'smarty_internal_method_setautoloadfilters.php' => true, + 'smarty_internal_method_setdebugtemplate.php' => true, + 'smarty_internal_method_setdefaultmodifiers.php' => true, + 'smarty_internal_method_unloadfilter.php' => true, + 'smarty_internal_method_unregistercacheresource.php' => true, + 'smarty_internal_method_unregisterfilter.php' => true, + 'smarty_internal_method_unregisterobject.php' => true, + 'smarty_internal_method_unregisterplugin.php' => true, + 'smarty_internal_method_unregisterresource.php' => true, + 'smarty_internal_nocache_insert.php' => true, + 'smarty_internal_parsetree.php' => true, + 'smarty_internal_parsetree_code.php' => true, + 'smarty_internal_parsetree_dq.php' => true, + 'smarty_internal_parsetree_dqcontent.php' => true, + 'smarty_internal_parsetree_tag.php' => true, + 'smarty_internal_parsetree_template.php' => true, + 'smarty_internal_parsetree_text.php' => true, + 'smarty_internal_resource_eval.php' => true, + 'smarty_internal_resource_extends.php' => true, + 'smarty_internal_resource_file.php' => true, + 'smarty_internal_resource_php.php' => true, + 'smarty_internal_resource_registered.php' => true, + 'smarty_internal_resource_stream.php' => true, + 'smarty_internal_resource_string.php' => true, + 'smarty_internal_runtime_cachemodify.php' => true, + 'smarty_internal_runtime_cacheresourcefile.php' => true, + 'smarty_internal_runtime_capture.php' => true, + 'smarty_internal_runtime_codeframe.php' => true, + 'smarty_internal_runtime_filterhandler.php' => true, + 'smarty_internal_runtime_foreach.php' => true, + 'smarty_internal_runtime_getincludepath.php' => true, + 'smarty_internal_runtime_inheritance.php' => true, + 'smarty_internal_runtime_make_nocache.php' => true, + 'smarty_internal_runtime_tplfunction.php' => true, + 'smarty_internal_runtime_updatecache.php' => true, + 'smarty_internal_runtime_updatescope.php' => true, + 'smarty_internal_runtime_writefile.php' => true, + 'smarty_internal_smartytemplatecompiler.php' => true, + 'smarty_internal_template.php' => true, + 'smarty_internal_templatebase.php' => true, + 'smarty_internal_templatecompilerbase.php' => true, + 'smarty_internal_templatelexer.php' => true, + 'smarty_internal_templateparser.php' => true, + 'smarty_internal_testinstall.php' => true, + 'smarty_internal_undefined.php' => true, + 'smarty_resource.php' => true, + 'smarty_resource_custom.php' => true, + 'smarty_resource_recompiled.php' => true, + 'smarty_resource_uncompiled.php' => true, + 'smarty_security.php' => true, + 'smarty_template_cached.php' => true, + 'smarty_template_compiled.php' => true, + 'smarty_template_config.php' => true, + 'smarty_template_resource_base.php' => true, + 'smarty_template_source.php' => true, + 'smarty_undefined_variable.php' => true, + 'smarty_variable.php' => true,); $iterator = new DirectoryIterator($source); foreach ($iterator as $file) { if (!$file->isDot()) { @@ -516,7 +502,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'sysplugins' ] = $message; } - } elseif ($errors === null) { + } else if ($errors === null) { echo "... OK\n"; } } else { @@ -528,36 +514,61 @@ class Smarty_Internal_TestInstall $errors[ 'sysplugins_dir_constant' ] = $message; } } - if ($errors === null) { echo "Testing plugin files...\n"; } // test if core plugins are available $source = SMARTY_PLUGINS_DIR; if (is_dir($source)) { - $expectedPlugins = - array('block.textformat.php' => true, 'function.counter.php' => true, 'function.cycle.php' => true, - 'function.fetch.php' => true, 'function.html_checkboxes.php' => true, - 'function.html_image.php' => true, 'function.html_options.php' => true, - 'function.html_radios.php' => true, 'function.html_select_date.php' => true, - 'function.html_select_time.php' => true, 'function.html_table.php' => true, - 'function.mailto.php' => true, 'function.math.php' => true, 'modifier.capitalize.php' => true, - 'modifier.date_format.php' => true, 'modifier.debug_print_var.php' => true, - 'modifier.escape.php' => true, 'modifier.regex_replace.php' => true, - 'modifier.replace.php' => true, 'modifier.spacify.php' => true, 'modifier.truncate.php' => true, - 'modifiercompiler.cat.php' => true, 'modifiercompiler.count_characters.php' => true, - 'modifiercompiler.count_paragraphs.php' => true, 'modifiercompiler.count_sentences.php' => true, - 'modifiercompiler.count_words.php' => true, 'modifiercompiler.default.php' => true, - 'modifiercompiler.escape.php' => true, 'modifiercompiler.from_charset.php' => true, - 'modifiercompiler.indent.php' => true, 'modifiercompiler.lower.php' => true, - 'modifiercompiler.noprint.php' => true, 'modifiercompiler.string_format.php' => true, - 'modifiercompiler.strip.php' => true, 'modifiercompiler.strip_tags.php' => true, - 'modifiercompiler.to_charset.php' => true, 'modifiercompiler.unescape.php' => true, - 'modifiercompiler.upper.php' => true, 'modifiercompiler.wordwrap.php' => true, - 'outputfilter.trimwhitespace.php' => true, 'shared.escape_special_chars.php' => true, - 'shared.literal_compiler_param.php' => true, 'shared.make_timestamp.php' => true, - 'shared.mb_str_replace.php' => true, 'shared.mb_unicode.php' => true, - 'shared.mb_wordwrap.php' => true, 'variablefilter.htmlspecialchars.php' => true,); + $expectedPlugins = array( + 'block.textformat.php' => true, + 'function.counter.php' => true, + 'function.cycle.php' => true, + 'function.fetch.php' => true, + 'function.html_checkboxes.php' => true, + 'function.html_image.php' => true, + 'function.html_options.php' => true, + 'function.html_radios.php' => true, + 'function.html_select_date.php' => true, + 'function.html_select_time.php' => true, + 'function.html_table.php' => true, + 'function.mailto.php' => true, + 'function.math.php' => true, + 'modifier.capitalize.php' => true, + 'modifier.date_format.php' => true, + 'modifier.debug_print_var.php' => true, + 'modifier.escape.php' => true, + 'modifier.mb_wordwrap.php' => true, + 'modifier.regex_replace.php' => true, + 'modifier.replace.php' => true, + 'modifier.spacify.php' => true, + 'modifier.truncate.php' => true, + 'modifiercompiler.cat.php' => true, + 'modifiercompiler.count_characters.php' => true, + 'modifiercompiler.count_paragraphs.php' => true, + 'modifiercompiler.count_sentences.php' => true, + 'modifiercompiler.count_words.php' => true, + 'modifiercompiler.default.php' => true, + 'modifiercompiler.escape.php' => true, + 'modifiercompiler.from_charset.php' => true, + 'modifiercompiler.indent.php' => true, + 'modifiercompiler.lower.php' => true, + 'modifiercompiler.noprint.php' => true, + 'modifiercompiler.string_format.php' => true, + 'modifiercompiler.strip.php' => true, + 'modifiercompiler.strip_tags.php' => true, + 'modifiercompiler.to_charset.php' => true, + 'modifiercompiler.unescape.php' => true, + 'modifiercompiler.upper.php' => true, + 'modifiercompiler.wordwrap.php' => true, + 'outputfilter.trimwhitespace.php' => true, + 'shared.escape_special_chars.php' => true, + 'shared.literal_compiler_param.php' => true, + 'shared.make_timestamp.php' => true, + 'shared.mb_str_replace.php' => true, + 'shared.mb_unicode.php' => true, + 'variablefilter.htmlspecialchars.php' => true, + ); $iterator = new DirectoryIterator($source); foreach ($iterator as $file) { if (!$file->isDot()) { @@ -575,7 +586,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'plugins' ] = $message; } - } elseif ($errors === null) { + } else if ($errors === null) { echo "... OK\n"; } } else { @@ -587,12 +598,10 @@ class Smarty_Internal_TestInstall $errors[ 'plugins_dir_constant' ] = $message; } } - if ($errors === null) { echo "Tests complete.\n"; echo "</PRE>\n"; } - return $status; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_resource.php b/vendor/smarty/smarty/libs/sysplugins/smarty_resource.php index ea673ead1..b76b9c783 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_resource.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_resource.php @@ -21,31 +21,28 @@ abstract class Smarty_Resource { /** + * resource types provided by the core + * + * @var array + */ + public static $sysplugins = array('file' => 'smarty_internal_resource_file.php', + 'string' => 'smarty_internal_resource_string.php', + 'extends' => 'smarty_internal_resource_extends.php', + 'stream' => 'smarty_internal_resource_stream.php', + 'eval' => 'smarty_internal_resource_eval.php', + 'php' => 'smarty_internal_resource_php.php'); + /** * Source is bypassing compiler * * @var boolean */ public $uncompiled = false; - /** * Source must be recompiled on every occasion * * @var boolean */ public $recompiled = false; - - /** - * resource types provided by the core - * - * @var array - */ - public static $sysplugins = array('file' => 'smarty_internal_resource_file.php', - 'string' => 'smarty_internal_resource_string.php', - 'extends' => 'smarty_internal_resource_extends.php', - 'stream' => 'smarty_internal_resource_stream.php', - 'eval' => 'smarty_internal_resource_eval.php', - 'php' => 'smarty_internal_resource_php.php'); - /** * Flag if resource does implement populateCompiledFilepath() method * @@ -54,70 +51,6 @@ abstract class Smarty_Resource public $hasCompiledHandler = false; /** - * Load template's source into current template object - * - * @param Smarty_Template_Source $source source object - * - * @return string template source - * @throws SmartyException if source cannot be loaded - */ - abstract public function getContent(Smarty_Template_Source $source); - - /** - * populate Source Object with meta data from Resource - * - * @param Smarty_Template_Source $source source object - * @param Smarty_Internal_Template $_template template object - */ - abstract public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null); - - /** - * populate Source Object with timestamp and exists from Resource - * - * @param Smarty_Template_Source $source source object - */ - public function populateTimestamp(Smarty_Template_Source $source) - { - // intentionally left blank - } - - /** - * modify resource_name according to resource handlers specifications - * - * @param Smarty $smarty Smarty instance - * @param string $resource_name resource_name to make unique - * @param boolean $isConfig flag for config resource - * - * @return string unique resource name - */ - public function buildUniqueResourceName(Smarty $smarty, $resource_name, $isConfig = false) - { - if ($isConfig) { - if (!isset($smarty->_joined_config_dir)) { - $smarty->getTemplateDir(null, true); - } - return get_class($this) . '#' . $smarty->_joined_config_dir . '#' . $resource_name; - } else { - if (!isset($smarty->_joined_template_dir)) { - $smarty->getTemplateDir(); - } - return get_class($this) . '#' . $smarty->_joined_template_dir . '#' . $resource_name; - } - } - - /** - * Determine basename for compiled filename - * - * @param Smarty_Template_Source $source source object - * - * @return string resource's basename - */ - public function getBasename(Smarty_Template_Source $source) - { - return basename(preg_replace('![^\w]+!', '_', $source->name)); - } - - /** * Load Resource Handler * * @param Smarty $smarty smarty object @@ -132,20 +65,17 @@ abstract class Smarty_Resource if (isset($smarty->_cache[ 'resource_handlers' ][ $type ])) { return $smarty->_cache[ 'resource_handlers' ][ $type ]; } - // try registered resource if (isset($smarty->registered_resources[ $type ])) { return $smarty->_cache[ 'resource_handlers' ][ $type ] = $smarty->registered_resources[ $type ] instanceof Smarty_Resource ? $smarty->registered_resources[ $type ] : new Smarty_Internal_Resource_Registered(); } - // try sysplugins dir if (isset(self::$sysplugins[ $type ])) { $_resource_class = 'Smarty_Internal_Resource_' . ucfirst($type); return $smarty->_cache[ 'resource_handlers' ][ $type ] = new $_resource_class(); } - // try plugins dir $_resource_class = 'Smarty_Resource_' . ucfirst($type); if ($smarty->loadPlugin($_resource_class)) { @@ -159,7 +89,6 @@ abstract class Smarty_Resource return self::load($smarty, $type); } } - // try streams $_known_stream = stream_get_wrappers(); if (in_array($type, $_known_stream)) { @@ -169,9 +98,7 @@ abstract class Smarty_Resource } return $smarty->_cache[ 'resource_handlers' ][ $type ] = new Smarty_Internal_Resource_Stream(); } - // TODO: try default_(template|config)_handler - // give up throw new SmartyException("Unknown resource type '{$type}'"); } @@ -206,6 +133,7 @@ abstract class Smarty_Resource * @param string $template_resource template_resource to extract resource handler and name of * * @return string unique resource name + * @throws \SmartyException */ public static function getUniqueTemplateName($obj, $template_resource) { @@ -214,26 +142,15 @@ abstract class Smarty_Resource // TODO: optimize for Smarty's internal resource types $resource = Smarty_Resource::load($smarty, $type); // go relative to a given template? - $_file_is_dotted = $name[ 0 ] == '.' && ($name[ 1 ] == '.' || $name[ 1 ] == '/'); + $_file_is_dotted = $name[ 0 ] === '.' && ($name[ 1 ] === '.' || $name[ 1 ] === '/'); if ($obj->_isTplObj() && $_file_is_dotted && - ($obj->source->type == 'file' || $obj->parent->source->type == 'extends') + ($obj->source->type === 'file' || $obj->parent->source->type === 'extends') ) { - $name = $smarty->_realpath(dirname($obj->parent->source->filepath) . $smarty->ds . $name); + $name = $smarty->_realpath(dirname($obj->parent->source->filepath) . DIRECTORY_SEPARATOR . $name); } return $resource->buildUniqueResourceName($smarty, $name); } - /* - * Check if resource must check time stamps when when loading complied or cached templates. - * Resources like 'extends' which use source components my disable timestamp checks on own resource. - * - * @return bool - */ - public function checkTimestamps() - { - return true; - } - /** * initialize Source Object for given resource * wrapper for backward compatibility to versions < 3.1.22 @@ -243,12 +160,93 @@ abstract class Smarty_Resource * @param Smarty $smarty smarty object * @param string $template_resource resource identifier * - * @return Smarty_Template_Source Source Object + * @return \Smarty_Template_Source Source Object + * @throws \SmartyException */ - public static function source(Smarty_Internal_Template $_template = null, Smarty $smarty = null, + public static function source(Smarty_Internal_Template $_template = null, + Smarty $smarty = null, $template_resource = null) { return Smarty_Template_Source::load($_template, $smarty, $template_resource); } + + /** + * Load template's source into current template object + * + * @param Smarty_Template_Source $source source object + * + * @return string template source + * @throws SmartyException if source cannot be loaded + */ + abstract public function getContent(Smarty_Template_Source $source); + + /** + * populate Source Object with meta data from Resource + * + * @param Smarty_Template_Source $source source object + * @param Smarty_Internal_Template $_template template object + */ + abstract public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null); + + /** + * populate Source Object with timestamp and exists from Resource + * + * @param Smarty_Template_Source $source source object + */ + public function populateTimestamp(Smarty_Template_Source $source) + { + // intentionally left blank + } + + /** + * modify resource_name according to resource handlers specifications + * + * @param Smarty $smarty Smarty instance + * @param string $resource_name resource_name to make unique + * @param boolean $isConfig flag for config resource + * + * @return string unique resource name + */ + public function buildUniqueResourceName(Smarty $smarty, $resource_name, $isConfig = false) + { + if ($isConfig) { + if (!isset($smarty->_joined_config_dir)) { + $smarty->getTemplateDir(null, true); + } + return get_class($this) . '#' . $smarty->_joined_config_dir . '#' . $resource_name; + } else { + if (!isset($smarty->_joined_template_dir)) { + $smarty->getTemplateDir(); + } + return get_class($this) . '#' . $smarty->_joined_template_dir . '#' . $resource_name; + } + } + + /* + * Check if resource must check time stamps when when loading complied or cached templates. + * Resources like 'extends' which use source components my disable timestamp checks on own resource. + * + * @return bool + */ + + /** + * Determine basename for compiled filename + * + * @param Smarty_Template_Source $source source object + * + * @return string resource's basename + */ + public function getBasename(Smarty_Template_Source $source) + { + return basename(preg_replace('![^\w]+!', '_', $source->name)); + } + + /** + * @return bool + */ + public function checkTimestamps() + { + return true; + } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_resource_custom.php b/vendor/smarty/smarty/libs/sysplugins/smarty_resource_custom.php index 619f2d6f0..77f619eca 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_resource_custom.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_resource_custom.php @@ -47,7 +47,7 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource */ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) { - $source->filepath = $source->type . ':' . $source->name; + $source->filepath = $source->type . ':' . substr(preg_replace('/[^A-Za-z0-9.]/','',$source->name),0,25); $source->uid = sha1($source->type . ':' . $source->name); $mtime = $this->fetchTimestamp($source->name); @@ -90,6 +90,6 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource */ public function getBasename(Smarty_Template_Source $source) { - return basename($source->name); + return basename(substr(preg_replace('/[^A-Za-z0-9.]/','',$source->name),0,25)); } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_resource_recompiled.php b/vendor/smarty/smarty/libs/sysplugins/smarty_resource_recompiled.php index 7e51d1b1d..322cdabfa 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_resource_recompiled.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_resource_recompiled.php @@ -49,7 +49,7 @@ abstract class Smarty_Resource_Recompiled extends Smarty_Resource $_smarty_tpl->loadCompiler(); // call compiler try { - eval("?>" . $_smarty_tpl->compiler->compileTemplate($_smarty_tpl)); + eval('?>' . $_smarty_tpl->compiler->compileTemplate($_smarty_tpl)); } catch (Exception $e) { unset($_smarty_tpl->compiler); @@ -85,6 +85,9 @@ abstract class Smarty_Resource_Recompiled extends Smarty_Resource * * @return bool */ + /** + * @return bool + */ public function checkTimestamps() { return false; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_resource_uncompiled.php b/vendor/smarty/smarty/libs/sysplugins/smarty_resource_uncompiled.php index 554f3aea3..a11e2c14c 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_resource_uncompiled.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_resource_uncompiled.php @@ -29,7 +29,7 @@ abstract class Smarty_Resource_Uncompiled extends Smarty_Resource * @var bool */ public $hasCompiledHandler = true; - + /** * populate compiled object with compiled filepath * diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_security.php b/vendor/smarty/smarty/libs/sysplugins/smarty_security.php index 4f75f7529..126f6fb46 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_security.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_security.php @@ -322,7 +322,7 @@ class Smarty_Security // fall back return $this->isTrustedStaticClass($class_name, $compiler); } - if ($params[ 2 ] == 'method') { + if ($params[ 2 ] === 'method') { $allowed = $this->trusted_static_methods; $name = substr($params[ 0 ], 0, strpos($params[ 0 ], '(')); } else { @@ -514,60 +514,39 @@ class Smarty_Security public function isTrustedResourceDir($filepath, $isConfig = null) { if ($this->_include_path_status !== $this->smarty->use_include_path) { - foreach ($this->_include_dir as $directory) { - unset($this->_resource_dir[ $directory ]); - } - if ($this->smarty->use_include_path) { - $this->_include_dir = array(); - $_dirs = $this->smarty->ext->_getIncludePath->getIncludePathDirs($this->smarty); - foreach ($_dirs as $directory) { - $this->_include_dir[] = $directory; - $this->_resource_dir[ $directory ] = true; - } + $_dir = $this->smarty->use_include_path ? $this->smarty->ext->_getIncludePath->getIncludePathDirs($this->smarty) : array(); + if ($this->_include_dir !== $_dir) { + $this->_updateResourceDir($this->_include_dir, $_dir); + $this->_include_dir = $_dir; } $this->_include_path_status = $this->smarty->use_include_path; } - if ($isConfig !== true && - (!isset($this->smarty->_cache[ 'template_dir_new' ]) || $this->smarty->_cache[ 'template_dir_new' ]) - ) { + if ($isConfig !== true) { $_dir = $this->smarty->getTemplateDir(); if ($this->_template_dir !== $_dir) { - foreach ($this->_template_dir as $directory) { - unset($this->_resource_dir[ $directory ]); - } - foreach ($_dir as $directory) { - $this->_resource_dir[ $directory ] = true; - } + $this->_updateResourceDir($this->_template_dir, $_dir); $this->_template_dir = $_dir; } - $this->smarty->_cache[ 'template_dir_new' ] = false; } - if ($isConfig !== false && - (!isset($this->smarty->_cache[ 'config_dir_new' ]) || $this->smarty->_cache[ 'config_dir_new' ]) - ) { + if ($isConfig !== false) { $_dir = $this->smarty->getConfigDir(); if ($this->_config_dir !== $_dir) { - foreach ($this->_config_dir as $directory) { - unset($this->_resource_dir[ $directory ]); - } - foreach ($_dir as $directory) { - $this->_resource_dir[ $directory ] = true; - } + $this->_updateResourceDir($this->_config_dir, $_dir); $this->_config_dir = $_dir; } - $this->smarty->_cache[ 'config_dir_new' ] = false; } - if ($this->_secure_dir !== (array) $this->secure_dir) { - foreach ($this->_secure_dir as $directory) { - unset($this->_resource_dir[ $directory ]); - } - foreach ((array) $this->secure_dir as $directory) { - $directory = $this->smarty->_realpath($directory . DIRECTORY_SEPARATOR, true); - $this->_resource_dir[ $directory ] = true; + if ($this->_secure_dir !== $this->secure_dir) { + $this->secure_dir = (array)$this->secure_dir; + foreach($this->secure_dir as $k => $d) { + $this->secure_dir[$k] = $this->smarty->_realpath($d.DIRECTORY_SEPARATOR,true); } - $this->_secure_dir = (array) $this->secure_dir; + $this->_updateResourceDir($this->_secure_dir, $this->secure_dir); + $this->_secure_dir = $this->secure_dir; + } + $addPath = $this->_checkDir($filepath, $this->_resource_dir); + if ($addPath !== false) { + $this->_resource_dir = array_merge($this->_resource_dir, $addPath); } - $this->_resource_dir = $this->_checkDir($filepath, $this->_resource_dir); return true; } @@ -622,40 +601,64 @@ class Smarty_Security $this->_php_resource_dir[ $directory ] = true; } } + $addPath = $this->_checkDir($filepath, $this->_php_resource_dir); + if ($addPath !== false) { + $this->_php_resource_dir = array_merge($this->_php_resource_dir, $addPath); + } + return true; + } - $this->_php_resource_dir = - $this->_checkDir($this->smarty->_realpath($filepath, true), $this->_php_resource_dir); - return true; + /** + * Remove old directories and its sub folders, add new directories + * + * @param array $oldDir + * @param array $newDir + */ + private function _updateResourceDir($oldDir, $newDir) { + foreach ($oldDir as $directory) { + $directory = $this->smarty->_realpath($directory, true); + $length = strlen($directory); + foreach ($this->_resource_dir as $dir) { + if (substr($dir, 0,$length) === $directory) { + unset($this->_resource_dir[ $dir ]); + } + } + } + foreach ($newDir as $directory) { + $directory = $this->smarty->_realpath($directory, true); + $this->_resource_dir[ $directory ] = true; + } } - /** * Check if file is inside a valid directory * * @param string $filepath * @param array $dirs valid directories * - * @return array + * @return array|bool * @throws \SmartyException */ private function _checkDir($filepath, $dirs) { $directory = dirname($filepath) . DIRECTORY_SEPARATOR; + if (isset($dirs[ $directory ])) { + return false; + } + $filepath = $this->smarty->_realpath($filepath, true); + $directory = dirname($filepath) . DIRECTORY_SEPARATOR; $_directory = array(); while (true) { - // remember the directory to add it to _resource_dir in case we're successful - $_directory[ $directory ] = true; - // test if the directory is trusted + // test if the directory is trusted if (isset($dirs[ $directory ])) { - // merge sub directories of current $directory into _resource_dir to speed up subsequent lookup - $dirs = array_merge($dirs, $_directory); - - return $dirs; + return $_directory; } // abort if we've reached root if (!preg_match('#[\\\/][^\\\/]+[\\\/]$#', $directory)) { break; } - // bubble up one level + // remember the directory to add it to _resource_dir in case we're successful + $_directory[ $directory ] = true; + // bubble up one level $directory = preg_replace('#[\\\/][^\\\/]+[\\\/]$#', DIRECTORY_SEPARATOR, $directory); } @@ -676,11 +679,11 @@ class Smarty_Security { if ($security_class instanceof Smarty_Security) { $smarty->security_policy = $security_class; - return; + return $smarty; } elseif (is_object($security_class)) { throw new SmartyException("Class '" . get_class($security_class) . "' must extend Smarty_Security."); } - if ($security_class == null) { + if ($security_class === null) { $security_class = $smarty->security_class; } if (!class_exists($security_class)) { @@ -690,7 +693,7 @@ class Smarty_Security } else { $smarty->security_policy = new $security_class($smarty); } - return; + return $smarty; } /** * Start template processing diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_template_cached.php b/vendor/smarty/smarty/libs/sysplugins/smarty_template_cached.php index 58f0daf28..45c83c895 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_template_cached.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_template_cached.php @@ -83,6 +83,8 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base * create Cached Object container * * @param Smarty_Internal_Template $_template template object + * + * @throws \SmartyException */ public function __construct(Smarty_Internal_Template $_template) { @@ -105,8 +107,7 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base $_template->cached = new Smarty_Template_Cached($_template); $_template->cached->handler->populate($_template->cached, $_template); // caching enabled ? - if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT || - $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || $_template->source->handler->recompiled + if (!$_template->caching || $_template->source->handler->recompiled ) { $_template->cached->valid = false; } @@ -162,13 +163,13 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base } else { $this->valid = true; } - if ($this->valid && $_template->caching == Smarty::CACHING_LIFETIME_CURRENT && + if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_CURRENT && $_template->cache_lifetime >= 0 && time() > ($this->timestamp + $_template->cache_lifetime) ) { // lifetime expired $this->valid = false; } - if ($this->valid && $_template->smarty->compile_check == 1 && + if ($this->valid && $_template->compile_check === Smarty::COMPILECHECK_ON && $_template->source->getTimeStamp() > $this->timestamp ) { $this->valid = false; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php b/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php index 18f9d562c..7ca2ebcb4 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php @@ -11,7 +11,6 @@ */ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base { - /** * nocache hash * @@ -49,21 +48,22 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base $this->filepath = $smarty->getCompileDir(); if (isset($_template->compile_id)) { $this->filepath .= preg_replace('![^\w]+!', '_', $_template->compile_id) . - ($smarty->use_sub_dirs ? $smarty->ds : '^'); + ($smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^'); } // if use_sub_dirs, break file into directories if ($smarty->use_sub_dirs) { - $this->filepath .= $source->uid[ 0 ] . $source->uid[ 1 ] . $smarty->ds . $source->uid[ 2 ] . - $source->uid[ 3 ] . $smarty->ds . $source->uid[ 4 ] . $source->uid[ 5 ] . $smarty->ds; + $this->filepath .= $source->uid[ 0 ] . $source->uid[ 1 ] . DIRECTORY_SEPARATOR . $source->uid[ 2 ] . + $source->uid[ 3 ] . DIRECTORY_SEPARATOR . $source->uid[ 4 ] . $source->uid[ 5 ] . + DIRECTORY_SEPARATOR; } $this->filepath .= $source->uid . '_'; if ($source->isConfig) { - $this->filepath .= (int) $smarty->config_read_hidden + (int) $smarty->config_booleanize * 2 + - (int) $smarty->config_overwrite * 4; + $this->filepath .= (int)$smarty->config_read_hidden + (int)$smarty->config_booleanize * 2 + + (int)$smarty->config_overwrite * 4; } else { - $this->filepath .= (int) $smarty->merge_compiled_includes + (int) $smarty->escape_html * 2 + + $this->filepath .= (int)$smarty->merge_compiled_includes + (int)$smarty->escape_html * 2 + (($smarty->merge_compiled_includes && $source->type === 'extends') ? - (int) $smarty->extends_recursion * 4 : 0); + (int)$smarty->extends_recursion * 4 : 0); } $this->filepath .= '.' . $source->type; $basename = $source->handler->getBasename($source); @@ -81,64 +81,6 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base } /** - * load compiled template or compile from source - * - * @param Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template - * - * @throws Exception - */ - public function process(Smarty_Internal_Template $_smarty_tpl) - { - $source = &$_smarty_tpl->source; - $smarty = &$_smarty_tpl->smarty; - if ($source->handler->recompiled) { - $source->handler->process($_smarty_tpl); - } elseif (!$source->handler->uncompiled) { - if (!$this->exists || $smarty->force_compile || - ($smarty->compile_check && $source->getTimeStamp() > $this->getTimeStamp()) - ) { - $this->compileTemplateSource($_smarty_tpl); - $compileCheck = $smarty->compile_check; - $smarty->compile_check = false; - $this->loadCompiledTemplate($_smarty_tpl); - $smarty->compile_check = $compileCheck; - } else { - $_smarty_tpl->mustCompile = true; - @include($this->filepath); - if ($_smarty_tpl->mustCompile) { - $this->compileTemplateSource($_smarty_tpl); - $compileCheck = $smarty->compile_check; - $smarty->compile_check = false; - $this->loadCompiledTemplate($_smarty_tpl); - $smarty->compile_check = $compileCheck; - } - } - $_smarty_tpl->_subTemplateRegister(); - $this->processed = true; - } - } - - /** - * Load fresh compiled template by including the PHP file - * HHVM requires a work around because of a PHP incompatibility - * - * @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template - */ - private function loadCompiledTemplate(Smarty_Internal_Template $_smarty_tpl) - { - if (function_exists('opcache_invalidate') && strlen(ini_get("opcache.restrict_api")) < 1) { - opcache_invalidate($this->filepath, true); - } elseif (function_exists('apc_compile_file')) { - apc_compile_file($this->filepath); - } - if (defined('HHVM_VERSION')) { - eval("?>" . file_get_contents($this->filepath)); - } else { - include($this->filepath); - } - } - - /** * render compiled template code * * @param Smarty_Internal_Template $_template @@ -180,6 +122,44 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base } /** + * load compiled template or compile from source + * + * @param Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template + * + * @throws Exception + */ + public function process(Smarty_Internal_Template $_smarty_tpl) + { + $source = &$_smarty_tpl->source; + $smarty = &$_smarty_tpl->smarty; + if ($source->handler->recompiled) { + $source->handler->process($_smarty_tpl); + } else if (!$source->handler->uncompiled) { + if (!$this->exists || $smarty->force_compile || + ($_smarty_tpl->compile_check && $source->getTimeStamp() > $this->getTimeStamp()) + ) { + $this->compileTemplateSource($_smarty_tpl); + $compileCheck = $_smarty_tpl->compile_check; + $_smarty_tpl->compile_check = Smarty::COMPILECHECK_OFF; + $this->loadCompiledTemplate($_smarty_tpl); + $_smarty_tpl->compile_check = $compileCheck; + } else { + $_smarty_tpl->mustCompile = true; + @include($this->filepath); + if ($_smarty_tpl->mustCompile) { + $this->compileTemplateSource($_smarty_tpl); + $compileCheck = $_smarty_tpl->compile_check; + $_smarty_tpl->compile_check = Smarty::COMPILECHECK_OFF; + $this->loadCompiledTemplate($_smarty_tpl); + $_smarty_tpl->compile_check = $compileCheck; + } + } + $_smarty_tpl->_subTemplateRegister(); + $this->processed = true; + } + } + + /** * compile template from source * * @param Smarty_Internal_Template $_template @@ -193,8 +173,8 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base $this->nocache_hash = null; $this->unifunc = null; // compile locking - $saved_timestamp = $_template->source->handler->recompiled ? false : $this->getTimeStamp(); - if ($saved_timestamp) { + if ($saved_timestamp = (!$_template->source->handler->recompiled && is_file($this->filepath))) { + $saved_timestamp = $this->getTimeStamp(); touch($this->filepath); } // compile locking @@ -205,7 +185,7 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base } catch (Exception $e) { // restore old timestamp in case of error - if ($saved_timestamp) { + if ($saved_timestamp && is_file($this->filepath)) { touch($this->filepath, $saved_timestamp); } unset($_template->compiler); @@ -221,7 +201,8 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base * @param Smarty_Internal_Template $_template template object * @param string $code compiled code * - * @return boolean success + * @return bool success + * @throws \SmartyException */ public function write(Smarty_Internal_Template $_template, $code) { @@ -252,4 +233,26 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base } return isset($this->content) ? $this->content : false; } + + /** + * Load fresh compiled template by including the PHP file + * HHVM requires a work around because of a PHP incompatibility + * + * @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template + */ + private function loadCompiledTemplate(Smarty_Internal_Template $_smarty_tpl) + { + if (function_exists('opcache_invalidate') + && (!function_exists('ini_get') || strlen(ini_get("opcache.restrict_api")) < 1) + ) { + opcache_invalidate($this->filepath, true); + } else if (function_exists('apc_compile_file')) { + apc_compile_file($this->filepath); + } + if (defined('HHVM_VERSION')) { + eval('?>' . file_get_contents($this->filepath)); + } else { + include($this->filepath); + } + } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php b/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php index 6cc008a10..951e02af3 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php @@ -73,16 +73,11 @@ abstract class Smarty_Template_Resource_Base public $content = null; /** - * required plugins + * Included sub templates + * - index name + * - value use count * - * @var array - */ - public $required_plugins = array(); - - /** - * Included subtemplates - * - * @var array + * @var int[] */ public $includes = array(); diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_template_source.php b/vendor/smarty/smarty/libs/sysplugins/smarty_template_source.php index fdb3deaa8..4868706c8 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_template_source.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_template_source.php @@ -126,12 +126,13 @@ class Smarty_Template_Source /** * create Source Object container * - * @param Smarty_Resource $handler Resource Handler this source object communicates with - * @param Smarty $smarty Smarty instance this source object belongs to - * @param string $resource full template_resource - * @param string $type type of resource - * @param string $name resource name + * @param Smarty $smarty Smarty instance this source object belongs to + * @param string $resource full template_resource + * @param string $type type of resource + * @param string $name resource name * + * @throws \SmartyException + * @internal param \Smarty_Resource $handler Resource Handler this source object communicates with */ public function __construct(Smarty $smarty, $resource, $type, $name) { @@ -202,6 +203,7 @@ class Smarty_Template_Source * Get source content * * @return string + * @throws \SmartyException */ public function getContent() { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_undefined_variable.php b/vendor/smarty/smarty/libs/sysplugins/smarty_undefined_variable.php index 88bc6f68c..e064f6551 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_undefined_variable.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_undefined_variable.php @@ -7,22 +7,18 @@ * @package Smarty * @subpackage Template */ -class Smarty_Undefined_Variable +class Smarty_Undefined_Variable extends Smarty_Variable { /** - * Returns FALSE for 'nocache' and NULL otherwise. + * Returns null for not existing properties * * @param string $name * - * @return bool + * @return null */ public function __get($name) { - if ($name == 'nocache') { - return false; - } else { return null; - } } /** @@ -32,6 +28,6 @@ class Smarty_Undefined_Variable */ public function __toString() { - return ""; + return ''; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smartycompilerexception.php b/vendor/smarty/smarty/libs/sysplugins/smartycompilerexception.php index 763bab159..f7ad39b93 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smartycompilerexception.php +++ b/vendor/smarty/smarty/libs/sysplugins/smartycompilerexception.php @@ -7,6 +7,9 @@ */ class SmartyCompilerException extends SmartyException { + /** + * @return string + */ public function __toString() { return ' --> Smarty Compiler: ' . $this->message . ' <-- '; diff --git a/vendor/smarty/smarty/libs/sysplugins/smartyexception.php b/vendor/smarty/smarty/libs/sysplugins/smartyexception.php index 431d8f8e9..7f7b9aa43 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smartyexception.php +++ b/vendor/smarty/smarty/libs/sysplugins/smartyexception.php @@ -9,6 +9,9 @@ class SmartyException extends Exception { public static $escape = false; + /** + * @return string + */ public function __toString() { return ' --> Smarty: ' . (self::$escape ? htmlentities($this->message) : $this->message) . ' <-- '; |