Posted
over 16 years
ago
Adapters: Added the ZendFramework interface for Dwoo (see /Dwoo/Adapters/ZendFramework/README) Plugins: Added the {a} block plugin to generate <a> tags Syntax: Added the ";" token that allows to group multiple instructions in one single
... [More]
template tag, example: {if $foo; "> $foo";$bar;/} is equal to: {if $foo}> {$foo}{$bar}{/} - This also allow block operations such as: {a http://url.com; "Text" /} which equals to {a http://url.com}Text{/} Syntax: Block plugins that you want to call without content can be self-closed just like XML tags (e.g. {a "http://url.com" /} ). Be careful not to close a non-block plugin like that however, since it will close it's parent block Syntax: Static methods can be called using {Class::method()} Syntax: It is now possible to use a plugin's result as an object and call a method or read a property from it, i.e. {fetchObject()->doStuff()} API: Added Dwoo_Plugin::paramsToAttributes() utility function to help with the creation of compilable xml/html-related plugins, see {a} for an example API: Added Dwoo->setPluginProxy() and Dwoo_IPluginProxy that allow you to hook into the compiler's plugin subsystem to provide your own plugin calls. Thanks to Denis Arh for the patch => topic API: Dwoo->addPlugin() has a third parameter to mark a plugin as compilable Compiler supports method calls into a method call's parameters* Dwoo_Compiler::implode_r is now public/static so it can be used in other places such as plugin proxies* Syntax: Math expressions in strings are now only allowed when the entire expression is delimited, e.g. {"/$foo/$bar"} evaluates as just that while {"/`$foo/$bar`"} will result in "/".($foo/$bar), therefore processing the / as a division, this is better since URLs using / are far more common than math in strings => topic* Compiler now allows the use of the right delimiter inside strings (e.g. {"}"})* Fixed a bug preventing if blocks containing a {elseif} followed by {else}* Fixed the Dwoo_ILoader interface and implemented it in Dwoo_Loader now => topic* Fixed ompileId auto-generation creating conflicts* Include allows paths going in upper levels now such as : "../foo.html"* Some compiler fixes regarding custom plugins [Less]
|
Posted
over 16 years
ago
! BC Break: Renamed the {strip} modifier/function to {whitespace}, this does not affect the strip block, that has been moved off the compiler into a plugin. Which is why the name conflict had to be resolved. Please report any issue you might
... [More]
encounter when using the strip block! BC Break: Changed the function signature of Dwoo_Block_Plugin::postProcessing it only affects you if you had any custom block plugins, see UPGRADE_NOTES for more details! BC Break: Dwoo_ITemplate::cache() must now return the cached file name or false if caching failed, only affects you if you had a custom template class and implemented cache() yourself! BC Break: Dwoo_Loader is not static anymore so anything you did on it directly will break. Use $dwoo->getLoader()->addDirectory() instead of Dwoo_Loader::addDirectory() for example! BC Break: DWOO_COMPILE_DIRECTORY and DWOO_CACHE_DIRECTORY are gone, set those paths in Dwoo's constructor (i.e. new Dwoo('compiledir', 'cachedir')) if you need to override the default ones Plugins: Added {dynamic} that allows cached templates to have dynamic (non-cached) parts, when rendering a cached page, the dynamic parts can still use the variables you provides Plugins: Added {tif} that acts as a ternary if / allows you to use a ternary operator inside it API: Added a Dwoo_ILoader interface if you want to provide a custom plugin loading solution (use $dwoo->setLoader($myLoader)) Added line numbers in compilation errors and improved several error messages Added magic object-access methods to Dwoo_Data, so you can assign values by doing $data->var = $val; instead of $data->assign('var', $val); Added get()/unassign()/isAssigned() methods to read, remove and check for the presence of a var inside a Dwoo_Data object* Plugins: added a fifth 'string $implode' parameter to {foreach}, it prints whatever you provide it between each item of the foreach, just like implode()* Plugins: added a fourth 'bool $case_sensitive' parameter to {replace}* Plugins: added a fourth 'bool $trim' parameter to {capture} that trims the captured text* Made the dependency on the hash extension optional* Fixed compiler bug that prevented method calls combined with named parameters* Fixed compiler bug that prevented the % shortcut for constants to work within function calls (basically it only worked as {%CONST})* Fixed compiler bug that prevented empty() to be called* Fixed several modifier parsing bugs => topic* Fixed empty string parsing in modifier applied to variables* Fixed compiler handling of <?php echo "foo" ?>{template_tag} where there was no ';' at the end of the php tag* Allowed method calls to work within named parameters* Removed checks for methods/properties being present on objects before calling them since these can be handled by __get() and __call() => topic* Calling {func (params)} (with the space between function and params) is now allowed => topic* The compiler now allows \r, \n and \t to be parameter splitters as well as "," and " ". You can therefore split complex function calls on multiple lines* Converted most of the code to follow PEAR Coding Standards, hopefully this didn't break anything that the tests missed* A few other minor or internal changes [Less]
|
Posted
over 16 years
ago
API: Added Dwoo_Compiler->setAutoEscape() and getAutoEscape() to modify the automatic html entity escaping setting. This is disabled by default, and when enabled can be overriden with the {safe $var} plugin or the {auto_escape disable} block
... [More]
plugin. The block plugin can also be used to enable this mode from within a template Syntax: Mixing named and unnamed parameters is now allowed, as long as the unnamed ones appear first Syntax: Added {/} shortcut that closes the last opened block* Optimized scope-handling functions, {loop} and {with} are now slightly faster* Fixed a bug in {date_format} that prevented anything but unix timestamps to work* {literal} and {strip} now follow the LooseOpeningsHandling setting* Fixed complex variables (i.e. {$_root[$c[$x.0]].0}) parsing bugs* Fixed $dwoo->addResource() breaking if the resource class was not loaded yet, autoload should now be called (thanks mike)* Fixed a block stack bug that messed up {textformat} and possibly usermade block plugins [Less]
|
Posted
over 16 years
ago
! BC Break: changed all class names to be PEAR compliant (aka use underscores to separate words/paths), sorry about that but I better do it now than in six months! BC Break: $dwoo->output() and get() have been swapped internally, but it doesn't
... [More]
change anything for you unless you called output(*, *, *, true) directly to emulate get().! BC Break: $dwoo->getTemplate() changed to $dwoo->templateFactory() and $dwoo->getCurrentTemplate() changed to $dwoo->getTemplate() for consistency among all classes and factory functions Added a compiled version of Dwoo that loads faster (especially with opcode caches such as APC), include Dwoo.compiled.php instead of Dwoo.php on production but if you want to file a bug use Dwoo.php please as it allows you to get the proper file/line number where an error occurs. Do not remove all other files however since they are not all included in the compiled package Plugins: Added {extends} and {block} to handle template inheritance, read more about it in the wiki Plugins: Added {loop} that combines {foreach} and {with}, see the wiki for details Plugins: Added {do} that executes whatever you feed it whitout echoing the result, used internally for extends but you can use it if required Plugins: Added {eol} that prints an end of line character (OS-specific) Syntax: Added shortcut for {$dwoo.const.*} using '%', for example you can use {%FOO} instead of {$dwoo.const.FOO} Syntax: When using named parameters, typing a parameter name without any value is the same as typing param=true, for example {foo name="test" bar} and {foo name="test" bar=true} are equals, can be useful for very complex plugins with huge amounts of parameters. Syntax: Added support for {$foo =5}, {$foo="a"}, {$foo } and {$foo--} Syntax: Added shortcut for $dwoo.*, you can now use {$.foreach.foo} instead of {$dwoo.foreach.foo} for example, applies to all $dwoo.* vars Syntax: Added $ as a shortcut for current scope, $_ for $_parent and $__ for $_root API: Added getSource(), getUid() and getResourceIdentifier() to Dwoo_ITemplate API: Added setSecurityPolicy() too Dwoo_ICompiler and modified the arguments of its compile() method API: Added a bunch of utility functions to Dwoo_Compiler, allowing compiled plugins to access more of the compiler internals Both cache and compile IDs can now have slashes in them to create subfolders in the cache/compile dirs Added a DWOO_CHMOD constant that, if set before you include Dwoo, allows you to define the file mode of all the file/directories Dwoo will write, defaults to 0777 Added a 'data' argument to {include} to be able to feed data directly into it* The compiler now throws Dwoo_Compilation_Exception exceptions upon failure and security problems lead to a Dwoo_Security_Exception being thrown. Runtime plugin errors and such trigger simple php errors to allow the template execution to complete. You can use Dwoo_Exception to catch all Dwoo exceptions* Fixed a potential concurrency issue (thanks to Rasmus Schultz for the patch)* Moved all files to Dwoo/Class.php excepted for the core Dwoo.php file* Various performance improvements, including the removal of a lot of isset() calls. Doing {$foo} if foo is undefined will now display a PHP warning, but doing {foreach $foo}..{/foreach} will not however, that way you don't have to do {if isset($foo)} before the foreach, but automated isset() calls don't impact performance as much as they did before.* API: Dwoo_ITemplate->clearCache now requires a Dwoo instance as its first arg, should not affect you unless you built a custom template class from scratch* Reworked Dwoo template rendering to avoid variables conflicts with plugins* {include} now uses the current resource if none is provided instead of using file as it did before* Dwoo uses include path instead of absolute includes* Changed all line endings to Unix (line feed only) and all spaces left have been converted to tabs (tabspace 4)* TestFest happened early for Dwoo, lots of new tests and more code covered* Fixed a regression in the handling of custom class plugins* Fixed various bugs in the Adapter class and related smarty compatibility features* Fixed a classpath rebuilding bug that occured on some UNIX platforms due to glob() returning false sometimes for empty folders* Fixed a bug in Dwoo_Security_Policy->getAllowedDirectories(), no security issue though* Fixed a bug in Dwoo::setScope affecting {loop} and {with}* Fixed a parsing bug when doing {"string"|modifier:$var} [Less]
|
Posted
almost 17 years
ago
! BC Break: DWOO_PATH constant changed to DWOO_DIRECTORY! BC Break: Smarty's @ operator for modifiers is now reversed, for example $array|reverse will reverse the items of that array while $array|@reverse will reverse each item of the given array (as
... [More]
if you used array_map) see details Syntax: Added support for method calls on objects i.e. {$foo->bar()} Added support for smarty security features, see the DwooSecurityPolicy class and $dwoo->setSecurityPolicy() API: Added a DwooCompiler->setLooseOpeningHandling() method that, if set to true, allows tags to contain spaces between the opening bracket and the content. Turned off by default as it allows to compile files containing css and javascript without the need to escape it through {literal} or \{ Added DWOO_CACHE_DIRECTORY and DWOO_COMPILE_DIRECTORY constants that you can set before including Dwoo.php to override the defaults (although Dwoo->setCacheDir/setCompileDir() still work to change that if required) Added the DwooException class Smarty: Added partial support for register_object(), unregister_object() and get_registered_object(). All features can not be supported by the adapter though so you might get compatibility warnings * Fixed {elseif} bug that appeared when multiple elseif tags were used in a row* Syntax: Improved simple math support to work within variable variables (i.e. you can do {$array[$index 1]}) and within strings as well. To prevent this enclose the variables in backticks (i.e. {"$foo/$bar"} will do the math while {"`$foo`/$bar"} won't as $foo is properly delimited)* Changed DwooLoader::addDirectory() so that it writes the class paths cache into DWOO_COMPILE_DIRECTORY, that way you don't have to make your plugin directory writable* Made all the error triggering more consistent* Changed automatic cacheId generation in DwooTemplateFile/String to be faster [Less]
|
Posted
almost 17 years
ago
Syntax: Added support for $dwoo.const.CONSTANT and $dwoo.const.Class::CONSTANT to read PHP constants from the template Syntax: Added support for on/off/yes/no, that work as aliases for true/false Syntax: Added the $dwoo.charset global variable
... [More]
Plugins: Added {withelse} and made {with} compatible with {else} also API: Added left/right delimiters customization, see DwooCompiler->setDelimiters() API: Added DwooCompiler->triggerError() API: Added Dwoo->clearCache() and DwooITemplate->clearCache() methods Smarty: The smartyCompat prefilter converts {section} tags into {for} tags on the fly, however it's not guaranteed to work with *all* section tags, let me know if it breaks for you* {with} now skips the entire block if it's variable doesn't exist, so by itself it acts as if you would do {if $var}{with $var}{/with}{/if}* Each resource has a compiler factory function assigned to it, allowing you to easily provide a custom compiler without loading it on every page* OutputFilters are now simply called Filters (they still use DwooFilter)* Pre/PostFilters have become Pre/PostProcessors (they now use DwooProcessor)* Compiler: Fixed a parsing bug that prevented function names of 1character* Compiler: Changed internal handling of variables to fix some errors being thrown with specific cases* Reorganized Dwoo/DwooCompiler and fully commented all the core classes and interfaces [Less]
|
Posted
almost 17 years
ago
Added access to superglobals through $dwoo.get.value, $dwoo.post.value, etc. Added outputFilters to Dwoo (use Dwoo->addOutputFilter and Dwoo->removeOutputFilter) Added preFilters and postFilters to DwooCompiler (use
... [More]
DwooCompiler->addPreFilter, etc) Added a html_format output filter that intends properly the html code, use it only on full page templates Plugins: Added {for} and {forelse} which allow to loop over an array or to loop over a range of numbers Plugins: Added {mailto}, {counter}, {eval}, {fetch} and {include} Syntax : Enhanced support for implicit math operations, {$var $var2*var3 5} now works. Operations are executed from left to right though, there is no operator priority. (i.e. 1 1*2 = (1 1)*2 = 4, not 3) API: Added resources support through DwooITemplate implementations and Dwoo->addResource() API: Added Dwoo->getTemplate() to get the currently running template object API: Added DwooCompiler::getInstance() to use only one compiler object when rendering from the default compiler and to provide you with a singleton if it's easier, however the class is not a singleton in the sense that it can be instantiated separately API: Added a factory method on DwooITemplate to support resources creation Added a release tag so that all compiled templates are forced to recompile after an update, however it is recommended to cleanup your "compiled" directory now and then as each release uses new filenames Added an abstract DwooFilter class that you can extend to build filters* PHP function calls are now case insensitive* Syntax: The compiler now parses expressions before modifiers, allowing for {$var/2|number_format} for example* DwooTemplateFile now extends DwooTemplateString instead of the other way around as it was before* {else} is now a general purpose plugin that can act as 'else' for foreach, for and if/elseif, foreachelse and forelse are still available though [Less]
|
Posted
almost 17 years
ago
Added {cycle} function Syntax : Enabled support for associative arrays using array(key="value", key2=5) for example, which you can assign or use in a foreach directly Syntax : Added support for {$var -/*% X} (i.e. {$var 4}), useful for simple
... [More]
math operations without the math plugin API : Added append/appendByRef to DwooData Completely rebuilt DwooSmartyAdapter, it should "work" and fail silently if you use a non supported function now, however you can set $smarty->show_compat_errors=true; on it to receive notices about unsupported features that you use* Bug fixed in {literal} parsing* Bug fixed in smarty functions handling* API : Moved Plugin types constants to Dwoo so the compiler doesn't have to be loaded unles really required* API : Moved globals and var reinitialization in Dwoo into their own methods so that child classes can easily add globals* Some improvements in the compiler output* Some changes in the cache handling of DwooTemplateFile- Special thanks to Andrew Collins that found many of the bugs fixed in this release [Less]
|
Posted
almost 17 years
ago
Full template cache support DwooTemplateString class to load templates from a string Dwoo::VERSION constant {dump} plugin to print out variables Unit tests (with PHPUnit) covering 73% of the codebase right now, which should help reducing
... [More]
regression bugs in the next versions. Started commenting (with phpdocs) properly all the classes, should be complete for 0.4.0* {capture} is now compilable and has a new boolean flag to append output into the target variable instead of overwriting * {foreach} supports direct input (instead of only variables), allowing constructs like {foreach array(a,b,c) val}{$val}{/foreach} for example that would output abc.* pre/postProcessing functions in block plugins now receive an array of named parameters instead of numbered * Major refactoring of DwooTemplateFile and DwooCompiler* Cleaned up members visibility in Dwoo/DwooCompiler * Fixes in the compiler parsing and general variables handling* Multiple bugfixes here and there thanks to the unit tests* Optimized {foreach} a lot [Less]
|
Posted
almost 17 years
ago
* Compiler fixes for argument parsing and handling of Smarty plugins
|