Parse the template

@return string Parsed element
541970
public function generate()
	{
		if (TL_MODE === 'BE') {
			return parent::generate();
		}

		$parentKey = ($this->arrData['ptable'] ?: 'tl_article') . '__' . $this->arrData['pid'];

		$htmlPrefix = '';

		if (!empty($GLOBALS['TL_RS_COLUMNS'][$parentKey])) {

			if ($GLOBALS['TL_RS_COLUMNS'][$parentKey]['active']) {

				$GLOBALS['TL_RS_COLUMNS'][$parentKey]['count']++;
				$count = $GLOBALS['TL_RS_COLUMNS'][$parentKey]['count'];

				if ($count) {

					$classes = array('rs-column');
					foreach ($GLOBALS['TL_RS_COLUMNS'][$parentKey]['config'] as $name => $media) {
						$classes = array_merge($classes, $media[($count - 1) % count($media)]);
						if ($count - 1 < count($media)) {
							$classes[] = '-' . $name . '-first-row';
						}
					}

					$htmlPrefix .= '<div class="' . implode(' ', $classes) . '">';

				}

			}

			$GLOBALS['TL_RS_COLUMNS_STACK'][$parentKey][] = $GLOBALS['TL_RS_COLUMNS'][$parentKey];
		}

		$GLOBALS['TL_RS_COLUMNS'][$parentKey] = array(
			'active' => true,
			'count' => 0,
			'config' => static::getColumnsConfiguration($this->arrData),
		);

		return $htmlPrefix . parent::generate();
	}
818905
public function parse()
    {
        return $this->setDescription()
            ->setArray('IS_ARRAY')
            ->setOptional()
            ->setDefault()
            ->setRequired()
            ->calculateMode(InputArgument::class)
            ->setName();
    }
688136
public function render() 
	{
		return Template::i()
			->set(array_merge($this->getHelpers(), $this->getVariables()))
			->parsePhp($this->getTemplate());
	}
90971
protected function getElements()
    {
        $name = str_replace('#', '', $this->selector);

        $id = str_replace(['[', ']'], ['\\[', '\\]'], $name);

        return collect(explode(',', $this->validElements()))->map(function ($element) use ($name, $id) {
            return "{$element}#{$id}, {$element}[name='{$name}']";
        })->all();
    }
326904
protected function _parseTemplate()
	{
		$matches = array();

		if (preg_match_all('#<jdoc:include\ type="([^"]+)" (.*)\/>#iU', $this->_template, $matches))
		{
			$template_tags_first = array();
			$template_tags_last  = array();

			// Step through the jdocs in reverse order.
			for ($i = count($matches[0]) - 1; $i >= 0; $i--)
			{
				$type = $matches[1][$i];
				$attribs = empty($matches[2][$i]) ? array() : $this->parseAttributes($matches[2][$i]);
				$name = isset($attribs['name']) ? $attribs['name'] : null;

				// Separate buffers to be executed first and last
				if ($type == 'module' || $type == 'modules')
				{
					$template_tags_first[$matches[0][$i]] = array('type' => $type, 'name' => $name, 'attribs' => $attribs);
				}
				else
				{
					$template_tags_last[$matches[0][$i]]  = array('type' => $type, 'name' => $name, 'attribs' => $attribs);
				}
			}
			// Reverse the last array so the jdocs are in forward order.
			$template_tags_last = array_reverse($template_tags_last);

			$this->_template_tags = $template_tags_first + $template_tags_last;
		}

		return $this;
	}
123965
public function parse()
    {
        if ($this->query !== null) {
            return $this->query;
        }
        $query = preg_replace_callback('~{(.*?)}~', array($this, 'tableClb'), $this->pattern);
        $pattern = '~\?([a-z\?-]+)?(:([a-z0-9_-]*))?;?~i';
        $callback = array($this, 'placeholderClb');
        $query = preg_replace_callback($pattern, $callback, $query);
        if ((!$this->named) && (count($this->data) > $this->counter)) {
            if (($this->counter > 0) || (isset($this->data[0]))) {
                throw new DataMuch(count($this->data), $this->counter);
            }
        }
        $this->query = $query;
        return $this->query;
    }
