summaryrefslogtreecommitdiff
path: root/includes/common.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/common.inc')
-rw-r--r--includes/common.inc36
1 files changed, 36 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 972fc2319..938fcab03 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -7679,3 +7679,39 @@ function drupal_get_updaters() {
}
return $updaters;
}
+
+/**
+ * Drupal FileTransfer registry.
+ *
+ * @return
+ * Returns the Drupal FileTransfer class registry.
+ *
+ * @see FileTransfer
+ * @see hook_filetransfer_info()
+ * @see hook_filetransfer_info_alter()
+ */
+function drupal_get_filetransfer_info() {
+ $info = &drupal_static(__FUNCTION__);
+ if (!isset($info)) {
+ // Since we have to manually set the 'file path' default for each
+ // module separately, we can't use module_invoke_all().
+ $info = array();
+ foreach (module_implements('filetransfer_info') as $module) {
+ $function = $module . '_filetransfer_info';
+ if (function_exists($function)) {
+ $result = $function();
+ if (isset($result) && is_array($result)) {
+ foreach ($result as &$values) {
+ if (empty($values['file path'])) {
+ $values['file path'] = drupal_get_path('module', $module);
+ }
+ }
+ $info = array_merge_recursive($info, $result);
+ }
+ }
+ }
+ drupal_alter('filetransfer_info', $info);
+ uasort($info, 'drupal_sort_weight');
+ }
+ return $info;
+}