function authorize_get_filetransfer in Drupal 7
Gets a FileTransfer class for a specific transfer method and settings.
Parameters
$backend: The FileTransfer backend to get the class for.
$settings: Array of settings for the FileTransfer.
Return value
An instantiated FileTransfer object for the requested method and settings, or FALSE if there was an error finding or instantiating it.
3 calls to authorize_get_filetransfer()
- authorize_filetransfer_form_submit in includes/
authorize.inc - Form submission handler for authorize_filetransfer_form().
- authorize_filetransfer_form_validate in includes/
authorize.inc - Form validation handler for authorize_filetransfer_form().
- _authorize_filetransfer_connection_settings in includes/
authorize.inc - Generates the Form API array for a given connection backend's settings.
File
- includes/
authorize.inc, line 319 - 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;
}
if (class_exists($backend_info['class'])) {
// PHP 5.2 doesn't support $class::factory() syntax, so we have to
// use call_user_func_array() until we can require PHP 5.3.
$filetransfer = call_user_func_array(array(
$backend_info['class'],
'factory',
), array(
DRUPAL_ROOT,
$settings,
));
}
}
return $filetransfer;
}