[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/kernel/classes/datatypes/ezxmltext/ -> ezxmlinputhandler.php (source)

   1  <?php
   2  //
   3  // Definition of eZXMLInputHandler class
   4  //
   5  // Created on: <06-Nov-2002 15:10:02 wy>
   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 ezxmlinputhandler.php
  30  */
  31  
  32  /*!
  33    \class eZXMLInputHandler ezxmlinputhandler.php
  34    \ingroup eZDatatype
  35    \brief The class eZXMLInputHandler does
  36  
  37  */
  38  
  39  include_once ( "lib/ezxml/classes/ezxml.php" );
  40  include_once ( "lib/ezxml/classes/ezdomnode.php" );
  41  include_once ( "lib/ezxml/classes/ezdomdocument.php" );
  42  include_once ( 'kernel/classes/datatypes/ezurl/ezurl.php' );
  43  
  44  class eZXMLInputHandler
  45  {
  46      /*!
  47       Constructor
  48      */
  49      function eZXMLInputHandler(  &$xmlData, $aliasedType, $contentObjectAttribute )
  50      {
  51          $this->XMLData =& $xmlData;
  52          $this->ContentObjectAttribute = $contentObjectAttribute;
  53          $this->AliasedType = $aliasedType;
  54          $this->AliasedHandler = null;
  55      }
  56  
  57      /*!
  58       \return an array with attribute names.
  59      */
  60      function attributes()
  61      {
  62          return array( 'input_xml',
  63                        'aliased_type',
  64                        'aliased_handler',
  65                        'edit_template_name',
  66                        'information_template_name' );
  67      }
  68  
  69      /*!
  70       \return true if the attribute \a $name exists.
  71      */
  72      function hasAttribute( $name )
  73      {
  74          return in_array( $name, $this->attributes() );
  75      }
  76  
  77      /*!
  78       \return the value of the attribute \a $name if it exists, if not returns \c null.
  79      */
  80      function &attribute( $name )
  81      {
  82          switch ( $name )
  83          {
  84              case 'input_xml':
  85              {
  86                  $retValue =& $this->inputXML();
  87              } break;
  88              case 'edit_template_name':
  89              {
  90                  $retValue =& $this->editTemplateName();
  91              }break;
  92              case 'information_template_name':
  93              {
  94                  $retValue =& $this->informationTemplateName();
  95              }break;
  96              case 'aliased_type':
  97              {
  98                  return $this->AliasedType;
  99              }break;
 100              case 'aliased_handler':
 101              {
 102                  if ( $this->AliasedType !== false and
 103                       $this->AliasedHandler === null )
 104                  {
 105                      $this->AliasedHandler =& eZXMLText::inputHandler( $this->XMLData,
 106                                                                        $this->AliasedType,
 107                                                                        false );
 108                  }
 109                  return $this->AliasedHandler;
 110              }break;
 111              default:
 112              {
 113                  eZDebug::writeError( "Attribute '$name' does not exist", 'eZXMLInputHandler::attribute' );
 114                  $retValue = null;
 115              }break;
 116          }
 117          return $retValue;
 118      }
 119  
 120      /*!
 121       \return the template name for this input handler, includes the edit suffix if any.
 122      */
 123      function &editTemplateName()
 124      {
 125          $name = 'ezxmltext';
 126          $suffix =& $this->editTemplateSuffix( $this->ContentObjectAttribute );
 127          if ( $suffix !== false )
 128              $name .= '_' . $suffix;
 129          return $name;
 130      }
 131  
 132      /*!
 133       \return the template name for this input handler, includes the information suffix if any.
 134      */
 135      function &informationTemplateName()
 136      {
 137          $name = 'ezxmltext';
 138          $suffix =& $this->informationTemplateSuffix( $this->ContentObjectAttribute );
 139          if ( $suffix !== false )
 140              $name .= '_' . $suffix;
 141          return $name;
 142      }
 143  
 144      /*!
 145       \pure
 146       Handles custom actions for input handler.
 147       \note Default does nothing, reimplement to check actions.
 148      */
 149      function customObjectAttributeHTTPAction( $http, $action, &$contentObjectAttribute )
 150      {
 151      }
 152  
 153      /*!
 154       \virtual
 155       \return true if the input handler is considered valid, if not the handler will not be used.
 156       \note Default returns true
 157      */
 158      function isValid()
 159      {
 160          return true;
 161      }
 162  
 163      /*!
 164       \pure
 165       \return the suffix for the attribute template, if false it is ignored.
 166      */
 167      function &editTemplateSuffix( &$contentobjectAttribute )
 168      {
 169          $editSuffix = false;
 170          return $editSuffix;
 171      }
 172  
 173      /*!
 174       \pure
 175       \return the suffix for the attribute template, if false it is ignored.
 176      */
 177      function &informationTemplateSuffix( &$contentobjectAttribute )
 178      {
 179          $templateSuffix = false;
 180          return $templateSuffix;
 181      }
 182  
 183      /*!
 184       \return the xml data as text.
 185      */
 186      function xmlData()
 187      {
 188          return $this->XMLData;
 189      }
 190  
 191      /*!
 192       \pure
 193       Validates user input and returns whether it can be used or not.
 194      */
 195      function &validateInput( &$http, $base, &$contentObjectAttribute )
 196      {
 197          $retValue = EZ_INPUT_VALIDATOR_STATE_INVALID;
 198          return $retValue;
 199      }
 200  
 201      /*!
 202       \pure
 203       Converts text input \a $text into an XML structure and returns it.
 204       \return an array where index 0 is the xml structure and index 1 is a message.
 205      */
 206      function &convertInput( &$text )
 207      {
 208          $retValue = null;
 209          return $retValue;
 210      }
 211  
 212      /*!
 213       \pure
 214       Returns the text representation of the XML structure, implement this to turn
 215       XML back into user input.
 216      */
 217      function &inputXML()
 218      {
 219          $retValue = null;
 220          return $retValue;
 221      }
 222  
 223      /// \privatesection
 224      /// Contains the XML data as text
 225      var $XMLData;
 226      var $AliasedType;
 227      var $AliasedHandler;
 228      var $ContentObjectAttribute;
 229  }
 230  
 231  ?>


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