Source for file pre.smarty_compat.php
Documentation is available at pre.smarty_compat.php
* Performs some template conversions to allow smarty templates to be used by
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from the use of this software.
* @author Jordi Boggiano <j.boggiano@seld.be>
* @copyright Copyright (c) 2008, Jordi Boggiano
* @license http://dwoo.org/LICENSE Modified BSD License
list
($l, $r) =
$this->compiler->getDelimiters();
$sectionParam =
'(?:(name|loop|start|step|max|show)\s*=\s*(\S+))?\s*';
$input =
preg_replace_callback('/'.
$rl.
'\s*section '.
str_repeat($sectionParam, 6).
'\s*'.
$rr.
'(.+?)(?:'.
$rl.
'\s*sectionelse\s*'.
$rr.
'(.+?))?'.
$rl.
'\s*\/section\s*'.
$rr.
'/is', array($this, 'convertSection'), $input);
$input =
str_replace('$smarty.section.', '$smarty.for.', $input);
'/'.
$rl.
'\s*ldelim\s*'.
$rr.
'/',
'/'.
$rl.
'\s*rdelim\s*'.
$rr.
'/',
'/'.
$rl.
'\s*\$smarty\.ldelim\s*'.
$rr.
'/',
'/'.
$rl.
'\s*\$smarty\.rdelim\s*'.
$rr.
'/',
'/'.
$rl.
'\s*php\s*'.
$rr.
'/',
'/'.
$rl.
'\s*\/php\s*'.
$rr.
'/',
'/\|(@?)strip(\||'.
$rr.
')/',
'/'.
$rl.
'\s*sectionelse\s*'.
$rr.
'/',
if (preg_match('{\|@([a-z][a-z0-9_]*)}i', $input, $matches)) {
trigger_error('The Smarty Compatibility Module has detected that you use |@'.
$matches[1].
' in your template, this might lead to problems as Dwoo interprets the @ operator differently than Smarty, see http://wiki.dwoo.org/index.php/Syntax#The_.40_Operator', E_USER_NOTICE);
while (!empty($matches[$index]) &&
$index <
13) {
$params[$matches[$index]] =
$matches[$index+
1];
return str_replace('['.
trim($params['name'], '"\'').
']', '[$'.
trim($params['name'], '"\'').
']', $matches[0]);
Documentation generated on Sun, 07 Feb 2010 17:53:54 +0000 by phpDocumentor 1.4.0