Cleans up a single or a list of params by stripping HTML encodings

@param string $value

@return string
488718
protected function cleanupParam($value)
    {
        if (is_array($value)) {
            foreach ($value as $k => $v) {
                $clean = $this->cleanupParam($v);
                if (!is_null($clean)) {
                    $value[$k] = $clean;
                }
            }

            return $value;
        } else {
            return preg_replace('/>/', '', preg_replace('/</', '', $value));
        }
    }
431829
public function filter($value)
    {
        if ($value === null) {
            return $value;
        }

        if ($this->characters === null) {
            return trim($value);
        }

        return trim($value, $this->characters);
    }
260937
public function filter($value)
    {
        if (!is_string($value)) {
            return $value;
        }

        // Strip unicode bombs, and make sure all newlines are UNIX newlines.
        $value = preg_replace('{^\xEF\xBB\xBF|\x1A}', '', $value);
        $value = preg_replace('{\r\n?}', "\n", $value);

        $lambda = function($text) {
            $text = htmlspecialchars($text, ENT_COMPAT, 'UTF-8');
            /** @noinspection NotOptimalRegularExpressionsInspection */
            $text = preg_replace('/--/', '&mdash;', $text);
            $text = nl2br($text, false);
            $text = sprintf('<p>%s</p>', $text);

            return $text;
        };

        $paragraphs = preg_split('/\n{2,}/', $value, -1, PREG_SPLIT_NO_EMPTY);
        $paragraphs = array_map($lambda, $paragraphs);

        return implode("\n\n", $paragraphs);
    }
879219
protected function _sanitize($value)
    {
        //strip php tags
        $value = preg_replace('/<\\?.*(\\?>|$)/Us', '', $value);
        $value = parent::_sanitize($value);

        return $value;
    }
783528
public function sanitize( $value = [] ) {
		if ( is_string( $value ) || is_numeric( $value ) ) {
			return [
				sanitize_text_field( $value ),
			];
		}
		$sanitized_value = [];
		foreach ( $value as $sub_value ) {
			if ( isset( $this->choices[ $sub_value ] ) ) {
				$sanitized_value[] = sanitize_text_field( $sub_value );
			}
		}
		return $sanitized_value;
	}
1319767
public function filter($value)
    {
        if ($this->encodingFormat !== null) {
            $firstChar = mb_substr($value, 0, 1, $this->encodingFormat);
            $rest = mb_substr($value, 1, null, $this->encodingFormat);
            return mb_strtoupper($firstChar, $this->encodingFormat) . $rest;
        }

        $firstChar = mb_substr($value, 0, 1);
        $rest = mb_substr($value, 1);

        return mb_strtoupper($firstChar) . $rest;
    }
56120
protected function sanitizeNodeToValue($value)
    {
        $first = strpos($value, '>')+1;
        $last = strrpos($value, '<')-$first;
        $value = substr($value, $first, $last);
        $value = str_replace('"', "'", $value);
        return trim($value);
    }
880537
public function sanitize($value)
    {
        //remove any quotation and replace with whitespace
        $value = preg_replace('/\"/', '', $value);

        //remove any '-' from the string they will be used as concatonater
        $value = str_replace($this->_separator, ' ', $value);

        //convert to ascii characters
        $value = $this->getObject('lib:filter.ascii')->sanitize($value);

        //lowercase and trim
        $value = trim(strtolower($value));

        //remove any duplicate whitespace, and ensure all characters are alphanumeric
        $value = preg_replace(array('/\s+/','/[^A-Za-z0-9\-]/'), array($this->_separator,''), $value);

        //remove repeated occurrences of the separator
        $value = preg_replace('/['.preg_quote($this->_separator, '/').']+/', $this->_separator, $value);

        //limit length
        if (strlen($value) > $this->_length) {
            $value = substr($value, 0, $this->_length);
        }

        //remove unwanted separators from the ends
        $value = trim($value, $this->_separator);

        return $value;
    }
