You are here

function _swftools_get_flashvars_string in SWF Tools 5

Same name and namespace in other branches
  1. 6 swftools.module \_swftools_get_flashvars_string()
  2. 6.2 swftools.module \_swftools_get_flashvars_string()

"flashvars" is a parameter like height and width, which are passed into the flash player as a=1&b=2&...

1 call to _swftools_get_flashvars_string()
swf in ./swftools.module
Return output, which might be embed markup, or pre-flash markup that includes the appropriate jQuery added to the <head>

File

./swftools.module, line 696

Code

function _swftools_get_flashvars_string(&$flashvars) {
  foreach ($flashvars as $var => $value) {
    $flashvars[$var] = str_replace(array(
      '&',
      '=',
      '?',
    ), array(
      '%26',
      '%3D',
      '%3F',
    ), $value);
  }
  $encoded = drupal_query_string_encode($flashvars);

  // '#' seems to encode as %2523, reverse this, using a more robust hex prefix..
  $encoded = str_replace('%2523', '0x', $encoded);

  // Fix encoding of :// as per #181998#comment-882293
  $encoded = str_replace('%3A', ':', $encoded);
  $encoded = str_replace('%252F', '/', $encoded);
  return $encoded;
}