Konwertuje tagi {'element struktury'} na wynik renderowania pliku
przykład: {'cms/index'} wyrenderuje template index.tpl w module cms
@param array $matches dopasowania
@return string
484458
private function _render(array $matches)
    {
        //wyszukiwanie szablonu
        if (null === $template = $this->view->getTemplateByPath($matches[1])) {
            //brak szablonu
            return;
        }
        //rekurencyjne zastąpienie (gdyż wstawienia mogą być zagnieżdżone)
        return preg_replace_callback('/\{\'([a-zA-Z\-\/]+)\'\}/', [&$this, '_render'], file_get_contents($template));
    }
505116
protected function _emoticonCallback($matches) {
        $smiley = trim($matches[0]);

        if (count($matches) === 1 || !$this->hasSmiley($smiley)) {
            return $matches[0];
        }

        return $this->render($smiley, $this->getParser()->getConfig('xhtmlOutput'));
    }
266713
protected function javascriptEscaper(array $matches): string
	{
		$chr = $matches[0];

		if(strlen($chr) === 1)
		{
			return sprintf('\\x%02X', ord($chr));
		}

		$chr = mb_convert_encoding($chr, 'UTF-16BE', 'UTF-8');

		return sprintf('\\u%04s', strtoupper(bin2hex($chr)));
	}
139549
protected function cssEscaper(array $matches): string
	{
		$chr = $matches[0];

		if(strlen($chr) === 1)
		{
			$ord = ord($chr);
		}
		else
		{
			$chr = mb_convert_encoding($chr, 'UTF-16BE', 'UTF-8');

			$ord = hexdec(bin2hex($chr));
		}

		return sprintf('\\%X ', $ord);
	}
1266453
public function compile($matches)
    {
        $overwrite = ($matches[1] == "section.overwrite") ? "true" : "false";

        if (isset($matches[6]) && !empty($matches[6])) {
            /*
            $params = $this->compiler->splitParams($matches[6], "default", function($values) {
                return $values;
            });
            
            $input = null;

            foreach($params as $key => $value)
                $input .= PHP_EOL . "if(!isset(\$$key))" . PHP_EOL . "{" . PHP_EOL . "\$$key = <<<HTML" . PHP_EOL . "$value" . PHP_EOL . "HTML;" . PHP_EOL . "}";

            $input = $this->compiler->wrap($input, "");

            return
                $this->compiler->wrap("ob_start()")
                . $input
                . $matches[7]
                . $this->compiler->wrap("\$__env->addSection(\"{$matches[3]}\", ob_get_contents(), $overwrite); ob_end_clean()");
            */
        }

        return
            $this->compiler->wrap("ob_start()")
            . $matches[7]
            . $this->compiler->wrap("\$__env->addSection(\"{$matches[3]}\", ob_get_contents(), $overwrite); ob_end_clean()");
    }
1069553
protected function _replaceTags($matches)
    {
        $style = $this->styles($matches['tag']);
        if (empty($style)) {
            return '<' . $matches['tag'] . '>' . $matches['text'] . '</' . $matches['tag'] . '>';
        }

        $styleInfo = [];
        if (!empty($style['text']) && isset(static::$_foregroundColors[$style['text']])) {
            $styleInfo[] = static::$_foregroundColors[$style['text']];
        }
        if (!empty($style['background']) && isset(static::$_backgroundColors[$style['background']])) {
            $styleInfo[] = static::$_backgroundColors[$style['background']];
        }
        unset($style['text'], $style['background']);
        foreach ($style as $option => $value) {
            if ($value) {
                $styleInfo[] = static::$_options[$option];
            }
        }

        return "\033[" . implode($styleInfo, ';') . 'm' . $matches['text'] . "\033[0m";
    }
1044859
private function func_arr_params_callback($matches) {
    	$func = $matches[1];
    	$params_str = $matches[2];
        $in_matches = [];
    	preg_match_all("/([a-z_]+)\=[\"\']?([^\"\']+)[\"\']?/i", stripslashes($params_str), $in_matches, PREG_SET_ORDER);
    	$params = null;
    	foreach($in_matches as $v) {
    		$params[$v[1]] = $v[2];
    	}
    	return "<?php print_r( " . $func . "(" . ArrayHelper::toRaw($params) . ') ); ?>';
    }
