Index: branches/5.1.x/core/kernel/nparser/nparser.php =================================================================== diff -u -N -r12657 -r13086 --- branches/5.1.x/core/kernel/nparser/nparser.php (.../nparser.php) (revision 12657) +++ branches/5.1.x/core/kernel/nparser/nparser.php (.../nparser.php) (revision 13086) @@ -1,6 +1,6 @@ _btnPhrases['design'] = $this->Application->Phrase('la_btn_EditDesign', false); - $this->_btnPhrases['block'] = $this->Application->Phrase('la_btn_EditBlock', false); - + if (defined('EDITING_MODE') && (EDITING_MODE == EDITING_MODE_DESIGN)) { + $this->_btnPhrases['design'] = $this->Application->Phrase('la_btn_EditDesign', false, true); + $this->_btnPhrases['block'] = $this->Application->Phrase('la_btn_EditBlock', false, true); } } @@ -125,7 +138,7 @@ // the idea is to count number of comment openings and closings before current tag // if the numbers do not match we inverse the status of InsideComment - if (substr_count($tag_data[1][0], '')) { + if ($this->SkipComments && (substr_count($tag_data[1][0], ''))) { $this->InsideComment = !$this->InsideComment; } @@ -291,9 +304,9 @@ function CompileTag($tag) { + $code = ''; $to_pass = $this->CompileParamsArray($tag['NP']); - $code = ''; if ($tag['prefix'] == '__auto__') { $prefix = $this->GetParam('PrefixSpecial'); $code .= '$_p_ =& $_parser->GetProcessor($PrefixSpecial);'."\n"; @@ -304,17 +317,20 @@ $code .= '$_p_ =& $_parser->GetProcessor("'.$tag['prefix'].'");'."\n"; $code .= 'echo $_p_->ProcessParsedTag(\''.$tag['name'].'\', '.$to_pass.', "'.$tag['prefix'].'", \''.$tag['file'].'\', '.$tag['line'].');'."\n"; } - if (isset($tag['NP']['result_to_var'])) { + + if (array_key_exists('result_to_var', $tag['NP']) && $tag['NP']['result_to_var']) { $code .= "\$params['{$tag['NP']['result_to_var']}'] = \$_parser->GetParam('{$tag['NP']['result_to_var']}');\n"; $code .= "\${$tag['NP']['result_to_var']} = \$params['{$tag['NP']['result_to_var']}'];\n"; } + if ($prefix && strpos($prefix, '$') === false) { $p =& $this->GetProcessor($prefix); if (!is_object($p) || !$p->CheckTag($tag['name'], $tag['prefix'])) { $this->Application->handleError(E_USER_ERROR, 'Unknown tag: '.$this->TagInfo($tag).' - incorrect tag name or prefix ', $tag['file'], $tag['line']); return false; } } + return $code; } @@ -490,6 +506,13 @@ $block_params = $this->Params; // input parameters, but modified inside rendered block $this->PopParams(); + if (array_key_exists('result_to_var', $flag_values) && $flag_values['result_to_var']) { + // when "result_to_var" used inside ParseBlock, then $$result_to_var parameter is set inside ParseBlock, + // but not outside it as expected and got lost at all after PopParams is called, so make it work by + // setting it's value on current parameter deep level (from where ParseBlock was called) + $this->SetParam($flag_values['result_to_var'], $block_params[ $flag_values['result_to_var'] ]); + } + $this->CheckNoData($ret, $params); $this->DataExists = $data_exists_bak || $this->DataExists;