Compare commits

...

1954 Commits

Author SHA1 Message Date
Simon Wisselink f65e7ddd22 fixed changelog 2021-01-07 00:34:08 +01:00
Simon Wisselink 92e05d4f8d Brought lexer source functionally up-to-date with compiled version (#625)
Fixes #621
2021-01-07 00:26:28 +01:00
Simon Wisselink e2b28167f8 Clarify correct LGPL version.
Fixes #612
2021-01-05 22:23:13 +01:00
Libor M 820782cd80 const fix for usage with comparison operators (#618)
Fixes #609 #613
2021-01-05 22:07:44 +01:00
Simon Wisselink c295786e43 Fixes for php8.0.0beta3 (#608)
* Set $errcontext argument optional to support PHP 8

- Argument is optional and deprecated in PHP 7.2

* Getting ready for PHP8, handling changed error levels/handlers mostly

* php5 compat syntax

* Updated UndefinedTemplateVarTest for PHP8 (and disabled a check for PHP<5.6) and re-enabled php:nightly in travis config

* Attempt to fix travis runs for (almost) all php versions supported

* Fix unit tests for php8, force composer to think we are still php7 to pick a supported phpunit and being less specific about an error msg because PHP8 is in active development and the exact wording is changing.

* Fixed a unit test that accidentally passed on phpunit < 7 because of sloppy string comparison.

* changelog

* run travis in xenial where possible for latest php versions. Fix unit tests from freakingo over inconsistent error messages in php8-beta.

* Incorporated AnrDaemons suggestions, making composer figure out the required phpunit version instead of specifying it explicitly and removing a unneeded error supression (@).

Co-authored-by: Jorge Sá Pereira <me@jorgesapereira.com>
2020-09-12 21:37:31 +02:00
♚ PH⑦ de Soria™♛ 859a09e1bb Bumped phpdoc @version tag to 3.1.36 (#598)
Although this could be removed, since the header comment is still there, it's good to keep the @version tag updated in order to avoid confusion for those who read it :)
2020-09-11 13:34:15 +02:00
Simon Wisselink a5934a755d Fixed a unit test that accidentally passed on phpunit < 7 because of sloppy string comparison. 2020-09-11 13:22:45 +02:00
Simon Wisselink 5a72624380 Test travis config for PHP5 versions (#592)
* Run tests for PHP5.x
* Start from 5.3 since composer requires it and without it we cannot install phpunit
* Specify dist for 5.3
* Disabled nightly testing because phpunit doesn't support php8 yet.
2020-05-05 15:08:31 +02:00
Simon Wisselink 1418c8c422 Merge branch 'AnrDaemon-fix-php5.3-compat' 2020-05-05 09:21:07 +02:00
Simon Wisselink f46c13b32a Updated changelog 2020-05-05 09:20:56 +02:00
AnrDaemon eae19f23b9 PHP 5.3 compatibility fixes 2020-05-05 01:37:36 +03:00
Sławomir Kaleta e1c050a32c Fix comment - Method can return string (#583) 2020-04-14 17:26:20 +02:00
Simon Wisselink fd148f7ade Merge branch 'release/3.1.36' 2020-04-14 16:44:26 +02:00
Simon Wisselink 07772aac90 version bump 2020-04-14 16:44:24 +02:00
Simon Wisselink 08227651fc Fixed #584 2020-04-14 16:44:09 +02:00
Simon Wisselink e0ea6899c8 fixed version of Smarty::SMARTY_VERSION and updates make-release script to do so automatically from now on 2020-04-14 16:40:44 +02:00
Simon Wisselink 97f700971f Merge branch 'release/3.1.35' 2020-04-14 00:02:48 +02:00
Simon Wisselink a0abc47588 version bump 2020-04-14 00:02:39 +02:00
Simon Wisselink 728a584ad5 Moved changelog to a keepachangelog.com format and added a release script 2020-04-14 00:02:18 +02:00
Simon Wisselink 290f7cfc3d Moved the isset tests into the test suite 2020-04-13 23:44:39 +02:00
Simon Wisselink 48d24b7ad1 Fix repo layout for package maintainers (#571)
* Do not ignore lexer subfolder for export as this contains source files and add smarty-lexer as a composer dev-dependency.
* Remove unit tests etc from archive export

Please note that the generated lexer / parser classes are not exactly equivalent, as they have been editing to conform to coding standards afterwards. I did a quick review and there don't seem to be any differences in semantics though.
2020-04-13 22:32:23 +02:00
Simon Wisselink 19ef8342aa Strip now removes whitespaces after comment (#582)
* Mark text sections as to be stripped, but do not strip them right away. Combine equivalent sections in chunks at the template level and strip combined chunks where possible.
- simplified Smarty_Internal_TemplateCompilerBase::processText along the way
Fixes #447
2020-04-13 22:27:42 +02:00
Simon Wisselink 4f89f6d84f Throw SmartyException when setting caching attributes for cacheable plugin as compiling this would fail (#573)
Fixes #457
2020-04-13 22:26:24 +02:00
Simon Wisselink 4396351d75 Switched to a more advanced regex to test wheter parameter is a variable (#567)
* This appears to fix #453, #498, #499 and possibly more issues.
2020-04-13 22:24:29 +02:00
Simon Wisselink 17d4d43624 Feature/merge smarty-phpunit into tests subfolder (#580)
* Removed unneeded files and replace dummy.txt with .gitignore files
* Synced unit tests with master codebase, noted TODO's, fixed phpunit scripts and travis config
* fix php7.4 deprecation and remove php7.4 from travis allow_failures since php7.4 is current stable

Co-authored-by: Uwe Tews <uwe.tews@googlemail.com>
Co-authored-by: Uwe Tews <uwe.tews@gmail.com>
Co-authored-by: AnrDaemon <anrdaemon@yandex.ru>
2020-04-13 15:30:52 +02:00
Simon Wisselink 61e7412807 Merge pull request #570 from vadimkuragkovskiy/master
fix minor typo
2020-04-12 11:41:22 +02:00
Vadim Kuragkovskiy 38b5ac72fa fix minor typo 2020-02-07 18:56:25 +02:00
Simon Wisselink 4b29dfce11 Merge pull request #566 from smarty-php/bugfix/506_foreachelse_on_arrayiterators
Bugfix/506 foreachelse on arrayiterators
2020-01-27 16:08:35 +01:00
Simon Wisselink e0df3d47e2 Ignore templates_c dir 2020-01-27 16:04:04 +01:00
Simon Wisselink 62d772e734 Fixed broken nesting and null handling. 2020-01-27 16:02:02 +01:00
Simon Wisselink 388993e9ca Fix foreachelse on arrayiterators
Keep track of main loop using a do_else variable.
Fixed #506
2020-01-27 15:24:45 +01:00
Simon Wisselink 97c27a0f2f Merge pull request #503 from SeahunOh/master
fix typo
2020-01-26 23:49:57 +01:00
Monte Ohrt b2ecd98ae0 update changelog to reflect resent pull request merges 2020-01-13 18:56:03 -06:00
mohrt 4911f49b9c Merge pull request #535 from glensc/patch-1
exclude error_reporting.ini from git export
2020-01-13 18:51:34 -06:00
mohrt a62a7caf97 Merge pull request #540 from Hunman/master
Fixing problem with assigning value to object variables as arrays in smarty_internal_compile_assign
2020-01-13 18:50:41 -06:00
mohrt 704fcef160 Merge pull request #542 from IT-Experte/master
Fixed using wrong get and set methods from class memcached
2020-01-13 18:48:56 -06:00
mohrt d1f37449a9 Merge pull request #546 from matks/enhance-readme
Add Travis badge and php compatibility infos in readme
2020-01-13 18:46:14 -06:00
mohrt 9e9961feae Merge pull request #551 from bits4breakfast/master
Replace callback typehint with callable
2020-01-13 18:45:23 -06:00
mohrt 4fb3f616b2 Merge pull request #560 from JercSi/master
Typo in exception message
2020-01-13 18:44:07 -06:00
mohrt e4239d095a Merge pull request #563 from caugner/patch-1
Fixes the change log date of the 3.1.34 release
2020-01-13 18:42:54 -06:00
Claas Augner 5547e0177b fix change log date 2020-01-13 18:51:37 +01:00
JercSi b9b9d30144 Typo in exception message
Added space between 'line' and line number.
2019-12-20 09:49:32 +01:00
Monte Ohrt 0137c2e7e6 update change log version 2019-12-12 18:56:47 -06:00
Matteo Galli c7ee6a3333 Replace callback typehint with callable
`callback` is not a valid PHP type and makes static analysis tools failing
2019-08-14 09:34:42 +02:00
Mathieu Ferment 651b129700 Add Travis badge and php compatibility infos in readme 2019-07-04 11:11:51 +02:00
Mathias 6d8d3b67d8 Changed read and write methods for compatibility with class memcached
The methods of the memcached class have different parameters than the memcache class.
2019-05-24 12:08:44 +02:00
Sanyi 7bc96d56fe Fix missing parenthesises in smarty_internal_compile_assign 2019-05-13 17:15:14 +02:00
Elan Ruusamäe 78924d8d68 exclude error_reporting.ini from git export 2019-03-02 18:11:04 +02:00
uwetews c9f0de05f4 Fix PHPunit tests for PHP7 https://github.com/smarty-php/smarty/pull/532 2019-02-28 07:42:20 +01:00
uwetews f93f95787f Fix PHPunit tests for PHP7 https://github.com/smarty-php/smarty/pull/532 2019-02-28 05:59:23 +01:00
uwetews 70fc2fd276 Travis fix 2018-12-09 05:06:53 +01:00
uwetews 3ddd960337 Travis fix 2018-12-09 04:42:05 +01:00
uwetews 20bb96c1b0 Revert "Travis fix"
This reverts commit eca7ec7f48.
2018-12-09 04:28:51 +01:00
uwetews 22cb50fcda Revert "Travis fix"
This reverts commit 2db8437354.
2018-12-09 04:28:28 +01:00
uwetews f0d1b52094 Revert "Travis fix"
This reverts commit 4dbaa25cee.
2018-12-09 04:27:56 +01:00
uwetews 4dbaa25cee Travis fix 2018-12-09 04:23:02 +01:00
uwetews 2db8437354 Travis fix 2018-12-09 04:17:23 +01:00
uwetews eca7ec7f48 Travis fix 2018-12-09 04:05:30 +01:00
uwetews d453d9e667 Merge pull request #515 from AnrDaemon/use-classmaps
Use Composer classmap autoload instead of custom bootstrap.
2018-11-28 07:01:04 +01:00
AnrDaemon dc2484dd3c Merge branch 'master' into use-classmaps 2018-11-26 21:21:43 +03:00
AnrDaemon 91af98d328 Tweaked the composer.json a little. 2018-11-26 20:58:42 +03:00
uwetews 69c6a0d650 Merge pull request #509 from jplusc/patch-1
minor typo in NEW_FEATURES.txt (setLiterals)
2018-11-11 09:16:56 +01:00
jplusc 69e8f3f892 minor typo in NEW_FEATURES.txt (setLiterals)
function is actually 'setLiterals' but docs refer to 'setLiteral'
2018-11-10 21:44:33 -05:00
shpik 5ccdf3a3fc fix typo
fix typo
2018-11-01 01:01:47 +09:00
uwetews 68537949f2 - bugfix a nested subblock in an inheritance child template was not replace by
outer level block with same name in same child template https://github.com/smarty-php/smarty/issues/500
2018-10-30 01:03:52 +01:00
uwetews 433d220fa1 - bugfix Smarty::$php_handling == PHP_PASSTHRU (default) did eat the "\n" (newline) character if it did directly followed
a PHP tag like "?>" or other https://github.com/smarty-php/smarty/issues/501
2018-10-29 23:32:22 +01:00
uwetews 3626e37c53 - bugfix autoloader exit shortcut https://github.com/smarty-php/smarty/issues/467 2018-10-14 04:18:45 +02:00
uwetews b05bc1b617 - bugfix in date-format modifier; NULL at date string or default_date did not produce correct output
https://github.com/smarty-php/smarty/pull/458
2018-10-11 09:22:23 +02:00
uwetews c930f0e207 - bugfix {insert} not works when caching is enabled and included template is present
https://github.com/smarty-php/smarty/issues/496
2018-10-11 06:56:22 +02:00
uwetews 7f531f6a44 09.10.2018
- bugfix fix of 26.8.2017 https://github.com/smarty-php/smarty/issues/327
   modifier is applied to sum expression https://github.com/smarty-php/smarty/issues/491
 - bugfix indexed arrays could not be defined "array(...)""
2018-10-09 03:36:14 +02:00
uwetews 9301ba4bfc 09.10.2018
- bugfix fix of 26.8.2017 https://github.com/smarty-php/smarty/issues/327
   modifier is applied to sum expression https://github.com/smarty-php/smarty/issues/491
 - bugfix indexed arrays could not be defined "array(...)""
2018-10-09 03:34:34 +02:00
uwetews 5204723bc6 update .travis.yml 2018-09-18 05:36:27 +02:00
uwetews a6cb648dfc - bugfix large plain text template sections without a Smarty tag > 700kB could
could fail in version 3.1.32 and 3.1.33 because PHP preg_match() restrictions
    https://github.com/smarty-php/smarty/issues/488
2018-09-18 04:46:30 +02:00
AnrDaemon b9dbd46289 Merge branch 'master' into use-classmaps 2018-09-14 17:25:51 +03:00
uwetews dd55b23121 Prepare 3.1.33 release 2018-09-12 22:54:16 +02:00
uwetews 2d1905cd88 - bugfix {foreach} using new style property access like {$item@property} on
Smarty 2 style named foreach loop could produce errors https://github.com/smarty-php/smarty/issues/484
2018-09-03 01:18:26 +02:00
uwetews 2c60503dfc - bugfix some custom left and right delimiters like '{^' '^}' did not work
https://github.com/smarty-php/smarty/issues/450 https://github.com/smarty-php/smarty/pull/482
2018-08-31 17:32:44 +02:00
uwetews 7b64226e16 - reformating for PSR-2 coding standards https://github.com/smarty-php/smarty/pull/483 2018-08-31 16:46:20 +02:00
uwetews 4f7cd8f1b3 - reformating for PSR-2 coding standards https://github.com/smarty-php/smarty/pull/483 2018-08-31 16:45:09 +02:00
uwetews d52a04fba1 travis configuration problem fpr PHP 5.4 2018-08-31 16:24:31 +02:00
uwetews 8a4a817c66 - bugfix on Windows absolute filepathes did fail if the drive letter was followed by a linux DIRECTORY_SEPARATOR
like C:/  at Smarty > 3.1.33-dev-5 https://github.com/smarty-php/smarty/issues/451
2018-08-31 16:07:47 +02:00
uwetews 7a8607fe17 - PSR-2 code style fixes for config and template file Lexer/Parser generated with
the Smarty Lexer/Parser generator from https://github.com/smarty-php/smarty-lexer
    https://github.com/smarty-php/smarty/pull/483
2018-08-31 02:37:47 +02:00
Uwe Tews 3a78a21f14 Update .gitattributes to force eol=lf 2018-08-30 17:38:07 +02:00
uwetews a1f6720318 - bugfix/enhancement {capture} allow variable as capture block name in Smarty special variable
like $smarty.capture.$foo https://github.com/smarty-php/smarty/issues/478 https://github.com/smarty-php/smarty/pull/481
2018-08-26 00:46:29 +02:00
uwetews 8e09f97a14 - bugfix/enhancement {capture} allow variable as capture block name in Smarty special variable
like $smarty.capture.$foo https://github.com/smarty-php/smarty/issues/478 https://github.com/smarty-php/smarty/pull/481
2018-08-26 00:20:31 +02:00
uwetews 72185fb743 Merge pull request #477 from dusta/master
Fixed #476, Wrong demo directory location
2018-08-19 11:48:13 +02:00
uwetews 7096c99ff3 - fix PSR-2 coding standards and PHPDoc blocks https://github.com/smarty-php/smarty/pull/452
https://github.com/smarty-php/smarty/pull/475
    https://github.com/smarty-php/smarty/pull/473
  - bugfix PHP5.2 compatibility https://github.com/smarty-php/smarty/pull/472 (reverted from commit 2fe3a30e75) (reverted from commit ed674ee050)
2018-08-19 10:30:28 +02:00
uwetews ed674ee050 - fix PSR-2 coding standards and PHPDoc blocks https://github.com/smarty-php/smarty/pull/452
https://github.com/smarty-php/smarty/pull/475
    https://github.com/smarty-php/smarty/pull/473
  - bugfix PHP5.2 compatibility https://github.com/smarty-php/smarty/pull/472 (reverted from commit 2fe3a30e75)
2018-08-19 10:22:47 +02:00
Sławomir Kaleta d191935127 Fixed #476, Wrong demo directory location 2018-08-19 09:47:58 +02:00
uwetews 2fe3a30e75 - fix PSR-2 coding standards and PHPDoc blocks https://github.com/smarty-php/smarty/pull/452
https://github.com/smarty-php/smarty/pull/475
    https://github.com/smarty-php/smarty/pull/473
  - bugfix PHP5.2 compatibility https://github.com/smarty-php/smarty/pull/472
2018-08-19 02:41:43 +02:00
uwetews 799b5cb342 - fix PSR-2 coding standards and PHPDoc blocks https://github.com/smarty-php/smarty/pull/452
https://github.com/smarty-php/smarty/pull/475
    https://github.com/smarty-php/smarty/pull/473
  - bugfix PHP5.2 compatibility https://github.com/smarty-php/smarty/pull/472
2018-08-19 02:35:46 +02:00
uwetews b5e5085391 Merge pull request #452 from dusta/Update-PSR-2
Update PSR-2
2018-08-12 03:20:33 +02:00
AnrDaemon da29452d74 Updated composer.json with require-dev deps. 2018-07-19 20:03:29 +03:00
AnrDaemon e9dacb4fd0 Integrate ongoing master. 2018-06-19 07:51:02 +03:00
Sławomir Kaleta 2404095783 Update PSR-2 2018-06-12 09:58:15 +02:00
Uwe Tews cc4d8fa1a0 - bugfix strip-block produces different output in Smarty v3.1.32 https://github.com/smarty-php/smarty/issues/436 2018-05-17 16:04:48 +02:00
Uwe Tews 87ec44e9f8 - bugfix Smarty::compileAllTemplates ignores $extension parameter https://github.com/smarty-php/smarty/issues/437
https://github.com/smarty-php/smarty/pull/438
2018-05-17 13:50:14 +02:00
Uwe Tews e2aec4d011 Fix annotation https://github.com/smarty-php/smarty/issues/441 2018-05-17 08:12:26 +02:00
Uwe Tews 514d99beaa - improvement do not compute total property in {foreach} if not needed https://github.com/smarty-php/smarty/issues/443 2018-05-17 06:27:35 +02:00
Uwe Tews 115e178884 - bugfix plugins may not be loaded when setMergeCompiledIncludes is true https://github.com/smarty-php/smarty/issues/435 2018-05-17 04:40:58 +02:00
Uwe Tews cb59fc5537 Delete unwanted file 2018-04-28 05:32:02 +02:00
Uwe Tews c9dbe1d08c - bugfix regarding Security Vulnerability did not solve the problem under Linux 2018-04-26 21:38:08 +02:00
Uwe Tews 2e081a51b1 - bugfix regarding Security Vulnerability did not solve the problem under Linux 2018-04-26 18:06:45 +02:00
Uwe Tews f9ca3c63d1 - bugfix regarding Security Vulnerability did not solve the problem under Linux 2018-04-26 13:02:51 +02:00
Uwe Tews ac9d4b587e Release version 3.1.32 2018-04-24 16:53:33 +02:00
Uwe Tews e83bdc2ece Revert "remove - php: nightly test"
This reverts commit 216ada91f3.
2018-04-24 16:51:39 +02:00
Uwe Tews bcedfd6b58 Release version 3.1.32 2018-04-24 16:14:10 +02:00
Uwe Tews 216ada91f3 remove - php: nightly test 2018-04-24 16:00:35 +02:00
Uwe Tews a57d514e8c update .travis.yml 2018-04-24 12:41:39 +02:00
Uwe Tews 20c3f70379 update .travis.yml 2018-04-24 12:37:01 +02:00
Uwe Tews c95d3f3a4d - fix compatibility for PHP version < 5.6 2018-04-24 11:33:47 +02:00
Uwe Tews 8d21f38dc3 - bugfix possible Security Vulnerability in Smarty_Security class. 2018-04-24 10:38:18 +02:00
Uwe Tews fbbb292ef0 update access to parent object 2018-04-19 16:04:41 +02:00
Uwe Tews 8bea607b78 fix comment lines of inline subtemplates 2018-04-19 15:57:37 +02:00
uwetews 7c3606e839 Merge pull request #432 from dusta/patch-1
Update README.md
2018-04-19 13:14:12 +02:00
Dusta b2d55b677d Update README.md
Add https, add dots
2018-04-14 20:32:35 +02:00
Uwe Tews 860ebb618e - bugfix plugins may not be loaded if {function} or {block} tags are executed in nocache mode 2018-03-28 07:35:52 +02:00
Uwe Tews 336c07c23f - bugfix plugins may not be loaded if {function} or {block} tags are executed in nocache mode
https://github.com/smarty-php/smarty/issues/371
2018-03-28 07:15:29 +02:00
Uwe Tews cf22e986c0 - new feature {parent} = {$smarty.block.parent} {child} = {$smarty.block.child} 2018-03-28 07:14:29 +02:00
Uwe Tews 0dbace8321 - new feature {parent} = {$smarty.block.parent} {child} = {$smarty.block.child} 2018-03-26 22:35:31 +02:00
Uwe Tews c81948d602 - bugfix preg_replace could fail on large content resulting in a blank page https://github.com/smarty-php/smarty/issues/417 2018-03-23 19:34:18 +01:00
Uwe Tews 3a3b8c75a1 - bugfix preg_replace could fail on large content resulting in a blank page https://github.com/smarty-php/smarty/issues/417 2018-03-23 19:14:53 +01:00
Uwe Tews d646d4678c - bugfix preg_replace could fail on large content resulting in a blank page https://github.com/smarty-php/smarty/issues/417 2018-03-23 19:11:12 +01:00
Uwe Tews d79af55485 - bugfix short form of {section} attributes did not work https://github.com/smarty-php/smarty/issues/428 2018-03-21 15:19:57 +01:00
Uwe Tews b7e7def0b1 - 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
2018-03-21 07:36:11 +01:00
Uwe Tews 60415e6f2a - improvement Smarty::compileAllTemplates() exit with a non-zero status code if max errors is reached https://github.com/smarty-php/smarty/pull/402 2018-03-17 08:31:40 +01:00
Uwe Tews a5961606f3 - bugfix extends resource did not work with user defined left/right delimiter https://github.com/smarty-php/smarty/issues/419 2018-03-16 18:44:47 +01:00
AnrDaemon ca00a31f71 Use Composer classmap instead of bootstrap. 2017-12-05 21:19:17 +03:00
Uwe Tews 93909aacf8 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 2017-11-22 01:21:09 +01:00
Uwe Tews 40ea5d89da - replacement of " by ' 2017-11-20 12:26:48 +01:00
Uwe Tews fcf108b33f bugfix variable filter might not have been loaded in cache file for use in nocache sections. 2017-11-20 11:11:46 +01:00
Uwe Tews 96fd914cc1 bugfix rework of newline spacing between tag code and template text.
now again identical with Smarty2 (forum topic 26878)
2017-11-20 04:07:51 +01:00
Uwe Tews 654659aadf remove html tags from PHPDoc blocks 2017-11-11 07:11:33 +01:00
Uwe Tews 96bcbd2221 fix comment correct last commit 2017-11-11 07:10:35 +01:00
Uwe Tews efe0e4c40c fix comment 2017-11-11 06:44:33 +01:00
Uwe Tews da273df95f remove blanks on line endings 2017-11-06 19:27:14 +01:00
Uwe Tews 5220ca6776 - bugfix {$smarty.section.name.loop} used together with {$smarty.section.name.total} could produce
wrong results (forum topic 27041) 3.1.32-dev-35
2017-11-06 04:58:02 +01:00
Uwe Tews 3fc8abeb98 code cleanup and optimizations 3.1.32-dev-34 2017-11-06 01:02:56 +01:00
Uwe Tews 3799714d53 lexer/parser optimization 2017-11-05 20:04:32 +01:00
Uwe Tews dd9c076dfa - correction of PHPDoc blocks
- minor code cleanup
2017-10-26 10:25:41 +02:00
Uwe Tews 812758225c - optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR
version update because of recent commit problems
2017-10-26 06:34:51 +02:00
Uwe Tews 5d8cd94c1d - optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR 2017-10-26 06:30:19 +02:00
Uwe Tews 570bc41b12 - optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR 2017-10-26 06:14:22 +02:00
Uwe Tews 4575a31e62 - 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.
2017-10-26 06:00:40 +02:00
Uwe Tews 926ed8714b - optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR 2017-10-26 05:36:13 +02:00
Uwe Tews f86d251e5b - optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR 2017-10-26 05:27:25 +02:00
Uwe Tews c404294a1f - bugfix Smarty version was not filled in header comment of compiled and cached files 2017-10-26 05:09:07 +02:00
Uwe Tews 87f260e3a9 fix Smarty version in header comment (reverted from commit 5ec2e1f62b) 2017-10-26 04:37:39 +02:00
Uwe Tews 41621ca35e - optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR (reverted from commit f7a5316205) 2017-10-26 04:37:31 +02:00
Uwe Tews a675aaf68e - optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR (reverted from commit f7a5316205) (reverted from commit beaa293eb3) 2017-10-26 04:37:17 +02:00
Uwe Tews f3950a45a7 - bugfix Smarty version was not filled in header comment of compiled and cached files
- optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR (reverted from commit 1e787d08f1)
2017-10-26 04:37:05 +02:00
Uwe Tews 8e9108544a - bugfix Smarty version was not filled in header comment of compiled and cached files
- optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR (reverted from commit 1e787d08f1) (reverted from commit 42a292d56a)
2017-10-26 04:36:41 +02:00
Uwe Tews 4cbc436599 - optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR (reverted from commit f7a5316205) (reverted from commit beaa293eb3) (reverted from commit 86f36196e2) 2017-10-26 04:36:17 +02:00
Uwe Tews eaac933770 - optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR (reverted from commit f7a5316205) (reverted from commit beaa293eb3) (reverted from commit 86f36196e2) (reverted from commit 36c6a72015) 2017-10-26 04:36:08 +02:00
Uwe Tews 36c6a72015 - optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR (reverted from commit f7a5316205) (reverted from commit beaa293eb3) (reverted from commit 86f36196e2) 2017-10-26 04:35:56 +02:00
Uwe Tews 86f36196e2 - optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR (reverted from commit f7a5316205) (reverted from commit beaa293eb3) 2017-10-26 04:19:23 +02:00
Uwe Tews 42a292d56a - bugfix Smarty version was not filled in header comment of compiled and cached files
- optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR (reverted from commit 1e787d08f1)
2017-10-26 04:18:28 +02:00
Uwe Tews 1e787d08f1 - bugfix Smarty version was not filled in header comment of compiled and cached files
- optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR
2017-10-26 03:38:27 +02:00
Uwe Tews beaa293eb3 - optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR (reverted from commit f7a5316205) 2017-10-26 03:37:40 +02:00
Uwe Tews f7a5316205 - optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR 2017-10-22 03:38:10 +02:00
Uwe Tews 5ec2e1f62b fix Smarty version in header comment 2017-10-21 23:43:22 +02:00
Uwe Tews 3d7dece088 - bugfix custom delimiters could fail since modification of version 3.1.32-dev-23
https://github.com/smarty-php/smarty/issues/394
2017-10-21 13:14:14 +02:00
Uwe Tews 668d07cda9 disable php5.2 tests 2017-10-18 14:03:22 +02:00
Uwe Tews 338f5a5769 enable PHPunit tests for PHP 5.2 and 5.3 2017-10-18 13:50:29 +02:00
Uwe Tews 19ebab9e4a enable PHPunit tests for PHP 5.2 and 5.3 2017-10-18 13:39:19 +02:00
Uwe Tews e4f41adf5a -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
2017-10-18 09:40:38 +02:00
Uwe Tews 6b97d5cdd5 - unclosed block tag in double quted string must throw compiler exception.
https://github.com/smarty-php/smarty/issues/391 https://github.com/smarty-php/smarty/issues/392
2017-10-12 20:15:42 +02:00
Uwe Tews b271173a2d 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
2017-10-12 08:21:12 +02:00
Uwe Tews 34fc5e6b46 remove phpunit tests for hhvm 2017-10-09 23:50:45 +02:00
Uwe Tews 64ed85a954 enable PHPunit tests for PHP 7.2 and hhvm 2017-10-09 23:28:58 +02:00
Uwe Tews 0bf112c2bb Use phpunit 6.4.1 for PHP 7.1 2017-10-09 21:26:36 +02:00
Uwe Tews 157f51086c Test phpunit 6.4.1 (reverted from commit f60d8a763c) 2017-10-09 17:04:03 +02:00
Uwe Tews 7e84d34363 Use phpunit 6.4.1 for PHP 7.1 2017-10-09 16:38:32 +02:00
Uwe Tews 0f0fdf0200 Use phpunit 6.4.1 for PHP 7.1 2017-10-09 15:22:35 +02:00
Uwe Tews 0b8940c75e Use phpunit 6.4.1 for PHP 7.1 2017-10-09 14:30:08 +02:00
Uwe Tews b98be78cbf Use phpunit 6.4.1 for PHP 7.1 2017-10-09 14:17:47 +02:00
Uwe Tews 0cad914147 Test phpunit 6.4.1 2017-10-09 14:08:36 +02:00
Uwe Tews d76a00673b Test phpunit 6.4.1 2017-10-09 13:56:16 +02:00
Uwe Tews f60d8a763c Test phpunit 6.4.1 2017-10-09 13:53:21 +02:00
Uwe Tews 1bb374c1fb Test phpunit 6.4.1 2017-10-09 13:39:54 +02:00
Uwe Tews 8d3153401a Test phpunit 6.4.1 2017-10-09 13:27:39 +02:00
Uwe Tews f55baf5e73 Test phpunit 6.4.1 2017-10-09 13:19:19 +02:00
Uwe Tews 89d924659e Test phpunit 6.4.1 2017-10-09 13:15:55 +02:00
Uwe Tews 989e49a7de Test phpunit 6.4.1 2017-10-09 13:13:11 +02:00
Uwe Tews 2777efb84e Test phpunit 6.4.1 2017-10-09 13:07:51 +02:00
Uwe Tews 68b73fe153 Test phpunit 6.1 2017-10-09 13:02:59 +02:00
Uwe Tews 030abc6364 Test against 7.1.9
PHPunit does fail on 7.1.10
2017-10-09 10:53:47 +02:00
Uwe Tews b1cc51a380 set error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT for PHP versions == 7.1 2017-10-09 10:23:21 +02:00
Uwe Tews e25bc7a291 set error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT for PHP versions >= 7.0 2017-10-09 10:13:52 +02:00
Uwe Tews 9ad66c695d Update COMPOSER_RELEASE_NOTES.txt
https://github.com/smarty-php/smarty/issues/373
2017-10-09 08:53:58 +02:00
Uwe Tews 428efa634d - bugfix modification of 9.8.2017 did fail on some recursive
tag nesting. https://github.com/smarty-php/smarty/issues/389
2017-10-07 09:05:54 +02:00
Uwe Tews b0ea1cb5df Improve extension handler 2017-10-07 08:20:18 +02:00
Uwe Tews deb9e12aaa - bugfix {make_nocache} did display code if the template did not contain other nocache code
https://github.com/smarty-php/smarty/issues/369
2017-08-26 16:13:04 +02:00
Uwe Tews 94c2ab7e54 - bugfix templates filepath with multibyte characters did not work
https://github.com/smarty-php/smarty/issues/385
2017-08-26 14:56:02 +02:00
Uwe Tews f90b449d21 - bugfix chained modifier failed when last modifier parameter is a signed value
https://github.com/smarty-php/smarty/issues/327
2017-08-26 11:47:41 +02:00
Uwe Tews 511773ce6b - improvement repeated delimiter like {{ and }} will be treated as literal
https://groups.google.com/forum/#!topic/smarty-developers/h9r82Bx4KZw
2017-08-09 12:58:47 +02:00
Uwe Tews 2c1f0312a1 register autoloader as first in chain 2017-08-09 12:22:37 +02:00
Uwe Tews 6a257a7ad3 - improvement repeated delimiter like {{ and }} will be treated as literal
https://groups.google.com/forum/#!topic/smarty-developers/h9r82Bx4KZw
2017-08-09 12:20:33 +02:00
Uwe Tews 418a1fd443 - improvement repeated delimiter like {{ and }} will be treated as literal
https://groups.google.com/forum/#!topic/smarty-developers/h9r82Bx4KZw
2017-08-09 11:15:33 +02:00
Uwe Tews 353240c38d fixed spelling 2017-08-06 05:01:15 +02:00
Uwe Tews db16d0d2e6 fixed typo 2017-08-06 02:58:05 +02:00
Uwe Tews 30526520b6 - cleanup of _getSmartyObj() 2017-08-05 23:08:59 +02:00
Uwe Tews 5cc9b27784 - bugfix wordwrap modifier could fail if used in nocache code.
converted plugin file shared.mb_wordwrap.php into modifier.mb_wordwrap.php
2017-08-05 19:59:23 +02:00
Uwe Tews c3b331d2ad remove PHP 5.3 test 2017-07-31 23:26:41 +02:00
Uwe Tews da6181f733 Update travis.yml 2017-07-31 23:23:35 +02:00
Uwe Tews 036f1143fa Update travis.yml 2017-07-31 23:09:38 +02:00
Uwe Tews 105651a469 - Call clearstatcache() after mkdir() failure https://github.com/smarty-php/smarty/pull/379 2017-07-31 18:58:41 +02:00
Uwe Tews bcfea52cbf - rewrite mkdir() bugfix to retry automatically see https://github.com/smarty-php/smarty/pull/377
https://github.com/smarty-php/smarty/pull/379
2017-07-30 05:16:31 +02:00
Uwe Tews 5165776aec add link to documentation
https://github.com/smarty-php/smarty/issues/380
2017-07-30 00:39:41 +02:00
uwetews b562e9527e Merge pull request #320 from glensc/patch-1
Update Autoloader.php comment
2017-07-21 08:17:14 +02:00
Uwe Tews 5a8d015ef1 - bugfix solve preg_match() hhvm parameter problem https://github.com/smarty-php/smarty/pull/372 2017-07-21 08:12:33 +02:00
Uwe Tews f3325c4923 Merge pull request #377 from a-shpota/fix-writefile-sysplugin
fix 'mkdir(): File exists' error on create directory from parallel processes
2017-07-21 06:46:13 +02:00
uwetews ba2de9721b Merge pull request #377 from a-shpota/fix-writefile-sysplugin
fix 'mkdir(): File exists' error on create directory from parallel processes
2017-07-21 06:38:05 +02:00
Uwe Tews 67e9d08371 remove hhvm from travis tests 2017-07-21 05:53:22 +02:00
Uwe Tews bd6bf0628e fix travis for hhvm testing 2017-07-21 05:43:05 +02:00
Uwe Tews 614ad1f8b9 - security possible PHP code injection on custom resources at display() or fetch()
calls if the resource does not sanitize the template name
2017-07-21 05:13:54 +02:00
Andrew Shpota 6768340a97 fix 'mkdir(): File exists' error on create directory from parallel
processes
2017-07-14 15:10:12 +03:00
uwetews a6f3a518e1 - improvement replace phpversion() by PHP_VERSION constant.
https://github.com/smarty-php/smarty/pull/363
2017-05-27 14:37:35 +02:00
uwetews 03e2a1c8a2 - bugfix https://github.com/smarty-php/smarty/pull/368 did break the default plugin handler 2017-05-27 12:33:48 +02:00
uwetews ea93486135 - bugfix https://github.com/smarty-php/smarty/pull/368 did break the default plugin handler 2017-05-27 12:18:43 +02:00
uwetews ef889c79e0 - bugfix change compiled code for registered function and modifiers to called as callable to allow closures
https://github.com/smarty-php/smarty/pull/368
2017-05-27 11:30:21 +02:00
uwetews e51b0ac4af - 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
2017-05-27 11:04:00 +02:00
uwetews a49a08748f Remove nightly test. Does hang on PHP 7.2 2017-05-21 19:55:25 +02:00
uwetews 63b578708f disable PHP 5.2 tests 2017-05-21 19:23:25 +02:00
uwetews 0f2d703c63 Add PHP 5.2 to test (reverted from commit 3dbb5c4eae) 2017-05-21 18:59:00 +02:00
uwetews 3dbb5c4eae Add PHP 5.2 to test 2017-05-21 18:34:21 +02:00
uwetews cd1a864751 Add PHP 5.2 to test (reverted from commit 9e7c1f4b0d) 2017-05-21 18:22:43 +02:00
uwetews 9e7c1f4b0d Add PHP 5.2 to test 2017-05-21 18:20:19 +02:00
uwetews f860f7ce88 - bugfix version 3.1.31 did fail under PHP 5.2
https://github.com/smarty-php/smarty/issues/365
2017-05-21 18:19:52 +02:00
uwetews 28688d5ce7 - 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
    fixed bug in above change
2017-05-21 17:14:30 +02:00
uwetews 4fd1f7684e - 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
2017-05-21 16:58:58 +02:00
uwetews 61b59a9ec3 - bugfix remove special treatment of classes implementing ArrayAccess in {foreach}
https://github.com/smarty-php/smarty/issues/332
2017-05-21 02:24:48 +02:00
uwetews da22c961bb - improvement check if ini_get() and ini_set() not disabled
https://github.com/smarty-php/smarty/pull/362
2017-05-21 02:24:48 +02:00
uwetews 2782e83a92 - 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
2017-05-21 02:24:48 +02:00
uwetews d571ffa111 Merge pull request #361 from zonuexe/patch-1
Fix markdown
2017-05-19 19:02:48 +02:00
uwetews 8f54ad7c96 Merge pull request #354 from jcodt/master
Fix markdown titles
2017-05-19 19:02:08 +02:00
uwetews f0e215b954 - change properties $accessMap and $obsoleteProperties from private to protected
https://github.com/smarty-php/smarty/issues/351
2017-05-19 04:54:49 +02:00
USAMI Kenta e3cea24be1 Fix markdown
affected by GitHub's Markdown parser change
https://githubengineering.com/a-formal-spec-for-github-markdown/
2017-05-11 10:50:42 +09:00
jcodt 5af93831ee Fix markdown titles 2017-04-25 17:49:55 +02:00
uwetews 5448fecc9d - fix spelling https://github.com/smarty-php/smarty/commit/e3eda8a5f5653d8abb960eb1bc47e3eca679b1b4#commitcomment-21803095 2017-04-24 18:21:37 +02:00
uwetews e3eda8a5f5 - correct generated code on empty() and isset() call, observe change PHP behaviour since PHP 5.5
https://github.com/smarty-php/smarty/issues/347
2017-04-17 05:32:24 +02:00
uwetews 29388b8baa - correct generated code on empty() and isset() call, observe change PHP behaviour since PHP 5.5
https://github.com/smarty-php/smarty/issues/347 (reverted from commit cfd8bf32b0)
2017-04-17 05:04:44 +02:00
uwetews f7bdfe463b Add PHP 7.1 to travis tests 2017-04-17 04:35:17 +02:00
uwetews cfd8bf32b0 - correct generated code on empty() and isset() call, observe change PHP behaviour since PHP 5.5
https://github.com/smarty-php/smarty/issues/347
2017-04-17 03:49:39 +02:00
uwetews 1a7328ca67 - 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
2017-04-14 15:01:43 +02:00
uwetews cfc3f8c424 Merge pull request #322 from simivar/patch-1
Fix annotation for addPluginsDir()
2017-04-14 14:52:18 +02:00
uwetews ec9fd99684 Merge pull request #349 from ka7/feature/spelling
spelling fixes
2017-04-14 14:37:18 +02:00
uwetews 00974d74b8 Merge pull request #337 from SvenRtbg/patch-1
Fix typo in @method annotation
2017-04-14 14:33:19 +02:00
uwetews 6d85c715f1 - bugfix array_merge() parameter should be checked https://github.com/smarty-php/smarty/issues/350 2017-04-13 07:15:46 +02:00
uwetews fd95365bf3 Prepare 3.1.32-dev 2017-04-13 05:17:27 +02:00
klemens 51a0e764e8 spelling fixes 2017-04-08 12:10:39 +02:00
SvenRtbg 697df30d18 Fix typo in @method annotation
It's `setDefaultModifiers()`, not `setDefaultModifier()`
2017-02-14 22:48:26 +01:00
simivar 1900ce24a3 Fix annotation for addPluginsDir()
Param of [addPluginsDir()](http://www.smarty.net/docs/en/api.add.plugins.dir.tpl) can be null, array or a string. Fixed annotation so there will be no IDE warnings.
2016-12-29 14:52:35 +01:00
Elan Ruusamäe 66205d5565 Update Autoloader.php
spelling fix
2016-12-21 23:36:37 +02:00
uwetews c7d42e4a32 prepare 3.1.31 release 2016-12-14 22:57:25 +01:00
uwetews 27928ece9c - move template object cache into static variables 2016-11-23 17:12:38 +01:00
uwetews 04a2327c75 - change version checking 2016-11-19 18:13:00 +01:00
uwetews 91af9d090a - bugfix inheritance root child templates containing nested {block}{/block} could call sub-bock content from parent
template https://github.com/smarty-php/smarty/issues/317
2016-11-19 07:34:06 +01:00
uwetews 05933749c0 - smaller speed optimization 2016-11-11 23:09:28 +01:00
uwetews be054c1727 touch 2016-11-11 22:17:35 +01:00
uwetews 5b9699b41a touch 2016-11-11 22:16:58 +01:00
uwetews b745a31a2d fixed spelling chilek commented on c4746e9 2016-11-11 21:17:32 +01:00
uwetews d120c1fad2 - bugfix when Smarty is using a cached template object on Smarty::fetch() or Smarty::isCached() the inheritance data
must be removed https://github.com/smarty-php/smarty/issues/312
2016-11-11 20:13:40 +01:00
uwetews e867ae125e add utility to build Smarty_Internal_Testinstall 2016-11-08 18:09:14 +01:00
uwetews 7438ac39d0 Merge pull request #295 from glensc/patch-1
exclude files from git export
2016-11-08 18:04:08 +01:00
uwetews 428a7ad883 - add bootstrap file to load and register Smarty_Autoloader. Change composer.json to make it known to composer 2016-11-08 17:48:25 +01:00
uwetews c4746e9080 - optimization of lexer speed https://github.com/smarty-php/smarty/issues/311 2016-11-07 03:08:11 +01:00
uwetews 2d2be8f57f - bugfix template function definitions array has not been cached between Smarty::fetch() and Smarty::display() calls
https://github.com/smarty-php/smarty/issues/301
2016-10-27 05:42:17 +02:00
uwetews 98efe22e02 - improvement/bugfix when Smarty::fetch() is called on a template object the inheritance and tplFunctions property
should be copied to the called template object
2016-10-23 18:48:17 +02:00
uwetews d79edd2fe0 - improvement/bugfix when Smarty::fetch() is called on a template object the inheritance and tplFunctions property
should be copied to the called template object
2016-10-23 18:34:59 +02:00
uwetews 29cbe10857 - bugfix for compile locking touched timestamp of old compiled file was not restored on compilation error https://github.com/smarty-php/smarty/issues/308 2016-10-21 04:00:07 +02:00
uwetews 6699299767 - bugfix nocache code was not removed in cache file when subtemplate did contain PHP short tags in text but no other
nocache code https://github.com/smarty-php/smarty/issues/300
2016-10-20 00:53:04 +02:00
uwetews 34e5739fc1 - bugfix {make_nocache $var} remove spaces from variable value https://github.com/smarty-php/smarty/issues/304 2016-10-19 20:43:17 +02:00
uwetews 80a024f44e - bugfix {make_nocache $var} did fail when variable value did contain '\' https://github.com/smarty-php/smarty/issues/305 2016-10-19 19:35:58 +02:00
uwetews f3e0e01266 - 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
2016-10-12 01:02:54 +02:00
uwetews 3c07a28434 - optimization move runtime extension for template functions into Smarty objects 2016-10-08 06:07:14 +02:00
uwetews caceefc300 use absolute path normalizaion 2016-09-30 04:10:25 +02:00
uwetews 80af6ea2b5 - improvement new Smarty::$extends_recursion property to disable execution of {extends} in templates called by extends resource
https://github.com/smarty-php/smarty/issues/296
2016-09-30 02:30:39 +02:00
uwetews 68ab01dc9e - improvement new Smarty::$extends_recursion property to disable execution of {extends} in templates called by extends resource
https://github.com/smarty-php/smarty/issues/296
2016-09-29 04:26:44 +02:00
uwetews 4de72f1acd - improvement new Smarty::$extends_recursion property to disable execution of {extends} in templates called by extends resource
https://github.com/smarty-php/smarty/issues/296
2016-09-29 04:22:20 +02:00
uwetews 5b508b7bf3 - bugfix nocache hash was not removed for <?xml ?> tags in subtemplates https://github.com/smarty-php/smarty/issues/300 2016-09-28 23:39:05 +02:00
uwetews 998c778948 - bugfix the generated code for calling a subtemplate must pass the template resource name in single quotes https://github.com/smarty-php/smarty/issues/299 2016-09-28 04:59:51 +02:00
uwetews 3f0d519daf - bugfix when Smarty does use an internally cached template object on Smarty::fetch() calls
the template and config variables must be cleared https://github.com/smarty-php/smarty/issues/297
2016-09-27 23:19:56 +02:00
Elan Ruusamäe beeec36bb8 exclude files from git export
add files to be excluded from git export

visible when used via composer --prefer-dist
2016-09-24 11:03:02 +03:00
uwetews efa18457f2 - temporary fix for https://github.com/smarty-php/smarty/issues/293 main reason still under investigation 2016-09-20 16:06:01 +02:00
uwetews ec3a00e5ab - improvement new tags {block_parent} {block_child} in template inheritance 2016-09-20 16:00:28 +02:00
uwetews b8acd7ea17 - bugfix some $smarty special template variables are no longer accessed as real variable.
using them on calls like {if isset($smarty.foo)} or {if empty($smarty.foo)} will fail
    http://www.smarty.net/forums/viewtopic.php?t=26222
2016-09-20 14:21:39 +02:00
uwetews d9a6938473 - cleanup convert cache resource file method clear into runtime extension 2016-09-19 16:39:19 +02:00
uwetews a9e7e8881e - optimization clear compiled and cached folder completely on detected version change 2016-09-19 14:59:49 +02:00
uwetews 8835408e0d - improvement make Smarty::clearCompiledTemplate() on custom resource independent from changes of templateId computation 2016-09-15 09:14:56 +02:00
uwetews cd28347130 - bugfix assigning a variable in if condition by function like {if $value = array_shift($array)} the function got called twice https://github.com/smarty-php/smarty/issues/291 2016-09-15 08:36:12 +02:00
uwetews f95b81a6f9 - bugfix calling $smarty->isCached() on a not existing cache file with $smarty->cache_locking = true; could cause a 10 second delay http://www.smarty.net/forums/viewtopic.php?t=26282 2016-09-15 06:43:36 +02:00
uwetews 58b6472d4f - bugfix function plugins called with assign attribute like {foo assign='bar'} did not output returned content because
because assumption was made that it was assigned to a variable https://github.com/smarty-php/smarty/issues/292
2016-09-15 03:23:04 +02:00
uwetews 424dca6d24 - bugfix assigning a variable in if condition by function like {if $value = array_shift($array)} the function got called twice https://github.com/smarty-php/smarty/issues/291 2016-09-15 02:56:34 +02:00
uwetews 44189a7531 - performance Smarty::configLoad() did load unneeded template source object 2016-09-11 05:41:16 +02:00
uwetews 0a8e47ecb2 - improvement move often used code snippets into methods 2016-09-11 04:35:52 +02:00
uwetews e62b40c421 - improvement {math} misleading E_USER_WARNING messages when parameter value = null https://github.com/smarty-php/smarty/issues/288 2016-09-11 00:23:37 +02:00
uwetews 7e230713c6 - improvement {math} misleading E_NOTICE messages when parameter value = null https://github.com/smarty-php/smarty/issues/288 (reverted from commit 810881c76e) 2016-09-11 00:21:45 +02:00
uwetews 810881c76e - improvement {math} misleading E_NOTICE messages when parameter value = null https://github.com/smarty-php/smarty/issues/288 2016-09-11 00:13:29 +02:00
uwetews 62099617ae - improvement {foreach} observe {break n} and {continue n} nesting levels when restoring saved $item and $key variables 2016-09-09 22:54:42 +02:00
uwetews 0e942e4821 - bugfix {foreach} must keep the @properties when restoring a saved $item variable as the properties might be used outside {foreach} https://github.com/smarty-php/smarty/issues/267 2016-09-09 19:45:08 +02:00
uwetews 21aa211ddb - bugfix/optimization {foreach} did not execute the {foreachelse} when iterating empty objects https://github.com/smarty-php/smarty/pull/287 2016-09-09 18:43:37 +02:00
uwetews 124b333da2 - bugfix implement wrapper for removed method getConfigVariable() https://github.com/smarty-php/smarty/issues/286 2016-09-08 22:28:06 +02:00
uwetews bfc1ef8885 - bugfix {capture}{/capture} did add in 3.1.30 unintended additional blank lines https://github.com/smarty-php/smarty/issues/268 2016-09-07 17:43:10 +02:00
uwetews 0429272370 - bugfix when {foreach} was looping over an object the total property like {$item@total} did always return 1 https://github.com/smarty-php/smarty/issues/281 2016-09-07 00:41:31 +02:00
uwetews e5bbc052b1 - bugfix uppercase TRUE, FALSE and NULL did not work when security was enabled https://github.com/smarty-php/smarty/issues/282 2016-09-07 00:15:44 +02:00
uwetews e82f966682 - bugfix using nocache like attribute with value true like {plugin nocache=true} did not work https://github.com/smarty-php/smarty/issues/285 2016-09-07 00:06:17 +02:00
uwetews 51e0d5cd40 - performance require_once should be called only once for shared plugins https://github.com/smarty-php/smarty/issues/280 2016-09-06 04:26:46 +02:00
uwetews e1d27d68d7 - performance require_once should be called only once for shared plugins https://github.com/smarty-php/smarty/issues/280 2016-09-02 01:08:50 +02:00
uwetews 5580857d9b - bugfix change of 23.08.2016 failed on linux when use_include_path = true 2016-08-26 05:54:11 +02:00
uwetews 2003020df9 - bugfix remove constant DS as shortcut for DIRECTORY_SEPARATOR as the user may have defined it to something else https://github.com/smarty-php/smarty/issues/277 2016-08-23 08:03:39 +02:00
uwetews be39cc0121 - bugfix {make_nocache} failed when using composer autoloader https://github.com/smarty-php/smarty/issues/275 2016-08-20 15:58:12 +02:00
uwetews c39abdf83e - bugfix {config_load ... scope="global"} shall not throw an arror but fallback to scope="smarty" https://github.com/smarty-php/smarty/issues/274 2016-08-20 14:18:43 +02:00
uwetews db01627c1c - optimization remove unneeded call to update acopes when {assign} scope and template scope was local (default) 2016-08-14 03:32:07 +02:00
uwetews 1b6d2a9375 - bugfix Class 'Smarty_Internal_Runtime_ValidateCompiled' not found when upgrading from some older Smarty versions with existing
compiled or cached template files https://github.com/smarty-php/smarty/issues/269
2016-08-14 02:38:55 +02:00
uwetews fee77dbfb8 - bugfix $smarty_>debugging = true; did E_NOTICE messages when {eval} tag was used https://github.com/smarty-php/smarty/issues/266 2016-08-14 01:12:37 +02:00
uwetews 7f932e7ac4 Prepare 3.1.31-dev 2016-08-07 20:57:11 +02:00
uwetews ed2b7f1146 Release 3.1.30 2016-08-07 20:46:49 +02:00
uwetews 0cc1577b1b Update travis for 3.1.30 test 2016-08-07 20:35:44 +02:00
uwetews 001f16aa0a update error message 2016-08-07 16:08:10 +02:00
uwetews 761e516a32 - bugfix update of 04.08.2016 was incomplete 2016-08-07 15:31:01 +02:00
uwetews 25ad0b3b5a - updated error checking at template and config default handler 2016-08-05 21:29:15 +02:00
uwetews 04301645d6 - bugfix compiling of templates failed when the Smarty delimiter did contain '/' https://github.com/smarty-php/smarty/issues/264 2016-08-05 01:00:51 +02:00
uwetews e96a218e8b Merge pull request #263 from a-shpota/fix-method-define
Fix define method in registered objects
2016-08-04 23:11:59 +02:00
uwetews ffa270c395 04.08.2015
- improvement move template function source parameter into extension
2016-08-04 23:10:26 +02:00
Andrey Shpota a3c1a152ca fix define method in registered objects 2016-08-04 12:28:19 +03:00
uwetews 335f199cbc - optimization unneeded loading of compiled resource 2016-07-26 04:00:15 +02:00
uwetews f74a0d575a - regression this->addPluginsDir('/abs/path/to/dir') adding absolute path without trailing '/' did fail https://github.com/smarty-php/smarty/issues/260 2016-07-24 20:31:27 +02:00
uwetews eb2d9d4e6d - improvement remove double funtion declaration in plugin shared.escape_special_cars.php https://github.com/smarty-php/smarty/issues/229 2016-07-23 22:37:17 +02:00
uwetews 2ba2f6e2e7 - bugfix setTemplateDir('/') and setTemplateDir('') did create wrong absolute filepath https://github.com/smarty-php/smarty/issues/245
- optimization of filepath normalization
2016-07-23 22:21:14 +02:00
uwetews 6d7d36d9a6 Fx changelog text for - bugfix {match} shell injection vulnerability patch provided by Tim Weber 2016-07-19 20:22:10 +02:00
uwetews 50068ca52a - bugfix {match} shell injection vulnerability patch provided by Tim Weber 2016-07-19 20:17:47 +02:00
uwetews f39e61762c - bugfix multiple {include} with relative filepath within {block}{/block} could fail https://github.com/smarty-php/smarty/issues/246 2016-07-19 03:37:01 +02:00
uwetews afb971f84b - bugfix multiple {include} with relative filepath within {block}{/block} could fail https://github.com/smarty-php/smarty/issues/246 (reverted from commit 09d8eab89f) (reverted from commit 3fdd9e4b89) 2016-07-19 00:25:49 +02:00
uwetews e865374fc2 - bugfix multiple {include} with relative filepath within {block}{/block} could fail https://github.com/smarty-php/smarty/issues/246 (reverted from commit 09d8eab89f) (reverted from commit 3fdd9e4b89) 2016-07-19 00:19:22 +02:00
uwetews 3fdd9e4b89 - bugfix multiple {include} with relative filepath within {block}{/block} could fail https://github.com/smarty-php/smarty/issues/246 (reverted from commit 09d8eab89f) 2016-07-19 00:14:51 +02:00
uwetews 09d8eab89f - bugfix multiple {include} with relative filepath within {block}{/block} could fail https://github.com/smarty-php/smarty/issues/246 2016-07-18 23:50:37 +02:00
uwetews 5fd21b7361 - bugfix multiple {include} with relative filepath within {block}{/block} could fail https://github.com/smarty-php/smarty/issues/246 2016-07-18 23:43:58 +02:00
uwetews d854219696 - bugfix avoid opcache_invalidate to result in ErrorException when opcache.restrict_api is not empty https://github.com/smarty-php/smarty/pull/244 2016-07-18 19:45:30 +02:00
uwetews 92945eaf12 - bugfix modifier on plugins like {plugin|modifier ... } did fail when the plugin does return an array https://github.com/smarty-php/smarty/issues/228 2016-07-18 17:57:50 +02:00
uwetews 79a4fdcd52 - 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 2016-07-18 05:27:46 +02:00
uwetews c666ec9a34 - bugfix wrong parameter on compileAllTemplates() and compileAllConfig() https://github.com/smarty-php/smarty/issues/231 2016-07-14 20:32:41 +02:00
uwetews e5eebc3cc2 - bugfix wrong parameter on compileAllTemplates() https://github.com/smarty-php/smarty/issues/231 2016-07-13 01:49:38 +02:00
uwetews cbea88b3a7 - bugfix template function data should be merged when loading subtemplate https://github.com/smarty-php/smarty/issues/240 2016-07-13 01:42:54 +02:00
uwetews 38b13661fe - bugfix enable debugging could fail when template objects did already exists https://github.com/smarty-php/smarty/issues/237 2016-07-13 01:07:53 +02:00
uwetews 31f6afd16e - update testInstall() https://github.com/smarty-php/smarty/issues/248https://github.com/smarty-php/smarty/issues/248 2016-07-13 00:26:17 +02:00
uwetews 353ee1a490 - bugfix PHP 7 compatibility on registered compiler plugins https://github.com/smarty-php/smarty/issues/241 2016-07-13 00:12:58 +02:00
uwetews 02f95184ab - bugfix enableSecurity() must init cache flags https://github.com/smarty-php/smarty/issues/247 2016-07-12 02:30:14 +02:00
uwetews b525d4d1d7 - 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 2016-07-12 00:24:11 +02:00
uwetews b46a9a8dbd - 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
2016-05-28 03:33:32 +02:00
uwetews 778b0d920e - 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
2016-05-27 22:22:57 +02:00
uwetews dccfc6c2f5 - broken PHP 5.3 and 5.4 compatibility 2016-05-16 18:17:58 +02:00
uwetews 0fcac38c70 - optimization {foreach} compiler and processing 2016-05-16 17:57:06 +02:00
uwetews a62557e817 - broken PHP 5.3 and 5.4 compatibility 2016-05-15 11:51:46 +02:00
uwetews 6ef0d0eaa0 - optimization and cleanup of resource code 2016-05-15 11:13:31 +02:00
uwetews 1fbf16afed - optimization of inheritance processing 2016-05-10 03:54:56 +02:00
uwetews 608064e5f2 -bugfix Only variables should be assigned by reference https://github.com/smarty-php/smarty/issues/227 2016-05-07 13:46:37 +02:00
uwetews f02f943021 Merge pull request #188 from tinogo/master
Minor optimization for Smarty_Internal_Data::assign()
2016-05-03 21:55:46 +02:00
uwetews ecdd33d334 - bugfix same relative filepath at {include} called from template in different folders could display wrong sub-template 2016-05-02 04:28:09 +02:00
uwetews 971058fc61 - enhancement {block} tag names can now be variable https://github.com/smarty-php/smarty/issues/221 2016-05-02 00:58:17 +02:00
uwetews f1b3662b28 - bugfix same relative filepath at {include} called from template in different folders could display wrong sub-template 2016-05-01 23:53:38 +02:00
uwetews 2cb03512f7 - bugfix {strip} remove space on linebreak between html tags https://github.com/smarty-php/smarty/issues/213 2016-04-29 00:24:47 +02:00
uwetews 116854cee2 Merge pull request #222 from glensc/patch-1
Update NEW_FEATURES.txt
2016-04-24 15:18:03 +02:00
Elan Ruusamäe 608dbd0f7f whitespace cleanup 2016-04-24 15:21:08 +03:00
Elan Ruusamäe af1b632a11 Update NEW_FEATURES.txt 2016-04-24 15:19:30 +03:00
uwetews 13a2127b50 - bugfix nested {include} with relative file path could fail when called in {block} ... {/block} https://github.com/smarty-php/smarty/issues/218 2016-04-24 11:04:36 +02:00
uwetews d3b7a344aa - bugfix the default template handler must calculate the source uid https://github.com/smarty-php/smarty/issues/205 2016-04-14 21:24:26 +02:00
uwetews 9839de9cc4 - bugfix special variable {$smarty.capture.name} was not case sensitive on name https://github.com/smarty-php/smarty/issues/210 2016-04-14 21:12:34 +02:00
uwetews 6d4a4de0d5 - bugfix template inheritance status must be saved when calling sub-templates https://github.com/smarty-php/smarty/issues/215 2016-04-13 03:36:16 +02:00
uwetews a36d9bc809 Fixing wrong date 2016-03-27 18:53:53 +02:00
uwetews 2dac1729c2 - bugfix change of 11.03.2014 cause again {capture} data could not been seen in other templates with {$smarty.capture.name} https://github.com/smarty-php/smarty/issues/153 2016-03-27 18:44:19 +02:00
uwetews ff6a8521bb - improvement $smarty->clearCompiledTemplate() should return on recompiled or uncompiled resources 2016-03-11 03:36:43 +01:00
uwetews af71fda639 - optimization of capture and security handling 2016-03-11 02:55:55 +01:00
uwetews 62bf9eeddc - optimization of resource processing 2016-03-11 01:07:26 +01:00
uwetews 880967aff3 - optimization of resource processing 2016-03-11 01:05:26 +01:00
uwetews 4815464b9c - optimization of resource processing 2016-03-10 22:22:46 +01:00
uwetews 00be382842 fix function name case 2016-03-09 04:03:37 +01:00
uwetews 5c1907052e fix class name case 2016-03-09 04:01:47 +01:00
uwetews 23acdf722c fix passed parameter 2016-03-09 03:53:12 +01:00
uwetews 43c5aabda5 update {capture} compiler tag nesting code 2016-03-09 03:13:15 +01:00
uwetews f63ceb1c05 - remove access to removed an not needed property 2016-03-09 02:44:38 +01:00
uwetews 91b4992ab8 - 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
  missed commit
2016-03-09 02:11:06 +01:00
uwetews e066488f8b - bugfix correct Autoloader update of 2.3.2014 https://github.com/smarty-php/smarty/issues/199 2016-03-09 01:44:10 +01:00
uwetews abf5be58ad - 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
2016-03-09 01:01:32 +01:00
uwetews d88168d1b6 - bugfix change from 01.03.2016 will cause $smarty->isCached(..) failure if called multiple time for same template
(forum topic 25935) related to 825aa26079
2016-03-04 17:54:10 +01:00
uwetews 4f5aeeb2b6 - revert autoloader optimizations because of unexplainable warning when using plugins https://github.com/smarty-php/smarty/issues/199 2016-03-02 18:17:22 +01:00
uwetews b99bc7b8da - bugfix template objects must be cached on $smarty->fetch('foo.tpl) calls incase the template is fetched
multiple times (forum topic 25909)
2016-03-01 00:55:28 +01:00
uwetews 825aa26079 - bugfix template objects must be cached on $smarty->fetch('foo.tpl) calls incase the template is fetched
multiple times (forum topic 25909)
2016-03-01 00:54:33 +01:00
uwetews 0e5ea2a467 - bugfix instanceof expression in template code must be treated as value https://github.com/smarty-php/smarty/issues/191 2016-02-26 00:50:15 +01:00
uwetews a5b465e2c6 - optimization of _realpath 2016-02-25 23:36:53 +01:00
uwetews 8df91e9d0d - bugfix wrong _realpath with 4 or more parent-directories https://github.com/smarty-php/smarty/issues/190 2016-02-25 02:53:55 +01:00
uwetews b39f561083 update https://github.com/smarty-php/smarty/issues/179 2016-02-20 22:00:19 +01:00
uwetews 4530a8232f - 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
2016-02-20 21:45:21 +01:00
uwetews b832cd36a5 - 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} new attribute 'property' to force compilation of loop property
    read NEW_FEATURES.txt https://github.com/smarty-php/smarty/issues/189 (reverted from commit 4958deaf09)
2016-02-20 21:33:31 +01:00
uwetews 4958deaf09 - 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} new attribute 'property' to force compilation of loop property
    read NEW_FEATURES.txt https://github.com/smarty-php/smarty/issues/189
2016-02-20 21:13:38 +01:00
uwetews a884855818 - bugfix {strip} must keep space between hmtl tags. Broken by changes of 10.2.2016 https://github.com/smarty-php/smarty/issues/184 2016-02-20 17:24:48 +01:00
uwetews 3e463c1be0 - 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
2016-02-19 16:10:17 +01:00
Tino Goratsch 8dc8fc23c8 Optimization for Smarty_Internal_Data::assign()
Removed the extra if block, when an array has been given as the $tpl_var argument, because in the else block there is already a "not empty check".
2016-02-19 09:44:07 +01:00
uwetews 0735ff9605 - optimization make compiler tag object cache static for higher compilation speed 2016-02-14 20:57:21 +01:00
uwetews 30328d318c - optimization of tag attribute compiling 2016-02-14 19:58:55 +01:00
uwetews 7e36f98c1d - bugfix using extendsall as default resource and {include} inside {block} tags could produce unexpected results https://github.com/smarty-php/smarty/issues/183 2016-02-14 14:33:59 +01:00
uwetews 4b1ba73eea - optimization of sub-template processing 2016-02-14 09:17:55 +01:00
uwetews 0f7f0d87b6 - new tag {make_nocache} read NEW_FEATURES.txt https://github.com/smarty-php/smarty/issues/110 2016-02-14 02:54:38 +01:00
uwetews 3756588858 - improvement added KnockoutJS comments to trimwhitespace outputfilter https://github.com/smarty-php/smarty/issues/82
https://github.com/smarty-php/smarty/pull/181
2016-02-11 22:05:45 +01:00
uwetews 00f07690e7 update of the inheritance release notes 2016-02-10 21:32:52 +01:00
uwetews 9c37394ccb - bugfix other {strip} error with output tags between hmtl https://github.com/smarty-php/smarty/issues/180 2016-02-10 21:12:35 +01:00
uwetews a8d3373f26 - improvement because of ambiguities the inline constant support has been removed from the $foo.bar syntax https://github.com/smarty-php/smarty/issues/149 2016-02-10 04:06:05 +01:00
uwetews b8fb986327 - bugfix {strip} must keep space on output creating smarty tags within html tags https://github.com/smarty-php/smarty/issues/177 other update for BC 2016-02-10 03:49:09 +01:00
uwetews 47237eb84f - bugfix wrong precedence on special if conditions like '$foo is ... by $bar' could cause wrong code https://github.com/smarty-php/smarty/issues/178 2016-02-10 03:19:25 +01:00
uwetews 417088bdb7 - bugfix {strip} must keep space on output creating smarty tags within html tags https://github.com/smarty-php/smarty/issues/177 2016-02-10 03:17:32 +01:00
uwetews 08db1a4a3f - bugfix {strip} must keep space on output creating smarty tags within html tags https://github.com/smarty-php/smarty/issues/177 2016-02-10 01:12:57 +01:00
uwetews 2f62b99173 - update/bugfix scope attribute handling reworked. Read the newfeatures.txt file 2016-02-09 23:27:07 +01:00
uwetews 37e6d26b23 - move some code from parser into compiler 2016-02-09 04:48:08 +01:00
uwetews b04486a091 - reformat all code for unique style 2016-02-09 01:27:15 +01:00
uwetews c59ca44b9f - move some code from parser into compiler 2016-02-09 01:15:12 +01:00
uwetews c1f34b1314 - improvement internal compiler changes 2016-02-05 17:41:11 +01:00
uwetews 85eedd0c11 - bugfix {foreach} compilation failed when $smarty->merge_compiled_includes = true and pre-filters are used.
https://github.com/smarty-php/smarty/issues/172
2016-02-01 00:46:15 +01:00
uwetews e1bf16a504 - bugfix implement replacement code for _tag_stack property https://github.com/smarty-php/smarty/issues/151 2016-01-29 01:21:00 +01:00
uwetews addd2a74e2 Merge pull request #156 from glensc/patch-1
Update change_log.txt
2016-01-28 05:49:12 +01:00
uwetews a687a127c4 - 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 2016-01-28 05:34:41 +01:00
uwetews 193163be29 - bugfix allow windows network filepath or wrapper (forum topic 25876) https://github.com/smarty-php/smarty/issues/170 2016-01-28 03:51:54 +01:00
uwetews 41684818d9 - bugfix {capture} data could not been seen in other templates with {$smarty.capture.name} https://github.com/smarty-php/smarty/issues/153 2016-01-27 05:18:29 +01:00
uwetews f59b00c6dd - 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
2016-01-27 04:51:02 +01:00
uwetews 04d9c5cc34 - bugfix output filters did not observe nocache code flag https://github.com/smarty-php/smarty/issues/160 2016-01-27 00:35:04 +01:00
uwetews 71f71e6262 - bugfix string resource could inject code at {block} or inline subtemplates through PHP comments https://github.com/smarty-php/smarty/issues/157 2016-01-26 22:22:20 +01:00
uwetews 867a2f3165 - bugfix string resource could inject code at {block} or inline subtemplates through PHP comments https://github.com/smarty-php/smarty/issues/157 (reverted from commit 2850cce19f) 2016-01-26 21:49:56 +01:00
uwetews 2850cce19f - bugfix string resource could inject code at {block} or inline subtemplates through PHP comments https://github.com/smarty-php/smarty/issues/157 2016-01-26 21:34:11 +01:00
uwetews 0b31052418 - bugfix {$smarty.section.customer.loop} did throw compiler error https://github.com/smarty-php/smarty/issues/161
update of yesterdays fix
2016-01-26 21:25:29 +01:00
uwetews 8a0c783b71 - revert bugfix compiling {section} did create warning 2016-01-26 20:49:46 +01:00
uwetews ccbc4303ed - bugfix {$smarty.section.customer.loop} did throw compiler error https://github.com/smarty-php/smarty/issues/161 2016-01-26 03:01:33 +01:00
uwetews b58e1cdc5a - bugfix compiling {section} did create warning 2016-01-26 02:57:21 +01:00
uwetews 8b0e0a3df6 - improvement observe Smarty::$_CHARSET in debugging console https://github.com/smarty-php/smarty/issues/169 2016-01-26 00:15:39 +01:00
Elan Ruusamäe 5cf9824cdf Update change_log.txt
typo fixes
2016-01-06 23:40:13 +02:00
uwetews dd0f4c7c36 - improvement runtime checks if registered block plugins are callabel 2016-01-02 17:58:58 +01:00
uwetews 418492b40b - optimize block plugin compiler 2016-01-02 11:27:44 +01:00
uwetews 59343127f7 - update scope handling 2016-01-02 02:47:32 +01:00
uwetews bdf9f41da8 - remove Smarty::$resource_cache_mode property 2016-01-01 18:28:27 +01:00
uwetews 8e9cb7586f add memcache tests to travis 2015-12-31 06:45:19 +01:00
uwetews d381c47ba8 add memcache tests to travis 2015-12-31 06:36:19 +01:00
uwetews ea866a5a92 add memcache tests to travis 2015-12-31 06:33:47 +01:00
uwetews 04afbdb18d disable 5.2 2015-12-31 06:07:18 +01:00
uwetews 0dc576bfc0 enable 5.2 2015-12-31 06:03:56 +01:00
uwetews d32badfdee disable 5.2 2015-12-31 05:45:24 +01:00
uwetews b935ae803b enable 5.2 2015-12-31 05:20:50 +01:00
uwetews fe85dd4a3b disable 5.2 2015-12-31 05:08:25 +01:00
uwetews 77b6a9e8e1 Add travis test for php 5.2 2015-12-31 04:55:59 +01:00
uwetews 633a6285b0 Test if class Memcached exists 2015-12-31 03:44:42 +01:00
uwetews 239fed38b9 enable mysql and memcache tests on travis 2015-12-31 02:49:45 +01:00
uwetews c60cdb3e64 - optimization of {assign}, {if} and {while} compiled code 2015-12-31 02:20:47 +01:00
uwetews 7eb56ac5e3 - bugfix plugin names starting with "php" did not compile https://github.com/smarty-php/smarty/issues/147 2015-12-30 22:11:15 +01:00
uwetews 34062d45b7 - bugfix Smarty::error_reporting was not observed when display() or fetch() was called on template objects https://github.com/smarty-php/smarty/issues/145 2015-12-29 16:54:15 +01:00
uwetews 59b3a53089 remove allowed failure on hhvm 2015-12-28 06:00:03 +01:00
uwetews afec7564d6 - optimization of {foreach} code size and processing 2015-12-28 00:58:22 +01:00
uwetews c8c82a292a - PHPdoc updates 2015-12-27 08:12:46 +01:00
uwetews c2f05e8c3c - code fixes 2015-12-27 08:11:31 +01:00
uwetews 94cc120439 update SmartyBC 2015-12-27 07:19:04 +01:00
uwetews b0691dd056 - update external methods 2015-12-27 07:18:35 +01:00
uwetews 4dd8b0bf73 new _clearTemplateCache() method 2015-12-27 05:43:11 +01:00
uwetews ca48e93f00 force opcache invalidation 2015-12-27 05:42:30 +01:00
uwetews 1ebaac314c remove obsolete code 2015-12-27 05:37:50 +01:00
uwetews dc6da4384b - improve inheritance code 2015-12-27 04:02:21 +01:00
uwetews 7e7591f6c0 new _clearTemplateCache() method 2015-12-27 03:28:26 +01:00
uwetews fbf544286a - new feature If ACP is enabled force an apc_compile_file() when compiled or cached template was updated 2015-12-25 10:29:29 +01:00
uwetews 613e66c257 - optimization replace hhvm extension by inline code 2015-12-25 10:02:10 +01:00
uwetews fdd20dd4f1 - compile {block} tag code and its processing into classes 2015-12-25 09:10:39 +01:00
uwetews 2ebacc3b54 - bugfix post filter did fail on template inheritance https://github.com/smarty-php/smarty/issues/144 2015-12-24 05:52:41 +01:00
uwetews 297f47a15a - new feature Compiler does now observe the template_dir setting and will create separate compiled files if required 2015-12-24 02:29:21 +01:00
uwetews 9d0865aaf8 - new feature Caching does now observe the template_dir setting and will create separate cache files if required 2015-12-24 02:26:31 +01:00
uwetews 5c377637e1 - new feature Caching does now observe the template_dir setting and will create separate cache files if required 2015-12-23 04:35:48 +01:00
uwetews db2cace210 - optimization move subtemplate processing back into template object 2015-12-23 03:08:23 +01:00
uwetews 8a0562fb58 lost code on last commit 2015-12-23 00:57:52 +01:00
uwetews ad635471cb - optimization move internal method decodeProperties back into template object 2015-12-23 00:44:51 +01:00
uwetews ef3da3cc0b - code optimizations 2015-12-22 23:49:25 +01:00
uwetews 136e94ae74 - change $xxx_dir properties from private to protected in case Smarty class gets extended.
Properties like $template_dir must never be accessed directly or overloaded by a user class. Use getter/setter methods like setTemplateDir()
2015-12-22 01:21:35 +01:00
uwetews a8f8efd4b4 - bugfix {strip} must remove all blanks between html tags https://github.com/smarty-php/smarty/issues/136 2015-12-21 23:35:52 +01:00
uwetews fd09164be5 - optimization of filepath normalization 2015-12-21 22:50:55 +01:00
uwetews 76bb166eda - 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 (reverted from commit e29834387f) (reverted from commit 5a418efe57)
2015-12-21 17:19:39 +01:00
uwetews 5a418efe57 - 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 (reverted from commit e29834387f)
2015-12-21 16:36:33 +01:00
uwetews e29834387f - 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
2015-12-21 16:34:46 +01:00
uwetews b22686023e Merge pull request #141 from m1nd53t/master
set correct path to template in CompileAll
2015-12-21 15:05:53 +01:00
Kars Frijters d8109dda75 set correct path to template in CompileAll
When the template is in a subdirectory of the sourcedir, the the template could not be loaded
2015-12-21 14:27:26 +01:00
uwetews fa482f09f5 Fix typo in version 2015-12-21 03:08:35 +01:00
uwetews ee0ea0afbf Prepare 3.1.20-dev 2015-12-21 03:01:41 +01:00
uwetews 35480f10e7 Release 3.1.29 2015-12-21 02:57:06 +01:00
uwetews 6867515183 v3.1.28-p1 patch 2015-12-21 02:49:46 +01:00
uwetews efaa61cfb6 - optimization improve speed of filetime checks on extends and extendsall resource 2015-12-21 02:18:27 +01:00
uwetews 3548de5fa1 - bugfix the source uid of the extendsall resource must contain $template_dir settings https://github.com/smarty-php/smarty/issues/123 2015-12-20 17:51:16 +01:00
uwetews 78243be722 - bugfix add addition check for OS type on normalization of file path https://github.com/smarty-php/smarty/issues/134 2015-12-20 16:21:32 +01:00
uwetews 6483164d18 - update compilation of Smarty special variables 2015-12-20 15:13:34 +01:00
uwetews e655856871 - bugfix failure when the default resource type was set to 'extendsall' https://github.com/smarty-php/smarty/issues/123 2015-12-20 05:27:43 +01:00
uwetews dc9872e0e2 - bugfix broken PHP 5.2 compatibility https://github.com/smarty-php/smarty/issues/139 2015-12-19 21:55:32 +01:00
uwetews 9cdf68807f - improvement make sure that compiled and cache templates never can contain a trailing '?>? 2015-12-19 21:37:46 +01:00
uwetews d11956fc78 - remove no longer used code 2015-12-19 21:35:24 +01:00
uwetews 116c0caa5b update travis 2015-12-19 20:19:32 +01:00
uwetews b75f638d20 update travis 2015-12-19 20:16:18 +01:00
uwetews 5558f4face update travis 2015-12-19 20:13:46 +01:00
uwetews 224a1c4874 - bugfix broken PHP 5.2 compatibility 2015-12-19 20:10:45 +01:00
uwetews e32720ef4e - bugfix using $smarty.capture.foo in expressions could fail https://github.com/smarty-php/smarty/pull/138 2015-12-19 19:18:31 +01:00
uwetews 818715351a typo 2015-12-18 05:52:04 +01:00
uwetews 44eea98260 - bugfix regression when mdifier parameter was follow by math https://github.com/smarty-php/smarty/issues/132 2015-12-18 04:43:55 +01:00
uwetews 05c069d889 - bugfix using {block append/prepend} on same block in multiple levels of inheritance templates could fail (forum topic 25827) 2015-12-18 00:34:58 +01:00
uwetews 9a8bcb93b1 - bugfix text content consisting of just a single '0' like in {if true}0{/if} was suppressed (forum topic 25834) 2015-12-17 21:51:19 +01:00
uwetews 919861014a - bugfix using {block append/prepend} on same block in multiple levels of inheritance templates could fail (forum topic 25827) 2015-12-17 21:32:36 +01:00
uwetews fb80bd53a5 - bugfix {$smarty.capture.nameFail} did lowercase capture name https://github.com/smarty-php/smarty/issues/135 2015-12-17 20:31:30 +01:00
uwetews b7118b6beb - optimize direct access $smarty->template_dir = 'foo'; should call Smarty::setTemplateDir() https://github.com/smarty-php/smarty/issues/121 2015-12-16 22:32:07 +01:00
uwetews c4a5aca865 - bugfix direct access $smarty->template_dir = 'foo'; should call Smarty::setTemplateDir() https://github.com/smarty-php/smarty/issues/121 2015-12-16 04:54:34 +01:00
uwetews fa3aed33ee - bugfix {foreach} did fail if from atrribute is a Generator class https://github.com/smarty-php/smarty/issues/128 2015-12-16 03:25:33 +01:00
uwetews e1eefdca75 Merge pull request #127 from logbon72/master
Restored Smarty_Internal_Data::getVariable()
2015-12-16 00:58:13 +01:00
uwetews b842934abd Merge pull request #129 from eaglewu/patch-1
Compatible with PHP7
2015-12-16 00:57:54 +01:00
Di Wu 1f7a82e2be Compatible with PHP7
Explicitly defining the evaluation order with the curly braces.

In PHP5
``
$person->$property['first'] is evaluated as $person->{$property['first']}
``

But in PHP7
``
$person->$property['first'] is evaluated as {$person->$property}['first']
``
2015-12-15 17:37:53 +08:00
Joseph Orilogbon 048b648bff - Restored Smarty_Internal_Data::getVariable(), but added deprecation message. 2015-12-15 08:54:21 +01:00
uwetews 017120c1ef - bugfix a call to clearAllCache() and other should clear all internal template object caches (forum topic 25828) 2015-12-15 03:37:13 +01:00
uwetews 80f872ac06 Merge pull request #126 from glensc/patch-1
Update NEW_FEATURES.txt
2015-12-15 01:52:53 +01:00
uwetews 862ce9db08 - bugfix {$smarty.cookies.foo} did return the $_COOKIE array not the 'foo' value https://github.com/smarty-php/smarty/issues/122 2015-12-15 01:34:18 +01:00
Elan Ruusamäe ca12046179 typos here too 2015-12-14 23:33:42 +02:00
Elan Ruusamäe 362af770fe one more typo fix
altho not sure where the quote should be here
2015-12-14 23:31:40 +02:00
Elan Ruusamäe b40684c5d5 more typos 2015-12-14 23:30:45 +02:00
Elan Ruusamäe 5c71e35d4f Update NEW_FEATURES.txt
typos
2015-12-14 23:29:07 +02:00
uwetews c4e6ad6c35 - bugfix multiple calls of {section} with same name droped E_NOTICE error https://github.com/smarty-php/smarty/issues/118 2015-12-14 00:18:27 +01:00
uwetews f8ec3ecaef - bugfix {$smarty.config.foo} broken in 3.1.28 https://github.com/smarty-php/smarty/issues/120 2015-12-14 00:04:31 +01:00
uwetews bc3ea2c878 Prepare .1.29-dev 2015-12-13 15:41:00 +01:00
uwetews d234f79203 Prepare release 3.1.28 2015-12-13 15:19:58 +01:00
uwetews 15e3d10267 Fix typos 2015-12-13 15:16:20 +01:00
uwetews 2cab5c74ff fix link to documentation 2015-12-13 14:50:11 +01:00
uwetews dca9cd887e Merge pull request #117 from yonexyonex/fix_typo
fix typo in template error message
2015-12-13 14:41:20 +01:00
yonex fc999d81be fix typo in template error message 2015-12-13 22:35:22 +09:00
uwetews e8078f55ae - bugfix Debug Console could display incorrect data when using subtemplates 2015-12-13 14:15:54 +01:00
uwetews 7e521a92d9 - bugfix $smarty->debugging_ctrl = 'URL' did not work (forum topic 25811) 2015-12-13 10:16:10 +01:00
uwetews 6dc9196c35 - bugfix {foreach} and {section} with uppercase characters in name attribute did not work (forum topic 25819) 2015-12-13 06:30:08 +01:00
uwetews 71e364e4b2 - bugix Smarty did fail under PHP 7.0.0 with use_include_path = true; 2015-12-09 02:16:48 +01:00
uwetews e783f61132 - bugix Smarty did fail under PHP 7.0.0 with use_include_path = true; 2015-12-09 02:03:56 +01:00
uwetews 260d3e3e46 -bugfix {strip} should exclude some html tags from stripping, related to fix for https://github.com/smarty-php/smarty/issues/111 2015-12-09 01:35:17 +01:00
uwetews ee743d2729 update of SMARTY_VERSION 2015-12-08 23:45:04 +01:00
uwetews 29e2eb0bca - bugfix internal template function data got stored in wrong compiled file https://github.com/smarty-php/smarty/issues/114 2015-12-08 23:41:42 +01:00
uwetews be8340bef2 - remove no longer needed file and updated testinstall 2015-12-08 23:41:01 +01:00
uwetews 4839d0e0cc -bugfix {strip} should insert a single space https://github.com/smarty-php/smarty/issues/111 2015-12-05 17:28:05 +01:00
uwetews 54fe432730 Merge pull request #109 from KLVTZ/master
Refactor readme: use github markdown parser
2015-12-04 04:11:16 +01:00
Justin Page a061365844 Provide new line to separate highlights 2015-11-28 16:51:14 -08:00
Justin Page 0403c876ed Use quotes to highlight features 2015-11-28 16:48:27 -08:00
Justin Page 2bc86a00f1 Wrap JSON examples in language specific code wrap
This allows Github or any repo system to parse and display correctly code
examples by proper wrappers.
2015-11-28 16:45:46 -08:00
uwetews e0fc310b6e -bugfix a left delimter like '[%' did fail on [%$var_[%$variable%]%] (forum topic 25798) 2015-11-25 21:19:23 +01:00
uwetews 5ca1cd485f - bugfix {include} with variable file name like {include file="foo_$bar.tpl"} did fail in 3.1.28-dev https://github.com/smarty-php/smarty/issues/102 2015-11-02 23:04:52 +01:00
uwetews aa730800bd - bugfix {include} with variable file name like {include file="foo_$bar.tpl"} did fail in 3.1.28-dev https://github.com/smarty-php/smarty/issues/102 2015-11-02 18:06:42 +01:00
uwetews cc3f69a2a3 - update config file processing 2015-11-01 02:58:27 +01:00
uwetews 8a78038181 update PHPdoc 2015-11-01 02:57:50 +01:00
uwetews 72258bc28d add test for valid scope name 2015-11-01 02:02:27 +01:00
uwetews 9496df8e1f - bugfix add missing $trusted_dir property to SmartyBC class (forum topic 25751) 2015-10-31 23:13:12 +01:00
uwetews eedfdff62f - improve template scope handling 2015-10-29 22:33:00 +01:00
uwetews 55f38125a4 - improve template scope handling 2015-10-29 22:17:35 +01:00
uwetews a0f583078d - minor optimizations 2015-10-29 21:41:21 +01:00
uwetews 862b23fe52 - update testinstall() 2015-10-26 01:27:06 +01:00
uwetews 6e3d94c13e - more optimizations of template processing 2015-10-25 05:59:45 +01:00
uwetews 2b9dcb22b5 - more optimizations of template processing 2015-10-25 05:03:23 +01:00
uwetews 42e722926a - bugfix Error when using {include} within {capture} https://github.com/smarty-php/smarty/issues/100 2015-10-25 04:53:58 +01:00
uwetews 1a51c1c17b - more optimizations of template processing 2015-10-25 04:53:19 +01:00
uwetews 50760c794c - more optimizations of template processing 2015-10-24 22:43:19 +02:00
uwetews 4ea4d1ff41 - improve autoloader speed 2015-10-24 05:20:09 +02:00
uwetews abdb335b26 - fix comment 2015-10-24 05:17:17 +02:00
uwetews b7fb490cb1 - improve compiled code 2015-10-24 05:16:54 +02:00
uwetews 891495f849 - improve recovery from ivalid compiled template code 2015-10-24 05:14:47 +02:00
uwetews 0ea1360d65 - new extension handler to load functions when called 2015-10-24 05:12:10 +02:00
uwetews 888014b908 - new extension handler to load functions when called 2015-10-24 05:02:24 +02:00
uwetews eec7639c9c - fix template scope processing 2015-10-24 04:45:09 +02:00
uwetews b26ba9ce52 update travis 2015-10-21 04:32:27 +02:00
uwetews e25a8ab661 - move some code into runtime extensions 2015-10-21 03:53:25 +02:00
uwetews ad65c850f7 - move some code into runtime extensions 2015-10-21 02:02:42 +02:00
uwetews 4e1d6707fe - update code generated by template function call handler 2015-10-18 22:12:16 +02:00
uwetews 0e28150b4a - fix compiled code for new {block} assign attribute 2015-10-18 11:35:08 +02:00
uwetews bd7d10e09d Update travis 2015-10-18 05:14:27 +02:00
uwetews bf6910ee21 - bugfix under HHVM temporary cache file must only be created when caches template was updated 2015-10-18 05:08:03 +02:00
uwetews 4776491a7f - bugfix under HHVM temporary cache file must only be created when caches template was updated 2015-10-18 04:58:53 +02:00
uwetews c99fe144f6 - speed and size optimizations 2015-10-18 04:54:09 +02:00
uwetews 8dc2a0af7c - rework of template inheritance 2015-10-18 04:46:05 +02:00
uwetews ca9ccfc919 - optimize filepath normalization 2015-10-18 04:40:45 +02:00
uwetews 757d66a731 parser: add support for template prefix and postfix code 2015-10-18 02:02:43 +02:00
uwetews 5cde3a8799 compiler: add support for post compile callbacks 2015-10-18 02:02:42 +02:00
uwetews 8dc777effd Merge pull request #96 from glensc/patch-1
do not load "Autoloader" from include path
2015-10-18 02:00:49 +02:00
Elan Ruusamäe 87a04b2ef6 do not load "Autoloader" from include path
loading it from include path (without abs path) can be dangerous, can load some other project's Autoloader.php instead the right one.
2015-10-13 10:32:04 +03:00
uwetews 788566cf70 - bugfix {if $foo instanceof $bar} failed to compile if 2nd value is a variable https://github.com/smarty-php/smarty/issues/92 (reverted from commit 428e667453) 2015-10-08 19:53:25 +02:00
uwetews 428e667453 - bugfix {if $foo instanceof $bar} failed to compile if 2nd value is a variable https://github.com/smarty-php/smarty/issues/92 2015-10-08 19:47:43 +02:00
uwetews 7f0a2f788f Merge pull request #95 from dshepherd/patch-1
Update README with correct plugin method signature
2015-10-08 19:42:03 +02:00
Dan Shepherd d45652afe2 Update README with correct plugin method signature
The existing README states that 3 params are passed for plugins (params, smarty, template) but the smarty object was actually removed long ago. This update correct this.
2015-10-08 13:50:46 +01:00
uwetews 64464e8fbe - bugfix {if $foo instanceof $bar} failed to compile if 2nd value is a variable https://github.com/smarty-php/smarty/issues/92 2015-09-19 19:55:14 +02:00
uwetews d5ca4518be - bugfix {foreach} first attribute was not correctly reset since commit 05a8fa2 of 02.08.2015 https://github.com/smarty-php/smarty/issues/90 2015-09-17 21:01:48 +02:00
uwetews e1e8d2feda - update compiler by moving no longer needed properties, code optimizations and other 2015-09-16 16:23:38 +02:00
uwetews 5a9500c2d9 - remove not needed compiled code whan caching is disabled 2015-09-15 01:25:40 +02:00
uwetews 83a68c99c8 - update template inheritance processing 2015-09-15 00:44:34 +02:00
uwetews fb9f2c9267 fix 2015-09-15 00:21:28 +02:00
uwetews ceb9afbb5d - bugfix unintended multiple debug windows (forum topic 25699) 2015-09-15 00:18:17 +02:00
uwetews 0eb7f4b8d1 - improvement invalidate OPCACHE for cleared compiled and cached template files (forum topic 25557) 2015-09-15 00:15:12 +02:00
uwetews 6ff3505a37 - move code of {call} processing back into Smarty_Internal_Template class 2015-09-14 23:50:20 +02:00
uwetews 8d734a9d52 - update template inheritance processing 2015-09-14 23:46:17 +02:00
uwetews 71c1b32c51 - optimize internal subtemplate handling 2015-09-14 23:39:04 +02:00
uwetews 5cbedc87f0 - optimize internal subtemplate handling 2015-09-14 23:16:13 +02:00
uwetews df0824675a - optimize internal subtemplate handling 2015-09-14 23:12:03 +02:00
uwetews 56a884a428 - optimize autoloader 2015-09-14 23:02:59 +02:00
uwetews bfcffb009a - remove unneeded code and properties, minor fixes 2015-09-01 02:52:09 +02:00
uwetews ca0b3f02b9 add some cope needed for PHPunit tests 2015-09-01 02:35:51 +02:00
uwetews 2e0b834b59 remove unneeded realpath call 2015-09-01 02:34:59 +02:00
uwetews d2fa4083f7 - move template function code into runtime extension 2015-09-01 02:30:56 +02:00
uwetews 2ba7109043 - move subtemplate code into runtime extension and optimize for size and speed 2015-09-01 02:27:22 +02:00
uwetews 37e6529c7b - improvement convert template inheritance into runtime processing
- bugfix {$smarty.block.parent} did always reference the root parent block https://github.com/smarty-php/smarty/issues/68
2015-09-01 02:10:15 +02:00
uwetews 620e52405b - improvement convert template inheritance into runtime processing
- bugfix {$smarty.block.parent} did always reference the root parent block https://github.com/smarty-php/smarty/issues/68
2015-09-01 01:54:28 +02:00
uwetews 54d54e5000 hook for runtime extension loading 2015-09-01 00:33:10 +02:00
uwetews 0d46c17578 - rearrange internal cache 2015-08-29 14:37:59 +02:00
uwetews 31a7162fba - remove double break 2015-08-27 19:26:49 +02:00
uwetews 3ba86e8d91 remove permission properties 2015-08-23 19:58:27 +02:00
uwetews d67acf7e9a revert removal of permission properties 2015-08-23 18:46:32 +02:00
uwetews 470cd186c4 major push of internal changes for size and speed optimizations 2015-08-23 17:23:09 +02:00
uwetews 0e4039f5c0 - bugfix compiling super globals like {$smarty.get.foo} did fail in the master branch https://github.com/smarty-php/smarty/issues/77 2015-08-23 16:59:34 +02:00
uwetews 9fd0b3086d - remove redundant code 2015-08-23 13:53:03 +02:00
uwetews 9eb87ef5a2 - relocate properties for size optimization 2015-08-23 13:24:24 +02:00
uwetews 606b8e8669 - optimize use_include_path processing 2015-08-23 11:13:20 +02:00
uwetews 2c197a2ea6 - check if $includes entry does exist 2015-08-23 06:47:39 +02:00
uwetews 3382aab429 - fix output buffer handling 2015-08-23 06:46:03 +02:00
uwetews 0b9e46d6ed - bugfix do not cache template object for config files 2015-08-23 05:36:20 +02:00
uwetews c6ea69feb7 - bugfix uncompiled templates could not be cached after recent change 2015-08-23 05:35:13 +02:00
uwetews 3daf187fb1 - bugfix of unneeded instanceof conditions replacement 2015-08-23 05:33:04 +02:00
uwetews 189b2af115 - optimize invalidation of internal caches 2015-08-23 05:27:16 +02:00
uwetews 1ae11c26c0 - optimize Smarty::templateExists() 2015-08-23 05:15:05 +02:00
uwetews fb83a888f3 varname changes 2015-08-23 02:03:25 +02:00
uwetews e2f11126eb fix PHPDoc 2015-08-23 02:00:25 +02:00
uwetews a413a2a2e1 replace unneeded instanceof conditions 2015-08-23 01:50:05 +02:00
uwetews 6eed7732df - remove properties with redundant content 2015-08-23 01:46:30 +02:00
uwetews 87985d1243 - move caching to Smarty::_cache 2015-08-23 01:39:18 +02:00
uwetews 6a26393099 - optimize rendering 2015-08-23 01:26:46 +02:00
uwetews 329cd6ec4d - remove not really needed properties 2015-08-19 02:19:25 +02:00
uwetews df541858de - cache template object of {include} if same template is included several times 2015-08-19 01:22:27 +02:00
uwetews 7935b181fb - optimize nocache hash processing 2015-08-19 01:18:25 +02:00
uwetews 8292a3581c - use output buffers for better performance and less memory usage 2015-08-19 01:09:08 +02:00
uwetews 6087ac5de0 - convert debug console processing to object 2015-08-19 00:58:47 +02:00
uwetews 5f7b5a45ac improve performance 2015-08-18 03:20:01 +02:00
uwetews 457a0486f5 - cache template object of {include} if same template is included several times 2015-08-18 02:55:53 +02:00
uwetews e8252906ba - make sure that property value is set 2015-08-17 22:27:41 +02:00
uwetews 6cbcdf4d7b - load seldom used Smarty API methods dynamically to reduce memory footprint 2015-08-17 21:52:32 +02:00
uwetews eb7aa8fe92 update template_id handling 2015-08-15 18:35:51 +02:00
uwetews 8a9b52e975 optimize $properties array 2015-08-15 18:32:27 +02:00
uwetews 9ad5e1eb1e define missing properties 2015-08-15 18:25:06 +02:00
uwetews af6f77a9e6 create raw compiled object to avoid checking for compiled file 2015-08-10 22:45:56 +02:00
uwetews e63926088c optimize compilation of merged subtemplates 2015-08-10 22:35:33 +02:00
uwetews 0260b525b8 introduce Smarty::$resource_cache_mode and cache template object of {include} inside loop 2015-08-10 21:57:06 +02:00
uwetews 5c9c57df7d replace property array by object properties 2015-08-09 21:14:16 +02:00
uwetews 6bcdd0edbe remove unused parameter 2015-08-09 20:56:18 +02:00
uwetews dde6bc506b remove unneeded method 2015-08-09 20:54:13 +02:00
uwetews 7d2e27ae2f use parent_compiler object for storing required plugins 2015-08-09 20:53:32 +02:00
uwetews 3619b672f4 replace property array by object properties 2015-08-09 20:48:33 +02:00
uwetews c08191d191 replace property array by object properties 2015-08-09 20:45:28 +02:00
uwetews d16e2d3a15 replace property array by object properties 2015-08-09 20:43:04 +02:00
Uwe Tews 643e6784e8 - bugfix Smarty failed when compile_id did contain "|" 2015-08-06 21:42:20 +02:00
Uwe Tews c5cf7884d5 - commit several internal improvements 2015-08-06 19:46:44 +02:00
Uwe Tews ea6f848e04 fix properties 2015-08-06 19:42:40 +02:00
Uwe Tews 5d1ba7ca9c restore template object state on exception, free lexer/parser resources 2015-08-06 19:40:37 +02:00
Uwe Tews e402e2f893 no need to clone handler 2015-08-06 19:32:33 +02:00
Uwe Tews de49865d22 optimize template object caching 2015-08-06 19:25:00 +02:00
Uwe Tews 16fc95ccf7 load source resource at template object creation 2015-08-06 19:16:41 +02:00
Uwe Tews 1ed4808bd9 check parent object type 2015-08-06 19:14:55 +02:00
Uwe Tews 5ca4f0484a load source resource at template object creation 2015-08-06 19:12:24 +02:00
Uwe Tews 35c7e9767d remove unneeded properties 2015-08-06 19:05:11 +02:00
Uwe Tews 8cffee8426 invalidate compiled resource cache 2015-08-06 19:02:30 +02:00
Uwe Tews 63a1e74811 - rewrite compileAll... utility methods 2015-08-06 01:29:36 +02:00
Uwe Tews a7098432ba Make declaration compatible with compile assign 2015-08-06 01:24:41 +02:00
Uwe Tews e1cc514a68 - avoid possible circular object referances caused by parser/lexer objects 2015-08-06 01:19:11 +02:00
Uwe Tews ca969fe663 fix autoloader optimization 2015-08-06 00:59:06 +02:00
Uwe Tews 8c5f20430d optimize duplicate code 2015-08-06 00:57:36 +02:00
Uwe Tews 80ee385965 - improve getIncludePath() to return directory i 2015-08-03 22:32:09 +02:00
Uwe Tews 201ea13a33 - bugfix compileAllConfig() was broken since 3.1.22 because of the changes in config file processing 2015-08-03 21:39:30 +02:00
Uwe Tews f2585a035c - rework clear cache methods 2015-08-03 05:40:34 +02:00
Uwe Tews 147ba329b5 Fix generated code 2015-08-03 03:14:25 +02:00
Uwe Tews 7dfe853076 remove unneed dummy $smarty template variable 2015-08-02 21:12:33 +02:00
Uwe Tews c95ff14434 - rework {capture} compiler 2015-08-02 20:57:46 +02:00
Uwe Tews e205cb7a89 - optimization and code cleanup of {foreach} and {section} compiler 2015-08-02 19:43:21 +02:00
Uwe Tews 05a8fa245e - improvement show resource type and start of template source instead of uid on eval: and string: resource (forum topic 25630) 2015-08-01 14:28:39 +02:00
Uwe Tews 3d2a15be3c - update DateTime object can be instance of DateTimeImmutable since PHP5.5 https://github.com/smarty-php/smarty/pull/75 2015-08-01 13:09:41 +02:00
Uwe Tews c5cdd90352 - optimize {foreach} and {section} compiler 2015-07-31 01:03:29 +02:00
Uwe Tews e9d172d8ac - optimize {section} compiler for speed and size of compiled code 2015-07-30 02:45:38 +02:00
Uwe Tews 20640577a1 Revert "- optimize {section} compiler for speed and size of compiled code"
This reverts commit 1074090473.
2015-07-30 02:03:29 +02:00
Uwe Tews 1074090473 - optimize {section} compiler for speed and size of compiled code 2015-07-30 01:15:22 +02:00
Uwe Tews aa6e2219ec - optimize {section} compiler for speed and size of compiled code 2015-07-30 01:03:12 +02:00
Uwe Tews 8eabafed83 add some error suppression for undefined variables 2015-07-29 23:30:52 +02:00
Uwe Tews 99d802f30c - optimize {section} compiler for speed and size of compiled code 2015-07-29 22:23:23 +02:00
Uwe Tews c9f2a0d26e - update for PHP 7 compatibility 2015-07-28 01:39:08 +02:00
Uwe Tews fe4fdd15d8 add PHP 7 to travis tests 2015-07-28 01:15:31 +02:00
Uwe Tews d192e470d5 add PHP 7 to travis tests 2015-07-28 01:12:45 +02:00
Uwe Tews 0436176739 add hhvm to travis test 2015-07-26 18:11:10 +02:00
Uwe Tews f9d9ca0f67 - improvement impement workaround for HHVM PHP incompatibillity https://github.com/facebook/hhvm/issues/4797 2015-07-26 18:04:40 +02:00
Uwe Tews bb3dfc6fdf - bugfix parser did hang on text starting <?something https://github.com/smarty-php/smarty/issues/74 2015-07-25 22:32:10 +02:00
Uwe Tews f61084f70f move Smarty::clear() into extension 2015-07-20 04:38:13 +02:00
Uwe Tews 8cbe51a603 - improvement invalidate PHP 5.5 opcache for recompiled and cached templates https://github.com/smarty-php/smarty/issues/72 2015-07-20 04:01:43 +02:00
Uwe Tews 3e54c268ab - bugfix config files got recompiled on each request 2015-07-20 03:15:45 +02:00
Uwe Tews 61253c1999 optimization 2015-07-12 07:03:55 +02:00
Uwe Tews 208628080f reformat 2015-07-12 07:02:25 +02:00
Uwe Tews 21e07daf6d optimization 2015-07-12 02:26:42 +02:00
Uwe Tews 878724c4ea - optimize {extends} compilation 2015-07-12 01:11:22 +02:00
Uwe Tews b3fd262541 - bugfix force file: resource in demo resource.extendsall.php 2015-07-10 05:18:10 +02:00
Uwe Tews 7a56edc180 - bugfix convert each word of class names to ucfirst in in compiler. (forum topic 25588) 2015-07-08 04:59:37 +02:00
Uwe Tews 40f0dda0e6 - new feature multiple indices on file: resource 2015-07-07 18:18:19 +02:00
Uwe Tews 1e4f28da54 update Smarty::_realpath() 2015-07-07 17:56:50 +02:00
Uwe Tews 7fa6c4fd47 update include_path handling 2015-07-07 17:55:45 +02:00
Uwe Tews 733755f94a reformat 2015-07-07 17:51:40 +02:00
uwetews f66cd7e062 Merge pull request #71 from mmerian/master
Added $limit parameter to regex_replace modifier
2015-07-07 15:40:28 +02:00
Maxime Mérian 73dc3f311a Added $limit parameter to regex_replace modifier 2015-07-07 09:32:40 +02:00
Uwe Tews bc99747f93 - improvement allow fetch() or display() called on a template object to get output from other template
like $template->fetch('foo.tpl') https://github.com/smarty-php/smarty/issues/70
2015-07-07 02:01:45 +02:00
Uwe Tews 5b401789b5 - optimization resource extendsall 2015-07-06 06:57:56 +02:00
uwetews a35294946e Merge pull request #69 from bmewburn/master
removed invalid .gitignore pattern
2015-07-06 05:46:01 +02:00
Uwe Tews 06096191c5 - optimize {block} compilation 2015-07-06 03:41:37 +02:00
Uwe Tews b1fdc085e7 - optimization get rid of __get and __set in source object 2015-07-06 03:25:03 +02:00
Uwe Tews b198e6488c - optimize {block} compilation 2015-07-06 03:12:25 +02:00
bmewburn da38a22621 removed invalid .gitignore pattern
git ignore pattern .idea\ causes version control in netbeans 8.02 to crash
2015-07-06 11:12:11 +10:00
Uwe Tews 7e7112153a search {foreach} properties also in parent compiler 2015-07-01 13:01:16 +02:00
Uwe Tews e5bea506af - bugfix debugging console did not display string values containing \n, \r or \t correctly https://github.com/smarty-php/smarty/issues/66 2015-07-01 10:54:45 +02:00
Uwe Tews a756ce3d9e add error messages 2015-07-01 10:46:51 +02:00
Uwe Tews be212a2a87 load template source early 2015-07-01 06:44:28 +02:00
Uwe Tews 9ac1dd44e2 - update {foreach} compiler 2015-07-01 03:30:08 +02:00
Uwe Tews a9f0b8ad1f - optimize compile check handling 2015-07-01 03:27:06 +02:00
Uwe Tews 86783c857d use tag object cache of parent compiler 2015-07-01 03:25:55 +02:00
Uwe Tews 2762d81d93 add new methods and optimizations 2015-07-01 03:23:40 +02:00
Uwe Tews 8567f08248 fix flag in file status cache 2015-06-30 02:59:41 +02:00
Uwe Tews c84e406db5 observe $smarty->compile_check 2015-06-29 20:48:49 +02:00
Uwe Tews 83f6154eae - compiler optimization 2015-06-29 20:45:21 +02:00
Uwe Tews 3052406cfc - fix $smarty->use_include_path option and optimize file path code 2015-06-29 02:41:42 +02:00
Uwe Tews 99fe8120c8 - remove redundant code 2015-06-28 15:45:50 +02:00
Uwe Tews 8d30442450 - bugfix PATH_SEPARATOR was replaced by mistake in autoloader 2015-06-28 15:12:00 +02:00
Uwe Tews cd132140f2 - optimize file path normalization 2015-06-28 12:54:47 +02:00
Uwe Tews c1ae1a52af - optimize autoloader 2015-06-28 08:33:18 +02:00
Uwe Tews ce0c1dcfae - move $smarty->append() and $smarty->appendByRef() into extension 2015-06-28 05:22:19 +02:00
Uwe Tews 3442acd407 update comment 2015-06-28 05:00:47 +02:00
Uwe Tews f4d7838a8f - move getStreamVariable() into extension 2015-06-28 05:00:27 +02:00
Uwe Tews afe9af11b7 - move $smarty->getTemplateVars() into extension 2015-06-28 04:44:16 +02:00
Uwe Tews 85eb95d960 - move auto load filter methods into extension 2015-06-28 04:05:07 +02:00
Uwe Tews aee07f7bba - optimize security isTrustedResourceDir() 2015-06-28 02:37:41 +02:00
Uwe Tews 5377fd5926 - move $smarty->enableSecurity() into Smarty_Security class 2015-06-28 01:38:52 +02:00
Uwe Tews 15d8e545cd - rework of $smarty->clearCompiledTemplate() and move it to its own extension 2015-06-27 23:59:12 +02:00
Uwe Tews 9d937ffe68 - bugfix allow function plugins with name ending with 'close' https://github.com/smarty-php/smarty/issues/52 2015-06-27 22:18:08 +02:00
Uwe Tews 1360be4eef - minor compiler optimizations 2015-06-27 21:50:33 +02:00
Uwe Tews 38e47c7ee2 - minor compiler optimizations 2015-06-27 21:23:22 +02:00
Uwe Tews 291c06dbea - move $smarty->loadPlugin() into extension 2015-06-27 20:56:27 +02:00
Uwe Tews 75ccd86c8a - update {include_php} with new realpath handling 2015-06-27 20:25:54 +02:00
Uwe Tews f567d5d778 - update Smarty security with new realpath handling 2015-06-27 20:18:01 +02:00
Uwe Tews 6197df45b5 - update $smarty->_realpath for relative path not starting with './' 2015-06-27 20:08:17 +02:00
Uwe Tews aefec40962 - fix special cases of filepath normalization 2015-06-27 18:30:47 +02:00
Uwe Tews e0630b106a revert 2015-06-27 16:31:26 +02:00
Uwe Tews c5ea2e4b48 add hhvm 2015-06-27 16:26:31 +02:00
Uwe Tews 9986286af0 - bugfix resolve naming conflict between custom Smarty delimiter '<%' and PHP ASP tags https://github.com/smarty-php/smarty/issues/64 2015-06-27 16:09:50 +02:00
Uwe Tews 3239a19435 - bugfix resolve naming conflict between custom Smarty delimiter '<%' and PHP ASP tags https://github.com/smarty-php/smarty/issues/64 2015-06-27 15:35:27 +02:00
Uwe Tews 6b875397a5 update autoloader 2015-06-21 13:56:10 +02:00
Uwe Tews b64d5d26c9 - update realpath handling 2015-06-21 13:53:52 +02:00
Uwe Tews 666f7264f4 optimization 2015-06-21 13:51:50 +02:00
Uwe Tews dd4cbfac3a - move registerObject / registerClass into extension 2015-06-21 13:43:17 +02:00
Uwe Tews 1a24b3971d - optimization of filter execution 2015-06-21 13:23:23 +02:00
Uwe Tews c09b05cbe3 - optimization of directory handling / build realpath 2015-06-21 13:11:52 +02:00
Uwe Tews 31d94d05d3 - optimization of template/config file normalization 2015-06-21 12:52:49 +02:00
Uwe Tews 4e471b19e2 - optimization of template/config file normalization 2015-06-21 12:42:53 +02:00
Uwe Tews 2d0f457abd Update 2015-06-20 18:25:05 +02:00
Uwe Tews afe79aac2e - improvement allow closures as callback at $smarty->registerFilter() https://github.com/smarty-php/smarty/issues/59 2015-06-19 03:21:52 +02:00
Uwe Tews 4537d8aae6 Release 3.1.27 2015-06-18 02:55:59 +02:00
Uwe Tews 34531edb4c - bugfix another update on file path normalization failed on path containing something like "/.foo/" https://github.com/smarty-php/smarty/issues/56 2015-06-18 02:53:22 +02:00
Uwe Tews 2cdba79a74 Release 3.1.26 2015-06-18 02:08:42 +02:00
Uwe Tews 7b469c1f4a - bugfix file path normalization failed on path containing something like "/.foo/" https://github.com/smarty-php/smarty/issues/56 2015-06-18 01:46:35 +02:00
Uwe Tews 52ced72361 - bugfix calling a plugin with nocache option but no other attributes like {foo nocache} caused call to undefined function https://github.com/smarty-php/smarty/issues/55 2015-06-18 00:06:40 +02:00
Uwe Tews 58616d6ee5 Release 3.1.25 2015-06-16 00:23:24 +02:00
Uwe Tews ec383370cb - optimization of smarty_cachereource_keyvaluestore.php code 2015-06-15 23:39:42 +02:00
Uwe Tews 3bb22560c0 - bugfix an output tag with variable, modifier followed by an operator like {$foo|modifier+1} did fail https://github.com/smarty-php/smarty/issues/53 2015-06-14 04:26:37 +02:00
Uwe Tews 83f3f6d7f1 - bugfix an output tag with variable, modifier followed by an operator like {$foo|modifier+1} did fail https://github.com/smarty-php/smarty/issues/53 2015-06-14 04:23:50 +02:00
Uwe Tews ecddc1f720 - bugfix a relative sub template path could fail if template_dir path did contain /../ https://github.com/smarty-php/smarty/issues/50
- optimization rework of path normalization
2015-06-14 03:30:31 +02:00
Uwe Tews e96ee1b5d6 - bugfix a custom cache resource using smarty_cachereource_keyvaluestore.php did fail if php.ini mbstring.func_overload = 2 (forum topic 25568) 2015-06-13 19:39:02 +02:00
Uwe Tews 768b7d1ec5 - bugfix the lexer could hang on very large quoted strings (forum topic 25570) 2015-06-11 23:33:30 +02:00
Uwe Tews f1e1f56ffe - bugfix using {$foo} as array index like $bar.{$foo} or in double quoted string like "some {$foo} thing" failed https://github.com/smarty-php/smarty/issues/49 2015-06-08 23:54:46 +02:00
Uwe Tews d804454f21 Fix spelling 2015-06-04 02:40:36 +02:00
Uwe Tews 2a1badfebb - bugfix possible error message on unset() while compiling {block} tags https://github.com/smarty-php/smarty/issues/46 2015-06-04 02:39:26 +02:00
Uwe Tews fa269d418f - bugfix <?xml ... ?> including template variables broken since 3.1.22 https://github.com/smarty-php/smarty/issues/47 2015-06-01 22:26:45 +02:00
Uwe Tews 3771ea8d35 Fix comments 2015-05-28 22:31:35 +02:00
Uwe Tews 63b1d343b8 - 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 2015-05-27 22:24:24 +02:00
Uwe Tews 0434f34bdd - bugfix if condition string 'neq' broken due to a typo https://github.com/smarty-php/smarty/issues/42 2015-05-24 18:37:53 +02:00
Uwe Tews c9cd39f36f minor bugfix when processing autoliteral { php} tag. Does not effect generated output. 2015-05-23 23:40:02 +02:00
Uwe Tews 0356b70578 minor fix 2015-05-23 22:40:24 +02:00
Uwe Tews aa1e554993 Remove redundant code 2015-05-23 22:36:46 +02:00
Uwe Tews 531b298886 Prepare 3.1.25-dev 2015-05-23 19:25:50 +02:00
Uwe Tews b58771e31b Release 3.1.24 2015-05-23 19:22:14 +02:00
Uwe Tews c226fbd3d9 Travis setup does not work for PHP 5.2 for some reason 2015-05-23 19:04:19 +02:00
Uwe Tews 25391749a1 - improvement on php_handling to allow very large PHP sections, better error handling
- improvement allow extreme large comment sections (forum 25538)
2015-05-23 19:03:13 +02:00
Uwe Tews ec449734c3 - improvement on php_handling to allow very large PHP sections, better error handling
- improvement allow extreme large comment sections (forum 25538)
2015-05-23 18:56:00 +02:00
Uwe Tews c8ecad0b06 - bugfix named {foreach} comparison like $smarty.foreach.foobar.index > 1 did compile into wrong code https://github.com/smarty-php/smarty/issues/41 2015-05-21 00:59:26 +02:00
Uwe Tews 5d8718f761 - bugfix broken PHP 5.2 compatibility when compiling <?php tags https://github.com/smarty-php/smarty/issues/40 2015-05-21 00:05:16 +02:00
Uwe Tews 85e05458c6 - bugfix compiler could run into the pcre.backtrack_limit on larger comment or {php} tag sections (forum 25538) 2015-05-20 05:48:45 +02:00
Uwe Tews b8eb8784d4 - bugfix output filter trimwhitespace could run into the pcre.backtrack_limit on large output (code.google issue 220) 2015-05-20 04:26:29 +02:00
Uwe Tews 5468f140fa - bugfix compiler did overwrite existing variable value when setting the nocache attribute https://github.com/smarty-php/smarty/issues/39 2015-05-19 22:47:04 +02:00
Uwe Tews dcf53ca957 Fix max nesting parameter 2015-05-18 05:39:57 +02:00
Uwe Tews ed740b967a Removed redundant code 2015-05-18 04:26:46 +02:00
Uwe Tews ac99173cea - improvement introduce shortcuts in lexer/parser rules for most frequent terms for higher
compilation speed
2015-05-18 04:12:40 +02:00
Uwe Tews bef7c55544 {for} should be able to init array elements 2015-05-18 04:00:17 +02:00
Uwe Tews e3123c0427 - improvement higher compilation speed by modified lexer/parser generator at "smarty/smarty-lexer" 2015-05-16 16:33:50 +02:00
Uwe Tews d21921de22 - improvement reduce number of lexer tokens on operators and if conditions 2015-05-16 14:47:12 +02:00
Uwe Tews 22bccee350 - improvement remove not needed ?><?php transitions from compiled code 2015-05-16 14:17:59 +02:00
Uwe Tews 0bdd805d6b remove code not intended for this version 2015-05-16 13:40:45 +02:00
Uwe Tews a74804b061 - bugfix {php}{/php} did work just for single lines https://github.com/smarty-php/smarty/issues/33 2015-05-16 13:33:04 +02:00
Uwe Tews 9f1061f5bc - bugfix template functions failed when calling the function recursively with function name as tag name https://github.com/smarty-php/smarty/issues/28 2015-05-14 15:13:09 +02:00
Uwe Tews 2db464a6e5 - bugfix template functions failed when calling the function recursively with function name as tag name https://github.com/smarty-php/smarty/issues/28 2015-05-14 15:11:38 +02:00
Uwe Tews 8ee805632d - bugfix in Smarty_Security 'nl2br' should be a trusted modifier, not PHP function (code.google issue 223) 2015-05-13 20:17:02 +02:00
Uwe Tews dea56a2243 default for $debug_tpl will be set up in Smarty_Internal_Debug 2015-05-13 19:25:05 +02:00
Uwe Tews e0dbc79204 Debugging - add display of Smarty version 2015-05-13 19:10:06 +02:00
Uwe Tews a3c89bb4f4 Debugging - truncate output of Origin to 80 characters and increase string values from 40 to 80 characters 2015-05-13 19:03:54 +02:00
Uwe Tews 319e396937 use clean Smarty object to display the debugging console.
Avoid possible promblems when application did overload the Smarty object or properties go modified hardcoded in the class source.
2015-05-13 18:04:29 +02:00
Uwe Tews 3240b5a596 - improvement remove not needed ?><?php transitions from compiled code 2015-05-13 02:09:00 +02:00
Uwe Tews 2b858212b7 - improvement remove not needed ?><?php transitions from compiled code 2015-05-13 02:06:33 +02:00
Uwe Tews cf5b5c4e1f Disable hhvm test because of a hhvm PHP compatibility problem 2015-05-13 01:50:23 +02:00
Uwe Tews 07c781d9cf - bugfix in nested {foreach} saved item attributes got overwritten https://github.com/smarty-php/smarty/issues/33 2015-05-13 00:33:23 +02:00
Uwe Tews e4741e9dd7 version update after fixed issues 28 and 29 2015-05-12 20:41:41 +02:00
Uwe Tews ece0e2241f Log fixes for issue 28 and 29 2015-05-12 20:39:10 +02:00
Uwe Tews 3ac71869a6 Remove PHP nightly test 2015-05-12 20:33:18 +02:00
uwetews f791eeba11 Merge pull request #32 from Stricted/patch-1
fix variable name
2015-05-12 18:40:53 +02:00
uwetews 962cf3d193 Merge pull request #30 from Stricted/master
fix constant handling
2015-05-12 18:40:08 +02:00
Stricted a8f30dc7f6 fix variable name 2015-05-12 15:52:54 +02:00
Stricted 4af23bc104 fix last commit 2015-05-12 15:44:54 +02:00
Stricted 811e2e0e13 fix constant handling
on undefined constants you get 'TEST_CONST' on definied constants TEST_CONST
2015-05-12 15:43:57 +02:00
Uwe Tews 2ff51de3df allow failures of hhvm 2015-05-12 04:48:10 +02:00
Uwe Tews 04f0090c40 release 3.1.23 2015-05-12 04:08:22 +02:00
Uwe Tews e6a4e68139 remove hhvm nightly test 2015-05-12 04:01:10 +02:00
Uwe Tews d234625d7c - bugfix of smaller performance issue introduce in 3.1.22 when caching is enabled 2015-05-12 03:34:38 +02:00
Uwe Tews b4792df08a - bugfix missig entry for smarty-temmplate-config in autoloader 2015-05-12 03:07:24 +02:00
Uwe Tews 6deb3cee7c update travis 2015-05-12 02:58:32 +02:00
Uwe Tews c12655ded2 - bugfix of smaller performance issue introduce in 3.1.22 when caching is enabled 2015-05-12 02:52:30 +02:00
Uwe Tews 8acb920e20 update 2015-05-12 01:17:14 +02:00
Uwe Tews d276829aa6 fix comment 2015-05-11 23:09:27 +02:00
Uwe Tews 556185c9e2 Update 2015-05-10 23:17:43 +02:00
Uwe Tews ebef3b1988 Update 2015-05-10 23:14:51 +02:00
Uwe Tews ee8a695a57 Update 2015-05-10 22:46:48 +02:00
Uwe Tews 94d5e1e198 Update 2015-05-10 22:42:24 +02:00
Uwe Tews 469a6ad860 correction 2015-05-10 21:55:43 +02:00
Uwe Tews 735507b0ba correction 2015-05-10 21:53:16 +02:00
Uwe Tews 4c3e67a301 update 2015-05-10 21:47:34 +02:00
Uwe Tews 31edf7fcea push 2015-05-10 21:44:18 +02:00
Uwe Tews 5963632a99 add .travis.yml 2015-05-10 21:05:54 +02:00
Uwe Tews 3836cafd90 Prepare 3.1.23-dev 2015-05-10 13:17:33 +02:00
Uwe Tews 0f9ec2642a Release 3.1.22 2015-05-10 13:08:04 +02:00
Uwe Tews ab93b0feee - improvement added constants for $debugging 2015-05-10 12:18:41 +02:00
Uwe Tews 741a07fc8f new dev version 2015-05-10 12:13:21 +02:00
Uwe Tews 8a34ad0cd2 parameter cleanup 2015-05-10 12:09:24 +02:00
Uwe Tews b0ca67b213 - bugfix cache lock was not handled correctly after timeout when $cache_locking == true 2015-05-10 12:08:47 +02:00
Uwe Tews 5ce5d4df49 - bugfix custom cache resource did not observe compile_id and cache_id when $cache_locking == true 2015-05-10 12:00:19 +02:00
Uwe Tews edf49ca3cf formatting 2015-05-10 11:53:09 +02:00
Uwe Tews af4a923da5 - uodate and fixes at cache locking 2015-05-08 07:27:45 +02:00
Uwe Tews d7b0b57420 - optimization of resource class loading 2015-05-08 06:02:59 +02:00
Uwe Tews c5468b421e - optimization of resource class loading 2015-05-07 22:57:59 +02:00
Uwe Tews 37449b2fcb - improvement of the debugging console. Read NEW_FEATURES.txt 2015-05-07 04:36:49 +02:00
Uwe Tews af08353e93 - bugfix/improvement in 3.1.22-dev cache locking did not work as expected 2015-05-06 23:10:39 +02:00
Uwe Tews 57df382ff2 - bugfix in 3.1.22-dev cache resource must not be loaded for subtemplates 2015-05-06 22:10:04 +02:00
Uwe Tews d92714cc7e - optimization move <?php ?> handling from parser to new compiler module 2015-05-06 00:03:26 +02:00
Uwe Tews d7ff1eec47 - optimization on cache update when main template is modified 2015-05-05 15:46:24 +02:00
Uwe Tews 914815d438 Fix broken code 2015-05-05 06:48:37 +02:00
Uwe Tews 3e4734acfb - bugfix code could be messed up when {tags} are used in multiple attributes https://github.com/smarty-php/smarty/issues/23 2015-05-05 03:33:53 +02:00
Uwe Tews 6575e11f68 Add missing properties 2015-05-05 03:27:16 +02:00
Uwe Tews c5915a8c0c - improvement use is_file() checks to avoid errors suppressed by @ which could still cause problems (https://github.com/smarty-php/smarty/issues/24) 2015-05-05 00:41:30 +02:00
Uwe Tews f14f2dcc6f - bugfix Smarty_Resource::parseResourceName incompatible with Google AppEngine (https://github.com/smarty-php/smarty/issues/22) 2015-05-04 22:44:29 +02:00
Uwe Tews 22ea1404df add information how to get development tools 2015-05-04 18:21:55 +02:00
Uwe Tews 08c81acbb1 add require-dev to load PHPUnit tests and lxer/parser generator (reverted from commit f3d7b05ccb) 2015-05-04 18:20:44 +02:00
Uwe Tews 9789867d8b Revert "add require-dev to load PHPUnit tests and lxer/parser generator"
This reverts commit f3d7b05ccb.
2015-05-04 18:09:21 +02:00
Uwe Tews 80926a538d Revert "test"
This reverts commit d40e2a0286.
2015-05-04 18:08:41 +02:00
Uwe Tews d40e2a0286 test 2015-05-04 05:54:05 +02:00
Uwe Tews f3d7b05ccb add require-dev to load PHPUnit tests and lxer/parser generator 2015-05-04 05:20:22 +02:00
Uwe Tews ea17aad266 - bugfix plugins of merged subtemplates not loaded in 3.1.22-dev (forum topic 25508) 2nd fix 2015-04-28 23:12:12 +02:00
Uwe Tews e312dd9b59 - bugfix plugins of merged subtemplates not loaded in 3.1.22-dev (forum topic 25508) 2015-04-28 01:38:45 +02:00
Uwe Tews c7ba22dc98 - bugfix a nocache template variable used as parameter at {insert} was by mistake cached 2015-04-23 02:34:28 +02:00
Uwe Tews de892651c2 - bugfix at a template function containing nocache code a parmeter could overwrite a template variable of same name 2015-04-20 22:59:45 +02:00
Uwe Tews 6fb27d5ae4 strip property must now be public 2015-04-07 02:11:20 +02:00
Uwe Tews a92302d059 move strip processing from parser to compiler 2015-04-02 01:42:53 +02:00
Uwe Tews e9fd2354ef move compileVariable() from parser to compiler 2015-04-02 01:35:16 +02:00
Uwe Tews ea2a566b1f - 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)
2015-03-28 03:58:08 +01:00
Uwe Tews 443ae8c216 - bugfix problems when {function}{/function} defined a template function in a cached subtemplate and it was called {call} from a not cached subtemplate {forum topic 25468} 2015-03-23 00:39:22 +01:00
Uwe Tews 2a005ac6d6 - bugfix correct update of global variable values on exit of template functions. (reported under Smarty Developers) 2015-03-20 18:25:59 +01:00
Uwe Tews 2758cb8ce9 Correct version number 2015-03-20 01:49:52 +01:00
Uwe Tews 4ecc75344f - bugfix make sure that function properties get saved only in compiled files containing the fuction definition {forum topic 25452} 2015-03-20 00:41:55 +01:00
Uwe Tews 03c7b786a0 Clean up template functions property structure 2015-03-17 04:53:57 +01:00
Uwe Tews ab1272a2e4 fix whitespaces on tags included in double quoted strings 2015-03-17 04:31:51 +01:00
Uwe Tews 4c0e124c22 - bugfix {block}{/block} tags did not work inside double quoted strings issues #18 2015-03-17 03:40:01 +01:00
Uwe Tews 6df84b6fe3 - bugfix {block}{/block} tags did not work inside double quoted issues #18 2015-03-17 03:31:44 +01:00
Uwe Tews e7ad5909e5 - bugfix Smarty_Security->allow_constants=false; did not disallow direct usage of defined constants like {SMARTY_DIR} {forum topic 25457} 2015-03-17 02:29:19 +01:00
Uwe Tews eead9c81e9 - bugfix problems with {function}{/function} and {call} tags in different subtemplate cache files {forum topic 25452} 2015-03-17 01:10:51 +01:00
Uwe Tews 7b7118eea9 - bugfix $smarty->compile_check must be restored before rendering of a just updated cache file {forum 25452} 2015-03-15 02:01:07 +01:00
Uwe Tews 7fe81e6d79 - bugfix {nocache} {/nocache} tags corrupted code when used within a nocache section caused by a nocache template variable 2015-03-14 15:17:58 +01:00
Uwe Tews 8020144d46 - 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}
2015-03-14 12:02:57 +01:00
Uwe Tews e9b1f296cb - bugfix {include ... nocache} with variable file or compile_id attribute was not executed in nocache mode. 2015-03-10 18:06:05 +01:00
Uwe Tews 8892f358ad - bugfix __get() was called when loading config files 2015-03-07 01:44:30 +01:00
Uwe Tews b1cd4cd7d2 Return to saved output buffer level on exceptions 2015-03-01 21:39:54 +01:00
Uwe Tews 464b37c053 optimize compiled code of {foreach} 2015-02-15 16:58:42 +01:00
Uwe Tews 8082bc7471 get rid of smarty object self pointer 2015-02-15 01:45:37 +01:00
Uwe Tews f93cfc63ad get rid of reference parameter 2015-02-14 21:57:42 +01:00
Uwe Tews 6925c98af0 - bugfix multiple Smarty::fetch() of same template when $smarty->merge_compiled_includes = true; could cause function alreday defined error 2015-02-12 23:56:43 +01:00
Uwe Tews 0e87a99507 - bugfix recursive {includes} did create E_NOTICE message when $smarty->$merge_compiled_includes = true; 2015-02-11 07:15:40 +01:00
Uwe Tews aec380839c - bugfix recursive {includes} did create E_NOTICE message when $smarty->$merge_compiled_includes = true; 2015-02-11 06:57:17 +01:00
Uwe Tews 05f5ddf573 remove comments 2015-02-09 23:52:25 +01:00
Uwe Tews d62d394345 update 2015-02-08 22:22:52 +01:00
Uwe Tews d288e58692 update 2015-02-08 21:36:32 +01:00
Uwe Tews b2b114d5b8 udate 2015-02-08 21:21:30 +01:00
Uwe Tews 10bf6f6032 add isset($_smarty_tpl) to avoid errors when unit test runs in separate process 2015-02-08 21:10:45 +01:00
Uwe Tews 1fc2b9ece2 add isset($_smarty_tpl) to avoid errors when unit test runs in separate process 2015-02-08 19:57:14 +01:00
Uwe Tews e4e3e176c0 add note 2015-01-22 04:07:58 +01:00
Uwe Tews 1a781b39b1 new feature: security can now control access to static methods and properties
see also NEW_FEATURES.txt
2015-01-22 03:53:01 +01:00
Uwe Tews ec19bc763f - bugfix 'self::' and 'parent::' was interpreted in template syntax as static class 2015-01-21 23:30:37 +01:00
Uwe Tews 8d5fa36a80 - bugfix clearCompiledTemplates(), clearAll() and clear() could try to delete whole drive
at wrong path permissions because realpath() fail (forum 25397)
2015-01-21 22:14:25 +01:00
Uwe Tews 85f24ce413 convert writeFile() to object method to remove a vulnerability 2015-01-21 21:12:00 +01:00
Uwe Tews 7a1df12afa - bugfix clearCompiledTemplates() could try to delete whole drive
at wrong path permissions because realpath() fail (forum 25397)
2015-01-20 22:33:38 +01:00
Uwe Tews 4428d72e6d Update testInstall() and move it into its own class 2015-01-12 22:12:20 +01:00
Uwe Tews 593f984f6a load source, compiled and cache resource manually in normal flow (avoid __get()) 2015-01-07 17:46:12 +01:00
Uwe Tews 466c3ee9f8 Use require_once ; remove unnedded paramter 2015-01-07 16:46:57 +01:00
Uwe Tews 740a583c7c Use require_once 2015-01-07 16:46:03 +01:00
Uwe Tews b3f8ddefd2 remove redundant overloaded methods 2015-01-06 04:42:49 +01:00
Uwe Tews 43f043364f fix case in class name 2015-01-06 01:18:58 +01:00
Uwe Tews 67162324bb check ..._dir property overloading
if $template_dir, $compile_dir, $cache_dir, $config_dir or $plugins_dir properties
are overloaded the setters must be called for required processing
2015-01-05 02:03:24 +01:00
Uwe Tews 2aaa29ad20 reset _is_file_cache 2015-01-04 23:54:11 +01:00
Uwe Tews 7cc981e6a6 revert some unneeded normalization of compiled_dir, cache_dir and plugins_dir 2015-01-04 23:42:22 +01:00
Uwe Tews 3463fae2a1 push llast weeks changes to github 2015-01-04 05:57:49 +01:00
Uwe Tews 111a10bb17 Move some classes into its own files 2015-01-04 05:51:52 +01:00
Uwe Tews d528234a97 Small optimization 2015-01-04 05:51:03 +01:00
Uwe Tews 068da64c99 best defaults for internal resource caching
$resource_caching = false and $template_resource_caching = true

fixed typos
2015-01-04 05:49:38 +01:00
Uwe Tews 66eac7bc2a fix code frame of inline (merged) subtemplate 2015-01-03 21:32:33 +01:00
Uwe Tews 8b71e591c0 some minor speed optimization 2015-01-03 21:27:33 +01:00
Uwe Tews 57620443e9 Optimize constructor 2015-01-03 07:56:03 +01:00
Uwe Tews f236905fed create different compiled templates and config files
Smarty does now automatically detect a change of the $merge_compiled_includes and $escape_html
    property and create different compiled templates files depending on the setting.

    Same applies to config files and the $config_overwrite, $config_booleanize and
    $config_read_hidden properties.
2015-01-03 07:36:07 +01:00
Uwe Tews cfdd53c6b4 restructure config file processing
move code into an extension class
use Smarty_Internal_Template
2015-01-02 22:30:53 +01:00
Uwe Tews 75ad0b4da5 move default template handling into an extesion class 2015-01-02 10:48:07 +01:00
Uwe Tews 15728f6ea3 normalize directory path 2015-01-02 10:22:36 +01:00
Uwe Tews c8712b8b7e update autoloader 2015-01-02 09:12:27 +01:00
Uwe Tews 0a3579f9ca restructure template processing
Code was moved into classes it better belongs to.
This does reduce also Smarty's memory footprint
2015-01-02 09:12:01 +01:00
Uwe Tews 8c1f400c09 remove \r from template source before compiling 2015-01-02 08:25:27 +01:00
Uwe Tews 97e7948e16 fix update of file dependency 2015-01-02 08:20:57 +01:00
Uwe Tews 6f801de283 update buildFilepath() 2015-01-02 06:29:08 +01:00
Uwe Tews c55367d1f6 update buildFilepath() 2015-01-02 06:26:04 +01:00
Uwe Tews 296a88b557 Change class name case because of composer autoloader problems 2015-01-02 06:07:19 +01:00
Uwe Tews 3f08b18170 Correct recompiled check 2015-01-02 01:05:03 +01:00
Uwe Tews 48f66c81c7 rework class Smarty_Template_Cached
- move class Smarty_Template_Cached in its own file
- implement all code for chached template handling in class
2015-01-01 23:53:59 +01:00
Uwe Tews c3aa9994c8 rework source resource handling
- move class Smarty_Template_Source into its own file
- impelement all source processing into the classes it better belongs to
2015-01-01 23:34:29 +01:00
Uwe Tews dd2d24d1d6 rework class Smarty_Template_Compiled
- move class Smarty_Template_Compiled in its own file
- implement all code for compiled template handling in class
2015-01-01 23:28:09 +01:00
Uwe Tews 7c4e5175a4 rework class Smarty_Template_Compiled
- move class Smarty_Template_Compiled in its own file
- implement all code for compiled template handling in class (reverted from commit f6a1349fdb)
2015-01-01 23:15:08 +01:00
Uwe Tews f6a1349fdb rework class Smarty_Template_Compiled
- move class Smarty_Template_Compiled in its own file
- implement all code for compiled template handling in class
2015-01-01 23:11:35 +01:00
Uwe Tews 80bf76cc6e move internal createTemplateCodeFrame() method into an extension class 2015-01-01 22:59:07 +01:00
Uwe Tews e8a77171d3 implement templateId generation as method 2015-01-01 22:27:45 +01:00
Uwe Tews 2f8d4f1dbf missing property 2014-12-31 16:08:36 +01:00
Uwe Tews 0cb8b24055 implement most common stetters as method for better performance 2014-12-31 15:56:59 +01:00
Uwe Tews b013984dfd move properties into classes where they better belong to 2014-12-31 15:44:08 +01:00
Uwe Tews 2687f36849 update autoloader with for special class names 2014-12-31 14:32:47 +01:00
Uwe Tews 47faa63a0e use function_exists('mb_get_info') for setting Smarty::$_MBSTRING
Function mb_split could be overloaded depending on php.ini mbstring.func_overload
2014-12-31 06:07:17 +01:00
Uwe Tews 4b7fba4d88 get config properties via compiler object
- reverting part of earlier change of today
2014-12-30 18:16:51 +01:00
Uwe Tews e351c0123f move some code into Smarty_Internal_Debug class
where it better belongs to
2014-12-30 17:17:15 +01:00
Uwe Tews d3e26fb679 template function call handling 2014-12-30 16:43:42 +01:00
Uwe Tews 1d248d6349 formatting 2014-12-30 16:28:18 +01:00
Uwe Tews 8fe6f14af7 Change class name case because of composer autoloader problems 2014-12-30 16:27:08 +01:00
Uwe Tews b122878131 rename parse tree class names and minor fixes 2014-12-30 16:22:03 +01:00
Uwe Tews 825ccc9f47 rename parse tree class names to Smarty_Internal_ParseTree.... 2014-12-30 16:16:54 +01:00
Uwe Tews 485f093e0b get config properties via template object 2014-12-30 16:03:21 +01:00
Uwe Tews 6be6bf7b70 limit the template nesting level by security 2014-12-30 12:57:43 +01:00
Uwe Tews 1da50aa61d security can now disable special $smarty variables
see also NEW_FEATURES.txt
2014-12-29 21:59:23 +01:00
Uwe Tews 49a3427515 clear internal _is_file_cache when plugins_dir was modified 2014-12-27 23:06:04 +01:00
Uwe Tews 5e4f55d121 add .plex and .y files
add lexer .plex and parser .y files to distribution for easier version
control
2014-12-14 00:49:42 +01:00
Uwe Tews 46654268ef update .gitignore 2014-12-14 00:44:11 +01:00
Uwe Tews 2fb5bc6bbe lexer and parser optimizations
up to 30% higher compiling speed depending on template complexity
2014-12-13 23:02:29 +01:00
Uwe Tews 2fe60e8996 resolve parser ambiguity
- bugfix resolve parser ambiguity between constant print tag {CONST} and
other smarty tags after change of 09.12.2014
2014-12-11 05:21:21 +01:00
Smarty PHP Template Engine 042e93c725 Merge pull request #12 from jenolan/master
Commit 7b2a2c4a88 changed the constant pro...
2014-12-11 03:11:19 +01:00
Larry Lewis 7bb7b3ac03 Commit 7b2a2c4a88 changed the constant processing to allow a variable in teh $smarty.const but this broke the normal callout. Change allows both methods. 2014-12-11 08:06:27 +11:00
Uwe Tews 2a2a73cabc - bugfix call of template function by a variable name
did not work after latest changes (forum 25342)
2014-12-10 00:51:09 +01:00
Uwe Tews 7bd40d2c0b - bugfix variables $null, $true and $false did not work
after the change of 12.11.2014 (forum 25342)
2014-12-09 23:33:11 +01:00
Uwe Tews ffbfe40043 - bugfix a plugin with attached modifier could fail
if the tag was immediately followed by another Smarty tag (since 3.1.21) (forum 25326)
2014-11-23 13:25:09 +01:00
Uwe Tews de7310b702 Revert "delete unwanted file"
This reverts commit 77d8349ffb.
2014-11-13 19:52:41 +01:00
Uwe Tews 77d8349ffb delete unwanted file 2014-11-13 19:48:34 +01:00
Uwe Tews 0b6af0add7 move autoload code into Autoloader.php.
Use Composer autoloader when possible
2014-11-13 19:42:01 +01:00
Uwe Tews 0b21213c55 new feature - added support of namespaces to template code 2014-11-12 19:07:00 +01:00
Uwe Tews c7e8881c76 bugfix for recent changes of {function} tag handling 2014-11-11 01:01:01 +01:00
Uwe Tews 9ecbb93ebb update of the $smarty->merge_compiled_includes option 2014-11-11 00:03:08 +01:00
Uwe Tews 460be5a5da bugfix for recent changes of {function} tag handling 2014-11-10 23:57:30 +01:00
Uwe Tews adc6091c4d update of cache resources for template function calls in nocache mode 2014-11-09 10:20:06 +01:00
Uwe Tews 223cdc0787 moved code into constructor 2014-11-09 10:15:16 +01:00
Uwe Tews 230c5787e6 move Smarty exceptions into syslibs folder 2014-11-09 06:42:20 +01:00
Uwe Tews 4edb5fce30 Update of change log 2014-11-08 21:44:55 +01:00
Uwe Tews b82756a705 - bugfix subtemplate called in nocache mode could be called with wrong compile_id when it did change on one of the calling templates 2014-11-08 21:27:53 +01:00
Uwe Tews ea9c681106 remove no longer needed code 2014-11-08 21:06:53 +01:00
Uwe Tews f92af96419 fixed $smarty->debugging on merged compiled subtemplates 2014-11-08 21:02:14 +01:00
Uwe Tews 8f8d462b8a add code of template functions called in nocache mode dynamically to cache file 2014-11-08 17:19:53 +01:00
uwetews 845c4184b2 Merge pull request #9 from uwetews/master
new $smarty->debug options
2014-11-04 19:00:56 +01:00
Uwe Tews 963e5dae5e new $smarty->debug options
- new feature $smarty->debug = true; => overwrite existing Debug Console
window (old behaviour)
$smarty->debug = 2; => individual Debug Console window by template name
2014-11-04 18:59:57 +01:00
uwetews 5b1c649c6a Merge pull request #8 from uwetews/master
Debug Console Update
2014-11-03 22:31:13 +01:00
Uwe Tews 158b7be58a Debug Console Update
- 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
- 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
2014-11-03 22:27:32 +01:00
uwetews 4b3196fe30 Merge pull request #2 from smarty-php/master
Merge pull request #7 from uwetews/master
2014-11-02 14:57:41 +01:00
uwetews 4369b2fe05 Merge pull request #7 from uwetews/master
-bugfix and enhancement on subtemplate {include} and template {function}
2014-11-01 22:52:01 +01:00
Uwe Tews bc13ebbc9b -bugfix and enhancement on subtemplate {include} and template {function} tags.
* Calling a template which has a nocache section could fail if it was
called from a cached and a not cached subtemplate.
* Calling the same subtemplate cached and not cached with the
$smarty->merge_compiled_includes enabled could cause problems
* Many smaller related changes
2014-11-01 22:42:34 +01:00
uwetews 5f2f292739 Merge pull request #1 from smarty-php/master
merge
2014-11-01 11:24:58 +01:00
Smarty PHP Template Engine 337ab5bd1e Merge pull request #6 from aivus/patch-1
Clean merge conflicts
2014-11-01 11:14:25 +01:00
Ilya Antipenko 95cc39deb6 Clean merge conflicts 2014-11-01 11:22:03 +02:00
Smarty PHP Template Engine 402547baaf Merge pull request #5 from uwetews/master
resolved merge conflict
2014-11-01 00:42:31 +01:00
Uwe Tews 199c16e827 resolved merge conflict 2014-11-01 00:34:32 +01:00
Uwe Tews 84e5ef7345 3.1.22-dev 2014-10-31 05:48:52 +01:00
Uwe Tews 21204c6613 Merge branch 'trunk' 2014-10-31 05:31:56 +01:00
Uwe Tews 1f878e6d74 v3.1.21 2014-10-31 05:22:20 +01:00
Uwe Tews 6254b5d4df Merge branch 'v3.1.21' 2014-10-31 05:16:16 +01:00
Uwe Tews cef27602bb v3.1.20 2014-10-31 05:12:39 +01:00
Uwe Tews 1153afe2f5 Merge branch 'v3.1.20' 2014-10-31 05:05:40 +01:00
Uwe Tews be0fd3186c Merge branch 'v3.1.19' 2014-10-31 02:29:14 +01:00
Uwe Tews c65444124a v3.1.19 2014-10-31 02:26:40 +01:00
Uwe Tews bf1de6c105 Merge branch 'v3.1.18' 2014-10-31 02:15:15 +01:00
Uwe Tews 97decc4c04 Merge branch 'v3.1.17' 2014-10-31 02:10:17 +01:00
Uwe Tews 43be80762e Merge branch 'v3.1.16' 2014-10-31 02:05:49 +01:00
Uwe Tews 1bdaf9a2a6 v3.1.15 2014-10-31 02:02:52 +01:00
Uwe Tews 4281d16bd4 Merge branch 'v3.1.15' 2014-10-31 01:59:07 +01:00
Uwe Tews 5ea2a50161 v3.1.14 2014-10-31 01:55:21 +01:00
Uwe Tews 8c18f8664c Merge branch 'v3.1.14' 2014-10-31 01:52:37 +01:00
Uwe Tews 7b2a2c4a88 Merge branch 'v3.1.13' 2014-10-31 01:47:26 +01:00
Uwe Tews 014e8bc2be Merge branch 'v3.1.12'
Conflicts:
	change_log.txt
2014-10-31 01:41:04 +01:00
Uwe Tews 25d1339bea v3.1.12 2014-10-31 01:38:04 +01:00
Uwe Tews 0b24c4520b Merge branch 'v3.1.11' 2014-10-31 01:35:16 +01:00
Uwe Tews 5b6aa49b23 prepare 3.1 2014-10-31 01:34:24 +01:00
Uwe Tews af7a4c10e2 v3.1.11 2014-10-31 01:30:32 +01:00
Uwe Tews f83b3effc6 prepare 3.1 2014-10-31 01:28:26 +01:00
Uwe Tews 52fb7b1e25 - bugfix access to class constant by object like {$object::CONST} or variable class name {$class::CONST} did not work (forum 25301) me 2014-10-30 00:55:01 +01:00
Uwe Tews 0c9ca2994e - bugfix merge_compiled_includes option failed when caching enables and same subtemplate was included cached and not cached 2014-10-26 09:47:10 +01:00
Uwe Tews f7955513b2 Revert "- bugfix template function call handler must never be called as nocache code"
This reverts commit db183d1aa4.
2014-10-24 00:09:45 +02:00
Uwe Tews db183d1aa4 - bugfix template function call handler must never be called as nocache code 2014-10-23 19:05:25 +02:00
Uwe Tews a22ee9f264 - bugfix E_NOTICE message was created during compilation when ASP tags '<%' or '%>' are in template source text 2014-10-23 18:27:12 +02:00
Uwe Tews fc55a39d67 Update README.md 2014-10-23 18:13:05 +02:00
Uwe Tews 53c5e3fc4a Added licence file and demo folder 2014-10-18 17:42:52 +02:00
Uwe Tews cbc9ce927e add composer release notes 2014-10-18 07:48:57 +02:00
Uwe Tews c0a9a0449b add composer release notes 2014-10-18 07:44:20 +02:00
Uwe Tews 16afbfaca1 Prepare 3.1.22-dev 2014-10-18 01:21:53 +02:00
Uwe Tews 1441f32fce Upload 3.1.21 2014-10-18 01:19:29 +02:00
Uwe Tews 117d28f647 Upload 3.21 2014-10-18 01:17:22 +02:00
Uwe Tews 542892dded Upload 3.1.21 2014-10-18 01:09:18 +02:00
Uwe Tews 024b336bea Upload 3.1.20 2014-10-18 01:05:22 +02:00
Uwe Tews 7c6b3d21fa revert 2014-10-18 01:01:36 +02:00
Uwe Tews 6cb40b8bcc Upload 3.1.20 2014-10-18 00:55:00 +02:00
Uwe Tews bdac1cb2e1 Upload 3.1.20 2014-10-18 00:53:39 +02:00
Uwe Tews d26db3f717 Revert "Prepare 3.2.22-dev"
This reverts commit 451c62001d.
2014-10-18 00:45:38 +02:00
Uwe Tews 451c62001d Prepare 3.2.22-dev 2014-10-18 00:38:59 +02:00
Uwe Tews eb48f3bcea Upload 3.1.21 2014-10-18 00:31:50 +02:00
Uwe Tews 0409ab005e Upload version 3.1.20 2014-10-18 00:18:11 +02:00
uwetews d091179e43 Initial commit 2014-10-17 19:51:33 +02:00
Uwe.Tews@googlemail.com 279bdbd352 - bugfix on $php_handling security and optimization of smarty_internal_parsetree (Thue Kristensen) 2014-10-16 22:53:22 +00:00
Uwe.Tews@googlemail.com 1c63d3a9fc - bugfix composer.json update 2014-10-16 01:33:28 +00:00
Uwe.Tews@googlemail.com b10b12165a - bugfix calling a new created cache file with fetch() and Smarty::CACHING_LIFETIME_SAVED multiple times did fail (forum 22350) 2014-10-15 20:22:22 +00:00
Uwe.Tews@googlemail.com dece63c5d7 - improvement cache is_file(file_exists) results of loadPlugin() to avoid unnecessary calls during compilation (Issue 201} 2014-10-14 22:29:58 +00:00
Uwe.Tews@googlemail.com d9bc39da57 - bugfix classmap in root composer.json should start at "libs/..." 2014-10-14 21:59:49 +00:00
Uwe.Tews@googlemail.com c77cc80a8c - bugfix any tag placed within "<script language=php>" will throw a security exception to close all thinkable holes 2014-10-14 21:45:05 +00:00
Uwe.Tews@googlemail.com 4dde85a089 - bugfix "<script language=php>" with $php_handling PHP_PASSTHRU was executed in {nocache} sections 2014-10-12 15:57:16 +00:00
Uwe.Tews@googlemail.com f03fc13bc9 - bugfix change of 08.10.2014 could create E_NOTICE meassage when using "<?php" tags 2014-10-12 15:09:52 +00:00
Uwe.Tews@googlemail.com 6af75db3c3 2014-10-12 14:11:34 +00:00
Uwe.Tews@googlemail.com a1dac5a053 Switch trunk version to 3.1.21-dev 2014-10-10 17:12:39 +00:00
monte.ohrt 11e0cd566c fix date format 2014-10-09 21:37:21 +00:00
monte.ohrt d0673df7c2 update composer file 2014-10-09 21:29:46 +00:00
monte.ohrt 821456043b update changelog 2014-10-09 21:23:23 +00:00
Uwe.Tews@googlemail.com a7b4f6cdd9 2014-10-07 22:20:21 +00:00
Uwe.Tews@googlemail.com 6af4441f0e - bugfix security mode of "<script language=php>" must be controlled by $php_handling property (Thue Kristensen) 2014-10-07 22:07:15 +00:00
monte.ohrt 795c3af692 update classmap 2014-10-02 15:48:56 +00:00
Uwe.Tews@googlemail.com 2a311c5473 - bugfix existing child {block} tag must override parent {block} tag append / prepend setting (topic 25259) 2014-10-01 21:03:40 +00:00
monte.ohrt 7add711ea0 add composer.json to dist folder 2014-10-01 18:57:34 +00:00
monte.ohrt f57bb66746 revert move 2014-10-01 18:52:28 +00:00
monte.ohrt 2d3a853bce move composer file 2014-10-01 18:50:11 +00:00
Uwe.Tews@googlemail.com bbf0e42847 Fix typo's in Smarty_Security class comment and documentation 2014-10-01 17:15:24 +00:00
Uwe.Tews@googlemail.com 68b83f591d - bugfix template resource of inheritance blocks could get invalid if the default resource type is not 'file'(Issue 202) 2014-09-30 23:20:56 +00:00
Uwe.Tews@googlemail.com 254230a5d5 Correct wording 2014-08-06 17:29:53 +00:00
Uwe.Tews@googlemail.com 95760bb537 fixed spelling 2014-08-02 15:39:02 +00:00
Uwe.Tews@googlemail.com 9307f0cfcb - bugfix modifier wordwrap did output break string wrong if first word was exceeding lenght with cut = true (topic 25193) 2014-08-02 15:24:28 +00:00
monte.ohrt 9b06625c74 update changelog 2014-07-24 15:10:55 +00:00
monte.ohrt fcece85062 fix issue where cache dir does not exist
-This line, and those below, will be ignored--

M    distribution/libs/sysplugins/smarty_internal_cacheresource_file.php
2014-07-24 15:08:32 +00:00
Uwe.Tews@googlemail.com 071f9af42f anchor BOM regex to front of file 2014-07-16 21:40:57 +00:00
Uwe.Tews@googlemail.com 77292d394a - enhancement remove BOM automatically from template source (topic 25161) 2014-07-16 18:21:25 +00:00
Uwe.Tews@googlemail.com c2bba29216 - 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) 2014-07-03 23:16:23 +00:00
monte.ohrt 4b3e1eb89d fix url in comment 2014-07-01 19:33:25 +00:00
monte.ohrt 84a2b19447 update version 2014-07-01 05:20:41 +00:00
Uwe.Tews@googlemail.com fb28ee9d2e - bugfix template variables could not be passed as paramter in {include} when the include was in a {nocache} section (topic 25131) 2014-06-21 08:56:11 +00:00
Uwe.Tews@googlemail.com a75e36b357 - bugfix template variables could not be passed as paramter in {include} when the include was in a {nocache} section (topic 25131) 2014-06-21 08:53:38 +00:00
Uwe.Tews@googlemail.com ee69f963c6 - bugfix large template text of some charsets could cause parsing errors (topic 24630) 2014-06-17 20:24:20 +00:00
Uwe.Tews@googlemail.com 0e1f7fdcfc - bugfix {html_image} security check did fail on files relative to basedir (Issue 191) 2014-06-08 19:03:39 +00:00
Uwe.Tews@googlemail.com 7ca939f47b - bugfix UNC WINDOWS PATH like "\\psf\path\to\dir" did not work as template directory (Issue 192) 2014-06-08 18:12:09 +00:00
Uwe.Tews@googlemail.com ee4a77b797 upload reformatted versions 2014-06-08 16:00:56 +00:00
Uwe.Tews@googlemail.com e5dd155809 - bugfix {block} tags within {literal} .. {/literal} got not displayed correctly (topic 25024) 2014-06-08 15:52:08 +00:00
Uwe.Tews@googlemail.com 642c071437 - bugfix registered objects did not work after spelling fixes of 006.06.2014 2014-06-08 15:43:02 +00:00
Uwe.Tews@googlemail.com 425091a19f - fixed spelling, PHPDoc , minor errors, code cleanup 2014-06-06 02:40:04 +00:00
Uwe.Tews@googlemail.com ca6a908c83 - fixed PHPUnit outputFilterTrimWhitespaceTests.php assertion of test result 2014-06-05 22:58:58 +00:00
Uwe.Tews@googlemail.com 3a124b4a56 Rename release note file 2014-06-02 20:11:09 +00:00
Uwe.Tews@googlemail.com 2c5ce49b97 - using multiple cwd with relative template dirs could result in identical compiled file names. (issue 194 and topic 25099) 2014-06-02 19:56:38 +00:00
Uwe.Tews@googlemail.com c7071d9d2c - bugfix clearCompiledTemplate() did not delete files on WINDOWS when a compile_id was specified 2014-04-19 13:53:20 +00:00
Uwe.Tews@googlemail.com 8658b04c86 bugfix calling createTemplate(template, data) with empty data array caused notice of array to string conversion (Issue 189) 2014-04-19 11:42:11 +00:00
Uwe.Tews@googlemail.com d6c1482996 fixed typos 2014-04-18 08:13:32 +00:00
Uwe.Tews@googlemail.com 608dddc19a 2014-04-18 08:09:38 +00:00
Uwe.Tews@googlemail.com a613394887 Update dev version number to 3.1.19-dev 2014-04-07 19:57:42 +00:00
monte.ohrt f67473f085 update to 3.1.18 2014-04-07 18:30:41 +00:00
Uwe.Tews@googlemail.com 00c919dcc2 bugfix update of composer file (Issue 168 and 184) 2014-04-06 19:06:32 +00:00
Uwe.Tews@googlemail.com 668bc16717 - bugfix template inheritance fail when using custom resource after patch of 8.3.2014 (Issue 187) 2014-04-06 18:50:39 +00:00
Uwe.Tews@googlemail.com 79d67afb0f - bugfix default date format leads to extra spaces when displaying dates with single digit days (Issue 182) 2014-04-04 23:38:36 +00:00
Uwe.Tews@googlemail.com 58982caf27 - bugfix Smart_Resource_Custom should not lowercase the resource name (Issue 183) 2014-03-26 20:33:03 +00:00
Uwe.Tews@googlemail.com 474e863af1 - bugfix using a {foreach} property like @iteration could fail when used in inheritance parent templates (Issue 182) 2014-03-24 18:52:29 +00:00
Uwe.Tews@googlemail.com 478db521c9 - bugfix $smarty->auto_literal and mbsting.func_overload 2, 6 or 7 did fail (forum topic 24899) 2014-03-20 22:07:26 +00:00
Uwe.Tews@googlemail.com 7dec7d9963 - revert change of 17.03.2014 2014-03-18 18:22:33 +00:00
Uwe.Tews@googlemail.com d82d54bffd fix line endings 2014-03-17 21:57:15 +00:00
Uwe.Tews@googlemail.com 45fc4cd729 - bugfix $smarty->auto_literal and mbsting.func_overload 2, 6 or 7 did fail (forum topic 24899) 2014-03-17 19:04:48 +00:00
Uwe.Tews@googlemail.com ad62b0b2f8 - bugfix Smarty_CacheResource_Keyvaluestore did use different keys on read/writes and clearCache() calls (Issue 169) 2014-03-15 21:43:04 +00:00
Uwe.Tews@googlemail.com 3d4d35f4d7 - bugfix clearXxx() change of 27.1.2014 did not work when specifing cache_id or compile_id (forum topic 24868 and 24867) 2014-03-13 20:32:39 +00:00
monte.ohrt 40acefe91b update changelog 2014-03-12 19:50:58 +00:00
Uwe.Tews@googlemail.com af13907219 08.03.2014
- bugfix relative file path {include} within {block} of child templates did throw exception on first call (Issue 177)
2014-03-08 23:03:08 +00:00
Uwe.Tews@googlemail.com f06013927c - bugfix Smarty failed when executing PHP on HHVM (Hip Hop 2.4) because uniqid('',true) does return string with ',' (forum topic 20343) 2014-02-17 18:21:31 +00:00
Uwe.Tews@googlemail.com bfa0ce8ba4 - bugfix a '//' or '\\' in template_dir path could produce wrong path on relative filepath in {include} (Issue 175) 2014-02-16 18:34:08 +00:00
Uwe.Tews@googlemail.com f242ce30fb - bugfix shared.literal_compiler_param.php did throw an exception when literal did contain a '-' (smarty-developers group) 2014-02-05 19:39:21 +00:00
Uwe.Tews@googlemail.com ba2996fef5 - bugfix clearCompiledTemplate(), clearAll() and clear() should use realpath to avoid possible exception from RecursiveDirectoryIterator (Issue 171) 2014-01-27 16:35:56 +00:00
Uwe.Tews@googlemail.com 79dfde4977 - bugfix $smarty->debugging = true; did show the variable of the $smarty object not the variables used in display() call (forum topic 24764) 2014-01-27 16:08:55 +00:00
Uwe.Tews@googlemail.com 0e03ba5b61 - bugfix undo block nesting checks for {nocache} for reasons like forum topic 23280 (forum topic 24762) 2014-01-26 20:11:19 +00:00
Uwe.Tews@googlemail.com 290dd3f73f - bugfix the compiler did fail when using template inheritance and recursive {include} (smarty-developers group) 2014-01-18 14:43:02 +00:00
Uwe.Tews@googlemail.com 1dfbe19ebf - internals content cache should be clear when updating cache file 2014-01-11 12:21:12 +00:00
Uwe.Tews@googlemail.com 18ff092501 2014-01-11 12:15:37 +00:00
Uwe.Tews@googlemail.com 54d5d949de - bugfix SmartyBC.class.php should use require_once to load Smarty.class.php (forum topic 24683) 2014-01-08 21:16:06 +00:00
Uwe.Tews@googlemail.com 797bd37c5f - bugfix Smarty_CacheResource_Custom did not handle template resource type specifications on clearCache() calls (Issue 161) 2014-01-08 21:05:58 +00:00
monte.ohrt fa09638f95 update changelog 2013-12-17 16:06:12 +00:00
Uwe.Tews@googlemail.com a0a24e1975 - enhancement additional debug output at $smarty->_parserdebug = true; 2013-12-15 15:25:50 +00:00
Uwe.Tews@googlemail.com 7f88dcd31f - bugfix {include} with {block} tag handling (forum topic 24599, 24594, 24682) (Issue 161)
Read 3.1.16_RELEASE_NOTES for more details
2013-12-15 15:19:01 +00:00
Uwe.Tews@googlemail.com 6abc9ea0d3 - bugfix compiler could fail if PHP mbstring.func_overload is enabled (Issue 164) 2013-11-07 20:00:56 +00:00
Uwe.Tews@googlemail.com 4e1f7b1568 - bugfix too restrictive handling of {include} within {block} tags. 3.1.15 did throw errors where 3.1.14 did not (forum topic 24599) 2013-11-07 19:09:37 +00:00
Uwe.Tews@googlemail.com c8996a4085 - bugfix multiple {block}s with same name in parent did not work (forum topic 24631) 2013-10-29 00:40:14 +00:00
Uwe.Tews@googlemail.com 5dc4b61771 - bugfix correction of modifier capitalize fix from 3.10.2013 (issue 159) 2013-10-28 23:56:41 +00:00
Uwe.Tews@googlemail.com c3e6823f5d - bugfix notice "Trying to get property of non-object" removed (Issue 163) 2013-10-28 23:53:01 +00:00
Uwe.Tews@googlemail.com 26e4a5120e - bugfix variable resource name at custom resource plugin did not work within {block} tags (Issue 163) 2013-10-28 18:24:01 +00:00
Uwe.Tews@googlemail.com 8342cf45f3 - bugfix a variable file name at {extends} tag did fail (forum topic 24618) 2013-10-20 15:27:35 +00:00
Uwe.Tews@googlemail.com fccd80818b - bugfix yesterdays fix could result in an undefined variable 2013-10-14 07:47:49 +00:00
Uwe.Tews@googlemail.com c3994f4006 .- bugfix relative includes with same name like {include './foo.tpl'} from different folder failed (forum topic 24590)(Issue 161) 2013-10-13 17:49:38 +00:00
Uwe.Tews@googlemail.com cd6c1c2ff8 bugfix variable names on {include} in template inheritance did unextepted error message (forum topic 24585) (Issue 161) 2013-10-13 12:48:07 +00:00
Uwe.Tews@googlemail.com 51453d196b - bugfix variable file names at {extends} had been disbabled by mistake with the rewrite of
template inheritance of 24.08.2013   (forum topic 24585)
2013-10-04 08:47:46 +00:00
Uwe.Tews@googlemail.com 655a2d9301 - bugfix loops using modifier capitalize did eat up memory (issue 159) 2013-10-03 09:16:27 +00:00
monte.ohrt 3281c14769 update change log 2013-10-01 19:35:02 +00:00
Uwe.Tews@googlemail.com 953f6f5a14 - improvement on performance when using error handler and multiple template folders (issue 152) 2013-10-01 18:56:49 +00:00
Uwe.Tews@googlemail.com 51ee8c4ad9 - use current delimiters in compiler error messages (issue 157) 2013-10-01 18:48:29 +00:00
Uwe.Tews@googlemail.com 5bbfbafc47 - improvement added patch for additional SmartyCompilerException properties for better access to scource information (forum topic 24559) 2013-09-17 20:44:41 +00:00
Uwe.Tews@googlemail.com bf8275ee20 - bugfix recompiled templates did not show on first request with zend opcache cache (forum topic 24320) 2013-09-16 18:47:04 +00:00
Uwe.Tews@googlemail.com a0dcb5611b - bugfix html_select_time defaulting error for the Meridian dropdown (forum topic 24549) 2013-09-13 20:48:40 +00:00
Uwe.Tews@googlemail.com 0d9f9802db - bugfix incorrect compiled code with array(object,method) callback at registered Variable Filter (forum topic 24542} 2013-09-09 16:10:13 +00:00
Uwe.Tews@googlemail.com 70d5af437e fixed spelling 2013-09-03 16:20:04 +00:00
Uwe.Tews@googlemail.com 96c2a9c71a - bugfix delimiter followed by linebreak did not work as auto literak after update form 24.08.2013 (forum topic 24518} 2013-08-27 19:42:38 +00:00
Uwe.Tews@googlemail.com 98c1dd29cd - bugfix and enhancement
Because several recent problems with template inheritance the {block} tag compiler has been rewriten
   - Error messages shown now the correct child template file and line number
   - The compiler could fail on some larger UTF-8 text block (forum topic 24455}
   - 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
2013-08-24 18:46:31 +00:00
Uwe.Tews@googlemail.com e206ba63f0 - bugfix compiled filepath of config file did not observe different config_dir (forum topic 24493) 2013-08-14 19:38:03 +00:00
Uwe.Tews@googlemail.com e9601e1d6d - bugfix avoid possible E_STRICT error after bugfix for (forum topic 24493) 2013-08-13 23:03:28 +00:00
Uwe.Tews@googlemail.com 3ad903ad21 - bugfix the internal resource cache did not observe config_dir changes (forum topic 24493) 2013-08-13 20:54:59 +00:00
Uwe.Tews@googlemail.com 518ffca6f5 - bugfix internal $tmpx variables must be unique over all inheritance templates (Issue 149) 2013-08-12 21:09:29 +00:00
Uwe.Tews@googlemail.com 35d2e254bb - bugfix a newline was eaten when a <?xml ... ?> was passed by a Smarty variable and caching was enabled (forum topic 24482) 2013-08-10 09:55:27 +00:00
Uwe.Tews@googlemail.com 6d88d33c5b - bugfix headers already send warning thrown when using 'SMARTY_DEBUG=on' from URL (Issue 148) 2013-07-29 13:58:08 +00:00
Uwe.Tews@googlemail.com 6851c57ef8 - enhancement allow access to properties of registered opjects for Smarty2 BC (forum topic 24344) 2013-07-27 10:06:43 +00:00
Uwe.Tews@googlemail.com e62dcaa6a9 - enhancement allow access to properties of registered opjects for Smarty2 BC (forum topic 24344) 2013-07-27 09:48:42 +00:00
Uwe.Tews@googlemail.com 697696fef9 Source code reformatted 2013-07-27 07:05:26 +00:00
Uwe.Tews@googlemail.com f83eba920d - bugfix template inheritance nesting problem (forum topic 24387) 2013-07-26 13:50:44 +00:00
Uwe.Tews@googlemail.com 584886cb1c - update code generated by PSR-2 standards fixer which introduced PHP 5.4 incompatibilities of 14.7.2013 2013-07-15 18:18:28 +00:00
Uwe.Tews@googlemail.com 00ccae8857 - update for PHP 5.4 compatibility
- reformat source to PSR-2 standard
2013-07-14 22:15:45 +00:00
Uwe.Tews@googlemail.com f99e6a83ce - bugfix increase of internal maximum parser stacksize to allow more complex tag code {forum topic 24426} 2013-07-14 21:12:08 +00:00
Uwe.Tews@googlemail.com 917f92d38b - bugfix Do not remove '//' from file path at normalization (Issue 142) 2013-07-12 00:16:43 +00:00
monte.ohrt a74d8d5416 update change log 2013-07-02 14:16:49 +00:00
monte.ohrt a0f26a96cc fix order of replacements (mohrt) 2013-07-02 14:11:12 +00:00
monte.ohrt 739688a454 update change log 2013-06-28 02:02:53 +00:00
Uwe.Tews@googlemail.com 0643bf9808 - bugfix removed PHP 5.5 deprecated preg_replace /e option in modifier capitalize (forum topic 24389) 2013-06-26 22:21:17 +00:00
Uwe.Tews@googlemail.com b7d4796400 - bugfix added smarty_security.php to composer.json (Issue 135) 2013-06-17 13:48:22 +00:00
Uwe.Tews@googlemail.com 338e7c5d56 - enhancement added constant SMARTY::CLEAR_EXPIRED for the change of 26.05.2013 (forum topic 24310) 2013-06-17 13:30:49 +00:00
Uwe.Tews@googlemail.com b0b2c0e86d 17.06.2013
- fixed spelling in sources and documentation (from smarty-developers forum Veres Lajos)
2013-06-17 12:34:10 +00:00
Uwe.Tews@googlemail.com 00c034b593 - enhancement an expire_time of -1 in clearCache() and clearAllCache() will delete outdated cache files
by their individual cache_lifetime used at creation (forum topic 24310)
2013-05-26 10:50:13 +00:00
Uwe.Tews@googlemail.com 6b5b06564f - bugfix modifier strip_tags:true was compiled into wrong code (Forum Topic 24287)
- bugfix /n after ?> in Smarty.class.php did start output buffering (Issue 138)
2013-05-21 21:01:23 +00:00
Uwe.Tews@googlemail.com 8e2d249233 - bugfix escape and wordrap modifier could be compiled into wrong code when used in {nocache}{/nocache}
section but caching is disabled  (Forum Topic 24260)
2013-04-25 15:20:13 +00:00
Uwe.Tews@googlemail.com f074a20ed5 - bugfix after the fix for Issue #130 compiler exceptions got double escaped (Forum Topic 24199) 2013-04-05 22:19:13 +00:00
Uwe.Tews@googlemail.com 58f2227cce - bugfix post filter must not run when compiling inheritance child blocks (Forum Topic 24094) 2013-04-05 21:19:28 +00:00
uwe.tews@googlemail.com c3319fc5ca fixed date 2013-02-28 19:41:00 +00:00
uwe.tews@googlemail.com 6612fa6d8b - bugfix Compile ID gets nulled when compiling child blocks (Issue #134) 2013-02-28 19:23:04 +00:00
uwe.tews@googlemail.com bd8af7c5cb - bugfix nocache blocks could be lost when using CACHING_LIFETIME_SAVED (Issue #133) 2013-02-28 19:17:26 +00:00
uwe.tews@googlemail.com 2140439352 - bugfix wrong tag type in smarty_internal_templatecompilerbase.php could cause wrong plugin search order (Forum Topic 24028) 2013-01-24 19:16:41 +00:00
monte.ohrt 6148053a15 update changelog 2013-01-16 02:07:15 +00:00
uwe.tews@googlemail.com 73c7b32c83 13.01.2013
- enhancement allow to disable exception message escaping by SmartyException::$escape = false;  (Issue #130)
2013-01-13 21:13:14 +00:00
uwe.tews@googlemail.com af4735193e - added abstract method declaration doCompile() in Smarty_Internal_TemplateCompilerBase (Forum Topic 23969) 2013-01-09 23:54:31 +00:00
uwe.tews@googlemail.com 993a2eac70 - enhancement to allow variable constant names like {$smarty.const.{$foo}} (Forum Topic 23970) 2013-01-09 23:35:40 +00:00
uwe.tews@googlemail.com 285a535346 - bugfix template inheritance could fail if nested {block} tags in childs did contain {$smarty.block.child} (Issue #127)
- bugfix template inheritance could fail if {block} tags in childs did have similar name as used plugins (Issue #128)
2013-01-09 23:05:09 +00:00
uwe.tews@googlemail.com 2f83a70627 - bugfix compilation did fail when a prefilter did modify an {extends} tag (Forum Topic 23966) 2013-01-09 00:05:07 +00:00
uwe.tews@googlemail.com b24eada147 - Allow '://' URL syntax in template names of stream resources (Issue #129) 2013-01-06 19:22:48 +00:00
uwe.tews@googlemail.com 6ebd099041 - bugfix wrong variable usage in smarty_internal_utility.php (Issue #125) 2012-11-27 13:37:35 +00:00
uwe.tews@googlemail.com 88693d327a - bugfix global variable assigned within template function are not seen after template function exit (Forum Topic 23800) 2012-11-26 20:11:10 +00:00
rodneyrehm 9c6bda43d0 made SmartyBC loadable via composer (Issue #124) 2012-11-24 10:45:38 +00:00
uwe.tews@googlemail.com 27be6508bd - bugfix assignGlobal() called from plugins did not work (Forum Topic 23771) 2012-11-20 02:06:20 +00:00
rodneyrehm b8f0d3bacb - adding attribute "strict" to html_options, html_checkboxes, html_radios to only print disabled/readonly attributes if their values are true or "disabled"/"readonly" (Issue #120) 2012-11-13 18:31:48 +00:00
rodneyrehm 642e021f45 Fixing Issue #118 - muteExpectedErrors would fail non-readable directories 2012-11-01 10:10:10 +00:00
monte.ohrt 3204262e0f update change log 2012-09-25 19:03:40 +00:00
uwe.tews@googlemail.com 191a13b623 - bugfix template inheritance failed to compile with delimiters {/ and /} (Forum Topic 23008) 2012-09-14 14:42:15 +00:00
uwe.tews@googlemail.com 4305a8931c - bugfix escape Smarty exception messages to avoid possible script execution 2012-09-11 16:23:30 +00:00
uwe.tews@googlemail.com 81a6d0869b - bugfix tag option flags and shorttag attributes did not work when rdel started with '=' (Forum Topic 22979) 2012-09-10 22:04:03 +00:00
rodneyrehm 9ef8d6045f bugfix resolving relative paths broke in some circumstances (Issue #114) 2012-08-31 19:39:28 +00:00
rodneyrehm 98c9862de4 - bugfix test MBString availability through mb_split(), as it could've been compiled without regex support (--enable-mbregex). Either we get MBstring's full package, or we pretend it's not there at all. 2012-08-22 20:45:22 +00:00
uwe.tews@googlemail.com b70b06aa20 - 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)
2012-08-21 21:54:30 +00:00
uwe.tews@googlemail.com 9d34e78d0b 17.08.2012
- bugfix compiled code of nocache sections could contain wrong escaping (Forum Topic 22810)
2012-08-17 11:19:16 +00:00
uwe.tews@googlemail.com 090ba8e7c5 - bugfix template inheritance did produce wrong code if subtemplates with {block} was
included several times (from smarty-developers forum)
2012-08-15 15:09:12 +00:00
rodneyrehm b977381e4e bugfix PHP5.2 compatibility compromised by SplFileInfo::getBasename() (Issue 110) 2012-08-14 13:22:34 +00:00
rodneyrehm b921a7657d fixing typo in comments 2012-08-14 13:18:24 +00:00
uwe.tews@googlemail.com b069c08eb4 - bugfix avoid PHP error on $smarty->configLoad(...) with invalid section specification (Forum Topic 22608) 2012-08-01 21:31:24 +00:00
uwe.tews@googlemail.com 897d40fe5c -bugfix {assign} in a nocache section should not overwrite existing variable values
during compilation (issue 109)
2012-07-30 20:07:51 +00:00
uwe.tews@googlemail.com 50b3a4f070 28.07.2012
- bugfix array access of config variables did not work (Forum Topic 22527)
2012-07-28 08:10:04 +00:00
uwe.tews@googlemail.com 942db98f0c - bugfix the default plugin handler did create wrong compiled code for static class methods
from external script files (issue 108)
2012-07-18 22:31:56 +00:00
monte.ohrt c6f25b466d update changelog 2012-06-30 21:20:53 +00:00
uwe.tews@googlemail.com ab1cdc8d84 - bugfix {block.. hide} did not work as nested child (Forum Topic 22216) 2012-06-30 15:53:22 +00:00
rodneyrehm 79087f409f <script><!-- … is bad practice and should not be encouraged. 2012-06-28 20:13:17 +00:00
uwe.tews@googlemail.com d59870d557 - bugfix the default plugin handler did not allow static class methods for modifier (issue 85) 2012-06-25 21:46:17 +00:00
rodneyrehm fc8e4767ca bugfix escape modifier support for PHP < 5.2.3 (Forum Topic 21176) 2012-06-24 18:15:58 +00:00
uwe.tews@googlemail.com 7be2c1fded - bugfix the patch for Topic 21856 did break tabs between tag attributes (Forum Topic 22124) 2012-06-11 18:14:41 +00:00
monte.ohrt c3d4693604 update changelog 2012-06-09 15:57:26 +00:00
uwe.tews@googlemail.com 766d3f04a2 - bugfix the patch for Topic 21856 did break multiline tags (Forum Topic 22124) 2012-06-09 14:27:25 +00:00
uwe.tews@googlemail.com 42d2ee98dd 09.06.2012
- bugfix the compiler did ignore registered compiler plugins for closing tags (Forum Topic 22094)
2012-06-09 14:00:57 +00:00
monte.ohrt 7133a3c85c update change log 2012-06-08 20:44:17 +00:00
rodneyrehm dd6d9b159e bugfix treat "0000-00-00" as 0 in modifier.date_format (Issue 103) 2012-06-07 13:01:58 +00:00
rodneyrehm a37492e04a bugfix fetch() and display() with relative paths (Issue 104) 2012-06-07 12:54:02 +00:00
uwe.tews@googlemail.com 179c62e4ef - bugfix add compile_id to cache key of of source (Issue 97) 2012-05-24 17:03:31 +00:00
uwe.tews@googlemail.com 35a68ed535 - bugfix attribute parameter names of plugins may now contain also "-" and ":" (Forum Topic 21856) 2012-05-24 16:01:19 +00:00
rodneyrehm 8f831024ce bugfix Smarty_Internal_Write_File::writeFile() could cause race-conditions on linux systems (Issue 101) 2012-05-24 15:13:19 +00:00
uwe.tews@googlemail.com bc2622bf94 - bugfix recursive {include} within {section} did fail (Smarty developer group) 2012-05-22 21:00:47 +00:00
rodneyrehm b27fc84447 bugfix {html_options} did not properly escape values (Issue 98) 2012-05-12 10:59:49 +00:00
uwe.tews@googlemail.com 208ad6b540 2012-05-03 16:17:39 +00:00
uwe.tews@googlemail.com 9e5eed4733 - bugfix {nocache}{block}{plugin}... did produce wrong compiled code when caching is disabled (Forum Topic 21572, issue 95) 2012-05-02 17:19:33 +00:00
uwe.tews@googlemail.com 8c3bcf9eef - bugfix concurrent cache updates could create a warning (Forum Topic 21403) 2012-04-12 16:55:35 +00:00
uwe.tews@googlemail.com 4c86e72faa - Smarty did eat the linebreak after the <?xml...?> closing tag (Issue 93) 2012-04-12 15:43:06 +00:00
uwe.tews@googlemail.com 409e39c4ec - bugfix "\\" was not escaped correctly when generation nocache code (Forum Topic 21364) 2012-04-08 12:08:48 +00:00
uwe.tews@googlemail.com 8d60164201 2012-03-30 14:21:16 +00:00
uwe.tews@googlemail.com 0364e35e7d - bugfix implement Smarty2's behaviour of variables assigned by reference in SmartyBC. {assign} will affect all references.
(issue 88)
2012-03-27 17:07:32 +00:00
uwe.tews@googlemail.com d157cac590 - bugfix prefilter did run multiple times on inline subtemplates compiled into several main templates (Forum Topic 21325) 2012-03-27 14:44:46 +00:00
uwe.tews@googlemail.com 9079b1d890 - bugfix compileAllTemplates() and compileAllConfig() did not return the number of compiled files (Forum Topic 21286) 2012-03-21 17:18:51 +00:00
uwe.tews@googlemail.com e2b14e7c19 - correction of yesterdays bugfix (Forum Topic 21175 and 21182) 2012-03-13 18:10:00 +00:00
uwe.tews@googlemail.com 62f01f29e5 - bugfix template inheritance did set $merge_compiled_includes globally true 2012-03-12 19:29:10 +00:00
uwe.tews@googlemail.com a7f7267b04 - bugfix a double quoted string of "$foo" did not compile into PHP "$foo" (Forum Topic 21175) 2012-03-12 19:25:30 +00:00
uwe.tews@googlemail.com 065db28777 - optimization of compiling speed when same modifier was used several times 2012-03-03 14:10:39 +00:00
uwe.tews@googlemail.com f6769036f1 - enhancement the default plugin handler can now also resolve undefined modifier (Smarty::PLUGIN_MODIFIER)
(Issue 85)
2012-03-02 20:26:38 +00:00
monte.ohrt 902e8e6e15 update changelog 2012-02-20 16:26:49 +00:00
uwe.tews@googlemail.com e134e54820 - enhancement added Smarty special variable $smarty.template_object to return the current template object (Forum Topic 20289) 2012-02-19 18:53:10 +00:00
uwe.tews@googlemail.com d0ad3df670 - bugfix {include} could result in a fatal error if used in appended or prepended nested {block} tags
(reported by mh and Issue 83)
2012-02-19 15:48:05 +00:00
uwe.tews@googlemail.com c000b3a480 - enhancement cacheable parameter added to default plugin handler, same functionality as in registerPlugin (request by calguy1000) 2012-02-07 21:55:37 +00:00
uwe.tews@googlemail.com 820e0e70d8 - bugfix increase entropy of internal function names in compiled and cached template files (Forum Topic 20996) 2012-02-07 18:54:06 +00:00
uwe.tews@googlemail.com 53df807220 - improvement replaced some calls of preg_replace with str_replace (Issue 73) 2012-02-06 20:53:57 +00:00
rodneyrehm e91ee4c5ec improved include_path resolving 2012-02-06 20:45:10 +00:00
rodneyrehm 0f39bdfd59 added modifier unescape:"url", fix (Forum Topic 20980) 2012-02-06 20:33:07 +00:00
rodneyrehm 6d90cd3fd7 bugfix fetch('extends:foo.tpl') always yielded $source->exists == true (Forum Topic 20980) 2012-02-06 20:18:47 +00:00
rodneyrehm 8f805ca871 todo 2012-02-06 20:17:49 +00:00
rodneyrehm b9bae74db6 improvement stream_resolve_include_path() added to Smarty_Internal_Get_Include_Path (Forum Topic 20980) 2012-02-06 20:17:32 +00:00
rodneyrehm f009a80a74 typos 2012-01-30 11:39:04 +00:00
rodneyrehm 26eac9888d bugfix Smarty_Security internal $_resource_dir cache wasn't properly propagated 2012-01-30 11:31:34 +00:00
uwe.tews@googlemail.com 9419a999c9 2012-01-27 19:30:53 +00:00
uwe.tews@googlemail.com d8b26c5ad0 - bugfix output filter must not run before writing cache when template does contain nocache code {Issue 71} 2012-01-20 18:21:32 +00:00
uwe.tews@googlemail.com 1e2fb8fbbe - fixed typo in template parser 2012-01-20 14:52:50 +00:00
uwe.tews@googlemail.com c352723ec9 - bugfix typo in Smarty_Internal_Get_IncludePath did cause runtime overhead (Issue 74)
- improvment remove unneeded assigments (Issue 75 and 76)
2012-01-20 14:47:01 +00:00
uwe.tews@googlemail.com b38be6edaa - bugfix {block foo nocache} did not load plugins within child {block} in nocache mode (Forum Topic 20753) 2012-01-02 20:49:26 +00:00
uwe.tews@googlemail.com 1b25005d42 - bugfix embedded quotes in single quoted strings did not compile correctly in {nocache} sections (Forum Topic 20730) 2011-12-29 18:44:09 +00:00
rodneyrehm 3d409db9b1 typo 2011-12-29 13:32:40 +00:00
rodneyrehm ec99ee7ee6 - bugfix enable more entropy in Smarty_Internal_Write_File for "more uniqueness" and Cygwin compatibility 2011-12-29 13:30:09 +00:00
uwe.tews@googlemail.com 05f17be99a - bugfix Smarty's internal header code must be excluded from postfilters (issue 71) 2011-12-28 18:51:20 +00:00
uwe.tews@googlemail.com d6abd3155d - bugfix template inheritace did fail if mbstring.func_overload != 0 (issue 70) (Forum Topic 20680) 2011-12-22 19:37:44 +00:00
uwe.tews@googlemail.com 44f7651eb2 - bugfix the new lexer of 17.12.2011 did fail if mbstring.func_overload != 0 (issue 70) (Forum Topic 20680) 2011-12-22 16:33:12 +00:00
uwe.tews@googlemail.com 04c1b32a81 adjust formatting 2011-12-20 17:50:15 +00:00
uwe.tews@googlemail.com ea567850b0 - bugfix template inheritance: {$smarty.block.child} in nested child {block} tags did not return
content after {$smarty.block.child} (Forum Topic 20564)
2011-12-20 15:52:59 +00:00
monte.ohrt dae58ebd3e update changelog 2011-12-19 22:12:28 +00:00
rodneyrehm ac2e0dcde5 typo 2011-12-19 21:53:53 +00:00
rodneyrehm 6f2c439455 (typo) 2011-12-19 07:56:12 +00:00
rodneyrehm 2c25a64dd3 - added Smarty_Security::isTrustedUri() and Smarty_Security::$trusted_uri to validate remote resource calls through {fetch} and {html_image} (Forum Topic 20627) 2011-12-18 22:21:49 +00:00
rodneyrehm df60ed94fa (typos) 2011-12-18 18:51:04 +00:00
rodneyrehm 52754a1a47 - added Smarty::$_UTF8_MODIFIER for proper PCRE charset handling (Forum Topic 20452) 2011-12-18 18:48:07 +00:00
rodneyrehm d645ad2ea1 - changed internals to use Smarty::$_MBSTRING ($_CHARSET, $_DATE_FORMAT) for better unit testing 2011-12-18 18:20:09 +00:00
rodneyrehm 75c271079d stashing PCRE modifications 2011-12-18 17:21:44 +00:00
rodneyrehm 23a924cebe (phpdoc indentation) 2011-12-18 16:55:28 +00:00
rodneyrehm 3495b683bd (phpdoc indentation) 2011-12-18 16:52:26 +00:00
rodneyrehm 9be91eb04b - added chaining to Smarty_Internal_Templatebase
- changed unloadFilter() to not return a boolean in favor of chaining and API conformity
- bugfix unregisterObject() raised notice when object to unregister did not exist
2011-12-18 16:51:32 +00:00
uwe.tews@googlemail.com d0b6b69f7c - bufix strings ending with " in multiline strings of config files failed to compile {isse 67) 2011-12-18 15:39:51 +00:00
uwe.tews@googlemail.com 6c17076d19 - improvement of compiling speed by new handling of plain text blocks in the lexer/parser (issue 68) 2011-12-17 14:23:31 +00:00
uwe.tews@googlemail.com e439c13a3e - bugfix the source exits flag and timestamp was not setup when temple is in php include path (issue 69) 2011-12-16 17:00:51 +00:00
uwe.tews@googlemail.com 36ec5acb0d - 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 
   parent template (Issue 66}
- bugfix template inheritance: {$smarty.block.child} in nested child {block} tags did not return expected
   result (Forum Topic 20564)
2011-12-09 22:05:16 +00:00
monte.ohrt 0455f90c8d update changelog, fix dev version number 2011-12-01 15:34:04 +00:00
uwe.tews@googlemail.com 678b28769d - bugfix is_cache() for individual cached subtemplates with $smarty->caching = CACHING_OFF did produce
an exception (Forum Topic 20531)
2011-11-30 16:31:25 +00:00
uwe.tews@googlemail.com f14c4bfb9c - bugfix added exception if the default plugin handler did return a not static callback (Forum Topic 20512) 2011-11-29 17:47:37 +00:00
uwe.tews@googlemail.com fe68b976e8 - bugfix {html_select_date} and {html_slecet_time} did not default to current time if "time" was not specified
since r4432 (issue 60)
2011-11-25 17:06:30 +00:00
uwe.tews@googlemail.com e8a933e8e0 - bugfix a subtemplate later used as main template did use old variable values 2011-11-24 21:08:26 +00:00
uwe.tews@googlemail.com 8b414e3b8a - bugfix cache file could include unneeded modifier plugins under certain condition 2011-11-21 00:37:33 +00:00
uwe.tews@googlemail.com 8f732cc4b6 - bugfix declare all directory properties private to map direct access to getter/setter also on extended Smarty class 2011-11-18 15:32:17 +00:00
rodneyrehm 3d03494a74 - added escape argument to html_checkboxes and html_radios (Forum Topic 20425) 2011-11-16 11:28:35 +00:00
rodneyrehm 0fb537aed2 - bugfix Smarty_Resource::load() did not always return a proper resource handler (Forum Topic 20414) 2011-11-16 08:25:33 +00:00
monte.ohrt 0c368eb1bb update changelog 2011-11-14 17:58:52 +00:00
uwe.tews@googlemail.com 4b7de63dc5 - bugfix allow space between function name and open bracket (forum topic 20375) 2011-11-14 17:14:28 +00:00
monte.ohrt 55fc3b1bc7 fix typos paramter to parameter 2011-11-14 14:53:16 +00:00
uwe.tews@googlemail.com 9a9dd9a7ba fixed topic reference in change_log.txt 2011-11-09 17:12:08 +00:00
uwe.tews@googlemail.com 555a7fceb9 - bugfix different behaviour of uniqid() on cygwin. See https://bugs.php.net/bug.php?id=34908
(forum topic 20199)
2011-11-09 15:30:06 +00:00
uwe.tews@googlemail.com a061bc47d1 - bugfix multiline strings in config files could fail on longer strings (reopened Issue #55) 2011-11-01 21:41:12 +00:00
uwe.tews@googlemail.com d3e71dabb6 - bugfix {if} and {while} tags without condition did not throw a SmartyCompilerException (Issue #57) 2011-11-01 20:27:53 +00:00
uwe.tews@googlemail.com 4f4cb7847d fixed changelog 2011-10-22 17:07:06 +00:00
uwe.tews@googlemail.com 20a14579ce - bugfix use catch Exception instead UnexpectedValueException in
clearCompiledTemplate to be PHP 5.2 compatible

- fixed PHPunit ClearCompiledTests to run also under Windows
2011-10-22 16:47:35 +00:00
rodneyrehm 1edb2220c7 - bugfix smarty_mb_from_unicode() would not decode unicode-points properly 2011-10-22 15:30:26 +00:00
rodneyrehm 7659c6c0ea - add Smarty::$allow_ambiguous_resources to activate unique resource handling (Forum Topic 20128)
see http://www.smarty.net/forums/viewtopic.php?t=20128
2011-10-21 18:40:16 +00:00
rodneyrehm 6baca38bf1 - improvement sha1() for array keys longer than 150 characters 2011-10-21 12:10:41 +00:00
uwe.tews@googlemail.com 37719ce858 - bugfix apostrophe in plugins_dir path name failed (forum topic 20199) 2011-10-21 12:08:35 +00:00
rodneyrehm 6470e6a2c9 - improvement removed unnecessary sha1()
(and added previously forgotten templates for ClearCompileTests)
2011-10-20 20:28:21 +00:00
rodneyrehm 922017c7fa - bugfix {html_select_date} and {html_select_time} did not properly handle empty time arguments (Forum Topic 20190)
see http://www.smarty.net/forums/viewtopic.php?t=20190
2011-10-20 13:31:25 +00:00
rodneyrehm b71323ca24 - bugfix Smarty::clearCompiledTemplate() threw an Exception if $cache_id was not present in $compile_dir when $use_sub_dirs = true.
-rewrote ClearCompiledTests to cover all possible usage scenarios
2011-10-20 12:50:12 +00:00
rodneyrehm 38af2463df - @silenced unlink() in Smarty_Internal_Write_File since debuggers go haywire without it. 2011-10-20 10:55:11 +00:00
uwe.tews@googlemail.com 85658fcdd4 - fixed PHP4 constructor message 2011-10-19 19:49:27 +00:00
monte.ohrt 5547f8a485 revert PHP4 constructor 2011-10-19 19:20:58 +00:00
monte.ohrt dd30176b9e fix text filenames, update changelog 2011-10-19 18:20:03 +00:00
monte.ohrt 724e1b969f update change log 2011-10-19 14:37:08 +00:00
monte.ohrt 0dd7ddb2d1 add exception for using php4 style constructor 2011-10-19 14:32:52 +00:00
rodneyrehm eea360e87d - bugfix testInstall() did not propery check cache_dir and compile_dir 2011-10-16 09:53:14 +00:00
rodneyrehm 131553272a - bugfix Smarty_Resource and Smarty_CacheResource runtime caching (Forum Post 75264)
www.smarty.net/forums/viewtopic.php?p=75264#75264
2011-10-15 10:46:03 +00:00
rodneyrehm 318328cd75 fixing previous commit 2011-10-14 17:54:25 +00:00
rodneyrehm 59a95253b4 - add Smarty_Internal_Template::clearCache() to accompany isCached() fetch() etc. 2011-10-14 17:15:06 +00:00
rodneyrehm ef32ed830c fixing previous commit 2011-10-14 16:22:00 +00:00
rodneyrehm 8a82d84861 - add locking to custom resources (Forum Post 75252)
this is a potentially dirty commit
2011-10-14 16:17:27 +00:00
rodneyrehm ef3e29daa7 - bugfix unique_resource did not properly apply to compiled resources (Forum Topic 20128) 2011-10-14 09:31:09 +00:00
uwe.tews@googlemail.com 8471e25bd8 - bugfix multiline strings in config files could fail on longer strings (Issue #55) 2011-10-13 16:25:50 +00:00
rodneyrehm 81c068dc3a f***ing phpunit now doing what it's supposed to. 2011-10-13 15:36:35 +00:00
rodneyrehm 94dff13c89 removing todos 2011-10-13 13:41:59 +00:00
rodneyrehm 6979b4efb0 - add concept unique_resource to combat potentially ambiguous template_resource values when custom resource handlers are used (Forum Topic 2012)
http://www.smarty.net/forums/viewtopic.php?t=2012

thereby DRYed and optimized the resource handler identification method.
2011-10-13 13:10:06 +00:00
uwe.tews@googlemail.com 806c51fdcf - bugfix disable of caching after isCached() call did not work (Forum Topic 20131) 2011-10-13 11:59:02 +00:00
rodneyrehm 3b006ae5a1 - add caching for config files in Smarty_Resource
(not really sure why this wasn't implemented yet?!) If we removed this (for some reason) we should've made a note of it in the code...
2011-10-13 09:50:55 +00:00
uwe.tews@googlemail.com 0fabe627ad - add runtime checks for not matching {capture}/{/capture} calls (Forum Topic 20120) 2011-10-11 15:49:19 +00:00
rodneyrehm 352cb05cf5 - bugfix Smarty_CacheResource_mysql example was missing strtotime() calls 2011-10-10 19:31:34 +00:00
uwe.tews@googlemail.com d3258767a6 - bugfix <?xml> tag did create wrong output when caching enabled and the tag was in included subtemplate 2011-10-10 11:38:27 +00:00
rodneyrehm 1cfdafccdd - bugfix variable name typo in {html_options} and {html_checkboxes} (Issue #54) 2011-10-10 08:53:43 +00:00
uwe.tews@googlemail.com 4c070d0bda - bugfix parent pointer was not set when fetch() for other template was called on template object 2011-10-07 15:30:04 +00:00
rodneyrehm b7ef6f0597 - improvement removed some unnecessary count()s 2011-10-07 14:05:26 +00:00
rodneyrehm 1f35133079 - improvement html_checkboxes and html_radios to accept null- and object values, and label_ids attribute 2011-10-07 13:39:45 +00:00
rodneyrehm 1bf1b05846 - bugfix html_options plugin did not handle object values properly (Issue #49, Forum Topic 20049) 2011-10-07 12:11:33 +00:00
rodneyrehm 2fdb8c9bb5 - improvement testInstall() now showing resolved paths and checking the include_path if necessary 2011-10-07 11:07:00 +00:00
rodneyrehm 13f1415c22 - bugfix testInstall() would not show path to internal plugins_dir (Forum Post 74627) 2011-10-07 10:38:46 +00:00
rodneyrehm a3a4bf8f80 - improvement removed html comments from {mailto} (Forum Topic 20092) 2011-10-07 08:55:12 +00:00
rodneyrehm 7169e594c4 - bugfix start_year and end_year of {html_select_date} did not use current year as offset base (Issue #53) 2011-10-06 15:12:35 +00:00
uwe.tews@googlemail.com 904731fd1f - bugfix switch lexer internals depending on mbstring.func_overload 2011-10-06 14:36:30 +00:00
rodneyrehm 3825ef336c - bugfix html_options plugin did not handle null- and object values properly (Issue #49, Forum Topic 20049) 2011-10-05 18:51:10 +00:00
uwe.tews@googlemail.com 1e48394ed3 - bugfix nofilter tag option did not disable default modifier 2011-10-05 18:17:40 +00:00
rodneyrehm 3e3f6ad43c - add environment configuration issue with mbstring.func_overload Smarty cannot compensate for (Issue #45) 2011-10-05 17:51:44 +00:00
rodneyrehm aeec0783ec - bugfix of problem introduced with r4342 by replacing strlen() with isset() 2011-10-05 17:11:01 +00:00
uwe.tews@googlemail.com 8bab7fe522 - bugfix has_nocache_code flag was not reset before compilation 2011-10-04 18:58:17 +00:00
uwe.tews@googlemail.com eb9714cf0e - bugfix output filter should not run on individually cached subtemplates
- add unloadFilter() method
2011-10-04 17:50:39 +00:00
uwe.tews@googlemail.com 4cb1e143cc - bugfix of problem introduced with r4342 on math plugin 2011-10-04 16:38:12 +00:00
uwe.tews@googlemail.com dbda42bc6c - bugfix assign() in plugins called in subtemplates did change value also in parent template 2011-10-04 16:18:24 +00:00
monte.ohrt 9ca21fac77 update changelog 2011-10-03 19:30:08 +00:00
uwe.tews@googlemail.com 12e8593760 - improvement add internal $joined_template_dir property instead computing it on the fly several times 2011-10-03 19:02:44 +00:00
rodneyrehm c24e213ed9 typo 2011-10-01 19:35:54 +00:00
rodneyrehm 9bd3520d97 - improvement Smarty_Internal_Utility::clearCompiledTemplate() removed redundant strlen()s 2011-10-01 19:11:28 +00:00
rodneyrehm 655cbc94bc - improvement replaced some strlen($foo) > 3 calls by isset($foo[3]) 2011-10-01 18:47:56 +00:00
rodneyrehm aff7c6a0ab - improvement replaced most in_array() calls by more efficient isset() on array_flip()ed haystacks
- added notes on possible performance optimization/problem with Smarty_Security
2011-10-01 18:10:48 +00:00
rodneyrehm 41958a5790 - improvement of Smarty_Internal_Config::loadConfigVars() dropped the in_array for index look up 2011-09-29 12:59:06 +00:00
uwe.tews@googlemail.com bc2d519c38 - bugfix on template functions called nocache calling other template functions 2011-09-28 15:56:01 +00:00
uwe.tews@googlemail.com d9ba05407a - bugfix wrong resource could be used on compile check of custom resource 2011-09-27 21:48:33 +00:00
rodneyrehm ae85a298d8 - bugfix smarty_make_timestamp() failed to process DateTime objects properly 2011-09-27 18:16:03 +00:00
uwe.tews@googlemail.com 0348e71109 - bugfix variable property did not work on objects variable in template 2011-09-27 17:52:21 +00:00
uwe.tews@googlemail.com 5c33be7fc0 - bugfix remove race condition when a custom resource did change timestamp during compilation 2011-09-27 17:15:31 +00:00
rodneyrehm 0cd9821dcc - added chaining to Smarty_Internal_Data so $smarty->assign('a',1)->assign('b',2); is possible now 2011-09-27 12:36:50 +00:00
rodneyrehm b6e6b67548 - bugfix possible warning "attempt to modify property of non-object" in {section} (issue #34) 2011-09-27 10:09:25 +00:00
uwe.tews@googlemail.com 709e5e1e84 - bugfix repeated calls to same subtemplate did not make use of cached template object 2011-09-26 15:21:50 +00:00
uwe.tews@googlemail.com a98d83bbf3 - improvment better error message for undefined templates at {include} 2011-09-24 18:20:13 +00:00
rodneyrehm 5c0d7ad8b4 - added compile_dir and cache_dir to list of muted directories 2011-09-24 15:45:30 +00:00
rodneyrehm 25e31b38f5 fixed error_handler 2011-09-24 14:12:36 +00:00
rodneyrehm d0228e96ea - removed internal muteExpectedErrors() calls in favor of having the implementor call this once from his application
- optimized muteExpectedErrors() to pass errors to the latest registered error handler, if appliccable

error muting is now a global thing. this was done because of the overhead set_error_handler imposes and the fact, that only a few people really "need" this. 

The decision was made by uwe.tews and rodneyrehm. (just in case anyone asks…)
2011-09-24 12:56:52 +00:00
uwe.tews@googlemail.com 537285032c - bugfix error muting was not implemented for cache locking 2011-09-23 22:27:44 +00:00
uwe.tews@googlemail.com 50a8f805dd - 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 
  extended Smarty class created problems
2011-09-23 20:21:16 +00:00
monte.ohrt 1d9f527c1e update header 2011-09-23 14:22:30 +00:00
uwe.tews@googlemail.com 00a4769aa5 - bugfix debug.tpl did not display correctly when it was compiled with escape_html = true 2011-09-22 19:13:15 +00:00
uwe.tews@googlemail.com 6e22abb6dd - bugfix {foreachelse} does fail if {section} was nested inside {foreach} 2011-09-22 14:51:34 +00:00
rodneyrehm 48295d9573 - reverted ./ and ../ handling in fetch() and display() - they're allowed again 2011-09-21 23:06:27 +00:00
uwe.tews@googlemail.com 95ab01f99f remove unneeded error suppression 2011-09-21 22:54:08 +00:00
rodneyrehm 985b575e97 oops 2011-09-21 22:45:21 +00:00
rodneyrehm f1511d813e monte wanted some docs on the topic of error_muting 2011-09-21 22:44:53 +00:00
rodneyrehm 38a3554fa0 optimized autoloader 2011-09-21 22:10:52 +00:00
rodneyrehm e499fb11f0 oops… 2011-09-21 22:05:54 +00:00
rodneyrehm 7a6b9dba91 - added $error_muting to suppress error messages even for badly implemented error_handlers
- reverted r4301
2011-09-21 22:02:54 +00:00
uwe.tews@googlemail.com b77446463f - bugfix use 3.0 version of smarty_internal_write_file.php because of problems with custom error handlers 2011-09-21 19:39:30 +00:00
uwe.tews@googlemail.com cade307db0 - bugfix look for mixed case plugin file names as in 3.0 if not found try all lowercase 2011-09-21 19:06:16 +00:00
uwe.tews@googlemail.com eb60692dbe - bugfix {assign} with scope root and global did not work in all cases 2011-09-20 19:12:51 +00:00
rodneyrehm a3dc61542d apc.enable_cli must be activated for the APC test to execute in unit tests (which are run from CLI) duh! 2011-09-20 17:33:15 +00:00
uwe.tews@googlemail.com bff28f38a4 - bugfix {include} did not work inside nested {block} tags 2011-09-20 17:27:45 +00:00
rodneyrehm 2df84e24a6 - bugfix relative paths in $template_dir broke relative path resolving in {include "../foo.tpl"} 2011-09-20 14:12:34 +00:00
uwe.tews@googlemail.com 29a7600b74 - bugfix removed debug echo output while compiling template inheritance 2011-09-19 23:58:52 +00:00
uwe.tews@googlemail.com c8eb5d078a - bugfix output filter shall not run on included subtemplates 2011-09-19 21:13:44 +00:00
rodneyrehm c877da74de - bugfix regression in Smarty_CacheReource_KeyValueStore introduced by r4261
- added APC test
- added read/write test to APC demo ('cause it ain't working on my machine!?)
2011-09-19 20:17:22 +00:00
uwe.tews@googlemail.com 8e6626fbca - bugfix for Smarty2 style compiler plugins on unnamed attribute passing like {tag $foo $bar}
- bugfix debug.tpl did not display correctly when it was compiled with escape_html = true
2011-09-18 18:36:26 +00:00
rodneyrehm c86131979e comma -> dot 2011-09-18 09:48:51 +00:00
uwe.tews@googlemail.com a44d9a6ac9 - bugfix template caching did not care about file.tpl in different template_dir
- bugfix {include $file} was broken when merge_compiled_incluges = true
- bugfix {include} was broken when merge_compiled_incluges = true and same indluded template
  was used in different main templates in one compilation run
2011-09-18 02:31:58 +00:00
rodneyrehm c9be9cd7f9 - bugfix lock_id for file resource would create invalid filepath
- bugfix resource caching did not care about file.tpl in different template_dir
- added svn:ignore where necessary
2011-09-17 16:29:10 +00:00
uwe.tews@googlemail.com 00d45f4d3f - bugfix reverted resource caching as it could not detect template_dir changes 2011-09-16 22:31:34 +00:00
monte.ohrt b6274e6ae9 fix non utf-8 chars 2011-09-16 16:26:28 +00:00
monte.ohrt 12a8953246 commit 3.1 files to trunk 2011-09-16 15:16:22 +00:00
uwe.tews@googlemail.com c0e62f38ba Update SMARTY_3.1_NOTES.txt 2011-09-16 14:46:38 +00:00
monte.ohrt 8842e79107 commit 3.1 into the trunk 2011-09-16 14:19:56 +00:00
uwe.tews@googlemail.com 5693de91f5 - bugfix subtemplate could use wrong varibale scope when it was recalled from different templates 2011-07-27 16:47:44 +00:00
uwe.tews@googlemail.com c4c0cd254c - bugfix experimental getTags() method did not work 2011-07-26 18:09:31 +00:00
uwe.tews@googlemail.com c64813beb5 - bugfix individual cache_lifetime of {include} did not work correctly inside {block} tags 2011-07-15 00:42:43 +00:00
uwe.tews@googlemail.com c859f6a9ae - bugfix PHP did eat line break on nocache sections 2011-07-12 17:20:45 +00:00
uwe.tews@googlemail.com a55e05506e - bugfix clear_config Smarty2 BC wrapper function was missing 2011-06-19 20:34:28 +00:00
uwe.tews@googlemail.com 4d07e3b03e - bugfix do not overwrite 'smarty' template variable when {include ... scope=parent} exits 2011-06-16 17:27:32 +00:00
rodneyrehm bc96213c44 fix smarty security_policy issue in plugins {html_image} and {fetch} 2011-06-09 07:52:58 +00:00
uwe.tews@googlemail.com 0c552377cd - bugfix registerFilter() or registerPlugin() on template objects did register to the main Smarty object if the register methods had been used on the main Smarty object before. 2011-06-07 14:31:22 +00:00
monte.ohrt b59c9b06f9 update version 2011-06-03 19:39:21 +00:00
uwe.tews@googlemail.com 7c90b107b2 - bugfix <?xml..?> in templates did break "cache modified check" 2011-05-29 10:37:57 +00:00
uwe.tews@googlemail.com 7c0e3c89c1 - bugfix error handling at stream resources 2011-05-14 11:11:52 +00:00
uwe.tews@googlemail.com 86586e5af4 - bugfix fopen() error handling at stream resources 2011-05-14 10:18:10 +00:00
uwe.tews@googlemail.com 184557ed46 - bugfix condition starting with "-" did fail at {if} and {while} tags 2011-05-13 14:08:55 +00:00
uwe.tews@googlemail.com 6443a923cf - workaround for PHP 5.2.13 bug in method_exists() 2011-04-22 02:19:14 +00:00
uwe.tews@googlemail.com 44dc14891d - bugfix allow only fixed string as file attribute at {extends} tag 2011-04-21 23:11:24 +00:00
uwe.tews@googlemail.com d999a7bc5c - bugfix do not run filters and default modifier when displaying the debug template
- bugfix of embedded double quotes within multi line strings (""")
2011-04-01 08:41:57 +00:00
uwe.tews@googlemail.com 1757b274d6 - bugfix on error message in smarty_internal_compile_block.php
- bugfix mb handling in strip modifier
- bugfix for Smarty2 style registered compiler function on unnamed attribute passing like {tag $foo $bar}
2011-03-28 22:18:39 +00:00
uwe.tews@googlemail.com 6b0f3a6ede - bugfix on default {function} parameters when {function} was used in nocache sections
- bugfix on compiler object destruction. compiler_object property was by mistake unset.
2011-03-16 23:57:04 +00:00
uwe.tews@googlemail.com 91c2c9ae1d -bugfix a variable filter should run before modifers on an output tag (see change of 23/07/2010) 2011-03-09 13:26:34 +00:00
monte.ohrt 3e0c5e06b1 fixed config_load to only load defaults with no section defined 2011-03-08 16:14:38 +00:00
uwe.tews@googlemail.com 9d1b0abe5c - bugfix internal rendered_content must be cleared after subtemplate was included 2011-03-03 19:37:00 +00:00
monte.ohrt 78d4e1b2e5 do some updates to the text 2011-03-03 17:03:57 +00:00
uwe.tews@googlemail.com 05335415d4 - bugfix "smarty" template variable was not recreated when cached templated had expired 2011-03-03 16:15:31 +00:00
uwe.tews@googlemail.com fe26cf256e - 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 
         child name when it needed to compile
2011-03-01 19:47:44 +00:00
uwe.tews@googlemail.com e583777976 - bugfix for Smarty2 style compiler plugins on unnamed attribute passing like {tag $foo $bar} 2011-02-25 16:09:28 +00:00
uwe.tews@googlemail.com 34d5029469 - bugfix $smarty->clearCache('some.tpl') did by mistake cache the template object 2011-02-24 15:28:03 +00:00
uwe.tews@googlemail.com dea3e1f83e - bugfix force default debug.tpl to be loaded by the file resource when default_resource_type was modified 2011-02-19 00:20:45 +00:00
uwe.tews@googlemail.com 5b8a7e2ad9 - bugfix removed possible race condition when isCached() was called for an individually cached subtemplate 2011-02-18 17:33:38 +00:00
uwe.tews@googlemail.com 0e863c651d -improvement not to delete files starting with '.' from cache and template_c folders on clearCompiledTemplate() and clearCache() 2011-02-17 15:43:37 +00:00
uwe.tews@googlemail.com 5a6c3e6928 -improvement allow leading spaces on } tag closing if auto_literal is enabled 2011-02-16 16:45:27 +00:00
uwe.tews@googlemail.com e4e5418b46 -fixed typo in exception message of Smarty_Internal_Template 2011-02-16 14:20:23 +00:00
uwe.tews@googlemail.com 295c2ebd8e 2011-02-13 22:11:27 +00:00
uwe.tews@googlemail.com d38cb92059 - bufix replace $smarty->triggerError() by exception
- removed obsolete {popup_init..} plugin from demo templates
2011-02-13 22:04:58 +00:00
monte.ohrt be268fe3b0 remove popup_init from demo template 2011-02-13 13:37:27 +00:00
monte.ohrt 43f3581591 update change log with version tag 2011-02-11 22:52:27 +00:00
monte.ohrt f9ce2d8c7e fix typos, rewording 2011-02-11 22:21:17 +00:00
uwe.tews@googlemail.com 0154f17de2 - bugfix removed security hole when using {$smarty.template} 2011-02-09 17:50:05 +00:00
uwe.tews@googlemail.com 5c8541eae3 - removed assert() from config and template parser 2011-02-01 12:51:01 +00:00
uwe.tews@googlemail.com 0860e69018 - bugfix the lexer/parser did fail on special characters like VT 2011-01-31 14:15:12 +00:00
monte.ohrt af19a07bf3 flip test for ctype_digit, speed up 2011-01-19 15:13:27 +00:00
monte.ohrt 2d75fb0098 avoid preg for string match 2011-01-17 21:49:19 +00:00
uwe.tews@googlemail.com d494d0db22 -bugfix of Iterator object handling in internal _count() method 2011-01-16 16:22:58 +00:00
uwe.tews@googlemail.com 7dfb27d322 -bugfix of ArrayAccess object handling in internal _count() method 2011-01-16 15:28:43 +00:00
uwe.tews@googlemail.com cfd81bafba fix memory leak 2011-01-14 21:51:08 +00:00
uwe.tews@googlemail.com d8f8e417f4 - remove possible warning 2011-01-14 20:40:42 +00:00
uwe.tews@googlemail.com 9ef3c770ef -bugfix removed memory leak while processing compileAllTemplates 2011-01-14 18:39:16 +00:00
uwe.tews@googlemail.com 7d48680bd5 - bugfix in {if} and {while} tag compiler when using assignments as condition and nocache mode 2011-01-12 21:33:26 +00:00
uwe.tews@googlemail.com 65e823610d - bugfix when using {$smarty.block.child} and name of {block} was in double quoted string
- bugfix updateParentVariables() was called twice when leaving {include} processing
2011-01-10 17:10:35 +00:00
monte.ohrt eba1d212f2 remove overlib plugins - no longer supported 2011-01-04 16:15:04 +00:00
monte.ohrt d0b232e264 fix mb_str_replace to work with utf8 2011-01-03 23:19:22 +00:00
uwe.tews@googlemail.com 9630a99a82 - bugfix dynamic configuration of $debugging_crtl did not work
- bugfix default value of $config_read_hidden changed to false
- bugfix format of attribute array on compiler plugins
- bugfix getTemplateVars() could return value from wrong scope
2010-12-31 13:47:12 +00:00
uwe.tews@googlemail.com 015f817259 - bugfix multiple {append} tags failed to compile. 2010-12-28 22:40:13 +00:00
uwe.tews@googlemail.com 9f3758ace1 do not clone Smarty object on internal createTemplate() calls 2010-12-22 16:35:39 +00:00
monte.ohrt c0b6f29077 update html_options to support class and id attrs 2010-12-21 15:59:25 +00:00
uwe.tews@googlemail.com b9477b0deb - bugfix added missing support of $cache_attrs for registered plugins 2010-12-17 21:05:29 +00:00
uwe.tews@googlemail.com 6d897f0d59 - bugfix assigment as condition in {while} did drop an E_NOTICE 2010-12-15 09:08:35 +00:00
uwe.tews@googlemail.com 2918615377 - bugfix when passing an array as default parameter at {function} tag 2010-12-14 03:55:31 +00:00
uwe.tews@googlemail.com f0c95ab79c - bugfix {$smarty.template} in child template did not return right content
- bugfix Smarty3 did not search the PHP include_path for template files
2010-12-13 22:05:27 +00:00
monte.ohrt 73bd60cad5 update changelog 2010-12-13 15:56:49 +00:00
uwe.tews@googlemail.com 5999777341 - bugfix fixed typo regarding yesterdays change to allow streamWrapper 2010-12-12 12:45:52 +00:00
uwe.tews@googlemail.com b8b68d7edf - bugfix changed code when writing temporary compiled files to allow stream_wrapper 2010-12-11 13:55:06 +00:00
uwe.tews@googlemail.com cf50ede71a - bugfix nested block tags in template inheritance child templates did not work correctly
- bugfix {$smarty.current_dir} in child template did not point to dir of child template
2010-12-11 13:27:14 +00:00
uwe.tews@googlemail.com ea37403f01 - bugfix getTemplateVars() should return 'null' instead dropping E_NOTICE on an unassigned variable 2010-12-06 19:00:50 +00:00
uwe.tews@googlemail.com 6ddcf3819a - bugfix empty($foo) in {if} did drop a notice when $foo was not assigned 2010-12-05 22:15:23 +00:00
uwe.tews@googlemail.com 5522850591 - bugfix missing declaration of $smarty in Smarty class 2010-12-05 17:21:02 +00:00
uwe.tews@googlemail.com 5139a6fcd1 - other update regarding {debug} 2010-12-01 23:34:06 +00:00
uwe.tews@googlemail.com 176c3d625c - improvement of {debug} tag output 2010-12-01 21:19:20 +00:00
uwe.tews@googlemail.com e80dd75958 -change run output filter before cache file is written (as in Smarty2) 2010-11-27 15:05:38 +00:00
uwe.tews@googlemail.com 2e1c83f44d -bugfix on parser at !$foo|modifier
-change parser logic when assignments used as condition in {if] and {while} to allow assign to array element
2010-11-24 19:38:45 +00:00
uwe.tews@googlemail.com c08664e75e -bugfix allow integer as attribute name in plugin calls
-change  trimm whitespace from error message, removed long list of expected tokens
2010-11-23 23:36:16 +00:00
uwe.tews@googlemail.com c0130d5d34 - added error message for illegal variable file attributes at {extends...} tags 2010-11-22 22:03:47 +00:00
uwe.tews@googlemail.com 1153ea5a5a - bugfix on template inheritance when an {extends} tag was inserted by a prefilter 2010-11-22 19:43:11 +00:00
uwe.tews@googlemail.com f14de1689c update changelog 2010-11-21 03:12:26 +00:00
monte.ohrt abf779f91b update README for 3.0.5wq 2010-11-21 02:58:39 +00:00
uwe.tews@googlemail.com 8e4cd21b3d revert change of 19/11/2010 - bugfix on template inheritance. prefilter did not run over child blocks
It was no error
2010-11-20 15:24:32 +00:00
uwe.tews@googlemail.com 1c9f015135 - bugfix on block plugins with modifiers
- bugfix on template inheritance. prefilter did not run over child blocks
2010-11-20 00:00:24 +00:00
uwe.tews@googlemail.com eddb301947 - change on handling of unassigned template variable -- default will drop E_NOTICE
- bugfix on Smarty2 wrapper load_filter() did not work
2010-11-18 18:58:53 +00:00
uwe.tews@googlemail.com 6b9921baae 2010-11-18 00:18:57 +00:00
uwe.tews@googlemail.com dd332db455 -bugfix in function.fetch.php, reference to undefined $smarty 2010-11-17 23:15:12 +00:00
uwe.tews@googlemail.com f49ac309b9 - bugfix on {block} if name did contain '-' 2010-11-17 19:07:59 +00:00
uwe.tews@googlemail.com 6d4b6accfd - bugfix on {call} with variable function name 2010-11-17 17:21:27 +00:00
uwe.tews@googlemail.com a2d99d41b1 - bugfix on default parameter for {function} 2010-11-16 23:16:34 +00:00
uwe.tews@googlemail.com db8867cd88 - bugfix whitespace in front of "<?php" in smarty_internal_compile_private_block_plugin.php
- bugfix {$smarty.now} did compile incorrectly
- bugfix on reset(),end(),next(),prev(),current() within tempaltes
2010-11-16 21:06:46 +00:00
uwe.tews@googlemail.com ef85c9f2ad - bugfix captured content could not be accessed globally
- bugfix Smarty2 wrapper functions could not be call from within plugins
2010-11-15 22:54:59 +00:00
uwe.tews@googlemail.com 21ed644f82 - bugfix when using {$smarty.session} as object
- bugfix scoping problem on $smarty object passed to filters
2010-11-15 19:17:18 +00:00
uwe.tews@googlemail.com d2cafef753 - small performace patch in Smarty class 2010-11-14 18:46:18 +00:00
uwe.tews@googlemail.com 7135787127 - bugfix isset() did not allow multiple parameter
- improvment of some error messages
- bugfix html_image did use removed property $request_use_auto_globals
2010-11-14 15:08:44 +00:00
uwe.tews@googlemail.com 6ff5c28343 - bugfix overloading problem when $smarty->fetch()/display() have been used in plugins 2010-11-13 18:32:50 +00:00
uwe.tews@googlemail.com 5d278ce5ad - code cleanup 2010-11-13 17:48:30 +00:00
uwe.tews@googlemail.com 7dc5c0a09d - bugix overloading problem when $smarty->fetch()/display() have been used in plugins (introduced with 3.0.2) 2010-11-13 15:26:03 +00:00
uwe.tews@googlemail.com fb29ed63ed - improvement remove last linebreak from {function} definition 2010-11-13 11:16:01 +00:00
uwe.tews@googlemail.com 1f0c08ce3f - fixed internal_config (removed unwanted code line) 2010-11-13 05:06:58 +00:00
uwe.tews@googlemail.com fe63ad36b8 - reverted location of loadPlugin() to Smarty class
- fixed comments in plugins
2010-11-13 04:10:52 +00:00
uwe.tews@googlemail.com 3c04e4ff37 - bugfix on {debug} 2010-11-13 01:53:38 +00:00
uwe.tews@googlemail.com 626b95dfb4 2010-11-12 23:43:02 +00:00
uwe.tews@googlemail.com 5e21770fe5 - 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 
  with transparent access to Smarty object
- fixed {config_load} scoping form compile time to run time
2010-11-12 23:42:32 +00:00
monte.ohrt 86afd1b42a update version in README 2010-11-12 15:02:15 +00:00
uwe.tews@googlemail.com 6401833933 - reactivated $error_reporting property handling 2010-11-12 14:53:49 +00:00
monte.ohrt bafcf67f81 update license 2010-11-12 01:44:30 +00:00
monte.ohrt 5abe3d5c62 finish commit, resolve conflict 2010-11-12 01:38:08 +00:00
monte.ohrt 0d1cebad79 update README
2010-11-11 21:54:26 +00:00
monte.ohrt 6cd1b88fbe update README 2010-11-11 21:49:04 +00:00
uwe.tews@googlemail.com f044178bad - major update including some API changes 2010-11-11 21:34:36 +00:00
uwe.tews@googlemail.com 93686c695d 2010-11-10 17:02:48 +00:00
uwe.tews@googlemail.com 8497415888 - observe compile_id also for config files 2010-11-10 16:46:57 +00:00
uwe.tews@googlemail.com 87ec00f518 -bugfix on complex expressions as start value for {for} tag 2010-11-09 20:35:47 +00:00
uwe.tews@googlemail.com 7af4fc7521 - bugfix do not allow access of dynamic and private object members of assigned objects when security is enabled. 2010-11-04 15:53:28 +00:00
uwe.tews@googlemail.com c7e7f5b3b2 - bugfix related to E_NOTICE change. {if empty($foo)} did fail when $foo contained a string 2010-11-01 17:23:28 +00:00
uwe.tews@googlemail.com 0acba360d3 - bugfix on compiling modifiers within $smarty special vars like {$smarty.post.{$foo|lower}} 2010-10-28 20:11:01 +00:00
uwe.tews@googlemail.com ecd1793bdf - bugfix default parameter values did not work for template functions included with {include} 2010-10-27 16:42:01 +00:00
uwe.tews@googlemail.com 5176f39583 - bugfix for E_NOTICE change, array elements did not work as modifier parameter 2010-10-25 18:53:43 +00:00
uwe.tews@googlemail.com ce7a278f44 - bugfix for the E_NOTICE change 2010-10-20 18:28:04 +00:00
uwe.tews@googlemail.com be02af7246 - change Smarty does no longer mask out E_NOTICE by default during template processing 2010-10-19 16:06:52 +00:00
uwe.tews@googlemail.com 147c5d0631 - bugfix on output buffer handling in isCached() method 2010-10-13 23:22:57 +00:00
uwe.tews@googlemail.com cf42bcd242 - bugfix on template inheritance using nested eval or string resource in {extends} tags 2010-10-13 20:26:12 +00:00
uwe.tews@googlemail.com 7ec3cb453c - bugfix removed ambiguity between ternary and stream variable in template syntax
- bugfix use caching properties of template instead of smarty object when compiling child {block}
- bugfix {*block}...{/block*} did throw an exception in template inheritance
2010-10-13 15:44:03 +00:00
uwe.tews@googlemail.com 415d2f43e2 - added {break} and {continue} tags for flow control of {foreach},{section},{for} and {while} loops
- change of 'string' resource. It's no longer evaluated and compiled files are now stored
- new 'eval' resource which evaluates a template without saving the compiled file
- change in isCached() method to allow multiple calls for the same template
2010-10-01 13:19:53 +00:00
uwe.tews@googlemail.com dde2219004 - bugfix on some compiling modifiers 2010-09-25 13:31:57 +00:00
uwe.tews@googlemail.com 802d40f3d3 - bugfix merge_compiled_includes flag was not restored correctly in {block} tag 2010-09-24 12:13:19 +00:00
uwe.tews@googlemail.com e8ab747a60 - bugfix on default modifier 2010-09-22 13:06:47 +00:00
uwe.tews@googlemail.com b38e46db46 - bugfix untility compileAllConfig() did not create sha1 code for compiled template file names if template_dir was defined with no trailing DS
- bugfix on templateExists() for extends resource
2010-09-18 14:57:02 +00:00
uwe.tews@googlemail.com 18bcfa2ba7 - bugfix {$smarty.template} and {$smarty.current_dir} did not compile correctly within {block} tags
- bugfix corrected error message on missing template files in extends resource
- bugfix untility compileAllTemplates() did not create sha1 code for compiled template file names if template_dir was defined with no trailing DS
2010-09-17 18:10:10 +00:00
uwe.tews@googlemail.com 66752cd790 - bugfix when a doublequoted modifier parameter did contain Smarty tags and ':' 2010-09-16 16:29:44 +00:00
uwe.tews@googlemail.com 44c6732970 15/09/2010
- bugfix resolving conflict between '<%'/'%>' as custom Smarty delimiter and ASP tags
- use ucfirst for resource name on internal resource class names
2010-09-15 15:17:28 +00:00
uwe.tews@googlemail.com 4556f7d370 - bugfix for change of 08/09/2010 (final {block} tags in subtemplates did not produce correct results) 2010-09-12 17:46:04 +00:00
uwe.tews@googlemail.com 255c271246 - bugfix for change of 08/09/2010 (final {block} tags in subtemplates did not produce correct results) 2010-09-10 11:15:15 +00:00
Uwe.Tews 550a416209 - allow multiple template inheritance branches starting in subtemplates 2010-09-08 17:40:00 +00:00
Uwe.Tews a2f50cebd4 - bugfix {counter} and {cycle} plugin assigned result to smarty variable not in local(template) scope
- bugfix templates containing just {strip} {/strip} tags did produce an error
2010-09-07 16:24:34 +00:00
Uwe.Tews 96e3d9937a - fixed E_STRICT errors for uninitialized variables 2010-08-23 14:40:10 +00:00
Uwe.Tews ee15e53542 - added attribute cache_id to {include} tag 2010-08-22 12:15:51 +00:00
monte.ohrt 21d507a5cb fix formatting 2010-08-17 15:39:51 +00:00
Uwe.Tews ad921936b0 - remove exception_handler property from Smarty class
- added Smarty's own exceptions SmartyException and SmartyCompilerException
2010-08-13 10:39:51 +00:00
Uwe.Tews cbc4205669 - bugfix on modifier with doublequoted strings as parameter containing embedded tags 2010-08-09 14:28:28 +00:00
Uwe.Tews 85450515d9 2010-08-06 15:34:18 +00:00
Uwe.Tews a8cb6c737f 2010-08-06 14:38:33 +00:00
Uwe.Tews cf231447d2 - bugfix when cascading some modifier like |strip|strip_tags modifier 2010-08-06 13:43:52 +00:00
Uwe.Tews 09dfffd2a0 - bugfix in nocache sections {include} must not cache the subtemplate 2010-08-05 21:13:29 +00:00
Uwe.Tews 08874b0965 - added plugin type modifiercompiler to produce compiled modifier code
- changed standard modifier plugins to the compiling versions whenever possible
2010-08-05 17:50:16 +00:00
Uwe.Tews 254c9e6c53 - bugfix strip did not work correctly in conjunction with comment lines 2010-08-02 16:29:23 +00:00
Uwe.Tews e8fbee624d - bugfix on nocache attribute at {assign} and {append} 2010-07-31 13:29:59 +00:00
Uwe.Tews b52cbe9adb - bugfix passing scope attributes in doublequoted strings did not work at {include} {assign} and {append} 2010-07-30 13:09:52 +00:00
Uwe.Tews 7c7d65eb32 2010-07-25 11:42:46 +00:00
Uwe.Tews b7b2e7c4be - another bugfix of change from 23/07/2010 when compiling modifer 2010-07-25 10:58:54 +00:00
Uwe.Tews a09ed74a10 2010-07-24 23:44:21 +00:00
Uwe.Tews 8598eca6bc 2010-07-24 23:34:19 +00:00
Uwe.Tews 8e8feb3945 - bugfix of change from 23/07/2010 when compiling modifer 2010-07-24 21:58:16 +00:00
Uwe.Tews 6ae00435af - changed execution order. A variable filter does now run before modifiers on output of variables
- bugfix use always { and } as delimiter for debug.tpl
2010-07-23 12:53:04 +00:00
Uwe.Tews f319a15cfc - bugfix in templateExists() method 2010-07-22 19:11:38 +00:00
Uwe.Tews ff7fce9bca - fixed handling of { strip } tag with whitespaces 2010-07-20 16:19:54 +00:00
Uwe.Tews c4a824bf2c - bufix {$smarty.template} does include now the relative path, not just filename 2010-07-15 14:08:56 +00:00
Uwe.Tews f6b98d0d7f 2010-07-14 23:15:20 +00:00
Uwe.Tews c1e1c03892 - make the date_format modifier work also on objects of the DateTime class
- implementation of parsetrees in the parser to close security holes and remove unwanted empty line in HTML output
2010-07-14 22:47:37 +00:00
monte.ohrt 50637fccdd add DateTime support, clean up some logic 2010-07-13 22:57:47 +00:00
Uwe.Tews db38a0aaec - bugfix on assigning multidimensional arrays within templates
- corrected bugfix for truncate modifier
2010-07-08 18:30:03 +00:00
Uwe.Tews 396d7aa8a5 - bugfix support of script files relative to trusted_dir 2010-07-07 22:08:10 +00:00
Uwe.Tews c8f22fe247 - bugfix the truncate modifier needs to check if the string is utf-8 encoded or not 2010-07-07 16:34:06 +00:00
Uwe.Tews c83ef6792c - create exception on recursive {extends} calls
- fixed reported line number at "unexpected closing tag " exception
- bugfix on escape:'mail' modifier
- drop exception if 'item' variable is equal 'from' variable in {foreach} tag
2010-07-06 20:00:41 +00:00
Uwe.Tews cbe2f3356f - removed call_user_func_array calls for optimization of compiled code when using registered modifiers and plugins
- updated comments
2010-07-01 19:57:56 +00:00
Uwe.Tews 6456403706 - bugfix escaping " when block tags are used within doublequoted strings 2010-06-25 18:41:30 +00:00
Uwe.Tews ccc0e1b6c8 - added $smarty->register->templateClass() and $smarty->unregister->templateClass() methods for supporting static classes with namespace 2010-06-24 20:30:19 +00:00
Uwe.Tews f99e09f588 - replace internal get_time() calls with standard PHP5 microtime(true) calls in Smarty_Internal_Utility 2010-06-24 14:43:04 +00:00
Uwe.Tews 95869f258e - allow spaces between typecast and value in template syntax
- bugfix get correct count of traversables in {foreach} tag
2010-06-22 18:09:12 +00:00
Uwe.Tews f7fd63e890 - improved speed of cache->clear() when a compile_id was specified and use_sub_dirs is true 2010-06-21 20:10:22 +00:00
Uwe.Tews 7626cbf093 - removed use of PHP shortags SMARTY_PHP_PASSTHRU mode 2010-06-21 18:01:36 +00:00
Uwe.Tews 5a974e69cf 2010-06-20 21:16:18 +00:00
Uwe.Tews 1380199f43 - closed security hole when php.ini asp_tags = on 2010-06-20 20:37:16 +00:00
Uwe.Tews b534be00da - replace internal get_time() calls with standard PHP5 microtime(true) calls 2010-06-20 14:37:47 +00:00
Uwe.Tews 7cd84ed640 - added __toString method to the Smarty_Variable class 2010-06-18 15:10:35 +00:00
Uwe.Tews 6ba7d10ccd - make handling of Smarty comments followed by newline BC to Smarty2 2010-06-14 18:40:31 +00:00
Uwe.Tews 7075a1186d - bugfix Smarty3 did not handle hexadecimals like 0x0F as numerical value
- bugifx Smarty3 did not accept numerical constants like .1 or 2. (without a leading or trailing digit)
2010-06-13 12:52:36 +00:00
Uwe.Tews 538708d344 11/06/2010
- bugfix the lexer did fail on larger {literal} ... {/literal} sections
2010-06-11 13:01:36 +00:00
monte.ohrt 968deec9a4 remove newline on include tag 2010-06-10 18:58:26 +00:00
monte.ohrt c963a8342e fix assign_by_ref and append_by_ref BC compatability 2010-06-08 20:45:18 +00:00
Uwe.Tews cf2f6a33e1 - bugfix on calling template functions like Smarty tags 2010-06-03 14:33:51 +00:00
Uwe.Tews 62490ae8c0 - removed /* vim: set expandtab: */ comments
- bugfix of auto literal problem introduce with fix of 31/05/2010
2010-06-01 19:11:48 +00:00
Uwe.Tews c82455c145 - bugfix on template functions used with template inheritance 2010-06-01 17:10:39 +00:00
monte.ohrt 72d41f3b59 update @ syntax 2010-06-01 14:42:26 +00:00
Uwe.Tews 6ac2489ea5 - bugfix the parser did not allow some smarty variables with special name like $for, $if, $else and others. 2010-05-31 17:58:23 +00:00
Uwe.Tews 2ad1d7e102 - make scope of {counter} and {cycle} tags again global as in Smarty2 2010-05-27 19:56:39 +00:00
Uwe.Tews b889d66dd9 - bugfix on object chaining using variable properties 2010-05-27 15:59:40 +00:00
Uwe.Tews 8bf398e22c - bugfix removed decrepated register_resource call in smarty_internal_template.php 2010-05-26 20:35:15 +00:00
Uwe.Tews 063b8bf150 - rewrite of template function handling to improve speed
- bugfix on file dependency when merge_compiled_includes = true
2010-05-25 19:33:55 +00:00
Uwe.Tews eb12b18929 - bugfix when passing parameter with numeric name like {foo 1='bar' 2='blar'} 2010-05-16 20:12:14 +00:00
Uwe.Tews a15c0f85d1 14/05/2010
- bugfix compile new config files if compile_check and force_compile = false
- added variable static classes names to template syntax
2010-05-14 13:45:04 +00:00
Uwe.Tews 3197470ca5 - reverted the change 0f 30/04/2010. With the exception of forward references template functions can be again called by a standard tag. 2010-05-11 17:01:08 +00:00
Uwe.Tews 6e97a8a393 - bugfix make sure that the cache resource is loaded in all conditions when template methods getCached... are called externally 2010-05-11 16:24:24 +00:00
Uwe.Tews 2d1ce2f940 - bugfix on {foreach} and {for} optimizations of 27/04/2010 2010-05-10 20:08:24 +00:00
Uwe.Tews cf11940bf7 - update of template and config file parser because of minor parser generator bugs 2010-05-09 16:48:03 +00:00
Uwe.Tews 25ea3dd1de - bugfix on {insert} 2010-05-07 18:28:17 +00:00
Uwe.Tews d1986c6cff - bugfix on {insert} 2010-05-07 13:08:46 +00:00
Uwe.Tews 98753671e3 - bugfix when merging compiled templates and objects are passed as parameter of the {include} tag 2010-05-06 17:59:31 +00:00
Uwe.Tews bf591a307b - bugfix on getTemplateVars method 2010-05-06 00:32:10 +00:00
Uwe.Tews 2e8b7c864d - implementation of $smarty->default_modifiers as in Smarty2 2010-05-06 00:11:30 +00:00
Uwe.Tews df1ddc31fc - bugfix on {insert} to cache parameter 2010-05-05 19:48:42 +00:00
Uwe.Tews e71c82ff1d - bugfix on handling of variable method names at object chaning 2010-05-01 16:10:20 +00:00
Uwe.Tews ecf66837b5 - fix to make calling of template functions unambiguously by madatory usage of the {call} tag 2010-04-30 21:06:07 +00:00
Uwe.Tews 0920b383c6 - bugfix on template inheritance for tag names starting with "block"
- bugfix on {function} tag with name attribute in doublequoted strings
2010-04-30 18:11:34 +00:00
Uwe.Tews ace9d4fe5e - work around of a substr_compare bug in older PHP5 versions 2010-04-30 14:04:03 +00:00
Uwe.Tews ea84147f45 - work around of a substr_compare bug in older PHP5 versions 2010-04-30 14:00:26 +00:00
Uwe.Tews 6bb0cb7c0c - bugfix when comparing timestamps in sysplugins/smarty_internal_config.php 2010-04-30 13:12:12 +00:00
Uwe.Tews d7a629df0c - change default of $debugging_ctrl to 'NONE'
- optimization of compiled code of {foreach} and {for} loops
- change of compiler for config variables
2010-04-28 20:30:27 +00:00
Uwe.Tews 4e27b70ba5 - bugfix in $smarty->cache->clear() method. (do not cache template object) 2010-04-27 17:47:24 +00:00
Uwe.Tews d44ffe9132 - security fix in {math} plugin 2010-04-17 10:24:44 +00:00
monte.ohrt 09c208eda6 revert lables on optgroup tags 2010-04-16 13:49:46 +00:00
monte.ohrt 4e8602585e remove label from option tag (unnecessary):wq 2010-04-12 19:04:02 +00:00
Uwe.Tews c8be3ed029 - removed parser restrictions in using true,false and null as ID 2010-04-12 18:22:53 +00:00
Uwe.Tews 5d644eb203 - bugfix in smarty_internal_templatecompilerbase (overloaded property) 2010-04-12 15:06:24 +00:00
Uwe.Tews 1eb8a44b0f - bugfix typo in smarty_internal_templatecompilerbase and smarty_internal_template 2010-04-07 15:19:02 +00:00
Uwe.Tews b14725e21a - bugfix typo in smarty_internal_templatecompilerbase 2010-04-07 15:10:34 +00:00
Uwe.Tews b52e9f1ac8 - compile locking by touching old compiled files to avoid concurrent compilations 2010-03-31 16:23:01 +00:00
Uwe.Tews 24d5ad78f3 - bugfix allow array definitions as modifier parameter
- bugfix observe compile_check property when loading config files
- added the template object as third filter parameter
2010-03-29 15:41:01 +00:00
Uwe.Tews 76f1bd5428 - new method utility->compileAllConfig() to compile all config files 2010-03-25 21:18:58 +00:00
Uwe.Tews c24dce9ed4 - change of utility->compileAllTemplates() log messages
- bugfix on nocache code in {function} tags
2010-03-25 20:43:56 +00:00
Uwe.Tews 8372ef8874 - bugfix on register->modifier() error messages 2010-03-24 11:23:18 +00:00
Uwe.Tews 63d671b935 - bugfix on caching mode SMARTY_CACHING_LIFETIME_SAVED and cache_lifetime = 0 2010-03-23 17:08:46 +00:00
Uwe.Tews 2e27c294b3 - bugfix on template inheritance when calling multiple child/parent relations 2010-03-23 16:51:48 +00:00
Uwe.Tews 7f64fdc593 - bugfix make directory separator operating system independend in compileAllTemplates() 2010-03-22 16:12:18 +00:00
monte.ohrt 56d054b743 fix testInstall() error messages 2010-03-22 14:48:46 +00:00
Uwe.Tews 97041ec7be - removed unused code in compileAllTemplates() 2010-03-21 14:18:17 +00:00
Uwe.Tews 6d2fb922e9 - bugfix for multiple {/block} tags on same line 2010-03-19 15:45:32 +00:00
Uwe.Tews d89e53c2f6 - bugfix make $smarty->cache->clear() function independent from caching status 2010-03-17 17:37:32 +00:00
Uwe.Tews eb4436e7be - bugfix on assign attribute at registered template objects
- make handling of modifiers on expression BC to Smarty2
2010-03-16 18:26:46 +00:00
Uwe.Tews c573ee9bf8 - bugfix on block plugin calls 2010-03-15 21:40:05 +00:00
Uwe.Tews 13089f2d64 - changed parsing of <?php and ?> back to Smarty2 behaviour 2010-03-11 22:26:46 +00:00
monte.ohrt cba54ad3d8 remove old API call 2010-03-10 16:21:16 +00:00
Uwe.Tews 5e2bf86e66 - bugfix on uninitialized properties in smarty_internal_template
- bugfix on $smarty->disableSecurity()
2010-03-09 21:11:21 +00:00
monte.ohrt 689ee2c73c fix overload error 2010-03-09 15:14:11 +00:00
Uwe.Tews 4b6590728e - README update regarding plugins 2010-03-08 18:06:54 +00:00
monte.ohrt 54a8dcd343 add __get() to templateCreate class 2010-03-08 16:20:19 +00:00
monte.ohrt 374d801d51 remove comment 2010-03-08 15:16:35 +00:00
monte.ohrt 05a9c3beab add setters/getters to created templates 2010-03-08 15:15:41 +00:00
Uwe.Tews d9e4646b60 - bugfix on accessing chained objects of static classes 2010-03-04 20:33:53 +00:00
Uwe.Tews a2a7942cea - bugfix allow uppercase chars in registered resource names 2010-03-04 15:49:48 +00:00
Uwe.Tews 5d9f7ab65b - bugfix on nocache code in {block} tags if child template was included by {include} 2010-03-01 16:46:30 +00:00
monte.ohrt 7300133dc6 move replacement func 2010-03-01 14:56:24 +00:00
monte.ohrt 0d3137b511 fix mb check 2010-03-01 14:52:01 +00:00
Uwe.Tews 1819689775 - bugfix on double quote strings 2010-02-28 13:51:57 +00:00
Uwe.Tews 428889e762 - code optimizations 2010-02-28 12:50:33 +00:00
Uwe.Tews ed2458e9ae - code optimization 2010-02-27 23:28:14 +00:00
Uwe.Tews 3898f593f4 - allow block tags inside double quoted string 2010-02-27 20:10:32 +00:00
Uwe.Tews a4d34aebce - support of access to a class constant from an object (since PHP 5.3) 2010-02-26 13:28:54 +00:00
Uwe.Tews 3059df16aa - cache modified check implemented 2010-02-26 12:58:36 +00:00
Uwe.Tews 0426dd0459 - bugfix on expressions in doublequoted string enclosed in backticks
- added security property $static_classes for static class security
2010-02-24 18:01:03 +00:00
monte.ohrt 7c9aed9299 remove debug code 2010-02-20 23:22:55 +00:00
monte.ohrt 591df13a26 fix __get() return value, and set properties before returning 2010-02-20 21:48:19 +00:00
Uwe.Tews f393874262 - bugfix on parsing Smarty tags inside <?xml ... ?>
- bugfix on truncate modifier
2010-02-18 16:28:11 +00:00
monte.ohrt c5b0288087 remove unnecessary param for preg 2010-02-18 14:45:27 +00:00
Uwe.Tews 950c3a7307 2010-02-17 21:30:36 +00:00
Uwe.Tews 44feb88c19 - bugfix on <?xml ... ?> tags for all php_handling modes
- bugfix on parameter of variablefilter.htmlspecialchars.php plugin
2010-02-16 20:20:49 +00:00
monte.ohrt c188b50ecc change ereg to preg 2010-02-16 15:20:47 +00:00
Uwe.Tews 239462fde4 - bugfix $smarty.const... inside doublequoted strings and backticks was compiled into wrong PHP code 2010-02-14 20:26:57 +00:00
Uwe.Tews 9afda44ebf - added missing _plugins property in smarty.class.php 2010-02-14 16:42:39 +00:00
Uwe.Tews 78c2e92f19 - bugfix on nested {block} tags
- changed Smarty special variable $smarty.parent to $smarty.block.parent
2010-02-12 15:56:17 +00:00
Uwe.Tews 99ab6e96a5 - added support of nested {bock} tags 2010-02-12 01:14:34 +00:00
Uwe.Tews cb0ba1908a - allow Smarty tags inside <? ... ?> tags in SMARTY_PHP_QUOTE and SMARTY_PHP_PASSTHRU mode
- bugfix at new "for" syntax like {for $x=1 to 10 step 2}
2010-02-10 20:51:36 +00:00
Uwe.Tews 9f5d885835 - avoid possible notice on $smarty->cache->clear(...), $smarty->clear_cache(....) 2010-02-10 18:00:41 +00:00
Uwe.Tews 43ae585e5e - added $smarty->_tag_stack for tracing block tag hierarchy 2010-02-09 21:20:17 +00:00
Uwe.Tews 24141e81dd - bugfix use template fullpath at §smarty->cache->clear(...), $smarty->clear_cache(....) 2010-02-08 21:04:43 +00:00
monte.ohrt c2ff808db6 update README 2010-02-08 17:49:26 +00:00
monte.ohrt fbebb5bb02 update wrapper 2010-02-08 17:41:48 +00:00
Uwe.Tews b48ef33cd5 - bugfix of cache filename on extended templates when force_compile=true 2010-02-08 17:39:48 +00:00
monte.ohrt 0c2b18c727 move getTemplateVars() into data object 2010-02-08 17:31:15 +00:00
monte.ohrt 5be6130f0c update API list 2010-02-08 17:08:09 +00:00
Uwe.Tews 7bfa54f067 - bugfix on changes of 05/02/2010 2010-02-07 22:21:37 +00:00
Uwe.Tews d19fbb19d9 - bugfix on changes of 05/02/2010 2010-02-07 20:45:44 +00:00
Uwe.Tews 063cb19f18 - preserve line endings type form template source 2010-02-07 12:49:57 +00:00
Uwe.Tews ae49fe099b - minor fixes on API update 2010-02-07 11:09:28 +00:00
monte.ohrt 8f8a11f733 add new files 2010-02-07 03:03:48 +00:00
monte.ohrt 9af377d7d3 major API update 2010-02-06 22:11:10 +00:00
Uwe.Tews 3ad446bb21 - bugfix on modifier and block plugins with same name 2010-02-05 17:03:22 +00:00
Uwe.Tews fde7a592f4 - retaining newlines at registered functions and function plugins 2010-02-02 20:09:57 +00:00
Uwe.Tews 3c88d12e00 - added test that $_SERVER['SCRIPT_NAME'] does exist in Smarty.class.php 2010-01-25 19:02:34 +00:00
Uwe.Tews 8defafbb14 - bugfix cache resource was not loaded when caching was globally off but enabled at a template object 2010-01-25 18:10:35 +00:00
Uwe.Tews e89c15d65d - new method $smarty->createData([$parent]) for creating a data object (required for bugfixes below)
- bugfix config_load() method now works also on a data object
- bugfix get_config_vars() method now works also on a data and template objects
- bugfix clear_config() method now works also on a data and template objects
2010-01-22 16:39:30 +00:00
Uwe.Tews cfea085629 - bugfix on plugins if same plugin was called from a nocache section first and later from a cached section 2010-01-19 17:01:10 +00:00
Uwe.Tews 2c570f25b9 - bugfix on $smarty.const... in double quoted strings 2010-01-17 15:52:37 +00:00
Uwe.Tews f11e4e40bc - internal change of config file lexer/parser on handling of section names
- bugfix on registered objects (format parameter of register_object was not handled correctly)
2010-01-16 12:03:53 +00:00
Uwe.Tews da2f22438c - allow special characters in config file section names for Smarty2 BC 2010-01-14 22:05:32 +00:00
Uwe.Tews 383e4bb4ae - revert handling of newline on no output tags like {if...} 2010-01-14 20:57:27 +00:00
Uwe.Tews 13444e9781 - bugfix on special Smarty variable $smarty.cookies 2010-01-14 19:12:14 +00:00
Uwe.Tews db2c655322 - bugfix allow absolute filepath for config files 2010-01-14 16:43:43 +00:00
Uwe.Tews ecfc492298 - bugfix on backslash within single quoted strings 2010-01-14 15:57:09 +00:00
Uwe.Tews 19c0e47495 - bugfix on {if} tags 2010-01-13 15:33:54 +00:00
Uwe.Tews 51ed5b7861 - closed possible security hole at <?php ... ?> tags
- bugfix of config file parser on large config files
2010-01-12 22:12:19 +00:00
Uwe.Tews db887adc37 - bugfix the {function..} tag did not accept the name attribute in double quotes 2010-01-12 20:37:05 +00:00
Uwe.Tews f83fd47acc - changed back modifer handling in parser. Some restrictions still apply:
if modifiers are used in side {if...} expression or in mathematical expressions 
    parentheses must be used.
2010-01-12 19:05:26 +00:00
Uwe.Tews aabc4352c2 - added optional nocache attribute to {block} tags in parent template
- updated <?php...?> handling supporting now heredocs and newdocs. (thanks to Thue Jnaus Kristensen)
2010-01-11 20:44:01 +00:00
Uwe.Tews e912e731bc - added missing support of insert plugins 2010-01-11 20:22:41 +00:00
Uwe.Tews cdd2aae582 - added \n to the compiled code of the {if},{else},{elseif},{/if} tags to get output of newlines as expected by the template source 2010-01-11 17:58:10 +00:00
Uwe.Tews 64503880b3 - added \n to the compiled code of the {/if} tag to get output of newlines as expected by the template source 2010-01-11 17:36:37 +00:00
Uwe.Tews a3459b2e3a - bugfix on nocache {block} tags in parent templates 2010-01-09 19:23:35 +00:00
Uwe.Tews 6c020763a8 - bugfix on variable filters. filter/nofilter attributes did not work on output statements 2010-01-08 15:54:21 +00:00
Uwe.Tews 17a8c7f0a2 - bugfix on file dependendcy at template inheritance
- bugfix on nocache code at template inheritance
2010-01-07 19:33:18 +00:00
Uwe.Tews 1227de42cc - bugfix for custom delimiter at extends resource and {extends} tag 2010-01-06 18:48:50 +00:00
Uwe.Tews ceb4cb75c7 - bugfix for custom delimiter at extends resource and {extends} tag 2010-01-06 17:31:59 +00:00
Uwe.Tews 57fd94ddb1 - fixed typo in smarty_internal_resource_registered 2010-01-06 15:52:33 +00:00
Uwe.Tews d287c6b1d9 - bugfix sha1() calculations at extends resource and some general improvments on sha1() handling 2010-01-05 21:10:25 +00:00
Uwe.Tews a6c2f5f8d4 - internal change on building cache files 2010-01-03 11:53:28 +00:00
Uwe.Tews 4519218f04 - update cached_timestamp at the template object after cache file is written to avoid possible side effects
- use internally always SMARTY_CACHING_LIFETIME_* constants
2010-01-02 12:15:04 +00:00
Uwe.Tews b5ff9e450f - bugfix for {php} tag (trow an exception if allow_php_tag = false) 2010-01-01 20:19:26 +00:00
Uwe.Tews 8c93e0765a - bugfix for obtaining plugins which must be included (related to change of 12/30/2009) 2010-01-01 12:07:36 +00:00
Uwe.Tews 72219be200 - optimization of generated code for doublequoted strings containing variables
- rewrite of {function} tag handling
  - can now be declared in an external subtemplate
  - can contain nocache sections (nocache_hash handling)
  - can be called in noccache sections (nocache_hash handling)
  - new {call..} tag to call template functions with a variable name {call name=$foo}
- fixed nocache_hash handling in merged compiled templates
2009-12-31 16:38:12 +00:00
Uwe.Tews a6c4c0b192 - bugfix for plugins defined in the script as smarty_function_foo 2009-12-30 14:26:42 +00:00
Uwe.Tews 67641b63e8 - fixed cache filename for custom resources 2009-12-29 23:46:31 +00:00
Uwe.Tews 7a8e24cfc1 - internal change on merging some data 2009-12-29 22:27:04 +00:00
Uwe.Tews 8327f57f36 2009-12-29 20:12:51 +00:00
Uwe.Tews d1969d6f56 - use sha1() for filepath encoding
- updates on nocache_hash handling
2009-12-29 20:12:11 +00:00
Uwe.Tews 589f736efa - fixed bug loading modifiers in child template at template inheritance 2009-12-28 20:46:31 +00:00
monte.ohrt 5d6b87d9a1 replace md5 with str_replace 2009-12-28 17:41:27 +00:00
Uwe.Tews 8ad3fade36 - adding md5 to nocache_hash 2009-12-28 17:02:48 +00:00
Uwe.Tews de4957a151 - update for security fixes
- make modifier plugins always trusted
2009-12-28 15:27:13 +00:00
monte.ohrt f908aa0a27 update cache logic to use secure dynamic cache id 2009-12-28 05:08:45 +00:00
monte.ohrt 55d50efb1d set default cache lifetime to 3600, BC with Smarty 2 2009-12-28 03:22:57 +00:00
Uwe.Tews 997b8cd73f - fixed bug on modifier plugins at nocache output 2009-12-27 22:26:06 +00:00
Uwe.Tews 36da15cee8 - update of getCachedTimestamp() 2009-12-27 19:12:51 +00:00
Uwe.Tews 44dd7830dd --- this is a major update with a couple of internal changes ---
- new config file lexer/parser (thanks to Thue Jnaus Kristensen)
- template lexer/parser fixes for PHP and {literal} handing (thanks to Thue Jnaus Kristensen)
- fix on registered plugins with different type but same name
- rewrite of plugin handling (optimized execution speed)
- closed a security hole regarding PHP code injection into cache files
- fixed bug in clear cache handling
- Renamed a couple of internal classes
- code cleanup for merging compiled templates
- couple of runtime optimizations (still not all done)
2009-12-27 15:06:49 +00:00
Uwe.Tews 5f02276a2a - bugfix on comment lines in config files 2009-12-19 16:57:12 +00:00
Uwe.Tews 8f7a70de38 - bugfix on comment lines in config files 2009-12-19 12:36:15 +00:00
Uwe.Tews be04e0904c - fixed {strip} handling in auto literals 2009-12-17 20:39:11 +00:00
Uwe.Tews aaa7b8f245 - bugfix of parent/global variable update at included/merged subtemplates
- encode final template filepath into filename of compiled and cached files
2009-12-17 16:58:44 +00:00
Uwe.Tews 13448b9b0b - added {include file='foo.tpl' inline} inline option to merge compiled code of aubtemplate into the calling template 2009-12-16 17:05:31 +00:00
Uwe.Tews 5385475a5e - update of changelog 2009-12-16 16:27:06 +00:00
Uwe.Tews 8d5fab37e8 - bugfix on object as array index 2009-12-15 00:02:10 +00:00
Uwe.Tews 7406a7386a - allow !$foo as value 2009-12-13 20:21:54 +00:00
Uwe.Tews b2db17992b - bugfix on single quote inside {function} tag 2009-12-12 11:51:07 +00:00
Uwe.Tews c5f8ceb5e9 - fix short append/prepend attributes in {block} tags 2009-12-12 10:50:40 +00:00
Uwe.Tews 5219139f6b - bugfix on clear_compiled_tpl (avoid possible warning) 2009-12-11 14:26:57 +00:00
Uwe.Tews 048fd5e274 - bugfix on {function} tags and template inheritance 2009-12-10 17:23:32 +00:00
Uwe.Tews bec015821a - fixed documentation of extends resource 2009-12-06 12:25:19 +00:00
Uwe.Tews 74a20f4650 - removed unneeded lexer code 2009-12-05 15:10:47 +00:00
Uwe.Tews 1723b98ce0 - fixed problem when a cached file was fetched several times 2009-12-05 13:38:09 +00:00
monte.ohrt cd5cc650d8 add automagic formatting for date() and strftime() 2009-12-05 05:30:20 +00:00
Uwe.Tews 85c8676988 - added file SMARTY2_BC_NOTES 2009-12-04 16:37:31 +00:00
Uwe.Tews 7e6da87134 - added max attribute to for loop
- added security mode allow_super_globals
2009-12-04 15:44:47 +00:00
Uwe.Tews 19413d8dab - bugfix for {$foo.$x.$y.$z} 2009-12-04 00:18:54 +00:00
Uwe.Tews 9ee61377fa - README 2009-12-03 22:50:05 +00:00
Uwe.Tews 1573bf813c - added {for $foo = 1 to 5 step 2} syntax 2009-12-03 22:39:45 +00:00
Uwe.Tews 91da0aa7fe - template inheritance: child templates can now call functions defined by the {function} tag in the parent template 2009-12-03 19:49:17 +00:00
Uwe.Tews 2c23dccf3b - use $template_class property for template class name when compiling {include},{eval} and {extends} tags 2009-12-01 22:24:31 +00:00
Uwe.Tews 7e45bcf527 - replaced most hard errors (exceptions) by softerrors(trigger_error) in plugins 2009-12-01 20:34:32 +00:00
Uwe.Tews e5cd6c8a17 - removed cache resource plugin for mysql from the distribution 2009-12-01 19:36:58 +00:00
Uwe.Tews a8a17d09e9 - fixed parsing of names of special formated tags like if,elseif,while,for,foreach
- removed direct access to constants in templates because of some syntax problems
2009-12-01 17:08:54 +00:00
Uwe.Tews 4c4ce1e5bf - update of comment 2009-11-30 21:20:09 +00:00
Uwe.Tews 89e53f6372 - allow {function} tags within {block} tags 2009-11-30 19:56:17 +00:00
Uwe.Tews 319f0c88fb - map 'true' to SMARTY_CACHING_LIFETIME_CURRENT for the $smarty->caching parameter 2009-11-30 17:52:13 +00:00
Uwe.Tews 732ab27055 - ignore compile_id at debug template
- added direct access to constants in templates
- some lexer/parser optimizations
2009-11-28 18:48:02 +00:00
Uwe.Tews 9f18a6bf62 - added comment with MYSQL create table command 2009-11-27 21:06:17 +00:00
Uwe.Tews 27d3a21fb4 - added cache resource MYSQL plugin 2009-11-27 20:46:56 +00:00
Uwe.Tews 255eec00ae - bugfix double quoted string 2009-11-27 00:43:38 +00:00
Uwe.Tews be47f5773e - fix on checking dynamic varibales with error_unassigned = true 2009-11-26 23:36:30 +00:00
Uwe.Tews 25270df6bd - correct line number on unknown tag error message
- changed {include} compiled code
2009-11-26 22:49:56 +00:00
Uwe.Tews f3f01b928a 2009-11-26 21:08:45 +00:00
Uwe.Tews 4afab27bd8 - {strip} tag functionality rewritten 2009-11-25 20:56:51 +00:00
Uwe.Tews f94acef2cc - allow null, NULL, Null 2009-11-25 16:44:02 +00:00
Uwe.Tews e80531444b - allow the following writing for boolean: true, TRUE, True, false, FALSE, False 2009-11-25 16:27:06 +00:00
Uwe.Tews 2bab2f147d - bugfix for $smarty->config_overwrite = false 2009-11-24 20:33:40 +00:00
Uwe.Tews 4925a98949 - suppress warnings on unlink caused by race conditions
- correct line number on unknown tag error message
2009-11-23 22:31:22 +00:00
Uwe.Tews 963b13b0af - fixed configfile parser for text starting with a numeric char
- the default_template_handler_func may now return a filepath to a template source
2009-11-23 16:05:30 +00:00
Uwe.Tews 631e3023cc - bugfix for empty config files
- convert timestamps of registered resources to integer
2009-11-20 21:49:20 +00:00
Uwe.Tews cc4058c633 - compiled templates are no longer touched with the filemtime of template source 2009-11-19 14:45:04 +00:00
Uwe.Tews 6b506c4b40 - allow integer as attribute name in plugin calls 2009-11-18 21:51:20 +00:00
Uwe.Tews 4e98b48c7c - make $smarty->_current_file available during compilation for Smarty2 BC 2009-11-18 17:43:39 +00:00
Uwe.Tews 4286ad068b - observe umask settings when setting file permissions
- avoide unneeded cache file creation for subtemplates which did occur in some situations
2009-11-18 17:25:18 +00:00
Uwe.Tews e081d85b79 - bugfix cycle plugin 2009-11-17 20:17:51 +00:00
Uwe.Tews 1470251f18 - renamed extend tag and resource to extens: {extends file='foo.tol'} , $smarty->display('extends:foo.tpl|bar.tpl); 2009-11-17 19:03:06 +00:00
Uwe.Tews 724a31ce11 - added {foreach $array as $key=>$value} syntax 2009-11-17 18:09:29 +00:00
Uwe.Tews a63bc0f83b - sanitize compile_id and cache_id (replace illegal chars with _)
- use _dir_perms and _file_perms properties at file creation
- new constant SMARTY_RESOURCE_DATE_FORMAT (default '%b %e, %Y') which is used as default format in modifier date_format
2009-11-17 17:46:03 +00:00
monte.ohrt 72de1a7b33 fix delimiter setting 2009-11-17 01:31:44 +00:00
Uwe.Tews 9f505c1c23 - lexer/parser optimizations on quoted strings 2009-11-15 19:05:53 +00:00
Uwe.Tews 960fd1b3a9 - parser could run into a PHP error on wrong file attribute 2009-11-14 20:09:18 +00:00
Uwe.Tews 5b6050bf54 - fix on merging compiled templates with nocache sections in nocache includes 2009-11-14 16:20:18 +00:00
Uwe.Tews 6154717b48 - fixed locaion where outputfilters are running
- fixed config file definitions at EOF
2009-11-14 13:02:48 +00:00
Uwe.Tews d482a8b137 - bugfix modifiers on registered object tags 2009-11-14 10:40:08 +00:00
Uwe.Tews 2e70e88b0f - bugfix on merging compiled templates when source files got removed or renamed. 2009-11-14 10:08:27 +00:00
Uwe.Tews 39b25f8db8 - fix on nocache code in child {block} tags 2009-11-12 22:50:48 +00:00
Uwe.Tews da8e893358 2009-11-12 22:13:21 +00:00
Uwe.Tews e47a58fb6a - added description of template inheritance 2009-11-12 21:56:54 +00:00
Uwe.Tews f149804f3e - added scope to Smarty variables in the {block} tag compiler 2009-11-12 21:32:46 +00:00
Uwe.Tews 55b2d90fb8 - fixed variable filenames in {include_php} and {insert} 2009-11-12 17:20:42 +00:00
Uwe.Tews 7af23e23b6 - changed debugging handling 2009-11-11 22:09:06 +00:00
Uwe.Tews ad70b964cb - removed checking for reserved variables 2009-11-11 16:54:04 +00:00
Uwe.Tews ba6ba0cf8d - fixed {foreachelse}, {forelse}, {sectionelse} compiled code at nocache variables 2009-11-11 16:15:47 +00:00
Uwe.Tews d35746dd26 - fixed preg_qoute on delimiters 2009-11-10 16:04:32 +00:00
Uwe.Tews 60601acc25 2009-11-09 21:50:11 +00:00
Uwe.Tews 039d9044da 2009-11-09 21:22:28 +00:00
Uwe.Tews 6f7896c87b - bugfix for {function} block tags in included templates 2009-11-09 20:56:50 +00:00
Uwe.Tews 9f77baac25 - new SMARTY_SPL_AUTOLOAD constant to control the autoloader option 2009-11-09 17:26:59 +00:00
Uwe.Tews ff8c1050e4 - lexer/parser bugfix 2009-11-09 16:30:56 +00:00
Uwe.Tews 2e61999def - fixed alphanumeric array index 2009-11-08 21:01:22 +00:00
Uwe.Tews ce18a4cc15 - bugfix on complex double quoted strings 2009-11-08 16:17:51 +00:00
Uwe.Tews 6a9924162b - lexer/parser fix for null,true,false as array index 2009-11-06 17:40:20 +00:00
Uwe.Tews b7876e55ec - register only smartyAutoload 2009-11-06 16:51:46 +00:00
monte.ohrt 3386b94e15 change linefeed style to native on all files 2009-11-06 14:35:00 +00:00
Uwe.Tews 5c2b897534 - config_load method can now be called on data and template objects 2009-11-05 18:22:40 +00:00
Uwe.Tews db0767a71e - bugfix on complex indexed special Smarty variables 2009-11-04 17:54:00 +00:00
Uwe.Tews caac4bb841 - added typecasting support for template variables 2009-11-04 16:03:25 +00:00
Uwe.Tews 94b80e892b - renamed function names of autoloaded Smarty methods to Smarty_Method_....
- new security_class property (default is Smarty_Security)
2009-11-03 20:38:38 +00:00
Uwe.Tews 05c64b7748 - fixed file dependency for {incude} inside {block} tag
- fixed not compiling on non existing compiled templates when compile_check = false
2009-11-03 18:02:13 +00:00
monte.ohrt 4babb2e550 add smarty property, fix typo 2009-11-03 15:51:29 +00:00
monte.ohrt 23c4e77f14 fix typo 2009-11-03 15:46:22 +00:00
Uwe.Tews bbbb5e098e - fixed parser error on objects with special smarty vars 2009-11-03 15:23:18 +00:00
Uwe.Tews 67af69cbb1 - throw exception on illegal Smarty() constructor calls 2009-11-02 23:04:10 +00:00
Uwe.Tews 7409a9061d - remove last change for unquoted attribute values 2009-11-02 22:25:35 +00:00
monte.ohrt 182e40d4e9 remove tabs 2009-11-02 21:20:36 +00:00
monte.ohrt 469975c237 remove tabs 2009-11-02 21:19:57 +00:00
monte.ohrt 6eb95b0b30 update README 2009-11-02 21:14:10 +00:00
Uwe.Tews 15ee358dd7 - change on unquoted attribute values 2009-11-02 20:21:28 +00:00
Uwe.Tews 8d6607d410 - added neq,lte,gte,mod as aliases to if conditions 2009-11-02 17:49:57 +00:00
monte.ohrt b48f460a63 fix spl_autoload when autoloaders exist 2009-11-01 16:26:06 +00:00
Uwe.Tews cf379474fd - change of filenames in sysplugins folder for internal spl_autoload function
- lexer/parser changed for increased compilation speed
2009-10-31 00:44:58 +00:00
monte.ohrt 6efbb3ee58 fix typo 2009-10-29 14:02:21 +00:00
monte.ohrt 466805978c add SVN Id 2009-10-29 13:39:02 +00:00
monte.ohrt 1374718163 add $Rev$ to version number 2009-10-29 13:37:10 +00:00
Uwe.Tews 100d72ffbe - fixed missing quotes in include_php.php 2009-10-28 15:37:50 +00:00
Uwe.Tews fa9290135f - pass {} through as literal 2009-10-27 20:25:16 +00:00
Uwe.Tews 5584d80b98 - fixed typo in method.register_resource 2009-10-27 16:25:15 +00:00
Uwe.Tews eddbf62d03 - merge only compiled subtemplates into the compiled code of the main template 2009-10-26 20:36:26 +00:00
uwe.tews 6c7c18d79f - fixed merging of recursive includes 2009-10-24 09:27:53 +00:00
uwe.tews f88b868d5a - fixed nocache vars at internal block tags 2009-10-24 08:41:54 +00:00
uwe.tews 4914c90e9a - fixed nocache var problem 2009-10-23 16:49:21 +00:00
uwe.tews 8dd550f216 - fixed nocache var problem 2009-10-23 15:14:33 +00:00
uwe.tews 28f883ca8e - fixed nocache var problem 2009-10-22 23:05:14 +00:00
Uwe.Tews ecb5c84d5d - fix trimwhitespace outputfilter parameter 2009-10-22 13:08:43 +00:00
Uwe.Tews 60d1a30791 - fixed nocache variable inside if condition of {if} tag 2009-10-21 18:26:14 +00:00
Uwe.Tews 530c4bf108 - fixed function definitions on some autoloaded methods 2009-10-21 16:13:20 +00:00
Uwe.Tews 5fe16d23f0 - fixed file dependency for config files
- some code optimizations
2009-10-21 15:19:00 +00:00
Uwe.Tews 4a68612a5a - added {$foo++}{$foo--} syntax
- buxfix changed PHP "if (..):" to "if (..){" because of possible bad code when concenating PHP tags
- autoload Smarty internal classes
2009-10-21 09:49:43 +00:00
Uwe.Tews dc592e5a44 - check at compile time for variable filter to improve rendering speed if no filter is used
- fixed bug at combination of {elseif} tag and {...} in double quoted strings of static class parameter
2009-10-20 17:09:22 +00:00
Uwe.Tews fad5c12f3a - fixed compiled template merging on variable double quoted strings as name 2009-10-19 20:25:47 +00:00
Uwe.Tews 7189a3db28 - fixed bug in caching mode 2 and cache_lifetime -1 2009-10-19 18:32:35 +00:00
Uwe.Tews 88229447d1 - fixed modifier support on block tags 2009-10-19 14:36:57 +00:00
Uwe.Tews 5b554f80a4 new experimental version of compile_directory method 2009-10-17 14:40:02 +00:00
Uwe.Tews 72a04fe699 once again include template with variable name 2009-10-17 13:09:31 +00:00
Uwe.Tews cd321f4bd6 - problem with variable names of included templates 2009-10-17 12:11:00 +00:00
Uwe.Tews e73de1713b - bugfix on variable include filename 2009-10-17 10:41:12 +00:00
Uwe.Tews 402e3f4272 - remove ?>\n<?php and ?><?php sequences from compiled template 2009-10-17 03:36:47 +00:00
Uwe.Tews 81ebefccea experimental compile_directory method 2009-10-17 02:02:28 +00:00
Uwe.Tews b8837aecba - parser bugfix on array access 2009-10-16 16:54:25 +00:00
Uwe.Tews 395131c2d0 - buxfix on assigning array elements inside templates 2009-10-16 13:13:33 +00:00
Uwe.Tews 0fe0ad55c9 - allow bit operator '&' inside {if} tag
- implementation of ternary operator
2009-10-15 21:00:23 +00:00
Uwe.Tews fb29f74f3d added missing file 2009-10-15 13:51:41 +00:00
Uwe.Tews 5be5d4cf28 - do not recompile evaluated templates if reused just with other data
- recompile config files when config properties did change
- some lexer/parser otimizations
2009-10-13 19:44:38 +00:00
Uwe.Tews 526337aa23 - allow {block} tags inside included templates
- bugfix for resource plugins in Smarty2 format
- some optimizations of internal.template.php
2009-10-12 14:37:31 +00:00
Uwe.Tews 7afa8dce66 - fixed bug when template with same name is used with different data objects
- fixed bug with double quoted name attribute at {insert} tag
- reenabled assign_by_ref and append_by_ref methodes
2009-10-11 20:23:00 +00:00
Uwe.Tews 9eab32ff60 - removed block nesting checks for {capture} 2009-10-07 20:24:17 +00:00
Uwe.Tews 6869fa9a49 - bugfix on {insert} 2009-10-07 15:52:57 +00:00
Uwe.Tews e62d6baa2a - added support of "isinstance" to {if} tag
- bugfix in PHP resource
2009-10-05 18:55:22 +00:00
Uwe.Tews 585c115c94 - internal changes to improve performance
- fix registering of filters for classes
2009-10-04 18:12:30 +00:00
Uwe.Tews 9cc1533ac0 - update of README 2009-10-02 20:48:46 +00:00
Uwe.Tews 3c4b99ca34 -update of README 2009-10-02 15:30:32 +00:00
monte.ohrt c4b46fe7c8 update for beta 2009-10-02 14:43:55 +00:00
Uwe.Tews 84a1428bf7 - removed default timezone setting 2009-10-01 17:09:49 +00:00
Uwe.Tews c55e606278 - added missing file 2009-09-30 22:16:14 +00:00
Uwe.Tews b85d0ca2db - Update of README 2009-09-30 22:06:46 +00:00
Uwe.Tews 898819dd2b - reactivated PHP resource for simple PHP templates. Must set allow_php_templates = true to enable
- {PHP} tag can be enabled by allow_php_tag = true
2009-09-30 22:03:41 +00:00
Uwe.Tews 25d4535be6 - fixed handling of template_exits methode for all resource types 2009-09-30 18:28:50 +00:00
Uwe.Tews ed6df80a8f - bugfix for other cache resources than file 2009-09-30 16:00:11 +00:00
Uwe.Tews 26949347e2 - the methodes assign_by_ref is now wrapped to assign, append_by_ref to append
- allow arrays of variables pass in display, fetch and createTemplate calls
  $data = array('foo'=>'bar','foo2'=>'blar');
  $smarty->display('my.tpl',$data);
2009-09-29 22:58:54 +00:00
Uwe.Tews 8387d1ef6f - enabled short boolean attributes {some attr} equala {some attr=true} 2009-09-29 21:40:30 +00:00
Uwe.Tews 0fdcb79ec3 - allow $tpl->display(), $tpl->fetch(); and $tpl->is_cached() calls on template objects 2009-09-29 21:00:00 +00:00
Uwe.Tews 56e01e8a45 - allow Smarty2 and Smarty3 parameter ordering on display, fetch and create template 2009-09-29 20:36:29 +00:00
Uwe.Tews 3ab56b041e - bugfix on <?php ?> tags 2009-09-29 18:52:58 +00:00
Uwe.Tews 6a5f07a1ad - lexer fix for multiline <?php ...?> tags 2009-09-29 17:17:41 +00:00
Uwe.Tews 1af2723de9 - changed {php} tag handling
- removed support of Smarty::instance()
- removed support of PHP resource type
- improved execution speed of {foreach} tags
- fixed bug in {section} tag
2009-09-29 16:23:35 +00:00
Uwe.Tews 4faa5eff33 - reload of {section} tag fix 2009-09-27 17:58:33 +00:00
Uwe.Tews 97278555f7 - bugfix for {literal} tag inside comment 2009-09-26 23:06:57 +00:00
Uwe.Tews 441c1aa978 - update of $smarty->test() methode 2009-09-26 10:38:24 +00:00
Uwe.Tews d2aeb81188 - bugfix on {section} tag 2009-09-26 10:32:36 +00:00
Uwe.Tews 324276f7fa - improvements and bugfix on {include} tag handling
******************************************************************
NOTICE: existing compiled template and cache files must be deleted
******************************************************************
2009-09-23 16:50:16 +00:00
Uwe.Tews 5bf063d2cc - fixed error in is_cached 2009-09-20 02:02:44 +00:00
Uwe.Tews 0e68cdd9d2 - replace internal "eval()" calls by "include" during rendering process
- speed improvment for templates which have included subtemplates
    the compiled code of included templates is merged into the compiled code of the parent template
- added logical operator "xor" for {if} tag
- changed parameter ordering for Smarty2 BC
    fetch($template, $cache_id = null, $compile_id = null, $parent = null)
    display($template, $cache_id = null, $compile_id = null, $parent = null)
    createTemplate($template, $cache_id = null, $compile_id = null, $parent = null)
- property resource_char_set is now replaced by constant SMARTY_RESOURCE_CHAR_SET
- fixed handling of classes in registered blocks
- speed improvement of lexer on text sections
2009-09-19 13:22:32 +00:00
Uwe.Tews 1c30387c96 - update extend resource 2009-09-11 18:59:48 +00:00
Uwe.Tews b360c7cb5b - bugfix {extend} tag
- bugfix of automatic literals
2009-09-11 15:11:21 +00:00
Uwe.Tews 6c5c0a156e - bugfix for very large {block} tag content 2009-09-10 23:08:06 +00:00
Uwe.Tews 11a748a6e9 - removed var_dump 2009-09-08 18:58:15 +00:00
Uwe.Tews 62061b73e2 - bugfix on clear_cache() 2009-09-08 18:54:22 +00:00
Uwe.Tews 1cdb112388 - bugfix 2009-09-01 22:04:30 +00:00
Uwe.Tews 5563fc9fd5 - dropped nl2br as plugin
- added '<>' as comparission operator in {if} tags
- cached caching_lifetime property to cache_liftime for backward compatibility with Smarty2.
  {include} optional attribute is also now cache_lifetime
- fixed trigger_error methode (moved into Smarty class)
- version is now  Beta!!!
2009-09-01 21:11:42 +00:00
Uwe.Tews 45ba48f2b6 - some speed optimizations on loading internal plugins 2009-08-30 18:10:01 +00:00
monte.ohrt 770ef89611 remove built-in exception handling, add DS as shorthand to DIRECTORY_SEPARATOR 2009-08-29 22:57:29 +00:00
Uwe.Tews bfefb8e017 - implemented caching of registered Resources
- new property 'auto_literal'. if true(default)  '{ ' and ' }' interpreted as literal, not as Smarty delimiter
2009-08-29 16:29:52 +00:00
Uwe.Tews a13ae6628c - Fix on line breaks inside {if} tags 2009-08-28 18:32:31 +00:00
Uwe.Tews 8c48521260 - fixed wrong case at require_once 2009-08-27 16:02:44 +00:00
Uwe.Tews 4331452b8e - implemented registered resources as in Smarty2. NOTE: caching does not work yet
- new property 'force_cache'. if true it forces the creation of a new cache file
- fixed modifiers on arrays
- some speed optimization on loading internal classes
2009-08-27 14:59:28 +00:00
Uwe.Tews e759f76661 - bugfix - the output of plugins was not cached
- added global variable SCRIPT_NAME
2009-08-24 19:26:31 +00:00
Uwe.Tews b688c24976 - fixed typo in lexer definition for '!==' operator 2009-08-24 15:31:31 +00:00
Uwe.Tews 5fce224f8d - fixed problems whitespace in conjunction with custom delimiters
- Smarty tags can now be used as value anywhere
2009-08-21 14:50:34 +00:00
Uwe.Tews c12c6d9471 2009-08-18 18:43:06 +00:00
Uwe.Tews eef7400f55 - definition of template class name moded in internal.templatebase.php
- whitespace parser changes
2009-08-18 16:53:33 +00:00
Uwe.Tews 6e9350f7c7 - fixed parser problems 2009-08-12 16:43:37 +00:00
Uwe.Tews 9fecdb57b8 - fixed parser problems with custom delimiter 2009-08-11 18:53:23 +00:00
Uwe.Tews 0ba34008a7 - update of mb support in plugins 2009-08-10 17:52:26 +00:00
Uwe.Tews a693a00280 - fixed problems with doublequoted strings at name attribute of {block} tag
- bugfix at scope attribute of {append} tag
2009-08-09 22:03:33 +00:00
Uwe.Tews d2d8c8925b - removed all internal calls of Smarty::instance()
- fixed code in double quoted strings
2009-08-08 17:28:23 +00:00
Uwe.Tews fc9b7eef10 - bugfix of \n.\t etc in double quoted strings 2009-08-05 19:41:49 +00:00
Uwe.Tews 8b555a5903 - bugfix mb_string support 2009-08-05 19:40:48 +00:00
Uwe.Tews 83cc212060 - added syntax for variable config vars like #$foo# 2009-07-29 16:43:54 +00:00
Uwe.Tews 85998e3fca - fixed parsing of $smarty.session vars containing objects 2009-07-28 19:26:56 +00:00
Uwe.Tews 21659a76e8 - fix of "$" handling indouble quoted strings 2009-07-22 16:22:24 +00:00
Uwe.Tews 0c7113d98e 2009-07-21 17:41:16 +00:00
Uwe.Tews 51cc106811 - fix that {$smarty.current_dir} returns correct value within {block} tags. 2009-07-21 16:26:11 +00:00
Uwe.Tews 12ef15812c - drop error message on unmatched {block} {/block} pairs 2009-07-20 15:38:11 +00:00
monte.ohrt e348a33cf0 change split() to preg_split(), deprecated in php 5.3 2009-07-05 05:03:24 +00:00
monte.ohrt 3463a3a090 add SMARTY_EXCEPTION_HANDLER constant to determine if internal exception handling is enabled 2009-07-03 14:48:38 +00:00
Uwe.Tews b288d014f4 - fixed smarty_function_html_options call in plugin function.html_select_date.php (missing ,) 2009-07-01 20:19:04 +00:00
Uwe.Tews 18b939331e - fixed smarty_function_html_options call in plugin function.html_select_date.php 2009-06-24 16:27:42 +00:00
Uwe.Tews 581620d8cd - fix on \n and spaces inside smarty tags
- removed request_use_auto_globals propert as it is no longer needed because Smarty 3 will always run under PHP 5
2009-06-22 14:23:21 +00:00
Uwe.Tews f5aabcd47f - added $smarty.current_dir which returns the current working directory 2009-06-18 18:51:21 +00:00
Uwe.Tews b6b4d90487 - fixed compilation of block plugins when caching enabled 2009-06-18 17:46:25 +00:00
Uwe.Tews ce9a656829 - allow smarty tags within xml tags
- PHPunit update
2009-06-14 13:08:13 +00:00
Uwe.Tews ae3c3fce48 - fixed array access on super globals
- changed internal access to smarty object
2009-06-14 11:07:26 +00:00
Uwe.Tews 18a3bb1971 - instantiate classes of plugins instead of calling them static 2009-06-13 21:05:57 +00:00
Uwe.Tews 06ce127133 - bugfix at extend resource: create unique files for compiled template and cache for each combination of template files
- update extend resource to handle appen and prepend block attributes
2009-06-13 20:39:56 +00:00
Uwe.Tews 30bd8f119b - fixed repeat at block plugins 2009-06-03 18:07:15 +00:00
Uwe.Tews d4558ca158 - fixed problem with caching of compiler plugins 2009-05-25 21:14:44 +00:00
Uwe.Tews 1084678645 - fixed directory separator handling 2009-05-14 10:53:28 +00:00
Uwe.Tews bd6b49ee1e - syntax change for stream variables 2009-05-09 12:44:43 +00:00
Uwe.Tews 8f8111a449 - fixed bug when using absolute template filepath and caching 2009-05-09 07:04:55 +00:00
Uwe.Tews 0a64988240 - fixed bug of {nocache} tag in included templates 2009-05-08 11:34:21 +00:00
Uwe.Tews ff4619801a - allow that plugins_dir folder names can end without directory separator 2009-05-06 07:46:08 +00:00
Uwe.Tews d7a8731ac9 - fixed E_STRICT incompabilities
- {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
2009-05-05 17:19:33 +00:00
Uwe.Tews 5bbc44f35d - functions defined with the {function} tag now always have global scope 2009-04-30 17:39:17 +00:00
Uwe.Tews f3c58dfa8d - allow that cache_dir can end without directory separator 2009-04-29 19:31:33 +00:00
Uwe.Tews 0b9887cc17 - allow that cache_dir can end without directory separator 2009-04-29 19:25:44 +00:00
Uwe.Tews d7093433ae - fixed problem with directory setter methodes 2009-04-29 17:56:56 +00:00
Uwe.Tews 4c794a3d70 - the {function} tag can no longer overwrite standard smarty tags
- inherit functions defined by the {fuction} tag into subtemplates
- added {while <statement>} sytax to while tag
2009-04-28 15:37:13 +00:00
Uwe.Tews c724b720be - added trusted stream checking to security
- internal changes at file dependency check for caching
2009-04-26 16:56:17 +00:00
Uwe.Tews 4f4f2d3dd3 - changed name of {template} tag to {function} 2009-04-24 22:36:12 +00:00
Uwe.Tews e315782819 - added new {template} tag 2009-04-24 19:59:51 +00:00
Uwe.Tews 1ee0747801 - fixed access of special smarty variables from included template 2009-04-23 13:32:45 +00:00
Uwe.Tews d991f96423 - unified template stream syntax with standard Smarty resource syntax $smarty->display('mystream:mytemplate') 2009-04-21 22:09:17 +00:00
Uwe.Tews 453d8a23da - change of new style syntax for forach. Now: {foreach $array as $var} like in PHP 2009-04-21 18:02:34 +00:00
Uwe.Tews 380cb27945 - fixed "$foo.bar ..." variable replacement in double quoted strings 2009-04-20 20:33:14 +00:00
Uwe.Tews 73fe38c488 - fixed error in {include} tag with variable file attribute 2009-04-20 14:08:02 +00:00
Uwe.Tews 152cedb75c - added stream resources ($smarty->display('mystream://mytemplate'))
- added stream variables  {$mystream:myvar}
2009-04-18 14:46:29 +00:00
Uwe.Tews 24e3218d28 - added {if 'expression' is in 'array'} syntax 2009-04-14 12:41:07 +00:00
Uwe.Tews 1970c0cbdb - fixed compile_id handling on {include} tags 2009-04-14 11:25:45 +00:00
Uwe.Tews 3d0b7663e2 - fixed compile_id handling on {include} tags 2009-04-14 10:31:02 +00:00
Uwe.Tews 04fc33b99a - fixed append/prepend attributes in {block} tag
- added  {if  'expression' is in 'array'}  syntax
- use crc32 as hash for compiled config files.
2009-04-14 09:04:15 +00:00
Uwe.Tews 139b3d4570 - fixed scope problem with parent variables when appending variables within templates.
- fixed code for {block} without childs (possible sources for notice errors removed)
2009-04-12 22:26:02 +00:00
Uwe.Tews bdb43faab3 - update on append and prepend attribute at {block} tag 2009-04-12 05:40:30 +00:00
Uwe.Tews 62039b5e24 - added append and prepend attribute to {block} tag 2009-04-12 02:30:54 +00:00
Uwe.Tews c9b789ca32 - fixed variables in 'file' attribute of {extend} tag
- fixed problems in modifiers (if mb string functions not present)
2009-04-11 08:47:28 +00:00
Uwe.Tews ba61f12384 - check if mb string functions available otherwise fallback to normal string functions 2009-04-10 15:52:59 +00:00
Uwe.Tews 1262b7d873 - parser update 2009-04-10 14:31:23 +00:00
Uwe.Tews eace27e2b6 - added global variable scope SMARTY_GLOBAL_SCOPE
- enable 'variable' filter by default
2009-04-10 12:33:51 +00:00
Uwe.Tews 33082844a5 - fixed {$smarty.block.parent.foo} 2009-04-10 02:29:46 +00:00
Uwe.Tews 066467ca82 - implementation of a 'variable' filter as replacement for default modifier
- update of unregister_....filter methods
2009-04-10 01:15:53 +00:00
Uwe.Tews a424da0671 - syntax corrections on variable object property 2009-04-09 17:43:32 +00:00
Uwe.Tews ba74349d59 - fixed execution of filters defined by classes 2009-04-09 16:38:07 +00:00
Uwe.Tews 57d190e997 - compile the always the content of {block} tags to make shure that the filters are running over it
- syntax corrections on variable object property
- syntax corrections on array access in dot syntax
2009-04-09 15:53:52 +00:00
Uwe.Tews 8bcd6514b5 - allow variable object property 2009-04-08 14:47:28 +00:00
Uwe.Tews 9b41308bf6 - changed variable scopes to SMARTY_LOCAL_SCOPE, SMARTY_PARENT_SCOPE, SMARTY_ROOT_SCOPE to avoid possible conflicts with user constants
- Smarty variable global attribute replaced with scope attribute
2009-04-07 16:22:31 +00:00
Uwe.Tews 0ab30877db - variable scopes LOCAL_SCOPE, PARENT_SCOPE, ROOT_SCOPE
- more getter/setter methodes
2009-04-06 02:53:09 +00:00
Uwe.Tews 65f1871c98 - update of README file 2009-04-05 18:07:17 +00:00
Uwe.Tews fa3a23dace - replaced new array looping syntax {for $foo in $array} with {foreach $foo in $array} to avoid confusion 2009-04-05 17:56:04 +00:00
Uwe.Tews 827e9b08d8 - added append array for short form of assign {$foo[]='bar'} and allow assignments to nested arrays {$foo['bla']['blue']='bar'} 2009-04-05 14:49:27 +00:00
Uwe.Tews 45e2a5f0d6 - make output of template default handlers cachable 2009-04-04 19:07:42 +00:00
Uwe.Tews 228a225f5b - some fixes on yesterdays update 2009-04-04 15:46:09 +00:00
Uwe.Tews 3c5f0d56d3 - added registerDefaultTemplateHandler methode and functionallity
- added registerDefaultPluginHandler methode and functionallity
- added {append} tag to extend Smarty array variabled
2009-04-03 15:59:40 +00:00
Uwe.Tews b46b973b8e - added setter/getter methodes
- added $foo@first and $foo@last properties at {for} tag
- added $set_timezone (true/false) property to setup optionally the default time zone
2009-04-02 12:24:50 +00:00
Uwe.Tews 25e4ef7fb9 - bugfix smarty.class and internal.security_handler
- added compile_check configuration 
- added all setter/getter methodes
2009-03-31 14:20:10 +00:00
Uwe.Tews c9bbd7e834 - added all major setter/getter methodes 2009-03-30 17:05:37 +00:00
Uwe.Tews 590029c092 - code optimization at crc32 hash computation 2009-03-29 13:13:33 +00:00
Uwe.Tews 53e31d8162 - {block} tags can be nested now 2009-03-28 12:20:53 +00:00
Uwe.Tews 7f00b38f34 - md5 hash function replace with crc32 for speed optimization 2009-03-28 09:41:06 +00:00
Uwe.Tews e180d015ea - file order for exted resource inverted
- clear_compiled_tpl and clear_cache_all will not touch .svn folder any longer
2009-03-28 08:47:26 +00:00
Uwe.Tews 8a8766b0bd - added extend resource 2009-03-27 15:31:47 +00:00
Uwe.Tews 000e5c7892 - implemented $smarty.block.name.parent to access parent block content
- fixed smarty.class
2009-03-26 21:06:02 +00:00
Uwe.Tews 9f95d63ab7 - parser fix 2009-03-26 15:36:01 +00:00
Uwe.Tews 526d5e0388 - fixed parser not to create error on word in double quoted strings
- allow PHP  array(...)
2009-03-26 14:08:43 +00:00
Uwe.Tews 52652dd4f9 - fixed {foreachelse} and {forelse} tags 2009-03-23 15:29:50 +00:00
Uwe.Tews c20094c923 - update of paths 2009-03-22 22:36:46 +00:00
Uwe.Tews a752396d41 - updated paths in development folder 2009-03-22 22:35:10 +00:00
Uwe.Tews 0e2e7efc99 2009-03-22 17:04:35 +00:00
Uwe.Tews d88ab67260 - delete obsolete files 2009-03-22 17:03:59 +00:00
Uwe.Tews e06ebee879 - files moved in SVN 2009-03-22 16:59:03 +00:00
monte.ohrt 73f0eae241 fix path 2009-03-22 16:13:14 +00:00
monte.ohrt dcaa96a9f8 rearrange things into distribution and development directories 2009-03-22 16:09:05 +00:00
1166 changed files with 67749 additions and 20373 deletions
-1
View File
@@ -1 +0,0 @@
templates_c
+20 -7
View File
@@ -1,7 +1,20 @@
* text=auto !eol
docs/chm/make_chm_spc.gif -text
docs/fop/thryb.ttf -text
docs/fop/thrybi.ttf -text
docs/fop/thryi.ttf -text
docs/fop/thryn.ttf -text
misc/smarty_icon.gif -text
# Auto detect text files and perform LF normalization
* text=auto
*.php text eol=lf
*.y text eol=lf
*.lex text eol=lf
# exclude from git export
/tests export-ignore
/utilities/ export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/error_reporting.ini export-ignore
/make-release.sh export-ignore
/phpunit.sh export-ignore
/phpunit.xml export-ignore
/TODO.md export-ignore
/travis.ini export-ignore
+13 -19
View File
@@ -1,19 +1,13 @@
docs/*.cache
docs/*.fot
docs/Makefile
docs/chm/*.chm
docs/chm/*.hh?
docs/chm/fancy
docs/config.*
docs/configure
docs/diff
docs/dsssl/html-common.dsl
docs/entities/file-entities.ent
docs/entities/version.ent
docs/html
docs/manual.pdf
docs/manual.xml
docs/phpweb
docs/revcheck.html
docs/scripts/file-entities.php
/templates_c
.idea/
# Smarty
lexer/*.php
lexer/*.php.bak
lexer/*.out
utilies/*.php
# Dev
phpunit*
vendor/*
composer.lock
+39
View File
@@ -0,0 +1,39 @@
language: php
os: linux
dist: xenial
install:
- travis_retry composer install
jobs:
include:
- php: 5.3 # Composer and PHPUnit require PHP 5.3.2+ to run, so we cannot test below 5.3
dist: precise # PHP 5.3 is supported only on Precise.
- php: 5.4
dist: trusty # PHP 5.4 is supported only on Trusty.
- php: 5.5
dist: trusty # PHP 5.5 is supported only on Trusty.
- php: 5.6
- php: 7.0
- php: 7.1
- php: 7.2
- php: 7.3
- php: 7.4
- php: nightly
install: travis_retry composer config platform.php 7.4.0 && composer install
fast_finish: true
allow_failures:
- php: nightly # PHP 8 is still in beta
services:
- memcached
- mysql
before_script:
- mysql -e "create database IF NOT EXISTS test;" -uroot
before_install:
- phpenv config-rm xdebug.ini || return 0
script:
- ./phpunit.sh
-7
View File
@@ -1,7 +0,0 @@
Smarty is supported only in PHP 4.0.6 or later.
Smarty versions previous to 2.0 require the PEAR libraries. Be sure to include
the path to the PEAR libraries in your php include_path. Config_file.class.php
uses the PEAR library for its error handling routines. PEAR comes with the PHP
distribution. Unix users check /usr/local/lib/php, windows users check
C:/php/pear.
+3455
View File
File diff suppressed because it is too large Load Diff
+31
View File
@@ -0,0 +1,31 @@
Starting with Smarty 3.1.21 Composer has been configured to load the packages from github.
*******************************************************************************
* *
* NOTE: Because of this change you must clear your local composer cache with *
* the "composer clearcache" command *
* *
*******************************************************************************
To get the latest stable version use
"require": {
"smarty/smarty": "~3.1"
}
in your composer.json file.
To get the trunk version use
"require": {
"smarty/smarty": "~3.1@dev"
}
The "smarty/smarty" package will start at libs/.... subfolder.
To retrieve the development and documentation folders add
"require-dev": {
"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.
-458
View File
@@ -1,458 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
-9197
View File
File diff suppressed because it is too large Load Diff
-284
View File
@@ -1,284 +0,0 @@
QUESTION INDEX
--------------
GENERAL
Q: What is Smarty?
Q: What's the difference between Smarty and other template engines?
Q: What do you mean "Compiled PHP Scripts" ?
Q: Why can't I just use PHPA (http://php-accelerator.co.uk) or Zend Cache?
Q: Why does smarty have a built in cache? Wouldn't it be better to handle this
in a separate class?
Q: Is Smarty faster than <insert other PHP template engine>?
Q: How can I be sure to get the best performance from Smarty?
Q: Do you have a mailing list?
Q: Can you change the mailing list so reply-to sends to the list and not the
user?
TROUBLESHOOTING
Q: Smarty doesn't work.
Q: I get the following error when running Smarty:
Warning: Smarty error: problem creating directory "templates_c/239/239105369"
in /path/to/Smarty.class.php on line 542
Q: I get the following error when running Smarty:
Warning: Wrong parameter count for preg_replace() in
Smarty.class.php on line 371
Q: I get this error when passing variables to {include}:
Fatal error: Call to undefined function: get_defined_vars() in
/path/to/Smarty/templates_c/index.tpl.php on line 8
Q: I get PHP errors in my {if} tag logic.
Q: I'm changing my php code and/or templates, and my results are not getting
updated.
Q: I'm running Windows 2000 and I get blank content. My compiled PHP files are
also zero length.
Q: The template goes into an infinite loop when I include included templates
that pass local variables
Q: Javascript is causing Smarty errors in my templates.
Q: I get "SAFE MODE Restriction in effect. ..."-errors when running smarty.
MISC
Q: Can I use Macromedia's Dreamweaver to edit my templates?
Q: Dreamweaver is urlencoding the template delimiters when they are in a SRC or
HREF link. How do I get around this?
HOWTO
Q: How do I generate different cache files per template based on arguments
passed to the page?
Q: How do I pass a template variable as a parameter? {function param={$varname}}
does not work.
Q: How do I include cached template(s) within a non-cached template?
GENERAL
-------
Q: What is Smarty?
A: Smarty is a template engine for PHP... but be aware this isn't just another
PHP template engine. It's much more than that.
Q: What's the difference between Smarty and other template engines?
A: Most other template engines for PHP provide basic variable substitution and
dynamic block functionality. Smarty takes a step further to be a "smart"
template engine, adding features such as configuration files, template
functions, variable modifiers (see the docs!) and making all of this
functionality as easy as possible to use for both programmers and template
designers. Smarty also compiles the templates into PHP scripts, eliminating
the need to parse the templates on every invocation, making Smarty extremely
scalable and manageable for large application needs.
Q: What do you mean "Compiled PHP Scripts" ?
A: Smarty reads the template files and creates PHP scripts from them. Once
these PHP scripts are created, Smarty executes these, never having to parse
the template files again. If you change a template file, Smarty will
recreate the PHP script for it. All this is done automatically by Smarty.
Template designers never need to mess with the generated PHP scripts or even
know of their existance. (NOTE: you can turn off this compile checking step
in Smarty for increased performance.)
Q: Why can't I just use PHPA (http://php-accelerator.co.uk) or Zend Cache?
A: You certainly can, and we highly recommend it! What PHPA does is caches
compiled bytecode of your PHP scripts in shared memory or in a file. This
speeds up server response and saves the compilation step. Smarty creates PHP
scripts, which PHPA will cache nicely. Now, Smarty's built-in cache is
something completely different. It caches the _output_ of the template
contents. For example, if you have a template that requires several database
queries, Smarty can cache this output, saving the need to call the database
every time. Smarty and PHPA (or Zend Cache) complement each other nicely. If
performance is of the utmost importance, we would recommend using one of
these with any PHP application, using Smarty or not. As you can see in the
benchmarks, Smartys performance _really_ excels in combination with a PHP
accelerator.
Q: Why does Smarty have a built in cache? Wouldn't it be better to handle this
in a separate class?
A: Smarty's caching functionality is tightly integrated with the template
engine, making it quite a bit more flexible than a simple caching wrapper.
For instance, you can cache select portions of a template page. Let's say
you have a polling box on your site. With Smarty, you can leave the poll
dynamic and cache the rest of the page. You can also pass templates
multiple cache ids, meaning that a template can have several caches
depending on URL, cookies, etc.
Q: Is Smarty faster than <insert other PHP template engine>?
A: See the benchmark page for some performance comparisons. Smarty's approach
to templates is a bit different from some languages: it compiles templates
into PHP scripts instead of parsing them on each invocation. This usually
results in great performance gains, especially with complex templates.
Coupled with the built-in caching of Smarty templates, the performance is
outstanding.
Q: How can I be sure to get the best performance from Smarty?
A: Be sure you set $compile_check=false once your templates are initially
compiled. This will skip the unneeded step of testing if the template has
changed since it was last compiled. If you have complex pages that don't
change too often, turn on the caching engine and adjust your application so
it doesn't do unnecessary work (like db calls) if a cached page is
available. See the documentation for examples.
Q: Do you have a mailing list?
A: We have a few mailing lists. "general" for you to share your ideas or ask
questions, "dev" for those interested in the development efforts of Smarty,
and "cvs" for those that would like to track the updates made in the cvs
repository.
send a blank e-mail message to:
smarty-general-subscribe@lists.php.net (subscribe to the general list)
smarty-general-unsubscribe@lists.php.net (unsubscribe from the general list)
smarty-general-digest-subscribe@lists.php.net (subscribe to digest)
smarty-general-digest-unsubscribe@lists.php.net (unsubscribe from digest)
smarty-dev-subscribe@lists.php.net (subscribe to the dev list)
smarty-dev-unsubscribe@lists.php.net (unsubscribe from the dev list)
smarty-cvs-subscribe@lists.php.net (subscribe to the cvs list)
smarty-cvs-unsubscribe@lists.php.net (unsubscribe from the cvs list)
You can also browse the mailing list archives at
http://marc.theaimsgroup.com/?l=smarty&r=1&w=2
Q: Can you change the mailing list so Reply-To sends to the list and not the
user?
A: Yes we could, but no we won't. Use "Reply-All" in your e-mail client to send
to the list. http://www.unicom.com/pw/reply-to-harmful.html
TROUBLESHOOTING
---------------
Q: Smarty doesn't work.
A: You must be using PHP 4.0.6 or later if you use any version of Smarty
past 2.0.1. Read the BUGS file for more info.
Q: I get the following error when running Smarty:
Warning: Smarty error: problem creating directory "templates_c/239/239105369"
in /path/to/Smarty.class.php on line 542
A: Your web server user does not have permission to write to the templates_c
directory, or is unable to create the templates_c directory. Be sure the
templates_c directory exists in the location defined in Smarty.class.php,
and the web server user can write to it. If you do not know the web server
user, chmod 777 the templates_c directory, reload the page, then check the
file ownership of the files created in templates_c. Or, you can check the
httpd.conf (usually in /usr/local/apache/conf) file for this setting:
User nobody
Group nobody
Q: I get the following error when running Smarty: Warning: Wrong parameter
count for preg_replace() in Smarty.class.php on line 371
A: preg_replace had a parameter added in PHP 4.0.2 that Smarty
requires. Upgrade to at least 4.0.6 to fix all known PHP issues with
Smarty.
Q: I get this error when passing variables to {include}:
Fatal error: Call to undefined function: get_defined_vars() in
/path/to/Smarty/templates_c/index.tpl.php on line 8
A: get_defined_vars() was added to PHP 4.0.4. If you plan on passing
variables to included templates, you will need PHP 4.0.6 or later.
Q: I get PHP errors in my {if} tag logic.
A: All conditional qualifiers must be separated by spaces. This syntax will not
work: {if $name=="Wilma"} You must instead do this: {if $name == "Wilma"}.
The reason for this is syntax ambiguity. Both "==" and "eq" are equivalent
in the template parser, so something like {if $nameeq"Wilma"} wouldn't be
parsable by the tokenizer.
Q: I'm changing my php code and/or templates, and my results are not getting
updated.
A: This may be the result of your compile or cache settings. If you are
changing your php code, your templates will not necessarily get recompiled
to reflect the changes. Use $force_compile during develpment to avoid these
situations. Also turn off caching during development when you aren't
specifically testing it. You can also remove everything from your
compile_dir and cache_dir and reload the page to be sure everything gets
regenerated.
Q: I'm running Windows 2000 and I get blank content. My compiled PHP files are
also zero length.
A: There seems to be a problem with some W2k machines and exclusive file
locking. Comment out the flock() call in _write_file to get around this,
although be aware this could possibly cause a problem with simultaneous
writes to a file, especially with caching turned on. NOTE: As of Smarty
1.4.0, a workaround was put in place that should solve this.
Q: The template goes into an infinite loop when I include included templates
that pass local variables
A: This was fixed in 1.3.2 (new global attribute)
Q: Javascript is causing Smarty errors in my templates.
A: Surround your javascript with {literal}{/literal} tags. See the docs.
Q: I get "SAFE MODE Restriction in effect. ..."-errors when running smarty.
A: Use $smarty->use_sub_dirs = false when running php in safe mode.
MISC
----
Q: Can I use Macromedia's Dreamweaver to edit my templates?
A: Certainly. You might want to change your tag delimiters from {} to something
that resembles valid HTML, like <!--{ }--> or <{ }> or something similar.
This way the editor won't view the template tags as errors.
Q: Dreamweaver is urlencoding the template delimiters when they are in a SRC or
HREF link. How do I get around this?
A: In Edit - Properties - Rewrite HTML you can specify if Dreamweaver should
change special letters to %-equivalent or not. The default is on which
produces this error.
HOWTO
-----
Q: How do I generate different cache files per template based on arguments
passed to the page?
A: Use your $REQUEST_URI as the cache_id when fetching the page:
global $REQUEST_URI; // if not already present
$smarty->display('index.tpl',$REQUEST_URI);
This will create a separate cache file for each unique URL when you call
index.tpl. See the documentation for display() and fetch()
Q: How do I pass a template variable as a parameter? {function param={$varname}}
does not work.
A: {function param=$varname} (You cannot nest template delimiters.)
Q: How do I include cached template(s) within a non-cached template?
A: One way to do it:
$smarty->caching = true;
$tpl1 = $smarty->fetch("internal1.tpl");
$tpl2 = $smarty->fetch("internal2.tpl");
$tpl3 = $smarty->fetch("internal3.tpl");
$smarty->assign("tpl1_contents",$tpl1);
$smarty->assign("tpl2_contents",$tpl2);
$smarty->assign("tpl3_contents",$tpl3);
$smarty->caching = false;
$smarty->display('index.tpl');
index.tpl
---------
<table>
<tr>
<td>{$tpl1_contents}</td>
<td>{$tpl2_contents}</td>
<td>{$tpl3_contents}</td>
</tr>
</table>
Another approach:
You could write a custom insert function to fetch your internal
templates:
<table>
<tr>
<td>{insert name=fetch_tpl tpl="internal1.tpl"}</td>
<td>{insert name=fetch_tpl tpl="internal2.tpl"}</td>
<td>{insert name=fetch_tpl tpl="internal3.tpl"}</td>
</tr>
</table>
+91
View File
@@ -0,0 +1,91 @@
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}
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.
This does resolve all known existing restrictions (see below).
The $smarty::$inheritance_merge_compiled_includes property has been removed.
Any access to it is ignored.
New features:
Any code outside root {block} tags in child templates is now executed but any output will be ignored.
{extends 'foo.tpl'}
{$bar = 'on'} // assigns variable $bar seen in parent templates
{block 'buh'}{/block}
{extends 'foo.tpl'}
{$bar} // the output of variable bar is ignored
{block 'buh'}{/block}
{block} tags can be dynamically en/disabled by conditions.
{block 'root'}
{if $foo}
{block 'v1'}
....
{/block}
{else}
{block 'v1'}
....
{/block}
{/if}
{/block}
{block} tags can have variable names.
{block $foo}
....
{/block}
Starting with 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.
NOTE There is a BC break. If you used the extends resource {extends} tags have been ignored.
THE FOLLOWING RESTRICTIONS ARE NO LONGER EXISTING:
In Smarty 3.1 template inheritance is a compile time process. All the extending of {block} tags
is done at compile time and the parent and child templates are compiled in a single compiled template.
{include} subtemplate could also {block} tags. Such subtemplate could not compiled by it's own because
it could be used in other context where the {block} extended with a different result. For that reasion
the compiled code of {include} subtemplates gets also merged in compiled inheritance template.
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. 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
that a couple of users did use some of above and now got exceptions.
To resolve this starting with 3.1.16 there is a new configuration parameter $inheritance_merge_compiled_includes.
For most backward compatibility its default setting is true.
With this setting all {include} subtemplate will be merge into the compiled inheritance template, but the above cases
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.
{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;
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.
-29
View File
@@ -1,29 +0,0 @@
REQUIREMENTS:
Smarty requires PHP 4.0.6 or later.
See the on-line documentation for complete install instructions.
INSTALLATION (quick):
* copy the files under the libs/ directory to a directory that is in your PHP
include_path, or set the SMARTY_DIR constant and put them in this directory.
(if you upgrade from versions before 2.5.0 be aware that up to Smarty 2.4.2
all necessary files where in the distribution's root directory, but are now
in libs/.)
* for each application using Smarty, create a "templates", "configs", and a
"templates_c" directory, be sure to set the appropriate directory settings in
Smarty for them. If they are located in the same directory as your
application, they shouldn't need to be modified. Be sure the "templates_c"
directory is writable by your web server user (usually nobody). chown
nobody:nobody templates_c; chmod 700 templates_c You can also chmod 777 this
directory, but be aware of security issues for multi-user systems. If you are
using Smarty's built-in caching, create a "cache" directory and also chown
nobody:nobody.
* setup your php and template files. A good working example is in the on-line
documentation.
* TECHNICAL NOTE: If you do not have access to the php.ini file, you can change
non-server settings (such as your include_path) with the ini_set() command.
example: ini_set("include_path",".:/usr/local/lib/php");
+179
View File
@@ -0,0 +1,179 @@
Smarty: the PHP compiling template engine
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License below for more details.
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
-1065
View File
File diff suppressed because it is too large Load Diff
+291
View File
@@ -0,0 +1,291 @@
This file contains a brief description of new features which have been added to Smarty 3.1
Smarty 3.1.33-dev
Variable capture name in Smarty special variable
================================================
{$smarty.capture.$foo} can now be used to access the content of a named
capture block
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->setLiterals(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->setLiterals(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
=========================================
{block_parent} == {$smarty.block.parent}
{block_child} == {$smarty.block.child}
Smarty 3.1.30
Loop optimization {foreach} and {section}
=========================================
Smarty does optimize the {foreach} and {section} loops by removing code for not needed loop
properties.
The compiler collects needed properties by scanning the current template for $item@property,
$smarty.foreach.name.property and $smarty.section.name.property.
The compiler does not know if additional properties will be needed outside the current template scope.
Additional properties can be generated by adding them with the property attribute.
Example:
index.tpl
{foreach $from as $item properties=[iteration, index]}
{include 'sub.tpl'}
{$item.total}
{/foreach}
sub.tpl
{$item.index} {$item.iteration} {$item.total}
In above example code for the 'total' property is automatically generated as $item.total is used in
index.tpl. Code for 'iteration' and 'index' must be added with properties=[iteration, index].
New tag {make_nocache}
======================
Syntax: {make_nocache $foo}
This tag makes a variable which does exists normally only while rendering the compiled template
available in the cached template for use in not cached expressions.
Expample:
{foreach from=$list item=item}
<li>{$item.name} {make_nocache $item}{if $current==$item.id} ACTIVE{/if}</li>
{/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 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.
NOTE: if the variable value does contain objects these must have the __set_state method implemented.
Scope Attributes
================
The scope handling has been updated to cover all cases of variable assignments in templates.
The tags {assign}, {append} direct assignments like {$foo = ...}, {$foo[...]= ...} support
the following optional scope attributes:
scope='parent' - the variable will be assigned in the current template and if the template
was included by {include} the calling template
scope='tpl_root' - the variable will be assigned in the outermost root template called by $smarty->display()
or $smarty->fetch() and is bubbled up all {include} sub-templates to the current template.
scope='smarty' - the variable will be assigned in the Smarty object and is bubbled up all {include} sub-templates
to the current template.
scope='global' - the variable will be assigned as Smarty object global variable and is bubbled up all {include}
sub-templates to the current template.
scope='root' - the variable will be assigned if a data object was used for variable definitions in the data
object or in the Smarty object otherwise and is bubbled up all {include} sub-templates to the
current template.
scope='local' - this scope has only a meaning if the tag is called within a template {function}.
The variable will be assigned in the local scope of the template function and the
template which did call the template function.
The {config_load} tag supports all of the above except the global scope.
The scope attribute can be used also with the {include} tag.
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}.
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--}
Note: The scopes should be used only to the extend really need. If a variable value assigned in an included
sub-template should be returned to the calling sub-template just use {$foo='bar' scope='parent'}.
Use scopes only with variables for which it's realy needed. Avoid general scope settings with the
{include} tag as it can have a performance impact.
The {assign}, {append}, {config_load} and {$foo...=...} tags have a new option flag 'noscope'.Thi
Example: {$foo='bar' noscope} This will assign $foo only in the current template and any scope settings
at {include} is ignored.
Caching
=======
Caching does now observe the template_dir setting and will create separate cache files if required
Compiled Templates
==================
The template_dir setting is now encoded in the uid of the file name.
The content of the compiled template may depend on the template_dir search order
{include .... inline} is used or $smarty->merge_compiled_includes is enabled
APC
===
If APC is enabled force an apc_compile_file() when compiled or cached template was updated
Smarty 3.1.28
OPCACHE
=======
Smarty does now invalidate automatically updated and cleared compiled or cached template files in OPCACHE.
Correct operation is no longer dependent on OPCACHE configuration settings.
Template inheritance
====================
Template inheritance is now processed in run time.
See the INHERITANCE_RELEASE_NOTES
Modifier regex_replace
======================
An optional limit parameter was added
fetch() and display()
=====================
The fetch() and display() methods of the template object accept now optionally the same parameter
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'
File: resource
==============
Multiple template_dir entries can now be selected by a comma separated list of indices.
The template_dir array is searched in the order of the indices. (Could be used to change the default search order)
Example:
$smarty->display('[1],[0]foo.bar');
Filter support
==============
Optional filter names
An optional filter name was added to $smarty->registerFilter(). It can be used to unregister a filter by name.
- $smarty->registerFilter('output', $callback, 'name');
$smarty->unregister('output', 'name');
Closures
$smarty->registerFilter() does now accept closures.
- $smarty->registerFilter('pre', function($source) {return $source;});
If no optional filter name was specified it gets the default name 'closure'.
If you register multiple closures register each with a unique filter name.
- $smarty->registerFilter('pre', function($source) {return $source;}, 'closure_1');
- $smarty->registerFilter('pre', function($source) {return $source;}, 'closure_2');
Smarty 3.1.22
Namespace support within templates
==================================
Within templates you can now use namespace specifications on:
- Constants like foo\bar\FOO
- Class names like foo\bar\Baz::FOO, foo\bar\Baz::$foo, foo\bar\Baz::foo()
- PHP function names like foo\bar\baz()
Security
========
- disable special $smarty variable -
The Smarty_Security class has the new property $disabled_special_smarty_vars.
It's an array which can be loaded with the $smarty special variable names like
'template_object', 'template', 'current_dir' and others which will be disabled.
Note: That this security check is performed at compile time.
- limit template nesting -
Property $max_template_nesting of Smarty_Security does set the maximum template nesting level.
The main template is level 1. The nesting level is checked at run time. When the maximum will be exceeded
an Exception will be thrown. The default setting is 0 which does disable this check.
- trusted static methods -
The Smarty_Security class has the new property $trusted_static_methods to restrict access to static methods.
It's an nested array of trusted class and method names.
Format:
array (
'class_1' => array('method_1', 'method_2'), // allowed methods
'class_2' => array(), // all methods of class allowed
)
To disable access for all methods of all classes set $trusted_static_methods = null;
The default value is an empty array() which does enables all methods of all classes, but for backward compatibility
the setting of $static_classes will be checked.
Note: That this security check is performed at compile time.
- trusted static properties -
The Smarty_Security class has the new property $trusted_static_properties to restrict access to static properties.
It's an nested array of trusted class and property names.
Format:
array (
'class_1' => array('prop_1', 'prop_2'), // allowed properties listed
'class_2' => array(), // all properties of class allowed
}
To disable access for all properties of all classes set $trusted_static_properties = null;
The default value is an empty array() which does enables all properties of all classes, but for backward compatibility
the setting of $static_classes will be checked.
Note: That this security check is performed at compile time.
- trusted constants .
The Smarty_Security class has the new property $trusted_constants to restrict access to constants.
It's an array of trusted constant names.
Format:
array (
'SMARTY_DIR' , // allowed constant
}
If the array is empty (default) the usage of constants can be controlled with the
Smarty_Security::$allow_constants property (default true)
Compiled Templates
==================
Smarty does now automatically detects a change of the $merge_compiled_includes and $escape_html
property and creates different compiled templates files depending on the setting.
Same applies to config files and the $config_overwrite, $config_booleanize and
$config_read_hidden properties.
Debugging
=========
The layout of the debug window has been changed for better readability
New class constants
Smarty::DEBUG_OFF
Smarty::DEBUG_ON
Smarty::DEBUG_INDIVIDUAL
have been introduced for setting the $debugging property.
Smarty::DEBUG_INDIVIDUAL will create for each display() and fetch() call an individual debug window.
-103
View File
@@ -1,103 +0,0 @@
This is a simple guide to get Smarty setup and running quickly. The online
documentation includes a very thorough explanation of a Smarty installation.
This guide is meant to be a quick and painless way of getting Smarty working,
and nothing more. The guide assumes you are familiar with the UNIX system
environment. Windows users will need to make adjustments where necessary.
INSTALL SMARTY LIBRARY FILES
Copy the Smarty library files to your system. In our example, we place them in
/usr/local/lib/php/Smarty/
$> cd YOUR_DOWNLOAD_DIRECTORY
$> gtar -ztvf Smarty-2.6.7.tar.gz
$> mkdir /usr/local/lib/php/Smarty
$> cp -r Smarty-2.6.7/libs/* /usr/local/lib/php/Smarty
You should now have the following file structure:
/usr/local/lib/php/Smarty/
Config_File.class.php
debug.tpl
internals/
plugins/
Smarty.class.php
Smarty_Compiler.class.php
SETUP SMARTY DIRECTORIES
You will need four directories setup for Smarty to work. These files are for
templates, compiled templates, cached templates and config files. You may or
may not use caching or config files, but it is a good idea to set them up
anyways. It is also recommended to place them outside of the web server
document root. The web server PHP user will need write access to the cache and
compile directories as well.
In our example, the document root is /web/www.domain.com/docs and the
web server username is "nobody". We will keep our Smarty files under
/web/www.domain.com/smarty
$> cd /web/www.domain.com
$> mkdir smarty
$> mkdir smarty/templates
$> mkdir smarty/templates_c
$> mkdir smarty/cache
$> mkdir smarty/configs
$> chown nobody:nobody smarty/templates_c
$> chown nobody:nobody smarty/cache
$> chmod 775 smarty/templates_c
$> chmod 775 smarty/cache
SETUP SMARTY PHP SCRIPTS
Now we setup our application in the document root:
$> cd /web/www.domain.com/docs
$> mkdir myapp
$> cd myapp
$> vi index.php
Edit the index.php file to look like the following:
<?php
// put full path to Smarty.class.php
require('/usr/local/lib/php/Smarty/Smarty.class.php');
$smarty = new Smarty();
$smarty->template_dir = '/web/www.domain.com/smarty/templates';
$smarty->compile_dir = '/web/www.domain.com/smarty/templates_c';
$smarty->cache_dir = '/web/www.domain.com/smarty/cache';
$smarty->config_dir = '/web/www.domain.com/smarty/configs';
$smarty->assign('name', 'Ned');
$smarty->display('index.tpl');
?>
SETUP SMARTY TEMPLATE
$> vi /web/www.domain.com/smarty/templates/index.tpl
Edit the index.tpl file with the following:
<html>
<head>
<title>Smarty</title>
</head>
<body>
Hello, {$name}!
</body>
</html>
Now go to your new application through the web browser,
http://www.domain.com/myapp/index.php in our example. You should see the text
"Hello Ned!" in your browser.
Once you get this far, you can continue on to the Smarty Crash Course to learn
a few more simple things, or on to the documentation to learn it all.
+554 -65
View File
@@ -1,86 +1,575 @@
Smarty 3.x
NAME:
Author: Monte Ohrt <monte at ohrt dot com >
Author: Uwe Tews
Smarty - the PHP compiling template engine
AN INTRODUCTION TO SMARTY 3
VERSION: 2.6.18
NOTICE FOR 3.1 release:
AUTHORS:
Monte Ohrt <monte at ohrt dot com>
Andrei Zmievski <andrei@php.net>
Please see the SMARTY_3.1_NOTES.txt file that comes with the distribution.
MAILING LISTS:
NOTICE for 3.0.5 release:
We have a few mailing lists. "discussion" for you to share your ideas or ask
questions, "developers" for those interested in the development efforts of Smarty,
and "svn" for those that would like to track the updates made in the svn
repository.
Smarty now follows the PHP error_reporting level by default. If PHP does not mask E_NOTICE and you try to access an unset template variable, you will now get an E_NOTICE warning. To revert to the old behavior:
send a blank e-mail message to:
smarty-discussion-subscribe@googlecode.com(subscribe to the general discussion list)
smarty-discussion-unsubscribe@googlecode.com (unsubscribe from the general discussion list)
smarty-discussion-digest-subscribe@googlecode.com (subscribe to digest)
smarty-discussion-digest-unsubscribe@googlecode.com (unsubscribe from digest)
smarty-developers-subscribe@googlecode.com (subscribe to the dev list)
smarty-developers-unsubscribe@googlecode.com (unsubscribe from the dev list)
smarty-svn-subscribe@googlecode.com (subscribe to the svn list)
smarty-svn-unsubscribe@googlecode.com (unsubscribe from the svn list)
$smarty->error_reporting = E_ALL & ~E_NOTICE;
You can also browse the mailing list archives at
http://groups.google.com/group/smarty-discussion
http://groups.google.com/group/smarty-developers
NOTICE for 3.0 release:
and the OLD list archives at
http://marc.theaimsgroup.com/?l=smarty&r=1&w=2
IMPORTANT: Some API adjustments have been made between the RC4 and 3.0 release.
We felt it is better to make these now instead of after a 3.0 release, then have to
immediately deprecate APIs in 3.1. Online documentation has been updated
to reflect these changes. Specifically:
SYNOPSIS:
---- API CHANGES RC4 -> 3.0 ----
require("Smarty.class.php");
$smarty->register->*
$smarty->unregister->*
$smarty->utility->*
$samrty->cache->*
$smarty = new Smarty;
Have all been changed to local method calls such as:
$smarty->assign("Title","My Homepage");
$smarty->assign("Names",array("John","Gary","Gregg","James"));
$smarty->clearAllCache()
$smarty->registerFoo()
$smarty->unregisterFoo()
$smarty->testInstall()
etc.
$smarty->display("index.tpl");
Registration of function, block, compiler, and modifier plugins have been
consolidated under two API calls:
$smarty->registerPlugin(...)
$smarty->unregisterPlugin(...)
Registration of pre, post, output and variable filters have been
consolidated under two API calls:
$smarty->registerFilter(...)
$smarty->unregisterFilter(...)
Please refer to the online documentation for all specific changes:
http://www.smarty.net/documentation
----
The Smarty 3 API has been refactored to a syntax geared
for consistency and modularity. The Smarty 2 API syntax is still supported, but
will throw a deprecation notice. You can disable the notices, but it is highly
recommended to adjust your syntax to Smarty 3, as the Smarty 2 syntax must run
through an extra rerouting wrapper.
Basically, all Smarty methods now follow the "fooBarBaz" camel case syntax. Also,
all Smarty properties now have getters and setters. So for example, the property
$smarty->cache_dir can be set with $smarty->setCacheDir('foo/') and can be
retrieved with $smarty->getCacheDir().
Some of the Smarty 3 APIs have been revoked such as the "is*" methods that were
just duplicate functions of the now available "get*" methods.
Here is a rundown of the Smarty 3 API:
$smarty->fetch($template, $cache_id = null, $compile_id = null, $parent = null)
$smarty->display($template, $cache_id = null, $compile_id = null, $parent = null)
$smarty->isCached($template, $cache_id = null, $compile_id = null)
$smarty->createData($parent = null)
$smarty->createTemplate($template, $cache_id = null, $compile_id = null, $parent = null)
$smarty->enableSecurity()
$smarty->disableSecurity()
$smarty->setTemplateDir($template_dir)
$smarty->addTemplateDir($template_dir)
$smarty->templateExists($resource_name)
$smarty->loadPlugin($plugin_name, $check = true)
$smarty->loadFilter($type, $name)
$smarty->setExceptionHandler($handler)
$smarty->addPluginsDir($plugins_dir)
$smarty->getGlobal($varname = null)
$smarty->getRegisteredObject($name)
$smarty->getDebugTemplate()
$smarty->setDebugTemplate($tpl_name)
$smarty->assign($tpl_var, $value = null, $nocache = false)
$smarty->assignGlobal($varname, $value = null, $nocache = false)
$smarty->assignByRef($tpl_var, &$value, $nocache = false)
$smarty->append($tpl_var, $value = null, $merge = false, $nocache = false)
$smarty->appendByRef($tpl_var, &$value, $merge = false)
$smarty->clearAssign($tpl_var)
$smarty->clearAllAssign()
$smarty->configLoad($config_file, $sections = null)
$smarty->getVariable($variable, $_ptr = null, $search_parents = true, $error_enable = true)
$smarty->getConfigVariable($variable)
$smarty->getStreamVariable($variable)
$smarty->getConfigVars($varname = null)
$smarty->clearConfig($varname = null)
$smarty->getTemplateVars($varname = null, $_ptr = null, $search_parents = true)
$smarty->clearAllCache($exp_time = null, $type = null)
$smarty->clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
$smarty->registerPlugin($type, $tag, $callback, $cacheable = true, $cache_attr = array())
$smarty->registerObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
$smarty->registerFilter($type, $function_name)
$smarty->registerResource($resource_type, $function_names)
$smarty->registerDefaultPluginHandler($function_name)
$smarty->registerDefaultTemplateHandler($function_name)
$smarty->unregisterPlugin($type, $tag)
$smarty->unregisterObject($object_name)
$smarty->unregisterFilter($type, $function_name)
$smarty->unregisterResource($resource_type)
$smarty->compileAllTemplates($extension = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)
$smarty->clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null)
$smarty->testInstall()
// then all the getters/setters, available for all properties. Here are a few:
$caching = $smarty->getCaching(); // get $smarty->caching
$smarty->setCaching(true); // set $smarty->caching
$smarty->setDeprecationNotices(false); // set $smarty->deprecation_notices
$smarty->setCacheId($id); // set $smarty->cache_id
$debugging = $smarty->getDebugging(); // get $smarty->debugging
DESCRIPTION:
FILE STRUCTURE
What is Smarty?
The Smarty 3 file structure is similar to Smarty 2:
Smarty is a template engine for PHP. Many other template engines for PHP
provide basic variable substitution and dynamic block functionality.
Smarty takes a step further to be a "smart" template engine, adding
features such as configuration files, template functions, and variable
modifiers, and making all of this functionality as easy as possible to
use for both programmers and template designers. Smarty also converts
the templates into PHP scripts, eliminating the need to parse the
templates on every invocation. This makes Smarty extremely scalable and
manageable for large application needs.
/libs/
Smarty.class.php
/libs/sysplugins/
internal.*
/libs/plugins/
function.mailto.php
modifier.escape.php
...
Some of Smarty's features:
A lot of Smarty 3 core functionality lies in the sysplugins directory; you do
not need to change any files here. The /libs/plugins/ folder is where Smarty
plugins are located. You can add your own here, or create a separate plugin
directory, just the same as Smarty 2. You will still need to create your own
/cache/, /templates/, /templates_c/, /configs/ folders. Be sure /cache/ and
/templates_c/ are writable.
* it is extremely fast
* no template parsing overhead, only compiles once.
* it is smart about recompiling only the template files that have
changed.
* the template language is remarkably extensible via the plugin
architecture.
* configurable template delimiter tag syntax, so you can use
{}, {{}}, <!--{}-->, or whatever you like.
* built-in caching of template output.
* arbitrary template sources (filesystem, databases, etc.)
* template if/elseif/else/endif constructs are passed to the PHP parser,
so the if syntax can be as simple or as complex as you like.
* unlimited nesting of sections, conditionals, etc. allowed
* it is possible to embed PHP code right in your template files,
although not recommended and doubtfully needed since the engine
is so customizable.
* and many more.
The typical way to use Smarty 3 should also look familiar:
COPYRIGHT:
Copyright (c) 2001-2005 New Digital Group, Inc. All rights reserved.
This software is released under the GNU Lesser General Public License.
Please read the disclaimer at the top of the Smarty.class.php file.
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->assign('foo','bar');
$smarty->display('index.tpl');
However, Smarty 3 works completely different on the inside. Smarty 3 is mostly
backward compatible with Smarty 2, except for the following items:
*) Smarty 3 is PHP 5 only. It will not work with PHP 4.
*) The {php} tag is disabled by default. Enable with $smarty->allow_php_tag=true.
*) Delimiters surrounded by whitespace are no longer treated as Smarty tags.
Therefore, { foo } will not compile as a tag, you must use {foo}. This change
Makes Javascript/CSS easier to work with, eliminating the need for {literal}.
This can be disabled by setting $smarty->auto_literal = false;
*) The Smarty 3 API is a bit different. Many Smarty 2 API calls are deprecated
but still work. You will want to update your calls to Smarty 3 for maximum
efficiency.
There are many things that are new to Smarty 3. Here are the notable items:
LEXER/PARSER
============
Smarty 3 now uses a lexing tokenizer for its parser/compiler. Basically, this
means Smarty has some syntax additions that make life easier such as in-template
math, shorter/intuitive function parameter options, infinite function recursion,
more accurate error handling, etc.
WHAT IS NEW IN SMARTY TEMPLATE SYNTAX
=====================================
Smarty 3 allows expressions almost anywhere. Expressions can include PHP
functions as long as they are not disabled by the security policy, object
methods and properties, etc. The {math} plugin is no longer necessary but
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
{$foo[$x+3]} as array index
Smarty tags can be used as values within other tags.
Example: {$foo={counter}+3}
Smarty tags can also be used inside double quoted strings.
Example: {$foo="this is message {counter}"}
You can define arrays within templates.
Examples:
{assign var=foo value=[1,2,3]}
{assign var=foo value=['y'=>'yellow','b'=>'blue']}
Arrays can be nested.
{assign var=foo value=[1,[9,8],3]}
There is a new short syntax supported for assigning variables.
Example: {$foo=$bar+2}
You can assign a value to a specific array element. If the variable exists but
is not an array, it is converted to an array before the new values are assigned.
Examples:
{$foo['bar']=1}
{$foo['bar']['blar']=1}
You can append values to an array. If the variable exists but is not an array,
it is converted to an array before the new values are assigned.
Example: {$foo[]=1}
You can use a PHP-like syntax for accessing array elements, as well as the
original "dot" notation.
Examples:
{$foo[1]} normal access
{$foo['bar']}
{$foo['bar'][1]}
{$foo[$x+$x]} index may contain any expression
{$foo[$bar[1]]} nested index
{$foo[section_name]} smarty section access, not array access!
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'] 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.
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}_buh_{$blar} variable name with multiple segments
{$foo_{$x}} will output the variable $foo_1 if $x has a value of 1.
Object method chaining is implemented.
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
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 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
$x@total = total number of iterations
$x@first = true on first iteration
$x@last = true on last iteration
The Smarty 2 {section} syntax is still supported.
New shorter {foreach} syntax to loop over an array.
Example: {foreach $myarray as $var}...{/foreach}
Within the foreach loop, properties are access via:
$var@key foreach $var array key
$var@iteration foreach current iteration count (1,2,3...)
$var@index foreach current index count (0,1,2...)
$var@total foreach $var array total
$var@first true on first iteration
$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.
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}.
while block tag is now implemented:
{while $foo}...{/while}
{while $x lt 10}...{/while}
Direct access to PHP functions:
Just as you can use PHP functions as modifiers directly, you can now access
PHP functions directly, provided they are permitted by security settings:
{time()}
There is a new {function}...{/function} block tag to implement a template function.
This enables reuse of code sequences like a plugin function. It can call itself recursively.
Template function must be called with the new {call name=foo...} tag.
Example:
Template file:
{function name=menu level=0}
<ul class="level{$level}">
{foreach $data as $entry}
{if is_array($entry)}
<li>{$entry@key}</li>
{call name=menu data=$entry level=$level+1}
{else}
<li>{$entry}</li>
{/if}
{/foreach}
</ul>
{/function}
{$menu = ['item1','item2','item3' => ['item3-1','item3-2','item3-3' =>
['item3-3-1','item3-3-2']],'item4']}
{call name=menu data=$menu}
Generated output:
* item1
* item2
* item3
o item3-1
o item3-2
o item3-3
+ item3-3-1
+ item3-3-2
* item4
The function tag itself must have the "name" attribute. This name is the tag
name when calling the function. The function tag may have any number of
additional attributes. These will be default settings for local variables.
New {nocache} block function:
{nocache}...{/nocache} will declare a section of the template to be non-cached
when template caching is enabled.
New nocache attribute:
You can declare variable/function output as non-cached with the nocache attribute.
Examples:
{$foo nocache=true}
{$foo nocache} /* same */
{foo bar="baz" nocache=true}
{foo bar="baz" nocache} /* same */
{time() nocache=true}
{time() nocache} /* same */
Or you can also assign the variable in your script as nocache:
$smarty->assign('foo',$something,true); // third param is nocache setting
{$foo} /* non-cached */
$smarty.current_dir returns the directory name of the current template.
You can use strings directly as templates with the "string" resource type.
Examples:
$smarty->display('string:This is my template, {$foo}!'); // php
{include file="string:This is my template, {$foo}!"} // template
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
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.
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
from the Smarty object.
All known Smarty assignment interfaces will work on the data and template objects.
Besides the above mentioned objects, there is also a special storage area for
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= $smarty->createData($smarty); // create data object having a parent link to
the Smarty object
$data2= $smarty->createData($data); // create data object having a parent link to
the $data data object
A template object can be created by using the createTemplate method. It has the
same parameter assignments as the fetch() or display() method.
Function definition:
function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null)
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 = $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
The standard fetch() and display() methods will implicitly create a template object.
If the $parent parameter is not specified in these method calls, the template object
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.
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.
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.
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
{$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
{$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,
{$foo='bar' scope='global'} // they are available to any and all templates.
The scope attribute can also be attached to the {include...} tag. In this case,
the specified scope will be the default scope for all assignments within the
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.
The smarty object can be still be accessed through $template->smarty.
smarty_plugintype_name (array $params, Smarty_Internal_Template $template)
The Smarty 2 plugins are still compatible as long as they do not make use of specific Smarty 2 internals.
TEMPLATE INHERITANCE:
=====================
With template inheritance you can define blocks, which are areas that can be
overridden by child templates, so your templates could look like this:
parent.tpl:
<html>
<head>
<title>{block name='title'}My site name{/block}</title>
</head>
<body>
<h1>{block name='page-title'}Default page title{/block}</h1>
<div id="content">
{block name='content'}
Default content
{/block}
</div>
</body>
</html>
child.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}
{block name='page-title'}My home{/block}
{block name='content'}
{foreach $images as $img}
<img src="{$img.url}" alt="{$img.description}" />
{/foreach}
{/block}
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 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:
<html>
<head>
<title>Home - Child title</title>
</head>
<body>
<h1>My home</h1>
<div id="content">
<img src="/example.jpg" alt="image" />
<img src="/example2.jpg" alt="image" />
<img src="/example3.jpg" alt="image" />
</div>
</body>
</html>
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
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
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
is appended or prepended to the child block content.
{block name='title' append} My title {/block}
PHP STREAMS:
============
(see online documentation)
VARIBLE FILTERS:
================
(see online documentation)
STATIC CLASS ACCESS AND NAMESPACE SUPPORT
=========================================
You can register a class with optional namespace for the use in the template like:
$smarty->register->templateClass('foo','name\name2\myclass');
In the template you can use it like this:
{foo::method()} etc.
=======================
Please look through it and send any questions/suggestions/etc to the forums.
http://www.phpinsider.com/smarty-forum/viewtopic.php?t=14168
Monte and Uwe
+70 -15
View File
@@ -1,23 +1,78 @@
#Smarty 2 template engine
##Distribution repository
Starting with Smarty 2.6.23 Composer has been configured to load the packages from github.
**NOTE: Because of this change you must clear your local composer cache with the "composer clearcache" command**
# Smarty 3 template engine
[smarty.net](https://www.smarty.net/)
To get the latest stable version use
[![Build Status](https://travis-ci.org/smarty-php/smarty.svg?branch=master)](https://travis-ci.org/smarty-php/smarty)
"require": {
"smarty/smarty": "~2.6"
}
## Documentation
in your composer.json file.
To get the trunk version use
For documentation see
[www.smarty.net/docs/en/](https://www.smarty.net/docs/en/)
## Requirements
Smarty can be run with PHP 5.2 to PHP 7.4.
## Distribution repository
> Smarty 3.1.28 introduces run time template inheritance
> Read the NEW_FEATURES and INHERITANCE_RELEASE_NOTES file for recent extensions to Smarty 3.1 functionality
Smarty versions 3.1.11 or later are now on github and can be installed with Composer.
"require": {
"smarty/smarty": "~2.6@dev"
}
The "smarty/smarty" package will start at libs/.... subfolder.
To get the latest stable version of Smarty 3.1 use:
```json
"require": {
"smarty/smarty": "~3.1"
}
```
in your composer.json file.
To get the trunk version use:
```json
"require": {
"smarty/smarty": "~3.1@dev"
}
```
For a specific version use something like:
```json
"require": {
"smarty/smarty": "3.1.19"
}
```
PHPUnit test can be installed by corresponding composer entries like:
```json
"require": {
"smarty/smarty-phpunit": "3.1.19"
}
```
Similar applies for the lexer/parser generator.
```json
"require": {
"smarty/smarty-lexer": "3.1.19"
}
```
Or you could use:
```json
"require": {
"smarty/smarty-dev": "3.1.19"
}
```
Which is a wrapper to install all 3 packages.
Composer can also be used for Smarty2 versions 2.6.24 to 2.6.30.
-428
View File
@@ -1,428 +0,0 @@
2.6.7
-----
Those using Smarty with security enabled: a hole was found that allowed PHP code to be executed from within a template file. This has been fixed and you are engouraged to upgrade immediately. Note that this hole does NOT affect the security of your web server or PHP applications, only the ability for someone editing a template to execute PHP code. Other changes in this release can be found in the NEWS file.
2.5.0
-----
Very minor adjustments since RC2, see the NEWS file for details.
2.5.0-RC2
---------
Many fixes since the RC1 release. This one is as close to production quality as
they come, so this will be the last release before 2.5.0. The SGML documentation
files have also been removed from the tarball. If you want them, get them from
the CVS repository.
2.5.0-RC1
---------
Release Candidate 1. All $smarty vars can now be dynamic, such as
$smarty.get.$foo. A new class function get_function_object() gets you a
reference to an assigned object, useful within your own custom functions.
append() can now merge as well as append with a third optional attribute. A new
class function get_config_vars() was added, and get_template_vars() can now be
used to get individual vars. Full variable syntax is now supported within
double quotes via a backtick (`) syntax. Files created by smarty are now
written to a tmp file then renamed to avoid file lock retention. html_radios,
html_checkboxes, html_table, html_image, nl2br functions added, see the NEWS
file for full details.
2.4.2
-----
Another point release. Added support for dynamic object reference syntax
($foo->$bar), support for full variable syntax within quotes ("$foo[0].bar"),
and other minor fixes. See the NEWS file for full details.
2.4.1
-----
This is basically a point release, cleaning up a few things caught
in the 2.4.0 release. See the NEWS file for full details.
2.4.0
-----
Smarty now supports the ability to access objects within the templates. Two
methods are available, one which closely follows Smartys conventions, and
another that follows more traditional object syntax for those familiar with
PHP.
The internal compiling engine has also undergone some major work. The regex
parsing was rewritten to be much more strict, more secure and more
maintainable. Config files are now compiled, which can speed up pages quite a
bit that use config files extensively. Assigned variables are no longer
extracted to PHP namespace, saving an extract call for every template. There is
now support for applying modifiers to static values and functions. You can now
access constants with $smarty.const.VAR. See the NEWS file for complete
changes.
2.3.1
-----
The mtime on compiled files will now match the source files, in the case where
the source file may not get the current timestamp, recompiling will still work
as expected. Proper support for open_basedir has been added, so Smarty should
work correctly in safe mode. Added a few new features such as textformat block
function, strip variable modifier and optgroup support for html_options. Also
other minor bug fixes, see the Change Log.
2.3.0
-----
Smarty now has a {debug} template function that brings up the debugging console
right where {debug} is called, regardless of $debugging settings. This works a
little different than turning on $debugging in the sense that it shows all the
template variables available at the time {debug} is called, including local
scope vars. It does not show the templates names however, since this
executed during runtime of the template.
You can now supply an expire time when clearing cache or compile files. This is
mostly useful for removing stale files via the API.
Plugins now stop execution upon error, instead of outputting a warning and
continuing.
Two new API functions, assign_by_ref() and append_by_ref() were added. They
allow assigning template variables by reference. This can make a significant
performance gain, especially if you are assigning large arrays of data. PHP 5.0
will do this implicitly, so these functions are basically workarounds.
Several misc bug fixes, see the Change Log for information.
2.2.0
-----
Smarty now allows an array of paths for the $plugin_dir class variable. The
directories will be searched in the order they are given, so for efficiency keep
the most-used plugins at the top. Also, absolute paths to the plugin directories are
more efficient than relying on the PHP include_path.
Cache files can now be grouped with the cache_id. See the documentation under
the new "Caching" section for details. compile_id also respects the same
grouping syntax. The cache/compile file structure changed, so be sure to clear
out all your cache and compile files when upgrading Smarty. Also if you are
using PHP-accelerator, restart apache. I've seen some quirky things happen if
the phpa files do not get cleared (known issue with phpa and parent
class-member changes, so just clear 'em.)
Smarty now correctly respects the PHP include_path for $template_dir, $compile_dir,
$cache_dir, $config_dir and $plugin_dir. Be aware that relying on the
include_path is an overhead, try to use absolute pathnames when possible
(or relative to working directory.)
Documentation has been updated and rearranged a bit. Most notably, the
installation instructions are completely revamped, and a new Caching section
explains Smarty's caching in detail along with the new grouping functionality.
Many misc. bug fixes and enhancements, see the full ChangeLog (NEWS file) for
details.
2.1.1
-----
There was a bug with template paths and the include_path, this has been fixed.
Also register_outputfilter() did not work, this is fixed. A new template
function named "cycle" has been added to the distribution, nice for cycling
through a list (or array) of values.
2.1.0
-----
This release has quite a few new features and fixes. Most notable are the
introduction of block functions, so you can write plugins that work on a block
of text with {func}{/func} notation. Also output filters were added, so you can
apply a function against the output of your templates. This differs from the
postfilter function, which works on the compiled template at compile time, and
output filters work on the template output at runtime.
Many other features and bug fixes are noted in the NEWS file.
2.0.1
-----
This is a point release, fixing a few bugs and cleaning things up. A plugin
was renamed, the dash "-" was removed from compiled template and cached file
names. If you're upgrading, you might want to clear them out first. See the
ChangeLog for details.
2.0.0
-----
This release is a huge milestone for Smarty. Most notable new things are a
plugin architecture, removal of PEAR dependency, and optimizations that
drastically improve the performance of Smarty in most cases.
The plugin architecture allows modifiers, custom functions, compiler functions,
prefilters, postfilters, resources, and insert functions to be added by
simply dropping a file into the plugins directory. Once dropped in, they are
automatically registered by the template engine. This makes user-contributed
plugins easy to manage, as well as the internal workings of Smarty easy to
control and customize. This new architecture depends on the __FILE__ constant,
which contains the full path to the executing script. Some older versions of
PHP incorrectly gave the script name and not the full filesystem path. Be sure
your version of PHP populates __FILE__ correctly. If you use custom template
resource functions, the format of these changed with the plugin architecture.
Be sure to update your functions accordingly. See the template resource section
of the documentation.
The PEAR dependancy was removed from Smarty. The Config_File class that comes
with Smarty was actually what needed PEAR for error handling which Smarty didn't
use, but now everything is self-contained.
Performance improvements are graphed on the benchmark page, you will see that
overall performance has been sped up by as much as 80% in some cases.
Smarty-cached pages now support If-Modified-Since headers, meaning that if a
cached template page has not changed since the last request, a "304 Not
Modified" header will be sent instead of resending the same page. This is
disabled by default, change the setting of $cache_modified_check.
1.5.2
-----
Mostly bug fixes, added a default template resource handler.
1.5.1
-----
Critical bug fix release. If you use caching, you'll need to upgrade.
1.5.0
-----
Several feature enhancements were made to this version, most notably the
{foreach ...} command which is an alternative to {section ...} with an easier
syntax for looping through a single array of values. Several functions were
enhanced so that the output can be automatically assigned to a template
variable instead of displayed (assign attribute). Cache files can now be
controlled with a custom function as an alternative to the built-in file based
method. Many code cleanups and bug fixed went into this release as well.
1.4.6
-----
The behavior with caching and compile_check has been slightly enhanced. If
caching is enabled AND compile_check is enabled, the cache will immediately get
regenerated if _any_ involved template or config file is updated. This imposes
a slight performance hit because it must check all the files for changes, so be
sure to run live sites with caching enabled and compile_check disabled for best
performance. If you update a template or config file, simply turn on
compile_check, load the page, then turn it back off. This will update the cache
file with the new content. This is accomplished by maintaining a list of
included/loaded templates and config files at the beginning of the cache file.
Therefore it is advisable to remove all cache files after upgrading to 1.4.6
(although not absolutely necessary, old cache files will regenerate)
The debug console now has script timing and array values printed. You MUST
update your debug.tpl file with this version of Smarty. Also, the new debug.tpl
will not work with older versions of Smarty.
1.4.5
-----
Mostly bug fixes and minor improvements. Added compile id for separate compiled
versions of the same script. The directory format and filename convention for
the files in templates_c has changed, so you may want to remove all of the
existing ones before you upgrade.
1.4.4
-----
A few bug fixes, new section looping attributes and properties, debugging
console function for control via URL, and overLib integration and access
to request variables from within the template.
1.4.3
-----
This release has a few bug fixes and several enhancements. Smarty now supports
template security for third-party template editing. These features disallow the
ability for someone to execute commands or PHP code from the template language.
Smarty also now has a built-in debugging console, which is a javascript pop-up
window that displays all the included template names and assigned variables.
1.4.2
-----
This was mostly one bug fix with variable scoping within included templates
and a few documentation changes and updates. See the ChangeLog file for full
details.
1.4.1
-----
It seems that the EX_LOCK logic from the previous release didn't fix all the
problems with windows platforms. Hopefully this one does. It basically
disables file locking on windows, so there is a potential that two programs
could write over the same file at the same time, fyi.
The reset is minor bug fixes, please refer to the ChangeLog file.
1.4.0
-----
IMPORTANT NOTICE
Smarty now has a new syntax for accessing elements within section loops. The
new syntax is easier to use and nicely handles data structures of any
complexity. Consequently, this breaks the old syntax.
Here is an example of the syntax change:
old syntax:
{$sec1/sec2/sec3/customer.phone}
new syntax:
{$customer[$sec1][$sec2][$sec3].phone}
The section names used to come first, followed by the variable name. Now the
variable name always comes first, followed by the section names in brackets.
You can access variable indexes anywhere, depending on how you passed the
variables in.
To fix your current templates, we have provided a script that will adjust the
syntax for you. Located in misc/fix_vars.php, run this script from the the
command line, giving each template as an argument. Be sure to use absolute
pathnames, or pathnames relative to the executing script. Probably the easiest
way to do this is to copy the fix_vars.php script into your template directory
and run 'php -q fix_vars.php *.tpl' Be sure you have proper write permission,
and backup your scripts first to be safe! The examples in the 1.4.0
documentation have been updated to reflect the changes.
cd /path/to/templates
cp /path/to/fix_vars.php .
find . -name "*.tpl" -exec php -q ./fix_vars.php {} \;
NEW AND IMPROVED COMPILATION PROCESS
Smarty 1.4.0 also has a new compilation process. Instead of compiling all the
templates up front, it now compiles them at runtime. This has several
advantages. First of all, there is no longer a need to have a single template
directory. You can now have arbitrary template sources, such as multiple
directories or even database calls. This also speeds the performance of Smarty
when $compile_check is enabled, since it is only checking the template that is
being executed instead of everything found in the template directory. The
$tpl_file_ext is no longer needed, but kept for backward compatability.
Templates can now be named anything you like with any extension.
MINOR FIXES
A workaround for LOCK_EX on Windows systems was added, and changed a couple of
file permissions for better security on public servers.
$show_info_header is now defaulted to false instead of true. This header causes
problems when displaying content other than HTML, so now you must explicitly
set this flag to true to show the header information (or change the default in
your copy of Smarty.)
Documentation is written in docbook format. I updated the docbook -> HTML
generating software & style-sheets, and consequently the examples are no longer
in a different background color. If anyone wants to contribute a better
stylesheet or help with documentation, drop me a line. <monte at ohrt dot com>
CHANGES/ENHANCEMENTS/UPDATES
date_format, html_select_date and html_select_time used to require a unix
timestamp as the format of the date passed into the template. Smarty is now a
bit smarter at this. It will take a unix timestamp, a mysql timestamp, or any
date string that is parsable by strtotime, such as 10/01/2001 or 2001-10-01,
etc. Just give some formats a try and see what works.
Smarty now has template prefilters, meaning that you can run your templates
through custom functions before they are compiled. This is good for things like
removing unwanted comments, keeping an eye on words or functionality people are
putting in templates, translating XML -> HTML, etc. See the register_prefilter
documentation for more info.
Another addition are the so-called compiler functions. These are custom
functions registered by the user that are executed at compilation time of the
template. They can be used to inject PHP code or time-sensitive static content
into the compiled template.
The run-time custom functions are now passed the Smarty object as the second
parameter. This can be used, for example, to assign or clear template variables
from inside the custom function.
clear_compile_dir() was added for clearing out compiled versions of your
templates. Not something normally needed, but you may have a need for this if
you have $compile_check set to false and you periodically update templates via
some automated process. As of 1.4.0, uncompiled templates _always_ get
compiled regardless of $compile_check setting, although they won't be checked
for recompile if $compile_check is set to false.
You can now refer to properties of objects assigned from PHP by using the '->'
symbol and specifying the property name after it, e.g. $foo->bar.
{php}{/php} tags were added to embed php into the templates. Not normally
needed, but some circumstances may call for it. Check out the "componentized
templates" tip in the documentation for an example.
{capture}{/capture} and {counter} functions were added. See the documentation
for a complete description and examples.
UPGRADE NOTES
The format of the files created in the $compile_dir are now a bit different.
The compiled template filename is the template resource name url-encoded.
Therefore, all compiled files are now in the top directory of $compile_dir.
This was done to make way for arbitrary template resources. Each compiled
template also has a header that states what template resource was used to
create it. From a unix command prompt, you can use "head -2 *" to see the first
two lines of each file.
When upgrading to 1.4.0, you will want to clear out all your old files in the
$compile_dir. If you have $compile_check set to false and the compiled template
does not yet exist, it will compile it regardless of this setting. This way you
can clear out the $compile_dir and not worry about setting $compile_check to
true to get the inital compilation under way.
1.3.2
-----
Smarty now has (an optional) header prepended to the output of the Smarty
templates. This displays the Smarty version and the date/time when the page was
generated. This is useful for debugging your cache routines, and purely
informational so there is evidence that the page was generated by Smarty. Set
$show_info_header to false to disable it.
{config_load ...} performance was tuned by placing the loaded variables into a
global array, so basically a config file is read from the file system and
placed into a php array structure only once, no matter how many times it is
called in any of the templates. The scope of the loaded variables has changed a
bit as well. Variables loaded by config_load used to be treated as global
variables, meaning that parent templates (templates that included the current
template) could see them. Now the default behavior is such that loaded
variables are only visible by the current template and child templates (all
templates included after the {config_load ...} is called.) To mimic the
original behavior, provide the attribute "global=yes" like so: {config_load
file="mystuff.conf" global=yes}. Now when you load in mystuff.conf, the
variables will be visible to parent templates (merged with any existing config
variables.)
A formatting attribute was added to the {math ...} function, adding the ability
to control the format of the output. Use the same formatting syntax as the PHP
function sprintf().
{html_select_time ...} was added, a custom function that works much like
{html_select_date ...} except it displays time elements instead of dates.
A few custom modifiers were added: count_characters, count_words,
count_sentences, count_paragraphs. All pretty self-explanatory.
/* vim: set et: */
+109
View File
@@ -0,0 +1,109 @@
= Known incompatibilities with Smarty 2 =
== 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
information.
The {$array|@mod} syntax has always been a bit confusing, where an "@" is required
to apply a modifier to an array instead of the individual elements. Normally you
always want the modifier to apply to the variable regardless of its type. In Smarty 3,
{$array|mod} and {$array|@mod} behave identical. It is safe to drop the "@" and the
modifier will still apply to the array. If you really want the modifier to apply to
each array element, you must loop the array in-template, or use a custom modifier that
supports array iteration. Most smarty functions already escape values where necessary
such as {html_options}
== PHP Version ==
Smarty 3 is PHP 5 only. It will not work with PHP 4.
== {php} Tag ==
The {php} tag is disabled by default. The use of {php} tags is
deprecated. It can be enabled with $smarty->allow_php_tag=true.
But if you scatter PHP code which belongs together into several
{php} tags it may not work any longer.
== Delimiters and whitespace ==
Delimiters surrounded by whitespace are no longer treated as Smarty tags.
Therefore, { foo } will not compile as a tag, you must use {foo}. This change
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_)
For example filename strings must be quoted
<source lang="smarty">
{include file='path/foo.tpl'}
</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.
<source lang="php">
class MySmarty extends Smarty {
function __construct() {
parent::__construct();
// your initialization code goes here
}
}
</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
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.
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
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
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
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.
If one of the {if} tags is at the line end you will now get a newline in the HTML output.
== trigger_error() ==
The API function trigger_error() has been removed because it did just map to PHP trigger_error.
However it's still included in the Smarty2 API wrapper.
== Smarty constants ==
The constants
SMARTY_PHP_PASSTHRU
SMARTY_PHP_QUOTE
SMARTY_PHP_REMOVE
SMARTY_PHP_ALLOW
have been replaced with class constants
Smarty::PHP_PASSTHRU
Smarty::PHP_QUOTE
Smarty::PHP_REMOVE
Smarty::PHP_ALLOW
+24
View File
@@ -0,0 +1,24 @@
== Smarty2 backward compatibility ==
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.
== {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.
== php template resource ==
The support of the php template resource is removed.
== $cache_dir, $compile_dir, $config_dir, $template_dir access ==
The mentioned properties can't be accessed directly any longer. You must use
corresponding getter/setters like addConfigDir(), setConfigDir(), getConfigDir()
== obsolete Smarty class properties ==
The following no longer used properties are removed:
$allow_php_tag
$allow_php_template
$deprecation_notices
+306
View File
@@ -0,0 +1,306 @@
Smarty 3.1 Notes
================
Smarty 3.1 is a departure from 2.0 compatibility. Most notably, all
backward compatibility has been moved to a separate class file named
SmartyBC.class.php. If you require compatibility with 2.0, you will
need to use this class.
Some differences from 3.0 are also present. 3.1 begins the journey of
requiring setters/getters for property access. So far this is only
implemented on the five directory properties: template_dir,
plugins_dir, configs_dir, compile_dir and cache_dir. These properties
are now protected, it is required to use the setters/getters instead.
That said, direct property access will still work, however slightly
slower since they will now fall through __set() and __get() and in
turn passed through the setter/getter methods. 3.2 will exhibit a full
list of setter/getter methods for all (currently) public properties,
so code-completion in your IDE will work as expected.
There is absolutely no PHP allowed in templates any more. All
deprecated features of Smarty 2.0 are gone. Again, use the SmartyBC
class if you need any backward compatibility.
Internal Changes
Full UTF-8 Compatibility
The plugins shipped with Smarty 3.1 have been rewritten to fully
support UTF-8 strings if Multibyte String is available. Without
MBString UTF-8 cannot be handled properly. For those rare cases where
templates themselves have to juggle encodings, the new modifiers
to_charset and from_charset may come in handy.
Plugin API and Performance
All Plugins (modifiers, functions, blocks, resources,
default_template_handlers, etc) are now receiving the
Smarty_Internal_Template instance, where they were supplied with the
Smarty instance in Smarty 3.0. *. As The Smarty_Internal_Template
mimics the behavior of Smarty, this API simplification should not
require any changes to custom plugins.
The plugins shipped with Smarty 3.1 have been rewritten for better
performance. Most notably {html_select_date} and {html_select_time}
have been improved vastly. Performance aside, plugins have also been
reviewed and generalized in their API. {html_select_date} and
{html_select_time} now share almost all available options.
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 capital letter are lower-cased.
The count_sentences modifier now accepts (.?!) as
legitimate endings of a sentence - previously only (.) was
accepted
The new unescape modifier is there to reverse the effects of the
escape modifier. This applies to the escape formats html, htmlall and
entity.
default_template_handler_func
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:
/**
* 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
* could be loaded
*/
function default_template_handler_func($type, $name, &$content, &$modified, Smarty $smarty) {
if (false) {
// return corrected filepath
return "/tmp/some/foobar.tpl";
} elseif (false) {
// return a template directly
$content = "the template source";
$modified = time();
return true;
} else {
// tell smarty that we failed
return false;
}
}
Stuff done to the compiler
Many performance improvements have happened internally. One notable
improvement is that all compiled templates are now handled as PHP
functions. This speeds up repeated templates tremendously, as each one
calls an (in-memory) PHP function instead of performing another file
include/scan.
New Features
Template syntax
{block}..{/block}
The {block} tag has a new hide option flag. It does suppress the block
content if no corresponding child block exists.
EXAMPLE:
parent.tpl
{block name=body hide} child content "{$smarty.block.child}" was
inserted {block}
In the above example the whole block will be suppressed if no child
block "body" is existing.
{setfilter}..{/setfilter}
The new {setfilter} block tag allows the definition of filters which
run on variable output.
SYNTAX:
{setfilter filter1|filter2|filter3....}
Smarty3 will lookup up matching filters in the following search order:
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
{/setfilter} will turn previous filter setting off again.
{setfilter} tags can be nested.
EXAMPLE:
{setfilter filter1}
{$foo}
{setfilter filter2}
{$bar}
{/setfilter}
{$buh}
{/setfilter}
{$blar}
In the above example filter1 will run on the output of $foo, filter2
on $bar, filter1 again on $buh and no filter on $blar.
NOTES:
- {$foo nofilter} will suppress the filters
- These filters will run in addition to filters defined by
registerFilter('variable',...), autoLoadFilter('variable',...) and
defined default modifier.
- {setfilter} will effect only the current template, not included
subtemplates.
Resource API
Smarty 3.1 features a new approach to resource management. The
Smarty_Resource API allows simple, yet powerful integration of custom
resources for templates and configuration files. It offers simple
functions for loading data from a custom resource (e.g. database) as
well as define new template types adhering to the special
non-compiling (e,g, plain php) and non-compile-caching (e.g. eval:
resource type) resources.
See demo/plugins/resource.mysql.php for an example custom database
resource.
Note that old-fashioned registration of callbacks for resource
management has been deprecated but is still possible with SmartyBC.
CacheResource API
In line with the Resource API, the CacheResource API offers a more
comfortable handling of output-cache data. With the
Smarty_CacheResource_Custom accessing databases is made simple. With
the introduction of Smarty_CacheResource_KeyValueStore the
implementation of resources like memcache or APC became a no-brainer;
simple hash-based storage systems are now supporting hierarchical
output-caches.
See demo/plugins/cacheresource.mysql.php for an example custom
database CacheResource.
See demo/plugins/cacheresource.memcache.php for an example custom
memcache CacheResource using the KeyValueStore helper.
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
$smarty->cache_locking = true;
Relative Paths in Templates (File-Resource)
As of Smarty 3.1 {include file="../foo.tpl"} and {include
file="./foo.tpl"} will resolve relative to the template they're in.
Relative paths are available with {include file="..."} and
{extends file="..."}. As $smarty->fetch('../foo.tpl') and
$smarty->fetch('./foo.tpl') cannot be relative to a template, an
exception is thrown.
Addressing a specific $template_dir
Smarty 3.1 introduces the $template_dir index notation.
$smarty->fetch('[foo]bar.tpl') and {include file="[foo]bar.tpl"}
require the template bar.tpl to be loaded from $template_dir['foo'];
Smarty::setTemplateDir() and Smarty::addTemplateDir() offer ways to
define indexes along with the actual directories.
Mixing Resources in extends-Resource
Taking the php extends: template resource one step further, it is now
possible to mix resources within an extends: call like
$smarty->fetch("extends:file:foo.tpl|db:bar.tpl");
To make eval: and string: resources available to the inheritance
chain, eval:base64:TPL_STRING and eval:urlencode:TPL_STRING have been
introduced. Supplying the base64 or urlencode flags will trigger
decoding the TPL_STRING in with either base64_decode() or urldecode().
extends-Resource in template inheritance
Template based inheritance may now inherit from php's extends:
resource like {extends file="extends:foo.tpl|db:bar.tpl"}.
New Smarty property escape_html
$smarty->escape_html = true will autoescape all template variable
output by calling htmlspecialchars({$output}, ENT_QUOTES,
SMARTY_RESOURCE_CHAR_SET).
NOTE:
This is a compile time option. If you change the setting you must make
sure that the templates get recompiled.
New option at Smarty property compile_check
The automatic recompilation of modified templates can now be
controlled by the following settings:
$smarty->compile_check = COMPILECHECK_OFF (false) - template files
will not be checked
$smarty->compile_check = COMPILECHECK_ON (true) - template files will
always be checked
$smarty->compile_check = COMPILECHECK_CACHEMISS - template files will
be checked if caching is enabled and there is no existing cache file
or it has expired
Automatic recompilation on Smarty version change
Templates will now be automatically recompiled on Smarty version
changes to avoide incompatibillities in the compiled code. Compiled
template checked against the current setting of the SMARTY_VERSION
constant.
default_config_handler_func()
Analogous to the default_template_handler_func()
default_config_handler_func() has been introduced.
default_plugin_handler_func()
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.
New getters/setters
The following setters/getters will be part of the official
documentation, and will be strongly recommended. Direct property
access will still work for the foreseeable future... it will be
transparently routed through the setters/getters, and consequently a
bit slower.
array|string getTemplateDir( [string $index] )
replaces $smarty->template_dir; and $smarty->template_dir[$index];
Smarty setTemplateDir( array|string $path )
replaces $smarty->template_dir = "foo"; and $smarty->template_dir =
array("foo", "bar");
Smarty addTemplateDir( array|string $path, [string $index])
replaces $smarty->template_dir[] = "bar"; and
$smarty->template_dir[$index] = "bar";
array|string getConfigDir( [string $index] )
replaces $smarty->config_dir; and $smarty->config_dir[$index];
Smarty setConfigDir( array|string $path )
replaces $smarty->config_dir = "foo"; and $smarty->config_dir =
array("foo", "bar");
Smarty addConfigDir( array|string $path, [string $index])
replaces $smarty->config_dir[] = "bar"; and
$smarty->config_dir[$index] = "bar";
array getPluginsDir()
replaces $smarty->plugins_dir;
Smarty setPluginsDir( array|string $path )
replaces $smarty->plugins_dir = "foo";
Smarty addPluginsDir( array|string $path )
replaces $smarty->plugins_dir[] = "bar";
string getCompileDir()
replaces $smarty->compile_dir;
Smarty setCompileDir( string $path )
replaces $smarty->compile_dir = "foo";
string getCacheDir()
replaces $smarty->cache_dir;
Smarty setCacheDir( string $path )
replaces $smarty->cache_dir;
-10
View File
@@ -1,10 +0,0 @@
* handle asp style tags in $php_handler
* fix all E_NOTICE warnings
* make simple math easier
* caching all but parts of the template
* change plugins so $smarty variable always comes first
* get cache ttl with function call
FIX: make inserts use normal functions before plugins
UPD: change it so that if template comes from some resource,
that resource stays as the default, no need to specify it
in includes.
+2
View File
@@ -0,0 +1,2 @@
# Pre-release Todos
+14 -7
View File
@@ -2,7 +2,9 @@
"name": "smarty/smarty",
"type": "library",
"description": "Smarty - the compiling PHP template engine",
"keywords": ["templating"],
"keywords": [
"templating"
],
"homepage": "http://www.smarty.net",
"license": "LGPL-3.0",
"authors": [
@@ -13,11 +15,15 @@
{
"name": "Uwe Tews",
"email": "uwe.tews@googlemail.com"
},
{
"name": "Rodney Rehm",
"email": "rodney.rehm@medialize.de"
}
],
"support": {
"irc": "irc://irc.freenode.org/smarty",
"issues": "http://code.google.com/p/smarty-php/issues/list",
"issues": "https://github.com/smarty-php/smarty/issues",
"forum": "http://www.smarty.net/forums/"
},
"require": {
@@ -25,15 +31,16 @@
},
"autoload": {
"classmap": [
"libs/Smarty.class.php",
"libs/Smarty_Compiler.class.php",
"libs/Config_File.class.php"
"libs/"
]
},
"extra": {
"branch-alias": {
"dev-master": "2.6.x-dev"
"dev-master": "3.1.x-dev"
}
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^6.5 || ^5.7 || ^4.8",
"smarty/smarty-lexer": "^3.1"
}
}
+29 -19
View File
@@ -1,25 +1,35 @@
<?php
/**
* Example Application
*
* @package Example-application
*/
require '../libs/Smarty.class.php';
$smarty = new Smarty;
$smarty->compile_check = true;
//$smarty->force_compile = true;
$smarty->debugging = true;
$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill");
$smarty->assign("FirstName",array("John","Mary","James","Henry"));
$smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));
$smarty->assign("Class",array(array("A","B","C","D"), array("E", "F", "G", "H"),
array("I", "J", "K", "L"), array("M", "N", "O", "P")));
$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
$smarty->assign("option_values", array("NY","NE","KS","IA","OK","TX"));
$smarty->assign("option_output", array("New York","Nebraska","Kansas","Iowa","Oklahoma","Texas"));
$smarty->caching = true;
$smarty->cache_lifetime = 120;
$smarty->assign("Name", "Fred Irving Johnathan Bradley Peppergill", true);
$smarty->assign("FirstName", array("John", "Mary", "James", "Henry"));
$smarty->assign("LastName", array("Doe", "Smith", "Johnson", "Case"));
$smarty->assign(
"Class",
array(
array("A", "B", "C", "D"),
array("E", "F", "G", "H"),
array("I", "J", "K", "L"),
array("M", "N", "O", "P")
)
);
$smarty->assign(
"contacts",
array(
array("phone" => "1", "fax" => "2", "cell" => "3"),
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")
)
);
$smarty->assign("option_values", array("NY", "NE", "KS", "IA", "OK", "TX"));
$smarty->assign("option_output", array("New York", "Nebraska", "Kansas", "Iowa", "Oklahoma", "Texas"));
$smarty->assign("option_selected", "NE");
$smarty->display('index.tpl');
?>
+85
View File
@@ -0,0 +1,85 @@
<?php
/**
* APC CacheResource
* CacheResource Implementation based on the KeyValueStore API to use
* memcache as the storage resource for Smarty's output caching.
* *
*
* @package CacheResource-examples
* @author Uwe Tews
*/
class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore
{
/**
* Smarty_CacheResource_Apc constructor.
*
* @throws \Exception
*/
public function __construct()
{
// test if APC is present
if (!function_exists('apc_cache_info')) {
throw new Exception('APC Template Caching Error: APC is not installed');
}
}
/**
* Read values for a set of keys from cache
*
* @param array $keys list of keys to fetch
*
* @return array list of values with the given keys used as indexes
* @return boolean true on success, false on failure
*/
protected function read(array $keys)
{
$_res = array();
$res = apc_fetch($keys);
foreach ($res as $k => $v) {
$_res[ $k ] = $v;
}
return $_res;
}
/**
* Save values for a set of keys to cache
*
* @param array $keys list of values to save
* @param int $expire expiration time
*
* @return boolean true on success, false on failure
*/
protected function write(array $keys, $expire = null)
{
foreach ($keys as $k => $v) {
apc_store($k, $v, $expire);
}
return true;
}
/**
* Remove values from cache
*
* @param array $keys list of keys to delete
*
* @return boolean true on success, false on failure
*/
protected function delete(array $keys)
{
foreach ($keys as $k) {
apc_delete($k);
}
return true;
}
/**
* Remove *all* values from cache
*
* @return boolean true on success, false on failure
*/
protected function purge()
{
return apc_clear_cache('user');
}
}
+99
View File
@@ -0,0 +1,99 @@
<?php
/**
* Memcache CacheResource
* CacheResource Implementation based on the KeyValueStore API to use
* memcache as the storage resource for Smarty's output caching.
* Note that memcache has a limitation of 256 characters per cache-key.
* To avoid complications all cache-keys are translated to a sha1 hash.
*
* @package CacheResource-examples
* @author Rodney Rehm
*/
class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore
{
/**
* memcache instance
*
* @var Memcache
*/
protected $memcache = null;
/**
* Smarty_CacheResource_Memcache constructor.
*/
public function __construct()
{
if (class_exists('Memcached')) {
$this->memcache = new Memcached();
} else {
$this->memcache = new Memcache();
}
$this->memcache->addServer('127.0.0.1', 11211);
}
/**
* Read values for a set of keys from cache
*
* @param array $keys list of keys to fetch
*
* @return array list of values with the given keys used as indexes
* @return boolean true on success, false on failure
*/
protected function read(array $keys)
{
$res = array();
foreach ($keys as $key) {
$k = sha1($key);
$res[$key] = $this->memcache->get($k);
}
return $res;
}
/**
* Save values for a set of keys to cache
*
* @param array $keys list of values to save
* @param int $expire expiration time
*
* @return boolean true on success, false on failure
*/
protected function write(array $keys, $expire = null)
{
foreach ($keys as $k => $v) {
$k = sha1($k);
if (class_exists('Memcached')) {
$this->memcache->set($k, $v, $expire);
} else {
$this->memcache->set($k, $v, 0, $expire);
}
}
return true;
}
/**
* Remove values from cache
*
* @param array $keys list of keys to delete
*
* @return boolean true on success, false on failure
*/
protected function delete(array $keys)
{
foreach ($keys as $k) {
$k = sha1($k);
$this->memcache->delete($k);
}
return true;
}
/**
* Remove *all* values from cache
*
* @return boolean true on success, false on failure
*/
protected function purge()
{
return $this->memcache->flush();
}
}
+183
View File
@@ -0,0 +1,183 @@
<?php
/**
* MySQL CacheResource
* CacheResource Implementation based on the Custom API to use
* MySQL as the storage resource for Smarty's output caching.
* Table definition:
* <pre>CREATE TABLE IF NOT EXISTS `output_cache` (
* `id` CHAR(40) NOT NULL COMMENT 'sha1 hash',
* `name` VARCHAR(250) NOT NULL,
* `cache_id` VARCHAR(250) NULL DEFAULT NULL,
* `compile_id` VARCHAR(250) NULL DEFAULT NULL,
* `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
* `content` LONGTEXT NOT NULL,
* PRIMARY KEY (`id`),
* INDEX(`name`),
* INDEX(`cache_id`),
* INDEX(`compile_id`),
* INDEX(`modified`)
* ) ENGINE = InnoDB;</pre>
*
* @package CacheResource-examples
* @author Rodney Rehm
*/
class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
{
/**
* @var \PDO
*/
protected $db;
/**
* @var \PDOStatement
*/
protected $fetch;
/**
* @var \PDOStatement
*/
protected $fetchTimestamp;
/**
* @var \PDOStatement
*/
protected $save;
/**
* Smarty_CacheResource_Mysql constructor.
*
* @throws \SmartyException
*/
public function __construct()
{
try {
$this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
} catch (PDOException $e) {
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
}
$this->fetch = $this->db->prepare('SELECT modified, content FROM output_cache WHERE id = :id');
$this->fetchTimestamp = $this->db->prepare('SELECT modified FROM output_cache WHERE id = :id');
$this->save = $this->db->prepare(
'REPLACE INTO output_cache (id, name, cache_id, compile_id, content)
VALUES (:id, :name, :cache_id, :compile_id, :content)'
);
}
/**
* fetch cached content and its modification time from data source
*
* @param string $id unique cache content identifier
* @param string $name template name
* @param string $cache_id cache id
* @param string $compile_id compile id
* @param string $content cached content
* @param integer $mtime cache modification timestamp (epoch)
*
* @return void
*/
protected function fetch($id, $name, $cache_id, $compile_id, &$content, &$mtime)
{
$this->fetch->execute(array('id' => $id));
$row = $this->fetch->fetch();
$this->fetch->closeCursor();
if ($row) {
$content = $row[ 'content' ];
$mtime = strtotime($row[ 'modified' ]);
} else {
$content = null;
$mtime = null;
}
}
/**
* Fetch cached content's modification timestamp from data source
*
* @note implementing this method is optional. Only implement it if modification times can be accessed faster than
* loading the complete cached content.
*
* @param string $id unique cache content identifier
* @param string $name template name
* @param string $cache_id cache id
* @param string $compile_id compile id
*
* @return integer|boolean timestamp (epoch) the template was modified, or false if not found
*/
protected function fetchTimestamp($id, $name, $cache_id, $compile_id)
{
$this->fetchTimestamp->execute(array('id' => $id));
$mtime = strtotime($this->fetchTimestamp->fetchColumn());
$this->fetchTimestamp->closeCursor();
return $mtime;
}
/**
* Save content to cache
*
* @param string $id unique cache content identifier
* @param string $name template name
* @param string $cache_id cache id
* @param string $compile_id compile id
* @param integer|null $exp_time seconds till expiration time in seconds or null
* @param string $content content to cache
*
* @return boolean success
*/
protected function save($id, $name, $cache_id, $compile_id, $exp_time, $content)
{
$this->save->execute(
array('id' => $id,
'name' => $name,
'cache_id' => $cache_id,
'compile_id' => $compile_id,
'content' => $content,)
);
return !!$this->save->rowCount();
}
/**
* Delete content from cache
*
* @param string $name template name
* @param string $cache_id cache id
* @param string $compile_id compile id
* @param integer|null $exp_time seconds till expiration or null
*
* @return integer number of deleted caches
*/
protected function delete($name, $cache_id, $compile_id, $exp_time)
{
// delete the whole cache
if ($name === null && $cache_id === null && $compile_id === null && $exp_time === null) {
// returning the number of deleted caches would require a second query to count them
$query = $this->db->query('TRUNCATE TABLE output_cache');
return -1;
}
// build the filter
$where = array();
// equal test name
if ($name !== null) {
$where[] = 'name = ' . $this->db->quote($name);
}
// equal test compile_id
if ($compile_id !== null) {
$where[] = 'compile_id = ' . $this->db->quote($compile_id);
}
// range test expiration time
if ($exp_time !== null) {
$where[] = 'modified < DATE_SUB(NOW(), INTERVAL ' . intval($exp_time) . ' SECOND)';
}
// equal test cache_id and match sub-groups
if ($cache_id !== null) {
$where[] =
'(cache_id = ' .
$this->db->quote($cache_id) .
' OR cache_id LIKE ' .
$this->db->quote($cache_id . '|%') .
')';
}
// run delete query
$query = $this->db->query('DELETE FROM output_cache WHERE ' . join(' AND ', $where));
return $query->rowCount();
}
}
+346
View File
@@ -0,0 +1,346 @@
<?php
/**
* PDO Cache Handler
* Allows you to store Smarty Cache files into your db.
* Example table :
* CREATE TABLE `smarty_cache` (
* `id` char(40) NOT NULL COMMENT 'sha1 hash',
* `name` varchar(250) NOT NULL,
* `cache_id` varchar(250) DEFAULT NULL,
* `compile_id` varchar(250) DEFAULT NULL,
* `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
* `expire` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
* `content` mediumblob NOT NULL,
* PRIMARY KEY (`id`),
* KEY `name` (`name`),
* KEY `cache_id` (`cache_id`),
* KEY `compile_id` (`compile_id`),
* KEY `modified` (`modified`),
* KEY `expire` (`expire`)
* ) ENGINE=InnoDB
* Example usage :
* $cnx = new PDO("mysql:host=localhost;dbname=mydb", "username", "password");
* $smarty->setCachingType('pdo');
* $smarty->loadPlugin('Smarty_CacheResource_Pdo');
* $smarty->registerCacheResource('pdo', new Smarty_CacheResource_Pdo($cnx, 'smarty_cache'));
*
* @author Beno!t POLASZEK - 2014
*/
class Smarty_CacheResource_Pdo extends Smarty_CacheResource_Custom
{
/**
* @var string[]
*/
protected $fetchStatements = array('default' => 'SELECT %2$s
FROM %1$s
WHERE 1
AND id = :id
AND cache_id IS NULL
AND compile_id IS NULL',
'withCacheId' => 'SELECT %2$s
FROM %1$s
WHERE 1
AND id = :id
AND cache_id = :cache_id
AND compile_id IS NULL',
'withCompileId' => 'SELECT %2$s
FROM %1$s
WHERE 1
AND id = :id
AND compile_id = :compile_id
AND cache_id IS NULL',
'withCacheIdAndCompileId' => 'SELECT %2$s
FROM %1$s
WHERE 1
AND id = :id
AND cache_id = :cache_id
AND compile_id = :compile_id');
/**
* @var string
*/
protected $insertStatement = 'INSERT INTO %s
SET id = :id,
name = :name,
cache_id = :cache_id,
compile_id = :compile_id,
modified = CURRENT_TIMESTAMP,
expire = DATE_ADD(CURRENT_TIMESTAMP, INTERVAL :expire SECOND),
content = :content
ON DUPLICATE KEY UPDATE
name = :name,
cache_id = :cache_id,
compile_id = :compile_id,
modified = CURRENT_TIMESTAMP,
expire = DATE_ADD(CURRENT_TIMESTAMP, INTERVAL :expire SECOND),
content = :content';
/**
* @var string
*/
protected $deleteStatement = 'DELETE FROM %1$s WHERE %2$s';
/**
* @var string
*/
protected $truncateStatement = 'TRUNCATE TABLE %s';
/**
* @var string
*/
protected $fetchColumns = 'modified, content';
/**
* @var string
*/
protected $fetchTimestampColumns = 'modified';
/**
* @var \PDO
*/
protected $pdo;
/**
* @var
*/
protected $table;
/**
* @var null
*/
protected $database;
/**
* Constructor
*
* @param PDO $pdo PDO : active connection
* @param string $table : table (or view) name
* @param string $database : optional - if table is located in another db
*
* @throws \SmartyException
*/
public function __construct(PDO $pdo, $table, $database = null)
{
if (is_null($table)) {
throw new SmartyException("Table name for caching can't be null");
}
$this->pdo = $pdo;
$this->table = $table;
$this->database = $database;
$this->fillStatementsWithTableName();
}
/**
* Fills the table name into the statements.
*
* @return $this Current Instance
* @access protected
*/
protected function fillStatementsWithTableName()
{
foreach ($this->fetchStatements as &$statement) {
$statement = sprintf($statement, $this->getTableName(), '%s');
}
$this->insertStatement = sprintf($this->insertStatement, $this->getTableName());
$this->deleteStatement = sprintf($this->deleteStatement, $this->getTableName(), '%s');
$this->truncateStatement = sprintf($this->truncateStatement, $this->getTableName());
return $this;
}
/**
* Gets the fetch statement, depending on what you specify
*
* @param string $columns : the column(s) name(s) you want to retrieve from the database
* @param string $id unique cache content identifier
* @param string|null $cache_id cache id
* @param string|null $compile_id compile id
*
* @access protected
* @return \PDOStatement
*/
protected function getFetchStatement($columns, $id, $cache_id = null, $compile_id = null)
{
$args = array();
if (!is_null($cache_id) && !is_null($compile_id)) {
$query = $this->fetchStatements[ 'withCacheIdAndCompileId' ] and
$args = array('id' => $id, 'cache_id' => $cache_id, 'compile_id' => $compile_id);
} elseif (is_null($cache_id) && !is_null($compile_id)) {
$query = $this->fetchStatements[ 'withCompileId' ] and
$args = array('id' => $id, 'compile_id' => $compile_id);
} elseif (!is_null($cache_id) && is_null($compile_id)) {
$query = $this->fetchStatements[ 'withCacheId' ] and $args = array('id' => $id, 'cache_id' => $cache_id);
} else {
$query = $this->fetchStatements[ 'default' ] and $args = array('id' => $id);
}
$query = sprintf($query, $columns);
$stmt = $this->pdo->prepare($query);
foreach ($args as $key => $value) {
$stmt->bindValue($key, $value);
}
return $stmt;
}
/**
* fetch cached content and its modification time from data source
*
* @param string $id unique cache content identifier
* @param string $name template name
* @param string|null $cache_id cache id
* @param string|null $compile_id compile id
* @param string $content cached content
* @param integer $mtime cache modification timestamp (epoch)
*
* @return void
* @access protected
*/
protected function fetch($id, $name, $cache_id = null, $compile_id = null, &$content, &$mtime)
{
$stmt = $this->getFetchStatement($this->fetchColumns, $id, $cache_id, $compile_id);
$stmt->execute();
$row = $stmt->fetch();
$stmt->closeCursor();
if ($row) {
$content = $this->outputContent($row[ 'content' ]);
$mtime = strtotime($row[ 'modified' ]);
} else {
$content = null;
$mtime = null;
}
}
/**
* Fetch cached content's modification timestamp from data source
* {@internal implementing this method is optional.
* Only implement it if modification times can be accessed faster than loading the complete cached content.}}
*
* @param string $id unique cache content identifier
* @param string $name template name
* @param string|null $cache_id cache id
* @param string|null $compile_id compile id
*
* @return integer|boolean timestamp (epoch) the template was modified, or false if not found
* @access protected
*/
// protected function fetchTimestamp($id, $name, $cache_id = null, $compile_id = null) {
// $stmt = $this->getFetchStatement($this->fetchTimestampColumns, $id, $cache_id, $compile_id);
// $stmt -> execute();
// $mtime = strtotime($stmt->fetchColumn());
// $stmt -> closeCursor();
// return $mtime;
// }
/**
* Save content to cache
*
* @param string $id unique cache content identifier
* @param string $name template name
* @param string|null $cache_id cache id
* @param string|null $compile_id compile id
* @param integer|null $exp_time seconds till expiration time in seconds or null
* @param string $content content to cache
*
* @return boolean success
* @access protected
*/
protected function save($id, $name, $cache_id = null, $compile_id = null, $exp_time, $content)
{
$stmt = $this->pdo->prepare($this->insertStatement);
$stmt->bindValue('id', $id);
$stmt->bindValue('name', $name);
$stmt->bindValue('cache_id', $cache_id, (is_null($cache_id)) ? PDO::PARAM_NULL : PDO::PARAM_STR);
$stmt->bindValue('compile_id', $compile_id, (is_null($compile_id)) ? PDO::PARAM_NULL : PDO::PARAM_STR);
$stmt->bindValue('expire', (int)$exp_time, PDO::PARAM_INT);
$stmt->bindValue('content', $this->inputContent($content));
$stmt->execute();
return !!$stmt->rowCount();
}
/**
* Encodes the content before saving to database
*
* @param string $content
*
* @return string $content
* @access protected
*/
protected function inputContent($content)
{
return $content;
}
/**
* Decodes the content before saving to database
*
* @param string $content
*
* @return string $content
* @access protected
*/
protected function outputContent($content)
{
return $content;
}
/**
* Delete content from cache
*
* @param string|null $name template name
* @param string|null $cache_id cache id
* @param string|null $compile_id compile id
* @param integer|null|-1 $exp_time seconds till expiration or null
*
* @return integer number of deleted caches
* @access protected
*/
protected function delete($name = null, $cache_id = null, $compile_id = null, $exp_time = null)
{
// delete the whole cache
if ($name === null && $cache_id === null && $compile_id === null && $exp_time === null) {
// returning the number of deleted caches would require a second query to count them
$this->pdo->query($this->truncateStatement);
return -1;
}
// build the filter
$where = array();
// equal test name
if ($name !== null) {
$where[] = 'name = ' . $this->pdo->quote($name);
}
// equal test cache_id and match sub-groups
if ($cache_id !== null) {
$where[] =
'(cache_id = ' .
$this->pdo->quote($cache_id) .
' OR cache_id LIKE ' .
$this->pdo->quote($cache_id . '|%') .
')';
}
// equal test compile_id
if ($compile_id !== null) {
$where[] = 'compile_id = ' . $this->pdo->quote($compile_id);
}
// for clearing expired caches
if ($exp_time === Smarty::CLEAR_EXPIRED) {
$where[] = 'expire < CURRENT_TIMESTAMP';
} // range test expiration time
elseif ($exp_time !== null) {
$where[] = 'modified < DATE_SUB(NOW(), INTERVAL ' . intval($exp_time) . ' SECOND)';
}
// run delete query
$query = $this->pdo->query(sprintf($this->deleteStatement, join(' AND ', $where)));
return $query->rowCount();
}
/**
* Gets the formatted table name
*
* @return string
* @access protected
*/
protected function getTableName()
{
return (is_null($this->database)) ? "`{$this->table}`" : "`{$this->database}`.`{$this->table}`";
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
require_once 'cacheresource.pdo.php';
/**
* PDO Cache Handler with GZIP support
* Example usage :
* $cnx = new PDO("mysql:host=localhost;dbname=mydb", "username", "password");
* $smarty->setCachingType('pdo_gzip');
* $smarty->loadPlugin('Smarty_CacheResource_Pdo_Gzip');
* $smarty->registerCacheResource('pdo_gzip', new Smarty_CacheResource_Pdo_Gzip($cnx, 'smarty_cache'));
*
* @require Smarty_CacheResource_Pdo class
* @author Beno!t POLASZEK - 2014
*/
class Smarty_CacheResource_Pdo_Gzip extends Smarty_CacheResource_Pdo
{
/**
* Encodes the content before saving to database
*
* @param string $content
*
* @return string $content
* @access protected
*/
protected function inputContent($content)
{
return gzdeflate($content);
}
/**
* Decodes the content before saving to database
*
* @param string $content
*
* @return string $content
* @access protected
*/
protected function outputContent($content)
{
return gzinflate($content);
}
}
+62
View File
@@ -0,0 +1,62 @@
<?php
/**
* Extends All Resource
* Resource Implementation modifying the extends-Resource to walk
* through the template_dirs and inherit all templates of the same name
*
* @package Resource-examples
* @author Rodney Rehm
*/
class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends
{
/**
* populate Source Object with meta data from Resource
*
* @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object
*
* @return void
*/
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{
$uid = '';
$sources = array();
$timestamp = 0;
foreach ($source->smarty->getTemplateDir() as $key => $directory) {
try {
$s = Smarty_Resource::source(null, $source->smarty, 'file:' . '[' . $key . ']' . $source->name);
if (!$s->exists) {
continue;
}
$sources[ $s->uid ] = $s;
$uid .= $s->filepath;
$timestamp = $s->timestamp > $timestamp ? $s->timestamp : $timestamp;
} catch (SmartyException $e) {
}
}
if (!$sources) {
$source->exists = false;
return;
}
$sources = array_reverse($sources, true);
reset($sources);
$s = current($sources);
$source->components = $sources;
$source->filepath = $s->filepath;
$source->uid = sha1($uid . $source->smarty->_joined_template_dir);
$source->exists = true;
$source->timestamp = $timestamp;
}
/**
* Disable timestamp checks for extendsall resource.
* The individual source components will be checked.
*
* @return bool false
*/
public function checkTimestamps()
{
return false;
}
}
+101
View File
@@ -0,0 +1,101 @@
<?php
/**
* MySQL Resource
* Resource Implementation based on the Custom API to use
* MySQL as the storage resource for Smarty's templates and configs.
* Table definition:
* <pre>CREATE TABLE IF NOT EXISTS `templates` (
* `name` varchar(100) NOT NULL,
* `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
* `source` text,
* PRIMARY KEY (`name`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8;</pre>
* Demo data:
* <pre>INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello
* world"}{$x}');</pre>
*
*
* @package Resource-examples
* @author Rodney Rehm
*/
class Smarty_Resource_Mysql extends Smarty_Resource_Custom
{
/**
* PDO instance
*
* @var \PDO
*/
protected $db;
/**
* prepared fetch() statement
*
* @var \PDOStatement
*/
protected $fetch;
/**
* prepared fetchTimestamp() statement
*
* @var \PDOStatement
*/
protected $mtime;
/**
* Smarty_Resource_Mysql constructor.
*
* @throws \SmartyException
*/
public function __construct()
{
try {
$this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
} catch (PDOException $e) {
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
}
$this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name');
$this->mtime = $this->db->prepare('SELECT modified FROM templates WHERE name = :name');
}
/**
* Fetch a template and its modification time from database
*
* @param string $name template name
* @param string $source template source
* @param integer $mtime template modification timestamp (epoch)
*
* @return void
*/
protected function fetch($name, &$source, &$mtime)
{
$this->fetch->execute(array('name' => $name));
$row = $this->fetch->fetch();
$this->fetch->closeCursor();
if ($row) {
$source = $row[ 'source' ];
$mtime = strtotime($row[ 'modified' ]);
} else {
$source = null;
$mtime = null;
}
}
/**
* Fetch a template's modification time from database
*
* @note implementing this method is optional. Only implement it if modification times can be accessed faster than
* loading the comple template source.
*
* @param string $name template name
*
* @return integer timestamp (epoch) the template was modified
*/
protected function fetchTimestamp($name)
{
$this->mtime->execute(array('name' => $name));
$mtime = $this->mtime->fetchColumn();
$this->mtime->closeCursor();
return strtotime($mtime);
}
}
+77
View File
@@ -0,0 +1,77 @@
<?php
/**
* MySQL Resource
* Resource Implementation based on the Custom API to use
* MySQL as the storage resource for Smarty's templates and configs.
* Note that this MySQL implementation fetches the source and timestamps in
* a single database query, instead of two separate like resource.mysql.php does.
* Table definition:
* <pre>CREATE TABLE IF NOT EXISTS `templates` (
* `name` varchar(100) NOT NULL,
* `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
* `source` text,
* PRIMARY KEY (`name`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8;</pre>
* Demo data:
* <pre>INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello
* world"}{$x}');</pre>
*
*
* @package Resource-examples
* @author Rodney Rehm
*/
class Smarty_Resource_Mysqls extends Smarty_Resource_Custom
{
/**
* PDO instance
*
* @var \PDO
*/
protected $db;
/**
* prepared fetch() statement
*
* @var \PDOStatement
*/
protected $fetch;
/**
* Smarty_Resource_Mysqls constructor.
*
* @throws \SmartyException
*/
public function __construct()
{
try {
$this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
} catch (PDOException $e) {
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
}
$this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name');
}
/**
* Fetch a template and its modification time from database
*
* @param string $name template name
* @param string $source template source
* @param integer $mtime template modification timestamp (epoch)
*
* @return void
*/
protected function fetch($name, &$source, &$mtime)
{
$this->fetch->execute(array('name' => $name));
$row = $this->fetch->fetch();
$this->fetch->closeCursor();
if ($row) {
$source = $row[ 'source' ];
$mtime = strtotime($row[ 'modified' ]);
} else {
$source = null;
$mtime = null;
}
}
}
-1
View File
@@ -1,6 +1,5 @@
<HTML>
<HEAD>
{popup_init src="/javascripts/overlib.js"}
<TITLE>{$title} - {$Name}</TITLE>
</HEAD>
<BODY bgcolor="#ffffff">
+46 -40
View File
@@ -1,21 +1,21 @@
{config_load file=test.conf section="setup"}
{config_load file="test.conf" section="setup"}
{include file="header.tpl" title=foo}
<PRE>
{* bold and title are read from the config file *}
{if #bold#}<b>{/if}
{* capitalize the first letters of each word of the title *}
Title: {#title#|capitalize}
{if #bold#}</b>{/if}
{if #bold#}<b>{/if}
{* capitalize the first letters of each word of the title *}
Title: {#title#|capitalize}
{if #bold#}</b>{/if}
The current date and time is {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
The current date and time is {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
The value of global assigned variable $SCRIPT_NAME is {$SCRIPT_NAME}
The value of global assigned variable $SCRIPT_NAME is {$SCRIPT_NAME}
Example of accessing server environment variable SERVER_NAME: {$smarty.server.SERVER_NAME}
Example of accessing server environment variable SERVER_NAME: {$smarty.server.SERVER_NAME}
The value of {ldelim}$Name{rdelim} is <b>{$Name}</b>
The value of {ldelim}$Name{rdelim} is <b>{$Name}</b>
variable modifier example of {ldelim}$Name|upper{rdelim}
@@ -24,58 +24,64 @@ variable modifier example of {ldelim}$Name|upper{rdelim}
An example of a section loop:
{section name=outer loop=$FirstName}
{if $smarty.section.outer.index is odd by 2}
{$smarty.section.outer.rownum} . {$FirstName[outer]} {$LastName[outer]}
{else}
{$smarty.section.outer.rownum} * {$FirstName[outer]} {$LastName[outer]}
{/if}
{sectionelse}
none
{/section}
{section name=outer
loop=$FirstName}
{if $smarty.section.outer.index is odd by 2}
{$smarty.section.outer.rownum} . {$FirstName[outer]} {$LastName[outer]}
{else}
{$smarty.section.outer.rownum} * {$FirstName[outer]} {$LastName[outer]}
{/if}
{sectionelse}
none
{/section}
An example of section looped key values:
An example of section looped key values:
{section name=sec1 loop=$contacts}
phone: {$contacts[sec1].phone}<br>
fax: {$contacts[sec1].fax}<br>
cell: {$contacts[sec1].cell}<br>
{/section}
<p>
{section name=sec1 loop=$contacts}
phone: {$contacts[sec1].phone}
<br>
testing strip tags
{strip}
fax: {$contacts[sec1].fax}
<br>
cell: {$contacts[sec1].cell}
<br>
{/section}
<p>
testing strip tags
{strip}
<table border=0>
<tr>
<td>
<A HREF="{$SCRIPT_NAME}">
<font color="red">This is a test </font>
</A>
</td>
</tr>
<tr>
<td>
<A HREF="{$SCRIPT_NAME}">
<font color="red">This is a test </font>
</A>
</td>
</tr>
</table>
{/strip}
{/strip}
</PRE>
This is an example of the html_select_date function:
<form>
{html_select_date start_year=1998 end_year=2010}
{html_select_date start_year=1998 end_year=2010}
</form>
This is an example of the html_select_time function:
<form>
{html_select_time use_24_hours=false}
{html_select_time use_24_hours=false}
</form>
This is an example of the html_options function:
<form>
<select name=states>
{html_options values=$option_values selected=$option_selected output=$option_output}
</select>
<select name=states>
{html_options values=$option_values selected=$option_selected output=$option_output}
</select>
</form>
{include file="footer.tpl"}
+1
View File
@@ -0,0 +1 @@
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
+318
View File
@@ -0,0 +1,318 @@
<?php
/**
* Smarty Internal Plugin Configfilelexer
*
* This is the lexer to break the config file source into tokens
* @package Smarty
* @subpackage Config
* @author Uwe Tews
*/
/**
* Smarty_Internal_Configfilelexer
*
* This is the config file lexer.
* It is generated from the smarty_internal_configfilelexer.plex file
*
* @package Smarty
* @subpackage Compiler
* @author Uwe Tews
*/
class Smarty_Internal_Configfilelexer
{
/**
* 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
*
* @var array
*/
public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', 6 => 'TRIPPLE');
/**
* 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
);
/**
* constructor
*
* @param string $data template source
* @param Smarty_Internal_Config_File_Compiler $compiler
*/
public function __construct($data, Smarty_Internal_Config_File_Compiler $compiler)
{
$this->data = $data . "\n"; //now all lines are \n-terminated
$this->dataLength = strlen($data);
$this->counter = 0;
if (preg_match('/^\xEF\xBB\xBF/', $this->data, $match)) {
$this->counter += strlen($match[0]);
}
$this->line = 1;
$this->compiler = $compiler;
$this->smarty = $compiler->smarty;
$this->configBooleanize = $this->smarty->config_booleanize;
}
public function replace ($input) {
return $input;
}
public function PrintTrace()
{
$this->yyTraceFILE = fopen('php://output', 'w');
$this->yyTracePrompt = '<br>';
}
/*!lex2php
%input $this->data
%counter $this->counter
%token $this->token
%value $this->value
%line $this->line
commentstart = /#|;/
openB = /\[/
closeB = /\]/
section = /.*?(?=[\.=\[\]\r\n])/
equal = /=/
whitespace = /[ \t\r]+/
dot = /\./
id = /[0-9]*[a-zA-Z_]\w*/
newline = /\n/
single_quoted_string = /'[^'\\]*(?:\\.[^'\\]*)*'(?=[ \t\r]*[\n#;])/
double_quoted_string = /"[^"\\]*(?:\\.[^"\\]*)*"(?=[ \t\r]*[\n#;])/
tripple_quotes = /"""/
tripple_quotes_end = /"""(?=[ \t\r]*[\n#;])/
text = /[\S\s]/
float = /\d+\.\d+(?=[ \t\r]*[\n#;])/
int = /\d+(?=[ \t\r]*[\n#;])/
maybe_bool = /[a-zA-Z]+(?=[ \t\r]*[\n#;])/
naked_string = /[^\n]+?(?=[ \t\r]*\n)/
*/
/*!lex2php
%statename START
commentstart {
$this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART;
$this->yypushstate(self::COMMENT);
}
openB {
$this->token = Smarty_Internal_Configfileparser::TPC_OPENB;
$this->yypushstate(self::SECTION);
}
closeB {
$this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB;
}
equal {
$this->token = Smarty_Internal_Configfileparser::TPC_EQUAL;
$this->yypushstate(self::VALUE);
}
whitespace {
return false;
}
newline {
$this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
}
id {
$this->token = Smarty_Internal_Configfileparser::TPC_ID;
}
text {
$this->token = Smarty_Internal_Configfileparser::TPC_OTHER;
}
*/
/*!lex2php
%statename VALUE
whitespace {
return false;
}
float {
$this->token = Smarty_Internal_Configfileparser::TPC_FLOAT;
$this->yypopstate();
}
int {
$this->token = Smarty_Internal_Configfileparser::TPC_INT;
$this->yypopstate();
}
tripple_quotes {
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES;
$this->yypushstate(self::TRIPPLE);
}
single_quoted_string {
$this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING;
$this->yypopstate();
}
double_quoted_string {
$this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING;
$this->yypopstate();
}
maybe_bool {
if (!$this->configBooleanize || !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
} else {
$this->token = Smarty_Internal_Configfileparser::TPC_BOOL;
$this->yypopstate();
}
}
naked_string {
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
$this->yypopstate();
}
newline {
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
$this->value = '';
$this->yypopstate();
}
*/
/*!lex2php
%statename NAKED_STRING_VALUE
naked_string {
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
$this->yypopstate();
}
*/
/*!lex2php
%statename COMMENT
whitespace {
return false;
}
naked_string {
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
}
newline {
$this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
$this->yypopstate();
}
*/
/*!lex2php
%statename SECTION
dot {
$this->token = Smarty_Internal_Configfileparser::TPC_DOT;
}
section {
$this->token = Smarty_Internal_Configfileparser::TPC_SECTION;
$this->yypopstate();
}
*/
/*!lex2php
%statename TRIPPLE
tripple_quotes_end {
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END;
$this->yypopstate();
$this->yypushstate(self::START);
}
text {
$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_config_file_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;
}
*/
}
+346
View File
@@ -0,0 +1,346 @@
/**
* Smarty Internal Plugin Configfileparser
*
* This is the config file parser
*
*
* @package Smarty
* @subpackage Config
* @author Uwe Tews
*/
%name TPC_
%declare_class {
/**
* Smarty Internal Plugin Configfileparse
*
* This is the config file parser.
* It is generated from the smarty_internal_configfileparser.y file
* @package Smarty
* @subpackage Compiler
* @author Uwe Tews
*/
class Smarty_Internal_Configfileparser
}
%include_class
{
/**
* result status
*
* @var bool
*/
public $successful = true;
/**
* return value
*
* @var mixed
*/
public $retvalue = 0;
/**
* @var
*/
public $yymajor;
/**
* lexer object
*
* @var Smarty_Internal_Configfilelexer
*/
private $lex;
/**
* internal error flag
*
* @var bool
*/
private $internalError = false;
/**
* compiler object
*
* @var Smarty_Internal_Config_File_Compiler
*/
public $compiler = null;
/**
* smarty object
*
* @var Smarty
*/
public $smarty = null;
/**
* 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('\\' => '\\',
'\'' => '\'');
/**
* constructor
*
* @param Smarty_Internal_Configfilelexer $lex
* @param Smarty_Internal_Config_File_Compiler $compiler
*/
public function __construct(Smarty_Internal_Configfilelexer $lex, Smarty_Internal_Config_File_Compiler $compiler)
{
$this->lex = $lex;
$this->smarty = $compiler->smarty;
$this->compiler = $compiler;
$this->configOverwrite = $this->smarty->config_overwrite;
$this->configReadHidden = $this->smarty->config_read_hidden;
}
/**
* 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;
}
/**
* parse single quoted string
* remove outer quotes
* unescape inner quotes
*
* @param string $qstr
*
* @return string
*/
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 = '';
foreach ($ss as $s) {
if (strlen($s) === 2 && $s[0] === '\\') {
if (isset(self::$escapes_single[$s[1]])) {
$s = self::$escapes_single[$s[1]];
}
}
$str .= $s;
}
return $str;
}
/**
* parse double quoted string
*
* @param string $qstr
*
* @return string
*/
private static function parse_double_quoted_string($qstr)
{
$inner_str = substr($qstr, 1, strlen($qstr) - 2);
return stripcslashes($inner_str);
}
/**
* parse triple quoted string
*
* @param string $qstr
*
* @return string
*/
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]);
}
}
}
%token_prefix TPC_
%parse_accept
{
$this->successful = !$this->internalError;
$this->internalError = false;
$this->retvalue = $this->_retvalue;
}
%syntax_error
{
$this->internalError = true;
$this->yymajor = $yymajor;
$this->compiler->trigger_config_file_error();
}
%stack_overflow
{
$this->internalError = true;
$this->compiler->trigger_config_file_error('Stack overflow in configfile parser');
}
// Complete config file
start(res) ::= global_vars sections. {
res = null;
}
// Global vars
global_vars(res) ::= var_list(vl). {
$this->add_global_vars(vl);
res = null;
}
// Sections
sections(res) ::= sections section. {
res = null;
}
sections(res) ::= . {
res = null;
}
section(res) ::= OPENB SECTION(i) CLOSEB newline var_list(vars). {
$this->add_section_vars(i, vars);
res = null;
}
section(res) ::= OPENB DOT SECTION(i) CLOSEB newline var_list(vars). {
if ($this->configReadHidden) {
$this->add_section_vars(i, vars);
}
res = null;
}
// Var list
var_list(res) ::= var_list(vl) newline. {
res = vl;
}
var_list(res) ::= var_list(vl) var(v). {
res = array_merge(vl, array(v));
}
var_list(res) ::= . {
res = array();
}
// Var
var(res) ::= ID(id) EQUAL value(v). {
res = array('key' => id, 'value' => v);
}
value(res) ::= FLOAT(i). {
res = (float) i;
}
value(res) ::= INT(i). {
res = (int) i;
}
value(res) ::= BOOL(i). {
res = $this->parse_bool(i);
}
value(res) ::= SINGLE_QUOTED_STRING(i). {
res = self::parse_single_quoted_string(i);
}
value(res) ::= DOUBLE_QUOTED_STRING(i). {
res = self::parse_double_quoted_string(i);
}
value(res) ::= TRIPPLE_QUOTES(i) TRIPPLE_TEXT(c) TRIPPLE_QUOTES_END(ii). {
res = self::parse_tripple_double_quoted_string(c);
}
value(res) ::= TRIPPLE_QUOTES(i) TRIPPLE_QUOTES_END(ii). {
res = '';
}
value(res) ::= NAKED_STRING(i). {
res = i;
}
// NOTE: this is not a valid rule
// It is added hier to produce a usefull error message on a missing '=';
value(res) ::= OTHER(i). {
res = i;
}
// Newline and comments
newline(res) ::= NEWLINE. {
res = null;
}
newline(res) ::= COMMENTSTART NEWLINE. {
res = null;
}
newline(res) ::= COMMENTSTART NAKED_STRING NEWLINE. {
res = null;
}
+696
View File
@@ -0,0 +1,696 @@
<?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_Templatelexer
* This is the template file lexer.
* It is generated from the smarty_internal_templatelexer.plex file
*
*
* @author Uwe Tews <uwe.tews@googlemail.com>
*/
class Smarty_Internal_Templatelexer
{
/**
* 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 = '';
/**
* state number
*
* @var int
*/
public $state = 1;
/**
* Smarty object
*
* @var Smarty
*/
public $smarty = null;
/**
* compiler object
*
* @var Smarty_Internal_TemplateCompilerBase
*/
public $compiler = null;
/**
* 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',);
/**
* 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;
/**
* preg token pattern for state DOUBLEQUOTEDSTRING
*
* @var null
*/
private $yy_global_pattern5 = null;
/**
* preg token pattern for text
*
* @var null
*/
private $yy_global_text = null;
/**
* preg token pattern for literal
*
* @var null
*/
private $yy_global_literal = null;
/**
* constructor
*
* @param string $source template source
* @param Smarty_Internal_TemplateCompilerBase $compiler
*/
public function __construct($source, Smarty_Internal_TemplateCompilerBase $compiler)
{
$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->template->smarty;
$this->compiler = $compiler;
$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>';
}
/**
* replace placeholders with runtime preg code
*
* @param string $preg
*
* @return string
*/
public function replace($preg)
{
return $this->compiler->replaceDelimiter($preg);
}
/**
* 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;
}
/*!lex2php
%input $this->data
%counter $this->counter
%token $this->token
%value $this->value
%line $this->line
userliteral = ~(SMARTYldel)SMARTYautoliteral\s+SMARTYliteral~
char = ~[\S\s]~
textdoublequoted = ~([^"\\]*?)((?:\\.[^"\\]*?)*?)(?=((SMARTYldel)SMARTYal|\$|`\$|"SMARTYliteral))~
namespace = ~([0-9]*[a-zA-Z_]\w*)?(\\[0-9]*[a-zA-Z_]\w*)+~
emptyjava = ~[{][}]~
phptag = ~(SMARTYldel)SMARTYalphp([ ].*?)?SMARTYrdel|(SMARTYldel)SMARTYal[/]phpSMARTYrdel~
phpstart = ~[<][?]((php\s+|=)|\s+)|[<][%]|[<][?]xml\s+|[<]script\s+language\s*=\s*["']?\s*php\s*["']?\s*[>]|[?][>]|[%][>]~
slash = ~[/]~
ldel = ~(SMARTYldel)SMARTYal~
rdel = ~\s*SMARTYrdel~
nocacherdel = ~(\s+nocache)?\s*SMARTYrdel~
smartyblockchildparent = ~[\$]smarty\.block\.(child|parent)~
integer = ~\d+~
hex = ~0[xX][0-9a-fA-F]+~
math = ~\s*([*]{1,2}|[%/^&]|[<>]{2})\s*~
comment = ~(SMARTYldel)SMARTYal[*]~
incdec = ~([+]|[-]){2}~
unimath = ~\s*([+]|[-])\s*~
openP = ~\s*[(]\s*~
closeP = ~\s*[)]~
openB = ~\[\s*~
closeB = ~\s*\]~
dollar = ~[$]~
dot = ~[.]~
comma = ~\s*[,]\s*~
doublecolon = ~[:]{2}~
colon = ~\s*[:]\s*~
at = ~[@]~
hatch = ~[#]~
semicolon = ~\s*[;]\s*~
equal = ~\s*[=]\s*~
space = ~\s+~
ptr = ~\s*[-][>]\s*~
aptr = ~\s*[=][>]\s*~
singlequotestring = ~'[^'\\]*(?:\\.[^'\\]*)*'~
backtick = ~[`]~
vert = ~[|][@]?~
qmark = ~\s*[?]\s*~
constant = ~[_]+[A-Z0-9][0-9A-Z_]*|[A-Z][0-9A-Z_]*(?![0-9A-Z_]*[a-z])~
attr = ~\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\s*[=]\s*~
id = ~[0-9]*[a-zA-Z_]\w*~
literal = ~literal~
strip = ~strip~
lop = ~\s*([!=][=]{1,2}|[<][=>]?|[>][=]?|[&|]{2})\s*~
slop = ~\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\s+~
tlop = ~\s+is\s+(not\s+)?(odd|even|div)\s+by\s+~
scond = ~\s+is\s+(not\s+)?(odd|even)~
isin = ~\s+is\s+in\s+~
as = ~\s+as\s+~
to = ~\s+to\s+~
step = ~\s+step\s+~
if = ~(if|elseif|else if|while)\s+~
for = ~for\s+~
makenocache = ~make_nocache\s+~
array = ~array~
foreach = ~foreach(?![^\s])~
setfilter = ~setfilter\s+~
instanceof = ~\s+instanceof\s+~
not = ~[!]\s*|not\s+~
typecast = ~[(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\s*~
double_quote = ~["]~
*/
/*!lex2php
%statename TEXT
emptyjava {
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
comment {
$to = $this->dataLength;
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->getRightDelimiter()}'");
}
$this->value = substr($this->data,$this->counter,$to-$this->counter);
return false;
}
phptag {
$this->compiler->getTagCompiler('private_php')->parsePhp($this);
}
userliteral {
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
ldel literal rdel {
$this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
$this->yypushstate(self::LITERAL);
}
ldel slash literal rdel {
$this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
$this->yypushstate(self::LITERAL);
}
ldel {
$this->yypushstate(self::TAG);
return true;
}
phpstart {
$this->compiler->getTagCompiler('private_php')->parsePhp($this);
}
char {
if (!isset($this->yy_global_text)) {
$this->yy_global_text = $this->replace('/(SMARTYldel)SMARTYal|[<][?]((php\s+|=)|\s+)|[<][%]|[<][?]xml\s+|[<]script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*[>]|[?][>]|[%][>]SMARTYliteral/isS');
}
$to = $this->dataLength;
preg_match($this->yy_global_text, $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;
}
*/
/*!lex2php
%statename TAG
ldel if {
$this->token = Smarty_Internal_Templateparser::TP_LDELIF;
$this->yybegin(self::TAGBODY);
$this->taglineno = $this->line;
}
ldel for {
$this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
$this->yybegin(self::TAGBODY);
$this->taglineno = $this->line;
}
ldel foreach {
$this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
$this->yybegin(self::TAGBODY);
$this->taglineno = $this->line;
}
ldel setfilter {
$this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
$this->yybegin(self::TAGBODY);
$this->taglineno = $this->line;
}
ldel makenocache {
$this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE;
$this->yybegin(self::TAGBODY);
$this->taglineno = $this->line;
}
ldel id nocacherdel {
$this->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG;
$this->taglineno = $this->line;
}
ldel smartyblockchildparent rdel {
$this->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
$this->taglineno = $this->line;
}
ldel slash id rdel {
$this->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_CLOSETAG;
$this->taglineno = $this->line;
}
ldel dollar id nocacherdel {
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->getLeftDelimiter();
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
$this->yybegin(self::TAGBODY);
$this->taglineno = $this->line;
}
}
ldel slash {
$this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
$this->yybegin(self::TAGBODY);
$this->taglineno = $this->line;
}
ldel {
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
$this->yybegin(self::TAGBODY);
$this->taglineno = $this->line;
}
*/
/*!lex2php
%statename TAGBODY
rdel {
$this->token = Smarty_Internal_Templateparser::TP_RDEL;
$this->yypopstate();
}
ldel {
$this->yypushstate(self::TAG);
return true;
}
double_quote {
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
$this->yypushstate(self::DOUBLEQUOTEDSTRING);
$this->compiler->enterDoubleQuote();
}
singlequotestring {
$this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
}
dollar id {
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
}
dollar {
$this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
}
isin {
$this->token = Smarty_Internal_Templateparser::TP_ISIN;
}
as {
$this->token = Smarty_Internal_Templateparser::TP_AS;
}
to {
$this->token = Smarty_Internal_Templateparser::TP_TO;
}
step {
$this->token = Smarty_Internal_Templateparser::TP_STEP;
}
instanceof {
$this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
}
lop {
$this->token = Smarty_Internal_Templateparser::TP_LOGOP;
}
slop {
$this->token = Smarty_Internal_Templateparser::TP_SLOGOP;
}
tlop {
$this->token = Smarty_Internal_Templateparser::TP_TLOGOP;
}
scond {
$this->token = Smarty_Internal_Templateparser::TP_SINGLECOND;
}
not{
$this->token = Smarty_Internal_Templateparser::TP_NOT;
}
typecast {
$this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
}
openP {
$this->token = Smarty_Internal_Templateparser::TP_OPENP;
}
closeP {
$this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
}
openB {
$this->token = Smarty_Internal_Templateparser::TP_OPENB;
}
closeB {
$this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
}
ptr {
$this->token = Smarty_Internal_Templateparser::TP_PTR;
}
aptr {
$this->token = Smarty_Internal_Templateparser::TP_APTR;
}
equal {
$this->token = Smarty_Internal_Templateparser::TP_EQUAL;
}
incdec {
$this->token = Smarty_Internal_Templateparser::TP_INCDEC;
}
unimath {
$this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
}
math {
$this->token = Smarty_Internal_Templateparser::TP_MATH;
}
at {
$this->token = Smarty_Internal_Templateparser::TP_AT;
}
array openP {
$this->token = Smarty_Internal_Templateparser::TP_ARRAYOPEN;
}
hatch {
$this->token = Smarty_Internal_Templateparser::TP_HATCH;
}
attr {
// resolve conflicts with shorttag and right_delimiter starting with '='
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 {
$this->token = Smarty_Internal_Templateparser::TP_ATTR;
}
}
namespace {
$this->token = Smarty_Internal_Templateparser::TP_NAMESPACE;
}
id {
$this->token = Smarty_Internal_Templateparser::TP_ID;
}
integer {
$this->token = Smarty_Internal_Templateparser::TP_INTEGER;
}
backtick {
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
$this->yypopstate();
}
vert {
$this->token = Smarty_Internal_Templateparser::TP_VERT;
}
dot {
$this->token = Smarty_Internal_Templateparser::TP_DOT;
}
comma {
$this->token = Smarty_Internal_Templateparser::TP_COMMA;
}
semicolon {
$this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
}
doublecolon {
$this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
}
colon {
$this->token = Smarty_Internal_Templateparser::TP_COLON;
}
qmark {
$this->token = Smarty_Internal_Templateparser::TP_QMARK;
}
hex {
$this->token = Smarty_Internal_Templateparser::TP_HEX;
}
space {
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
}
char {
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
*/
/*!lex2php
%statename LITERAL
ldel literal rdel {
$this->literal_cnt++;
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
}
ldel slash literal rdel {
if ($this->literal_cnt) {
$this->literal_cnt--;
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
} else {
$this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
$this->yypopstate();
}
}
char {
if (!isset($this->yy_global_literal)) {
$this->yy_global_literal = $this->replace('/(SMARTYldel)SMARTYal[\/]?literalSMARTYrdel/isS');
}
$to = $this->dataLength;
preg_match($this->yy_global_literal, $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;
}
*/
/*!lex2php
%statename DOUBLEQUOTEDSTRING
userliteral {
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
ldel literal rdel {
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
ldel slash literal rdel {
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
ldel slash {
$this->yypushstate(self::TAG);
return true;
}
ldel id {
$this->yypushstate(self::TAG);
return true;
}
ldel {
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
$this->taglineno = $this->line;
$this->yypushstate(self::TAGBODY);
}
double_quote {
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
$this->yypopstate();
}
backtick dollar {
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
$this->value = substr($this->value,0,-1);
$this->yypushstate(self::TAGBODY);
$this->taglineno = $this->line;
}
dollar id {
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
}
dollar {
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
textdoublequoted {
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
char {
$to = $this->dataLength;
$this->value = substr($this->data,$this->counter,$to-$this->counter);
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
*/
}
File diff suppressed because it is too large Load Diff
+110
View File
@@ -0,0 +1,110 @@
<?php
/**
* Smarty Autoloader
*
* @package Smarty
*/
/**
* Smarty Autoloader
*
* @package Smarty
* @author Uwe Tews
* Usage:
* require_once '...path/Autoloader.php';
* Smarty_Autoloader::register();
* or
* include '...path/bootstrap.php';
*
* $smarty = new Smarty();
*/
class Smarty_Autoloader
{
/**
* Filepath to Smarty root
*
* @var string
*/
public static $SMARTY_DIR = null;
/**
* Filepath to Smarty internal plugins
*
* @var string
*/
public static $SMARTY_SYSPLUGINS_DIR = null;
/**
* Array with Smarty core classes and their filename
*
* @var array
*/
public static $rootClasses = array('smarty' => 'Smarty.class.php', 'smartybc' => 'SmartyBC.class.php',);
/**
* Registers Smarty_Autoloader backward compatible to older installations.
*
* @param bool $prepend Whether to prepend the autoloader or not.
*/
public static function registerBC($prepend = false)
{
/**
* register the class autoloader
*/
if (!defined('SMARTY_SPL_AUTOLOAD')) {
define('SMARTY_SPL_AUTOLOAD', 0);
}
if (SMARTY_SPL_AUTOLOAD
&& set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false
) {
$registeredAutoLoadFunctions = spl_autoload_functions();
if (!isset($registeredAutoLoadFunctions[ 'spl_autoload' ])) {
spl_autoload_register();
}
} else {
self::register($prepend);
}
}
/**
* Registers Smarty_Autoloader as an SPL autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not.
*/
public static function register($prepend = false)
{
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(PHP_VERSION, '5.3.0', '>=')) {
spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend);
} else {
spl_autoload_register(array(__CLASS__, 'autoload'));
}
}
/**
* Handles auto loading of classes.
*
* @param string $class A class name.
*/
public static function autoload($class)
{
if ($class[ 0 ] !== 'S' || strpos($class, 'Smarty') !== 0) {
return;
}
$_class = strtolower($class);
if (isset(self::$rootClasses[ $_class ])) {
$file = self::$SMARTY_DIR . self::$rootClasses[ $_class ];
if (is_file($file)) {
include $file;
}
} else {
$file = self::$SMARTY_SYSPLUGINS_DIR . $_class . '.php';
if (is_file($file)) {
include $file;
}
}
return;
}
}
-393
View File
@@ -1,393 +0,0 @@
<?php
/**
* Config_File class.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* For questions, help, comments, discussion, etc., please join the
* Smarty mailing list. Send a blank e-mail to
* smarty-discussion-subscribe@googlegroups.com
*
* @link http://www.smarty.net/
* @version 2.6.25-dev
* @copyright Copyright: 2001-2005 New Digital Group, Inc.
* @author Andrei Zmievski <andrei@php.net>
* @access public
* @package Smarty
*/
/* $Id$ */
/**
* Config file reading class
* @package Smarty
*/
class Config_File {
/**#@+
* Options
* @var boolean
*/
/**
* Controls whether variables with the same name overwrite each other.
*/
var $overwrite = true;
/**
* Controls whether config values of on/true/yes and off/false/no get
* converted to boolean values automatically.
*/
var $booleanize = true;
/**
* Controls whether hidden config sections/vars are read from the file.
*/
var $read_hidden = true;
/**
* Controls whether or not to fix mac or dos formatted newlines.
* If set to true, \r or \r\n will be changed to \n.
*/
var $fix_newlines = true;
/**#@-*/
/** @access private */
var $_config_path = "";
var $_config_data = array();
/**#@-*/
/**
* Constructs a new config file class.
*
* @param string $config_path (optional) path to the config files
*/
function Config_File($config_path = NULL)
{
if (isset($config_path))
$this->set_path($config_path);
}
/**
* Set the path where configuration files can be found.
*
* @param string $config_path path to the config files
*/
function set_path($config_path)
{
if (!empty($config_path)) {
if (!is_string($config_path) || !file_exists($config_path) || !is_dir($config_path)) {
$this->_trigger_error_msg("Bad config file path '$config_path'");
return;
}
if(substr($config_path, -1) != DIRECTORY_SEPARATOR) {
$config_path .= DIRECTORY_SEPARATOR;
}
$this->_config_path = $config_path;
}
}
/**
* Retrieves config info based on the file, section, and variable name.
*
* @param string $file_name config file to get info for
* @param string $section_name (optional) section to get info for
* @param string $var_name (optional) variable to get info for
* @return string|array a value or array of values
*/
function get($file_name, $section_name = NULL, $var_name = NULL)
{
if (empty($file_name)) {
$this->_trigger_error_msg('Empty config file name');
return;
} else {
$file_name = $this->_config_path . $file_name;
if (!isset($this->_config_data[$file_name]))
$this->load_file($file_name, false);
}
if (!empty($var_name)) {
if (empty($section_name)) {
return $this->_config_data[$file_name]["vars"][$var_name];
} else {
if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name]))
return $this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name];
else
return array();
}
} else {
if (empty($section_name)) {
return (array)$this->_config_data[$file_name]["vars"];
} else {
if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"]))
return (array)$this->_config_data[$file_name]["sections"][$section_name]["vars"];
else
return array();
}
}
}
/**
* Retrieves config info based on the key.
*
* @param $file_name string config key (filename/section/var)
* @return string|array same as get()
* @uses get() retrieves information from config file and returns it
*/
function &get_key($config_key)
{
list($file_name, $section_name, $var_name) = explode('/', $config_key, 3);
$result = &$this->get($file_name, $section_name, $var_name);
return $result;
}
/**
* Get all loaded config file names.
*
* @return array an array of loaded config file names
*/
function get_file_names()
{
return array_keys($this->_config_data);
}
/**
* Get all section names from a loaded file.
*
* @param string $file_name config file to get section names from
* @return array an array of section names from the specified file
*/
function get_section_names($file_name)
{
$file_name = $this->_config_path . $file_name;
if (!isset($this->_config_data[$file_name])) {
$this->_trigger_error_msg("Unknown config file '$file_name'");
return;
}
return array_keys($this->_config_data[$file_name]["sections"]);
}
/**
* Get all global or section variable names.
*
* @param string $file_name config file to get info for
* @param string $section_name (optional) section to get info for
* @return array an array of variables names from the specified file/section
*/
function get_var_names($file_name, $section = NULL)
{
if (empty($file_name)) {
$this->_trigger_error_msg('Empty config file name');
return;
} else if (!isset($this->_config_data[$file_name])) {
$this->_trigger_error_msg("Unknown config file '$file_name'");
return;
}
if (empty($section))
return array_keys($this->_config_data[$file_name]["vars"]);
else
return array_keys($this->_config_data[$file_name]["sections"][$section]["vars"]);
}
/**
* Clear loaded config data for a certain file or all files.
*
* @param string $file_name file to clear config data for
*/
function clear($file_name = NULL)
{
if ($file_name === NULL)
$this->_config_data = array();
else if (isset($this->_config_data[$file_name]))
$this->_config_data[$file_name] = array();
}
/**
* Load a configuration file manually.
*
* @param string $file_name file name to load
* @param boolean $prepend_path whether current config path should be
* prepended to the filename
*/
function load_file($file_name, $prepend_path = true)
{
if ($prepend_path && $this->_config_path != "")
$config_file = $this->_config_path . $file_name;
else
$config_file = $file_name;
ini_set('track_errors', true);
$fp = @fopen($config_file, "r");
if (!is_resource($fp)) {
$this->_trigger_error_msg("Could not open config file '$config_file'");
return false;
}
$contents = ($size = filesize($config_file)) ? fread($fp, $size) : '';
fclose($fp);
$this->_config_data[$config_file] = $this->parse_contents($contents);
return true;
}
/**
* Store the contents of a file manually.
*
* @param string $config_file file name of the related contents
* @param string $contents the file-contents to parse
*/
function set_file_contents($config_file, $contents)
{
$this->_config_data[$config_file] = $this->parse_contents($contents);
return true;
}
/**
* parse the source of a configuration file manually.
*
* @param string $contents the file-contents to parse
*/
function parse_contents($contents)
{
if($this->fix_newlines) {
// fix mac/dos formatted newlines
$contents = preg_replace('!\r\n?!', "\n", $contents);
}
$config_data = array();
$config_data['sections'] = array();
$config_data['vars'] = array();
/* reference to fill with data */
$vars =& $config_data['vars'];
/* parse file line by line */
preg_match_all('!^.*\r?\n?!m', $contents, $match);
$lines = $match[0];
for ($i=0, $count=count($lines); $i<$count; $i++) {
$line = $lines[$i];
if (empty($line)) continue;
if ( substr($line, 0, 1) == '[' && preg_match('!^\[(.*?)\]!', $line, $match) ) {
/* section found */
if (substr($match[1], 0, 1) == '.') {
/* hidden section */
if ($this->read_hidden) {
$section_name = substr($match[1], 1);
} else {
/* break reference to $vars to ignore hidden section */
unset($vars);
$vars = array();
continue;
}
} else {
$section_name = $match[1];
}
if (!isset($config_data['sections'][$section_name]))
$config_data['sections'][$section_name] = array('vars' => array());
$vars =& $config_data['sections'][$section_name]['vars'];
continue;
}
if (preg_match('/^\s*(\.?\w+)\s*=\s*(.*)/s', $line, $match)) {
/* variable found */
$var_name = rtrim($match[1]);
if (strpos($match[2], '"""') === 0) {
/* handle multiline-value */
$lines[$i] = substr($match[2], 3);
$var_value = '';
while ($i<$count) {
if (($pos = strpos($lines[$i], '"""')) === false) {
$var_value .= $lines[$i++];
} else {
/* end of multiline-value */
$var_value .= substr($lines[$i], 0, $pos);
break;
}
}
$booleanize = false;
} else {
/* handle simple value */
$var_value = preg_replace('/^([\'"])(.*)\1$/', '\2', rtrim($match[2]));
$booleanize = $this->booleanize;
}
$this->_set_config_var($vars, $var_name, $var_value, $booleanize);
}
/* else unparsable line / means it is a comment / means ignore it */
}
return $config_data;
}
/**#@+ @access private */
/**
* @param array &$container
* @param string $var_name
* @param mixed $var_value
* @param boolean $booleanize determines whether $var_value is converted to
* to true/false
*/
function _set_config_var(&$container, $var_name, $var_value, $booleanize)
{
if (substr($var_name, 0, 1) == '.') {
if (!$this->read_hidden)
return;
else
$var_name = substr($var_name, 1);
}
if (!preg_match("/^[a-zA-Z_]\w*$/", $var_name)) {
$this->_trigger_error_msg("Bad variable name '$var_name'");
return;
}
if ($booleanize) {
if (preg_match("/^(on|true|yes)$/i", $var_value))
$var_value = true;
else if (preg_match("/^(off|false|no)$/i", $var_value))
$var_value = false;
}
if (!isset($container[$var_name]) || $this->overwrite)
$container[$var_name] = $var_value;
else {
settype($container[$var_name], 'array');
$container[$var_name][] = $var_value;
}
}
/**
* @uses trigger_error() creates a PHP warning/error
* @param string $error_msg
* @param integer $error_type one of
*/
function _trigger_error_msg($error_msg, $error_type = E_USER_WARNING)
{
trigger_error("Config_File error: $error_msg", $error_type);
}
/**#@-*/
}
?>
+1161 -1698
View File
File diff suppressed because it is too large Load Diff
+477
View File
@@ -0,0 +1,477 @@
<?php
/**
* Project: Smarty: the PHP compiling template engine
* File: SmartyBC.class.php
* SVN: $Id: $
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* For questions, help, comments, discussion, etc., please join the
* Smarty mailing list. Send a blank e-mail to
* smarty-discussion-subscribe@googlegroups.com
*
* @link http://www.smarty.net/
* @copyright 2008 New Digital Group, Inc.
* @author Monte Ohrt <monte at ohrt dot com>
* @author Uwe Tews
* @author Rodney Rehm
* @package Smarty
*/
/**
* @ignore
*/
require_once dirname(__FILE__) . '/Smarty.class.php';
/**
* Smarty Backward Compatibility Wrapper Class
*
* @package Smarty
*/
class SmartyBC extends Smarty
{
/**
* Smarty 2 BC
*
* @var string
*/
public $_version = self::SMARTY_VERSION;
/**
* This is an array of directories where trusted php scripts reside.
*
* @var array
*/
public $trusted_dir = array();
/**
* Initialize new SmartyBC object
*/
public function __construct()
{
parent::__construct();
}
/**
* wrapper for assign_by_ref
*
* @param string $tpl_var the template variable name
* @param mixed &$value the referenced value to assign
*/
public function assign_by_ref($tpl_var, &$value)
{
$this->assignByRef($tpl_var, $value);
}
/**
* wrapper for append_by_ref
*
* @param string $tpl_var the template variable name
* @param mixed &$value the referenced value to append
* @param boolean $merge flag if array elements shall be merged
*/
public function append_by_ref($tpl_var, &$value, $merge = false)
{
$this->appendByRef($tpl_var, $value, $merge);
}
/**
* clear the given assigned template variable.
*
* @param string $tpl_var the template variable to clear
*/
public function clear_assign($tpl_var)
{
$this->clearAssign($tpl_var);
}
/**
* Registers custom function to be used in templates
*
* @param string $function the name of the template function
* @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)
{
$this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs);
}
/**
* Unregister custom function
*
* @param string $function name of template function
*/
public function unregister_function($function)
{
$this->unregisterPlugin('function', $function);
}
/**
* Registers object to be used in templates
*
* @param string $object name of template object
* @param object $object_impl the referenced PHP object to register
* @param array $allowed list of allowed methods (empty = all)
* @param boolean $smarty_args smarty argument format, else traditional
* @param array $block_methods list of methods that are block format
*
* @throws SmartyException
* @internal param array $block_functs list of methods that are block format
*/
public function register_object(
$object,
$object_impl,
$allowed = array(),
$smarty_args = true,
$block_methods = array()
) {
settype($allowed, 'array');
settype($smarty_args, 'boolean');
$this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods);
}
/**
* Unregister object
*
* @param string $object name of template object
*/
public function unregister_object($object)
{
$this->unregisterObject($object);
}
/**
* Registers block function to be used in templates
*
* @param string $block name of template block
* @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)
{
$this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs);
}
/**
* Unregister block function
*
* @param string $block name of template function
*/
public function unregister_block($block)
{
$this->unregisterPlugin('block', $block);
}
/**
* Registers compiler function
*
* @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)
{
$this->registerPlugin('compiler', $function, $function_impl, $cacheable);
}
/**
* Unregister compiler function
*
* @param string $function name of template function
*/
public function unregister_compiler_function($function)
{
$this->unregisterPlugin('compiler', $function);
}
/**
* Registers modifier to be used in templates
*
* @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)
{
$this->registerPlugin('modifier', $modifier, $modifier_impl);
}
/**
* Unregister modifier
*
* @param string $modifier name of template modifier
*/
public function unregister_modifier($modifier)
{
$this->unregisterPlugin('modifier', $modifier);
}
/**
* Registers a resource to fetch a template
*
* @param string $type name of resource
* @param array $functions array of functions to handle resource
*/
public function register_resource($type, $functions)
{
$this->registerResource($type, $functions);
}
/**
* Unregister a resource
*
* @param string $type name of resource
*/
public function unregister_resource($type)
{
$this->unregisterResource($type);
}
/**
* Registers a prefilter function to apply
* to a template before compiling
*
* @param callable $function
*
* @throws \SmartyException
*/
public function register_prefilter($function)
{
$this->registerFilter('pre', $function);
}
/**
* Unregister a prefilter function
*
* @param callable $function
*/
public function unregister_prefilter($function)
{
$this->unregisterFilter('pre', $function);
}
/**
* Registers a postfilter function to apply
* to a compiled template after compilation
*
* @param callable $function
*
* @throws \SmartyException
*/
public function register_postfilter($function)
{
$this->registerFilter('post', $function);
}
/**
* Unregister a postfilter function
*
* @param callable $function
*/
public function unregister_postfilter($function)
{
$this->unregisterFilter('post', $function);
}
/**
* Registers an output filter function to apply
* to a template output
*
* @param callable $function
*
* @throws \SmartyException
*/
public function register_outputfilter($function)
{
$this->registerFilter('output', $function);
}
/**
* Unregister an outputfilter function
*
* @param callable $function
*/
public function unregister_outputfilter($function)
{
$this->unregisterFilter('output', $function);
}
/**
* load a filter of specified type and name
*
* @param string $type filter type
* @param string $name filter name
*
* @throws \SmartyException
*/
public function load_filter($type, $name)
{
$this->loadFilter($type, $name);
}
/**
* clear cached content for the given template and cache id
*
* @param string $tpl_file name of template file
* @param string $cache_id name of cache_id
* @param string $compile_id name of compile_id
* @param string $exp_time expiration time
*
* @return boolean
*/
public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
{
return $this->clearCache($tpl_file, $cache_id, $compile_id, $exp_time);
}
/**
* clear the entire contents of cache (all templates)
*
* @param string $exp_time expire time
*
* @return boolean
*/
public function clear_all_cache($exp_time = null)
{
return $this->clearCache(null, null, null, $exp_time);
}
/**
* test to see if valid cache exists for this template
*
* @param string $tpl_file name of template file
* @param string $cache_id
* @param string $compile_id
*
* @return bool
* @throws \Exception
* @throws \SmartyException
*/
public function is_cached($tpl_file, $cache_id = null, $compile_id = null)
{
return $this->isCached($tpl_file, $cache_id, $compile_id);
}
/**
* clear all the assigned template variables.
*/
public function clear_all_assign()
{
$this->clearAllAssign();
}
/**
* clears compiled version of specified template resource,
* or all compiled template files if one is not specified.
* This function is for advanced use only, not normally needed.
*
* @param string $tpl_file
* @param string $compile_id
* @param string $exp_time
*
* @return boolean results of {@link smarty_core_rm_auto()}
*/
public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
{
return $this->clearCompiledTemplate($tpl_file, $compile_id, $exp_time);
}
/**
* Checks whether requested template exists.
*
* @param string $tpl_file
*
* @return bool
* @throws \SmartyException
*/
public function template_exists($tpl_file)
{
return $this->templateExists($tpl_file);
}
/**
* Returns an array containing template variables
*
* @param string $name
*
* @return array
*/
public function get_template_vars($name = null)
{
return $this->getTemplateVars($name);
}
/**
* Returns an array containing config variables
*
* @param string $name
*
* @return array
*/
public function get_config_vars($name = null)
{
return $this->getConfigVars($name);
}
/**
* load configuration values
*
* @param string $file
* @param string $section
* @param string $scope
*/
public function config_load($file, $section = null, $scope = 'global')
{
$this->ConfigLoad($file, $section, $scope);
}
/**
* return a reference to a registered object
*
* @param string $name
*
* @return object
*/
public function get_registered_object($name)
{
return $this->getRegisteredObject($name);
}
/**
* clear configuration values
*
* @param string $var
*/
public function clear_config($var = null)
{
$this->clearConfig($var);
}
/**
* trigger Smarty error
*
* @param string $error_msg
* @param integer $error_type
*/
public function trigger_error($error_msg, $error_type = E_USER_WARNING)
{
trigger_error("Smarty error: $error_msg", $error_type);
}
}
File diff suppressed because it is too large Load Diff
+16
View File
@@ -0,0 +1,16 @@
<?php
/**
* This file is part of the Smarty package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Load and register Smarty Autoloader
*/
if (!class_exists('Smarty_Autoloader')) {
include dirname(__FILE__) . '/Autoloader.php';
}
Smarty_Autoloader::register(true);
+135 -132
View File
@@ -1,157 +1,160 @@
{* Smarty *}
{* debug.tpl, last updated version 2.1.0 *}
{assign_debug_info}
{capture assign=debug_output}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Smarty Debug Console</title>
{literal}
<style type="text/css">
/* <![CDATA[ */
body, h1, h2, td, th, p {
font-family: sans-serif;
font-weight: normal;
font-size: 0.9em;
margin: 1px;
padding: 0;
}
{capture name='_smarty_debug' assign=debug_output}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Smarty Debug Console</title>
<style type="text/css">
{literal}
body, h1, h2, h3, td, th, p {
font-family: sans-serif;
font-weight: normal;
font-size: 0.9em;
margin: 1px;
padding: 0;
}
h1 {
margin: 0;
text-align: left;
padding: 2px;
background-color: #f0c040;
color: black;
font-weight: bold;
font-size: 1.2em;
}
h1 {
margin: 0;
text-align: left;
padding: 2px;
background-color: #f0c040;
color: black;
font-weight: bold;
font-size: 1.2em;
}
h2 {
background-color: #9B410E;
color: white;
text-align: left;
font-weight: bold;
padding: 2px;
border-top: 1px solid black;
}
h2 {
background-color: #9B410E;
color: white;
text-align: left;
font-weight: bold;
padding: 2px;
border-top: 1px solid black;
}
h3 {
text-align: left;
font-weight: bold;
color: black;
font-size: 0.7em;
padding: 2px;
}
body {
background: black;
}
body {
background: black;
}
p, table, div {
background: #f0ead8;
}
p, table, div {
background: #f0ead8;
}
p {
margin: 0;
font-style: italic;
text-align: center;
}
p {
margin: 0;
font-style: italic;
text-align: center;
}
table {
width: 100%;
}
table {
width: 100%;
}
th, td {
font-family: monospace;
vertical-align: top;
text-align: left;
width: 50%;
}
th, td {
font-family: monospace;
vertical-align: top;
text-align: left;
}
td {
color: green;
}
td {
color: green;
}
.odd {
background-color: #eeeeee;
}
.odd {
background-color: #eeeeee;
}
.even {
background-color: #fafafa;
}
.even {
background-color: #fafafa;
}
.exectime {
font-size: 0.8em;
font-style: italic;
}
.exectime {
font-size: 0.8em;
font-style: italic;
}
#table_assigned_vars th {
color: blue;
}
#bold div {
color: black;
font-weight: bold;
}
#blue h3 {
color: blue;
}
#normal div {
color: black;
font-weight: normal;
}
#table_assigned_vars th {
color: blue;
font-weight: bold;
}
#table_config_vars th {
color: maroon;
}
/* ]]> */
</style>
{/literal}
</head>
<body>
#table_config_vars th {
color: maroon;
}
<h1>Smarty Debug Console</h1>
{/literal}
</style>
</head>
<body>
<h2>included templates &amp; config files (load time in seconds)</h2>
<h1>Smarty {Smarty::SMARTY_VERSION} Debug Console
- {if isset($template_name)}{$template_name|debug_print_var nofilter} {/if}{if !empty($template_data)}Total Time {$execution_time|string_format:"%.5f"}{/if}</h1>
<div>
{section name=templates loop=$_debug_tpls}
{section name=indent loop=$_debug_tpls[templates].depth}&nbsp;&nbsp;&nbsp;{/section}
<font color={if $_debug_tpls[templates].type eq "template"}brown{elseif $_debug_tpls[templates].type eq "insert"}black{else}green{/if}>
{$_debug_tpls[templates].filename|escape:html}</font>
{if isset($_debug_tpls[templates].exec_time)}
<span class="exectime">
({$_debug_tpls[templates].exec_time|string_format:"%.5f"})
{if %templates.index% eq 0}(total){/if}
</span>
{if !empty($template_data)}
<h2>included templates &amp; config files (load time in seconds)</h2>
<div>
{foreach $template_data as $template}
<font color=brown>{$template.name}</font>
<br />&nbsp;&nbsp;<span class="exectime">
(compile {$template['compile_time']|string_format:"%.5f"}) (render {$template['render_time']|string_format:"%.5f"}) (cache {$template['cache_time']|string_format:"%.5f"})
</span>
<br />
{/foreach}
</div>
{/if}
<br />
{sectionelse}
<p>no templates included</p>
{/section}
</div>
<h2>assigned template variables</h2>
<h2>assigned template variables</h2>
<table id="table_assigned_vars">
{section name=vars loop=$_debug_keys}
<tr class="{cycle values="odd,even"}">
<th>{ldelim}${$_debug_keys[vars]|escape:'html'}{rdelim}</th>
<td>{$_debug_vals[vars]|@debug_print_var}</td></tr>
{sectionelse}
<tr><td><p>no template variables assigned</p></td></tr>
{/section}
</table>
<table id="table_assigned_vars">
{foreach $assigned_vars as $vars}
<tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
<td><h3><font color=blue>${$vars@key}</font></h3>
{if isset($vars['nocache'])}<b>Nocache</b><br />{/if}
{if isset($vars['scope'])}<b>Origin:</b> {$vars['scope']|debug_print_var nofilter}{/if}
</td>
<td><h3>Value</h3>{$vars['value']|debug_print_var:10:80 nofilter}</td>
<td>{if isset($vars['attributes'])}<h3>Attributes</h3>{$vars['attributes']|debug_print_var nofilter} {/if}</td>
{/foreach}
</table>
<h2>assigned config file variables (outer template scope)</h2>
<h2>assigned config file variables</h2>
<table id="table_config_vars">
{section name=config_vars loop=$_debug_config_keys}
<tr class="{cycle values="odd,even"}">
<th>{ldelim}#{$_debug_config_keys[config_vars]|escape:'html'}#{rdelim}</th>
<td>{$_debug_config_vals[config_vars]|@debug_print_var}</td></tr>
{sectionelse}
<tr><td><p>no config vars assigned</p></td></tr>
{/section}
</table>
</body>
</html>
<table id="table_config_vars">
{foreach $config_vars as $vars}
<tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
<td><h3><font color=blue>#{$vars@key}#</font></h3>
{if isset($vars['scope'])}<b>Origin:</b> {$vars['scope']|debug_print_var nofilter}{/if}
</td>
<td>{$vars['value']|debug_print_var:10:80 nofilter}</td>
</tr>
{/foreach}
</table>
</body>
</html>
{/capture}
{if isset($_smarty_debug_output) and $_smarty_debug_output eq "html"}
{$debug_output}
{else}
<script type="text/javascript">
// <![CDATA[
if ( self.name == '' ) {ldelim}
var title = 'Console';
{rdelim}
else {ldelim}
var title = 'Console_' + self.name;
{rdelim}
_smarty_console = window.open("",title.value,"width=680,height=600,resizable,scrollbars=yes");
_smarty_console.document.write('{$debug_output|escape:'javascript'}');
{$id = '__Smarty__'}
{if $display_mode}{$id = "$offset$template_name"|md5}{/if}
_smarty_console = window.open("", "console{$id}", "width=1024,height=600,left={$offset},top={$offset},resizable,scrollbars=yes");
_smarty_console.document.write("{$debug_output|escape:'javascript' nofilter}");
_smarty_console.document.close();
// ]]>
</script>
{/if}
@@ -1,67 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* assemble filepath of requested plugin
*
* @param string $type
* @param string $name
* @return string|false
*/
function smarty_core_assemble_plugin_filepath($params, &$smarty)
{
static $_filepaths_cache = array();
$_plugin_filename = $params['type'] . '.' . $params['name'] . '.php';
if (isset($_filepaths_cache[$_plugin_filename])) {
return $_filepaths_cache[$_plugin_filename];
}
$_return = false;
foreach ((array)$smarty->plugins_dir as $_plugin_dir) {
$_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename;
// see if path is relative
if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) {
$_relative_paths[] = $_plugin_dir;
// relative path, see if it is in the SMARTY_DIR
if (@is_readable(SMARTY_DIR . $_plugin_filepath)) {
$_return = SMARTY_DIR . $_plugin_filepath;
break;
}
}
// try relative to cwd (or absolute)
if (@is_readable($_plugin_filepath)) {
$_return = $_plugin_filepath;
break;
}
}
if($_return === false) {
// still not found, try PHP include_path
if(isset($_relative_paths)) {
foreach ((array)$_relative_paths as $_plugin_dir) {
$_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename;
$_params = array('file_path' => $_plugin_filepath);
require_once(SMARTY_CORE_DIR . 'core.get_include_path.php');
if(smarty_core_get_include_path($_params, $smarty)) {
$_return = $_params['new_file_path'];
break;
}
}
}
}
$_filepaths_cache[$_plugin_filename] = $_return;
return $_return;
}
/* vim: set expandtab: */
?>
@@ -1,43 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty assign_smarty_interface core plugin
*
* Type: core<br>
* Name: assign_smarty_interface<br>
* Purpose: assign the $smarty interface variable
* @param array Format: null
* @param Smarty
*/
function smarty_core_assign_smarty_interface($params, &$smarty)
{
if (isset($smarty->_smarty_vars) && isset($smarty->_smarty_vars['request'])) {
return;
}
$_globals_map = array('g' => 'HTTP_GET_VARS',
'p' => 'HTTP_POST_VARS',
'c' => 'HTTP_COOKIE_VARS',
's' => 'HTTP_SERVER_VARS',
'e' => 'HTTP_ENV_VARS');
$_smarty_vars_request = array();
foreach (preg_split('!!', strtolower($smarty->request_vars_order)) as $_c) {
if (isset($_globals_map[$_c])) {
$_smarty_vars_request = array_merge($_smarty_vars_request, $GLOBALS[$_globals_map[$_c]]);
}
}
$_smarty_vars_request = @array_merge($_smarty_vars_request, $GLOBALS['HTTP_SESSION_VARS']);
$smarty->_smarty_vars['request'] = $_smarty_vars_request;
}
/* vim: set expandtab: */
?>
@@ -1,79 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* create full directory structure
*
* @param string $dir
*/
// $dir
function smarty_core_create_dir_structure($params, &$smarty)
{
if (!file_exists($params['dir'])) {
$_open_basedir_ini = ini_get('open_basedir');
if (DIRECTORY_SEPARATOR=='/') {
/* unix-style paths */
$_dir = $params['dir'];
$_dir_parts = preg_split('!/+!', $_dir, -1, PREG_SPLIT_NO_EMPTY);
$_new_dir = (substr($_dir, 0, 1)=='/') ? '/' : getcwd().'/';
if($_use_open_basedir = !empty($_open_basedir_ini)) {
$_open_basedirs = explode(':', $_open_basedir_ini);
}
} else {
/* other-style paths */
$_dir = str_replace('\\','/', $params['dir']);
$_dir_parts = preg_split('!/+!', $_dir, -1, PREG_SPLIT_NO_EMPTY);
if (preg_match('!^((//)|([a-zA-Z]:/))!', $_dir, $_root_dir)) {
/* leading "//" for network volume, or "[letter]:/" for full path */
$_new_dir = $_root_dir[1];
/* remove drive-letter from _dir_parts */
if (isset($_root_dir[3])) array_shift($_dir_parts);
} else {
$_new_dir = str_replace('\\', '/', getcwd()).'/';
}
if($_use_open_basedir = !empty($_open_basedir_ini)) {
$_open_basedirs = explode(';', str_replace('\\', '/', $_open_basedir_ini));
}
}
/* all paths use "/" only from here */
foreach ($_dir_parts as $_dir_part) {
$_new_dir .= $_dir_part;
if ($_use_open_basedir) {
// do not attempt to test or make directories outside of open_basedir
$_make_new_dir = false;
foreach ($_open_basedirs as $_open_basedir) {
if (substr($_new_dir, 0, strlen($_open_basedir)) == $_open_basedir) {
$_make_new_dir = true;
break;
}
}
} else {
$_make_new_dir = true;
}
if ($_make_new_dir && !file_exists($_new_dir) && !@mkdir($_new_dir, $smarty->_dir_perms) && !is_dir($_new_dir)) {
$smarty->trigger_error("problem creating directory '" . $_new_dir . "'");
return false;
}
$_new_dir .= '/';
}
}
}
/* vim: set expandtab: */
?>
@@ -1,61 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty debug_console function plugin
*
* Type: core<br>
* Name: display_debug_console<br>
* Purpose: display the javascript debug console window
* @param array Format: null
* @param Smarty
*/
function smarty_core_display_debug_console($params, &$smarty)
{
// we must force compile the debug template in case the environment
// changed between separate applications.
if(empty($smarty->debug_tpl)) {
// set path to debug template from SMARTY_DIR
$smarty->debug_tpl = SMARTY_DIR . 'debug.tpl';
if($smarty->security && is_file($smarty->debug_tpl)) {
$smarty->secure_dir[] = realpath($smarty->debug_tpl);
}
$smarty->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl';
}
$_ldelim_orig = $smarty->left_delimiter;
$_rdelim_orig = $smarty->right_delimiter;
$smarty->left_delimiter = '{';
$smarty->right_delimiter = '}';
$_compile_id_orig = $smarty->_compile_id;
$smarty->_compile_id = null;
$_compile_path = $smarty->_get_compile_path($smarty->debug_tpl);
if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path))
{
ob_start();
$smarty->_include($_compile_path);
$_results = ob_get_contents();
ob_end_clean();
} else {
$_results = '';
}
$smarty->_compile_id = $_compile_id_orig;
$smarty->left_delimiter = $_ldelim_orig;
$smarty->right_delimiter = $_rdelim_orig;
return $_results;
}
/* vim: set expandtab: */
?>
-44
View File
@@ -1,44 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Get path to file from include_path
*
* @param string $file_path
* @param string $new_file_path
* @return boolean
* @staticvar array|null
*/
// $file_path, &$new_file_path
function smarty_core_get_include_path(&$params, &$smarty)
{
static $_path_array = null;
if(!isset($_path_array)) {
$_ini_include_path = ini_get('include_path');
if(strstr($_ini_include_path,';')) {
// windows pathnames
$_path_array = explode(';',$_ini_include_path);
} else {
$_path_array = explode(':',$_ini_include_path);
}
}
foreach ($_path_array as $_include_path) {
if (@is_readable($_include_path . DIRECTORY_SEPARATOR . $params['file_path'])) {
$params['new_file_path'] = $_include_path . DIRECTORY_SEPARATOR . $params['file_path'];
return true;
}
}
return false;
}
/* vim: set expandtab: */
?>
-23
View File
@@ -1,23 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Get seconds and microseconds
* @return double
*/
function smarty_core_get_microtime($params, &$smarty)
{
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = (double)($mtime[1]) + (double)($mtime[0]);
return ($mtime);
}
/* vim: set expandtab: */
?>
-80
View File
@@ -1,80 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Retrieves PHP script resource
*
* sets $php_resource to the returned resource
* @param string $resource
* @param string $resource_type
* @param $php_resource
* @return boolean
*/
function smarty_core_get_php_resource(&$params, &$smarty)
{
$params['resource_base_path'] = $smarty->trusted_dir;
$smarty->_parse_resource_name($params, $smarty);
/*
* Find out if the resource exists.
*/
if ($params['resource_type'] == 'file') {
$_readable = false;
if(file_exists($params['resource_name']) && is_readable($params['resource_name'])) {
$_readable = true;
} else {
// test for file in include_path
$_params = array('file_path' => $params['resource_name']);
require_once(SMARTY_CORE_DIR . 'core.get_include_path.php');
if(smarty_core_get_include_path($_params, $smarty)) {
$_include_path = $_params['new_file_path'];
$_readable = true;
}
}
} else if ($params['resource_type'] != 'file') {
$_template_source = null;
$_readable = is_callable($smarty->_plugins['resource'][$params['resource_type']][0][0])
&& call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][0],
array($params['resource_name'], &$_template_source, &$smarty));
}
/*
* Set the error function, depending on which class calls us.
*/
if (method_exists($smarty, '_syntax_error')) {
$_error_funcc = '_syntax_error';
} else {
$_error_funcc = 'trigger_error';
}
if ($_readable) {
if ($smarty->security) {
require_once(SMARTY_CORE_DIR . 'core.is_trusted.php');
if (!smarty_core_is_trusted($params, $smarty)) {
$smarty->$_error_funcc('(secure mode) ' . $params['resource_type'] . ':' . $params['resource_name'] . ' is not trusted');
return false;
}
}
} else {
$smarty->$_error_funcc($params['resource_type'] . ':' . $params['resource_name'] . ' is not readable');
return false;
}
if ($params['resource_type'] == 'file') {
$params['php_resource'] = $params['resource_name'];
} else {
$params['php_resource'] = $_template_source;
}
return true;
}
/* vim: set expandtab: */
?>
-59
View File
@@ -1,59 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* determines if a resource is secure or not.
*
* @param string $resource_type
* @param string $resource_name
* @return boolean
*/
// $resource_type, $resource_name
function smarty_core_is_secure($params, &$smarty)
{
if (!$smarty->security || $smarty->security_settings['INCLUDE_ANY']) {
return true;
}
if ($params['resource_type'] == 'file') {
$_rp = realpath($params['resource_name']);
if (isset($params['resource_base_path'])) {
foreach ((array)$params['resource_base_path'] as $curr_dir) {
if ( ($_cd = realpath($curr_dir)) !== false &&
strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) {
return true;
}
}
}
if (!empty($smarty->secure_dir)) {
foreach ((array)$smarty->secure_dir as $curr_dir) {
if ( ($_cd = realpath($curr_dir)) !== false) {
if($_cd == $_rp) {
return true;
} elseif (strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR) {
return true;
}
}
}
}
} else {
// resource is not on local file system
return call_user_func_array(
$smarty->_plugins['resource'][$params['resource_type']][0][2],
array($params['resource_name'], &$smarty));
}
return false;
}
/* vim: set expandtab: */
?>
-47
View File
@@ -1,47 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* determines if a resource is trusted or not
*
* @param string $resource_type
* @param string $resource_name
* @return boolean
*/
// $resource_type, $resource_name
function smarty_core_is_trusted($params, &$smarty)
{
$_smarty_trusted = false;
if ($params['resource_type'] == 'file') {
if (!empty($smarty->trusted_dir)) {
$_rp = realpath($params['resource_name']);
foreach ((array)$smarty->trusted_dir as $curr_dir) {
if (!empty($curr_dir) && is_readable ($curr_dir)) {
$_cd = realpath($curr_dir);
if (strncmp($_rp, $_cd, strlen($_cd)) == 0
&& substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) {
$_smarty_trusted = true;
break;
}
}
}
}
} else {
// resource is not on local file system
$_smarty_trusted = call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][3],
array($params['resource_name'], $smarty));
}
return $_smarty_trusted;
}
/* vim: set expandtab: */
?>
-125
View File
@@ -1,125 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Load requested plugins
*
* @param array $plugins
*/
// $plugins
function smarty_core_load_plugins($params, &$smarty)
{
foreach ($params['plugins'] as $_plugin_info) {
list($_type, $_name, $_tpl_file, $_tpl_line, $_delayed_loading) = $_plugin_info;
$_plugin = &$smarty->_plugins[$_type][$_name];
/*
* We do not load plugin more than once for each instance of Smarty.
* The following code checks for that. The plugin can also be
* registered dynamically at runtime, in which case template file
* and line number will be unknown, so we fill them in.
*
* The final element of the info array is a flag that indicates
* whether the dynamically registered plugin function has been
* checked for existence yet or not.
*/
if (isset($_plugin)) {
if (empty($_plugin[3])) {
if (!is_callable($_plugin[0])) {
$smarty->_trigger_fatal_error("[plugin] $_type '$_name' is not implemented", $_tpl_file, $_tpl_line, __FILE__, __LINE__);
} else {
$_plugin[1] = $_tpl_file;
$_plugin[2] = $_tpl_line;
$_plugin[3] = true;
if (!isset($_plugin[4])) $_plugin[4] = true; /* cacheable */
}
}
continue;
} else if ($_type == 'insert') {
/*
* For backwards compatibility, we check for insert functions in
* the symbol table before trying to load them as a plugin.
*/
$_plugin_func = 'insert_' . $_name;
if (function_exists($_plugin_func)) {
$_plugin = array($_plugin_func, $_tpl_file, $_tpl_line, true, false);
continue;
}
}
$_plugin_file = $smarty->_get_plugin_filepath($_type, $_name);
if (! $_found = ($_plugin_file != false)) {
$_message = "could not load plugin file '$_type.$_name.php'\n";
}
/*
* If plugin file is found, it -must- provide the properly named
* plugin function. In case it doesn't, simply output the error and
* do not fall back on any other method.
*/
if ($_found) {
include_once $_plugin_file;
$_plugin_func = 'smarty_' . $_type . '_' . $_name;
if (!function_exists($_plugin_func)) {
$smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", $_tpl_file, $_tpl_line, __FILE__, __LINE__);
continue;
}
}
/*
* In case of insert plugins, their code may be loaded later via
* 'script' attribute.
*/
else if ($_type == 'insert' && $_delayed_loading) {
$_plugin_func = 'smarty_' . $_type . '_' . $_name;
$_found = true;
}
/*
* Plugin specific processing and error checking.
*/
if (!$_found) {
if ($_type == 'modifier') {
/*
* In case modifier falls back on using PHP functions
* directly, we only allow those specified in the security
* context.
*/
if ($smarty->security && !in_array($_name, $smarty->security_settings['MODIFIER_FUNCS'])) {
$_message = "(secure mode) modifier '$_name' is not allowed";
} else {
if (!function_exists($_name)) {
$_message = "modifier '$_name' is not implemented";
} else {
$_plugin_func = $_name;
$_found = true;
}
}
} else if ($_type == 'function') {
/*
* This is a catch-all situation.
*/
$_message = "unknown tag - '$_name'";
}
}
if ($_found) {
$smarty->_plugins[$_type][$_name] = array($_plugin_func, $_tpl_file, $_tpl_line, true, true);
} else {
// output error
$smarty->_trigger_fatal_error('[plugin] ' . $_message, $_tpl_file, $_tpl_line, __FILE__, __LINE__);
}
}
}
/* vim: set expandtab: */
?>
@@ -1,74 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* load a resource plugin
*
* @param string $type
*/
// $type
function smarty_core_load_resource_plugin($params, &$smarty)
{
/*
* Resource plugins are not quite like the other ones, so they are
* handled differently. The first element of plugin info is the array of
* functions provided by the plugin, the second one indicates whether
* all of them exist or not.
*/
$_plugin = &$smarty->_plugins['resource'][$params['type']];
if (isset($_plugin)) {
if (!$_plugin[1] && count($_plugin[0])) {
$_plugin[1] = true;
foreach ($_plugin[0] as $_plugin_func) {
if (!is_callable($_plugin_func)) {
$_plugin[1] = false;
break;
}
}
}
if (!$_plugin[1]) {
$smarty->_trigger_fatal_error("[plugin] resource '" . $params['type'] . "' is not implemented", null, null, __FILE__, __LINE__);
}
return;
}
$_plugin_file = $smarty->_get_plugin_filepath('resource', $params['type']);
$_found = ($_plugin_file != false);
if ($_found) { /*
* If the plugin file is found, it -must- provide the properly named
* plugin functions.
*/
include_once($_plugin_file);
/*
* Locate functions that we require the plugin to provide.
*/
$_resource_ops = array('source', 'timestamp', 'secure', 'trusted');
$_resource_funcs = array();
foreach ($_resource_ops as $_op) {
$_plugin_func = 'smarty_resource_' . $params['type'] . '_' . $_op;
if (!function_exists($_plugin_func)) {
$smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", null, null, __FILE__, __LINE__);
return;
} else {
$_resource_funcs[] = $_plugin_func;
}
}
$smarty->_plugins['resource'][$params['type']] = array($_resource_funcs, true);
}
}
/* vim: set expandtab: */
?>
@@ -1,71 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Replace cached inserts with the actual results
*
* @param string $results
* @return string
*/
function smarty_core_process_cached_inserts($params, &$smarty)
{
preg_match_all('!'.$smarty->_smarty_md5.'{insert_cache (.*)}'.$smarty->_smarty_md5.'!Uis',
$params['results'], $match);
list($cached_inserts, $insert_args) = $match;
for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; $i++) {
if ($smarty->debugging) {
$_params = array();
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
$debug_start_time = smarty_core_get_microtime($_params, $smarty);
}
$args = unserialize($insert_args[$i]);
$name = $args['name'];
if (isset($args['script'])) {
$_params = array('resource_name' => $smarty->_dequote($args['script']));
require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php');
if(!smarty_core_get_php_resource($_params, $smarty)) {
return false;
}
$resource_type = $_params['resource_type'];
$php_resource = $_params['php_resource'];
if ($resource_type == 'file') {
$smarty->_include($php_resource, true);
} else {
$smarty->_eval($php_resource);
}
}
$function_name = $smarty->_plugins['insert'][$name][0];
if (empty($args['assign'])) {
$replace = $function_name($args, $smarty);
} else {
$smarty->assign($args['assign'], $function_name($args, $smarty));
$replace = '';
}
$params['results'] = substr_replace($params['results'], $replace, strpos($params['results'], $cached_inserts[$i]), strlen($cached_inserts[$i]));
if ($smarty->debugging) {
$_params = array();
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
$smarty->_smarty_debug_info[] = array('type' => 'insert',
'filename' => 'insert_'.$name,
'depth' => $smarty->_inclusion_depth,
'exec_time' => smarty_core_get_microtime($_params, $smarty) - $debug_start_time);
}
}
return $params['results'];
}
/* vim: set expandtab: */
?>
@@ -1,37 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Replace nocache-tags by results of the corresponding non-cacheable
* functions and return it
*
* @param string $compiled_tpl
* @param string $cached_source
* @return string
*/
function smarty_core_process_compiled_include($params, &$smarty)
{
$_cache_including = $smarty->_cache_including;
$smarty->_cache_including = true;
$_return = $params['results'];
foreach ($smarty->_cache_info['cache_serials'] as $_include_file_path=>$_cache_serial) {
$smarty->_include($_include_file_path, true);
}
foreach ($smarty->_cache_info['cache_serials'] as $_include_file_path=>$_cache_serial) {
$_return = preg_replace_callback('!(\{nocache\:('.$_cache_serial.')#(\d+)\})!s',
array(&$smarty, '_process_compiled_include_callback'),
$_return);
}
$smarty->_cache_including = $_cache_including;
return $_return;
}
?>
-101
View File
@@ -1,101 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* read a cache file, determine if it needs to be
* regenerated or not
*
* @param string $tpl_file
* @param string $cache_id
* @param string $compile_id
* @param string $results
* @return boolean
*/
// $tpl_file, $cache_id, $compile_id, &$results
function smarty_core_read_cache_file(&$params, &$smarty)
{
static $content_cache = array();
if ($smarty->force_compile) {
// force compile enabled, always regenerate
return false;
}
if (isset($content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']])) {
list($params['results'], $smarty->_cache_info) = $content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']];
return true;
}
if (!empty($smarty->cache_handler_func)) {
// use cache_handler function
call_user_func_array($smarty->cache_handler_func,
array('read', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], null));
} else {
// use local cache file
$_auto_id = $smarty->_get_auto_id($params['cache_id'], $params['compile_id']);
$_cache_file = $smarty->_get_auto_filename($smarty->cache_dir, $params['tpl_file'], $_auto_id);
$params['results'] = $smarty->_read_file($_cache_file);
}
if (empty($params['results'])) {
// nothing to parse (error?), regenerate cache
return false;
}
$_contents = $params['results'];
$_info_start = strpos($_contents, "\n") + 1;
$_info_len = (int)substr($_contents, 0, $_info_start - 1);
$_cache_info = unserialize(substr($_contents, $_info_start, $_info_len));
$params['results'] = substr($_contents, $_info_start + $_info_len);
if ($smarty->caching == 2 && isset ($_cache_info['expires'])){
// caching by expiration time
if ($_cache_info['expires'] > -1 && (time() > $_cache_info['expires'])) {
// cache expired, regenerate
return false;
}
} else {
// caching by lifetime
if ($smarty->cache_lifetime > -1 && (time() - $_cache_info['timestamp'] > $smarty->cache_lifetime)) {
// cache expired, regenerate
return false;
}
}
if ($smarty->compile_check) {
$_params = array('get_source' => false, 'quiet'=>true);
foreach (array_keys($_cache_info['template']) as $_template_dep) {
$_params['resource_name'] = $_template_dep;
if (!$smarty->_fetch_resource_info($_params) || $_cache_info['timestamp'] < $_params['resource_timestamp']) {
// template file has changed, regenerate cache
return false;
}
}
if (isset($_cache_info['config'])) {
$_params = array('resource_base_path' => $smarty->config_dir, 'get_source' => false, 'quiet'=>true);
foreach (array_keys($_cache_info['config']) as $_config_dep) {
$_params['resource_name'] = $_config_dep;
if (!$smarty->_fetch_resource_info($_params) || $_cache_info['timestamp'] < $_params['resource_timestamp']) {
// config file has changed, regenerate cache
return false;
}
}
}
}
$content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']] = array($params['results'], $_cache_info);
$smarty->_cache_info = $_cache_info;
return true;
}
/* vim: set expandtab: */
?>
-71
View File
@@ -1,71 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* delete an automagically created file by name and id
*
* @param string $auto_base
* @param string $auto_source
* @param string $auto_id
* @param integer $exp_time
* @return boolean
*/
// $auto_base, $auto_source = null, $auto_id = null, $exp_time = null
function smarty_core_rm_auto($params, &$smarty)
{
if (!@is_dir($params['auto_base']))
return false;
if(!isset($params['auto_id']) && !isset($params['auto_source'])) {
$_params = array(
'dirname' => $params['auto_base'],
'level' => 0,
'exp_time' => $params['exp_time']
);
require_once(SMARTY_CORE_DIR . 'core.rmdir.php');
$_res = smarty_core_rmdir($_params, $smarty);
} else {
$_tname = $smarty->_get_auto_filename($params['auto_base'], $params['auto_source'], $params['auto_id']);
if(isset($params['auto_source'])) {
if (isset($params['extensions'])) {
$_res = false;
foreach ((array)$params['extensions'] as $_extension)
$_res |= $smarty->_unlink($_tname.$_extension, $params['exp_time']);
} else {
$_res = $smarty->_unlink($_tname, $params['exp_time']);
}
} elseif ($smarty->use_sub_dirs) {
$_params = array(
'dirname' => $_tname,
'level' => 1,
'exp_time' => $params['exp_time']
);
require_once(SMARTY_CORE_DIR . 'core.rmdir.php');
$_res = smarty_core_rmdir($_params, $smarty);
} else {
// remove matching file names
$_handle = opendir($params['auto_base']);
$_res = true;
while (false !== ($_filename = readdir($_handle))) {
if($_filename == '.' || $_filename == '..') {
continue;
} elseif (substr($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, 0, strlen($_tname)) == $_tname) {
$_res &= (bool)$smarty->_unlink($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, $params['exp_time']);
}
}
}
}
return $_res;
}
/* vim: set expandtab: */
?>
-54
View File
@@ -1,54 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* delete a dir recursively (level=0 -> keep root)
* WARNING: no tests, it will try to remove what you tell it!
*
* @param string $dirname
* @param integer $level
* @param integer $exp_time
* @return boolean
*/
// $dirname, $level = 1, $exp_time = null
function smarty_core_rmdir($params, &$smarty)
{
if(!isset($params['level'])) { $params['level'] = 1; }
if(!isset($params['exp_time'])) { $params['exp_time'] = null; }
if($_handle = @opendir($params['dirname'])) {
while (false !== ($_entry = readdir($_handle))) {
if ($_entry != '.' && $_entry != '..') {
if (@is_dir($params['dirname'] . DIRECTORY_SEPARATOR . $_entry)) {
$_params = array(
'dirname' => $params['dirname'] . DIRECTORY_SEPARATOR . $_entry,
'level' => $params['level'] + 1,
'exp_time' => $params['exp_time']
);
smarty_core_rmdir($_params, $smarty);
}
else {
$smarty->_unlink($params['dirname'] . DIRECTORY_SEPARATOR . $_entry, $params['exp_time']);
}
}
}
closedir($_handle);
}
if ($params['level']) {
return @rmdir($params['dirname']);
}
return (bool)$_handle;
}
/* vim: set expandtab: */
?>
@@ -1,71 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Handle insert tags
*
* @param array $args
* @return string
*/
function smarty_core_run_insert_handler($params, &$smarty)
{
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
if ($smarty->debugging) {
$_params = array();
$_debug_start_time = smarty_core_get_microtime($_params, $smarty);
}
if ($smarty->caching) {
$_arg_string = serialize($params['args']);
$_name = $params['args']['name'];
if (!isset($smarty->_cache_info['insert_tags'][$_name])) {
$smarty->_cache_info['insert_tags'][$_name] = array('insert',
$_name,
$smarty->_plugins['insert'][$_name][1],
$smarty->_plugins['insert'][$_name][2],
!empty($params['args']['script']) ? true : false);
}
return $smarty->_smarty_md5."{insert_cache $_arg_string}".$smarty->_smarty_md5;
} else {
if (isset($params['args']['script'])) {
$_params = array('resource_name' => $smarty->_dequote($params['args']['script']));
require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php');
if(!smarty_core_get_php_resource($_params, $smarty)) {
return false;
}
if ($_params['resource_type'] == 'file') {
$smarty->_include($_params['php_resource'], true);
} else {
$smarty->_eval($_params['php_resource']);
}
unset($params['args']['script']);
}
$_funcname = $smarty->_plugins['insert'][$params['args']['name']][0];
$_content = $_funcname($params['args'], $smarty);
if ($smarty->debugging) {
$_params = array();
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
$smarty->_smarty_debug_info[] = array('type' => 'insert',
'filename' => 'insert_'.$params['args']['name'],
'depth' => $smarty->_inclusion_depth,
'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time);
}
if (!empty($params['args']["assign"])) {
$smarty->assign($params['args']["assign"], $_content);
} else {
return $_content;
}
}
}
/* vim: set expandtab: */
?>
@@ -1,50 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* called for included php files within templates
*
* @param string $smarty_file
* @param string $smarty_assign variable to assign the included template's
* output into
* @param boolean $smarty_once uses include_once if this is true
* @param array $smarty_include_vars associative array of vars from
* {include file="blah" var=$var}
*/
// $file, $assign, $once, $_smarty_include_vars
function smarty_core_smarty_include_php($params, &$smarty)
{
$_params = array('resource_name' => $params['smarty_file']);
require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php');
smarty_core_get_php_resource($_params, $smarty);
$_smarty_resource_type = $_params['resource_type'];
$_smarty_php_resource = $_params['php_resource'];
if (!empty($params['smarty_assign'])) {
ob_start();
if ($_smarty_resource_type == 'file') {
$smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']);
} else {
$smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']);
}
$smarty->assign($params['smarty_assign'], ob_get_contents());
ob_end_clean();
} else {
if ($_smarty_resource_type == 'file') {
$smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']);
} else {
$smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']);
}
}
}
/* vim: set expandtab: */
?>
-96
View File
@@ -1,96 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Prepend the cache information to the cache file
* and write it
*
* @param string $tpl_file
* @param string $cache_id
* @param string $compile_id
* @param string $results
* @return true|null
*/
// $tpl_file, $cache_id, $compile_id, $results
function smarty_core_write_cache_file($params, &$smarty)
{
// put timestamp in cache header
$smarty->_cache_info['timestamp'] = time();
if ($smarty->cache_lifetime > -1){
// expiration set
$smarty->_cache_info['expires'] = $smarty->_cache_info['timestamp'] + $smarty->cache_lifetime;
} else {
// cache will never expire
$smarty->_cache_info['expires'] = -1;
}
// collapse nocache.../nocache-tags
if (preg_match_all('!\{(/?)nocache\:[0-9a-f]{32}#\d+\}!', $params['results'], $match, PREG_PATTERN_ORDER)) {
// remove everything between every pair of outermost noache.../nocache-tags
// and replace it by a single nocache-tag
// this new nocache-tag will be replaced by dynamic contents in
// smarty_core_process_compiled_includes() on a cache-read
$match_count = count($match[0]);
$results = preg_split('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!', $params['results'], -1, PREG_SPLIT_DELIM_CAPTURE);
$level = 0;
$j = 0;
for ($i=0, $results_count = count($results); $i < $results_count && $j < $match_count; $i++) {
if ($results[$i] == $match[0][$j]) {
// nocache tag
if ($match[1][$j]) { // closing tag
$level--;
unset($results[$i]);
} else { // opening tag
if ($level++ > 0) unset($results[$i]);
}
$j++;
} elseif ($level > 0) {
unset($results[$i]);
}
}
$params['results'] = implode('', $results);
}
$smarty->_cache_info['cache_serials'] = $smarty->_cache_serials;
// prepend the cache header info into cache file
$_cache_info = serialize($smarty->_cache_info);
$params['results'] = strlen($_cache_info) . "\n" . $_cache_info . $params['results'];
if (!empty($smarty->cache_handler_func)) {
// use cache_handler function
call_user_func_array($smarty->cache_handler_func,
array('write', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], $smarty->_cache_info['expires']));
} else {
// use local cache file
if(!@is_writable($smarty->cache_dir)) {
// cache_dir not writable, see if it exists
if(!@is_dir($smarty->cache_dir)) {
$smarty->trigger_error('the $cache_dir \'' . $smarty->cache_dir . '\' does not exist, or is not a directory.', E_USER_ERROR);
return false;
}
$smarty->trigger_error('unable to write to $cache_dir \'' . realpath($smarty->cache_dir) . '\'. Be sure $cache_dir is writable by the web server user.', E_USER_ERROR);
return false;
}
$_auto_id = $smarty->_get_auto_id($params['cache_id'], $params['compile_id']);
$_cache_file = $smarty->_get_auto_filename($smarty->cache_dir, $params['tpl_file'], $_auto_id);
$_params = array('filename' => $_cache_file, 'contents' => $params['results'], 'create_dirs' => true);
require_once(SMARTY_CORE_DIR . 'core.write_file.php');
smarty_core_write_file($_params, $smarty);
return true;
}
}
/* vim: set expandtab: */
?>
@@ -1,91 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Extract non-cacheable parts out of compiled template and write it
*
* @param string $compile_path
* @param string $template_compiled
* @return boolean
*/
function smarty_core_write_compiled_include($params, &$smarty)
{
$_tag_start = 'if \(\$this->caching && \!\$this->_cache_including\)\: echo \'\{nocache\:('.$params['cache_serial'].')#(\d+)\}\'; endif;';
$_tag_end = 'if \(\$this->caching && \!\$this->_cache_including\)\: echo \'\{/nocache\:(\\2)#(\\3)\}\'; endif;';
preg_match_all('!('.$_tag_start.'(.*)'.$_tag_end.')!Us',
$params['compiled_content'], $_match_source, PREG_SET_ORDER);
// no nocache-parts found: done
if (count($_match_source)==0) return;
// convert the matched php-code to functions
$_include_compiled = "<?php /* Smarty version ".$smarty->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n";
$_include_compiled .= " compiled from " . strtr(urlencode($params['resource_name']), array('%2F'=>'/', '%3A'=>':')) . " */\n\n";
$_compile_path = $params['include_file_path'];
$smarty->_cache_serials[$_compile_path] = $params['cache_serial'];
$_include_compiled .= "\$this->_cache_serials['".$_compile_path."'] = '".$params['cache_serial']."';\n\n?>";
$_include_compiled .= $params['plugins_code'];
$_include_compiled .= "<?php";
$this_varname = ((double)phpversion() >= 5.0) ? '_smarty' : 'this';
for ($_i = 0, $_for_max = count($_match_source); $_i < $_for_max; $_i++) {
$_match =& $_match_source[$_i];
$source = $_match[4];
if ($this_varname == '_smarty') {
/* rename $this to $_smarty in the sourcecode */
$tokens = token_get_all('<?php ' . $_match[4]);
/* remove trailing <?php */
$open_tag = '';
while ($tokens) {
$token = array_shift($tokens);
if (is_array($token)) {
$open_tag .= $token[1];
} else {
$open_tag .= $token;
}
if ($open_tag == '<?php ') break;
}
for ($i=0, $count = count($tokens); $i < $count; $i++) {
if (is_array($tokens[$i])) {
if ($tokens[$i][0] == T_VARIABLE && $tokens[$i][1] == '$this') {
$tokens[$i] = '$' . $this_varname;
} else {
$tokens[$i] = $tokens[$i][1];
}
}
}
$source = implode('', $tokens);
}
/* add function to compiled include */
$_include_compiled .= "
function _smarty_tplfunc_$_match[2]_$_match[3](&\$$this_varname)
{
$source
}
";
}
$_include_compiled .= "\n\n?>\n";
$_params = array('filename' => $_compile_path,
'contents' => $_include_compiled, 'create_dirs' => true);
require_once(SMARTY_CORE_DIR . 'core.write_file.php');
smarty_core_write_file($_params, $smarty);
return true;
}
?>
@@ -1,35 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* write the compiled resource
*
* @param string $compile_path
* @param string $compiled_content
* @return true
*/
function smarty_core_write_compiled_resource($params, &$smarty)
{
if(!@is_writable($smarty->compile_dir)) {
// compile_dir not writable, see if it exists
if(!@is_dir($smarty->compile_dir)) {
$smarty->trigger_error('the $compile_dir \'' . $smarty->compile_dir . '\' does not exist, or is not a directory.', E_USER_ERROR);
return false;
}
$smarty->trigger_error('unable to write to $compile_dir \'' . realpath($smarty->compile_dir) . '\'. Be sure $compile_dir is writable by the web server user.', E_USER_ERROR);
return false;
}
$_params = array('filename' => $params['compile_path'], 'contents' => $params['compiled_content'], 'create_dirs' => true);
require_once(SMARTY_CORE_DIR . 'core.write_file.php');
smarty_core_write_file($_params, $smarty);
return true;
}
/* vim: set expandtab: */
?>
-54
View File
@@ -1,54 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* write out a file to disk
*
* @param string $filename
* @param string $contents
* @param boolean $create_dirs
* @return boolean
*/
function smarty_core_write_file($params, &$smarty)
{
$_dirname = dirname($params['filename']);
if ($params['create_dirs']) {
$_params = array('dir' => $_dirname);
require_once(SMARTY_CORE_DIR . 'core.create_dir_structure.php');
smarty_core_create_dir_structure($_params, $smarty);
}
// write to tmp file, then rename it to avoid file locking race condition
$_tmp_file = tempnam($_dirname, 'wrt');
if (!($fd = @fopen($_tmp_file, 'wb'))) {
$_tmp_file = $_dirname . DIRECTORY_SEPARATOR . uniqid('wrt');
if (!($fd = @fopen($_tmp_file, 'wb'))) {
$smarty->trigger_error("problem writing temporary file '$_tmp_file'");
return false;
}
}
fwrite($fd, $params['contents']);
fclose($fd);
if (DIRECTORY_SEPARATOR == '\\' || !@rename($_tmp_file, $params['filename'])) {
// On platforms and filesystems that cannot overwrite with rename()
// delete the file before renaming it -- because windows always suffers
// this, it is short-circuited to avoid the initial rename() attempt
@unlink($params['filename']);
@rename($_tmp_file, $params['filename']);
}
@chmod($params['filename'], $smarty->_file_perms);
return true;
}
/* vim: set expandtab: */
?>
+68 -50
View File
@@ -1,39 +1,52 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
* Smarty plugin to format text blocks
*
* @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>
* @link http://smarty.php.net/manual/en/language.function.textformat.php {textformat}
* (Smarty online manual)
* @param array
* <pre>
* Params: style: string (email)
* indent: integer (0)
* wrap: integer (80)
* wrap_char string ("\n")
* indent_char: string (" ")
* wrap_boundary: boolean (true)
* </pre>
* or custom wrap/indent settings
* Params:
*
* - style - string (email)
* - indent - integer (0)
* - wrap - integer (80)
* - wrap_char - string ("\n")
* - indent_char - string (" ")
* - wrap_boundary - boolean (true)
*
* @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat}
* (Smarty online manual)
*
* @param array $params parameters
* @param string $content contents of the block
* @param Smarty_Internal_Template $template template object
* @param boolean &$repeat repeat flag
*
* @return string content re-formatted
* @author Monte Ohrt <monte at ohrt dot com>
* @param string contents of the block
* @param Smarty clever simulation of a method
* @return string string $content re-formatted
* @throws \SmartyException
*/
function smarty_block_textformat($params, $content, &$smarty)
function smarty_block_textformat($params, $content, Smarty_Internal_Template $template, &$repeat)
{
if (is_null($content)) {
return;
}
if (Smarty::$_MBSTRING) {
$template->_checkPlugins(
array(
array(
'function' => 'smarty_modifier_mb_wordwrap',
'file' => SMARTY_PLUGINS_DIR . 'modifier.mb_wordwrap.php'
)
)
);
}
$style = null;
$indent = 0;
$indent_first = 0;
@@ -42,7 +55,6 @@ function smarty_block_textformat($params, $content, &$smarty)
$wrap_char = "\n";
$wrap_cut = false;
$assign = null;
foreach ($params as $_key => $_val) {
switch ($_key) {
case 'style':
@@ -51,53 +63,59 @@ function smarty_block_textformat($params, $content, &$smarty)
case 'assign':
$$_key = (string)$_val;
break;
case 'indent':
case 'indent_first':
case 'wrap':
$$_key = (int)$_val;
break;
case 'wrap_cut':
$$_key = (bool)$_val;
break;
default:
$smarty->trigger_error("textformat: unknown attribute '$_key'");
trigger_error("textformat: unknown attribute '{$_key}'");
}
}
if ($style == 'email') {
if ($style === 'email') {
$wrap = 72;
}
// split into paragraphs
$_paragraphs = preg_split('![\r\n][\r\n]!',$content);
$_output = '';
for($_x = 0, $_y = count($_paragraphs); $_x < $_y; $_x++) {
if ($_paragraphs[$_x] == '') {
$_paragraphs = preg_split('![\r\n]{2}!', $content);
foreach ($_paragraphs as &$_paragraph) {
if (!$_paragraph) {
continue;
}
// convert mult. spaces & special chars to single space
$_paragraphs[$_x] = preg_replace(array('!\s+!','!(^\s+)|(\s+$)!'), array(' ',''), $_paragraphs[$_x]);
$_paragraph =
preg_replace(
array(
'!\s+!' . Smarty::$_UTF8_MODIFIER,
'!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER
),
array(
' ',
''
),
$_paragraph
);
// indent first line
if($indent_first > 0) {
$_paragraphs[$_x] = str_repeat($indent_char, $indent_first) . $_paragraphs[$_x];
if ($indent_first > 0) {
$_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph;
}
// wordwrap sentences
$_paragraphs[$_x] = wordwrap($_paragraphs[$_x], $wrap - $indent, $wrap_char, $wrap_cut);
if (Smarty::$_MBSTRING) {
$_paragraph = smarty_modifier_mb_wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);
} else {
$_paragraph = wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);
}
// indent lines
if($indent > 0) {
$_paragraphs[$_x] = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraphs[$_x]);
if ($indent > 0) {
$_paragraph = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraph);
}
}
$_output = implode($wrap_char . $wrap_char, $_paragraphs);
return $assign ? $smarty->assign($assign, $_output) : $_output;
if ($assign) {
$template->assign($assign, $_output);
} else {
return $_output;
}
}
/* vim: set expandtab: */
?>
-40
View File
@@ -1,40 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {assign} compiler function plugin
*
* Type: compiler function<br>
* Name: assign<br>
* Purpose: assign a value to a template variable
* @link http://smarty.php.net/manual/en/language.custom.functions.php#LANGUAGE.FUNCTION.ASSIGN {assign}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com> (initial author)
* @author messju mohr <messju at lammfellpuschen dot de> (conversion to compiler function)
* @param string containing var-attribute and value-attribute
* @param Smarty_Compiler
*/
function smarty_compiler_assign($tag_attrs, &$compiler)
{
$_params = $compiler->_parse_attrs($tag_attrs);
if (!isset($_params['var'])) {
$compiler->_syntax_error("assign: missing 'var' parameter", E_USER_WARNING);
return;
}
if (!isset($_params['value'])) {
$compiler->_syntax_error("assign: missing 'value' parameter", E_USER_WARNING);
return;
}
return "\$this->assign({$_params['var']}, {$_params['value']});";
}
/* vim: set expandtab: */
?>
@@ -1,40 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {assign_debug_info} function plugin
*
* Type: function<br>
* Name: assign_debug_info<br>
* Purpose: assign debug info to the template<br>
* @author Monte Ohrt <monte at ohrt dot com>
* @param array unused in this plugin, this plugin uses {@link Smarty::$_config},
* {@link Smarty::$_tpl_vars} and {@link Smarty::$_smarty_debug_info}
* @param Smarty
*/
function smarty_function_assign_debug_info($params, &$smarty)
{
$assigned_vars = $smarty->_tpl_vars;
ksort($assigned_vars);
if (@is_array($smarty->_config[0])) {
$config_vars = $smarty->_config[0];
ksort($config_vars);
$smarty->assign("_debug_config_keys", array_keys($config_vars));
$smarty->assign("_debug_config_vals", array_values($config_vars));
}
$included_templates = $smarty->_smarty_debug_info;
$smarty->assign("_debug_keys", array_keys($assigned_vars));
$smarty->assign("_debug_vals", array_values($assigned_vars));
$smarty->assign("_debug_tpls", $included_templates);
}
/* vim: set expandtab: */
?>
-142
View File
@@ -1,142 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {config_load} function plugin
*
* Type: function<br>
* Name: config_load<br>
* Purpose: load config file vars
* @link http://smarty.php.net/manual/en/language.function.config.load.php {config_load}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @author messju mohr <messju at lammfellpuschen dot de> (added use of resources)
* @param array Format:
* <pre>
* array('file' => required config file name,
* 'section' => optional config file section to load
* 'scope' => local/parent/global
* 'global' => overrides scope, setting to parent if true)
* </pre>
* @param Smarty
*/
function smarty_function_config_load($params, &$smarty)
{
if ($smarty->debugging) {
$_params = array();
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
$_debug_start_time = smarty_core_get_microtime($_params, $smarty);
}
$_file = isset($params['file']) ? $smarty->_dequote($params['file']) : null;
$_section = isset($params['section']) ? $smarty->_dequote($params['section']) : null;
$_scope = isset($params['scope']) ? $smarty->_dequote($params['scope']) : 'global';
$_global = isset($params['global']) ? $smarty->_dequote($params['global']) : false;
if (!isset($_file) || strlen($_file) == 0) {
$smarty->trigger_error("missing 'file' attribute in config_load tag", E_USER_ERROR, __FILE__, __LINE__);
}
if (isset($_scope)) {
if ($_scope != 'local' &&
$_scope != 'parent' &&
$_scope != 'global') {
$smarty->trigger_error("invalid 'scope' attribute value", E_USER_ERROR, __FILE__, __LINE__);
}
} else {
if ($_global) {
$_scope = 'parent';
} else {
$_scope = 'local';
}
}
$_params = array('resource_name' => $_file,
'resource_base_path' => $smarty->config_dir,
'get_source' => false);
$smarty->_parse_resource_name($_params);
$_file_path = $_params['resource_type'] . ':' . $_params['resource_name'];
if (isset($_section))
$_compile_file = $smarty->_get_compile_path($_file_path.'|'.$_section);
else
$_compile_file = $smarty->_get_compile_path($_file_path);
if($smarty->force_compile || !file_exists($_compile_file)) {
$_compile = true;
} elseif ($smarty->compile_check) {
$_params = array('resource_name' => $_file,
'resource_base_path' => $smarty->config_dir,
'get_source' => false);
$_compile = $smarty->_fetch_resource_info($_params) &&
$_params['resource_timestamp'] > filemtime($_compile_file);
} else {
$_compile = false;
}
if($_compile) {
// compile config file
if(!is_object($smarty->_conf_obj)) {
require_once SMARTY_DIR . $smarty->config_class . '.class.php';
$smarty->_conf_obj = new $smarty->config_class();
$smarty->_conf_obj->overwrite = $smarty->config_overwrite;
$smarty->_conf_obj->booleanize = $smarty->config_booleanize;
$smarty->_conf_obj->read_hidden = $smarty->config_read_hidden;
$smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines;
}
$_params = array('resource_name' => $_file,
'resource_base_path' => $smarty->config_dir,
$_params['get_source'] = true);
if (!$smarty->_fetch_resource_info($_params)) {
return;
}
$smarty->_conf_obj->set_file_contents($_file, $_params['source_content']);
$_config_vars = array_merge($smarty->_conf_obj->get($_file),
$smarty->_conf_obj->get($_file, $_section));
if(function_exists('var_export')) {
$_output = '<?php $_config_vars = ' . var_export($_config_vars, true) . '; ?>';
} else {
$_output = '<?php $_config_vars = unserialize(\'' . strtr(serialize($_config_vars),array('\''=>'\\\'', '\\'=>'\\\\')) . '\'); ?>';
}
$_params = (array('compile_path' => $_compile_file, 'compiled_content' => $_output, 'resource_timestamp' => $_params['resource_timestamp']));
require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php');
smarty_core_write_compiled_resource($_params, $smarty);
} else {
include($_compile_file);
}
if ($smarty->caching) {
$smarty->_cache_info['config'][$_file] = true;
}
$smarty->_config[0]['vars'] = @array_merge($smarty->_config[0]['vars'], $_config_vars);
$smarty->_config[0]['files'][$_file] = true;
if ($_scope == 'parent') {
$smarty->_config[1]['vars'] = @array_merge($smarty->_config[1]['vars'], $_config_vars);
$smarty->_config[1]['files'][$_file] = true;
} else if ($_scope == 'global') {
for ($i = 1, $for_max = count($smarty->_config); $i < $for_max; $i++) {
$smarty->_config[$i]['vars'] = @array_merge($smarty->_config[$i]['vars'], $_config_vars);
$smarty->_config[$i]['files'][$_file] = true;
}
}
if ($smarty->debugging) {
$_params = array();
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
$smarty->_smarty_debug_info[] = array('type' => 'config',
'filename' => $_file.' ['.$_section.'] '.$_scope,
'depth' => $smarty->_inclusion_depth,
'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time);
}
}
/* vim: set expandtab: */
?>
+36 -54
View File
@@ -1,80 +1,62 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*
* @package Smarty
* @subpackage PluginsFunction
*/
/**
* 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>
* @link http://smarty.php.net/manual/en/language.function.counter.php {counter}
* (Smarty online manual)
* @param array parameters
* @param Smarty
* @link http://www.smarty.net/manual/en/language.function.counter.php {counter}
* (Smarty online manual)
*
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
*
* @return string|null
*/
function smarty_function_counter($params, &$smarty)
function smarty_function_counter($params, $template)
{
static $counters = array();
$name = (isset($params['name'])) ? $params['name'] : 'default';
if (!isset($counters[$name])) {
$counters[$name] = array(
'start'=>1,
'skip'=>1,
'direction'=>'up',
'count'=>1
);
$name = (isset($params[ 'name' ])) ? $params[ 'name' ] : 'default';
if (!isset($counters[ $name ])) {
$counters[ $name ] = array('start' => 1, 'skip' => 1, 'direction' => 'up', 'count' => 1);
}
$counter =& $counters[$name];
if (isset($params['start'])) {
$counter['start'] = $counter['count'] = (int)$params['start'];
$counter =& $counters[ $name ];
if (isset($params[ 'start' ])) {
$counter[ 'start' ] = $counter[ 'count' ] = (int)$params[ 'start' ];
}
if (!empty($params['assign'])) {
$counter['assign'] = $params['assign'];
if (!empty($params[ 'assign' ])) {
$counter[ 'assign' ] = $params[ 'assign' ];
}
if (isset($counter['assign'])) {
$smarty->assign($counter['assign'], $counter['count']);
if (isset($counter[ 'assign' ])) {
$template->assign($counter[ 'assign' ], $counter[ 'count' ]);
}
if (isset($params['print'])) {
$print = (bool)$params['print'];
if (isset($params[ 'print' ])) {
$print = (bool)$params[ 'print' ];
} else {
$print = empty($counter['assign']);
$print = empty($counter[ 'assign' ]);
}
if ($print) {
$retval = $counter['count'];
$retval = $counter[ 'count' ];
} else {
$retval = null;
}
if (isset($params['skip'])) {
$counter['skip'] = $params['skip'];
if (isset($params[ 'skip' ])) {
$counter[ 'skip' ] = $params[ 'skip' ];
}
if (isset($params['direction'])) {
$counter['direction'] = $params['direction'];
if (isset($params[ 'direction' ])) {
$counter[ 'direction' ] = $params[ 'direction' ];
}
if ($counter[ 'direction' ] === 'down') {
$counter[ 'count' ] -= $counter[ 'skip' ];
} else {
$counter[ 'count' ] += $counter[ 'skip' ];
}
if ($counter['direction'] == "down")
$counter['count'] -= $counter['skip'];
else
$counter['count'] += $counter['skip'];
return $retval;
}
/* vim: set expandtab: */
?>
+58 -72
View File
@@ -1,106 +1,92 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*
* @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {cycle} function plugin
* Type: function
* Name: cycle
* Date: May 3, 2002
* Purpose: cycle through given values
* Params:
*
* Type: function<br>
* Name: cycle<br>
* Date: May 3, 2002<br>
* Purpose: cycle through given values<br>
* Input:
* - 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)
* - reset = boolean - resets given var to true
* - print = boolean - print var or not. default is true
* - advance = boolean - whether or not to advance the cycle
* - delimiter = the value delimiter, default is ","
* - assign = boolean, assigns to template var instead of
* printed.
* - 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)
* - reset - boolean - resets given var to true
* - print - boolean - print var or not. default is true
* - advance - boolean - whether or not to advance the cycle
* - delimiter - the value delimiter, default is ","
* - assign - boolean, assigns to template var instead of printed.
*
* Examples:
*
* Examples:<br>
* <pre>
* {cycle values="#eeeeee,#d0d0d0d"}
* {cycle name=row values="one,two,three" reset=true}
* {cycle name=row}
* </pre>
* @link http://smarty.php.net/manual/en/language.function.cycle.php {cycle}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @author credit to Mark Priatel <mpriatel@rogers.com>
* @author credit to Gerard <gerard@interfold.com>
* @author credit to Jason Sweat <jsweat_php@yahoo.com>
* @version 1.3
* @param array
* @param Smarty
*
* @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @author credit to Mark Priatel <mpriatel@rogers.com>
* @author credit to Gerard <gerard@interfold.com>
* @author credit to Jason Sweat <jsweat_php@yahoo.com>
* @version 1.3
*
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
*
* @return string|null
*/
function smarty_function_cycle($params, &$smarty)
function smarty_function_cycle($params, $template)
{
static $cycle_vars;
$name = (empty($params['name'])) ? 'default' : $params['name'];
$print = (isset($params['print'])) ? (bool)$params['print'] : true;
$advance = (isset($params['advance'])) ? (bool)$params['advance'] : true;
$reset = (isset($params['reset'])) ? (bool)$params['reset'] : false;
if (!in_array('values', array_keys($params))) {
if(!isset($cycle_vars[$name]['values'])) {
$smarty->trigger_error("cycle: missing 'values' parameter");
$name = (empty($params[ 'name' ])) ? 'default' : $params[ 'name' ];
$print = (isset($params[ 'print' ])) ? (bool)$params[ 'print' ] : true;
$advance = (isset($params[ 'advance' ])) ? (bool)$params[ 'advance' ] : true;
$reset = (isset($params[ 'reset' ])) ? (bool)$params[ 'reset' ] : false;
if (!isset($params[ 'values' ])) {
if (!isset($cycle_vars[ $name ][ 'values' ])) {
trigger_error('cycle: missing \'values\' parameter');
return;
}
} else {
if(isset($cycle_vars[$name]['values'])
&& $cycle_vars[$name]['values'] != $params['values'] ) {
$cycle_vars[$name]['index'] = 0;
if (isset($cycle_vars[ $name ][ 'values' ]) && $cycle_vars[ $name ][ 'values' ] !== $params[ 'values' ]) {
$cycle_vars[ $name ][ 'index' ] = 0;
}
$cycle_vars[$name]['values'] = $params['values'];
$cycle_vars[ $name ][ 'values' ] = $params[ 'values' ];
}
if (isset($params['delimiter'])) {
$cycle_vars[$name]['delimiter'] = $params['delimiter'];
} elseif (!isset($cycle_vars[$name]['delimiter'])) {
$cycle_vars[$name]['delimiter'] = ',';
if (isset($params[ 'delimiter' ])) {
$cycle_vars[ $name ][ 'delimiter' ] = $params[ 'delimiter' ];
} elseif (!isset($cycle_vars[ $name ][ 'delimiter' ])) {
$cycle_vars[ $name ][ 'delimiter' ] = ',';
}
if(is_array($cycle_vars[$name]['values'])) {
$cycle_array = $cycle_vars[$name]['values'];
if (is_array($cycle_vars[ $name ][ 'values' ])) {
$cycle_array = $cycle_vars[ $name ][ 'values' ];
} else {
$cycle_array = explode($cycle_vars[$name]['delimiter'],$cycle_vars[$name]['values']);
$cycle_array = explode($cycle_vars[ $name ][ 'delimiter' ], $cycle_vars[ $name ][ 'values' ]);
}
if(!isset($cycle_vars[$name]['index']) || $reset ) {
$cycle_vars[$name]['index'] = 0;
if (!isset($cycle_vars[ $name ][ 'index' ]) || $reset) {
$cycle_vars[ $name ][ 'index' ] = 0;
}
if (isset($params['assign'])) {
if (isset($params[ 'assign' ])) {
$print = false;
$smarty->assign($params['assign'], $cycle_array[$cycle_vars[$name]['index']]);
$template->assign($params[ 'assign' ], $cycle_array[ $cycle_vars[ $name ][ 'index' ] ]);
}
if($print) {
$retval = $cycle_array[$cycle_vars[$name]['index']];
if ($print) {
$retval = $cycle_array[ $cycle_vars[ $name ][ 'index' ] ];
} else {
$retval = null;
}
if($advance) {
if ( $cycle_vars[$name]['index'] >= count($cycle_array) -1 ) {
$cycle_vars[$name]['index'] = 0;
if ($advance) {
if ($cycle_vars[ $name ][ 'index' ] >= count($cycle_array) - 1) {
$cycle_vars[ $name ][ 'index' ] = 0;
} else {
$cycle_vars[$name]['index']++;
$cycle_vars[ $name ][ 'index' ]++;
}
}
return $retval;
}
/* vim: set expandtab: */
?>
-35
View File
@@ -1,35 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {debug} function plugin
*
* Type: function<br>
* Name: debug<br>
* Date: July 1, 2002<br>
* Purpose: popup debug window
* @link http://smarty.php.net/manual/en/language.function.debug.php {debug}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @version 1.0
* @param array
* @param Smarty
* @return string output from {@link Smarty::_generate_debug_output()}
*/
function smarty_function_debug($params, &$smarty)
{
if (isset($params['output'])) {
$smarty->assign('_smarty_debug_output', $params['output']);
}
require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');
return smarty_core_display_debug_console(null, $smarty);
}
/* vim: set expandtab: */
?>
-49
View File
@@ -1,49 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {eval} function plugin
*
* Type: function<br>
* Name: eval<br>
* Purpose: evaluate a template variable as a template<br>
* @link http://smarty.php.net/manual/en/language.function.eval.php {eval}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param array
* @param Smarty
*/
function smarty_function_eval($params, &$smarty)
{
if (!isset($params['var'])) {
$smarty->trigger_error("eval: missing 'var' parameter");
return;
}
if($params['var'] == '') {
return;
}
$smarty->_compile_source('evaluated template', $params['var'], $_var_compiled);
ob_start();
$smarty->_eval('?>' . $_var_compiled);
$_contents = ob_get_contents();
ob_end_clean();
if (!empty($params['assign'])) {
$smarty->assign($params['assign'], $_contents);
} else {
return $_contents;
}
}
/* vim: set expandtab: */
?>
+181 -198
View File
@@ -1,221 +1,204 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*
* @package Smarty
* @subpackage PluginsFunction
*/
/**
* 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://smarty.php.net/manual/en/language.function.fetch.php {fetch}
* (Smarty online manual)
*
* @link http://www.smarty.net/manual/en/language.function.fetch.php {fetch}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param array
* @param Smarty
* @return string|null if the assign parameter is passed, Smarty assigns the
* result to a template variable
*
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
*
* @throws SmartyException
* @return string|null if the assign parameter is passed, Smarty assigns the result to a template variable
*/
function smarty_function_fetch($params, &$smarty)
function smarty_function_fetch($params, $template)
{
if (empty($params['file'])) {
$smarty->_trigger_fatal_error("[plugin] parameter 'file' cannot be empty");
if (empty($params[ 'file' ])) {
trigger_error('[plugin] fetch parameter \'file\' cannot be empty', E_USER_NOTICE);
return;
}
$content = '';
if ($smarty->security && !preg_match('!^(http|ftp)://!i', $params['file'])) {
$_params = array('resource_type' => 'file', 'resource_name' => $params['file']);
require_once(SMARTY_CORE_DIR . 'core.is_secure.php');
if(!smarty_core_is_secure($_params, $smarty)) {
$smarty->_trigger_fatal_error('[plugin] (secure mode) fetch \'' . $params['file'] . '\' is not allowed');
return;
}
// fetch the file
if($fp = @fopen($params['file'],'r')) {
while(!feof($fp)) {
$content .= fgets ($fp,4096);
// strip file protocol
if (stripos($params[ 'file' ], 'file://') === 0) {
$params[ 'file' ] = substr($params[ 'file' ], 7);
}
$protocol = strpos($params[ 'file' ], '://');
if ($protocol !== false) {
$protocol = strtolower(substr($params[ 'file' ], 0, $protocol));
}
if (isset($template->smarty->security_policy)) {
if ($protocol) {
// remote resource (or php stream, …)
if (!$template->smarty->security_policy->isTrustedUri($params[ 'file' ])) {
return;
}
fclose($fp);
} else {
$smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] . '\'');
// local file
if (!$template->smarty->security_policy->isTrustedResourceDir($params[ 'file' ])) {
return;
}
}
}
$content = '';
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 = '';
$uri = !empty($uri_parts[ 'path' ]) ? $uri_parts[ 'path' ] : '/';
$uri .= !empty($uri_parts[ 'query' ]) ? '?' . $uri_parts[ 'query' ] : '';
$_is_proxy = false;
if (empty($uri_parts[ 'port' ])) {
$port = 80;
} else {
$port = $uri_parts[ 'port' ];
}
if (!empty($uri_parts[ 'user' ])) {
$user = $uri_parts[ 'user' ];
}
if (!empty($uri_parts[ 'pass' ])) {
$pass = $uri_parts[ 'pass' ];
}
// loop through parameters, setup headers
foreach ($params as $param_key => $param_value) {
switch ($param_key) {
case 'file':
case 'assign':
case 'assign_headers':
break;
case 'user':
if (!empty($param_value)) {
$user = $param_value;
}
break;
case 'pass':
if (!empty($param_value)) {
$pass = $param_value;
}
break;
case 'accept':
if (!empty($param_value)) {
$accept = $param_value;
}
break;
case 'header':
if (!empty($param_value)) {
if (!preg_match('![\w\d-]+: .+!', $param_value)) {
trigger_error("[plugin] invalid header format '{$param_value}'", E_USER_NOTICE);
return;
} else {
$extra_headers[] = $param_value;
}
}
break;
case 'proxy_host':
if (!empty($param_value)) {
$proxy_host = $param_value;
}
break;
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);
return;
}
break;
case 'agent':
if (!empty($param_value)) {
$agent = $param_value;
}
break;
case 'referer':
if (!empty($param_value)) {
$referer = $param_value;
}
break;
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);
return;
}
break;
default:
trigger_error("[plugin] unrecognized attribute '{$param_key}'", E_USER_NOTICE);
return;
}
}
if (!empty($proxy_host) && !empty($proxy_port)) {
$_is_proxy = true;
$fp = fsockopen($proxy_host, $proxy_port, $errno, $errstr, $timeout);
} else {
$fp = fsockopen($server_name, $port, $errno, $errstr, $timeout);
}
if (!$fp) {
trigger_error("[plugin] unable to fetch: $errstr ($errno)", E_USER_NOTICE);
return;
} else {
if ($_is_proxy) {
fputs($fp, 'GET ' . $params[ 'file' ] . " HTTP/1.0\r\n");
} else {
fputs($fp, "GET $uri HTTP/1.0\r\n");
}
if (!empty($host)) {
fputs($fp, "Host: $host\r\n");
}
if (!empty($accept)) {
fputs($fp, "Accept: $accept\r\n");
}
if (!empty($agent)) {
fputs($fp, "User-Agent: $agent\r\n");
}
if (!empty($referer)) {
fputs($fp, "Referer: $referer\r\n");
}
if (isset($extra_headers) && is_array($extra_headers)) {
foreach ($extra_headers as $curr_header) {
fputs($fp, $curr_header . "\r\n");
}
}
if (!empty($user) && !empty($pass)) {
fputs($fp, 'Authorization: BASIC ' . base64_encode("$user:$pass") . "\r\n");
}
fputs($fp, "\r\n");
while (!feof($fp)) {
$content .= fgets($fp, 4096);
}
fclose($fp);
$csplit = preg_split("!\r\n\r\n!", $content, 2);
$content = $csplit[ 1 ];
if (!empty($params[ 'assign_headers' ])) {
$template->assign($params[ 'assign_headers' ], preg_split("!\r\n!", $csplit[ 0 ]));
}
}
} else {
trigger_error("[plugin fetch] unable to parse URL, check syntax", E_USER_NOTICE);
return;
}
} else {
// not a local file
if(preg_match('!^http://!i',$params['file'])) {
// 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->_version;
$referer = "";
$uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/';
$uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : '';
$_is_proxy = false;
if(empty($uri_parts['port'])) {
$port = 80;
} else {
$port = $uri_parts['port'];
}
if(!empty($uri_parts['user'])) {
$user = $uri_parts['user'];
}
if(!empty($uri_parts['pass'])) {
$pass = $uri_parts['pass'];
}
// loop through parameters, setup headers
foreach($params as $param_key => $param_value) {
switch($param_key) {
case "file":
case "assign":
case "assign_headers":
break;
case "user":
if(!empty($param_value)) {
$user = $param_value;
}
break;
case "pass":
if(!empty($param_value)) {
$pass = $param_value;
}
break;
case "accept":
if(!empty($param_value)) {
$accept = $param_value;
}
break;
case "header":
if(!empty($param_value)) {
if(!preg_match('![\w\d-]+: .+!',$param_value)) {
$smarty->_trigger_fatal_error("[plugin] invalid header format '".$param_value."'");
return;
} else {
$extra_headers[] = $param_value;
}
}
break;
case "proxy_host":
if(!empty($param_value)) {
$proxy_host = $param_value;
}
break;
case "proxy_port":
if(!preg_match('!\D!', $param_value)) {
$proxy_port = (int) $param_value;
} else {
$smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'");
return;
}
break;
case "agent":
if(!empty($param_value)) {
$agent = $param_value;
}
break;
case "referer":
if(!empty($param_value)) {
$referer = $param_value;
}
break;
case "timeout":
if(!preg_match('!\D!', $param_value)) {
$timeout = (int) $param_value;
} else {
$smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'");
return;
}
break;
default:
$smarty->_trigger_fatal_error("[plugin] unrecognized attribute '".$param_key."'");
return;
}
}
if(!empty($proxy_host) && !empty($proxy_port)) {
$_is_proxy = true;
$fp = fsockopen($proxy_host,$proxy_port,$errno,$errstr,$timeout);
} else {
$fp = fsockopen($server_name,$port,$errno,$errstr,$timeout);
}
if(!$fp) {
$smarty->_trigger_fatal_error("[plugin] unable to fetch: $errstr ($errno)");
return;
} else {
if($_is_proxy) {
fputs($fp, 'GET ' . $params['file'] . " HTTP/1.0\r\n");
} else {
fputs($fp, "GET $uri HTTP/1.0\r\n");
}
if(!empty($host)) {
fputs($fp, "Host: $host\r\n");
}
if(!empty($accept)) {
fputs($fp, "Accept: $accept\r\n");
}
if(!empty($agent)) {
fputs($fp, "User-Agent: $agent\r\n");
}
if(!empty($referer)) {
fputs($fp, "Referer: $referer\r\n");
}
if(isset($extra_headers) && is_array($extra_headers)) {
foreach($extra_headers as $curr_header) {
fputs($fp, $curr_header."\r\n");
}
}
if(!empty($user) && !empty($pass)) {
fputs($fp, "Authorization: BASIC ".base64_encode("$user:$pass")."\r\n");
}
fputs($fp, "\r\n");
while(!feof($fp)) {
$content .= fgets($fp,4096);
}
fclose($fp);
$csplit = preg_split("!\r\n\r\n!",$content,2);
$content = $csplit[1];
if(!empty($params['assign_headers'])) {
$smarty->assign($params['assign_headers'],preg_split("!\r\n!",$csplit[0]));
}
}
} else {
$smarty->_trigger_fatal_error("[plugin] unable to parse URL, check syntax");
return;
}
} else {
// ftp fetch
if($fp = @fopen($params['file'],'r')) {
while(!feof($fp)) {
$content .= fgets ($fp,4096);
}
fclose($fp);
} else {
$smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] .'\'');
return;
}
$content = @file_get_contents($params[ 'file' ]);
if ($content === false) {
throw new SmartyException("{fetch} cannot read resource '" . $params[ 'file' ] . "'");
}
}
if (!empty($params['assign'])) {
$smarty->assign($params['assign'],$content);
if (!empty($params[ 'assign' ])) {
$template->assign($params[ 'assign' ], $content);
} else {
return $content;
}
}
/* vim: set expandtab: */
?>
+226 -83
View File
@@ -1,143 +1,286 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*
* @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>
* Input:<br>
* - name (optional) - string default "checkbox"
* - values (required) - array
* - options (optional) - associative array
* - checked (optional) - array default not set
* - separator (optional) - ie <br> or &nbsp;
* - output (optional) - the output next to each checkbox
* - assign (optional) - assign the output as an array to this variable
* 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>
* @link http://smarty.php.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
* (Smarty online manual)
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
* @author credits to Monte Ohrt <monte at ohrt dot com>
* @version 1.0
* @param array
* @param Smarty
*
* Params:
*
* - name (optional) - string default "checkbox"
* - values (required) - array
* - options (optional) - associative array
* - checked (optional) - array default not set
* - separator (optional) - ie <br> or &nbsp;
* - 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
*
* @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
* (Smarty online manual)
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
* @author credits to Monte Ohrt <monte at ohrt dot com>
* @version 1.0
*
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
*
* @return string
* @uses smarty_function_escape_special_chars()
* @uses smarty_function_escape_special_chars()
* @throws \SmartyException
*/
function smarty_function_html_checkboxes($params, &$smarty)
function smarty_function_html_checkboxes($params, Smarty_Internal_Template $template)
{
require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
$template->_checkPlugins(
array(
array(
'function' => 'smarty_function_escape_special_chars',
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'
)
)
);
$name = 'checkbox';
$values = null;
$options = null;
$selected = null;
$selected = array();
$separator = '';
$escape = true;
$labels = true;
$label_ids = false;
$output = null;
$extra = '';
foreach($params as $_key => $_val) {
switch($_key) {
foreach ($params as $_key => $_val) {
switch ($_key) {
case 'name':
case 'separator':
$$_key = $_val;
$$_key = (string)$_val;
break;
case 'escape':
case 'labels':
case 'label_ids':
$$_key = (bool)$_val;
break;
case 'options':
$$_key = (array)$_val;
break;
case 'values':
case 'output':
$$_key = array_values((array)$_val);
break;
case 'checked':
case 'selected':
$selected = array_map('strval', array_values((array)$_val));
if (is_array($_val)) {
$selected = array();
foreach ($_val as $_sel) {
if (is_object($_sel)) {
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
);
continue;
}
} else {
$_sel = smarty_function_escape_special_chars((string)$_sel);
}
$selected[ $_sel ] = true;
}
} elseif (is_object($_val)) {
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
);
}
} else {
$selected = smarty_function_escape_special_chars((string)$_val);
}
break;
case 'checkboxes':
$smarty->trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', E_USER_WARNING);
trigger_error(
'html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead',
E_USER_WARNING
);
$options = (array)$_val;
break;
case 'assign':
break;
case 'strict':
break;
case 'disabled':
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",
E_USER_NOTICE
);
}
if ($_val === true || $_val === $_key) {
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
}
break;
}
// omit break; to fall through!
// no break
default:
if(!is_array($_val)) {
$extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
if (!is_array($_val)) {
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
} else {
$smarty->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;
}
}
if (!isset($options) && !isset($values))
return ''; /* raise error here? */
settype($selected, 'array');
if (!isset($options) && !isset($values)) {
return '';
} /* raise error here? */
$_html_result = array();
if (isset($options)) {
foreach ($options as $_key=>$_val)
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
} else {
foreach ($values as $_i=>$_key) {
$_val = isset($output[$_i]) ? $output[$_i] : '';
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
foreach ($options as $_key => $_val) {
$_html_result[] =
smarty_function_html_checkboxes_output(
$name,
$_key,
$_val,
$selected,
$extra,
$separator,
$labels,
$label_ids,
$escape
);
}
}
if(!empty($params['assign'])) {
$smarty->assign($params['assign'], $_html_result);
} else {
return implode("\n",$_html_result);
foreach ($values as $_i => $_key) {
$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
$_html_result[] =
smarty_function_html_checkboxes_output(
$name,
$_key,
$_val,
$selected,
$extra,
$separator,
$labels,
$label_ids,
$escape
);
}
}
if (!empty($params[ 'assign' ])) {
$template->assign($params[ 'assign' ], $_html_result);
} else {
return implode("\n", $_html_result);
}
}
function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels) {
/**
* @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
) {
$_output = '';
if ($labels) $_output .= '<label>';
$_output .= '<input type="checkbox" name="'
. smarty_function_escape_special_chars($name) . '[]" value="'
. smarty_function_escape_special_chars($value) . '"';
if (in_array((string)$value, $selected)) {
if (is_object($value)) {
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
);
return '';
}
} else {
$value = (string)$value;
}
if (is_object($output)) {
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
);
return '';
}
} else {
$output = (string)$output;
}
if ($labels) {
if ($label_ids) {
$_id = smarty_function_escape_special_chars(
preg_replace(
'![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER,
'_',
$name . '_' . $value
)
);
$_output .= '<label for="' . $_id . '">';
} else {
$_output .= '<label>';
}
}
$name = smarty_function_escape_special_chars($name);
$value = smarty_function_escape_special_chars($value);
if ($escape) {
$output = smarty_function_escape_special_chars($output);
}
$_output .= '<input type="checkbox" name="' . $name . '[]" value="' . $value . '"';
if ($labels && $label_ids) {
$_output .= ' id="' . $_id . '"';
}
if (is_array($selected)) {
if (isset($selected[ $value ])) {
$_output .= ' checked="checked"';
}
} elseif ($value === $selected) {
$_output .= ' checked="checked"';
}
$_output .= $extra . ' />' . $output;
if ($labels) $_output .= '</label>';
$_output .= $separator;
if ($labels) {
$_output .= '</label>';
}
$_output .= $separator;
return $_output;
}
?>
+95 -79
View File
@@ -1,43 +1,49 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*
* @package Smarty
* @subpackage PluginsFunction
*/
/**
* 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>
* Input:<br>
* - file = file (and path) of image (required)
* - height = image height (optional, default actual height)
* - width = image width (optional, default actual width)
* - basedir = base directory for absolute paths, default
* is environment variable DOCUMENT_ROOT
* - path_prefix = prefix for path output (optional, default empty)
*
* 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>
* @link http://smarty.php.net/manual/en/language.function.html.image.php {html_image}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @author credits to Duda <duda@big.hu> - wrote first image function
* in repository, helped with lots of functionality
* @version 1.0
* @param array
* @param Smarty
* Params:
*
* - 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)
*
* @link http://www.smarty.net/manual/en/language.function.html.image.php {html_image}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @author credits to Duda <duda@big.hu>
* @version 1.0
*
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
*
* @throws SmartyException
* @return string
* @uses smarty_function_escape_special_chars()
* @uses smarty_function_escape_special_chars()
*/
function smarty_function_html_image($params, &$smarty)
function smarty_function_html_image($params, Smarty_Internal_Template $template)
{
require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
$template->_checkPlugins(
array(
array(
'function' => 'smarty_function_escape_special_chars',
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'
)
)
);
$alt = '';
$file = '';
$height = '';
@@ -46,10 +52,9 @@ function smarty_function_html_image($params, &$smarty)
$prefix = '';
$suffix = '';
$path_prefix = '';
$server_vars = ($smarty->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
$basedir = isset($server_vars['DOCUMENT_ROOT']) ? $server_vars['DOCUMENT_ROOT'] : '';
foreach($params as $_key => $_val) {
switch($_key) {
$basedir = isset($_SERVER[ 'DOCUMENT_ROOT' ]) ? $_SERVER[ 'DOCUMENT_ROOT' ] : '';
foreach ($params as $_key => $_val) {
switch ($_key) {
case 'file':
case 'height':
case 'width':
@@ -58,85 +63,96 @@ function smarty_function_html_image($params, &$smarty)
case 'basedir':
$$_key = $_val;
break;
case 'alt':
if(!is_array($_val)) {
if (!is_array($_val)) {
$$_key = smarty_function_escape_special_chars($_val);
} else {
$smarty->trigger_error("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;
case 'link':
case 'href':
$prefix = '<a href="' . $_val . '">';
$suffix = '</a>';
break;
default:
if(!is_array($_val)) {
$extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
if (!is_array($_val)) {
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
} else {
$smarty->trigger_error("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)) {
$smarty->trigger_error("html_image: missing 'file' parameter", E_USER_NOTICE);
trigger_error('html_image: missing \'file\' parameter', E_USER_NOTICE);
return;
}
if (substr($file,0,1) == '/') {
if ($file[ 0 ] === '/') {
$_image_path = $basedir . $file;
} else {
$_image_path = $file;
}
if(!isset($params['width']) || !isset($params['height'])) {
if(!$_image_data = @getimagesize($_image_path)) {
if(!file_exists($_image_path)) {
$smarty->trigger_error("html_image: unable to find '$_image_path'", E_USER_NOTICE);
// strip file protocol
if (stripos($params[ 'file' ], 'file://') === 0) {
$params[ 'file' ] = substr($params[ 'file' ], 7);
}
$protocol = strpos($params[ 'file' ], '://');
if ($protocol !== false) {
$protocol = strtolower(substr($params[ 'file' ], 0, $protocol));
}
if (isset($template->smarty->security_policy)) {
if ($protocol) {
// remote resource (or php stream, …)
if (!$template->smarty->security_policy->isTrustedUri($params[ 'file' ])) {
return;
} else if(!is_readable($_image_path)) {
$smarty->trigger_error("html_image: unable to read '$_image_path'", E_USER_NOTICE);
return;
} else {
$smarty->trigger_error("html_image: '$_image_path' is not a valid image file", E_USER_NOTICE);
}
} else {
// local file
if (!$template->smarty->security_policy->isTrustedResourceDir($_image_path)) {
return;
}
}
if ($smarty->security &&
($_params = array('resource_type' => 'file', 'resource_name' => $_image_path)) &&
(require_once(SMARTY_CORE_DIR . 'core.is_secure.php')) &&
(!smarty_core_is_secure($_params, $smarty)) ) {
$smarty->trigger_error("html_image: (secure) '$_image_path' not in secure directory", E_USER_NOTICE);
}
if(!isset($params['width'])) {
$width = $_image_data[0];
}
if(!isset($params['height'])) {
$height = $_image_data[1];
}
}
if(isset($params['dpi'])) {
if(strstr($server_vars['HTTP_USER_AGENT'], 'Mac')) {
if (!isset($params[ 'width' ]) || !isset($params[ 'height' ])) {
// 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);
return;
} elseif (!is_readable($_image_path)) {
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);
return;
}
}
if (!isset($params[ 'width' ])) {
$width = $_image_data[ 0 ];
}
if (!isset($params[ 'height' ])) {
$height = $_image_data[ 1 ];
}
}
if (isset($params[ 'dpi' ])) {
if (strstr($_SERVER[ 'HTTP_USER_AGENT' ], 'Mac')) {
// FIXME: (rodneyrehm) wrong dpi assumption
// don't know who thought this up… even if it was true in 1998, it's definitely wrong in 2011.
$dpi_default = 72;
} else {
$dpi_default = 96;
}
$_resize = $dpi_default/$params['dpi'];
$_resize = $dpi_default / $params[ 'dpi' ];
$width = round($width * $_resize);
$height = round($height * $_resize);
}
return $prefix . '<img src="'.$path_prefix.$file.'" alt="'.$alt.'" width="'.$width.'" height="'.$height.'"'.$extra.' />' . $suffix;
return $prefix . '<img src="' . $path_prefix . $file . '" alt="' . $alt . '" width="' . $width . '" height="' .
$height . '"' . $extra . ' />' . $suffix;
}
/* vim: set expandtab: */
?>
+184 -76
View File
@@ -1,122 +1,230 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*
* @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {html_options} function plugin
*
* Type: function<br>
* Name: html_options<br>
* Input:<br>
* - name (optional) - string default "select"
* - values (required if no options supplied) - array
* - options (required if no values supplied) - associative array
* - selected (optional) - string default not set
* - output (required if not options supplied) - array
* Type: function
* Name: html_options
* Purpose: Prints the list of <option> tags generated from
* the passed parameters
* @link http://smarty.php.net/manual/en/language.function.html.options.php {html_image}
* (Smarty online manual)
* Params:
*
* - name (optional) - string default "select"
* - values (required) - if no options supplied) - array
* - options (required) - if no values supplied) - associative array
* - selected (optional) - string default not set
* - output (required) - if not options supplied) - array
* - id (optional) - string default not set
* - class (optional) - string default not set
*
* @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>
* @param array
* @param Smarty
* @author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de>
*
* @param array $params parameters
*
* @param \Smarty_Internal_Template $template
*
* @return string
* @uses smarty_function_escape_special_chars()
* @uses smarty_function_escape_special_chars()
* @throws \SmartyException
*/
function smarty_function_html_options($params, &$smarty)
function smarty_function_html_options($params, Smarty_Internal_Template $template)
{
require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
$template->_checkPlugins(
array(
array(
'function' => 'smarty_function_escape_special_chars',
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'
)
)
);
$name = null;
$values = null;
$options = null;
$selected = array();
$selected = null;
$output = null;
$id = null;
$class = null;
$extra = '';
foreach($params as $_key => $_val) {
switch($_key) {
foreach ($params as $_key => $_val) {
switch ($_key) {
case 'name':
case 'class':
case 'id':
$$_key = (string)$_val;
break;
case 'options':
$$_key = (array)$_val;
$options = (array)$_val;
break;
case 'values':
case 'output':
$$_key = array_values((array)$_val);
break;
case 'selected':
$$_key = array_map('strval', array_values((array)$_val));
break;
default:
if(!is_array($_val)) {
$extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
if (is_array($_val)) {
$selected = array();
foreach ($_val as $_sel) {
if (is_object($_sel)) {
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
);
continue;
}
} else {
$_sel = smarty_function_escape_special_chars((string)$_sel);
}
$selected[ $_sel ] = true;
}
} elseif (is_object($_val)) {
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
);
}
} else {
$smarty->trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
$selected = smarty_function_escape_special_chars((string)$_val);
}
break;
case 'strict':
break;
case 'disabled':
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",
E_USER_NOTICE
);
}
if ($_val === true || $_val === $_key) {
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
}
break;
}
// omit break; to fall through!
// no break
default:
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);
}
break;
}
}
if (!isset($options) && !isset($values))
return ''; /* raise error here? */
if (!isset($options) && !isset($values)) {
/* raise error here? */
return '';
}
$_html_result = '';
$_idx = 0;
if (isset($options)) {
foreach ($options as $_key=>$_val)
$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
} else {
foreach ($values as $_i=>$_key) {
$_val = isset($output[$_i]) ? $output[$_i] : '';
$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
foreach ($options as $_key => $_val) {
$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected, $id, $class, $_idx);
}
}
if(!empty($name)) {
$_html_result = '<select name="' . $name . '"' . $extra . '>' . "\n" . $_html_result . '</select>' . "\n";
}
return $_html_result;
}
function smarty_function_html_options_optoutput($key, $value, $selected) {
if(!is_array($value)) {
$_html_result = '<option label="' . smarty_function_escape_special_chars($value) . '" value="' .
smarty_function_escape_special_chars($key) . '"';
if (in_array((string)$key, $selected))
$_html_result .= ' selected="selected"';
$_html_result .= '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n";
} else {
$_html_result = smarty_function_html_options_optgroup($key, $value, $selected);
foreach ($values as $_i => $_key) {
$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected, $id, $class, $_idx);
}
}
if (!empty($name)) {
$_html_class = !empty($class) ? ' class="' . $class . '"' : '';
$_html_id = !empty($id) ? ' id="' . $id . '"' : '';
$_html_result =
'<select name="' . $name . '"' . $_html_class . $_html_id . $extra . '>' . "\n" . $_html_result .
'</select>' . "\n";
}
return $_html_result;
}
function smarty_function_html_options_optgroup($key, $values, $selected) {
/**
* @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)) {
$_key = smarty_function_escape_special_chars($key);
$_html_result = '<option value="' . $_key . '"';
if (is_array($selected)) {
if (isset($selected[ $_key ])) {
$_html_result .= ' selected="selected"';
}
} elseif ($_key === $selected) {
$_html_result .= ' selected="selected"';
}
$_html_class = !empty($class) ? ' class="' . $class . ' option"' : '';
$_html_id = !empty($id) ? ' id="' . $id . '-' . $idx . '"' : '';
if (is_object($value)) {
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
);
return '';
}
} else {
$value = smarty_function_escape_special_chars((string)$value);
}
$_html_result .= $_html_class . $_html_id . '>' . $value . '</option>' . "\n";
$idx++;
} else {
$_idx = 0;
$_html_result =
smarty_function_html_options_optgroup(
$key,
$value,
$selected,
!empty($id) ? ($id . '-' . $idx) : null,
$class,
$_idx
);
$idx++;
}
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";
foreach ($values as $key => $value) {
$optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected);
$optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, $idx);
}
$optgroup_html .= "</optgroup>\n";
return $optgroup_html;
}
/* vim: set expandtab: */
?>
+197 -87
View File
@@ -1,156 +1,266 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*
* @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {html_radios} function plugin
* File: function.html_radios.php
* Type: function
* Name: html_radios
* Date: 24.Feb.2003
* Purpose: Prints out a list of radio input types
* Params:
*
* - name (optional) - string default "radio"
* - values (required) - array
* - options (required) - associative array
* - checked (optional) - array default not set
* - separator (optional) - ie <br> or &nbsp;
* - 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
*
* 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>
* Input:<br>
* - name (optional) - string default "radio"
* - values (required) - array
* - options (optional) - associative array
* - checked (optional) - array default not set
* - separator (optional) - ie <br> or &nbsp;
* - output (optional) - the output next to each radio button
* - assign (optional) - assign the output as an array to this variable
* 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)
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
* @author credits to Monte Ohrt <monte at ohrt dot com>
* @version 1.0
* @param array
* @param Smarty
*
* @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}
* (Smarty online manual)
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
* @author credits to Monte Ohrt <monte at ohrt dot com>
* @version 1.0
*
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
*
* @return string
* @uses smarty_function_escape_special_chars()
* @uses smarty_function_escape_special_chars()
* @throws \SmartyException
*/
function smarty_function_html_radios($params, &$smarty)
function smarty_function_html_radios($params, Smarty_Internal_Template $template)
{
require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
$template->_checkPlugins(
array(
array(
'function' => 'smarty_function_escape_special_chars',
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'
)
)
);
$name = 'radio';
$values = null;
$options = null;
$selected = null;
$separator = '';
$escape = true;
$labels = true;
$label_ids = false;
$output = null;
$extra = '';
foreach($params as $_key => $_val) {
switch($_key) {
foreach ($params as $_key => $_val) {
switch ($_key) {
case 'name':
case 'separator':
$$_key = (string)$_val;
break;
case 'checked':
case 'selected':
if(is_array($_val)) {
$smarty->trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING);
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')) {
$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
);
}
} else {
$selected = (string)$_val;
}
break;
case 'escape':
case 'labels':
case 'label_ids':
$$_key = (bool)$_val;
break;
case 'options':
$$_key = (array)$_val;
break;
case 'values':
case 'output':
$$_key = array_values((array)$_val);
break;
case 'radios':
$smarty->trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead', E_USER_WARNING);
trigger_error(
'html_radios: the use of the "radios" attribute is deprecated, use "options" instead',
E_USER_WARNING
);
$options = (array)$_val;
break;
case 'assign':
break;
case 'strict':
break;
case 'disabled':
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",
E_USER_NOTICE
);
}
if ($_val === true || $_val === $_key) {
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
}
break;
}
// omit break; to fall through!
// no break
default:
if(!is_array($_val)) {
$extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
if (!is_array($_val)) {
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
} else {
$smarty->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;
}
}
if (!isset($options) && !isset($values))
return ''; /* raise error here? */
if (!isset($options) && !isset($values)) {
/* raise error here? */
return '';
}
$_html_result = array();
if (isset($options)) {
foreach ($options as $_key=>$_val)
$_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
} else {
foreach ($values as $_i=>$_key) {
$_val = isset($output[$_i]) ? $output[$_i] : '';
$_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
foreach ($options as $_key => $_val) {
$_html_result[] =
smarty_function_html_radios_output(
$name,
$_key,
$_val,
$selected,
$extra,
$separator,
$labels,
$label_ids,
$escape
);
}
}
if(!empty($params['assign'])) {
$smarty->assign($params['assign'], $_html_result);
} else {
return implode("\n",$_html_result);
foreach ($values as $_i => $_key) {
$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
$_html_result[] =
smarty_function_html_radios_output(
$name,
$_key,
$_val,
$selected,
$extra,
$separator,
$labels,
$label_ids,
$escape
);
}
}
if (!empty($params[ 'assign' ])) {
$template->assign($params[ 'assign' ], $_html_result);
} else {
return implode("\n", $_html_result);
}
}
function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids) {
/**
* @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
) {
$_output = '';
if (is_object($value)) {
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
);
return '';
}
} else {
$value = (string)$value;
}
if (is_object($output)) {
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
);
return '';
}
} else {
$output = (string)$output;
}
if ($labels) {
if($label_ids) {
$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value));
$_output .= '<label for="' . $_id . '">';
} else {
$_output .= '<label>';
}
}
$_output .= '<input type="radio" name="'
. smarty_function_escape_special_chars($name) . '" value="'
. smarty_function_escape_special_chars($value) . '"';
if ($labels && $label_ids) $_output .= ' id="' . $_id . '"';
if ((string)$value==$selected) {
if ($label_ids) {
$_id = smarty_function_escape_special_chars(
preg_replace(
'![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER,
'_',
$name . '_' . $value
)
);
$_output .= '<label for="' . $_id . '">';
} else {
$_output .= '<label>';
}
}
$name = smarty_function_escape_special_chars($name);
$value = smarty_function_escape_special_chars($value);
if ($escape) {
$output = smarty_function_escape_special_chars($output);
}
$_output .= '<input type="radio" name="' . $name . '" value="' . $value . '"';
if ($labels && $label_ids) {
$_output .= ' id="' . $_id . '"';
}
if ($value === $selected) {
$_output .= ' checked="checked"';
}
$_output .= $extra . ' />' . $output;
if ($labels) $_output .= '</label>';
$_output .= $separator;
if ($labels) {
$_output .= '</label>';
}
$_output .= $separator;
return $_output;
}
?>
+307 -250
View File
@@ -1,99 +1,145 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*
* @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:
*
* - 1.0 initial release
* - 1.1 added support for +/- N syntax for begin
* and end year values. (Monte)
* - 1.2 added support for yyyy-mm-dd syntax for
* time value. (Jan Rosier)
* - 1.3 added support for choosing format for
* month values (Gary Loescher)
* - 1.3.1 added support for choosing format for
* day values (Marcus Bointon)
* - 1.3.2 support negative timestamps, force year
* dropdown to include given date unless explicitly set (Monte)
* - 1.3.4 fix behaviour of 0000-00-00 00:00:00 dates to match that
* of 0000-00-00 dates (cybot, boots)
* - 2.0 complete rewrite for performance,
* added attributes month_names, *_id
*
* @link http://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date}
* (Smarty online manual)
* @version 2.0
* @author Andrei Zmievski
* @author Monte Ohrt <monte at ohrt dot com>
* @author Rodney Rehm
*
* @param array $params parameters
*
* @param \Smarty_Internal_Template $template
*
* ChangeLog:<br>
* - 1.0 initial release
* - 1.1 added support for +/- N syntax for begin
* and end year values. (Monte)
* - 1.2 added support for yyyy-mm-dd syntax for
* time value. (Jan Rosier)
* - 1.3 added support for choosing format for
* month values (Gary Loescher)
* - 1.3.1 added support for choosing format for
* day values (Marcus Bointon)
* - 1.3.2 support negative timestamps, force year
* dropdown to include given date unless explicitly set (Monte)
* - 1.3.4 fix behaviour of 0000-00-00 00:00:00 dates to match that
* of 0000-00-00 dates (cybot, boots)
* @link http://smarty.php.net/manual/en/language.function.html.select.date.php {html_select_date}
* (Smarty online manual)
* @version 1.3.4
* @author Andrei Zmievski
* @author Monte Ohrt <monte at ohrt dot com>
* @param array
* @param Smarty
* @return string
* @throws \SmartyException
*/
function smarty_function_html_select_date($params, &$smarty)
function smarty_function_html_select_date($params, Smarty_Internal_Template $template)
{
require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
require_once $smarty->_get_plugin_filepath('shared','make_timestamp');
require_once $smarty->_get_plugin_filepath('function','html_options');
$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;
if ($_month_timestamps === null) {
$_current_year = date('Y');
$_month_timestamps = array();
for ($i = 1; $i <= 12; $i++) {
$_month_timestamps[ $i ] = mktime(0, 0, 0, $i, 1, 2000);
}
}
/* Default values. */
$prefix = "Date_";
$start_year = strftime("%Y");
$end_year = $start_year;
$display_days = true;
$display_months = true;
$display_years = true;
$month_format = "%B";
$prefix = 'Date_';
$start_year = null;
$end_year = null;
$display_days = true;
$display_months = true;
$display_years = true;
$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";
$year_as_text = false;
$day_value_format = '%d';
$year_as_text = false;
/* Display years in reverse order? Ie. 2000,1999,.... */
$reverse_years = false;
$reverse_years = false;
/* Should the select boxes be part of an array when returned from PHP?
e.g. setting it to "birthday", would create "birthday[Day]",
"birthday[Month]" & "birthday[Year]". Can be combined with prefix */
$field_array = null;
$field_array = null;
/* <select size>'s of the different <select> tags.
If not set, uses default dropdown. */
$day_size = null;
$month_size = null;
$year_size = null;
$day_size = null;
$month_size = null;
$year_size = null;
/* Unparsed attributes common to *ALL* the <select>/<input> tags.
An example might be in the template: all_extra ='class ="foo"'. */
$all_extra = null;
$all_extra = null;
/* Separate attributes for the tags. */
$day_extra = null;
$month_extra = null;
$year_extra = null;
$day_extra = null;
$month_extra = null;
$year_extra = null;
/* Order in which to display the fields.
"D" -> day, "M" -> month, "Y" -> year. */
$field_order = 'MDY';
$field_order = 'MDY';
/* String printed between the different fields. */
$field_separator = "\n";
$time = time();
$all_empty = null;
$day_empty = null;
$month_empty = null;
$year_empty = null;
$extra_attrs = '';
foreach ($params as $_key=>$_value) {
$option_separator = "\n";
$time = null;
// $all_empty = null;
// $day_empty = null;
// $month_empty = null;
// $year_empty = null;
$extra_attrs = '';
$all_id = null;
$day_id = null;
$month_id = null;
$year_id = null;
foreach ($params as $_key => $_value) {
switch ($_key) {
case 'prefix':
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) {
$$_key = $_value;
} else {
trigger_error('html_select_date: month_names must be an array of 12 strings', E_USER_NOTICE);
}
break;
case 'prefix':
case 'field_array':
case 'start_year':
case 'end_year':
case 'month_format':
case 'day_format':
case 'day_value_format':
case 'field_array':
case 'month_format':
case 'month_value_format':
case 'day_size':
case 'month_size':
case 'year_size':
@@ -103,18 +149,17 @@ function smarty_function_html_select_date($params, &$smarty)
case 'year_extra':
case 'field_order':
case 'field_separator':
case 'month_value_format':
case 'option_separator':
case 'all_empty':
case 'month_empty':
case 'day_empty':
case 'year_empty':
case 'all_id':
case 'month_id':
case 'day_id':
case 'year_id':
$$_key = (string)$_value;
break;
case 'all_empty':
$$_key = (string)$_value;
$day_empty = $month_empty = $year_empty = $all_empty;
break;
case 'display_days':
case 'display_months':
case 'display_years':
@@ -122,210 +167,222 @@ function smarty_function_html_select_date($params, &$smarty)
case 'reverse_years':
$$_key = (bool)$_value;
break;
default:
if(!is_array($_value)) {
$extra_attrs .= ' '.$_key.'="'.smarty_function_escape_special_chars($_value).'"';
if (!is_array($_value)) {
$extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"';
} else {
$smarty->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;
}
}
if (preg_match('!^-\d+$!', $time)) {
// negative timestamp, use date()
$time = date('Y-m-d', $time);
}
// If $time is not in format yyyy-mm-dd
if (preg_match('/^(\d{0,4}-\d{0,2}-\d{0,2})/', $time, $found)) {
$time = $found[1];
// Note: date() is faster than strftime()
// Note: explode(date()) is faster than date() date() date()
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) {
$_variableName = '_' . strtolower($_elementName);
$$_variableName =
isset($params[ 'time' ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $prefix . $_elementName ] :
date($_elementKey);
}
} elseif (isset($params[ 'time' ][ $field_array ][ $prefix . 'Year' ])) {
// $_REQUEST given
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);
}
} else {
// no date found, use NOW
list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
}
} elseif ($time === null) {
if (array_key_exists('time', $params)) {
$_year = $_month = $_day = $time = null;
} else {
list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
}
} else {
// use smarty_make_timestamp to get an unix timestamp and
// strftime to make yyyy-mm-dd
$time = strftime('%Y-%m-%d', smarty_make_timestamp($time));
list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d', $time));
}
// Now split this in pieces, which later can be used to set the select
$time = explode("-", $time);
// make syntax "+N" or "-N" work with start_year and end_year
if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) {
if ($match[1] == '+') {
$end_year = strftime('%Y') + $match[2];
// 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) {
$key .= '_year';
$t = $$key;
if ($t === null) {
$$key = (int)$_current_year;
} elseif ($t[ 0 ] === '+') {
$$key = (int)($_current_year + (int)trim(substr($t, 1)));
} elseif ($t[ 0 ] === '-') {
$$key = (int)($_current_year - (int)trim(substr($t, 1)));
} else {
$end_year = strftime('%Y') - $match[2];
$$key = (int)$$key;
}
}
if (preg_match('!^(\+|\-)\s*(\d+)$!', $start_year, $match)) {
if ($match[1] == '+') {
$start_year = strftime('%Y') + $match[2];
} else {
$start_year = strftime('%Y') - $match[2];
}
// flip for ascending or descending
if (($start_year > $end_year && !$reverse_years) || ($start_year < $end_year && $reverse_years)) {
$t = $end_year;
$end_year = $start_year;
$start_year = $t;
}
if (strlen($time[0]) > 0) {
if ($start_year > $time[0] && !isset($params['start_year'])) {
// force start year to include given date if not explicitly set
$start_year = $time[0];
}
if($end_year < $time[0] && !isset($params['end_year'])) {
// force end year to include given date if not explicitly set
$end_year = $time[0];
}
}
$field_order = strtoupper($field_order);
$html_result = $month_result = $day_result = $year_result = "";
$field_separator_count = -1;
if ($display_months) {
$field_separator_count++;
$month_names = array();
$month_values = array();
if(isset($month_empty)) {
$month_names[''] = $month_empty;
$month_values[''] = '';
}
for ($i = 1; $i <= 12; $i++) {
$month_names[$i] = strftime($month_format, mktime(0, 0, 0, $i, 1, 2000));
$month_values[$i] = strftime($month_value_format, mktime(0, 0, 0, $i, 1, 2000));
}
$month_result .= '<select name=';
if (null !== $field_array){
$month_result .= '"' . $field_array . '[' . $prefix . 'Month]"';
} else {
$month_result .= '"' . $prefix . 'Month"';
}
if (null !== $month_size){
$month_result .= ' size="' . $month_size . '"';
}
if (null !== $month_extra){
$month_result .= ' ' . $month_extra;
}
if (null !== $all_extra){
$month_result .= ' ' . $all_extra;
}
$month_result .= $extra_attrs . '>'."\n";
$month_result .= smarty_function_html_options(array('output' => $month_names,
'values' => $month_values,
'selected' => (int)$time[1] ? strftime($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '',
'print_result' => false),
$smarty);
$month_result .= '</select>';
}
if ($display_days) {
$field_separator_count++;
$days = array();
if (isset($day_empty)) {
$days[''] = $day_empty;
$day_values[''] = '';
}
for ($i = 1; $i <= 31; $i++) {
$days[] = sprintf($day_format, $i);
$day_values[] = sprintf($day_value_format, $i);
}
$day_result .= '<select name=';
if (null !== $field_array){
$day_result .= '"' . $field_array . '[' . $prefix . 'Day]"';
} else {
$day_result .= '"' . $prefix . 'Day"';
}
if (null !== $day_size){
$day_result .= ' size="' . $day_size . '"';
}
if (null !== $all_extra){
$day_result .= ' ' . $all_extra;
}
if (null !== $day_extra){
$day_result .= ' ' . $day_extra;
}
$day_result .= $extra_attrs . '>'."\n";
$day_result .= smarty_function_html_options(array('output' => $days,
'values' => $day_values,
'selected' => $time[2],
'print_result' => false),
$smarty);
$day_result .= '</select>';
}
// generate year <select> or <input>
if ($display_years) {
$field_separator_count++;
if (null !== $field_array){
$year_name = $field_array . '[' . $prefix . 'Year]';
} else {
$year_name = $prefix . 'Year';
$_extra = '';
$_name = $field_array ? ($field_array . '[' . $prefix . 'Year]') : ($prefix . 'Year');
if ($all_extra) {
$_extra .= ' ' . $all_extra;
}
if ($year_extra) {
$_extra .= ' ' . $year_extra;
}
if ($year_as_text) {
$year_result .= '<input type="text" name="' . $year_name . '" value="' . $time[0] . '" size="4" maxlength="4"';
if (null !== $all_extra){
$year_result .= ' ' . $all_extra;
}
if (null !== $year_extra){
$year_result .= ' ' . $year_extra;
}
$year_result .= ' />';
$_html_years =
'<input type="text" name="' . $_name . '" value="' . $_year . '" size="4" maxlength="4"' . $_extra .
$extra_attrs . ' />';
} else {
$years = range((int)$start_year, (int)$end_year);
if ($reverse_years) {
rsort($years, SORT_NUMERIC);
} else {
sort($years, SORT_NUMERIC);
$_html_years = '<select name="' . $_name . '"';
if ($year_id !== null || $all_id !== null) {
$_html_years .= ' id="' . smarty_function_escape_special_chars(
$year_id !== null ?
($year_id ? $year_id : $_name) :
($all_id ? ($all_id . $_name) :
$_name)
) . '"';
}
$yearvals = $years;
if(isset($year_empty)) {
array_unshift($years, $year_empty);
array_unshift($yearvals, '');
if ($year_size) {
$_html_years .= ' size="' . $year_size . '"';
}
$year_result .= '<select name="' . $year_name . '"';
if (null !== $year_size){
$year_result .= ' size="' . $year_size . '"';
$_html_years .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($year_empty) || isset($all_empty)) {
$_html_years .= '<option value="">' . (isset($year_empty) ? $year_empty : $all_empty) . '</option>' .
$option_separator;
}
if (null !== $all_extra){
$year_result .= ' ' . $all_extra;
$op = $start_year > $end_year ? -1 : 1;
for ($i = $start_year; $op > 0 ? $i <= $end_year : $i >= $end_year; $i += $op) {
$_html_years .= '<option value="' . $i . '"' . ($_year == $i ? ' selected="selected"' : '') . '>' . $i .
'</option>' . $option_separator;
}
if (null !== $year_extra){
$year_result .= ' ' . $year_extra;
}
$year_result .= $extra_attrs . '>'."\n";
$year_result .= smarty_function_html_options(array('output' => $years,
'values' => $yearvals,
'selected' => $time[0],
'print_result' => false),
$smarty);
$year_result .= '</select>';
$_html_years .= '</select>';
}
}
// Loop thru the field_order field
for ($i = 0; $i <= 2; $i++){
$c = substr($field_order, $i, 1);
switch ($c){
case 'D':
$html_result .= $day_result;
break;
case 'M':
$html_result .= $month_result;
break;
// generate month <select> or <input>
if ($display_months) {
$_extra = '';
$_name = $field_array ? ($field_array . '[' . $prefix . 'Month]') : ($prefix . 'Month');
if ($all_extra) {
$_extra .= ' ' . $all_extra;
}
if ($month_extra) {
$_extra .= ' ' . $month_extra;
}
$_html_months = '<select name="' . $_name . '"';
if ($month_id !== null || $all_id !== null) {
$_html_months .= ' id="' . smarty_function_escape_special_chars(
$month_id !== null ?
($month_id ? $month_id : $_name) :
($all_id ? ($all_id . $_name) :
$_name)
) . '"';
}
if ($month_size) {
$_html_months .= ' size="' . $month_size . '"';
}
$_html_months .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($month_empty) || isset($all_empty)) {
$_html_months .= '<option value="">' . (isset($month_empty) ? $month_empty : $all_empty) . '</option>' .
$option_separator;
}
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 ]);
$_html_months .= '<option value="' . $_value . '"' . ($_val == $_month ? ' selected="selected"' : '') .
'>' . $_text . '</option>' . $option_separator;
}
$_html_months .= '</select>';
}
// generate day <select> or <input>
if ($display_days) {
$_extra = '';
$_name = $field_array ? ($field_array . '[' . $prefix . 'Day]') : ($prefix . 'Day');
if ($all_extra) {
$_extra .= ' ' . $all_extra;
}
if ($day_extra) {
$_extra .= ' ' . $day_extra;
}
$_html_days = '<select name="' . $_name . '"';
if ($day_id !== null || $all_id !== null) {
$_html_days .= ' id="' .
smarty_function_escape_special_chars(
$day_id !== null ? ($day_id ? $day_id : $_name) :
($all_id ? ($all_id . $_name) : $_name)
) . '"';
}
if ($day_size) {
$_html_days .= ' size="' . $day_size . '"';
}
$_html_days .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($day_empty) || isset($all_empty)) {
$_html_days .= '<option value="">' . (isset($day_empty) ? $day_empty : $all_empty) . '</option>' .
$option_separator;
}
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);
$_html_days .= '<option value="' . $_value . '"' . ($_val == $_day ? ' selected="selected"' : '') . '>' .
$_text . '</option>' . $option_separator;
}
$_html_days .= '</select>';
}
// order the fields for output
$_html = '';
for ($i = 0; $i <= 2; $i++) {
switch ($field_order[ $i ]) {
case 'Y':
$html_result .= $year_result;
case 'y':
if (isset($_html_years)) {
if ($_html) {
$_html .= $field_separator;
}
$_html .= $_html_years;
}
break;
case 'm':
case 'M':
if (isset($_html_months)) {
if ($_html) {
$_html .= $field_separator;
}
$_html .= $_html_months;
}
break;
case 'd':
case 'D':
if (isset($_html_days)) {
if ($_html) {
$_html .= $field_separator;
}
$_html .= $_html_days;
}
break;
}
// Add the field seperator
if($i < $field_separator_count) {
$html_result .= $field_separator;
}
}
return $html_result;
return $_html;
}
/* vim: set expandtab: */
?>
+298 -138
View File
@@ -1,64 +1,119 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*
* @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://smarty.php.net/manual/en/language.function.html.select.time.php {html_select_time}
* (Smarty online manual)
*
* @link http://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time}
* (Smarty online manual)
* @author Roberto Berto <roberto@berto.net>
* @credits Monte Ohrt <monte AT ohrt DOT com>
* @param array
* @param Smarty
* @author Monte Ohrt <monte AT ohrt DOT com>
*
* @param array $params parameters
*
* @param \Smarty_Internal_Template $template
*
* @return string
* @uses smarty_make_timestamp()
* @uses smarty_make_timestamp()
* @throws \SmartyException
*/
function smarty_function_html_select_time($params, &$smarty)
function smarty_function_html_select_time($params, Smarty_Internal_Template $template)
{
require_once $smarty->_get_plugin_filepath('shared','make_timestamp');
require_once $smarty->_get_plugin_filepath('function','html_options');
/* Default values. */
$prefix = "Time_";
$time = time();
$display_hours = true;
$display_minutes = true;
$display_seconds = true;
$display_meridian = true;
$use_24_hours = true;
$minute_interval = 1;
$second_interval = 1;
/* Should the select boxes be part of an array when returned from PHP?
e.g. setting it to "birthday", would create "birthday[Hour]",
"birthday[Minute]", "birthday[Seconds]" & "birthday[Meridian]".
Can be combined with prefix. */
$field_array = null;
$all_extra = null;
$hour_extra = null;
$minute_extra = null;
$second_extra = null;
$meridian_extra = null;
foreach ($params as $_key=>$_value) {
$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";
$time = null;
$display_hours = true;
$display_minutes = true;
$display_seconds = true;
$display_meridian = true;
$hour_format = '%02d';
$hour_value_format = '%02d';
$minute_format = '%02d';
$minute_value_format = '%02d';
$second_format = '%02d';
$second_value_format = '%02d';
$hour_size = null;
$minute_size = null;
$second_size = null;
$meridian_size = null;
$all_empty = null;
$hour_empty = null;
$minute_empty = null;
$second_empty = null;
$meridian_empty = null;
$all_id = null;
$hour_id = null;
$minute_id = null;
$second_id = null;
$meridian_id = null;
$use_24_hours = true;
$minute_interval = 1;
$second_interval = 1;
$extra_attrs = '';
$all_extra = null;
$hour_extra = null;
$minute_extra = null;
$second_extra = null;
$meridian_extra = null;
foreach ($params as $_key => $_value) {
switch ($_key) {
case 'prefix':
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 'prefix':
case 'field_array':
case 'field_separator':
case 'option_separator':
case 'all_extra':
case 'hour_extra':
case 'minute_extra':
case 'second_extra':
case 'meridian_extra':
case 'all_empty':
case 'hour_empty':
case 'minute_empty':
case 'second_empty':
case 'meridian_empty':
case 'all_id':
case 'hour_id':
case 'minute_id':
case 'second_id':
case 'meridian_id':
case 'hour_format':
case 'hour_value_format':
case 'minute_format':
case 'minute_value_format':
case 'second_format':
case 'second_value_format':
$$_key = (string)$_value;
break;
case 'display_hours':
case 'display_minutes':
case 'display_seconds':
@@ -66,129 +121,234 @@ function smarty_function_html_select_time($params, &$smarty)
case 'use_24_hours':
$$_key = (bool)$_value;
break;
case 'minute_interval':
case 'second_interval':
case 'hour_size':
case 'minute_size':
case 'second_size':
case 'meridian_size':
$$_key = (int)$_value;
break;
default:
$smarty->trigger_error("[html_select_time] unknown parameter $_key", E_USER_WARNING);
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);
}
break;
}
}
$time = smarty_make_timestamp($time);
$html_result = '';
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) {
$_variableName = '_' . strtolower($_elementName);
$$_variableName =
isset($params[ 'time' ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $prefix . $_elementName ] :
date($_elementKey);
}
$_meridian =
isset($params[ 'time' ][ $prefix . 'Meridian' ]) ? (' ' . $params[ 'time' ][ $prefix . 'Meridian' ]) :
'';
$time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
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) {
$_variableName = '_' . strtolower($_elementName);
$$_variableName = isset($params[ 'time' ][ $field_array ][ $prefix . $_elementName ]) ?
$params[ 'time' ][ $field_array ][ $prefix . $_elementName ] : date($_elementKey);
}
$_meridian = isset($params[ 'time' ][ $field_array ][ $prefix . 'Meridian' ]) ?
(' ' . $params[ 'time' ][ $field_array ][ $prefix . 'Meridian' ]) : '';
$time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
} else {
// no date found, use NOW
list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
}
} elseif ($time === null) {
if (array_key_exists('time', $params)) {
$_hour = $_minute = $_second = $time = null;
} else {
list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s'));
}
} else {
list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
}
// generate hour <select>
if ($display_hours) {
$hours = $use_24_hours ? range(0, 23) : range(1, 12);
$hour_fmt = $use_24_hours ? '%H' : '%I';
for ($i = 0, $for_max = count($hours); $i < $for_max; $i++)
$hours[$i] = sprintf('%02d', $hours[$i]);
$html_result .= '<select name=';
if (null !== $field_array) {
$html_result .= '"' . $field_array . '[' . $prefix . 'Hour]"';
} else {
$html_result .= '"' . $prefix . 'Hour"';
$_html_hours = '';
$_extra = '';
$_name = $field_array ? ($field_array . '[' . $prefix . 'Hour]') : ($prefix . 'Hour');
if ($all_extra) {
$_extra .= ' ' . $all_extra;
}
if (null !== $hour_extra){
$html_result .= ' ' . $hour_extra;
if ($hour_extra) {
$_extra .= ' ' . $hour_extra;
}
if (null !== $all_extra){
$html_result .= ' ' . $all_extra;
$_html_hours = '<select name="' . $_name . '"';
if ($hour_id !== null || $all_id !== null) {
$_html_hours .= ' id="' .
smarty_function_escape_special_chars(
$hour_id !== null ? ($hour_id ? $hour_id : $_name) :
($all_id ? ($all_id . $_name) : $_name)
) . '"';
}
$html_result .= '>'."\n";
$html_result .= smarty_function_html_options(array('output' => $hours,
'values' => $hours,
'selected' => strftime($hour_fmt, $time),
'print_result' => false),
$smarty);
$html_result .= "</select>\n";
if ($hour_size) {
$_html_hours .= ' size="' . $hour_size . '"';
}
$_html_hours .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($hour_empty) || isset($all_empty)) {
$_html_hours .= '<option value="">' . (isset($hour_empty) ? $hour_empty : $all_empty) . '</option>' .
$option_separator;
}
$start = $use_24_hours ? 0 : 1;
$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);
if (!$use_24_hours) {
$_hour12 = $_hour == 0 ? 12 : ($_hour <= 12 ? $_hour : $_hour - 12);
}
$selected = $_hour !== null ? ($use_24_hours ? $_hour == $_val : $_hour12 == $_val) : null;
$_html_hours .= '<option value="' . $_value . '"' . ($selected ? ' selected="selected"' : '') . '>' .
$_text . '</option>' . $option_separator;
}
$_html_hours .= '</select>';
}
// generate minute <select>
if ($display_minutes) {
$all_minutes = range(0, 59);
for ($i = 0, $for_max = count($all_minutes); $i < $for_max; $i+= $minute_interval)
$minutes[] = sprintf('%02d', $all_minutes[$i]);
$selected = intval(floor(strftime('%M', $time) / $minute_interval) * $minute_interval);
$html_result .= '<select name=';
if (null !== $field_array) {
$html_result .= '"' . $field_array . '[' . $prefix . 'Minute]"';
} else {
$html_result .= '"' . $prefix . 'Minute"';
$_html_minutes = '';
$_extra = '';
$_name = $field_array ? ($field_array . '[' . $prefix . 'Minute]') : ($prefix . 'Minute');
if ($all_extra) {
$_extra .= ' ' . $all_extra;
}
if (null !== $minute_extra){
$html_result .= ' ' . $minute_extra;
if ($minute_extra) {
$_extra .= ' ' . $minute_extra;
}
if (null !== $all_extra){
$html_result .= ' ' . $all_extra;
$_html_minutes = '<select name="' . $_name . '"';
if ($minute_id !== null || $all_id !== null) {
$_html_minutes .= ' id="' . smarty_function_escape_special_chars(
$minute_id !== null ?
($minute_id ? $minute_id : $_name) :
($all_id ? ($all_id . $_name) :
$_name)
) . '"';
}
$html_result .= '>'."\n";
$html_result .= smarty_function_html_options(array('output' => $minutes,
'values' => $minutes,
'selected' => $selected,
'print_result' => false),
$smarty);
$html_result .= "</select>\n";
if ($minute_size) {
$_html_minutes .= ' size="' . $minute_size . '"';
}
$_html_minutes .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($minute_empty) || isset($all_empty)) {
$_html_minutes .= '<option value="">' . (isset($minute_empty) ? $minute_empty : $all_empty) . '</option>' .
$option_separator;
}
$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);
$_html_minutes .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') .
'>' . $_text . '</option>' . $option_separator;
}
$_html_minutes .= '</select>';
}
// generate second <select>
if ($display_seconds) {
$all_seconds = range(0, 59);
for ($i = 0, $for_max = count($all_seconds); $i < $for_max; $i+= $second_interval)
$seconds[] = sprintf('%02d', $all_seconds[$i]);
$selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval);
$html_result .= '<select name=';
if (null !== $field_array) {
$html_result .= '"' . $field_array . '[' . $prefix . 'Second]"';
} else {
$html_result .= '"' . $prefix . 'Second"';
$_html_seconds = '';
$_extra = '';
$_name = $field_array ? ($field_array . '[' . $prefix . 'Second]') : ($prefix . 'Second');
if ($all_extra) {
$_extra .= ' ' . $all_extra;
}
if (null !== $second_extra){
$html_result .= ' ' . $second_extra;
if ($second_extra) {
$_extra .= ' ' . $second_extra;
}
if (null !== $all_extra){
$html_result .= ' ' . $all_extra;
$_html_seconds = '<select name="' . $_name . '"';
if ($second_id !== null || $all_id !== null) {
$_html_seconds .= ' id="' . smarty_function_escape_special_chars(
$second_id !== null ?
($second_id ? $second_id : $_name) :
($all_id ? ($all_id . $_name) :
$_name)
) . '"';
}
$html_result .= '>'."\n";
$html_result .= smarty_function_html_options(array('output' => $seconds,
'values' => $seconds,
'selected' => $selected,
'print_result' => false),
$smarty);
$html_result .= "</select>\n";
if ($second_size) {
$_html_seconds .= ' size="' . $second_size . '"';
}
$_html_seconds .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($second_empty) || isset($all_empty)) {
$_html_seconds .= '<option value="">' . (isset($second_empty) ? $second_empty : $all_empty) . '</option>' .
$option_separator;
}
$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);
$_html_seconds .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') .
'>' . $_text . '</option>' . $option_separator;
}
$_html_seconds .= '</select>';
}
// generate meridian <select>
if ($display_meridian && !$use_24_hours) {
$html_result .= '<select name=';
if (null !== $field_array) {
$html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]"';
} else {
$html_result .= '"' . $prefix . 'Meridian"';
$_html_meridian = '';
$_extra = '';
$_name = $field_array ? ($field_array . '[' . $prefix . 'Meridian]') : ($prefix . 'Meridian');
if ($all_extra) {
$_extra .= ' ' . $all_extra;
}
if (null !== $meridian_extra){
$html_result .= ' ' . $meridian_extra;
if ($meridian_extra) {
$_extra .= ' ' . $meridian_extra;
}
if (null !== $all_extra){
$html_result .= ' ' . $all_extra;
$_html_meridian = '<select name="' . $_name . '"';
if ($meridian_id !== null || $all_id !== null) {
$_html_meridian .= ' id="' . smarty_function_escape_special_chars(
$meridian_id !== null ?
($meridian_id ? $meridian_id :
$_name) :
($all_id ? ($all_id . $_name) :
$_name)
) . '"';
}
$html_result .= '>'."\n";
$html_result .= smarty_function_html_options(array('output' => array('AM', 'PM'),
'values' => array('am', 'pm'),
'selected' => strtolower(strftime('%p', $time)),
'print_result' => false),
$smarty);
$html_result .= "</select>\n";
if ($meridian_size) {
$_html_meridian .= ' size="' . $meridian_size . '"';
}
$_html_meridian .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($meridian_empty) || isset($all_empty)) {
$_html_meridian .= '<option value="">' . (isset($meridian_empty) ? $meridian_empty : $all_empty) .
'</option>' . $option_separator;
}
$_html_meridian .= '<option value="am"' . ($_hour > 0 && $_hour < 12 ? ' selected="selected"' : '') .
'>AM</option>' . $option_separator . '<option value="pm"' .
($_hour < 12 ? '' : ' selected="selected"') . '>PM</option>' . $option_separator .
'</select>';
}
return $html_result;
$_html = '';
foreach (array(
'_html_hours',
'_html_minutes',
'_html_seconds',
'_html_meridian'
) as $k) {
if (isset($$k)) {
if ($_html) {
$_html .= $field_separator;
}
$_html .= $$k;
}
}
return $_html;
}
/* vim: set expandtab: */
?>
+66 -79
View File
@@ -1,52 +1,51 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*
* @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {html_table} function plugin
* Type: function
* Name: html_table
* Date: Feb 17, 2003
* Purpose: make an html table from an array of data
* Params:
*
* Type: function<br>
* Name: html_table<br>
* Date: Feb 17, 2003<br>
* Purpose: make an html table from an array of data<br>
* Input:<br>
* - loop = array to loop through
* - cols = number of columns, comma separated list of column names
* or array of column names
* - rows = number of rows
* - table_attr = table attributes
* - th_attr = table heading attributes (arrays are cycled)
* - tr_attr = table row attributes (arrays are cycled)
* - td_attr = table cell attributes (arrays are cycled)
* - trailpad = value to pad trailing cells with
* - caption = text for caption element
* - vdir = vertical direction (default: "down", means top-to-bottom)
* - 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)
*
* - loop - array to loop through
* - cols - number of columns, comma separated list of column names
* or array of column names
* - rows - number of rows
* - table_attr - table attributes
* - th_attr - table heading attributes (arrays are cycled)
* - tr_attr - table row attributes (arrays are cycled)
* - td_attr - table cell attributes (arrays are cycled)
* - trailpad - value to pad trailing cells with
* - caption - text for caption element
* - vdir - vertical direction (default: "down", means top-to-bottom)
* - 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)
*
* 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>
* @author credit to boots <boots dot smarty at yahoo dot com>
* @version 1.1
* @link http://smarty.php.net/manual/en/language.function.html.table.php {html_table}
* (Smarty online manual)
* @param array
* @param Smarty
*
* @author Monte Ohrt <monte at ohrt dot com>
* @author credit to Messju Mohr <messju at lammfellpuschen dot de>
* @author credit to boots <boots dot smarty at yahoo dot com>
* @version 1.1
* @link http://www.smarty.net/manual/en/language.function.html.table.php {html_table}
* (Smarty online manual)
*
* @param array $params parameters
*
* @return string
*/
function smarty_function_html_table($params, &$smarty)
function smarty_function_html_table($params)
{
$table_attr = 'border="1"';
$tr_attr = '';
@@ -59,18 +58,16 @@ function smarty_function_html_table($params, &$smarty)
$hdir = 'right';
$inner = 'cols';
$caption = '';
if (!isset($params['loop'])) {
$smarty->trigger_error("html_table: missing 'loop' parameter");
$loop = null;
if (!isset($params[ 'loop' ])) {
trigger_error("html_table: missing 'loop' parameter", E_USER_WARNING);
return;
}
foreach ($params as $_key=>$_value) {
foreach ($params as $_key => $_value) {
switch ($_key) {
case 'loop':
$$_key = (array)$_value;
break;
case 'cols':
if (is_array($_value) && !empty($_value)) {
$cols = $_value;
@@ -84,11 +81,9 @@ function smarty_function_html_table($params, &$smarty)
$cols_count = $cols;
}
break;
case 'rows':
$$_key = (int)$_value;
break;
case 'table_attr':
case 'trailpad':
case 'hdir':
@@ -97,7 +92,6 @@ function smarty_function_html_table($params, &$smarty)
case 'caption':
$$_key = (string)$_value;
break;
case 'tr_attr':
case 'td_attr':
case 'th_attr':
@@ -105,50 +99,42 @@ function smarty_function_html_table($params, &$smarty)
break;
}
}
$loop_count = count($loop);
if (empty($params['rows'])) {
if (empty($params[ 'rows' ])) {
/* no rows specified */
$rows = ceil($loop_count/$cols_count);
} elseif (empty($params['cols'])) {
if (!empty($params['rows'])) {
$rows = ceil($loop_count / $cols_count);
} elseif (empty($params[ 'cols' ])) {
if (!empty($params[ 'rows' ])) {
/* no cols specified, but rows */
$cols_count = ceil($loop_count/$rows);
$cols_count = ceil($loop_count / $rows);
}
}
$output = "<table $table_attr>\n";
if (!empty($caption)) {
$output .= '<caption>' . $caption . "</caption>\n";
}
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++) {
for ($r = 0; $r < $cols_count; $r++) {
$output .= '<th' . smarty_function_html_table_cycle('th', $th_attr, $r) . '>';
$output .= $cols[$r];
$output .= $cols[ $r ];
$output .= "</th>\n";
}
$output .= "</tr></thead>\n";
}
$output .= "<tbody>\n";
for ($r=0; $r<$rows; $r++) {
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;
for ($c=0; $c<$cols_count; $c++) {
$x = ($hdir == 'right') ? $rx+$c : $rx+$cols_count-1-$c;
if ($inner!='cols') {
$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') {
/* shuffle x to loop over rows*/
$x = floor($x/$cols_count) + ($x%$cols_count)*$rows;
$x = floor($x / $cols_count) + ($x % $cols_count) * $rows;
}
if ($x<$loop_count) {
$output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">" . $loop[$x] . "</td>\n";
if ($x < $loop_count) {
$output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">" . $loop[ $x ] . "</td>\n";
} else {
$output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">$trailpad</td>\n";
}
@@ -157,21 +143,22 @@ function smarty_function_html_table($params, &$smarty)
}
$output .= "</tbody>\n";
$output .= "</table>\n";
return $output;
}
function smarty_function_html_table_cycle($name, $var, $no) {
if(!is_array($var)) {
/**
* @param $name
* @param $var
* @param $no
*
* @return string
*/
function smarty_function_html_table_cycle($name, $var, $no)
{
if (!is_array($var)) {
$ret = $var;
} else {
$ret = $var[$no % count($var)];
$ret = $var[ $no % count($var) ];
}
return ($ret) ? ' '.$ret : '';
return ($ret) ? ' ' . $ret : '';
}
/* vim: set expandtab: */
?>
+77 -105
View File
@@ -1,165 +1,137 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*
* @package Smarty
* @subpackage PluginsFunction
*/
/**
* 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>
* Input:<br>
* - address = 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)
* - 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
* Purpose: automate mailto address link creation, and optionally encode them.
* Params:
*
* - 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 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
*
* 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://smarty.php.net/manual/en/language.function.mailto.php {mailto}
* (Smarty online manual)
* @version 1.2
* @author Monte Ohrt <monte at ohrt dot com>
* @author credits to Jason Sweat (added cc, bcc and subject functionality)
* @param array
* @param Smarty
* @return string
*
* @link http://www.smarty.net/manual/en/language.function.mailto.php {mailto}
* (Smarty online manual)
* @version 1.2
* @author Monte Ohrt <monte at ohrt dot com>
* @author credits to Jason Sweat (added cc, bcc and subject functionality)
*
* @param array $params parameters
*
* @return string
*/
function smarty_function_mailto($params, &$smarty)
function smarty_function_mailto($params)
{
static $_allowed_encoding =
array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true);
$extra = '';
if (empty($params['address'])) {
$smarty->trigger_error("mailto: missing 'address' parameter");
if (empty($params[ 'address' ])) {
trigger_error("mailto: missing 'address' parameter", E_USER_WARNING);
return;
} else {
$address = $params['address'];
$address = $params[ 'address' ];
}
$text = $address;
// netscape and mozilla do not decode %40 (@) in BCC field (bug?)
// so, don't encode it.
$search = array('%40', '%2C');
$replace = array('@', ',');
$replace = array('@', ',');
$mail_parms = array();
foreach ($params as $var=>$value) {
foreach ($params as $var => $value) {
switch ($var) {
case 'cc':
case 'bcc':
case 'followupto':
if (!empty($value))
$mail_parms[] = $var.'='.str_replace($search,$replace,rawurlencode($value));
if (!empty($value)) {
$mail_parms[] = $var . '=' . str_replace($search, $replace, rawurlencode($value));
}
break;
case 'subject':
case 'newsgroups':
$mail_parms[] = $var.'='.rawurlencode($value);
$mail_parms[] = $var . '=' . rawurlencode($value);
break;
case 'extra':
case 'text':
$$var = $value;
// no break
default:
}
}
$mail_parm_vals = '';
for ($i=0; $i<count($mail_parms); $i++) {
$mail_parm_vals .= (0==$i) ? '?' : '&';
$mail_parm_vals .= $mail_parms[$i];
if ($mail_parms) {
$address .= '?' . join('&', $mail_parms);
}
$address .= $mail_parm_vals;
$encode = (empty($params['encode'])) ? 'none' : $params['encode'];
if (!in_array($encode,array('javascript','javascript_charcode','hex','none')) ) {
$smarty->trigger_error("mailto: 'encode' parameter must be none, javascript or hex");
$encode = (empty($params[ 'encode' ])) ? 'none' : $params[ 'encode' ];
if (!isset($_allowed_encoding[ $encode ])) {
trigger_error(
"mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex",
E_USER_WARNING
);
return;
}
if ($encode == 'javascript' ) {
$string = 'document.write(\'<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>\');';
// FIXME: (rodneyrehm) document.write() excues me what? 1998 has passed!
if ($encode === 'javascript') {
$string = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');';
$js_encode = '';
for ($x=0; $x < strlen($string); $x++) {
$js_encode .= '%' . bin2hex($string[$x]);
for ($x = 0, $_length = strlen($string); $x < $_length; $x++) {
$js_encode .= '%' . bin2hex($string[ $x ]);
}
return '<script type="text/javascript">eval(unescape(\''.$js_encode.'\'))</script>';
} elseif ($encode == 'javascript_charcode' ) {
$string = '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>';
for($x = 0, $y = strlen($string); $x < $y; $x++ ) {
$ord[] = ord($string[$x]);
return '<script type="text/javascript">eval(unescape(\'' . $js_encode . '\'))</script>';
} elseif ($encode === 'javascript_charcode') {
$string = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
for ($x = 0, $y = strlen($string); $x < $y; $x++) {
$ord[] = ord($string[ $x ]);
}
$_ret = "<script type=\"text/javascript\" language=\"javascript\">\n";
$_ret .= "<!--\n";
$_ret .= "{document.write(String.fromCharCode(";
$_ret .= implode(',',$ord);
$_ret .= "))";
$_ret .= "}\n";
$_ret .= "//-->\n";
$_ret .= "</script>\n";
$_ret = "<script type=\"text/javascript\" language=\"javascript\">\n" . "{document.write(String.fromCharCode(" .
implode(',', $ord) . "))" . "}\n" . "</script>\n";
return $_ret;
} elseif ($encode == 'hex') {
preg_match('!^(.*)(\?.*)$!',$address,$match);
if(!empty($match[2])) {
$smarty->trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.");
} 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);
return;
}
$address_encode = '';
for ($x=0; $x < strlen($address); $x++) {
if(preg_match('!\w!',$address[$x])) {
$address_encode .= '%' . bin2hex($address[$x]);
for ($x = 0, $_length = strlen($address); $x < $_length; $x++) {
if (preg_match('!\w!' . Smarty::$_UTF8_MODIFIER, $address[ $x ])) {
$address_encode .= '%' . bin2hex($address[ $x ]);
} else {
$address_encode .= $address[$x];
$address_encode .= $address[ $x ];
}
}
$text_encode = '';
for ($x=0; $x < strlen($text); $x++) {
$text_encode .= '&#x' . bin2hex($text[$x]).';';
for ($x = 0, $_length = strlen($text); $x < $_length; $x++) {
$text_encode .= '&#x' . bin2hex($text[ $x ]) . ';';
}
$mailto = "&#109;&#97;&#105;&#108;&#116;&#111;&#58;";
return '<a href="'.$mailto.$address_encode.'" '.$extra.'>'.$text_encode.'</a>';
return '<a href="' . $mailto . $address_encode . '" ' . $extra . '>' . $text_encode . '</a>';
} else {
// no encoding
return '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>';
return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
}
}
/* vim: set expandtab: */
?>
+79 -52
View File
@@ -1,85 +1,112 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
* This plugin is only for Smarty2 BC
*
* @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {math} function plugin
* Type: function
* Name: math
* Purpose: handle math computations in template
*
* Type: function<br>
* Name: math<br>
* Purpose: handle math computations in template<br>
* @link http://smarty.php.net/manual/en/language.function.math.php {math}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param array
* @param Smarty
* @return string
* @link http://www.smarty.net/manual/en/language.function.math.php {math}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
*
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
*
* @return string|null
*/
function smarty_function_math($params, &$smarty)
function smarty_function_math($params, $template)
{
static $_allowed_funcs =
array(
'int' => true,
'abs' => true,
'ceil' => true,
'cos' => true,
'exp' => true,
'floor' => true,
'log' => true,
'log10' => true,
'max' => true,
'min' => true,
'pi' => true,
'pow' => true,
'rand' => true,
'round' => true,
'sin' => true,
'sqrt' => true,
'srand' => true,
'tan' => true
);
// be sure equation parameter is present
if (empty($params['equation'])) {
$smarty->trigger_error("math: missing equation parameter");
if (empty($params[ 'equation' ])) {
trigger_error("math: missing equation parameter", E_USER_WARNING);
return;
}
// strip out backticks, not necessary for math
$equation = str_replace('`','',$params['equation']);
$equation = $params[ 'equation' ];
// make sure parenthesis are balanced
if (substr_count($equation,"(") != substr_count($equation,")")) {
$smarty->trigger_error("math: unbalanced parenthesis");
if (substr_count($equation, '(') !== substr_count($equation, ')')) {
trigger_error("math: unbalanced parenthesis", E_USER_WARNING);
return;
}
// match all vars in equation, make sure all are passed
preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]*)!",$equation, $match);
$allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',
'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
foreach($match[1] as $curr_var) {
if ($curr_var && !in_array($curr_var, array_keys($params)) && !in_array($curr_var, $allowed_funcs)) {
$smarty->trigger_error("math: function call $curr_var not allowed");
return;
}
// disallow backticks
if (strpos($equation, '`') !== false) {
trigger_error("math: backtick character not allowed in equation", E_USER_WARNING);
return;
}
foreach($params as $key => $val) {
if ($key != "equation" && $key != "format" && $key != "assign") {
// also disallow dollar signs
if (strpos($equation, '$') !== false) {
trigger_error("math: dollar signs not allowed in equation", E_USER_WARNING);
return;
}
foreach ($params as $key => $val) {
if ($key !== 'equation' && $key !== 'format' && $key !== 'assign') {
// make sure value is not empty
if (strlen($val)==0) {
$smarty->trigger_error("math: parameter $key is empty");
if (strlen($val) === 0) {
trigger_error("math: parameter '{$key}' is empty", E_USER_WARNING);
return;
}
if (!is_numeric($val)) {
$smarty->trigger_error("math: parameter $key: is not numeric");
trigger_error("math: parameter '{$key}' is not numeric", E_USER_WARNING);
return;
}
}
}
// match all vars in equation, make sure all are passed
preg_match_all('!(?:0x[a-fA-F0-9]+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)!', $equation, $match);
foreach ($match[ 1 ] as $curr_var) {
if ($curr_var && !isset($params[ $curr_var ]) && !isset($_allowed_funcs[ $curr_var ])) {
trigger_error(
"math: function call '{$curr_var}' not allowed, or missing parameter '{$curr_var}'",
E_USER_WARNING
);
return;
}
}
foreach ($params as $key => $val) {
if ($key !== 'equation' && $key !== 'format' && $key !== 'assign') {
$equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation);
}
}
eval("\$smarty_math_result = ".$equation.";");
if (empty($params['format'])) {
if (empty($params['assign'])) {
$smarty_math_result = null;
eval("\$smarty_math_result = " . $equation . ";");
if (empty($params[ 'format' ])) {
if (empty($params[ 'assign' ])) {
return $smarty_math_result;
} else {
$smarty->assign($params['assign'],$smarty_math_result);
$template->assign($params[ 'assign' ], $smarty_math_result);
}
} else {
if (empty($params['assign'])){
printf($params['format'],$smarty_math_result);
if (empty($params[ 'assign' ])) {
printf($params[ 'format' ], $smarty_math_result);
} else {
$smarty->assign($params['assign'],sprintf($params['format'],$smarty_math_result));
$template->assign($params[ 'assign' ], sprintf($params[ 'format' ], $smarty_math_result));
}
}
}
/* vim: set expandtab: */
?>
-119
View File
@@ -1,119 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {popup} function plugin
*
* Type: function<br>
* Name: popup<br>
* Purpose: make text pop up in windows via overlib
* @link http://smarty.php.net/manual/en/language.function.popup.php {popup}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param array
* @param Smarty
* @return string
*/
function smarty_function_popup($params, &$smarty)
{
$append = '';
foreach ($params as $_key=>$_value) {
switch ($_key) {
case 'text':
case 'trigger':
case 'function':
case 'inarray':
$$_key = (string)$_value;
if ($_key == 'function' || $_key == 'inarray')
$append .= ',' . strtoupper($_key) . ",'$_value'";
break;
case 'caption':
case 'closetext':
case 'status':
$append .= ',' . strtoupper($_key) . ",'" . str_replace("'","\'",$_value) . "'";
break;
case 'fgcolor':
case 'bgcolor':
case 'textcolor':
case 'capcolor':
case 'closecolor':
case 'textfont':
case 'captionfont':
case 'closefont':
case 'fgbackground':
case 'bgbackground':
case 'caparray':
case 'capicon':
case 'background':
case 'frame':
$append .= ',' . strtoupper($_key) . ",'$_value'";
break;
case 'textsize':
case 'captionsize':
case 'closesize':
case 'width':
case 'height':
case 'border':
case 'offsetx':
case 'offsety':
case 'snapx':
case 'snapy':
case 'fixx':
case 'fixy':
case 'padx':
case 'pady':
case 'timeout':
case 'delay':
$append .= ',' . strtoupper($_key) . ",$_value";
break;
case 'sticky':
case 'left':
case 'right':
case 'center':
case 'above':
case 'below':
case 'noclose':
case 'autostatus':
case 'autostatuscap':
case 'fullhtml':
case 'hauto':
case 'vauto':
case 'mouseoff':
case 'followmouse':
case 'closeclick':
if ($_value) $append .= ',' . strtoupper($_key);
break;
default:
$smarty->trigger_error("[popup] unknown parameter $_key", E_USER_WARNING);
}
}
if (empty($text) && !isset($inarray) && empty($function)) {
$smarty->trigger_error("overlib: attribute 'text' or 'inarray' or 'function' required");
return false;
}
if (empty($trigger)) { $trigger = "onmouseover"; }
$retval = $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\'';
$retval .= $append . ');"';
if ($trigger == 'onmouseover')
$retval .= ' onmouseout="nd();"';
return $retval;
}
/* vim: set expandtab: */
?>
-40
View File
@@ -1,40 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {popup_init} function plugin
*
* Type: function<br>
* Name: popup_init<br>
* Purpose: initialize overlib
* @link http://smarty.php.net/manual/en/language.function.popup.init.php {popup_init}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param array
* @param Smarty
* @return string
*/
function smarty_function_popup_init($params, &$smarty)
{
$zindex = 1000;
if (!empty($params['zindex'])) {
$zindex = $params['zindex'];
}
if (!empty($params['src'])) {
return '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:'.$zindex.';"></div>' . "\n"
. '<script type="text/javascript" language="JavaScript" src="'.$params['src'].'"></script>' . "\n";
} else {
$smarty->trigger_error("popup_init: missing src parameter");
}
}
/* vim: set expandtab: */
?>
+129 -27
View File
@@ -1,43 +1,145 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*
* @package Smarty
* @subpackage PluginsModifier
*/
/**
* Smarty capitalize modifier plugin
*
* Type: modifier<br>
* Name: capitalize<br>
* Type: modifier
* Name: capitalize
* Purpose: capitalize words in the string
* @link http://smarty.php.net/manual/en/language.modifiers.php#LANGUAGE.MODIFIER.CAPITALIZE
* capitalize (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param string
* {@internal {$string|capitalize:true:true} is the fastest option for MBString enabled systems }}
*
* @param string $string string to capitalize
* @param boolean $uc_digits also capitalize "x123" to "X123"
* @param boolean $lc_rest capitalize first letters, lowercase all following letters "aAa" to "Aaa"
*
* @return string capitalized string
* @author Monte Ohrt <monte at ohrt dot com>
* @author Rodney Rehm
*/
function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = false)
{
if (Smarty::$_MBSTRING) {
if ($lc_rest) {
// uppercase (including hyphenated words)
$upper_string = mb_convert_case($string, MB_CASE_TITLE, Smarty::$_CHARSET);
} else {
// uppercase word breaks
$upper_string = preg_replace_callback(
"!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER,
'smarty_mod_cap_mbconvert_cb',
$string
);
}
// check uc_digits case
if (!$uc_digits) {
if (preg_match_all(
"!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER,
$string,
$matches,
PREG_OFFSET_CAPTURE
)
) {
foreach ($matches[ 1 ] as $match) {
$upper_string =
substr_replace(
$upper_string,
mb_strtolower($match[ 0 ], Smarty::$_CHARSET),
$match[ 1 ],
strlen($match[ 0 ])
);
}
}
}
$upper_string =
preg_replace_callback(
"!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER,
'smarty_mod_cap_mbconvert2_cb',
$upper_string
);
return $upper_string;
}
// lowercase first
if ($lc_rest) {
$string = strtolower($string);
}
// uppercase (including hyphenated words)
$upper_string =
preg_replace_callback(
"!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER,
'smarty_mod_cap_ucfirst_cb',
$string
);
// check uc_digits case
if (!$uc_digits) {
if (preg_match_all(
"!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER,
$string,
$matches,
PREG_OFFSET_CAPTURE
)
) {
foreach ($matches[ 1 ] as $match) {
$upper_string =
substr_replace($upper_string, strtolower($match[ 0 ]), $match[ 1 ], strlen($match[ 0 ]));
}
}
}
$upper_string = preg_replace_callback(
"!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER,
'smarty_mod_cap_ucfirst2_cb',
$upper_string
);
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()
* Note: This can be fixed using anonymous functions instead, but that requires PHP >= 5.3
*
* @author Kyle Renfrow
*/
/**
* @param $matches
*
* @return string
*/
function smarty_modifier_capitalize($string, $uc_digits = false)
function smarty_mod_cap_mbconvert_cb($matches)
{
smarty_modifier_capitalize_ucfirst(null, $uc_digits);
return preg_replace_callback('!\'?\b\w(\w|\')*\b!', 'smarty_modifier_capitalize_ucfirst', $string);
return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 2 ]), MB_CASE_UPPER, Smarty::$_CHARSET);
}
function smarty_modifier_capitalize_ucfirst($string, $uc_digits = null)
/**
* @param $matches
*
* @return string
*/
function smarty_mod_cap_mbconvert2_cb($matches)
{
static $_uc_digits = false;
if(isset($uc_digits)) {
$_uc_digits = $uc_digits;
return;
}
if(substr($string[0],0,1) != "'" && !preg_match("!\d!",$string[0]) || $_uc_digits)
return ucfirst($string[0]);
else
return $string[0];
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 ]));
}
-33
View File
@@ -1,33 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty cat modifier plugin
*
* Type: modifier<br>
* Name: cat<br>
* 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
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @version 1.0
* @param string
* @param string
* @return string
*/
function smarty_modifier_cat($string, $cat)
{
return $string . $cat;
}
/* vim: set expandtab: */
?>
@@ -1,32 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty count_characters modifier plugin
*
* Type: modifier<br>
* Name: count_characteres<br>
* Purpose: count the number of characters in a text
* @link http://smarty.php.net/manual/en/language.modifier.count.characters.php
* count_characters (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param string
* @param boolean include whitespace in the character count
* @return integer
*/
function smarty_modifier_count_characters($string, $include_spaces = false)
{
if ($include_spaces)
return(strlen($string));
return preg_match_all("/[^\s]/",$string, $match);
}
/* vim: set expandtab: */
?>
@@ -1,29 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty count_paragraphs modifier plugin
*
* Type: modifier<br>
* Name: count_paragraphs<br>
* Purpose: count the number of paragraphs in a text
* @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php
* count_paragraphs (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param string
* @return integer
*/
function smarty_modifier_count_paragraphs($string)
{
// count \r or \n characters
return count(preg_split('/[\r\n]+/', $string));
}
/* vim: set expandtab: */
?>
-29
View File
@@ -1,29 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty count_sentences modifier plugin
*
* Type: modifier<br>
* Name: count_sentences
* Purpose: count the number of sentences in a text
* @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php
* count_sentences (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param string
* @return integer
*/
function smarty_modifier_count_sentences($string)
{
// find periods with a word before but not after.
return preg_match_all('/[^\s]\.(?!\w)/', $string, $match);
}
/* vim: set expandtab: */
?>
-33
View File
@@ -1,33 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty count_words modifier plugin
*
* Type: modifier<br>
* Name: count_words<br>
* Purpose: count the number of words in a text
* @link http://smarty.php.net/manual/en/language.modifier.count.words.php
* count_words (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param string
* @return integer
*/
function smarty_modifier_count_words($string)
{
// split text by ' ',\r,\n,\f,\t
$split_array = preg_split('/\s+/',$string);
// count matches that contain alphanumerics
$word_count = preg_grep('/[a-zA-Z0-9\\x80-\\xff]/', $split_array);
return count($word_count);
}
/* vim: set expandtab: */
?>
+68 -41
View File
@@ -1,58 +1,85 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*
* @package Smarty
* @subpackage PluginsModifier
*/
/**
* Include the {@link shared.make_timestamp.php} plugin
*/
require_once $smarty->_get_plugin_filepath('shared', 'make_timestamp');
/**
* Smarty date_format modifier plugin
* 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
*
* Type: modifier<br>
* Name: date_format<br>
* Purpose: format datestamps via strftime<br>
* Input:<br>
* - string: input date string
* - format: strftime format for output
* - default_date: default date if $string is empty
* @link http://smarty.php.net/manual/en/language.modifier.date.format.php
* date_format (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param string
* @param string
* @param string
* @return string|void
* @uses smarty_make_timestamp()
* @link http://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
*
* @param string $string input date string
* @param string $format strftime format for output
* @param string $default_date default date if $string is empty
* @param string $formatter either 'strftime' or 'auto'
*
* @return string |void
* @uses smarty_make_timestamp()
*/
function smarty_modifier_date_format($string, $format = '%b %e, %Y', $default_date = '')
function smarty_modifier_date_format($string, $format = null, $default_date = '', $formatter = 'auto')
{
if ($string != '') {
if ($format === null) {
$format = Smarty::$_DATE_FORMAT;
}
/**
* require_once the {@link shared.make_timestamp.php} plugin
*/
static $is_loaded = false;
if (!$is_loaded) {
if (!is_callable('smarty_make_timestamp')) {
include_once SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php';
}
$is_loaded = true;
}
if (!empty($string) && $string !== '0000-00-00' && $string !== '0000-00-00 00:00:00') {
$timestamp = smarty_make_timestamp($string);
} elseif ($default_date != '') {
} elseif (!empty($default_date)) {
$timestamp = smarty_make_timestamp($default_date);
} else {
return;
}
if (DIRECTORY_SEPARATOR == '\\') {
$_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));
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'
);
if (strpos($format, '%e') !== false) {
$_win_from[] = '%e';
$_win_to[] = sprintf('%\' 2d', date('j', $timestamp));
}
if (strpos($format, '%l') !== false) {
$_win_from[] = '%l';
$_win_to[] = sprintf('%\' 2d', date('h', $timestamp));
}
$format = str_replace($_win_from, $_win_to, $format);
}
if (strpos($format, '%l') !== false) {
$_win_from[] = '%l';
$_win_to[] = sprintf('%\' 2d', date('h', $timestamp));
}
$format = str_replace($_win_from, $_win_to, $format);
return strftime($format, $timestamp);
} else {
return date($format, $timestamp);
}
return strftime($format, $timestamp);
}
/* vim: set expandtab: */
?>
+65 -52
View File
@@ -1,56 +1,62 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*
* @package Smarty
* @subpackage Debug
*/
/**
* 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
* @link http://smarty.php.net/manual/en/language.modifier.debug.print.var.php
* debug_print_var (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param array|object
* @param integer
* @param integer
*
* @author Monte Ohrt <monte at ohrt dot com>
*
* @param array|object $var variable to be formatted
* @param int $max maximum recursion depth if $var is an array or object
* @param int $length maximum string length if $var is a string
* @param int $depth actual recursion depth
* @param array $objects processed objects in actual depth to prevent recursive object processing
*
* @return string
*/
function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = 0, $objects = array())
{
$_replace = array(
"\n" => '<i>\n</i>',
"\r" => '<i>\r</i>',
"\t" => '<i>\t</i>'
);
$_replace = array("\n" => '\n', "\r" => '\r', "\t" => '\t');
switch (gettype($var)) {
case 'array' :
case 'array':
$results = '<b>Array (' . count($var) . ')</b>';
if ($depth === $max) {
break;
}
foreach ($var as $curr_key => $curr_val) {
$results .= '<br>' . str_repeat('&nbsp;', $depth * 2)
. '<b>' . strtr($curr_key, $_replace) . '</b> =&gt; '
. smarty_modifier_debug_print_var($curr_val, ++$depth, $length);
$depth--;
$results .= '<br>' . str_repeat('&nbsp;', $depth * 2) . '<b>' . strtr($curr_key, $_replace) .
'</b> =&gt; ' .
smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects);
$depth--;
}
break;
case 'object' :
case 'object':
$object_vars = get_object_vars($var);
$results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>';
if (in_array($var, $objects)) {
$results .= ' called recursive';
break;
}
if ($depth === $max) {
break;
}
$objects[] = $var;
foreach ($object_vars as $curr_key => $curr_val) {
$results .= '<br>' . str_repeat('&nbsp;', $depth * 2)
. '<b> -&gt;' . strtr($curr_key, $_replace) . '</b> = '
. smarty_modifier_debug_print_var($curr_val, ++$depth, $length);
$depth--;
$results .= '<br>' . str_repeat('&nbsp;', $depth * 2) . '<b> -&gt;' . strtr($curr_key, $_replace) .
'</b> = ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects);
$depth--;
}
break;
case 'boolean' :
case 'NULL' :
case 'resource' :
case 'boolean':
case 'NULL':
case 'resource':
if (true === $var) {
$results = 'true';
} elseif (false === $var) {
@@ -58,33 +64,40 @@ function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
} elseif (null === $var) {
$results = 'null';
} else {
$results = htmlspecialchars((string) $var);
$results = htmlspecialchars((string)$var);
}
$results = '<i>' . $results . '</i>';
break;
case 'integer' :
case 'float' :
$results = htmlspecialchars((string) $var);
case 'integer':
case 'float':
$results = htmlspecialchars((string)$var);
break;
case 'string' :
case 'string':
$results = strtr($var, $_replace);
if (strlen($var) > $length ) {
$results = substr($var, 0, $length - 3) . '...';
if (Smarty::$_MBSTRING) {
if (mb_strlen($var, Smarty::$_CHARSET) > $length) {
$results = mb_substr($var, 0, $length - 3, Smarty::$_CHARSET) . '...';
}
} else {
if (isset($var[ $length ])) {
$results = substr($var, 0, $length - 3) . '...';
}
}
$results = htmlspecialchars('"' . $results . '"');
$results = htmlspecialchars('"' . $results . '"', ENT_QUOTES, Smarty::$_CHARSET);
break;
case 'unknown type' :
default :
$results = strtr((string) $var, $_replace);
if (strlen($results) > $length ) {
$results = substr($results, 0, $length - 3) . '...';
case 'unknown type':
default:
$results = strtr((string)$var, $_replace);
if (Smarty::$_MBSTRING) {
if (mb_strlen($results, Smarty::$_CHARSET) > $length) {
$results = mb_substr($results, 0, $length - 3, Smarty::$_CHARSET) . '...';
}
} else {
if (strlen($results) > $length) {
$results = substr($results, 0, $length - 3) . '...';
}
}
$results = htmlspecialchars($results);
$results = htmlspecialchars($results, ENT_QUOTES, Smarty::$_CHARSET);
}
return $results;
}
/* vim: set expandtab: */
?>
-32
View File
@@ -1,32 +0,0 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty default modifier plugin
*
* Type: modifier<br>
* Name: default<br>
* Purpose: designate default value for empty variables
* @link http://smarty.php.net/manual/en/language.modifier.default.php
* default (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param string
* @param string
* @return string
*/
function smarty_modifier_default($string, $default = '')
{
if (!isset($string) || $string === '')
return $default;
else
return $string;
}
/* vim: set expandtab: */
?>
+217 -55
View File
@@ -1,93 +1,255 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*
* @package Smarty
* @subpackage PluginsModifier
*/
/**
* Smarty escape modifier plugin
* Type: modifier
* Name: escape
* Purpose: escape string for output
*
* Type: modifier<br>
* Name: escape<br>
* Purpose: Escape the string according to escapement type
* @link http://smarty.php.net/manual/en/language.modifier.escape.php
* escape (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param string
* @param html|htmlall|url|quotes|hex|hexentity|javascript
* @return string
* @link http://www.smarty.net/docs/en/language.modifier.escape
* @author Monte Ohrt <monte at ohrt dot com>
*
* @param string $string input string
* @param string $esc_type escape type
* @param string $char_set character set, used for htmlspecialchars() or htmlentities()
* @param boolean $double_encode encode already encoded entitites again, used for htmlspecialchars() or htmlentities()
*
* @return string escaped input string
*/
function smarty_modifier_escape($string, $esc_type = 'html', $char_set = 'ISO-8859-1')
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', '>=');
}
if (!$char_set) {
$char_set = Smarty::$_CHARSET;
}
switch ($esc_type) {
case 'html':
return htmlspecialchars($string, ENT_QUOTES, $char_set);
if ($_double_encode) {
// php >=5.3.2 - go native
return htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode);
} else {
if ($double_encode) {
// php <5.2.3 - only handle double encoding
return htmlspecialchars($string, ENT_QUOTES, $char_set);
} else {
// 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
);
return $string;
}
}
// no break
case 'htmlall':
return htmlentities($string, ENT_QUOTES, $char_set);
if (Smarty::$_MBSTRING) {
// mb_convert_encoding ignores htmlspecialchars()
if ($_double_encode) {
// php >=5.3.2 - go native
$string = htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode);
} else {
if ($double_encode) {
// php <5.2.3 - only handle double encoding
$string = htmlspecialchars($string, ENT_QUOTES, $char_set);
} else {
// 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
);
return $string;
}
}
// htmlentities() won't convert everything, so use mb_convert_encoding
return mb_convert_encoding($string, 'HTML-ENTITIES', $char_set);
}
// no MBString fallback
if ($_double_encode) {
return htmlentities($string, ENT_QUOTES, $char_set, $double_encode);
} else {
if ($double_encode) {
return htmlentities($string, ENT_QUOTES, $char_set);
} 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
);
return $string;
}
}
// no break
case 'url':
return rawurlencode($string);
case 'urlpathinfo':
return str_replace('%2F','/',rawurlencode($string));
return str_replace('%2F', '/', rawurlencode($string));
case 'quotes':
// escape unescaped single quotes
return preg_replace("%(?<!\\\\)'%", "\\'", $string);
case 'hex':
// escape every character into hex
// escape every byte into hex
// Note that the UTF-8 encoded character ä will be represented as %c3%a4
$return = '';
for ($x=0; $x < strlen($string); $x++) {
$return .= '%' . bin2hex($string[$x]);
$_length = strlen($string);
for ($x = 0; $x < $_length; $x++) {
$return .= '%' . bin2hex($string[ $x ]);
}
return $return;
case 'hexentity':
$return = '';
for ($x=0; $x < strlen($string); $x++) {
$return .= '&#x' . bin2hex($string[$x]) . ';';
if (Smarty::$_MBSTRING) {
if (!$is_loaded_1) {
if (!is_callable('smarty_mb_to_unicode')) {
include_once SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php';
}
$is_loaded_1 = true;
}
$return = '';
foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) {
$return .= '&#x' . strtoupper(dechex($unicode)) . ';';
}
return $return;
}
// no MBString fallback
$_length = strlen($string);
for ($x = 0; $x < $_length; $x++) {
$return .= '&#x' . bin2hex($string[ $x ]) . ';';
}
return $return;
case 'decentity':
$return = '';
for ($x=0; $x < strlen($string); $x++) {
$return .= '&#' . ord($string[$x]) . ';';
if (Smarty::$_MBSTRING) {
if (!$is_loaded_1) {
if (!is_callable('smarty_mb_to_unicode')) {
include_once SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php';
}
$is_loaded_1 = true;
}
$return = '';
foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) {
$return .= '&#' . $unicode . ';';
}
return $return;
}
// no MBString fallback
$_length = strlen($string);
for ($x = 0; $x < $_length; $x++) {
$return .= '&#' . ord($string[ $x ]) . ';';
}
return $return;
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':
// safe way to display e-mail address on a web page
return str_replace(array('@', '.'),array(' [AT] ', ' [DOT] '), $string);
if (Smarty::$_MBSTRING) {
if (!$is_loaded_2) {
if (!is_callable('smarty_mb_str_replace')) {
include_once SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php';
}
$is_loaded_2 = true;
}
return smarty_mb_str_replace(
array(
'@',
'.'
),
array(
' [AT] ',
' [DOT] '
),
$string
);
}
// no MBString fallback
return str_replace(
array(
'@',
'.'
),
array(
' [AT] ',
' [DOT] '
),
$string
);
case 'nonstd':
// escape non-standard chars, such as ms document quotes
$_res = '';
for($_i = 0, $_len = strlen($string); $_i < $_len; $_i++) {
$_ord = ord(substr($string, $_i, 1));
// non-standard char, escape it
if($_ord >= 126){
$_res .= '&#' . $_ord . ';';
}
else {
$_res .= substr($string, $_i, 1);
}
}
return $_res;
// escape non-standard chars, such as ms document quotes
$return = '';
if (Smarty::$_MBSTRING) {
if (!$is_loaded_1) {
if (!is_callable('smarty_mb_to_unicode')) {
include_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) {
$return .= '&#' . $unicode . ';';
} else {
$return .= chr($unicode);
}
}
return $return;
}
$_length = strlen($string);
for ($_i = 0; $_i < $_length; $_i++) {
$_ord = ord(substr($string, $_i, 1));
// non-standard char, escape it
if ($_ord >= 126) {
$return .= '&#' . $_ord . ';';
} else {
$return .= substr($string, $_i, 1);
}
}
return $return;
default:
return $string;
}
}
/* vim: set expandtab: */
?>

Some files were not shown because too many files have changed in this diff Show More