[ Index ]
 

Code source de Horde 3.1.3

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

title

Body

[fermer]

/lib/VFS/ISOWriter/ -> RealOutputStrategy.php (source)

   1  <?php
   2  
   3  /**
   4   * Encapsulate strategies for ability to write output to real file.
   5   *
   6   * $Horde: framework/VFS_ISOWriter/ISOWriter/RealOutputStrategy.php,v 1.1.8.7 2006/01/01 21:28:43 jan Exp $
   7   *
   8   * Copyright 2004-2006 Cronosys, LLC <http://www.cronosys.com/>
   9   *
  10   * See the enclosed file COPYING for license information (LGPL). If you
  11   * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  12   *
  13   * @author  Jason M. Felice <jfelice@cronosys.com>
  14   * @package VFS_ISO
  15   * @since   Horde 3.0
  16   */
  17  class VFS_ISOWriter_RealOutputStrategy {
  18  
  19      /**
  20       * The VFS to which we will write the file.
  21       *
  22       * @var VFS
  23       */
  24      var $_targetVfs;
  25  
  26      /**
  27       * Where to store the file in the VFS.
  28       *
  29       * @var string
  30       */
  31      var $_targetFile;
  32  
  33      /**
  34       * Constructor
  35       *
  36       * @param object &$targetVfs        The VFS to which we will write the
  37       *                                  file.
  38       * @param string $targetFile        The path and name of file to write.
  39       */
  40      function VFS_ISOWriter_RealOutputStrategy(&$targetVfs, $targetFile)
  41      {
  42          $this->_targetVfs = &$targetVfs;
  43          $this->_targetFile = $targetFile;
  44      }
  45  
  46      /**
  47       * Select and create a concrete strategy for using a real output file.
  48       *
  49       * @param object &$targetVfs        The VFS to which we will write the
  50       *                                  result.
  51       * @param string $targetFile        The path and filename of the target
  52       *                                  file within the VFS.
  53       * @return object   A concrete output strategy object or PEAR_Error on
  54       *                  failure.
  55       */
  56      function &factory(&$targetVfs, $targetFile)
  57      {
  58          if (strtolower(get_class($targetVfs)) == 'vfs_file') {
  59              $method = 'direct';
  60          } else {
  61              $method = 'copy';
  62          }
  63  
  64          include_once dirname(__FILE__) . '/RealOutputStrategy/' . $method .
  65                        '.php';
  66          $class = 'VFS_ISOWriter_RealOutputStrategy_' . $method;
  67          if (!class_exists($class)) {
  68              return PEAR::raiseError(sprintf(_("Could not load strategy \"%s\"."),
  69                                              $method));
  70          }
  71  
  72          $strategy = &new $class($targetVfs, $targetFile);
  73          return $strategy;
  74      }
  75  
  76      /**
  77       * Get a real filesystem filename we can write to.
  78       *
  79       * @abstract
  80       * @return string   The filename or PEAR_Error on failure.
  81       */
  82      function getRealFilename()
  83      {
  84          return PEAR::raiseError(_("Not implemented."));
  85      }
  86  
  87      /**
  88       * Indicate that we're done writing to the real file.
  89       *
  90       * @abstract
  91       * @return mixed    Null or PEAR_Error on failure.
  92       */
  93      function finished()
  94      {
  95          return PEAR::raiseError(_("Not implemented."));
  96      }
  97  
  98  }
  99  


Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7