name; $mask = "/(\{$name(\s+[^\}]*)?\})/"; $bits = preg_split($mask, $input, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); $output = ""; while($bit = array_shift($bits)) { $matches = array(); if (preg_match($mask, $bit, $matches)) { if ($matches[2]) { $argstr = array_shift($bits); } else { $argstr = ""; } $argbits = preg_split("/\s/", trim($argstr)); $args = array(); foreach($argbits as $argbit) { if (preg_match('/([a-zA-Z]+)=([\'"])(.*)\2$/', $argbit, $matches)) { $args[$matches[1]] = $matches[3]; } } $output .= $this->show($args); } else { $output .= $bit; } } return $output; } /** Show an instance of the plugin. This is called by filter() every time * a tag representing the plugin is found. */ function show() { return ''; } } ?>