Source for file elseif.php

Documentation is available at elseif.php

  1. <?php
  2.  
  3. /**
  4.  * Acts as a php elseif block, allowing you to add one more condition
  5.  * if the previous one(s) didn't match. See the {if} plugin for syntax details
  6.  *
  7.  * This software is provided 'as-is', without any express or implied warranty.
  8.  * In no event will the authors be held liable for any damages arising from the use of this software.
  9.  *
  10.  * This file is released under the LGPL
  11.  * "GNU Lesser General Public License"
  12.  * More information can be found here:
  13.  * {@link http://www.gnu.org/copyleft/lesser.html}
  14.  *
  15.  * @author     Jordi Boggiano <j.boggiano@seld.be>
  16.  * @copyright  Copyright (c) 2008, Jordi Boggiano
  17.  * @license    http://www.gnu.org/copyleft/lesser.html  GNU Lesser General Public License
  18.  * @link       http://dwoo.org/
  19.  * @version    0.9.1
  20.  * @date       2008-05-30
  21.  * @package    Dwoo
  22.  */
  23. {
  24.     public function init(array $rest)
  25.     {
  26.     }
  27.  
  28.     public static function preProcessing(Dwoo_Compiler $compilerarray $params$prepend$append$type)
  29.     {
  30.         $preContent '';
  31.         while (true{
  32.             $preContent .= $compiler->removeTopBlock();
  33.             $block =$compiler->getCurrentBlock();
  34.             $interfaces class_implements($block['class']false);
  35.             if (in_array('Dwoo_IElseable'$interfaces!== false{
  36.                 break;
  37.             }
  38.         }
  39.  
  40.         $params['initialized'true;
  41.         $compiler->injectBlock($type$params);
  42.         return $preContent;
  43.     }
  44.  
  45.     public static function postProcessing(Dwoo_Compiler $compilerarray $params$prepend$append$content)
  46.     {
  47.         if (!isset($params['initialized'])) {
  48.             return '';
  49.         }
  50.  
  51.         $params $compiler->getCompiledParams($params);
  52.  
  53.         $pre Dwoo_Compiler::PHP_OPEN."elseif (".implode(' 'self::replaceKeywords($params['*']$compiler)).") {\n" Dwoo_Compiler::PHP_CLOSE;
  54.         $post Dwoo_Compiler::PHP_OPEN."\n}".Dwoo_Compiler::PHP_CLOSE;
  55.  
  56.         if (isset($params['hasElse'])) {
  57.             $post .= $params['hasElse'];
  58.         }
  59.  
  60.         $block =$compiler->getCurrentBlock();
  61.         $block['params']['hasElse'$pre $content $post;
  62.         return '';
  63.     }
  64. }

Documentation generated on Sun, 07 Sep 2008 23:57:45 +0200 by phpDocumentor 1.4.0