You are here

function swftools_update_6002 in SWF Tools 6.3

Updates the wijering4 variable to reflect the new storage format.

File

./swftools.install, line 103
Install, update and uninstall functions for the SWF Tools module.

Code

function swftools_update_6002() {

  // Initialise a results array
  $ret = array();

  // Get current values
  $defaults = variable_get('swftools_wijering4_mediaplayer', array());

  // If there are some values then update them
  if ($defaults) {

    // Initialise array for remapped defaults
    $new_defaults = array();

    // Process defaults to new format
    $new_defaults['basic']['playlistsize'] = $defaults['playlistsize'];
    $new_defaults['basic']['height'] = $defaults['height'];
    $new_defaults['basic']['width'] = $defaults['width'];
    $new_defaults['color']['frontcolor'] = $defaults['frontcolor'];
    $new_defaults['color']['backcolor'] = $defaults['backcolor'];
    $new_defaults['color']['lightcolor'] = $defaults['lightcolor'];
    $new_defaults['color']['screencolor'] = $defaults['screencolor'];
    $new_defaults['appearance']['skin'] = $defaults['skin'];
    $new_defaults['appearance']['logo'] = $defaults['logo'];
    $new_defaults['appearance']['overstretch'] = $defaults['overstretch'];
    $new_defaults['appearance']['controlbar'] = $defaults['controlbar'];
    $new_defaults['appearance']['playlist'] = $defaults['playlist'];
    $new_defaults['appearance']['plugins'] = '';
    $new_defaults['playback']['autostart'] = $defaults['autostart'];
    $new_defaults['playback']['bufferlength'] = $defaults['bufferlength'];
    $new_defaults['playback']['displayclick'] = $defaults['displayclick'];
    $new_defaults['playback']['repeat'] = $defaults['repeat'];
    $new_defaults['playback']['shuffle'] = $defaults['shuffle'];
    $new_defaults['playback']['volume'] = $defaults['volume'];
    $new_defaults['interaction']['captions'] = $defaults['captions'];
    $new_defaults['interaction']['link'] = $defaults['link'];
    $new_defaults['interaction']['linktarget'] = $defaults['linktarget'];
    $new_defaults['interaction']['streamscript'] = $defaults['streamscript'];
    $new_defaults['interaction']['type'] = $defaults['type'];
    $new_defaults['interaction']['fullscreen'] = $defaults['fullscreen'];
    $new_defaults['accessibility']['accessible'] = $defaults['accessible'];
    $new_defaults['accessibility']['accessible_visible'] = $defaults['accessible_visible'];

    // Store new defaults
    variable_set('swftools_wijering4_mediaplayer', $new_defaults);

    // Set return message
    $ret = array(
      array(
        'success' => TRUE,
        'query' => 'JW4 defaults remapped.',
      ),
    );
  }

  // Return results
  return $ret;
}