Recursively replaces special escape characters for line breaks and tabs with according characters.

@param mixed $input
@return mixed
174815
protected function replaceSpecialChars($input)
	{
		if(is_array($input))
		{
			$result = [];
			
			foreach($input as $k => $v)
			{
				$result[$k] = $this->replaceSpecialChars($v);
			}
			
			return $result;
		}
		
		return strtr($input, [
			'\n' => "\n",
			'\t' => "\t"
		]);
	}
1096960
public function removeEmptyInput($input)
    {
        $filterableInput = [];

        foreach ($input as $key => $val) {
            if ($val !== '' && $val !== null) {
                $filterableInput[$key] = $val;
            }
        }

        return $filterableInput;
    }
234164
public static function toUnderscoreVariable($input)
	{
	    // from camel case to the underscores separated lower string.
	    $input = self::fromCamelCase($input, false);
	    $input = strtolower(self::toUnderscoreSeparated($input));
	    $input = str_replace('\\_', '\\', str_replace('/_', '/', $input));
	    return $input;
	}
1141650
public function sanitize($input)
    {
        foreach ($this->rawRules as $rule) {
            if ($rule instanceof Attributes) {
                $config = [
                    'remainder' => $this->remainder,
                    'recursive' => $this->recursive
                ];
                Instance::configure($rule, $config);
                return $rule->sanitize($input);
            }
            $input = $rule->sanitize($input);

            if ($rule->recursive && (is_array($input) || is_object($input))) {
                $config['attributes'] = $this;
                return (new Attributes($config))->sanitize($input);
            }
        }

        return $input;
    }
1086939
public function sanitize( $input ) {
		$new_input = [];
		foreach ( array_keys( (array) $input ) as $id ) {
			$new_input[ sanitize_file_name( $id ) ] = sanitize_text_field( $input[ $id ] );
		}

		return $new_input;
	}
1350385
protected function toCamelCase($input)
    {
        $input = str_replace('_', ' ', $input);
        $input = ucwords($input);

        return str_ireplace(' ', '', $input);
    }
871028
public static function toCamelCase($input)
    {
        // Convert words to uppercase and then remove spaces.
        $input = self::toSpaceSeparated($input);
        $input = ucwords($input);
        $input = str_ireplace(' ', '', $input);

        return $input;
    }
486
protected static function deleteMarks(string $input): string
    {
        return preg_replace(
            '/\\p{M}+/u',
            '',
            \Normalizer::normalize($input, \Normalizer::FORM_KD)
        );
    }
202701
public function encode($input)
    {
        $chars = [
            '&#x102;' => 'a',
            '&#x103;' => 'a',
            '&#xC2;' => 'A',
            '&#xE2;' => 'a',
            '&#xCE;' => 'I',
            '&#xEE;' => 'i',
            '&#x218;' => 'S',
            '&#x219;' => 's',
            '&#x15E;' => 'S',
            '&#x15F;' => 's',
            '&#x21A;' => 'T',
            '&#x21B;' => 't',
            '&#354;' => 'T',
            '&#355;' => 't'
        ];

        $change = $with = [];
        foreach ($chars as $i => $v) {
            $change[] = html_entity_decode($i, ENT_QUOTES, 'UTF-8');
            $with[] = $v;
        }
        $input = str_replace($change, $with, $input);

        preg_match_all("/[a-z0-9]+/i", $input, $sections);
        return strtolower(implode("-", $sections[0]));
    }
400623
private function inputInOpenStringOrComment($input)
    {
        if (!$this->hasCode()) {
            return;
        }

        $code = $this->codeBuffer;
        \array_push($code, $input);
        $tokens = @\token_get_all('<?php ' . \implode("\n", $code));
        $last = \array_pop($tokens);

        return $last === '"' || $last === '`' ||
            (\is_array($last) && \in_array($last[0], [T_ENCAPSED_AND_WHITESPACE, T_START_HEREDOC, T_COMMENT]));
    }
204062
public function convert($input)
    {
        if (is_string($input) === false) {
            throw new \InvalidArgumentException('Expected a string value at Parsedown converter.');
        }

        $converter = new \ParsedownExtra();

        return $converter->text($input);
    }
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
        );
    }
247587
public static function cleanSpaces($input)
    {
        $nonbreaking_space = chr(0xC2) . chr(0xA0);
        $search_spaces = ['<p>&nbsp;</p>', '&nbsp;', $nonbreaking_space, ' '];
        $replace_spaces = ['', ' ', ' ', ' '];
        $out = str_replace($search_spaces, $replace_spaces, $input);
        $out = trim(preg_replace('/\s{2,}/', ' ', $out));
        return $out;
    }