651888
def _parse(self):
        
        # Is this a shorthand template?
        if self._element.tag == 'template':
            return self._parse_template(self._element)

        # Is this a shorthand redirect?
        if self._element.tag == 'redirect':
            return self._parse_redirect(self._element)

        for child in self._element:
            method_name = '_parse_' + child.tag

            if hasattr(self, method_name):
                parse = getattr(self, method_name)
                parse(child)
1151731
public function render()
    {
        $this->tag = '<' . $this->name;

        if (count($this->attr)) {
            $this->tag .= ' ';
            foreach ($this->attr as $key => $value) {
                $this->tag .= $key . '="';
                if (is_array($value)) {
                    $this->tag .= implode(' ', $value);
                } else {
                    $this->tag .= $value != false? $value: 0;
                }
                $this->tag .= '" ';
            }
        }
        $this->tag = trim($this->tag) . '>';

        if (!in_array(strtolower($this->name), $this->elementsNoClosing)) {
            $this->tag .= $this->parseValue($this->value) . '</' . $this->name . '>';
        }

        return $this->tag;
    }
635266
public function getElement()
	{
		$element = $this->_element;

		if (empty($element))
		{
			$r = new ReflectionClass($this);
			if ($r->inNamespace())
			{
				$bits = explode('\\', __NAMESPACE__);

				// Should match either:
				//   Plugins\Folder\Element
				//   Components\Folder\Plugins\Element
				$element = strtolower($bits[2]);

				if (strtolower($bits[0]) == 'components')
				{
					$element = strtolower($bits[3]);
				}
			}
			else
			{
				throw new Exception('Cannot get or parse view class name.', 500);
			}
		}

		return $element;
	}
632233
public function getTemplates()
	{
		$templates = [
			'br' => '<br/>',
			'e'  => '',
			'i'  => '',
			'p'  => '<p><xsl:apply-templates/></p>',
			's'  => ''
		];

		foreach ($this->configurator->tags as $tagName => $tag)
		{
			if (isset($tag->template))
			{
				$templates[$tagName] = (string) $tag->template;
			}
		}

		ksort($templates);

		return $templates;
	}
1104490
public function parse()
    {
        $notification = (isset($_POST) && isset($_POST["xml"])) ? $_POST["xml"] : null;

        if (! $notification) {
            throw new \Exception('Notification error', 5000);
        }
        return new \SimpleXMLElement($notification);
    }
458076
public function parse()
    {
        $newTokens = array();
        $len = count($this->tokens);
        $this->stack = array();
        $propValue = 'PROPERTY';
        $pushes = array(
            'L_BRACKET' => 'bracket',
            'L_BRACE' => 'brace',
            'AT_IDENTIFIER' => 'at',
            'L_SQ_BRACKET' => 'square'
        );
        $pops = array(
            'R_BRACKET' => 'bracket',
            'R_BRACE' => 'brace',
            'R_SQ_BRACKET' => 'square'
        );
        $this->index = 0;
        while ($this->index < $len) {
            $token = &$this->tokens[$this->index];
            $stackSize = count($this->stack);
            $state = !$stackSize? null : $this->stack[$stackSize - 1];
            $tokName = &$token[0];
            $inBrace = in_array('brace', $this->stack);
            $inBracket = in_array('bracket', $this->stack);
            $inSq = in_array('square', $this->stack);
            $inAt = in_array('at', $this->stack);
            if ($tokName === self::$deleteToken) {
                continue;
            }

            if ($tokName === 'L_BRACE') {
                if ($state === 'at') {
                    array_pop($this->stack);
                }
                $this->stack[] = $pushes[$tokName];
                $propValue = 'PROPERTY';
            } elseif (isset($pushes[$tokName])) {
                $this->stack[] = $pushes[$tokName];
            } elseif (isset($pops[$tokName]) && $state === $pops[$tokName]) {
                array_pop($this->stack);
            } elseif (!$inBracket && $tokName === 'COLON') {
                $propValue = 'VALUE';
            } elseif ($tokName === 'SEMICOLON') {
                $propValue = 'PROPERTY';
                if ($state === 'at') {
                    array_pop($this->stack);
                }
            } elseif ($tokName === 'GENERIC_IDENTIFIER') {
                // this is where the fun starts.
                // we have to figure out exactly what this is
                // if we can look ahead and find a '{' before we find a
                // ';', then this is part of a selector.
                // Otherwise it's part of a property/value pair.
                // the exception is when we have something like:
                // font : { family : sans-serif; }
                // then we need to check for ':{'
                if ($inSq) {
                    $token[0] = 'ATTR_SELECTOR';
                } elseif ($inBracket) {
                    $this->parseIdentifier($token);
                } elseif (!$inAt) {
                    $semi = $this->nextOfType('SEMICOLON');
                    $colonBrace = $this->nextSequence(array('COLON', 'L_BRACE'), array('WHITESPACE'));
                    $brace = $this->nextOfType('L_BRACE');

                    $ruleTerminator = min($semi, $colonBrace);
                    if ($brace < $ruleTerminator) {
                        $this->parseRule();
                        $propValue = 'PROPERTY';
                    } else {
                        $this->tokens[$this->index][0] = $propValue;
                        if ($propValue === 'VALUE') {
                            $this->parseIdentifier($token);
                        }
                    }
                }
            }
            $this->index++;
        }
        $this->cleanup();
    }
