Sanitize a value

@param   mixed   $value Value to be sanitized
@return  int
503306
public function sanitize($value)
    {
        $value = (int) filter_var($value, FILTER_SANITIZE_NUMBER_INT);

        if(isset($this->max) && $value > (int) $this->max) {
            $value = (int) $this->max;
        }

        if(isset($this->min) && $value < (int) $this->min) {
            $value = (int) $this->min;
        }

        return $value;
    }
1330637
public static function FILTER_SANITIZE_HTTP_URL($value)
	{
		if( !preg_match('/^http/i', $value)){
			$value = 'http://'.$value;
		}
		$value =  filter_var($value, FILTER_VALIDATE_URL);
		
		return $value?:null;	
	}
513520
public function sanitize($value)
    {
        if ($value instanceof Traversable) {
            return $this->sanitize(iterator_to_array($value));
        } elseif (is_array($value)) {
            return array_map([$this, 'sanitize'], $value);
        } elseif (is_object($value)) {
            return $this->sanitizeObject($value);
        } elseif (is_resource($value)) {
            return get_resource_type($value);
        }

        return $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;
    }
91963
protected function sanitize($value)
    {
        $value = escapeshellarg(trim((string) $value));
        $value = str_replace("\n", ' ', $value);

        return $value;
    }
1007249
public static function integer($value) :int {
		if(strrpos($value, '.')) {
			$value = str_replace(',', '' , $value);
		}
		elseif(strrpos($value, ',')) {
			$value = str_replace('.', '' , $value);
		} 
		return(intval(preg_replace('/[^0-9.\-]/', '', str_replace(',', '.' , $value))));
	}
456465
private function sanitize($value)
    {
        if ($value === null) {
            $value = 'null';
        }

        if (is_array($value)) {
            $value = 'array';
        }

        if (is_bool($value)) {
            $value = $value
                ? 'true'
                : 'false';
        }

        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;
	}
728189
protected function _sanitize($value)
    {
        $value = trim(str_replace('\\', '/', $value));
        preg_match(self::PATTERN, $value, $matches);
        $match = isset($matches[0]) ? $matches[0] : '';

        return $match;
    }
735805
protected function _validate($value)
    {
        $value = trim($value);
        return ((string) $value === $this->sanitize($value));
    }
293228
public function sanitize($value)
    {
        $value = (string) $value;

        if (!empty($value)) {
            $value = JComponentHelper::filterText($value);
        }

        return $value;
    }
739517
public function clean($value)
    {
        if ($value === true || $value === false) {
            return $value;
        } elseif (is_array($value)) {
            foreach ($value as $k => $v) {
                $value[$k] = $this->clean($v);
            }
        } else {
            $value = preg_replace('/^\"|\"$/', '', $value);
            $value = stripcslashes($value);
        }

        return $value;
    }
1369883
public function sanitize($value)
    {
        $value      = trim(strtolower($value));
        $pattern    = '/[^a-f0-9]*/';
        return substr(preg_replace($pattern, '', $value), 0, 32);
    }
133365
public function protectedTrim($value)
    {
        for ($i = count($value) - 1; $i >= 0; -- $i) {
            if ($value[$i]) {
                break;
            }
            unset($value[$i]);
        }
        return $value;
    }
922897
public static function sanitize( $value ) {
		if ( ! is_array( $value ) ) {
			return [];
		}
		foreach ( $value as $key => $val ) {
			$value[ $key ] = Color::sanitize( $val );
		}
		return $value;
	}
987926
protected function sanitize($value, $key = null, $regex = '/\s+/', $replace = ' ')
    {
        $value = $this->checkValue($value, $key);

        return $value == null ? null : utf8_decode(trim(preg_replace($regex, $replace, $value)));
    }
117248
public function validate($value)
    {
        $value = trim($value);
        return (is_string($value) && ($value === filter_var($value, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES)));
    }