Display HTML code from a Pug input or a Pug file.

@param string $input    pug input or file
@param array  $vars     to pass to the view
@param string $filename optional file path

@throws \Exception

@return string
974777
public function display($input, array $vars = [], $filename = null)
    {
        if ($this->stringCanBeLoadedAsFile($input)) {
            echo $this->renderFile($input, $vars);

            return;
        }

        $this->displayString($input, $vars, $filename);
    }
628039
public function input($filename, $input)
    {
        if (substr($filename, strlen($this->_settings['ext']) * -1) !== $this->_settings['ext']) {
            return $input;
        }
        if (!class_exists('Leafo\\ScssPhp\\Compiler')) {
            throw new \Exception(sprintf('Cannot not load filter class "%s".', 'Leafo\\ScssPhp\\Compiler'));
        }
        $sc = new Compiler();
        $sc->addImportPath(dirname($filename));
        return $sc->compile($input);
    }
437149
public function render($string, array $vars = array())
    {
        $fileName = uniqid(time(), false);
        $this->generateDirectoryStructure(storage_path(), [ 'caffeinated/stubs' ]);
        $path = storage_path("caffeinated/stubs/{$fileName}");
        $this->files->put($path, $this->compiler->compileString($string));

        if (is_array($vars) && ! empty($vars)) {
            extract($vars);
        }

        ob_start();
        include($path);
        $var = ob_get_contents();
        ob_end_clean();

        $this->files->delete($path);

        return $var;
    }
1007473
public function validatePropertyClass($input)
    {
        list($bundle, $document) = $this->parseShortcutNotation($input);

        try {
            $bundlePath = $this->getContainer()->get('kernel')->getBundle($bundle)->getPath();
        } catch (\Exception $e) {
            throw $this->getException('Bundle "%s" does not exist.', [$bundle]);
        }

        if (!file_exists($bundlePath . '/Document/' . str_replace('\\', '/', $document) . '.php')) {
            throw $this->getException('Document "%s:%s" does not exist.', [$bundle, $document]);
        }

        return $input;
    }
1332027
public function formatString($input)
    {
        if (is_array($input)) {
            $input = join(', ', $input);
        }
        $output = strip_tags($input);
        $output = str_replace(array("\r", "\n"), array(' ', ' '), $output);
        
        $output = $this->filterCsvInjection($output);
        
        return $output;
    }
1041684
public function translate($string, Array $vars = array())
    {
        // Use custom translator
        if ($this->translator) {
            return $this->translator($this->getString($string), $vars);
        }

        return $this->compileString($this->getString($string), $vars);
    }
799863
public function output($filename, $input)
    {
        $env = array('NODE_PATH' => $this->_settings['node_path']);

        $tmpfile = tempnam(sys_get_temp_dir(), 'miniasset_css_compressor');
        $this->generateScript($tmpfile, $input);

        $cmd = $this->_settings['node'] . ' ' . $tmpfile;
        return $this->_runCmd($cmd, '', $env);
    }
745580
public static function escapeInput(string $input): string
    {
        $escaped_input = htmlspecialchars(stripslashes(trim($input)));
        return $escaped_input;
    }
768711
public static function unXSS($input)
    {
        $return = '';
        if (version_compare(phpversion(), '5.4', '<')) {
            $return = htmlspecialchars($input);
        } else {
            $return = htmlentities($input, ENT_QUOTES | ENT_DISALLOWED | static::$outputLanguage);
        }

        return $return;
    }
63751
protected function prepareInputFilesForParsing(array $input = [])
    {
        $parse = [];
        foreach ($input as $in) {
            $less = realpath(WWW_ROOT . $in);
            // If we have plugin notation (Plugin.less/file.less)
            // ensure to properly load the files
            list($plugin, $basefile) = $this->_View->pluginSplit($in, false);
            if (!empty($plugin)) {
                $less = realpath(Plugin::path($plugin) . 'webroot' . DS . $basefile);

                if ($less !== false) {
                    $parse[$less] = $this->assetBaseUrl($plugin, $basefile);
                    continue;
                }
            }
            if ($less !== false) {
                $parse[$less] = '';
                continue;
            }
            // Plugins without plugin notation (/plugin/less/file.less)
            list($plugin, $basefile) = $this->assetSplit($in);
            if ($file = $this->pluginAssetFile([$plugin, $basefile])) {
                $parse[$file] = $this->assetBaseUrl($plugin, $basefile);
                continue;
            }

            // Will probably throw a not found error
            $parse[$in] = '';
        }

        return $parse;
    }
1167006
public static function linkXHTMLSafe($input)
    {
        $regex = 'href="([^"]*(&(amp;){0})[^"]*)*?"';

        return preg_replace_callback(
            "#$regex#i",
            function ($m) {
                $rx = '&(?!amp;)';

                return preg_replace('#' . $rx . '#', '&amp;', $m[0]);
            },
            $input
        );
    }
442425
public function render(Renderable $input, array &$data = null, array $shared = null) : string
    {
        return $this->parsedown->text(parent::render($input, $data, $shared));
    }
132551
static function get($var, $filename = '')
	{

		if ($filename) {
			$config_data = self::load($filename);
			if (!isset($config_data[$var])) throw new \Exception("Config value \"$var\" not found in file '$filename'.");
			return $config_data[$var];
		}

		if (!isset(self::$stack[$var])) throw new \Exception("Config value \"$var\" not found. (Looking in Global Stack)");
		return (isset(self::$stack[$var])) ? self::$stack[$var] : false;
	}
619582
static function read_file_to_string($filename)
    {
        $output = false;
        try {
            $output = file_get_contents($filename);
        } catch (Exception $e) {
            echo ('Error reading file: '.var_export($e, true).PHP_EOL);
            die();
        }
        return $output;
    }
100292
protected function parse($input): string
    {
        if (!is_array($input)) {
            return json_encode($input);
        }

        $parsed = "";
        foreach ($input as $key => $value) {
            $key = (!is_numeric($key) ? ($key . ": " ) : '');
            if (!is_array($value)) {
                $parsed .= $key . $this->parse($value) . ', ';
            } elseif (is_null(key($value)) || is_numeric(key($value))) {
                $parsed .= $key . "[" . $this->parse($value) . "], ";
            } else {
                $parsed .= $key . "{" . $this->parse($value) . "}, ";
            }
        }

        return rtrim($parsed, ', ');
    }
1098762
private function prepare(string $input)
    {
        $this->input = str_replace(["\n\r", "\r"], "\n", $input);

        // Create new token stream
        $this->stream = new TokenStream();

        $this->cursor = 0;
        $this->line = 1;
        $this->lineOffset = 0;
        $this->end = strlen($this->input);
        $this->lastCharPos = $this->end - 1;

        $this->currentChar = '';
        $this->currentValue = '';
        $this->modeStartChar = '';
        $this->modeStartPosition = 0;
        $this->modeStartLine = 0;

        // Set the mode to "ALL"
        $this->setMode(self::MODE_ALL);
    }
169034
function _ucs4_to_ucs4_string($input)
    {
        $output = '';
        // Take array values and split output to 4 bytes per value
        // The bit mask is 255, which reads &11111111
        foreach ($input as $v) {
            $output .= chr(($v >> 24) & 255).chr(($v >> 16) & 255).chr(($v >> 8) & 255).chr($v & 255);
        }
        return $output;
    }