function __construct($tag, $class, $param, $id, $ref) { parent::__construct($tag, $class, $param, $id); $this->source[] = $ref; $this->baseType = $tag; self::$var++; $this->varname = "\$dynhtml" . self::$var; }
function procLines() { /* @var $heir Tag[] Tag Heirachy Array */ $heir = array(); while ($this->lineNo < $this->lineCount) { $line = $this->lines[$this->lineNo]; if (trim($line)) { if (preg_match(self::REGEX_PARSE_LINE, $line, $m)) { if (FALSE !== strpos($m[1], "\t")) { throw new ParseError("Tabs are not supported in templates at this time"); } $indent = strlen($m[1]); $tag = isset($m[2]) ? $tag = $m[2] : ""; $classid = isset($m[3]) ? $m[3] : ""; $params = str_replace(array('\\[', '\\]', '\\&'), array('[', ']', '%26'), isset($m[4]) ? $m[4] : ""); $textcode = isset($m[5]) ? $m[5] : ""; $text = isset($m[8]) ? $m[8] : ""; $code = isset($m[6]) ? $m[6] : ""; $i = self::indentLevel($indent); unset($m[0]); switch (strlen($code) ? $code[0] : ($textcode ? $textcode : "")) { case "|": //Control Tag if ($code == "|snippet") { $hTag = new Tag\Snippet($text); } elseif ($code == "|form") { $hTag = new Tag\Form($text); } elseif ($code == "|formhint") { $hTag = new Tag\FormHint($text); } elseif ($code == "|else") { $hTag = new Tag\Control(substr($code, 1), $heir[$i - 1]); $hTag->setVar($text); } else { $hTag = new Tag\Control(substr($code, 1)); $hTag->setVar($text); } break; case ":": //Filter Tag $hTag = new Tag\Filter(substr($code, 1)); $hTag->addContent($text, Text::TOKEN_CODE); foreach ($this->consumeBlock($indent) as $l) { $hTag->addContent($l, Text::TOKEN_CODE); } break; case "_": //String Tag //String Tag case "__": //Unescape String Tag $hTag = new Tag\Text($textcode); $hTag->addContent($text); break; case "/": // HTML Comment // HTML Comment case "//": // Non Printed Comment $hTag = new Tag\Comment($textcode); $hTag->addContent($text); foreach ($this->consumeBlock($indent) as $l) { $hTag->addContent($l, Text::TOKEN_CODE); } break; default: $attr = array(); if (isset($params[0]) && $params[0] == "[") { $param = substr($params, 1, strlen($params) - 2); $param = str_replace('+', '%2B', $param); $param = str_replace('\\&', '%26', $param); // parse_str($param, $attr); $attr = $this->parseQueryString($param); } $class = array(); $id = ""; $ref = ""; preg_match_all('/[#\\.!][a-zA-Z0-9\\-\\_]+/m', $classid, $cid); if (isset($cid[0])) { foreach ($cid[0] as $s) { if ($s[0] == "#") { $id = substr($s, 1); } if ($s[0] == ".") { $class[] = substr($s, 1); } if ($s[0] == "!") { $ref = substr($s, 1); } } } if ($ref) { $hTag = new Tag\DynHtml($tag, $class, $attr, $id, $ref); } else { $hTag = new Tag\Html($tag, $class, $attr, $id); } $hTag->addContent($text); break; } $heir[$i] = $hTag; if ($i > 0) { $heir[$i - 1]->addChild($hTag); } else { $this->root[] = $hTag; } } else { throw new ParseError("Unable to parse line {$this->lineNo}\n\"{$line}\"/" . preg_last_error()); } } $this->lineNo++; } }