You are here

function Smarty_Compiler::_pop_tag in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/lib/smarty/Smarty_Compiler.class.php \Smarty_Compiler::_pop_tag()

pop closing tag-name raise an error if this stack-top doesn't match with the closing tag

Parameters

string the closing tag's name:

Return value

string the opening tag's name

2 calls to Smarty_Compiler::_pop_tag()
Smarty_Compiler::_compile_block_tag in includes/moodle/lib/smarty/Smarty_Compiler.class.php
compile block function tag
Smarty_Compiler::_compile_tag in includes/moodle/lib/smarty/Smarty_Compiler.class.php
Compile a template tag

File

includes/moodle/lib/smarty/Smarty_Compiler.class.php, line 2247

Class

Smarty_Compiler
Template compiling class @package Smarty

Code

function _pop_tag($close_tag) {
  $message = '';
  if (count($this->_tag_stack) > 0) {
    list($_open_tag, $_line_no) = array_pop($this->_tag_stack);
    if ($close_tag == $_open_tag) {
      return $_open_tag;
    }
    if ($close_tag == 'if' && ($_open_tag == 'else' || $_open_tag == 'elseif')) {
      return $this
        ->_pop_tag($close_tag);
    }
    if ($close_tag == 'section' && $_open_tag == 'sectionelse') {
      $this
        ->_pop_tag($close_tag);
      return $_open_tag;
    }
    if ($close_tag == 'foreach' && $_open_tag == 'foreachelse') {
      $this
        ->_pop_tag($close_tag);
      return $_open_tag;
    }
    if ($_open_tag == 'else' || $_open_tag == 'elseif') {
      $_open_tag = 'if';
    }
    elseif ($_open_tag == 'sectionelse') {
      $_open_tag = 'section';
    }
    elseif ($_open_tag == 'foreachelse') {
      $_open_tag = 'foreach';
    }
    $message = " expected {/{$_open_tag}} (opened line {$_line_no}).";
  }
  $this
    ->_syntax_error("mismatched tag {/{$close_tag}}.{$message}", E_USER_ERROR, __FILE__, __LINE__);
}