[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/lib/ezfile/classes/ -> ezarchivehandler.php (source)

   1  <?php
   2  //
   3  // Definition of eZArchiveHandler class
   4  //
   5  // Created on: <14-Aug-2003 11:25:33 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  /*! \file ezarchivehandler.php
  30  */
  31  
  32  /*!
  33    \class eZArchiveHandler ezarchivehandler.php
  34    \brief General handling of file archives
  35  
  36    This class handles the abstraction of handling various
  37    kinds of archive formats. The actual handling of the
  38    formats is sent of the specific archive handlers.
  39  
  40  \code
  41  $handler =& eZArchiveHandler::instance( 'tar', 'ezpublish.tar' );
  42  \endcode
  43  
  44  */
  45  
  46  include_once ( 'lib/ezfile/classes/ezfilehandler.php' );
  47  
  48  class eZArchiveHandler
  49  {
  50      /*!
  51       Constructor
  52      */
  53      function eZArchiveHandler( &$fileHandler, $archiveFilename = false )
  54      {
  55          $this->FileHandler =& $fileHandler;
  56          $this->ArchiveFilename = $archiveFilename;
  57      }
  58  
  59      function setArchiveFileName( $filename )
  60      {
  61          $this->ArchiveFilename = $filename;
  62      }
  63  
  64      function fileIsOpen()
  65      {
  66          return $this->FileHandler->isOpen();
  67      }
  68  
  69      function fileIsBinaryMode()
  70      {
  71          return $this->FileHandler->isBinaryMode();
  72      }
  73  
  74      function fileName()
  75      {
  76          return $this->FileHandler->filename();
  77      }
  78  
  79      function fileMode()
  80      {
  81          return $this->FileHandler->mode();
  82      }
  83  
  84      function fileOpen( $archiveFilename = false, $mode = false )
  85      {
  86          if ( !$archiveFilename )
  87              $archiveFilename = $this->ArchiveFilename;
  88          $result = $this->FileHandler->open( $archiveFilename, $mode );
  89          if ( $result )
  90              $this->ArchiveFilename = $archiveFilename;
  91          return $result;
  92      }
  93  
  94      function fileClose()
  95      {
  96          return $this->FileHandler->close();
  97      }
  98  
  99      function fileRead( $length = false )
 100      {
 101          return $this->FileHandler->read( $length );
 102      }
 103  
 104      function fileWrite( $data, $length = false )
 105      {
 106          return $this->FileHandler->write( $data, $length );
 107      }
 108  
 109      function fileFlush()
 110      {
 111          return $this->FileHandler->flush();
 112      }
 113  
 114      function fileSeek( $offset, $whence = SEEK_SET )
 115      {
 116          return $this->FileHandler->seek( $offset, $whence );
 117      }
 118  
 119      function fileRewind()
 120      {
 121          return $this->FileHandler->rewind();
 122      }
 123  
 124      function fileTell()
 125      {
 126          return $this->FileHandler->tell();
 127      }
 128  
 129      function fileEOF()
 130      {
 131          return $this->FileHandler->eof();
 132      }
 133  
 134      function filePasstrough( $closeFile = true )
 135      {
 136          return $this->FileHandler->passtrough( $closeFile );
 137      }
 138  
 139      function fileError()
 140      {
 141          return $this->FileHandler->error();
 142      }
 143  
 144      function fileErrorString()
 145      {
 146          return $this->FileHandler->errorString();
 147      }
 148  
 149      function fileErrorNumber()
 150      {
 151          return $this->FileHandler->errorNumber();
 152      }
 153  
 154      /*!
 155       Calls the rename() function for the current handler.
 156      */
 157      function fileRename( $destinationFilename, $sourceFilename = true )
 158      {
 159          return $this->FileHandler->rename( $destinationFilename, $sourceFilename );
 160      }
 161  
 162      function fileUnlink( $filename = false )
 163      {
 164          return $this->FileHandler->unlink( $filename );
 165      }
 166  
 167      function fileCopy( $sourceFilename, $destinationFilename )
 168      {
 169          return $this->FileHandler->copy( $sourceFilename, $destinationFilename );
 170      }
 171  
 172      function fileExists( $filename = false )
 173      {
 174          return $this->FileHandler->exists( $filename );
 175      }
 176  
 177      function fileIsDirectory( $filename = false )
 178      {
 179          return $this->FileHandler->isDirectory( $filename );
 180      }
 181  
 182      function fileIsExecutable( $filename = false )
 183      {
 184          return $this->FileHandler->isExecutable( $filename );
 185      }
 186  
 187      function fileIsFile( $filename = false )
 188      {
 189          return $this->FileHandler->isFile( $filename );
 190      }
 191  
 192      function fileIsLink( $filename = false )
 193      {
 194          return $this->FileHandler->isLink( $filename );
 195      }
 196  
 197      function fileIsReadable( $filename = false )
 198      {
 199          return $this->FileHandler->isReadable( $filename );
 200      }
 201  
 202      function fileIsWriteable( $filename = false )
 203      {
 204          return $this->FileHandler->isWriteable( $filename );
 205      }
 206  
 207      function fileStatistics( $filename = false )
 208      {
 209          return $this->FileHandler->statistics( $filename );
 210      }
 211  
 212      /*!
 213       \return the current file handler used for opening the archive file.
 214      */
 215      function fileHandler()
 216      {
 217          return $this->FileHandler;
 218      }
 219  
 220      /*!
 221       \return \c true if the handler is available for use.
 222      */
 223      function isAvailable()
 224      {
 225          return true;
 226      }
 227  
 228      /*!
 229       Detaches the current file handler and instanties a new duplicate as current.
 230       \return the old file handler.
 231      */
 232      function &detachHandler()
 233      {
 234          $oldHandler =& $this->FileHandler;
 235          $this->FileHandler =& $oldHandler->duplicate();
 236          return $oldHandler;
 237      }
 238  
 239      /*!
 240       Returns the handler for the identifier \a $identifier.
 241       The parameter \a $fileHandler must contain the filehandler object.
 242       \return \c false if the handler could not be created.
 243      */
 244      function &instance( $identifier, $fileHandlerType = false, $arhiveFilename = false )
 245      {
 246          include_once ( 'lib/ezutils/classes/ezini.php' );
 247          $ini =& eZINI::instance( 'file.ini' );
 248          $handlers = $ini->variable( 'ArchiveSettings', 'Handlers' );
 249          $instance = false;
 250          if ( isset( $handlers[$identifier] ) )
 251          {
 252              $className = $handlers[$identifier];
 253              $includeFile = 'lib/ezfile/classes/' . $className . '.php';
 254              include_once( $includeFile );
 255              $fileHandler =& eZFileHandler::instance( $fileHandlerType );
 256              $instance = new $className( $fileHandler, $arhiveFilename );
 257              if ( !$instance->isAvailable() )
 258              {
 259                  unset( $instance );
 260                  $instance = false;
 261              }
 262          }
 263          return $instance;
 264      }
 265  
 266      /// \privatesection
 267      var $FileHandler;
 268  }
 269  
 270  ?>


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