1318689
final public function parse()
    {
        $wsdl = $this->generator->getWsdl();
        if ($wsdl instanceof Wsdl) {
            $content = $wsdl->getContent();
            if ($content instanceof WsdlDocument) {
                if ($this->isWsdlParsed($wsdl) === false) {
                    $this->setWsdlAsParsed($wsdl)->setTags($content->getElementsByName($this->parsingTag()))->parseWsdl($wsdl);
                }
                foreach ($content->getExternalSchemas() as $schema) {
                    if ($this->isSchemaParsed($wsdl, $schema) === false) {
                        $this->setSchemaAsParsed($wsdl, $schema);
                        $schemaContent = $schema->getContent();
                        if ($schemaContent instanceof SchemaDocument) {
                            $this->setTags($schemaContent->getElementsByName($this->parsingTag()))->parseSchema($wsdl, $schema);
                        }
                    }
                }
            }
        }
    }
827311
public function parse()
    {
        if (null === $this->html) {
            throw new HtmlPhpExcelException('You must provide html content first. Use setHtml() or setHtmlFile().');
        }

        $dom = new \DOMDocument();
        $dom->loadHTML($this->html);

        $xpath = new \DOMXPath($dom);
        $htmlTables = $xpath->query('.//table[contains(concat(" ", normalize-space(@class), " "), "'.$this->tableClass.'")]');

        $document = new Document();

        foreach ($htmlTables as $htmlTable) {

            $table = new Table();

            $htmlRows = $xpath->query('.//tr[contains(concat(" ", normalize-space(@class), " "), "'.$this->rowClass.'")]', $htmlTable);
            foreach($htmlRows as $htmlRow) {

                $row = new Row();
                $htmlCells = $xpath->query(
                     './/td[contains(concat(" ", normalize-space(@class), " "), "'.$this->cellClass.'")]
                    | .//th[contains(concat(" ", normalize-space(@class), " "), "'.$this->cellClass.'")]',
                    $htmlRow
                );

                foreach($htmlCells as $htmlCell) {
                    $cell = new Cell();
                    $cell->setValue($htmlCell->nodeValue);

                    foreach ($htmlCell->attributes as $attribute) {
                        $cell->addAttribute($attribute->name, $attribute->value);
                    }

                    if ('th' == $htmlCell->nodeName) {
                        $cell->setIsHeader(true);
                    }

                    $row->addCell($cell);
                }

                foreach ($htmlRow->attributes as $attribute) {
                    $row->addAttribute($attribute->name, $attribute->value);
                }

                $table->addRow($row);
            }

            foreach ($htmlTable->attributes as $attribute) {
                $table->addAttribute($attribute->name, $attribute->value);
            }

            $document->addTable($table);
        }

        return $document;
    }
