You are here

function swftools_get_filter_alias in SWF Tools 6.3

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

Implements a hook that extends the parameters that can be passed to the filter so that myvar="value" can be mapped to flashvars, etc.

1 call to swftools_get_filter_alias()
_swftools_filter_process_text in ./swftools.module
Processes text obtained from the input filter.

File

./swftools.module, line 1149
The primary component of SWF Tools that enables comprehensive media handling.

Code

function swftools_get_filter_alias($var, $player = FALSE) {
  static $general_mapping = array();
  static $player_mapping = array();
  if (!count($general_mapping)) {

    // Build up the mapping arrays.
    $general_mapping = array(
      'action' => 'methods',
      'embed' => 'methods',
      'width' => 'params',
      'height' => 'params',
      'swliveconnect' => 'params',
      'play' => 'params',
      'loop' => 'params',
      'menu' => 'params',
      'quality' => 'params',
      'scale' => 'params',
      'align' => 'params',
      'salign' => 'params',
      'wmode' => 'params',
      'bgcolor' => 'params',
      'base' => 'params',
      'version' => 'params',
      'allowfullscreen' => 'params',
      'allowscriptaccess' => 'params',
    );
    if (!count($player_mapping)) {
      $player_mapping = module_invoke_all('swftools_variable_mapping');
    }
    $combined = array();
    if (count($player_mapping)) {
      foreach ($player_mapping as $mapping) {
        $combined = array_merge($combined, $mapping);
      }
      $general_mapping = array_merge($combined, $general_mapping);
    }
  }

  // Return the parent of the variable.
  if ($player && isset($player_mapping[$player][$var])) {
    return $player_mapping[$player][$var];
  }
  else {
    return isset($general_mapping[$var]) ? $general_mapping[$var] : FALSE;
  }
}