/**
  * Handler for unknown tags, handle else tags
  *
  * @param string $tag
  * @param array $params
  * @param array $tokens
  */
 function unknown_tag($tag, $params, &$tokens)
 {
     if ($tag == 'else' || $tag == 'elsif') {
         /* Update reference to nodelistHolder for this block */
         $this->_nodelist =& $this->_nodelistHolders[count($this->_blocks) + 1];
         $this->_nodelistHolders[count($this->_blocks) + 1] = array();
         array_push($this->_blocks, array($tag, $params, &$this->_nodelist));
     } else {
         parent::unknown_tag($tag, $params, $tokens);
     }
 }
Esempio n. 2
0
 /**
  * Handler for unknown tags, handle else tags
  *
  * @param string $tag
  * @param array $params
  * @param array $tokens
  */
 function unknown_tag($tag, $params, &$tokens)
 {
     new dBug(func_get_args(), 'Start = LiquidIf::unknown_tag');
     if ($tag == 'else' || $tag == 'elsif') {
         new dBug(count($this->_blocks), 'block count');
         new dBug($this->_blocks, 'blocks');
         new dBug($this->_nodelist, '_nodelist');
         new dBug($this->_nodelistHolders, '_nodelistHolders');
         /* Update reference to nodelistHolder for this block */
         $this->_nodelist =& $this->_nodelistHolders[count($this->_blocks) + 1];
         $this->_nodelistHolders[count($this->_blocks) + 1] = array();
         new dBug($this->_blocks, 'blocks 2');
         new dBug($this->_nodelist, '_nodelist 2');
         new dBug($this->_nodelistHolders, '_nodelistHolders 2');
         array_push($this->_blocks, array($tag, $params, &$this->_nodelist));
         new dBug($this->_blocks, 'blocks 3');
         new dBug($this->_nodelist, '_nodelist 3');
         new dBug($this->_nodelistHolders, '_nodelistHolders 3');
     } else {
         parent::unknown_tag($tag, $params, $tokens);
     }
 }
 /**
  * Unknown tag handler
  *
  * @param string $tag
  * @param array $params
  * @param array $tokens
  */
 function unknown_tag($tag, $params, &$tokens)
 {
     $when_syntax_regexp = new LiquidRegexp('/' . LIQUID_QUOTED_FRAGMENT . '/');
     switch ($tag) {
         case 'when':
             // push the current nodelist onto the stack and prepare for a new one
             if ($when_syntax_regexp->match($params)) {
                 $this->push_nodelist();
                 $this->right = $when_syntax_regexp->matches[0];
                 $this->_nodelist = array();
             } else {
                 throw new LiquidException("Syntax Error in tag 'case' - Valid when condition: when [condition]");
                 // harry
             }
             break;
         case 'else':
             // push the last nodelist onto the stack and prepare to recieve the else nodes
             $this->push_nodelist();
             $this->right = null;
             $this->else_nodelist =& $this->_nodelist;
             $this->_nodelist = array();
             break;
         default:
             parent::unknown_tag($tag, $params, $tokens);
     }
 }