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.  * @author     Jordi Boggiano <j.boggiano@seld.be>
  11.  * @copyright  Copyright (c) 2008, Jordi Boggiano
  12.  * @license    http://dwoo.org/LICENSE   Modified BSD License
  13.  * @link       http://dwoo.org/
  14.  * @version    1.0.0
  15.  * @date       2008-10-23
  16.  * @package    Dwoo
  17.  */
  18. {
  19.     public function init(array $rest)
  20.     {
  21.     }
  22.  
  23.     public static function preProcessing(Dwoo_Compiler $compilerarray $params$prepend$append$type)
  24.     {
  25.         $preContent '';
  26.         while (true{
  27.             $preContent .= $compiler->removeTopBlock();
  28.             $block =$compiler->getCurrentBlock();
  29.             $interfaces class_implements($block['class']false);
  30.             if (in_array('Dwoo_IElseable'$interfaces!== false{
  31.                 break;
  32.             }
  33.         }
  34.  
  35.         $params['initialized'true;
  36.         $compiler->injectBlock($type$params);
  37.         return $preContent;
  38.     }
  39.  
  40.     public static function postProcessing(Dwoo_Compiler $compilerarray $params$prepend$append$content)
  41.     {
  42.         if (!isset($params['initialized'])) {
  43.             return '';
  44.         }
  45.  
  46.         $params $compiler->getCompiledParams($params);
  47.  
  48.         $pre Dwoo_Compiler::PHP_OPEN."elseif (".implode(' 'self::replaceKeywords($params['*']$compiler)).") {\n" Dwoo_Compiler::PHP_CLOSE;
  49.         $post Dwoo_Compiler::PHP_OPEN."\n}".Dwoo_Compiler::PHP_CLOSE;
  50.  
  51.         if (isset($params['hasElse'])) {
  52.             $post .= $params['hasElse'];
  53.         }
  54.  
  55.         $block =$compiler->getCurrentBlock();
  56.         $block['params']['hasElse'$pre $content $post;
  57.         return '';
  58.     }
  59. }

Documentation generated on Sat, 18 Jul 2009 21:04:57 +0200 by phpDocumentor 1.4.0