/** * Constructor * * @param string $markup * @param array $tokens * @param LiquidFileSystem $fileSystem * @return IncludeLiquidTag */ public function __construct($markup, &$tokens, &$fileSystem) { $regex = new LiquidRegexp('/("[^"]+"|\'[^\']+\')?/'); if ($regex->match($markup)) { $this->_templateName = substr($regex->matches[1], 1, strlen($regex->matches[1]) - 2); } else { throw new LiquidException("Error in tag 'extends' - Valid syntax: extends '[template name]'"); } parent::__construct($markup, $tokens, $fileSystem); }
/** * Constructor * * @param string $markup * @param array $tokens * @param LiquidFileSystem $fileSystem * @return IncludeLiquidTag */ public function __construct($markup, &$tokens, &$fileSystem) { $regex = new LiquidRegexp('/("[^"]+"|\'[^\']+\')(\\s+(with|for)\\s+(' . LIQUID_QUOTED_FRAGMENT . '+))?/'); if ($regex->match($markup)) { $this->_templateName = substr($regex->matches[1], 1, strlen($regex->matches[1]) - 2); if (isset($regex->matches[1])) { $this->_collection = isset($regex->matches[3]) ? $regex->matches[3] == "for" : null; $this->_variable = isset($regex->matches[4]) ? $regex->matches[4] : null; } $this->extractAttributes($markup); } else { throw new LiquidException("Error in tag 'include' - Valid syntax: include '[template]' (with|for) [object|collection]"); } parent::__construct($markup, $tokens, $fileSystem); }
/** * Constructor * * @param string $markup * @param array $tokens * @param LiquidFileSystem $file_system * @return IncludeLiquidTag */ function IncludeLiquidTag($markup, &$tokens, &$file_system) { $regex = new LiquidRegexp('/("[^"]+"|\'[^\']+\')(\\s+(with|for)\\s+(' . LIQUID_QUOTED_FRAGMENT . '+))?/'); if ($regex->match($markup)) { $this->template_name = substr($regex->matches[1], 1, strlen($regex->matches[1]) - 2); if (isset($regex->matches[1])) { $this->collection = $regex->matches[3] == "for"; $this->variable = $regex->matches[4]; } $this->extract_attributes($markup); } else { trigger_error("Error in tag 'include' - Valid syntax: include '[template]' (with|for) [object|collection]", E_USER_ERROR); } parent::LiquidTag($markup, $tokens, $file_system); }