2
0

Transfer.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_File_Transfer
  17. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. * @version $Id: $
  20. */
  21. /**
  22. * Base class for all protocols supporting file transfers
  23. *
  24. * @category Zend
  25. * @package Zend_File_Transfer
  26. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  27. * @license http://framework.zend.com/license/new-bsd New BSD License
  28. */
  29. class Zend_File_Transfer
  30. {
  31. /**
  32. * Creates a file processing handler
  33. *
  34. * @param string $protocol Protocol to use
  35. */
  36. public function __construct($protocol = null)
  37. {
  38. require_once 'Zend/File/Transfer/Exception.php';
  39. throw new Zend_File_Transfer_Exception('Implementation in progress');
  40. switch (strtoupper($protocol)) {
  41. default:
  42. $adapter = 'Zend_File_Transfer_Adapter_Http';
  43. break;
  44. }
  45. if (!class_exists($adapter)) {
  46. require_once 'Zend/Loader.php';
  47. Zend_Loader::loadClass($adapter);
  48. }
  49. $this->_adapter = new $adapter();
  50. if (!$this->_adapter instanceof Zend_File_Transfer_Adapter) {
  51. require_once 'Zend/File/Transfer/Exception.php';
  52. throw new Zend_File_Transfer_Exception("Adapter " . $adapter . " does not extend Zend_File_Transfer_Adapter'");
  53. }
  54. return $this->_adapter;
  55. }
  56. }