You are here

function backup_migrate_filters_invoke_all in Backup and Migrate 7.3

Same name and namespace in other branches
  1. 8.2 includes/filters.inc \backup_migrate_filters_invoke_all()
  2. 8.3 includes/filters.inc \backup_migrate_filters_invoke_all()
  3. 6.3 includes/filters.inc \backup_migrate_filters_invoke_all()
  4. 6.2 includes/filters.inc \backup_migrate_filters_invoke_all()
  5. 7.2 includes/filters.inc \backup_migrate_filters_invoke_all()

Invokes the given method on all of the available filters.

20 calls to backup_migrate_filters_invoke_all()
backup_migrate_backup_fail in ./backup_migrate.module
Clean up when a backup operation fails.
backup_migrate_backup_migrate_destinations in includes/destinations.inc
Implements hook_backup_migrate_destinations().
backup_migrate_backup_migrate_locations in includes/locations.inc
Implements hook_backup_migrate_locations().
backup_migrate_backup_migrate_sources in includes/sources.inc
Implements hook_backup_migrate_sources().
backup_migrate_backup_succeed in ./backup_migrate.module
Clean up when a backup operation succeeds.

... See full list

File

includes/filters.inc, line 66
All of the filter handling code needed for Backup and Migrate.

Code

function backup_migrate_filters_invoke_all() {
  $args = func_get_args();
  $op = array_shift($args);
  $out = array();
  $filters = backup_migrate_get_filters($op);
  foreach ($filters as $filter) {
    if (method_exists($filter, $op)) {

      /* call_user_func_array() ignores the function signature, so we cannot
       * use it to pass references. (Call-time pass-by-reference is deprecated
       * in PHP5.3.) Work around it, since we have unknown function signatures.
       */
      switch (count($args)) {
        case 1:
          $ret = $filter
            ->{$op}($args[0]);
          break;
        case 2:
          $ret = $filter
            ->{$op}($args[0], $args[1]);
          break;
        default:

          // This assumes that no functions with more than 2 arguments expect a
          // reference as argument. If so, add another 'case block'.
          $ret = call_user_func_array(array(
            $filter,
            $op,
          ), $args);
      }
      $out = array_merge_recursive($out, (array) $ret);
    }
  }
  return $out;
}