function flash_get_macros in Flash Node 5
Return all flash macros as an array for passing to flash_content
1 call to flash_get_macros()
- flash_filter in ./
flash.module - Implementation of hook_filter()
File
- ./
flash.module, line 733
Code
function flash_get_macros($text) {
$m = array();
preg_match_all('/ \\[ ([^\\[\\]]+)* \\] /x', $text, $matches);
$tag_match = (array) array_unique($matches[1]);
// Don't process duplicates.
foreach ($tag_match as $macro) {
$current_macro = '[' . $macro . ']';
$param = array_map('trim', explode('|', $macro));
// The first macro param is assumed to be the function name.
$func_name = array_shift($param);
// if flash macro found, extra other settings
if ($func_name == 'flash') {
$vars = array();
foreach ($param as $p) {
$pos = strpos($p, '=');
$varname = substr($p, 0, $pos);
$varvalue = substr($p, $pos + 1);
$vars[$varname] = $varvalue;
}
$m[$current_macro] = $vars;
}
}
return $m;
}