1282386
protected function validator($input)
    {
        $this->checkValue($input);

        if ($this->hasErrors()) {
            return '';
        }

        if (!$input) {
            if ($this->mandatory) {
                $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['mandatory'], $this->strLabel));
            }

            return '';
        } elseif (false === strpos($input, ',')) {
            return $this->multiple ? [(int) $input] : (int) $input;
        }
        $arrValue = array_map('intval', array_filter(explode(',', $input)));

        return $this->multiple ? $arrValue : $arrValue[0];
    }
761282
protected function _uudecode($input)
    {
        $decoded = '';

        foreach (explode("\n", $input) as $line) {
            $c = count($bytes = unpack('c*', substr(trim($line,"\r\n\t"), 1)));

            while ($c % 4) {
                $bytes[++$c] = 0;
            }

            foreach (array_chunk($bytes, 4) as $b) {
                $b0 = ($b[0] == 0x60) ? 0 : $b[0] - 0x20;
                $b1 = ($b[1] == 0x60) ? 0 : $b[1] - 0x20;
                $b2 = ($b[2] == 0x60) ? 0 : $b[2] - 0x20;
                $b3 = ($b[3] == 0x60) ? 0 : $b[3] - 0x20;

                $b0 <<= 2;
                $b0 |= ($b1 >> 4) & 0x03;
                $b1 <<= 4;
                $b1 |= ($b2 >> 2) & 0x0F;
                $b2 <<= 6;
                $b2 |= $b3 & 0x3F;

                $decoded .= pack('c*', $b0, $b1, $b2);
            }
        }

        return rtrim($decoded, "\0");
    }
707241
protected function convertToValidCharacters(string $input): string
    {
        $converted = preg_replace(
            '/[\\p{C}\\p{Z}\\p{M}]+/u',
            '',
            \Normalizer::normalize(str_replace('～', '〜', $input), \Normalizer::FORM_KC)
        );
        if ($this->isRegExp($converted)) {
            $converted = trim($converted, '/');
        }
        return $converted;
    }
153293
private function parse($input)
    {
        $in_comment = false;

        $in_single_quote = false;
        $in_double_quote = false;

        $skip_char = [
            '{', '}', '[', ']', '>',
            '(', ')', ':', ';', ',',
            '+', '=', '~', '"', "'"
        ];

        $input = str_replace(["\r\n", "\r"], "\n", $input);
        $output = '';

        for ($i = 0;$i < strlen($input);$i++) {
            $char = substr($input, $i, 1);
            $pre_input_char = $i != 0 ? substr($input, $i - 1, 1) : null;
            $pre_output_char = substr($output, -1);

            /**
             * Handle comment block and check end tag
             */
            if ($in_comment) {
                if ('*/' === $pre_input_char . $char) {
                    $in_comment = false;
                }

                continue;
            }

            /**
             * Handle quote block and check end tag
             */
            if ($in_single_quote) {
                if ("'" === $char && '\\' !== $pre_output_char) {
                    $in_single_quote = false;
                }

                $output .= $char;
                continue;
            }

            if ($in_double_quote) {
                if ('"' === $char && '\\' !== $pre_output_char) {
                    $in_double_quote = false;
                }

                $output .= $char;
                continue;
            }

            /**
             * Check start tag of comment block
             */
            if ('/*' === $pre_output_char . $char) {
                $in_comment = true;

                $output = substr($output, 0, strlen($output) - 1);
                continue;
            }

            /**
             * Check start tag of quote block
             */
            if ("'" === $char) {
                if (' ' === $pre_output_char) {
                    $output = substr($output, 0, strlen($output) - 1);
                }

                $in_single_quote = true;

                $output .= $char;
                continue;
            }

            if ('"' === $char) {
                if (' ' === $pre_output_char) {
                    $output = substr($output, 0, strlen($output) - 1);
                }

                $in_double_quote = true;

                $output .= $char;
                continue;
            }

            /**
             * Handle normal block
             */
            if ("\n" === $char || "\t" === $char) {
                continue;
            }

            if (' ' === $char && ' ' === $pre_output_char) {
                continue;
            }

            if (' ' === $char && in_array($pre_output_char, $skip_char)) {
                continue;
            }

            if (' ' === $pre_output_char && in_array($char, $skip_char)) {
                $output = substr($output, 0, strlen($output) - 1);
            }

            if ('(' === $char && 'and' === substr($output, -3)) {
                $char = ' (';
            }

            $output .= $char;
        }

        return trim($output);
    }