function _compile_tag($template_tag) { /* Split tag into two three parts: command, command modifiers and the arguments. */ if (!preg_match('~^(?:(' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '|\\/?' . $this->_reg_obj_regexp . '|\\/?' . $this->_func_regexp . ')(' . $this->_mod_regexp . '*)) (?:\\s+(.*))?$ ~xs', $template_tag, $match)) { $this->_syntax_error("unrecognized tag: {$template_tag}", E_USER_ERROR, __FILE__, __LINE__); } $tag_command = $match[1]; $tag_modifier = isset($match[2]) ? $match[2] : null; $tag_args = isset($match[3]) ? $match[3] : null; switch ($tag_command) { case 'formset': $this->_push_tag('formset'); return $this->_compile_formset_start($tag_args); case 'formsetelse': $this->_push_tag('formsetelse'); return "<?php endforeach; else: ?>"; case '/formset': $_open_tag = $this->_pop_tag('formset'); if ($_open_tag == 'formsetelse') { return "<?php endif; unset(\$_from);?>"; } else { $output = "<?php unset(\$this->_tpl_vars['_pfw_formset_var']);\n"; } $output .= "unset(\$this->_tpl_vars['_pfw_formset_obj']);\n"; $output .= "unset(\$this->_tpl_vars['_pfw_formset_idx']);\n"; $output .= "endforeach; endif; unset(\$_from); ?>"; return $output; break; } return parent::_compile_tag($template_tag); }