Index: branches/unlabeled/unlabeled-1.17.2/core/kernel/processors/tag_processor.php =================================================================== diff -u -N -r8309 -r8682 --- branches/unlabeled/unlabeled-1.17.2/core/kernel/processors/tag_processor.php (.../tag_processor.php) (revision 8309) +++ branches/unlabeled/unlabeled-1.17.2/core/kernel/processors/tag_processor.php (.../tag_processor.php) (revision 8682) @@ -52,19 +52,8 @@ $backup_prefix = $this->Prefix; $backup_special = $this->Special; - // process all possible flags: begin - $flags = Array('js_escape', 'result_to_var', 'pass_params', 'html_escape', 'strip_nl'); - $flag_values = Array(); + $flag_values = $this->PreparePostProcess($params); - foreach ($flags as $flag_name) { - $flag_values[$flag_name] = false; - if (isset($params[$flag_name])) { - $flag_values[$flag_name] = $params[$flag_name]; - unset($params[$flag_name]); - } - } - // process all possible flags: end - // pass_params for non ParseBlock tags :) if ($flag_values['pass_params']) { $params = array_merge_recursive2($this->Application->Parser->Params, $params); @@ -75,22 +64,8 @@ $this->Prefix = $backup_prefix; $this->Special = $backup_special; - if ($flag_values['js_escape']) { - $ret = addslashes($ret); - $ret = str_replace(Array("\r", "\n"), Array('\r', '\n'), $ret); - $ret = str_replace('', "", $ret); - } - if ($flag_values['html_escape']) { - $ret = htmlspecialchars($ret); - } - if ($flag_values['strip_nl']) { - // 1 - strip \r,\n; 2 - strip tabs too - $ret = preg_replace($flag_values['strip_nl'] == 2 ? "/[\r\n\t]/" : "/[\r\n]/", '', $ret); - } - if ($flag_values['result_to_var']) { - $this->Application->Parser->SetParam($flag_values['result_to_var'], $ret); - $ret = ''; - } + $ret = $this->PostProcess($ret, $flag_values); + return $ret; } else @@ -105,7 +80,7 @@ $processor =& $this->Application->recallObject($__tag_processor); $processor->Prefix = $tmp['prefix']; $processor->Special = getArrayValue($tag_mapping, 2) ? $tag_mapping[2] : $tmp['special']; - + $params['PrefixSpecial'] = $this->getPrefixSpecial(); // $prefix; $ret = $processor->ProcessParsedTag($tag_mapping[1], $params, $prefix); if (isset($params['result_to_var'])) { @@ -124,7 +99,43 @@ } } + function PreparePostProcess(&$params) + { + $flags = Array('js_escape', 'result_to_var', 'pass_params', 'html_escape', 'strip_nl'); + $flag_values = Array(); + foreach ($flags as $flag_name) { + $flag_values[$flag_name] = false; + if (isset($params[$flag_name])) { + $flag_values[$flag_name] = $params[$flag_name]; + unset($params[$flag_name]); + } + } + return $flag_values; + } + + function PostProcess($ret, $flag_values) + { + if ($flag_values['js_escape']) { + $ret = addslashes($ret); + $ret = str_replace(Array("\r", "\n"), Array('\r', '\n'), $ret); + $ret = str_replace('', "", $ret); + } + if ($flag_values['html_escape']) { + $ret = htmlspecialchars($ret); + } + if ($flag_values['strip_nl']) { + // 1 - strip \r,\n; 2 - strip tabs too + $ret = preg_replace($flag_values['strip_nl'] == 2 ? "/[\r\n\t]/" : "/[\r\n]/", '', $ret); + } + if ($flag_values['result_to_var']) { + $this->Application->Parser->SetParam($flag_values['result_to_var'], $ret); + $ret = ''; + } + return $ret; + } + + /** * Not tag, method for parameter * selection from list in this TagProcessor