1 authorize.inc authorize_get_filetransfer($backend, $settings = array())

Gets a FileTransfer class for a specific transfer method and settings.

Parameters

string $backend: The name FileTransfer backend.

array $settings: Array of settings for the FileTransfer.

Return value

FileTransfer: An instantiated FileTransfer object for the requested method and settings, or FALSE if there was an error finding or instantiating it.

File

core/includes/authorize.inc, line 313
Helper functions and form handlers used for the authorize.php script.

Code

function authorize_get_filetransfer($backend, $settings = array()) {
  $filetransfer = FALSE;
  if (!empty($_SESSION['authorize_filetransfer_info'][$backend])) {
    $backend_info = $_SESSION['authorize_filetransfer_info'][$backend];
    if (!empty($backend_info['file'])) {
      $file = $backend_info['file path'] . '/' . $backend_info['file'];
      require_once $file;
    }
    /* @var FileTransfer $class */
    $class = $backend_info['class'];
    if (class_exists($class)) {
      $filetransfer = $class::factory(BACKDROP_ROOT, $settings);
    }
  }
  return $filetransfer;
}