Accept Unknown brackets

@return  string
420949
protected function acceptUnknowBrackets()
    {
        $level  = 0;
        $result = '';

        do
        {
            switch ( $this->buffer[0] )
            {
                case '{':
                    $level++;
                    $result .= '{';
                    $this->buffer = substr( $this->buffer, 1 );
                    break;

                case '}':
                    $level--;
                    $result .= '}';
                    $this->buffer = substr( $this->buffer, 1 );
                    break;

                default:
                    $newBuffer = preg_replace(
                        '/^[^\{\}]+/', '',
                        $this->buffer
                    );

                    $result .= substr(
                        $this->buffer,
                        0,
                        strlen( $this->buffer ) - strlen( $newBuffer )
                    );

                    $this->buffer = $newBuffer;
                    break;
            }
        }
        while ( $level > 0 );

        return $result;
    }
261224
public static function getSupportedEncodings()
    {
        if (static::$encodings === null) {
            static::$encodings = array_map('strtoupper', mb_list_encodings());

            // FIXME: Converting € (UTF-8) to ISO-8859-16 gives a wrong result
            $indexIso885916 = array_search('ISO-8859-16', static::$encodings, true);
            if ($indexIso885916 !== false) {
                unset(static::$encodings[$indexIso885916]);
            }
        }

        return static::$encodings;
    }
214277
public function accept()
    {
        if ($this->mode & self::FILTER_BY_PATH) {
            $value = $this->getCurrentResource()->getPath();
        } else {
            $value = $this->getCurrentResource()->getName();
        }

        if ($this->mode & self::MATCH_PREFIX) {
            return 0 === strpos($value, $this->pattern);
        } elseif ($this->mode & self::MATCH_SUFFIX) {
            return $this->pattern === substr($value, -$this->patternLength);
        } else {
            return preg_match($this->pattern, $value);
        }
    }
1270164
public static function getHtmlInputHidden(): string
    {
        static::init();

        if (($parameterName = static::getParameterName()) !== null) {
            $csrfValue = static::getStoredToken()->getToken();
            return sprintf('<input type="hidden" name="%s" value="%s"/>', $parameterName, $csrfValue);
        } else {
            return '';
        }
    }
415100
protected function getNameWithoutPrefix()
    {
        if ($this->isObjectAccessorMode()) {
            $propertySegments = explode('.', $this->arguments['property']);
            $formObjectName = $this->viewHelperVariableContainer->get(\TYPO3\Fluid\ViewHelpers\FormViewHelper::class, 'formObjectName');
            if (!empty($formObjectName)) {
                array_unshift($propertySegments, $formObjectName);
            }
            $name = array_shift($propertySegments);
            foreach ($propertySegments as $segment) {
                $name .= '[' . $segment . ']';
            }
        } else {
            $name = $this->arguments['name'];
        }
        if ($this->hasArgument('value')) {
            /** @var object $value */
            $value = $this->arguments['value'];
            $multiple = $this->hasArgument('multiple') && $this->arguments['multiple'] === true;
            if (!$multiple
                && is_object($value)
                && $this->persistenceManager->getIdentifierByObject($value) !== null
                && (!$this->persistenceManager->isNewObject($value))) {
                $name .= '[__identity]';
            }
        }

        return $name;
    }
225458
public function toValue() {
    $text = $this->getText();
    $quote_char = $text[0];
    $text = substr($text, 1, -1);
    if ($quote_char === '"') {
      $rules = array(
        preg_quote('\\\\') => '\\',
        preg_quote('\n') => "\n",
        preg_quote('\t') => "\t",
        preg_quote('\"') => '"',
        preg_quote('\$') => '$',
        preg_quote('\r') => "\r",
        preg_quote('\v') => "\v",
        preg_quote('\f') => "\f",
        preg_quote('\e') => "\e",
        '\\\\[0-7]{1,3}' => '__octal__',
        '\\\\x[0-9A-Fa-f]{1,2}' => '__hex__',
      );
    }
    else {
      $rules = array(
        preg_quote('\\\\') => '\\',
        preg_quote("\\'") => "'"
      );
    }
    $replacements = array_values($rules);
    $regex = '@(' . implode(')|(', array_keys($rules)) . ')@';
    return preg_replace_callback($regex, function ($matches) use ($replacements) {
      // find the first non-empty element (but skipping $matches[0]) using a quick for loop
      for ($i = 1; '' === $matches[$i]; ++$i);

      $match = $matches[0];
      $replacement = $replacements[$i - 1];
      if ($replacement === '__octal__') {
        $replacement = chr(octdec(substr($match, 1)));
      }
      elseif ($replacement === '__hex__') {
        $replacement = chr(hexdec(substr($match, 2)));
      }
      return $replacement;
    }, $text);
  }
1110807
public static function tld()
	{
		$arr = self::_getConfigArray();
		if (is_empty($arr))
		{
			return '';
		}
		$tld = end($arr);
		return $tld;
	}
