Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: patTemplate

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /pattemplate/patTemplate/Modifier/Expression.php

Documentation is available at Expression.php

  1. <?PHP
  2. /**
  3.  * patTemplate modfifier Expression
  4.  *
  5.  * $Id: Expression.php 330 2004-11-30 20:46:36Z schst $
  6.  *
  7.  * @package        patTemplate
  8.  * @subpackage    Modifiers
  9.  * @author        Stephan Schmidt <[email protected]>
  10.  */
  11.  
  12. // Check to ensure this file is within the rest of the framework
  13. defined('JPATH_BASE'or die();
  14.  
  15. /**
  16.  * patTemplate modfifier Expression
  17.  *
  18.  * Evaluates an expression and returns one of
  19.  * the defined values for true and false.
  20.  *
  21.  * Possible attributes are:
  22.  * - expression (string)
  23.  * - true (string)
  24.  * - false (string)
  25.  *
  26.  * @package        patTemplate
  27.  * @subpackage    Modifiers
  28.  * @author        Stephan Schmidt <[email protected]>
  29.  * @link        http://www.php.net/manual/en/function.wordwrap.php
  30.  */
  31. {
  32.    /**
  33.     * modify the value
  34.     *
  35.     * @access    public
  36.     * @param    string        value
  37.     * @return    string        modified value
  38.     */
  39.     function modify$value$params array() )
  40.     {
  41.         /*
  42.          * true and false
  43.          */
  44.         if!isset$params['true') )
  45.             $params['true']    =    'true';
  46.         if!isset$params['false') )
  47.             $params['false']=    'false';
  48.  
  49.         /*
  50.          * replace the value in the expression
  51.          */
  52.         $params['expression'str_replace'$self'"'$value'"$params['expression');
  53.  
  54.         @eval'$result = '.$params['expression'].';' );
  55.  
  56.         if ($result === true{
  57.             return str_replace'$self'$value$params['true');
  58.         }
  59.         return str_replace'$self'$value$params['false');
  60.     }
  61. }
  62. ?>

Documentation generated on Mon, 05 Mar 2007 20:58:00 +0000 by phpDocumentor 1.3.1