[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/eztemplate/classes/ -> eztemplatenl2broperator.php (source)

   1  <?php
   2  //
   3  // Definition of eZTemplateNl2BrOperator class
   4  //
   5  // Created on: <10-Mar-2003 11:22:29 bf>
   6  //
   7  // SOFTWARE NAME: eZ publish
   8  // SOFTWARE RELEASE: 3.9.0
   9  // BUILD VERSION: 17785
  10  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
  11  // SOFTWARE LICENSE: GNU General Public License v2.0
  12  // NOTICE: >
  13  //   This program is free software; you can redistribute it and/or
  14  //   modify it under the terms of version 2.0  of the GNU General
  15  //   Public License as published by the Free Software Foundation.
  16  //
  17  //   This program is distributed in the hope that it will be useful,
  18  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  19  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20  //   GNU General Public License for more details.
  21  //
  22  //   You should have received a copy of version 2.0 of the GNU General
  23  //   Public License along with this program; if not, write to the Free
  24  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  25  //   MA 02110-1301, USA.
  26  //
  27  //
  28  
  29  /*!
  30    \class eZTemplateNl2BrOperator eztemplatenl2broperator.php
  31    \ingroup eZTemplateOperators
  32  \code
  33  
  34  \endcode
  35  
  36  */
  37  
  38  class eZTemplateNl2BrOperator
  39  {
  40      /*!
  41       Initializes the object with the name $name, default is "nl2br".
  42      */
  43      function eZTemplateNl2BrOperator()
  44      {
  45          $this->Operators = array( 'nl2br' );
  46          $this->Nl2brName = 'nl2br';
  47      }
  48  
  49      /*!
  50       Returns the template operators.
  51      */
  52      function &operatorList()
  53      {
  54          return $this->Operators;
  55      }
  56  
  57      /*!
  58       See eZTemplateOperator::namedParameterList()
  59      */
  60      function namedParameterList()
  61      {
  62          return array( );
  63      }
  64  
  65      function operatorTemplateHints()
  66      {
  67          return array( $this->Nl2brName => array( 'input' => true,
  68                                                   'output' => true,
  69                                                   'parameters' => true,
  70                                                   'element-transformation' => true,
  71                                                   'transform-parameters' => true,
  72                                                   'input-as-parameter' => true,
  73                                                   'element-transformation-func' => 'nl2brTransformation') );
  74      }
  75  
  76      function nl2brTransformation( $operatorName, &$node, &$tpl, &$resourceData,
  77                                    &$element, &$lastElement, &$elementList, &$elementTree, &$parameters )
  78      {
  79          $values = array();
  80          $function = $operatorName;
  81  
  82          if ( ( count( $parameters ) != 1) )
  83          {
  84              return false;
  85          }
  86          $newElements = array();
  87  
  88          $values[] = $parameters[0];
  89          $code = "%output% = nl2br( %1% );\n";
  90  
  91          $newElements[] = eZTemplateNodeTool::createCodePieceElement( $code, $values );
  92          return $newElements;
  93      }
  94  
  95      /*!
  96       Display the variable.
  97      */
  98      function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters )
  99      {
 100          $operatorValue = str_replace( "\n",
 101                                        "<br />",
 102                                        $operatorValue );
 103      }
 104  
 105      /// The array of operators, used for registering operators
 106      var $Operators;
 107  }
 108  
 109  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7