Decode HTML entities to equivalent characters
@return string
@param $arg mixed
960264
function raw($arg) {
		return $this->fw->recursive($arg,
			function($val) {
				return is_string($val)?$this->fw->decode($val):$val;
			}
		);
	}
1205521
private function escapeArgs(&$args) {
    $escaped = array();
    foreach ($args as $arg) {
      $escaped[] = escapeshellarg($arg);
    }
    return $escaped;
  }
335682
def decode_entities(html):
    
    def decode(m):
        html = m.group(0)
        if html[:2] == "&#":
            try:
                if html[:3] == "&#x":
                    return chr(int(html[3:-1], 16))
                else:
                    return chr(int(html[2:-1]))
            except ValueError:
                pass
        else:
            try:
                html = chr(name2codepoint[html[1:-1]])
            except KeyError:
                pass
        return html
    return re.sub("&#?\w+;", decode, html.replace("&amp;", "&"))
1076786
public function plain($html)
    {
        $plain = preg_replace('#<br\s*/?>#iu', "\n", $html);
        $plain = strip_tags($plain);
        $plain = html_entity_decode($plain, ENT_QUOTES | ENT_HTML5);

        return $plain;
    }
614028
public static function dumpVars(...$args): string
    {
        \ob_start();
        \var_dump(...$args);
        $string = \ob_get_clean();

        return \preg_replace("/=>\n\s+/", '=> ', $string);
    }
79020
protected function parseAttributes( array $args )
	{
		if( empty( $args['attributes'] )) {
			return [];
		}

		$attributes = (array) $args['attributes'];

		foreach( $attributes as $key => $value ) {
			if( is_string( $key ))continue;
			unset( $attributes[ $key ] );
			if( !isset( $attributes[ $value ] )) {
				$attributes[ $value ] = '';
			}
		}

		return $attributes;
	}
721852
private function _strtoupper($str)
    {
        $str = html_entity_decode($str, ENT_COMPAT, $this->charset);
        $str = mb_strtoupper($str);
        $str = htmlspecialchars($str, ENT_COMPAT, $this->charset);

        return $str;
    }
736546
private function filterQueryAndFragment($arg) : string
    {
        if (!is_string($arg)) {
            throw new \InvalidArgumentException('Query and fragment must be a string');
        }

        $unreservedCharacter = preg_quote($this->unReservedCharacter, '/');
        $characterSubDelimiter = preg_quote($this->characterSubDelimiter, '/');
        return preg_replace_callback(
            '/(?:[^' . $unreservedCharacter . $characterSubDelimiter . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/',
            [$this, 'rawURLEncodeMatchZero'],
            $arg
        );
    }
1139244
public static function _describeArg($arg)
    {
        if (is_array($arg)) {
            return sprintf('array[%d]', count($arg));
        }
        if (is_object($arg)) {
            return sprintf('object[%s]', get_class($arg));
        }

        return Text::toString($arg);
    }
1204868
function parseDSN_args($args) {
     	$retn = array();
     	foreach(explode("&",$args) as $arg) {
     	 	list($key,$val) = explode("=",trim($arg));
     	 	$retn[$key] = $val;
     	 	unset($key,$val);
     	}
     	return $retn;
    }
1298062
public function decode(string $data): string
    {
        $this->validateInput($data);

        $data = str_split($data);
        $data = array_map(function ($character) {
            return strpos($this->options["characters"], $character);
        }, $data);

        $leadingZeroes = 0;
        while (!empty($data) && 0 === $data[0]) {
            $leadingZeroes++;
            array_shift($data);
        }

        $converted = $this->baseConvert($data, 62, 256);

        if (0 < $leadingZeroes) {
            $converted = array_merge(
                array_fill(0, $leadingZeroes, 0),
                $converted
            );
        }

        return implode("", array_map("chr", $converted));
    }
487684
public function decode($str)
	{
		if ($this->decodeHtmlEntities && strpos($str, '&') !== false)
		{
			$str = html_entity_decode($str, ENT_QUOTES, 'UTF-8');
		}
		$str = str_replace("\x1A", '', $str);

		if ($this->hasEscapedChars)
		{
			$str = strtr(
				$str,
				[
					"\x1B0" => '!', "\x1B1" => '"', "\x1B2" => "'", "\x1B3" => '(',
					"\x1B4" => ')', "\x1B5" => '*', "\x1B6" => '[', "\x1B7" => '\\',
					"\x1B8" => ']', "\x1B9" => '^', "\x1BA" => '_', "\x1BB" => '`',
					"\x1BC" => '~'
				]
			);
		}

		return $str;
	}
