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.
* This file is released under the LGPL
* "GNU Lesser General Public License"
* More information can be found here:
* {@link http://www.gnu.org/copyleft/lesser.html}
* @copyright Copyright (c) 2008, Jordi Boggiano
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public 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.
'/',
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];
$params['content'] =
$matches[13];
if (isset
($matches[14]) &&
!empty($matches[14])) {
$params['altcontent'] =
$matches[14];
if (empty($params['name'])) {
if (isset
($params['loop'])) {
$loops =
$params['loop'];
if (isset
($params['max'])) {
if (isset
($params['start'])) {
$start =
$params['start'];
if (isset
($params['step'])) {
if (!isset
($max) ||
$max <
0) {
list
($l, $r) =
$this->compiler->getDelimiters();
if (isset
($params['start']) && isset
($params['loop']) &&
!isset
($params['max'])) {
$output =
$l.
'for '.
$name.
' '.
$start.
' '.
($loops-
$step).
' '.
$step.
$r;
$output =
$l.
'for '.
$name.
' '.
$start.
' '.
($start+
floor($step*
$max+
($step>
0?-
1:
1))).
' '.
$step.
$r;
$output =
$l.
'for '.
$name.
' '.
$loops.
' '.
($start+
floor($max/
$step)).
' '.
$step.
' '.
$start.
$r;
$output .=
str_replace('['.
trim($name, '"\'').
']', '[$'.
trim($name, '"\'').
']', $params['content']);
if (isset
($params['altcontent'])) {
$output .=
$l.
'forelse'.
$r.
$params['altcontent'];
Documentation generated on Sun, 03 Aug 2008 15:12:43 +0200 by phpDocumentor 1.4.0