Source for file eval.php

Documentation is available at eval.php

  1. <?php
  2.  
  3. /**
  4.  * Evaluates the given string as if it was a template
  5.  *
  6.  * Although this plugin is kind of optimized and will
  7.  * not recompile your string each time, it is still not
  8.  * a good practice to use it. If you want to have templates
  9.  * stored in a database or something you should probably use
  10.  * the Dwoo_Template_String class or make another class that
  11.  * extends it
  12.  * <pre>
  13.  *  * var : the string to use as a template
  14.  *  * assign : if set, the output of the template will be saved in this variable instead of being output
  15.  * </pre>
  16.  * This software is provided 'as-is', without any express or implied warranty.
  17.  * In no event will the authors be held liable for any damages arising from the use of this software.
  18.  *
  19.  * @author     Jordi Boggiano <j.boggiano@seld.be>
  20.  * @copyright  Copyright (c) 2008, Jordi Boggiano
  21.  * @license    http://dwoo.org/LICENSE   Modified BSD License
  22.  * @link       http://dwoo.org/
  23.  * @version    1.0.0
  24.  * @date       2008-10-23
  25.  * @package    Dwoo
  26.  */
  27. function Dwoo_Plugin_eval(Dwoo $dwoo$var$assign null)
  28. {
  29.     if ($var == ''{
  30.         return;
  31.     }
  32.  
  33.     $tpl new Dwoo_Template_String($var);
  34.     $out $dwoo->get($tpl$dwoo->readVar('_parent'));
  35.  
  36.     if ($assign !== null{
  37.         $dwoo->assignInScope($out$assign);
  38.     else {
  39.         return $out;
  40.     }
  41. }

Documentation generated on Sun, 07 Feb 2010 17:53:42 +0000 by phpDocumentor 1.4.0