930060
protected function _replaceParamsCallback($matches)
    {
        $key   = substr($matches[0], 1);
        $value = $this->_parameters[$key];

        if(!$value instanceof DatabaseQuerySelect) {
            $value = is_object($value) ? (string) $value : $value;
            $replacement = $this->getDriver()->quoteValue($value);
        }
        else $replacement = '('.$value.')';

        return is_array($value) ? '('.$replacement.')' : $replacement;
    }
428611
protected function _processCodeBlock($matches)
    {
        list($block, $openTag, $tagName, $lang, $code, $closeTag) = $matches;
        unset($matches);

        // check language
        $lang = $this->validLang($lang);
        $code = html_entity_decode($code, ENT_QUOTES); // decode text in code block as GeSHi will re-encode it.

        if (isset($this->containerMap[$tagName])) {
            $patt = '/' . preg_quote($tagName) . '/';
            $openTag = preg_replace($patt, $this->containerMap[$tagName][0], $openTag);
            $closeTag = preg_replace($patt, $this->containerMap[$tagName][1], $closeTag);
        }

        if ($this->showPlainTextButton) {
            $button = '<a href="#null" class="geshi-plain-text">Show Plain Text</a>';
            $openTag = $button . $openTag;
        }

        if ($lang) {
            $highlighted = $this->highlightText(trim($code), $lang);
            return $openTag . $highlighted . $closeTag;
        }
        return $openTag . $code . $closeTag;
    }
1230234
protected static function h(array $matches)
    {
        $level = strlen($matches[1]);
        return sprintf('<h%d>%s</h%d>', $level, trim($matches[2]), $level);
    }
734019
protected function _replace($matches)
    {
        $required = empty($matches[2]) ? $matches[4] : $matches[2];
        $filename = $this->scanner()->find($required);
        if (!$filename) {
            throw new RuntimeException(sprintf('Could not find dependency "%s"', $required));
        }
        if (empty($this->_loaded[$filename])) {
            return $this->input($filename, file_get_contents($filename));
        }
        return '';
    }
401997
private function replaceId($matches)
    {
        $match = $matches[0];
        $id = "##r" . uniqid() . "##";

        // String or Comment?
        if (substr($match, 0, 2) == '//' || substr($match, 0, 2) == '/*' || substr($match, 0, 2) == '##' || substr($match, 0, 7) == '&lt;!--') {
            $this->tokens[$id] = '<span class="exception-comment">' . $match . '</span>'; // #7F9F7F
        } else {
            $this->tokens[$id] = '<span class="exception-string">' . $match . '</span>'; // #CC9385
        }
        return $id;
    }
1187036
public function render($matches)
    {
        // Compile the shortcode
        $compiled = $this->compileShortcode($matches);
        $name = $compiled->getName();
        $viewData = $this->_viewData;

        // Render the shortcode through the callback
        return call_user_func_array($this->getCallback($name), [
            $compiled,
            $compiled->getContent(),
            $this,
            $name,
            $viewData
        ]);
    }
140718
protected function decodeMatches(array $matches): string
    {
        if (1 === preg_match(static::REGEXP_PREVENTS_DECODING, $matches[0])) {
            return strtoupper($matches[0]);
        }

        return rawurldecode($matches[0]);
    }
1093507
public function compile($matches)
    {
        if ($matches[1] == '$') {
            $matches[2] = '$' . $matches[2];
        }

        $variable = $this->compileTernaryOperators($this->compiler->stringDotsToArrayKeys($matches[2]));

        $whitespace = empty($matches[4]) ? '' : $matches[4] . $matches[4];

        if (! empty($matches[3])) {
            $function = $matches[3];

            if (strpos($function, ":") !== false) {
                list($function, $args) = explode(":", $function, 2);

                $function .= "({$variable},{$args}";
            } else {
                $function .= "({$variable}";
            }

            $function .= ")";

            $variable = $function;
        }

        return $this->compiler->wrap("echo tplEscape({$variable})") . $whitespace;
    }
643685
public function renderMatchers(array $matchers): string
    {
        if (count($matchers) < 1) {
            return '<none>';
        }

        $rendered = [];

        foreach ($matchers as $matcher) {
            $rendered[] = $matcher->describe($this->exporter);
        }

        return implode(', ', $rendered);
    }
852430
protected function replace(array $match): string
    {
        $character = $this->getOption('character');
        $mention = Str::title(str_replace($character, '', trim($match[0])));

        $route = config('mentions.pools.' . $this->getOption('pool') . '.route');

        $link = $route . $mention;

        return " [{$character}{$mention}]($link)";
    }