41665
function parse() {
    $this->output = '';
    # drop tags
    $this->parser->html = preg_replace('#<('.implode('|', $this->drop).')[^>]*>.*</\\1>#sU', '', $this->parser->html);
    while ($this->parser->nextNode()) {
      switch ($this->parser->nodeType) {
        case 'doctype':
          break;
        case 'pi':
        case 'comment':
          if ($this->keepHTML) {
            $this->flushLinebreaks();
            $this->out($this->parser->node);
            $this->setLineBreaks(2);
          }
          # else drop
          break;
        case 'text':
          $this->handleText();
          break;
        case 'tag':
          if (in_array($this->parser->tagName, $this->ignore)) {
            break;
          }
          if ($this->parser->isStartTag) {
            $this->flushLinebreaks();
          }
          if ($this->skipConversion) {
            $this->isMarkdownable(); # update notConverted
            $this->handleTagToText();
            continue;
          }
          if (!$this->parser->keepWhitespace && $this->parser->isBlockElement && $this->parser->isStartTag) {
            $this->parser->html = ltrim($this->parser->html);
          }
          if ($this->isMarkdownable()) {
            if ($this->parser->isBlockElement && $this->parser->isStartTag && !$this->lastWasBlockTag && !empty($this->output)) {
              if (!empty($this->buffer)) {
                $str =& $this->buffer[count($this->buffer) -1];
              } else {
                $str =& $this->output;
              }
              if (substr($str, -strlen($this->indent)-1) != "\n".$this->indent) {
                $str .= "\n".$this->indent;
              }
            }
            $func = 'handleTag_'.$this->parser->tagName;
            $this->$func();
            if ($this->linksAfterEachParagraph && $this->parser->isBlockElement && !$this->parser->isStartTag && empty($this->parser->openTags)) {
              $this->flushStacked();
            }
            if (!$this->parser->isStartTag) {
              $this->lastClosedTag = $this->parser->tagName;
            }
          } else {
            $this->handleTagToText();
            $this->lastClosedTag = '';
          }
          break;
        default:
          trigger_error('invalid node type', E_USER_ERROR);
          break;
      }
      $this->lastWasBlockTag = $this->parser->nodeType == 'tag' && $this->parser->isStartTag && $this->parser->isBlockElement;
    }
    if (!empty($this->buffer)) {
      trigger_error('buffer was not flushed, this is a bug. please report!', E_USER_WARNING);
      while (!empty($this->buffer)) {
        $this->out($this->unbuffer());
      }
    }
    ### cleanup
    $this->output = rtrim(str_replace('&amp;', '&', str_replace('&lt;', '<', str_replace('&gt;', '>', $this->output))));
    # end parsing, flush stacked tags
    $this->flushStacked();
    $this->stack = array();
  }
340643
public function parse()
    {
        $templates = array();
        $finder = new Finder(); 
        
        $directories = array(
            $this->templatesDir, 
        );
        
        $globalResourcesFolder = $this->kernelDir . '/Resources/views/' . $this->themeName;
        if (is_dir($globalResourcesFolder)) {
            $directories[] = $globalResourcesFolder;
        }
        
        $templateFiles = $finder->files('*.twig')->in($directories);
        foreach ($templateFiles as $template) {
            $template = (string)$template;
            $templateName = basename($template);
            $templateContents = file_get_contents($template);
            
            $slots = $this->fetchSlots($templateContents);
            if (empty($slots)) {
                continue;
            }
            
            $templates[$templateName]['assets']['external_stylesheets'] = $this->fetchExternalStylesheets($templateContents);
            $templates[$templateName]['assets']['external_javascripts'] = $this->fetchExternalJavascripts($templateContents);
            $templates[$templateName]['assets']['external_stylesheets_cms'] = $this->fetchExternalStylesheetsCms($templateContents);
            $templates[$templateName]['assets']['external_javascripts_cms'] = $this->fetchExternalJavascriptsCms($templateContents);
            $templates[$templateName]['slots'] = $slots;
            if (strpos($template, $this->kernelDir) === false) {
                $templates[$templateName]['generate_template'] = dirname($template) == $this->templatesDir;
            }
        }
        
        return $templates;
    }
455537
private function _parse()
    {
        $this->contentXml = str_replace(array_keys($this->vars), array_values($this->vars), $this->contentXml);
        $this->stylesXml  = str_replace(array_keys($this->vars), array_values($this->vars), $this->stylesXml);
    }