function parse($input) { $result = ""; if ($this->parsing == true) { $parser = end(self::$spareParsers); if (!empty($parser) && $parser->parsing == false) { $result = $parser->parse($input); } else { self::$spareParsers[] = $parser = new JisonParser_Wiki_Handler(); $result = $parser->parse($input); } } else { $this->parsing = true; $result = parent::parse($input); $this->parsing = false; } return $result; }
/** * Where a parse generally starts. Can be self-called, as this is detected, and if nested, a new parser is instantiated * * @access private * @param string $input Wiki syntax to be parsed * @return string $output Parsed wiki syntax */ function parse($input) { if (empty($input)) { return $input; } if ($this->parsing == true) { $class = get_class($this->Parser); $parser = new $class($this->Parser); $output = $parser->parse($input); unset($parser); } else { $this->parsing = true; $this->preParse($input); $this->Parser->parseDepth++; $output = parent::parse($input); $this->Parser->parseDepth--; $this->parsing = false; $this->postParse($output); } return $output; }