[ 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/ -> eztemplatefunctionelement.php (source)

   1  <?php
   2  //
   3  // Definition of eZTemplateFunctionElement class
   4  //
   5  // Created on: <01-Mar-2002 13:49:30 amos>
   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  /*! \defgroup eZTemplateFunctions Template functions
  30      \ingroup eZTemplate */
  31  
  32  /*!
  33    \class eZTemplateFunctionElement eztemplatefunctionelement.php
  34    \ingroup eZTemplateElements
  35    \brief Represents a function element in the template tree.
  36  
  37    This class represents a function with it's parameters.
  38    It also contains child elements if the function was registered as having
  39    children.
  40  
  41  */
  42  
  43  class eZTemplateFunctionElement
  44  {
  45      /*!
  46       Initializes the function with a name and parameter array.
  47      */
  48      function eZTemplateFunctionElement( $name, $params, $children = array() )
  49      {
  50          $this->Name = $name;
  51          $this->Params =& $params;
  52          $this->Children = $children;
  53      }
  54  
  55      function setResourceRelation( $resource )
  56      {
  57          $this->Resource = $resource;
  58      }
  59  
  60      function setTemplateNameRelation( $templateName )
  61      {
  62          $this->TemplateName = $templateName;
  63      }
  64  
  65      function resourceRelation()
  66      {
  67          return $this->Resource;
  68      }
  69  
  70      function templateNameRelation()
  71      {
  72          return $this->TemplateName;
  73      }
  74  
  75      /*!
  76       Returns the name of the function.
  77      */
  78      function name()
  79      {
  80          return $this->Name;
  81      }
  82  
  83      function serializeData()
  84      {
  85          return array( 'class_name' => 'eZTemplateFunctionElement',
  86                        'parameters' => array( 'name', 'parameters', 'children' ),
  87                        'variables' => array( 'name' => 'Name',
  88                                              'parameters' => 'Params',
  89                                              'children' => 'Children' ) );
  90      }
  91  
  92      /*!
  93       Tries to run the function with the children, the actual function execution
  94       is done by the template class.
  95      */
  96      function process( &$tpl, &$text, $nspace, $current_nspace )
  97      {
  98          $tmp = $tpl->doFunction( $this->Name, $this, $nspace, $current_nspace );
  99          if ( $tmp === false )
 100              return;
 101          $tpl->appendElement( $text, $tmp, $nspace, $current_nspace );
 102      }
 103  
 104      /*!
 105       Returns a reference to the parameter list.
 106      */
 107      function &parameters()
 108      {
 109          return $this->Params;
 110      }
 111  
 112      /*!
 113       Returns a reference to the children.
 114      */
 115      function &children()
 116      {
 117          return $this->Children;
 118      }
 119  
 120      /*!
 121       Appends the child element $node to the child list.
 122      */
 123      function appendChild( &$node )
 124      {
 125          $this->Children[] =& $node;
 126      }
 127  
 128      /// The name of the function
 129      var $Name;
 130      /// The parameter list
 131      var $Params;
 132      /// The child elements
 133      var $Children = array();
 134  
 135      var $Resource;
 136      var $TemplateName;
 137  }
 138  
 139  ?>


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