203377
public function unknown()
    {
        unset($this->query['server']);
        $this->query['status'] = 'error';
        $result = array('rawdata' => array());
        $result['rawdata'][] = $this->query['errstr'][] = $this->query['query'] . ' domain is not supported';
        $this->checkDns($result);
        $this->fixResult($result, $this->query['query']);
        return $result;
    }
1202695
public function format()
    {
        $this->allowTemplateCode();
        $str = (string) $this->getRequiredParameter('value');

        // InputClean might be all you need but
        // if not, do more stuff after
        $str = $this->InputClean->clean($str, 'p,br');
        $str = $this->InputClean->unAutoParagraph($str);

        // mutant characters inserted by the wysiwyg.
        // a combo capital A, circumflex and non-breaking space
        $tincyMCEHack = chr(194) . chr(160);
        $str = str_replace($tincyMCEHack, '', $str);

        $str = preg_replace("/(\r\n){3,}|(\n|\r){3,}/", "\n\n", $str);
        return trim($str);
    }
90026
protected function _strReplaceOutsideQuotes(){
        
        $re_valid = '/
            # Validate string having embedded quoted substrings.
            ^                           # Anchor to start of string.
            (?:                         # Zero or more string chunks.
              "[^"\\\\]*(?:\\\\.[^"\\\\]*)*"  # Either a double quoted chunk,
            | \'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'  # or a single quoted chunk,
            | [^\'"\\\\]+               # or an unquoted chunk (no escapes).
            )*                          # Zero or more string chunks.
            \z                          # Anchor to end of string.
            /sx';
        if (!preg_match($re_valid, $this->subject)) {
            throw new StringHelperException("Subject string is not valid in the replace_outside_quotes context.");
        }
        $re_parse = '/
            # Match one chunk of a valid string having embedded quoted substrings.
              (                         # Either $1: Quoted chunk.
                "[^"\\\\]*(?:\\\\.[^"\\\\]*)*"  # Either a double quoted chunk,
              | \'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'  # or a single quoted chunk.
              )                         # End $1: Quoted chunk.
            | ([^\'"\\\\]+)             # or $2: an unquoted chunk (no escapes).
            /sx';
        
        return preg_replace_callback($re_parse, array($this, '_strReplaceOutsideQuotesCb'), $this->subject);
    }
27656
public function getAnonymizeed()
	{
		$userinfo = $this->toObject();
		$userinfo->password_clear = '******';
		if (isset($userinfo->password)) {
			$userinfo->password = substr($userinfo->password, 0, 6) . '********';
		}
		if (isset($userinfo->password_salt)) {
			$userinfo->password_salt = substr($userinfo->password_salt, 0, 4) . '*****';
		}
		return $userinfo;
	}
325788
function brackets() {
			for (;;) {
				oToken = that.advance();
				if (!oToken || oToken.id === ';') {
					that.expected("')'", oToken);
				}
				sValue += oToken.value;
				if (oToken.id === ")") {
					return;
				}
				if (oToken.id === "(") {
					brackets();
				}
			}
		}
501237
private function parseNameValue(){

		$index = $this->pos;
		$this->save();


		//$match = $this->MatchReg('/\\G([a-zA-Z\-]+)\s*:\s*((?:\'")?[a-zA-Z0-9\-% \.,!]+?(?:\'")?)\s*([;}])/');
		$match = $this->MatchReg('/\\G([a-zA-Z\-]+)\s*:\s*([\'"]?[#a-zA-Z0-9\-%\.,]+?[\'"]?) *(! *important)?\s*([;}])/');
		if( $match ){

			if( $match[4] == '}' ){
				$this->pos = $index + strlen($match[0])-1;
			}

			if( $match[3] ){
				$match[2] .= ' !important';
			}

			return $this->NewObj4('Less_Tree_NameValue',array( $match[1], $match[2], $index, $this->env->currentFileInfo));
		}

		$this->restore();
	}
476337
protected function acceptEncoding()
	{
		$encoding = false;

		if (!isset($_SERVER['HTTP_ACCEPT_ENCODING']))
		{
			return $encoding;
		}

		if (false !== strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'))
		{
			$encoding = 'gzip';
		}

		if (false !== strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip'))
		{
			$encoding = 'x-gzip';
		}

		return $encoding;
	}
8538
public function parseEncodedString()
    {
        $l = $this->parseEncodedBinary();
        if (($l === null) || ($l === false)) {
            return $l;
        }
        return $this->read($l);
    }
577649
public function getQuotedString() {
    $str = (string) $this;
    
    if (mb_strpos($str, ' ') !== FALSE) {
      return escapeshellarg($str);
    }
    
    return $str;
  }
161794
public function accept()
    {
        $filename = $this->current()->getRealPath();

        if ('\\' === \DIRECTORY_SEPARATOR) {
            $filename = str_replace('\\', '/', $filename);
        }

        return $this->isAccepted($filename);
    }