Create a stream wrapper to allow
the possibility to add $scope variables
@param $input
@return string
960365
public function stream($input)
    {
        if (false === static::$isWrapperRegistered)
        {
            static::$isWrapperRegistered = true;
            stream_wrapper_register($this->options['stream'], 'Jade\Stream\Template');
        }

        return $this->options['stream'].'://data;'.$this->compile($input);
    }
789738
private function addInput($parent, $input = true)
    {
        $name = $input ? 'wsdl:input' : 'wsdl:output';
        $tag = $this->addElement($name, $parent);
        $soapOperation = $this->addElement('soap:body', $tag);
        $soapOperation->setAttribute('use', ($this->use == SOAP_ENCODED) ? 'encoded' : 'literal');
        $soapOperation->setAttribute('namespace', $this->tns);
        if ($this->use == SOAP_ENCODED) {
            $soapOperation->setAttribute('encodingStyle', self::NS_ENC);
        }
    }
346131
public static function toHtmlEntity($input)
    {
        if(is_array($input)){
            foreach ($input as $key=>$value){
                $input[$key]=self::toHtmlEntity($value);
            }
        }else if(is_object($input)){
            $array=get_object_vars($input);
            foreach ($array as $key=>$value){
                $input->$key=self::toHtmlEntity($value);
            }
        }else{
            $input=htmlspecialchars($input);
        }

        return $input;
    }
560484
public function serialise($input)
    {
        $writer = Writer::createFromString('');

        if (is_array(reset($input))) {
            $writer->insertOne(array_keys(reset($input)));
        } else {
            $writer->insertOne(array_keys($input));
        }

        if (is_array(reset($input))) {
            $writer->insertAll($input);
        } else {
            $writer->insertOne($input);
        }

        return $writer->__toString();
    }
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, ', ');
    }
62007
public static function urlsafeB64Decode(string $input): string
    {
        $remainder = strlen($input) % 4;
        if ($remainder) {
            $padlen = 4 - $remainder;
            $input .= str_repeat('=', $padlen);
        }

        return base64_decode(strtr($input, '-_', '+/'));
    }
684340
private function dilemma($input = null, $from = false) {
        // calculate from and to
        list($plugin, $from) = $this->_View->pluginSplit($from, false);
        $from = Configure::read('App.cssBaseUrl') . $from;
        if(isset($plugin))
            $from = Inflector::underscore($plugin) . '/' . $from;

        // start converter
        $converter = new Converter("/{$from}-fake-file.css", "{$this->_config['paths']['css']}/cache-fake-file.css");

        // fix paths
        return $this->morph($input, function($url) use($converter) {
            return $converter->convert($url);
        });
    }
260430
protected static function Base64UrlEncode( $input ) {
			/**
			 * IMPORTANT NOTE:
			 * This is a hack suggested by @otto42 and @greenshady from
			 * the theme's review team. The usage of base64 for API
			 * signature encoding was approved in a Slack meeting
			 * held on Tue (10/25 2016).
			 *
			 * @todo Remove this hack once the base64 error is removed from the Theme Check.
			 *
			 * @since 1.2.2
			 * @author Vova Feldman (@svovaf)
			 */
			$fn = 'base64' . '_encode';
			$str = strtr( $fn( $input ), '+/', '-_' );
			$str = str_replace( '=', '', $str );

			return $str;
		}
821102
public function renderString($input, array $vars = [], $filename = null)
    {
        $fallback = function () use ($input, $vars, $filename) {
            return $this->renderWithPhp($input, $vars, $filename);
        };

        if ($this->getDefaultOption('pugjs')) {
            return $this->renderWithJs($input, $filename, $vars, $fallback);
        }

        return call_user_func($fallback);
    }
1089294
public function process($input)
    {
        list($l, $r) = $this->compiler->getDelimiters();

        $rl           = preg_quote($l, '/');
        $rr           = preg_quote($r, '/');
        $sectionParam = '(?:(name|loop|start|step|max|show)\s*=\s*(\S+))?\s*';
        $input        = preg_replace_callback('/' . $rl . '\s*section ' . str_repeat($sectionParam, 6) . '\s*' . $rr . '(.+?)(?:' . $rl . '\s*sectionelse\s*' . $rr . '(.+?))?' . $rl . '\s*\/section\s*' . $rr . '/is', array(
            $this,
            'convertSection'
        ), $input);
        $input        = str_replace('$smarty.section.', '$smarty.for.', $input);

        $smarty = array(
            '/' . $rl . '\s*ldelim\s*' . $rr . '/',
            '/' . $rl . '\s*rdelim\s*' . $rr . '/',
            '/' . $rl . '\s*\$smarty\.ldelim\s*' . $rr . '/',
            '/' . $rl . '\s*\$smarty\.rdelim\s*' . $rr . '/',
            '/\$smarty\./',
            '/' . $rl . '\s*php\s*' . $rr . '/',
            '/' . $rl . '\s*\/php\s*' . $rr . '/',
            '/\|(@?)strip(\||' . $rr . ')/',
            '/' . $rl . '\s*sectionelse\s*' . $rr . '/',
        );

        $dwoo = array(
            '\\' . $l,
            $r,
            '\\' . $l,
            $r,
            '$dwoo.',
            '<?php ',
            ' ?>',
            '|$1whitespace$2',
            $l . 'else' . $r,
        );

        if (preg_match('{\|@([a-z][a-z0-9_]*)}i', $input, $matches)) {
            trigger_error('The Smarty Compatibility Module has detected that you use |@' . $matches[1] . ' in your template, this might lead to problems as Dwoo interprets the @ operator differently than Smarty, see http://wiki.dwoo.org/index.php/Syntax#The_.40_Operator', E_USER_NOTICE);
        }

        return preg_replace($smarty, $dwoo, $input);
    }
