[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/kernel/common/ -> ezkerneloperator.php (source)

   1  <?php
   2  //
   3  // Definition of eZKernelOperator class
   4  //
   5  // Created on: <11-Aug-2003 14:04:59 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  /*! \file ezkerneloperator.php
  30  */
  31  
  32  /*!
  33    \class eZKerneloperator ezkerneloperator.php
  34    \brief The class eZKerneloperator does handles eZ publish preferences
  35  
  36  */
  37  class eZKernelOperator
  38  {
  39      /*!
  40       Initializes the object with the name $name
  41      */
  42      function eZKernelOperator( $name = "ezpreference" )
  43      {
  44          $this->Operators = array( $name );
  45      }
  46  
  47      /*!
  48        Returns the template operators.
  49      */
  50      function &operatorList()
  51      {
  52          return $this->Operators;
  53      }
  54  
  55      /*!
  56       \return true to tell the template engine that the parameter list exists per operator type.
  57      */
  58      function namedParameterPerOperator()
  59      {
  60          return true;
  61      }
  62  
  63      /*!
  64       See eZTemplateOperator::namedParameterList()
  65      */
  66      function namedParameterList()
  67      {
  68          return array( 'ezpreference' => array( 'name' => array( 'type' => 'string',
  69                                                                  'required' => true,
  70                                                                  'default' => false ) ) );
  71      }
  72  
  73      function operatorTemplateHints()
  74      {
  75          return array( 'ezpreference' => array( 'input' => false,
  76                                                 'output' => true,
  77                                                 'parameters' => 1,
  78                                                 'element-transformation' => true,
  79                                                 'transform-parameters' => true,
  80                                                 'input-as-parameter' => false,
  81                                                 'element-transformation-func' => 'preferencesTransformation') );
  82      }
  83  
  84      function preferencesTransformation( $operatorName, &$node, &$tpl, &$resourceData,
  85                                          &$element, &$lastElement, &$elementList, &$elementTree, &$parameters )
  86      {
  87          if ( count( $parameters[0] ) == 0 )
  88              return false;
  89          $values = array();
  90          if ( eZTemplateNodeTool::isStaticElement( $parameters[0] ) )
  91          {
  92              $name = eZTemplateNodeTool::elementStaticValue( $parameters[0] );
  93              $nameText = eZPHPCreator::variableText( $name, 0, 0, false );
  94          }
  95          else
  96          {
  97              $nameText = '%1%';
  98              $values[] = $parameters[0];
  99          }
 100          return array( eZTemplateNodeTool::createCodePieceElement( "include_once ( 'kernel/classes/ezpreferences.php' );\n" .
 101                                                                    "%output% = eZPreferences::value( $nameText );\n",
 102                                                                    $values ) );
 103      }
 104  
 105      function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters )
 106      {
 107          switch ( $operatorName )
 108          {
 109              case 'ezpreference':
 110              {
 111                  include_once ( 'kernel/classes/ezpreferences.php' );
 112                  $name = $namedParameters['name'];
 113                  $value = eZPreferences::value( $name );
 114                  $operatorValue = $value;
 115              }break;
 116  
 117              default:
 118              {
 119                  eZDebug::writeError( "Unknown kernel operator: $operatorName" );
 120              }break;
 121          }
 122      }
 123      var $Operators;
 124  }
 125  ?>


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