861008
function raw($arg) {
        $fw=Base::instance();
        return $fw->recursive($arg,
            function($val) use($fw) {
                return is_string($val)?$fw->decode($val):$val;
            }
        );
    }
1279980
public function decode($data)
    {
        $out = array();

        $this->_data = $data;
        $this->_datalen = strlen($data);
        $this->_ptr = 0;

        while ($this->_curr() !== false) {
            $this->_rfc822SkipLwsp();

            $this->_rfc822ParseMimeToken($param);

            if (is_null($param) || ($this->_curr() != '=')) {
                break;
            }

            ++$this->_ptr;
            $this->_rfc822SkipLwsp();

            $value = '';

            if ($this->_curr() == '"') {
                try {
                    $this->_rfc822ParseQuotedString($value);
                } catch (Horde_Mail_Exception $e) {
                    break;
                }
            } else {
                $this->_rfc822ParseMimeToken($value);
                if (is_null($value)) {
                    break;
                }
            }

            $out[$param] = $value;

            $this->_rfc822SkipLwsp();
            if ($this->_curr() != ';') {
                break;
            }

            ++$this->_ptr;
        }

        return $out;
    }
151846
public static function xss_entity_decode($content)
    {
        $callback = function($matches) { return chr(hexdec($matches[1])); };

        $out = html_entity_decode(html_entity_decode($content));
        $out = trim(preg_replace('/(^<!--|-->$)/', '', trim($out)));
        $out = preg_replace_callback('/\\\([0-9a-f]{2,6})\s*/i', $callback, $out);
        $out = preg_replace('/\\\([^0-9a-f])/i', '\\1', $out);
        $out = preg_replace('#/\*.*\*/#Ums', '', $out);
        $out = strip_tags($out);

        return $out;
    }
480711
private static function htmlEncodingCallback($matches)
    {
        $characterIndex = 1;
        $entities = '';

        $codes = unpack('C*', htmlentities($matches[0], ENT_COMPAT, 'UTF-8'));

        while (isset($codes[$characterIndex])) {
            if (0x80 > $codes[$characterIndex]) {
                $entities .= chr($codes[$characterIndex++]);

                continue;
            }

            if (0xF0 <= $codes[$characterIndex]) {
                $code = (($codes[$characterIndex++] - 0xF0) << 18) + (($codes[$characterIndex++] - 0x80) << 12) + (($codes[$characterIndex++] - 0x80) << 6) + $codes[$characterIndex++] - 0x80;
            } elseif (0xE0 <= $codes[$characterIndex]) {
                $code = (($codes[$characterIndex++] - 0xE0) << 12) + (($codes[$characterIndex++] - 0x80) << 6) + $codes[$characterIndex++] - 0x80;
            } else {
                $code = (($codes[$characterIndex++] - 0xC0) << 6) + $codes[$characterIndex++] - 0x80;
            }

            $entities .= '&#' . $code . ';';
        }

        return $entities;
    }
433452
def decode(arg, delimiter=None, encodeseq=None):
    ''''''
    arg = coerce_unicode(arg, _c.FSQ_CHARSET)
    new_arg = sep = u''
    delimiter, encodeseq = delimiter_encodeseq(
        _c.FSQ_DELIMITER if delimiter is None else delimiter,
        _c.FSQ_ENCODE if encodeseq is None else encodeseq,
        _c.FSQ_CHARSET)

    # char-wise decode walk -- minimally stateful
    encoding_trg = sep
    for c in arg:
        if len(encoding_trg):
            encoding_trg = sep.join([encoding_trg, c])
            if 4 !=  len(encoding_trg):
                continue
            try:
                c = chr(int(encoding_trg, 16))
            except ValueError:
                raise FSQEncodeError(errno.EINVAL, u'invalid decode'\
                                     u' target: {0}'.format(encoding_trg))
            c = coerce_unicode(c, _c.FSQ_CHARSET)
            encoding_trg = sep
        elif c == encodeseq:
            encoding_trg = u'0x'
            continue

        new_arg = sep.join([new_arg, c])

    # edge case, incomplete encoding at end of string
    if len(encoding_trg):
        raise FSQEncodeError(errno.EINVAL, u'truncated encoding at end of'
                             u' argument: {0}'.format(encoding_trg))

    return new_arg