1136956
public static function jsonEncode($input)
    {
        $json = json_encode($input);
        if (function_exists('json_last_error') && $errno = json_last_error()) {
            JWT::_handleJsonError($errno);
        } else if ($json === 'null' && $input !== null) {
            throw new \DomainException('Null result with non-null input');
        }
        return $json;
    }
4990
public function filter(string $input): string
    {
        // 解析
        $body = $this->parse($input);
        if (!$body) {
            return '';
        }
        
        // beforeコールバック関数の実行
        if (isset($this->options['before']) && call_user_func($this->options['before'], $body) === false) {
            return '';
        }
        
        // 全ノードの走査
        $parent = $body;
        $previous = null;
        $current = $parent->firstChild;

        $html = $body->parentNode;
        while ($parent !== $html) {
            while ($current) {
                if ($this->filterNode($current)) {
                    // ノードが取り除かれたら
                    // 次の同胞に移動
                    $current = $previous ? $previous->nextSibling : $parent->firstChild;
                } else {
                    // 子に移動
                    $parent = $current;
                    $previous = null;
                    $current = $parent->firstChild;
                }
            }

            // 親に移動
            $previous = $parent;
            $current = $parent->nextSibling;
            $parent = $parent->parentNode;
        }
        
        // afterコールバック関数の実行
        if (isset($this->options['after']) && call_user_func($this->options['after'], $body) === false) {
            return '';
        }
        
        // 直列化
        $fragment = $body->ownerDocument->createDocumentFragment();
        while ($body->hasChildNodes()) {
            $fragment->appendChild($body->firstChild);
        }
        return (new html5\HTML5())->saveHTML($fragment);
    }
994008
public function onInput($input)
    {
        foreach ($this->loopListeners as $listeners) {
            if (($return = $listeners->onInput($this, $input)) !== null) {
                $input = $return;
            }
        }

        return $input;
    }
761110
public function tokenize(string $input) : TokenStream
    {
        $this->prepare($input);

        // Loop each character
        while ($this->cursor < $this->end) {
            $this->currentChar = $this->input[$this->cursor];

            if (preg_match('@'.Token::REGEX_T_EOL.'@', $this->currentChar)) {
                if ($this->mode !== self::MODE_IDENT) {
                    ++$this->line;
                    $this->lineOffset = $this->cursor + 1;
                }
            }

            switch ($this->mode) {

                case self::MODE_ALL:
                    $this->lexAll();
                    break;
                case self::MODE_INSIDE_TAG:
                    $this->lexInsideTag();
                    break;
                case self::MODE_IDENT:
                    $this->lexIdent();
                    break;
                case self::MODE_VAR:
                    $this->lexVar();
                    break;
                case self::MODE_STRING:
                    $this->lexString();
                    break;
                case self::MODE_NUMBER:
                    $this->lexNumber();
                    break;
                case self::MODE_OP:
                    $this->lexOperator();
                    break;
            }
        }

        return $this->stream;
    }
211541
function(input) {
  var code = 'var $_isidentifier = ' + $_isidentifier.toString() + ';\n' +
    // FIXME: could we remove that eval?
    'eval((' + literaltovar.toString() + ')($_scope));\n';
  code += 'var $_parsers = {\n';
  var parsernames = Object.keys(parsers);
  for (var i = 0; i < parsernames.length; i++) {
    code += '  ' + JSON.stringify(parsernames[i]) + ': ' +
      parsers[parsernames[i]].toString() + ',\n';
  };
  code += '}\n';
  code += 'var $_written = "";\n' +
          'var $_write = function(data) { $_written += data; };\n';
  code += compile(input);
  code += '$_written\n';
  return function($_write, $_scope, timeout, cb) {
    var res;
    try {
      res = vm.runInNewContext(code, {$_scope: $_scope},
          {timeout: timeout || 1000});
    } catch(err) {
      console.error(err); $_write('');
      if (cb) { cb(err); }
      return;
    }
    $_write(res);
    if (cb) { cb(null); }
  };
}
741836
private function withParam( string$input )
	{
		return str_replace('$_FLAG_$',"__HTSL_CTRL_FLAG_{$this->id}__",preg_replace_callback('/(?<!%)%s((?:\\/.+?(?<!\\\\)\\/.+?(?<!\\\\)\\/)+)?/',function( array$matches ){
			$param= $this->param;

			if( isset($matches[1]) ){
				array_map(...[
					function($replacer)use(&$param){
						list($pattern,$replacement,)= preg_split('/(?<!\\\\)\\//',$replacer);
						$param= preg_replace(...[
							"/$pattern/",
							preg_replace('/^\\\\_$/','',$replacement),
							$param,
						]);
					},
					preg_split(
						'/(?<!\\\\)\\/\\//'
						,
						trim($matches[1],'/')
					),
				]);
			}
			return $param;
		},$input));
	}
1095603
public function addInput($input)
    {
        if ($input === '') {
            return $this;
        }

        // read everything up until before current position
        $pre  = $this->substr($this->linebuffer, 0, $this->linepos);
        $post = $this->substr($this->linebuffer, $this->linepos);

        $this->linebuffer = $pre . $input . $post;
        $this->linepos += $this->strlen($input);

        // only redraw if input should be echo'ed (i.e. is not hidden anyway)
        if ($this->echo !== false) {
            $this->redraw();
        }

        return $this;
    }