~ubuntu-branches/ubuntu/lucid/mahara/lucid-security

« back to all changes in this revision

Viewing changes to htdocs/lib/dwoo/dwoo/plugins/builtin/blocks/foreachelse.php

  • Committer: Bazaar Package Importer
  • Author(s): Francois Marier
  • Date: 2009-11-27 22:09:03 UTC
  • mfrom: (6.3.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091127220903-aiigd3tr46z0rmcg
Tags: 1.2.0-2
Fix postrm script so that Mahara can be uninstalled

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
/**
 
4
 * This plugin serves as a {else} block specifically for the {foreach} plugin.
 
5
 *
 
6
 * This software is provided 'as-is', without any express or implied warranty.
 
7
 * In no event will the authors be held liable for any damages arising from the use of this software.
 
8
 *
 
9
 * @author     Jordi Boggiano <j.boggiano@seld.be>
 
10
 * @copyright  Copyright (c) 2008, Jordi Boggiano
 
11
 * @license    http://dwoo.org/LICENSE   Modified BSD License
 
12
 * @link       http://dwoo.org/
 
13
 * @version    1.0.0
 
14
 * @date       2008-10-23
 
15
 * @package    Dwoo
 
16
 */
 
17
class Dwoo_Plugin_foreachelse extends Dwoo_Block_Plugin implements Dwoo_ICompilable_Block
 
18
{
 
19
        public function init()
 
20
        {
 
21
        }
 
22
 
 
23
        public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type)
 
24
        {
 
25
                $with =& $compiler->findBlock('foreach', true);
 
26
 
 
27
                $params['initialized'] = true;
 
28
                $compiler->injectBlock($type, $params);
 
29
 
 
30
                return '';
 
31
        }
 
32
 
 
33
        public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content)
 
34
        {
 
35
                if (!isset($params['initialized'])) {
 
36
                        return '';
 
37
                }
 
38
 
 
39
                $block =& $compiler->getCurrentBlock();
 
40
                $block['params']['hasElse'] = Dwoo_Compiler::PHP_OPEN."else {\n".Dwoo_Compiler::PHP_CLOSE . $content . Dwoo_Compiler::PHP_OPEN."\n}".Dwoo_Compiler::PHP_CLOSE;
 
41
                return '';
 
42
        }
 
43
}