Application->recallObject('Inp1Parser');
- $this->Output = $inp1_parser->Parse($name, $this->Output);
- $has_inp_tags = true;
- }
- }
-
-
- if (defined('EXPERIMENTAL_PRE_PARSE') && $pre_parse && !$has_inp_tags) {
-// $this->CompiledBuffer .= 'echo $o;'."\n";
- $this->CompiledBuffer .= '?'.'>'."\n";
-
- if (defined('SAFE_MODE') && SAFE_MODE) {
- if (!isset($conn)) $conn =& $this->Application->GetADODBConnection();
- $conn->Query('REPLACE INTO '.TABLE_PREFIX.'Cache (VarName, Data, Cached) VALUES ('.$conn->qstr($fname).','.$conn->qstr($this->CompiledBuffer).','.adodb_mktime().')');
- }
- else {
- $compiled = fopen($fname, 'w');
- fwrite($compiled, $this->CompiledBuffer);
- fclose($compiled);
- }
- }
-
- return $this->Output;
- }
-
- function ParseBlock($params, $force_pass_params=0, $as_template=false)
- {
- if( $this->Application->isDebugMode() && constOn('DBG_SHOW_TAGS') )
- {
- global $debugger;
- $debugger->appendHTML('ParseBlock '.$params['name'].' pass_params is '.$params['pass_params'].' force is '.$force_pass_params.' in '.$debugger->getFileLink($debugger->getLocalFile(FULL_PATH.THEMES_PATH.'/'.$this->TemplateName).'.tpl', $this->CurrentLineNumber(), '', true));
-
- }
- /*if ( $this->Application->isDebugMode() && constOn('DBG_PRE_PARSE') ) {
- global $debugger;
- $debugger->CurrentPreParsedBlock = $params['name'];
- }*/
- if (defined('EXPERIMENTAL_PRE_PARSE')) {
- $this->MainParser = false;
- if (isset($this->Application->PreParsedBlocks[$params['name']]) ) {
-
- if ($this->ParamsRecursionIndex == 0) {
- $this->ParamsStack[$this->ParamsRecursionIndex] = $this->Params;
- }
-
- if (isset($params['pass_params']) || $force_pass_params) {
- $pass_params = array_merge($this->ParamsStack[$this->ParamsRecursionIndex], $params);
- }
- else {
- $pass_params = $params;
- }
-
- $this->ParamsStack[++$this->ParamsRecursionIndex] = $pass_params;
- $this->Params = $pass_params;
-
- $f = $this->Application->PreParsedBlocks[$params['name']];
-
-// $this->ParamsRecursionIndex--;
-
- //$this->SetParams($params);
- if( !isset($pass_params['PrefixSpecial']) && isset($pass_params['prefix']) ) $pass_params['PrefixSpecial'] = $pass_params['prefix'];
-
- $ret = $f($pass_params);
-
- if (isset($params['return_params']) && $params['return_params']) {
- $this->ParamsStack[$this->ParamsRecursionIndex - 1] = array_merge($this->ParamsStack[$this->ParamsRecursionIndex - 1], $this->ParamsStack[$this->ParamsRecursionIndex]);
- }
-
- unset($this->ParamsStack[$this->ParamsRecursionIndex--]);
- $this->Params = $this->ParamsStack[$this->ParamsRecursionIndex];
- $this->MainParser = true;
- return defined('DBG_DECORATE_BLOCKS') && DBG_DECORATE_BLOCKS ? $this->decorateBlock($ret, $pass_params) : $ret;
- }
- }
-
- $BlockParser =& $this->Application->makeClass('TemplateParser');
- if (isset($params['pass_params']) || $force_pass_params) {
- $BlockParser->SetParams(array_merge($this->Params, $params));
- }
- else
- $BlockParser->SetParams($params);
- $this->Application->Parser =& $BlockParser;
- if (!isset($params['name'])) {
- trigger_error('***Error: Block name not passed to ParseBlock', E_USER_ERROR);
- }
- $templates_cache =& $this->Application->recallObject('TemplatesCache');
-
- $template_name = $as_template ? $params['name'] : $templates_cache->GetTemplateFileName($params['name']) . '-block:'.$params['name'];
-
- $silent = getArrayValue($params, 'from_inportal') && !defined('DBG_TEMPLATE_FAILURE');
-
- $o = $BlockParser->Parse(
- $templates_cache->GetTemplateBody($params['name'], $silent),
- $template_name
- );
- if (getArrayValue($params, 'BlockNoData') && !$BlockParser->DataExists) {
- $template_name = $as_template ? $params['BlockNoData'] : $templates_cache->GetTemplateFileName($params['BlockNoData']) . '-block:'.$params['BlockNoData'];
- $o = $BlockParser->Parse(
- $templates_cache->GetTemplateBody($params['BlockNoData'], $silent),
- $template_name
- );
- }
-
- $this->Application->Parser =& $this;
- $this->Application->Parser->DataExists = $this->Application->Parser->DataExists || $BlockParser->DataExists;
-
- return $o;
- }
-
- function decorateBlock(&$block_content, $block_params)
- {
- if (preg_match('/^(\s*)(.*)<\/td>(.*)$/is', $block_content, $regs)) {
- // block with td -> put div inside td
- return $regs[1].' | '.$regs[3].' | '.$regs[4];
- }
-
- return ''.$block_content.'
';
- }
-
- function Recurve(&$tag)
- {
- $this->Recursion[++$this->RecursionIndex] =& $tag;
- }
-
- function CheckRecursion(&$tag)
- {
- if ($this->RecursionIndex > 0) { //If we are inside the recursion
- if ($this->Recursion[$this->RecursionIndex]->CheckRecursion($tag)) { //If we can close this recursion
- unset($this->Recursion[$this->RecursionIndex--]); //unsetting current recursion level and decreasing it at the same time
- return true; //we should inform not to process closing tag
- }
- }
- return false;
- }
-
- function SetSkipMode($mode)
- {
- $this->SkipMode = $mode;
- }
-}
-
-?>
\ No newline at end of file