You are here

function _backup_migrate_array_to_ini in Backup and Migrate 7.3

Same name and namespace in other branches
  1. 8.2 backup_migrate.module \_backup_migrate_array_to_ini()
  2. 8.3 backup_migrate.module \_backup_migrate_array_to_ini()
  3. 6.3 backup_migrate.module \_backup_migrate_array_to_ini()
  4. 7.2 backup_migrate.module \_backup_migrate_array_to_ini()

Converts an associated array to an ini format string.

1 call to _backup_migrate_array_to_ini()
backup_migrate_destination::create_info_file in includes/destinations.inc
Create an ini file and write the meta data.

File

./backup_migrate.module, line 2028
Backup and restore databases for Drupal.

Code

function _backup_migrate_array_to_ini($data, $prefix = '') {
  $content = '';
  foreach ($data as $key => $val) {
    if ($prefix) {
      $key = $prefix . '[' . $key . ']';
    }
    if (is_array($val)) {
      $content .= _backup_migrate_array_to_ini($val, $key);
    }
    else {
      $content .= $key . ' = "' . $val . "\"\n";
    }
  }
  return $content;
}