function flashnode_get_macros in Flash Node 6.2
Same name and namespace in other branches
- 5.6 flashnode.module \flashnode_get_macros()
- 5.2 flashnode.module \flashnode_get_macros()
- 5.3 flashnode.module \flashnode_get_macros()
- 6.3 flashnode.module \flashnode_get_macros()
Process a macro string in to an array of keys and values. Pass the array to flashnode_content for processing and rendering in to an HTML string
1 call to flashnode_get_macros()
- flashnode_filter in ./
flashnode.module - Implementation of hook_filter()
File
- ./
flashnode.module, line 708
Code
function flashnode_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 == 'flashnode') {
$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;
}