You are here

function swftools_query_string_encode in SWF Tools 6.3

Customised version of drupal_query_string_encode().

drupal_query_string_encode() implodes using &, which means a Flashvars string appears to fail XHTML validation. This version implode using & which will pass XHMTL validation.

http://jonahchanticleer.com/archives.cfm/category/from-red-to-green/page/1

Issue originally raised in #1011402

Parameters

array $query:

array $exclude:

string $parent:

Return value

string

1 call to swftools_query_string_encode()
theme_swftools_direct in includes/swftools.core.inc
Turns an SWF Tools data array in to markup for inclusion on the page, using W3C compliant HTML.

File

includes/swftools.core.inc, line 393
Implements SWF Tools core functions that are common to the main module and the API module.

Code

function swftools_query_string_encode($query, $exclude = array(), $parent = '') {
  $params = array();
  foreach ($query as $key => $value) {
    $key = rawurlencode($key);
    if ($parent) {
      $key = $parent . '[' . $key . ']';
    }
    if (in_array($key, $exclude)) {
      continue;
    }
    if (is_array($value)) {
      $params[] = swftools_query_string_encode($value, $exclude, $key);
    }
    else {
      $params[] = $key . '=' . rawurlencode($value);
    }
  }
  return implode('&', $params);
}