630888
public function filter($value)
    {
        if (!is_string($value)) {
            return $value;
        }
        $value = (string) $value;

        if (null === $this->options['charlist']) {
            return $this->unicodeTrim($value);
        }

        return $this->unicodeTrim($value, $this->options['charlist']);
    }
825494
private function removeTerminationNull(string $value)
    {
        $i = strpos((string)$value, "\0");
        if ($i === false) {
            return $value;
        }

        $result = substr((string)$value, 0, $i);

        return $result;
    }
887634
public static function filterAttribute($value)
    {
        // Check whether current string has already been encoded
        $isEncoded = TextUtils::strModified($value, function($target){
            return self::escape($target);
        });

        // Decode if previous encoded or escaped
        if ($isEncoded) {
            $value = self::charsDecode($value);
        }

        // Convert special characters to make safe use of them
        $value = self::specialChars($value);

        return $value;
    }
1349587
public function unescape($value)
    {
        $callback = function ($matches) {
            return chr(hexdec($matches[1]));
        };

        return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', $callback, $value);
    }
1238889
protected function stripPadding($value)
	{
		$pad = ord($value[($len = strlen($value)) - 1]);

		return $this->paddingIsValid($pad, $value) ? substr($value, 0, strlen($value) - $pad) : $value;
	}
370199
protected function _sanitize($value)
    {
        $value = strip_tags($value);
        // Preserve escaped octets.
        $value = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $value);
        // Remove percent signs that are not part of an octet.
        $value = str_replace('%', '', $value);
        // Restore octets.
        $value = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $value);

        if ($this->_utf8($value)) {
            if (function_exists('mb_strtolower')) {
                $value = mb_strtolower($value, 'UTF-8');
            }
            $value = $this->_utf8encode($value, $this->_slug_length);
        }

        $value = strtolower($value);
        $value = preg_replace('/&.+?;|[^%a-z0-9_-]/', '-', $value); // replace entities and non-alpahnum with dashes
        $value = preg_replace('|-+|', '-', $value);
        $value = trim($value, '-');

        return $value;
    }
53025
public function sanitize($value)
    {
        $result = null;

        // Try to create a transliterator and ensure it actually works
        if (class_exists('Transliterator'))
        {
            try
            {
                // This returns NULL on failure
                $transliterator = Transliterator::create('Any-Latin; [^a-ÿ] Latin-ASCII; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove;');

                // transliterate method returns FALSE on failure
                if ($transliterator && ($sanitized = $transliterator->transliterate($value)) !== false) {
                    $result = $sanitized;
                }
            } catch (Exception $e) {}
        }

        if ($result === null)
        {
            $result = htmlentities(utf8_decode($value), ENT_SUBSTITUTE);
            $result = preg_replace(
                array('/&szlig;/','/&(..)lig;/', '/&([aouAOU])uml;/','/&(.)[^;]*;/'),
                array('ss',"$1","$1".'e',"$1"),
                $result);
        }

        return $result;
    }
325785
public function clean($value)
  {
    // Return null for empty strings.
    if ($value==='' || $value===null || $value===false)
    {
      return null;
    }

    // Replace all ambiguous characters.
    $tmp = $value;
    foreach ($this->ambiguities as $unambiguity => $ambiguities)
    {
      foreach ($ambiguities as $ambiguity)
      {
        // Note: str_replace works fine with multi byte characters like UTF-8.
        $tmp = str_replace($ambiguity, $unambiguity, $tmp);
      }
    }

    // Restore EOL for DOS users.
    if (PHP_EOL!="\n") $tmp = str_replace("\n", PHP_EOL, $tmp);

    // Return null for empty strings.
    if ($tmp==='') $tmp = null;

    return $tmp;
  }
831454
protected function filter(&$value)
	{
		if (is_scalar($value)) {
			return htmlspecialchars($value, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
		} elseif (is_array($value)){
			array_walk_recursive($value, [$this, 'filter']);
		} elseif (is_object($value)) {
			foreach (get_object_vars($value) as $k => $v) {
				$value->$k = $this->filter($value);
			}
		}

		return $value;
	}